diff --git a/source/common/utils.h b/source/common/utils.h index 5e8778e..436acfd 100644 --- a/source/common/utils.h +++ b/source/common/utils.h @@ -67,6 +67,7 @@ struct cheat_t bool infiniteLives; // Indica si el jugador dispone de vidas infinitas bool invincible; // Indica si el jugador puede morir bool jailEnabled; // Indica si la Jail está abierta + bool altSkin; // Indicxa si se usa una skin diferente para el jugador }; // Estructura con todas las opciones de configuración del programa diff --git a/source/director.cpp b/source/director.cpp index 1affa44..0edbb01 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -90,6 +90,7 @@ void Director::iniOptions() options->cheat.infiniteLives = false; options->cheat.invincible = false; options->cheat.jailEnabled = false; + options->cheat.altSkin = false; } // Comprueba los parametros del programa @@ -120,6 +121,11 @@ void Director::checkProgramArguments(int argc, char *argv[]) { options->cheat.jailEnabled = true; } + + else if (strcmp(argv[i], "--altSkin") == 0) + { + options->cheat.altSkin = true; + } } } diff --git a/source/game.cpp b/source/game.cpp index 86001bc..19cf1c0 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -32,7 +32,9 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *as itemTracker = new ItemTracker(); roomTracker = new RoomTracker(); room = new Room(resource->getRoom(currentRoom), renderer, screen, asset, options, itemTracker, &board.items, false, debug); - const player_t player = {spawnPoint, "player.png", "player.ani", renderer, resource, asset, options, input, room, debug}; + const std::string playerPNG = options->cheat.altSkin ? "player2.png" : "player.png"; + const std::string playerANI = options->cheat.altSkin ? "player2.ani" : "player.ani"; + const player_t player = {spawnPoint, playerPNG, playerANI, renderer, resource, asset, options, input, room, debug}; this->player = new Player(player); eventHandler = new SDL_Event(); text = new Text(resource->getOffset("smb2.txt"), resource->getTexture("smb2.png"), renderer); @@ -408,7 +410,9 @@ void Game::killPlayer() // Crea la nueva habitación y el nuevo jugador room = new Room(resource->getRoom(currentRoom), renderer, screen, asset, options, itemTracker, &board.items, board.jailEnabled, debug); - const player_t player = {spawnPoint, "player.png", "player.ani", renderer, resource, asset, options, input, room, debug}; + const std::string playerPNG = options->cheat.altSkin ? "player2.png" : "player.png"; + const std::string playerANI = options->cheat.altSkin ? "player2.ani" : "player.ani"; + const player_t player = {spawnPoint, playerPNG, playerANI, renderer, resource, asset, options, input, room, debug}; this->player = new Player(player); // Pone los objetos en pausa mientras esta la habitación en negro diff --git a/source/player.cpp b/source/player.cpp index eb5d140..f87ea55 100644 --- a/source/player.cpp +++ b/source/player.cpp @@ -19,6 +19,14 @@ Player::Player(player_t player) // Inicializa variables color = stringToColor(options->palette, "white"); + if (options->cheat.infiniteLives) + { + color = stringToColor(options->palette, "yellow"); + } + if (options->cheat.invincible) + { + color = stringToColor(options->palette, "cyan"); + } onBorder = false; border = BORDER_TOP; autoMovement = false;