establir la posicio i habitacio inicial de debug desde la consola

This commit is contained in:
2026-03-28 20:36:56 +01:00
parent 268763f162
commit 7483bf63c8
4 changed files with 48 additions and 0 deletions

View File

@@ -92,6 +92,7 @@ static void printHelp() {
SDL_Log(" INVENCIBILITY [ON|OFF] Invincibility cheat (GAME only)");
SDL_Log(" OPEN THE JAIL Open the jail (GAME only)");
SDL_Log(" CLOSE THE JAIL Close the jail (GAME only)");
SDL_Log(" SET INITIAL [ROOM|POS] Set initial room/position from current state (GAME only)");
#endif
SDL_Log(" AUDIO [ON|OFF|VOL <0-100>] Audio master");
SDL_Log(" MUSIC [ON|OFF|VOL <0-100>] Music volume");
@@ -449,6 +450,26 @@ static const std::vector<ConsoleCommand> COMMANDS = {
Options::cheats.jail_is_open = Options::Cheat::State::DISABLED;
return "Jail closed";
}},
// SET INITIAL [ROOM|POS] — guarda habitación/posición actual como inicio en debug.yaml; solo escena GAME
{.keyword = "SET", .execute = [](const std::vector<std::string>& args) -> std::string {
if (SceneManager::current != SceneManager::Scene::GAME) { return "Only available in GAME scene"; }
if (args.empty() || args[0] != "INITIAL") { return "Usage: SET INITIAL [ROOM|POS]"; }
const bool DO_ROOM = args.size() == 1 || (args.size() >= 2 && args[1] == "ROOM");
const bool DO_POS = args.size() == 1 || (args.size() >= 2 && args[1] == "POS");
if (!DO_ROOM && !DO_POS) { return "Usage: SET INITIAL [ROOM|POS]"; }
if (!GameControl::set_initial_room || !GameControl::set_initial_pos) { return "Game not initialized"; }
std::string result;
if (DO_ROOM) { result = GameControl::set_initial_room(); }
if (DO_POS) {
if (!result.empty()) { result += ", "; }
result += GameControl::set_initial_pos();
}
return result;
}},
#endif
// SCENE [LOGO|LOADING|TITLE|CREDITS|GAME|ENDING|ENDING2|RESTART] — Cambiar o reiniciar escena