Añadidos nuevos trucos
This commit is contained in:
@@ -61,6 +61,14 @@ struct section_t
|
|||||||
Uint8 subsection;
|
Uint8 subsection;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Estructura para albergar trucos
|
||||||
|
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
|
||||||
|
};
|
||||||
|
|
||||||
// Estructura con todas las opciones de configuración del programa
|
// Estructura con todas las opciones de configuración del programa
|
||||||
struct options_t
|
struct options_t
|
||||||
{
|
{
|
||||||
@@ -76,8 +84,7 @@ struct options_t
|
|||||||
float borderSize; // Porcentaje de borde que se añade a lo ventana
|
float borderSize; // Porcentaje de borde que se añade a lo ventana
|
||||||
palette_e palette; // Paleta de colores a usar en el juego
|
palette_e palette; // Paleta de colores a usar en el juego
|
||||||
bool console; // Indica si ha de mostrar información por la consola de texto
|
bool console; // Indica si ha de mostrar información por la consola de texto
|
||||||
bool infiniteLives; // Indica si el jugador dispone de vidas infinitas
|
cheat_t cheat; // Contiene trucos y ventajas para el juego
|
||||||
bool invincible; // Indica si el jugador puede morir
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Calcula el cuadrado de la distancia entre dos puntos
|
// Calcula el cuadrado de la distancia entre dos puntos
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ Director::Director(int argc, char *argv[])
|
|||||||
section.name = SECTION_PROG_LOGO;
|
section.name = SECTION_PROG_LOGO;
|
||||||
section.subsection = SUBSECTION_LOGO_TO_INTRO;
|
section.subsection = SUBSECTION_LOGO_TO_INTRO;
|
||||||
|
|
||||||
section.name = SECTION_PROG_GAME;
|
//section.name = SECTION_PROG_GAME;
|
||||||
|
|
||||||
// Crea e inicializa las opciones del programa
|
// Crea e inicializa las opciones del programa
|
||||||
iniOptions();
|
iniOptions();
|
||||||
@@ -85,8 +85,9 @@ void Director::iniOptions()
|
|||||||
|
|
||||||
// Estos valores no se guardan en el fichero de configuraci´ón
|
// Estos valores no se guardan en el fichero de configuraci´ón
|
||||||
options->console = false;
|
options->console = false;
|
||||||
options->infiniteLives = false;
|
options->cheat.infiniteLives = false;
|
||||||
options->invincible = false;
|
options->cheat.invincible = false;
|
||||||
|
options->cheat.jailEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba los parametros del programa
|
// Comprueba los parametros del programa
|
||||||
@@ -105,12 +106,17 @@ void Director::checkProgramArguments(int argc, char *argv[])
|
|||||||
|
|
||||||
else if (strcmp(argv[i], "--infiniteLives") == 0)
|
else if (strcmp(argv[i], "--infiniteLives") == 0)
|
||||||
{
|
{
|
||||||
options->infiniteLives = true;
|
options->cheat.infiniteLives = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (strcmp(argv[i], "--invincible") == 0)
|
else if (strcmp(argv[i], "--invincible") == 0)
|
||||||
{
|
{
|
||||||
options->invincible = true;
|
options->cheat.invincible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (strcmp(argv[i], "--jailEnabled") == 0)
|
||||||
|
{
|
||||||
|
options->cheat.jailEnabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *as
|
|||||||
this->options = options;
|
this->options = options;
|
||||||
|
|
||||||
// ****
|
// ****
|
||||||
currentRoom = "01.room";
|
currentRoom = "03.room";
|
||||||
const int x = 29;
|
const int x = 29;
|
||||||
const int y = 13;
|
const int y = 13;
|
||||||
spawnPoint = {x * 8, y * 8, 0, 0, 0, s_standing, SDL_FLIP_HORIZONTAL};
|
spawnPoint = {x * 8, y * 8, 0, 0, 0, s_standing, SDL_FLIP_HORIZONTAL};
|
||||||
@@ -44,7 +44,7 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *as
|
|||||||
board.items = 0;
|
board.items = 0;
|
||||||
board.rooms = 1;
|
board.rooms = 1;
|
||||||
board.music = true;
|
board.music = true;
|
||||||
board.jailEnabled = false;
|
board.jailEnabled = options->cheat.jailEnabled;
|
||||||
setScoreBoardColor();
|
setScoreBoardColor();
|
||||||
roomTracker->addRoom(currentRoom);
|
roomTracker->addRoom(currentRoom);
|
||||||
paused = false;
|
paused = false;
|
||||||
@@ -95,7 +95,7 @@ void Game::checkEventHandler()
|
|||||||
|
|
||||||
case SDL_SCANCODE_D:
|
case SDL_SCANCODE_D:
|
||||||
debug->switchEnabled();
|
debug->switchEnabled();
|
||||||
options->invincible = debug->getEnabled();
|
options->cheat.invincible = debug->getEnabled();
|
||||||
board.music = !debug->getEnabled();
|
board.music = !debug->getEnabled();
|
||||||
board.music ? JA_ResumeMusic() : JA_PauseMusic();
|
board.music ? JA_ResumeMusic() : JA_PauseMusic();
|
||||||
break;
|
break;
|
||||||
@@ -379,13 +379,13 @@ void Game::checkGameOver()
|
|||||||
// Mata al jugador
|
// Mata al jugador
|
||||||
void Game::killPlayer()
|
void Game::killPlayer()
|
||||||
{
|
{
|
||||||
if (options->invincible)
|
if (options->cheat.invincible)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resta una vida al jugador
|
// Resta una vida al jugador
|
||||||
if (!options->infiniteLives)
|
if (!options->cheat.infiniteLives)
|
||||||
{
|
{
|
||||||
board.lives--;
|
board.lives--;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user