- pots canviar el color del jugador desde la consola (persistent)
- cokmprova que el color no siga el mateix que el del fono (canvia a default) - eliminades animacions sobrants del jugador - canviada la logica del marcador pero a mostrar la animació de les vides del jugador - posibilitat d'utilitzar skins d'enemics en el jugador - canvi en calent de la skin en el marcador (abans soles en el constructir)
This commit is contained in:
@@ -623,19 +623,41 @@ static auto cmd_cheat(const std::vector<std::string>& args) -> std::string {
|
||||
return "usage: cheat [infinite lives|invincibility|open the jail|close the jail]";
|
||||
}
|
||||
|
||||
// SET PLAYER SKIN / SET INITIAL / SET ITEMS
|
||||
static auto cmd_set(const std::vector<std::string>& args) -> std::string {
|
||||
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;
|
||||
try {
|
||||
num = std::stoi(args[2]);
|
||||
} catch (...) {}
|
||||
if (num < 1 || num > 2) { return "usage: set player skin <1|2>"; }
|
||||
// PLAYER SKIN / PLAYER COLOR
|
||||
static auto cmd_player(const std::vector<std::string>& args) -> std::string {
|
||||
if (SceneManager::current != SceneManager::Scene::GAME) { return "Only available in GAME scene"; }
|
||||
|
||||
// PLAYER SKIN <name>
|
||||
if (args.size() >= 2 && args[0] == "SKIN") {
|
||||
if (!GameControl::change_player_skin) { return "Game not initialized"; }
|
||||
GameControl::change_player_skin(num);
|
||||
return "Player skin: " + std::to_string(num);
|
||||
std::string skin_name = args[1];
|
||||
std::ranges::transform(skin_name, skin_name.begin(), ::tolower);
|
||||
GameControl::change_player_skin(skin_name);
|
||||
return "Player skin: " + skin_name;
|
||||
}
|
||||
|
||||
// PLAYER COLOR DEFAULT
|
||||
if (args.size() >= 2 && args[0] == "COLOR" && args[1] == "DEFAULT") {
|
||||
if (!GameControl::change_player_color) { return "Game not initialized"; }
|
||||
GameControl::change_player_color(-1);
|
||||
return "Player color: default";
|
||||
}
|
||||
|
||||
// PLAYER COLOR <0-15>
|
||||
if (args.size() >= 2 && args[0] == "COLOR") {
|
||||
int color = -1;
|
||||
try { color = std::stoi(args[1]); } catch (...) {}
|
||||
if (color < 0 || color > 15) { return "usage: player color <0-15>|default"; }
|
||||
if (!GameControl::change_player_color) { return "Game not initialized"; }
|
||||
GameControl::change_player_color(color);
|
||||
return "Player color: " + std::to_string(color);
|
||||
}
|
||||
|
||||
return "usage: player skin <name> | player color <0-15>|default";
|
||||
}
|
||||
|
||||
// SET INITIAL / SET ITEMS
|
||||
static auto cmd_set(const std::vector<std::string>& args) -> std::string {
|
||||
#ifdef _DEBUG
|
||||
// SET INITIAL SCENE [<nombre>]
|
||||
if (args.size() >= 2 && args[0] == "INITIAL" && args[1] == "SCENE") {
|
||||
@@ -689,7 +711,7 @@ static auto cmd_set(const std::vector<std::string>& args) -> std::string {
|
||||
return "Items: " + std::to_string(count);
|
||||
}
|
||||
|
||||
if (args.empty() || args[0] != "INITIAL") { return "usage: set initial [room|pos|scene] | set items <0-200> | set player skin <1|2>"; }
|
||||
if (args.empty() || args[0] != "INITIAL") { return "usage: set initial [room|pos|scene] | set items <0-200>"; }
|
||||
|
||||
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");
|
||||
@@ -705,7 +727,7 @@ static auto cmd_set(const std::vector<std::string>& args) -> std::string {
|
||||
}
|
||||
return result;
|
||||
#else
|
||||
return "usage: set player skin <1|2>";
|
||||
return "Debug only command";
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -771,6 +793,7 @@ void CommandRegistry::registerHandlers() {
|
||||
handlers_["cmd_show"] = cmd_show;
|
||||
handlers_["cmd_hide"] = cmd_hide;
|
||||
handlers_["cmd_cheat"] = cmd_cheat;
|
||||
handlers_["cmd_player"] = cmd_player;
|
||||
handlers_["cmd_set"] = cmd_set;
|
||||
handlers_["cmd_restart"] = cmd_restart;
|
||||
handlers_["cmd_kiosk"] = cmd_kiosk;
|
||||
|
||||
Reference in New Issue
Block a user