- faltaven varios sources al makefile

- help de la consola organitzat
- modificats alguns comandos i comentaris de la consola
- habilitat render_info en release
This commit is contained in:
2026-03-29 23:15:12 +02:00
parent 301e0145fb
commit e13a28f69a
16 changed files with 1643 additions and 18152 deletions

View File

@@ -147,7 +147,7 @@ class Player {
// --- Variables de juego ---
bool is_alive_ = true; // Indica si el jugador esta vivo o no
bool is_paused_ = false; // Indica si el jugador esta en modo pausa
bool ignore_input_ = false; // Ignora inputs pero mantiene la física activa
bool ignore_input_ = false; // Ignora inputs pero mantiene la física activa
bool auto_movement_ = false; // Indica si esta siendo arrastrado por una superficie automatica
Room::Border border_ = Room::Border::TOP; // Indica en cual de los cuatro bordes se encuentra
int last_grounded_position_ = 0; // Ultima posición en Y en la que se estaba en contacto con el suelo (hace doble función: tracking de caída + altura inicial del salto)

View File

@@ -17,6 +17,7 @@
#include "core/resources/resource_list.hpp" // Para Asset
#include "core/system/global_events.hpp" // Para check
#include "game/defaults.hpp" // Para Defaults::Game
#include "game/game_control.hpp" // Para GameControl
#include "game/gameplay/cheevos.hpp" // Para Cheevos
#include "game/gameplay/item_tracker.hpp" // Para ItemTracker
#include "game/gameplay/room.hpp" // Para Room, RoomData
@@ -32,7 +33,6 @@
#ifdef _DEBUG
#include "core/system/debug.hpp" // Para Debug
#include "game/game_control.hpp" // Para GameControl
#endif
// Constructor
@@ -147,7 +147,7 @@ void Game::handleInput() {
Input::get()->update();
// Inputs globales siempre funcionan
if (Input::get()->checkAction(InputAction::TOGGLE_MUSIC, Input::DO_NOT_ALLOW_REPEAT)) {
if (Input::get()->checkAction(InputAction::TOGGLE_IN_GAME_MUSIC, Input::DO_NOT_ALLOW_REPEAT)) {
scoreboard_data_->music = !scoreboard_data_->music;
scoreboard_data_->music ? Audio::get()->resumeMusic() : Audio::get()->pauseMusic();
Notifier::get()->show({scoreboard_data_->music ? Locale::get()->get("game.music_enabled") : Locale::get()->get("game.music_disabled")});

View File

@@ -4,6 +4,7 @@
#include <cctype> // Para toupper
#include <functional> // Para function
#include <iostream> // Para std::cout
#include <string> // Para string
#include <vector> // Para vector
@@ -73,40 +74,58 @@ static auto parseTokens(const std::string& input) -> std::vector<std::string> {
// Texto de ayuda común para HELP y ?
static void printHelp() {
SDL_Log("=== JDD CONSOLE COMMANDS ===");
SDL_Log(" SS [ON|OFF|SIZE] Supersampling");
SDL_Log(" SS UPSCALE [NEAREST|LINEAR] SS upscale filter");
SDL_Log(" SS DOWNSCALE [BILINEAR|LANCZOS2|LANCZOS3] SS downscale algorithm");
SDL_Log(" SHADER [ON|OFF|NEXT [PRESET]|POSTFX|CRTPI] Toggle/select shader (F4)");
SDL_Log(" SET PLAYER SKIN <1|2> Change player skin (GAME only)");
SDL_Log(" BORDER [ON|OFF] Decorative border (B)");
SDL_Log(" FULLSCREEN [ON|OFF] Fullscreen mode (F3)");
SDL_Log(" ZOOM [UP|DOWN] Window zoom (F1/F2)");
SDL_Log(" INTSCALE [ON|OFF] Integer scaling (F7)");
SDL_Log(" VSYNC [ON|OFF] Vertical sync");
SDL_Log(" DRIVER [LIST|AUTO|NONE|<name>] GPU driver (restart to apply)");
SDL_Log(" PALETTE [NEXT|PREV] Color palette (F5/F6)");
std::cout << "=== JDD CONSOLE COMMANDS ===" << '\n';
std::cout << '\n';
std::cout << "[VIDEO]" << '\n';
std::cout << " SS [ON|OFF|SIZE] Supersampling" << '\n';
std::cout << " SS UPSCALE [NEAREST|LINEAR] SS upscale filter" << '\n';
std::cout << " SS DOWNSCALE [BILINEAR|LANCZOS2|LANCZOS3] SS downscale algorithm" << '\n';
std::cout << " SHADER [ON|OFF|NEXT [PRESET]|POSTFX|CRTPI] Toggle/select shader (F4)" << '\n';
std::cout << " BORDER [ON|OFF] Decorative border (B)" << '\n';
std::cout << " FULLSCREEN [ON|OFF] Fullscreen mode (F3)" << '\n';
std::cout << " ZOOM [UP|DOWN] Window zoom (F1/F2)" << '\n';
std::cout << " INTSCALE [ON|OFF] Integer scaling (F7)" << '\n';
std::cout << " VSYNC [ON|OFF] Vertical sync" << '\n';
std::cout << " DRIVER [LIST|AUTO|NONE|<name>] GPU driver (restart to apply)" << '\n';
std::cout << " PALETTE [NEXT|PREV] Color palette (F5/F6)" << '\n';
std::cout << '\n';
std::cout << "[AUDIO]" << '\n';
std::cout << " AUDIO [ON|OFF|VOL <0-100>] Audio master" << '\n';
std::cout << " MUSIC [ON|OFF|VOL <0-100>] Music volume" << '\n';
std::cout << " SOUND [ON|OFF|VOL <0-100>] Sound volume" << '\n';
std::cout << '\n';
std::cout << "[GAME]" << '\n';
std::cout << " SET PLAYER SKIN <1|2> Change player skin (GAME only)" << '\n';
std::cout << " RESTART Restart from the beginning" << '\n';
std::cout << " KIOSK [ON] Enable kiosk mode" << '\n';
std::cout << " EXIT / QUIT Quit application" << '\n';
std::cout << '\n';
std::cout << "[INFO]" << '\n';
std::cout << " SHOW [INFO] Show info overlay" << '\n';
std::cout << " HIDE [INFO] Hide info overlay" << '\n';
std::cout << " SIZE Window size in pixels" << '\n';
std::cout << " HELP / ? Show this help in terminal" << '\n';
#ifdef _DEBUG
SDL_Log(" DEBUG Toggle debug overlay (F12)");
SDL_Log(" ROOM <1-60>|NEXT|PREV Change to room number (GAME only)");
SDL_Log(" SET INITIAL [ROOM|POS] Set initial room/position from current state (GAME only)");
SDL_Log(" SET INITIAL SCENE [<name>] Set initial debug scene (GAME|LOGO|TITLE|LOADING|CREDITS|ENDING|ENDING2)");
SDL_Log(" SET ITEMS <0-200> Set collected items count (GAME only)");
SDL_Log(" CHEAT INFINITE LIVES [ON|OFF] Infinite lives (GAME only)");
SDL_Log(" CHEAT INVINCIBILITY [ON|OFF] Invincibility (GAME only)");
SDL_Log(" CHEAT OPEN THE JAIL Open the jail (GAME only)");
SDL_Log(" CHEAT CLOSE THE JAIL Close the jail (GAME only)");
std::cout << '\n';
std::cout << "[DEBUG]" << '\n';
std::cout << " DEBUG Toggle debug overlay (F12)" << '\n';
std::cout << " ROOM <1-60>|NEXT|PREV Change to room number (GAME only)" << '\n';
std::cout << " SCENE [LOGO|LOADING|TITLE|CREDITS|GAME|ENDING|ENDING2|RESTART]" << '\n';
std::cout << " SET INITIAL [ROOM|POS] Set initial room/position from current state (GAME only)" << '\n';
std::cout << " SET INITIAL SCENE [<name>] Set initial debug scene (GAME|LOGO|TITLE|LOADING|CREDITS|ENDING|ENDING2)" << '\n';
std::cout << " SET ITEMS <0-200> Set collected items count (GAME only)" << '\n';
std::cout << " CHEAT INFINITE LIVES [ON|OFF] Infinite lives (GAME only)" << '\n';
std::cout << " CHEAT INVINCIBILITY [ON|OFF] Invincibility (GAME only)" << '\n';
std::cout << " CHEAT OPEN THE JAIL Open the jail (GAME only)" << '\n';
std::cout << " CHEAT CLOSE THE JAIL Close the jail (GAME only)" << '\n';
std::cout << " SHOW NOTIFICATION Test notification popup" << '\n';
std::cout << " SHOW CHEEVO Test achievement notification" << '\n';
#endif
SDL_Log(" AUDIO [ON|OFF|VOL <0-100>] Audio master");
SDL_Log(" MUSIC [ON|OFF|VOL <0-100>] Music volume");
SDL_Log(" SOUND [ON|OFF|VOL <0-100>] Sound volume");
SDL_Log(" SCENE [LOGO|LOADING|TITLE|CREDITS|GAME|ENDING|ENDING2|RESTART]");
SDL_Log(" SIZE Window size in pixels");
SDL_Log(" KIOSK [ON] Enable kiosk mode");
SDL_Log(" EXIT / QUIT Quit application");
SDL_Log(" SHOW [FPS|INFO|NOTIFICATION|CHEEVO] Show debug overlay or test notification");
SDL_Log(" HIDE [FPS|INFO] Hide debug overlay");
SDL_Log(" HELP/? Show this help in terminal");
}
// Tabla de comandos disponibles
@@ -176,14 +195,14 @@ static const std::vector<ConsoleCommand> COMMANDS = {
return std::string("Shaders ") + (Options::video.postfx ? "ON" : "OFF");
}
if (args[0] == "ON") {
if (Options::video.postfx) { return "Shaders already ON"; }
if (Options::video.postfx) { return "Shader already ON"; }
Screen::get()->toggleShaders();
return "Shaders ON";
return "Shader ON";
}
if (args[0] == "OFF") {
if (!Options::video.postfx) { return "Shaders already OFF"; }
if (!Options::video.postfx) { return "Shader already OFF"; }
Screen::get()->toggleShaders();
return "Shaders OFF";
return "Shader OFF";
}
if (args[0] == "POSTFX") {
Screen::get()->setActiveShader(Rendering::ShaderType::POSTFX);
@@ -375,28 +394,6 @@ static const std::vector<ConsoleCommand> COMMANDS = {
return std::string("Debug mode ") + (Debug::get()->isEnabled() ? "ON" : "OFF");
}},
// SHOW FPS / SHOW INFO / SHOW NOTIFICATION / SHOW CHEEVO / HIDE FPS / HIDE INFO
{.keyword = "SHOW", .execute = [](const std::vector<std::string>& args) -> std::string {
if (!args.empty() && args[0] == "NOTIFICATION") {
Notifier::get()->show({"NOTIFICATION"});
return "Notification shown";
}
if (!args.empty() && args[0] == "CHEEVO") {
Notifier::get()->show({Locale::get()->get("achievements.header"), Locale::get()->get("achievements.c1")}, Notifier::Style::CHEEVO, -1, false); // NOLINT(readability-static-accessed-through-instance)
return "Cheevo notification shown";
}
if (args.empty() || (args[0] != "FPS" && args[0] != "INFO")) { return "Usage: SHOW [FPS|INFO|NOTIFICATION|CHEEVO]"; }
if (RenderInfo::get()->isActive()) { return "Info overlay already ON"; }
RenderInfo::get()->toggle();
return "Info overlay ON";
}},
{.keyword = "HIDE", .execute = [](const std::vector<std::string>& args) -> std::string {
if (args.empty() || (args[0] != "FPS" && args[0] != "INFO")) { return "Usage: HIDE [FPS|INFO]"; }
if (!RenderInfo::get()->isActive()) { return "Info overlay already OFF"; }
RenderInfo::get()->toggle();
return "Info overlay OFF";
}},
// ROOM <num>|NEXT|PREV — Cambia a la habitación indicada (1-60); solo en escena GAME
{.keyword = "ROOM", .execute = [](const std::vector<std::string>& args) -> std::string {
if (SceneManager::current != SceneManager::Scene::GAME) { return "Only available in GAME scene"; }
@@ -425,6 +422,34 @@ static const std::vector<ConsoleCommand> COMMANDS = {
#endif
// SHOW INFO — disponible en Release; SHOW NOTIFICATION / SHOW CHEEVO — solo en Debug
{.keyword = "SHOW", .execute = [](const std::vector<std::string>& args) -> std::string {
#ifdef _DEBUG
if (!args.empty() && args[0] == "NOTIFICATION") {
Notifier::get()->show({"NOTIFICATION"});
return "Notification shown";
}
if (!args.empty() && args[0] == "CHEEVO") {
Notifier::get()->show({Locale::get()->get("achievements.header"), Locale::get()->get("achievements.c1")}, Notifier::Style::CHEEVO, -1, false); // NOLINT(readability-static-accessed-through-instance)
return "Cheevo notification shown";
}
if (args.empty() || args[0] != "INFO") { return "Usage: SHOW [INFO|NOTIFICATION|CHEEVO]"; }
#else
if (args.empty() || args[0] != "INFO") { return "Usage: SHOW [INFO]"; }
#endif
if (RenderInfo::get()->isActive()) { return "Info overlay already ON"; }
RenderInfo::get()->toggle();
return "Info overlay ON";
}},
// HIDE INFO — disponible en Release
{.keyword = "HIDE", .execute = [](const std::vector<std::string>& args) -> std::string {
if (args.empty() || args[0] != "INFO") { return "Usage: HIDE [INFO]"; }
if (!RenderInfo::get()->isActive()) { return "Info overlay already OFF"; }
RenderInfo::get()->toggle();
return "Info overlay OFF";
}},
// CHEAT <subcomando> — Trucos de juego; solo en escena GAME; no aparece en ayuda en builds Release
{.keyword = "CHEAT", .execute = [](const std::vector<std::string>& args) -> std::string {
if (SceneManager::current != SceneManager::Scene::GAME) { return "Only available in GAME scene"; }
@@ -576,7 +601,8 @@ static const std::vector<ConsoleCommand> COMMANDS = {
#endif
}},
// SCENE [LOGO|LOADING|TITLE|CREDITS|GAME|ENDING|ENDING2|RESTART] — Cambiar o reiniciar escena
#ifdef _DEBUG
// SCENE [LOGO|LOADING|TITLE|CREDITS|GAME|ENDING|ENDING2|RESTART] — Cambiar o reiniciar escena; solo en Debug
{.keyword = "SCENE", .execute = [](const std::vector<std::string>& args) -> std::string {
if (Options::kiosk.enabled) { return "Not allowed in kiosk mode"; }
if (args.empty()) { return "Usage: SCENE [LOGO|LOADING|TITLE|CREDITS|GAME|ENDING|ENDING2|RESTART]"; }
@@ -608,6 +634,7 @@ static const std::vector<ConsoleCommand> COMMANDS = {
if (args[0] == "ENDING2") { return GO_TO(SceneManager::Scene::ENDING2, "Ending 2"); }
return "Unknown scene: " + args[0];
}},
#endif
// RESTART — Reiniciar desde el principio (equivale a SCENE LOGO)
{.keyword = "RESTART", .execute = [](const std::vector<std::string>&) -> std::string {

View File

@@ -2,10 +2,10 @@
#include <SDL3/SDL.h>
#include <deque> // Para deque (historial)
#include <functional> // Para function
#include <memory> // Para shared_ptr
#include <string> // Para string
#include <deque> // Para deque (historial)
#include <functional> // Para function
#include <memory> // Para shared_ptr
#include <string> // Para string
class Surface;
class Sprite;