Añadidos colores para el jugador segun los trucos. Añadida skin alternativa para el jugador

This commit is contained in:
2022-11-12 07:28:08 +01:00
parent 1df1bc463c
commit 763126580f
4 changed files with 21 additions and 2 deletions

View File

@@ -67,6 +67,7 @@ struct cheat_t
bool infiniteLives; // Indica si el jugador dispone de vidas infinitas bool infiniteLives; // Indica si el jugador dispone de vidas infinitas
bool invincible; // Indica si el jugador puede morir bool invincible; // Indica si el jugador puede morir
bool jailEnabled; // Indica si la Jail está abierta 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 // Estructura con todas las opciones de configuración del programa

View File

@@ -90,6 +90,7 @@ void Director::iniOptions()
options->cheat.infiniteLives = false; options->cheat.infiniteLives = false;
options->cheat.invincible = false; options->cheat.invincible = false;
options->cheat.jailEnabled = false; options->cheat.jailEnabled = false;
options->cheat.altSkin = false;
} }
// Comprueba los parametros del programa // Comprueba los parametros del programa
@@ -120,6 +121,11 @@ void Director::checkProgramArguments(int argc, char *argv[])
{ {
options->cheat.jailEnabled = true; options->cheat.jailEnabled = true;
} }
else if (strcmp(argv[i], "--altSkin") == 0)
{
options->cheat.altSkin = true;
}
} }
} }

View File

@@ -32,7 +32,9 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *as
itemTracker = new ItemTracker(); itemTracker = new ItemTracker();
roomTracker = new RoomTracker(); roomTracker = new RoomTracker();
room = new Room(resource->getRoom(currentRoom), renderer, screen, asset, options, itemTracker, &board.items, false, debug); 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); this->player = new Player(player);
eventHandler = new SDL_Event(); eventHandler = new SDL_Event();
text = new Text(resource->getOffset("smb2.txt"), resource->getTexture("smb2.png"), renderer); 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 // 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); 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); this->player = new Player(player);
// Pone los objetos en pausa mientras esta la habitación en negro // Pone los objetos en pausa mientras esta la habitación en negro

View File

@@ -19,6 +19,14 @@ Player::Player(player_t player)
// Inicializa variables // Inicializa variables
color = stringToColor(options->palette, "white"); 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; onBorder = false;
border = BORDER_TOP; border = BORDER_TOP;
autoMovement = false; autoMovement = false;