From f2e45940d54bde6663b03de8bfb3bf803e820d20 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Sun, 8 Mar 2026 10:09:30 +0100 Subject: [PATCH] =?UTF-8?q?afegit=20a=20defaults=20la=20habitaci=C3=B3=20i?= =?UTF-8?q?=20posici=C3=B3=20inicials=20(normal=20i=20debug)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/game/defaults.hpp | 25 +++++++++++++++++++++++++ source/game/scenes/game.cpp | 10 +++------- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/source/game/defaults.hpp b/source/game/defaults.hpp index 2ad72efe..3b39f5d9 100644 --- a/source/game/defaults.hpp +++ b/source/game/defaults.hpp @@ -95,4 +95,29 @@ constexpr const char* TEXT = ""; // Texto del modo kiosko por defecto constexpr bool INFINITE_LIVES = false; // Vidas infinitas en modo kiosko desactivadas por defecto } // namespace Kiosk +// --- GAME (posición y habitación inicial) --- +namespace Game { + +namespace Room { +#ifdef _DEBUG + constexpr const char* INITIAL = "51.yaml"; // Habitación de inicio en debug +#else + constexpr const char* INITIAL = "03.yaml"; // Habitación de inicio en release +#endif +} // namespace Room + +namespace Player { +#ifdef _DEBUG + constexpr int SPAWN_X = 28 * Tile::SIZE; // Posición X inicial en debug + constexpr int SPAWN_Y = 10 * Tile::SIZE; // Posición Y inicial en debug + constexpr SDL_FlipMode SPAWN_FLIP = Flip::LEFT; // Orientación inicial en debug +#else + constexpr int SPAWN_X = 25 * Tile::SIZE; // Posición X inicial en release + constexpr int SPAWN_Y = 13 * Tile::SIZE; // Posición Y inicial en release + constexpr SDL_FlipMode SPAWN_FLIP = Flip::LEFT; // Orientación inicial en release +#endif +} // namespace Player + +} // namespace Game + } // namespace Defaults diff --git a/source/game/scenes/game.cpp b/source/game/scenes/game.cpp index 075b3a25..caf964c8 100644 --- a/source/game/scenes/game.cpp +++ b/source/game/scenes/game.cpp @@ -26,6 +26,7 @@ #include "game/ui/notifier.hpp" // Para Notifier, NotificationText, CHEEVO_NO... #include "utils/defines.hpp" // Para Tile::SIZE, PlayArea::HEIGHT, RoomBorder::BOTTOM #include "utils/utils.hpp" // Para PaletteColor, stringToColor +#include "game/defaults.hpp" // Para Defaults::Game #ifdef _DEBUG #include "core/system/debug.hpp" // Para Debug @@ -38,13 +39,8 @@ Game::Game(Mode mode) room_tracker_(std::make_shared()), stats_(std::make_shared(Resource::List::get()->get("stats.csv"), Resource::List::get()->get("stats_buffer.csv"))), mode_(mode), -#ifdef _DEBUG - current_room_("03.yaml"), - spawn_data_(Player::SpawnData(25 * Tile::SIZE, 13 * Tile::SIZE, 0, 0, 0, Player::State::ON_GROUND, Flip::LEFT)) -#else - current_room_("03.yaml"), - spawn_data_(Player::SpawnData(25 * Tile::SIZE, 13 * Tile::SIZE, 0, 0, 0, Player::State::ON_GROUND, Flip::LEFT)) -#endif + current_room_(Defaults::Game::Room::INITIAL), + spawn_data_(Player::SpawnData(Defaults::Game::Player::SPAWN_X, Defaults::Game::Player::SPAWN_Y, 0, 0, 0, Player::State::ON_GROUND, Defaults::Game::Player::SPAWN_FLIP)) { // Crea objetos e inicializa variables ItemTracker::init();