clase Debug ara carrega la posicio i habitacio inicial desde un fitxer

This commit is contained in:
2026-03-28 20:15:44 +01:00
parent 71c7b8e553
commit 268763f162
6 changed files with 93 additions and 15 deletions

View File

@@ -89,21 +89,11 @@ namespace Defaults::Localization {
} // namespace Defaults::Localization
namespace Defaults::Game::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
constexpr const char* INITIAL = "03.yaml"; // Habitación de inicio
} // namespace Defaults::Game::Room
namespace Defaults::Game::Player {
#ifdef _DEBUG
constexpr int SPAWN_X = 26 * 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
constexpr int SPAWN_X = 25 * Tile::SIZE; // Posición X inicial
constexpr int SPAWN_Y = 13 * Tile::SIZE; // Posición Y inicial
constexpr SDL_FlipMode SPAWN_FLIP = Flip::LEFT; // Orientación inicial
} // namespace Defaults::Game::Player

View File

@@ -42,8 +42,13 @@ Game::Game(Mode mode)
room_tracker_(std::make_shared<RoomTracker>()),
stats_(std::make_shared<Stats>(Resource::List::get()->get("stats.csv"), Resource::List::get()->get("stats_buffer.csv"))),
mode_(mode),
#ifdef _DEBUG
current_room_(Debug::get()->getSpawnSettings().room),
spawn_data_(Player::SpawnData(Debug::get()->getSpawnSettings().spawn_x, Debug::get()->getSpawnSettings().spawn_y, 0, 0, 0, Player::State::ON_GROUND, Debug::get()->getSpawnSettings().flip)) {
#else
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)) {
#endif
// Crea objetos e inicializa variables
ItemTracker::init();
demoInit();