reorganitzats els comandos de consola
This commit is contained in:
@@ -75,21 +75,20 @@ static auto parseTokens(const std::string& input) -> std::vector<std::string> {
|
||||
static void printHelp() {
|
||||
SDL_Log("=== JDD CONSOLE COMMANDS ===");
|
||||
SDL_Log(" SS [ON|OFF|SIZE] Supersampling");
|
||||
SDL_Log(" SHADERS [ON|OFF|NEXT [PRESET]] Toggle/next shader or preset (F4/Shift+F4)");
|
||||
SDL_Log(" SET SHADER [POSTFX|CRTPI] Set active shader");
|
||||
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(" UPSCALE [NEAREST|LINEAR] SS upscale filter (toggle if no arg)");
|
||||
SDL_Log(" DOWNSCALE [BILINEAR|LANCZOS2|LANCZOS3] SS downscale algorithm");
|
||||
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)");
|
||||
#ifdef _DEBUG
|
||||
SDL_Log(" DEBUG Toggle debug overlay (F12)");
|
||||
SDL_Log(" ROOM <1-60> Change to room number (GAME only)");
|
||||
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)");
|
||||
@@ -112,14 +111,47 @@ static void printHelp() {
|
||||
|
||||
// Tabla de comandos disponibles
|
||||
static const std::vector<ConsoleCommand> COMMANDS = {
|
||||
// SS [ON|OFF|SIZE] — Supersampling
|
||||
// SS [ON|OFF|SIZE|UPSCALE [NEAREST|LINEAR]|DOWNSCALE [BILINEAR|LANCZOS2|LANCZOS3]] — Supersampling
|
||||
{.keyword = "SS", .execute = [](const std::vector<std::string>& args) -> std::string {
|
||||
static const std::array<std::string_view, 3> DOWNSCALE_NAMES = {"Bilinear", "Lanczos2", "Lanczos3"};
|
||||
if (!args.empty() && args[0] == "SIZE") {
|
||||
if (!Options::video.supersampling) { return "Supersampling is OFF: no texture"; }
|
||||
const auto [w, h] = Screen::get()->getSsTextureSize();
|
||||
if (w == 0) { return "SS texture: not active"; }
|
||||
return "SS texture: " + std::to_string(w) + "x" + std::to_string(h);
|
||||
}
|
||||
if (!args.empty() && args[0] == "UPSCALE") {
|
||||
if (args.size() == 1) {
|
||||
Screen::get()->setLinearUpscale(!Options::video.linear_upscale);
|
||||
return std::string("Upscale: ") + (Options::video.linear_upscale ? "Linear" : "Nearest");
|
||||
}
|
||||
if (args[1] == "NEAREST") {
|
||||
if (!Options::video.linear_upscale) { return "Upscale already Nearest"; }
|
||||
Screen::get()->setLinearUpscale(false);
|
||||
return "Upscale: Nearest";
|
||||
}
|
||||
if (args[1] == "LINEAR") {
|
||||
if (Options::video.linear_upscale) { return "Upscale already Linear"; }
|
||||
Screen::get()->setLinearUpscale(true);
|
||||
return "Upscale: Linear";
|
||||
}
|
||||
return "Usage: SS UPSCALE [NEAREST|LINEAR]";
|
||||
}
|
||||
if (!args.empty() && args[0] == "DOWNSCALE") {
|
||||
if (args.size() == 1) {
|
||||
return std::string("Downscale: ") + std::string(DOWNSCALE_NAMES[static_cast<size_t>(Options::video.downscale_algo)]);
|
||||
}
|
||||
int algo = -1;
|
||||
if (args[1] == "BILINEAR") { algo = 0; }
|
||||
if (args[1] == "LANCZOS2") { algo = 1; }
|
||||
if (args[1] == "LANCZOS3") { algo = 2; }
|
||||
if (algo == -1) { return "Usage: SS DOWNSCALE [BILINEAR|LANCZOS2|LANCZOS3]"; }
|
||||
if (Options::video.downscale_algo == algo) {
|
||||
return std::string("Downscale already ") + std::string(DOWNSCALE_NAMES[static_cast<size_t>(algo)]);
|
||||
}
|
||||
Screen::get()->setDownscaleAlgo(algo);
|
||||
return std::string("Downscale: ") + std::string(DOWNSCALE_NAMES[static_cast<size_t>(algo)]);
|
||||
}
|
||||
if (args.empty()) {
|
||||
Screen::get()->toggleSupersampling();
|
||||
return std::string("PostFX Supersampling ") + (Options::video.supersampling ? "ON" : "OFF");
|
||||
@@ -134,11 +166,11 @@ static const std::vector<ConsoleCommand> COMMANDS = {
|
||||
Screen::get()->toggleSupersampling();
|
||||
return "PostFX Supersampling OFF";
|
||||
}
|
||||
return "Usage: SS [ON|OFF|SIZE]";
|
||||
return "Usage: SS [ON|OFF|SIZE|UPSCALE [NEAREST|LINEAR]|DOWNSCALE [BILINEAR|LANCZOS2|LANCZOS3]]";
|
||||
}},
|
||||
|
||||
// SHADERS [ON|OFF|NEXT [PRESET]] — Toggle/cicla shaders (F4 / Shift+F4 / Ctrl+F4)
|
||||
{.keyword = "SHADERS", .execute = [](const std::vector<std::string>& args) -> std::string {
|
||||
// SHADER [ON|OFF|NEXT [PRESET]|POSTFX|CRTPI] — Toggle/cicla/selecciona shader (F4 / Shift+F4)
|
||||
{.keyword = "SHADER", .execute = [](const std::vector<std::string>& args) -> std::string {
|
||||
if (args.empty()) {
|
||||
Screen::get()->toggleShaders();
|
||||
return std::string("Shaders ") + (Options::video.postfx ? "ON" : "OFF");
|
||||
@@ -153,8 +185,16 @@ static const std::vector<ConsoleCommand> COMMANDS = {
|
||||
Screen::get()->toggleShaders();
|
||||
return "Shaders OFF";
|
||||
}
|
||||
if (args[0] == "POSTFX") {
|
||||
Screen::get()->setActiveShader(Rendering::ShaderType::POSTFX);
|
||||
return "Shader: POSTFX";
|
||||
}
|
||||
if (args[0] == "CRTPI") {
|
||||
Screen::get()->setActiveShader(Rendering::ShaderType::CRTPI);
|
||||
return "Shader: CRTPI";
|
||||
}
|
||||
if (args[0] == "NEXT") {
|
||||
// SHADERS NEXT PRESET → cicla presets del shader activo
|
||||
// SHADER NEXT PRESET → cicla presets del shader activo
|
||||
if (args.size() >= 2 && args[1] == "PRESET") {
|
||||
if (Options::current_shader == Rendering::ShaderType::CRTPI) {
|
||||
if (Options::crtpi_presets.empty()) { return "No CrtPi presets available"; }
|
||||
@@ -173,12 +213,12 @@ static const std::vector<ConsoleCommand> COMMANDS = {
|
||||
return "PostFX preset: " +
|
||||
Options::postfx_presets[static_cast<size_t>(Options::current_postfx_preset)].name;
|
||||
}
|
||||
// SHADERS NEXT → cicla entre tipos de shader (POSTFX ↔ CRTPI)
|
||||
// SHADER NEXT → cicla entre tipos de shader (POSTFX ↔ CRTPI)
|
||||
Screen::get()->nextShader();
|
||||
return std::string("Shader: ") +
|
||||
(Options::current_shader == Rendering::ShaderType::CRTPI ? "CRTPI" : "POSTFX");
|
||||
}
|
||||
return "Usage: SHADERS [ON|OFF|NEXT [PRESET]]";
|
||||
return "Usage: SHADER [ON|OFF|NEXT [PRESET]|POSTFX|CRTPI]";
|
||||
}},
|
||||
|
||||
// BORDER [ON|OFF] — Borde decorativo (B)
|
||||
@@ -241,43 +281,6 @@ static const std::vector<ConsoleCommand> COMMANDS = {
|
||||
return std::string("IntScale ") + (Options::video.integer_scale ? "ON" : "OFF");
|
||||
}},
|
||||
|
||||
// UPSCALE [NEAREST|LINEAR] — Filtro de upscale en supersampling
|
||||
{.keyword = "UPSCALE", .execute = [](const std::vector<std::string>& args) -> std::string {
|
||||
if (args.empty()) {
|
||||
Screen::get()->setLinearUpscale(!Options::video.linear_upscale);
|
||||
return std::string("Upscale: ") + (Options::video.linear_upscale ? "Linear" : "Nearest");
|
||||
}
|
||||
if (args[0] == "NEAREST") {
|
||||
if (!Options::video.linear_upscale) { return "Upscale already Nearest"; }
|
||||
Screen::get()->setLinearUpscale(false);
|
||||
return "Upscale: Nearest";
|
||||
}
|
||||
if (args[0] == "LINEAR") {
|
||||
if (Options::video.linear_upscale) { return "Upscale already Linear"; }
|
||||
Screen::get()->setLinearUpscale(true);
|
||||
return "Upscale: Linear";
|
||||
}
|
||||
return "Usage: UPSCALE [NEAREST|LINEAR]";
|
||||
}},
|
||||
|
||||
// DOWNSCALE [BILINEAR|LANCZOS2|LANCZOS3] — Algoritmo de downscale en supersampling
|
||||
{.keyword = "DOWNSCALE", .execute = [](const std::vector<std::string>& args) -> std::string {
|
||||
static const std::array<std::string_view, 3> NAMES = {"Bilinear", "Lanczos2", "Lanczos3"};
|
||||
if (args.empty()) {
|
||||
return std::string("Downscale: ") + std::string(NAMES[static_cast<size_t>(Options::video.downscale_algo)]);
|
||||
}
|
||||
int algo = -1;
|
||||
if (args[0] == "BILINEAR") { algo = 0; }
|
||||
if (args[0] == "LANCZOS2") { algo = 1; }
|
||||
if (args[0] == "LANCZOS3") { algo = 2; }
|
||||
if (algo == -1) { return "Usage: DOWNSCALE [BILINEAR|LANCZOS2|LANCZOS3]"; }
|
||||
if (Options::video.downscale_algo == algo) {
|
||||
return std::string("Downscale already ") + std::string(NAMES[static_cast<size_t>(algo)]);
|
||||
}
|
||||
Screen::get()->setDownscaleAlgo(algo);
|
||||
return std::string("Downscale: ") + std::string(NAMES[static_cast<size_t>(algo)]);
|
||||
}},
|
||||
|
||||
// VSYNC [ON|OFF] — Sincronización vertical
|
||||
{.keyword = "VSYNC", .execute = BOOL_TOGGLE_CMD("VSync", Options::video.vertical_sync, Screen::get()->toggleVSync())},
|
||||
|
||||
@@ -394,14 +397,23 @@ static const std::vector<ConsoleCommand> COMMANDS = {
|
||||
return "Info overlay OFF";
|
||||
}},
|
||||
|
||||
// ROOM <num> — Cambia a la habitación indicada (1-60); solo en escena GAME
|
||||
// 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"; }
|
||||
if (args.empty()) { return "Usage: ROOM <1-60>"; }
|
||||
if (args.empty()) { return "Usage: ROOM <1-60>|NEXT|PREV"; }
|
||||
int num = 0;
|
||||
try {
|
||||
num = std::stoi(args[0]);
|
||||
} catch (...) { return "Usage: ROOM <1-60>"; }
|
||||
if (args[0] == "NEXT" || args[0] == "PREV") {
|
||||
if (!GameControl::get_current_room) { return "Game not initialized"; }
|
||||
const std::string current = GameControl::get_current_room();
|
||||
try {
|
||||
num = std::stoi(current.substr(0, current.find('.')));
|
||||
} catch (...) { return "Cannot determine current room"; }
|
||||
num += (args[0] == "NEXT") ? 1 : -1;
|
||||
} else {
|
||||
try {
|
||||
num = std::stoi(args[0]);
|
||||
} catch (...) { return "Usage: ROOM <1-60>|NEXT|PREV"; }
|
||||
}
|
||||
if (num < 1 || num > 60) { return "Room must be between 1 and 60"; }
|
||||
char buf[16];
|
||||
std::snprintf(buf, sizeof(buf), "%02d.yaml", num);
|
||||
@@ -477,23 +489,11 @@ static const std::vector<ConsoleCommand> COMMANDS = {
|
||||
return "Usage: CHEAT [INFINITE LIVES|INVINCIBILITY|OPEN THE JAIL|CLOSE THE JAIL]";
|
||||
}},
|
||||
|
||||
// SET SHADER [POSTFX|CRTPI] — Activa un shader concreto (disponible en todos los builds)
|
||||
// SET PLAYER SKIN <1|2> — Cambia la skin del jugador (disponible en todos los builds, GAME)
|
||||
// SET INITIAL [ROOM|POS] — Guarda habitación/posición actual como inicio (solo _DEBUG, GAME)
|
||||
// SET INITIAL SCENE [<name>] — Guarda escena como escena inicial de debug (solo _DEBUG)
|
||||
// SET ITEMS <0-200> — Fija el contador de items recogidos (solo _DEBUG, GAME)
|
||||
{.keyword = "SET", .execute = [](const std::vector<std::string>& args) -> std::string {
|
||||
if (!args.empty() && args[0] == "SHADER") {
|
||||
if (args.size() < 2) { return "Usage: SET SHADER [POSTFX|CRTPI]"; }
|
||||
if (args[1] == "POSTFX") {
|
||||
Screen::get()->setActiveShader(Rendering::ShaderType::POSTFX);
|
||||
return "Shader set to POSTFX";
|
||||
}
|
||||
if (args[1] == "CRTPI") {
|
||||
Screen::get()->setActiveShader(Rendering::ShaderType::CRTPI);
|
||||
return "Shader set to CRTPI";
|
||||
}
|
||||
return "Usage: SET SHADER [POSTFX|CRTPI]";
|
||||
}
|
||||
if (args.size() >= 3 && args[0] == "PLAYER" && args[1] == "SKIN") {
|
||||
if (SceneManager::current != SceneManager::Scene::GAME) { return "Only available in GAME scene"; }
|
||||
int num = 0;
|
||||
@@ -556,7 +556,7 @@ static const std::vector<ConsoleCommand> COMMANDS = {
|
||||
return "Items: " + std::to_string(count);
|
||||
}
|
||||
|
||||
if (args.empty() || args[0] != "INITIAL") { return "Usage: SET INITIAL [ROOM|POS|SCENE] | SET ITEMS <0-200> | SET SHADER [POSTFX|CRTPI] | SET PLAYER SKIN <1|2>"; }
|
||||
if (args.empty() || args[0] != "INITIAL") { return "Usage: SET INITIAL [ROOM|POS|SCENE] | SET ITEMS <0-200> | SET PLAYER SKIN <1|2>"; }
|
||||
|
||||
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");
|
||||
@@ -572,7 +572,7 @@ static const std::vector<ConsoleCommand> COMMANDS = {
|
||||
}
|
||||
return result;
|
||||
#else
|
||||
return "Usage: SET SHADER [POSTFX|CRTPI] | SET PLAYER SKIN <1|2>";
|
||||
return "Usage: SET PLAYER SKIN <1|2>";
|
||||
#endif
|
||||
}},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user