forked from jaildesigner-jailgames/jaildoctors_dilemma
screen torna llista de paletes i permet canviar a una paleta pel nom
console 2.1 por canviar de paleta pel nom
This commit is contained in:
@@ -369,9 +369,9 @@ static const std::vector<ConsoleCommand> COMMANDS = {
|
||||
return "Driver: " + driver_lower + " (restart)";
|
||||
}},
|
||||
|
||||
// PALETTE NEXT/PREV — Paleta de colores (F5/F6)
|
||||
// PALETTE NEXT/PREV/<nombre> — Paleta de colores (F5/F6 o por nombre)
|
||||
{.keyword = "PALETTE", .execute = [](const std::vector<std::string>& args) -> std::string {
|
||||
if (args.empty()) { return "usage: palette [next|prev]"; }
|
||||
if (args.empty()) { return "usage: palette [next|prev|<name>]"; }
|
||||
if (args[0] == "NEXT") {
|
||||
Screen::get()->nextPalette();
|
||||
return "Palette: " + Options::video.palette;
|
||||
@@ -380,7 +380,10 @@ static const std::vector<ConsoleCommand> COMMANDS = {
|
||||
Screen::get()->previousPalette();
|
||||
return "Palette: " + Options::video.palette;
|
||||
}
|
||||
return "usage: palette [next|prev]";
|
||||
if (!Screen::get()->setPaletteByName(args[0])) {
|
||||
return "Unknown palette: " + args[0];
|
||||
}
|
||||
return "Palette: " + Options::video.palette;
|
||||
}},
|
||||
|
||||
#ifdef _DEBUG
|
||||
@@ -1150,44 +1153,57 @@ void Console::handleEvent(const SDL_Event& event) {
|
||||
} else {
|
||||
// Modo sub-argumento: completar primer arg del comando base
|
||||
using SubArgs = std::vector<std::string_view>;
|
||||
using Entry = std::pair<std::string_view, SubArgs>;
|
||||
using Entry = std::pair<std::string_view, SubArgs>;
|
||||
static const std::vector<Entry> SUB_ARGS = {
|
||||
{"SS", {"ON", "OFF", "SIZE", "UPSCALE", "DOWNSCALE"}},
|
||||
{"SHADER", {"ON", "OFF", "NEXT", "POSTFX", "CRTPI"}},
|
||||
{"BORDER", {"ON", "OFF"}},
|
||||
{"SS", {"ON", "OFF", "SIZE", "UPSCALE", "DOWNSCALE"}},
|
||||
{"SHADER", {"ON", "OFF", "NEXT", "POSTFX", "CRTPI"}},
|
||||
{"BORDER", {"ON", "OFF"}},
|
||||
{"FULLSCREEN", {"ON", "OFF"}},
|
||||
{"ZOOM", {"UP", "DOWN"}},
|
||||
{"INTSCALE", {"ON", "OFF"}},
|
||||
{"VSYNC", {"ON", "OFF"}},
|
||||
{"DRIVER", {"LIST", "AUTO", "NONE"}},
|
||||
{"PALETTE", {"NEXT", "PREV"}},
|
||||
{"AUDIO", {"ON", "OFF", "VOL"}},
|
||||
{"MUSIC", {"ON", "OFF", "VOL"}},
|
||||
{"SOUND", {"ON", "OFF", "VOL"}},
|
||||
{"ZOOM", {"UP", "DOWN"}},
|
||||
{"INTSCALE", {"ON", "OFF"}},
|
||||
{"VSYNC", {"ON", "OFF"}},
|
||||
{"DRIVER", {"LIST", "AUTO", "NONE"}},
|
||||
{"AUDIO", {"ON", "OFF", "VOL"}},
|
||||
{"MUSIC", {"ON", "OFF", "VOL"}},
|
||||
{"SOUND", {"ON", "OFF", "VOL"}},
|
||||
#ifdef _DEBUG
|
||||
{"SHOW", {"INFO", "NOTIFICATION", "CHEEVO"}},
|
||||
{"SET", {"PLAYER", "INITIAL", "ITEMS"}},
|
||||
{"DEBUG", {"ON", "OFF"}},
|
||||
{"ROOM", {"NEXT", "PREV"}},
|
||||
{"SCENE", {"LOGO", "LOADING", "TITLE", "CREDITS", "GAME", "ENDING", "ENDING2", "RESTART"}},
|
||||
{"SHOW", {"INFO", "NOTIFICATION", "CHEEVO"}},
|
||||
{"SET", {"PLAYER", "INITIAL", "ITEMS"}},
|
||||
{"DEBUG", {"ON", "OFF"}},
|
||||
{"ROOM", {"NEXT", "PREV"}},
|
||||
{"SCENE", {"LOGO", "LOADING", "TITLE", "CREDITS", "GAME", "ENDING", "ENDING2", "RESTART"}},
|
||||
#else
|
||||
{"SHOW", {"INFO"}},
|
||||
{"SET", {"PLAYER"}},
|
||||
{"SHOW", {"INFO"}},
|
||||
{"SET", {"PLAYER"}},
|
||||
#endif
|
||||
{"HIDE", {"INFO"}},
|
||||
{"KIOSK", {"ON"}},
|
||||
{"CHEAT", {"INFINITE", "INVINCIBILITY", "OPEN", "CLOSE"}},
|
||||
{"HIDE", {"INFO"}},
|
||||
{"KIOSK", {"ON"}},
|
||||
{"CHEAT", {"INFINITE", "INVINCIBILITY", "OPEN", "CLOSE"}},
|
||||
};
|
||||
const std::string base_cmd = upper.substr(0, space_pos);
|
||||
const std::string base_cmd = upper.substr(0, space_pos);
|
||||
const std::string sub_prefix = upper.substr(space_pos + 1);
|
||||
for (const auto& [keyword, args] : SUB_ARGS) {
|
||||
if (keyword == base_cmd) {
|
||||
for (const auto& arg : args) {
|
||||
if (sub_prefix.empty() || std::string_view{arg}.starts_with(sub_prefix)) {
|
||||
tab_matches_.emplace_back(std::string(base_cmd) + " " + std::string(arg));
|
||||
}
|
||||
if (base_cmd == "PALETTE" && Screen::get() != nullptr) {
|
||||
// NEXT/PREV primero, luego todos los nombres de paleta disponibles
|
||||
for (const auto sv : {"NEXT", "PREV"}) {
|
||||
if (sub_prefix.empty() || std::string_view{sv}.starts_with(sub_prefix)) {
|
||||
tab_matches_.emplace_back("PALETTE " + std::string(sv));
|
||||
}
|
||||
}
|
||||
for (const auto& name : Screen::get()->getPaletteNames()) {
|
||||
if (sub_prefix.empty() || std::string_view{name}.starts_with(sub_prefix)) {
|
||||
tab_matches_.emplace_back("PALETTE " + name);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (const auto& [keyword, args] : SUB_ARGS) {
|
||||
if (keyword == base_cmd) {
|
||||
for (const auto& arg : args) {
|
||||
if (sub_prefix.empty() || std::string_view{arg}.starts_with(sub_prefix)) {
|
||||
tab_matches_.emplace_back(std::string(base_cmd) + " " + std::string(arg));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user