From d3a5c0e54fe7d3b9cf39e5e2632a274b9c9f148c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Valor=20Mart=C3=ADnez?= Date: Thu, 1 Dec 2022 22:07:03 +0100 Subject: [PATCH] =?UTF-8?q?Cambiado=20el=20tama=C3=B1o=20de=20la=20textura?= =?UTF-8?q?=20usado=20para=20pintar=20el=20mapa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/common/utils.h | 1 + source/director.cpp | 1 + source/enter_id.cpp | 11 ++++++++++- source/room.cpp | 5 +++-- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/source/common/utils.h b/source/common/utils.h index a5834a0..2dd9e2b 100644 --- a/source/common/utils.h +++ b/source/common/utils.h @@ -101,6 +101,7 @@ struct cheat_t struct online_t { bool enabled; // Indica si se quiere usar el modo online o no + bool sessionEnabled; // Indica ya se ha hecho login std::string server; // Servidor para los servicios online int port; // Puerto del servidor std::string gameID; // Identificador del juego para los servicios online diff --git a/source/director.cpp b/source/director.cpp index 990ab7e..4f2bff2 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -144,6 +144,7 @@ void Director::initOptions() // Opciones online options->online.enabled = true; + options->online.sessionEnabled = false; options->online.server = "jaildoctor.duckdns.org"; options->online.port = 9911; #ifdef DEBUG diff --git a/source/enter_id.cpp b/source/enter_id.cpp index 59227d2..62607de 100644 --- a/source/enter_id.cpp +++ b/source/enter_id.cpp @@ -281,6 +281,11 @@ void EnterID::switchPalette() // Inicializa los servicios online void EnterID::initOnline() { + if (options->online.sessionEnabled) + { // Si ya ha iniciado la sesión, que no continue + return; + } + if (options->online.jailerID == "") { // Jailer ID no definido @@ -289,10 +294,14 @@ void EnterID::initOnline() else { // Jailer ID iniciado - options->online.enabled = true; + options->online.enabled = options->online.sessionEnabled = true; jscore::init(options->online.server, options->online.port); +#ifdef DEBUG + const std::string caption = options->online.jailerID + " IS LOGGED IN (DEBUG)"; +#else const std::string caption = options->online.jailerID + " IS LOGGED IN"; +#endif screen->showNotification(caption); if (options->console) { diff --git a/source/room.cpp b/source/room.cpp index 980eaad..cf12875 100644 --- a/source/room.cpp +++ b/source/room.cpp @@ -473,7 +473,7 @@ Room::Room(room_t *room, SDL_Renderer *renderer, Screen *screen, Asset *asset, o setAnimatedTiles(); // Crea la textura para el mapa de tiles de la habitación - mapTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, GAMECANVAS_WIDTH, GAMECANVAS_HEIGHT); + mapTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, PLAY_AREA_WIDTH, PLAY_AREA_HEIGHT); if (mapTexture == nullptr) { if (options->console) @@ -665,7 +665,8 @@ void Room::fillMapTexture() void Room::renderMap() { // Dibuja la textura con el mapa en pantalla - SDL_RenderCopy(renderer, mapTexture, nullptr, nullptr); + static SDL_Rect dest = {0, 0, PLAY_AREA_WIDTH, PLAY_AREA_HEIGHT}; + SDL_RenderCopy(renderer, mapTexture, nullptr, &dest); // Dibuja los tiles animados #ifdef DEBUG