Les enum class passen a estar totes amb la inicial en majuscula
This commit is contained in:
@@ -27,8 +27,8 @@ Fade::~Fade()
|
|||||||
// Inicializa las variables
|
// Inicializa las variables
|
||||||
void Fade::init()
|
void Fade::init()
|
||||||
{
|
{
|
||||||
type = fadeType::CENTER;
|
type = FadeType::CENTER;
|
||||||
mode = fadeMode::OUT;
|
mode = FadeMode::OUT;
|
||||||
enabled = false;
|
enabled = false;
|
||||||
finished = false;
|
finished = false;
|
||||||
counter = 0;
|
counter = 0;
|
||||||
@@ -67,10 +67,10 @@ void Fade::update()
|
|||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case fadeType::FULLSCREEN:
|
case FadeType::FULLSCREEN:
|
||||||
{
|
{
|
||||||
// Modifica la transparencia
|
// Modifica la transparencia
|
||||||
a = mode == fadeMode::OUT ? std::min(counter * 4, 255) : 255 - std::min(counter * 4, 255);
|
a = mode == FadeMode::OUT ? std::min(counter * 4, 255) : 255 - std::min(counter * 4, 255);
|
||||||
|
|
||||||
SDL_SetTextureAlphaMod(backbuffer, a);
|
SDL_SetTextureAlphaMod(backbuffer, a);
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ void Fade::update()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case fadeType::CENTER:
|
case FadeType::CENTER:
|
||||||
{
|
{
|
||||||
// Dibuja sobre el backbuffer
|
// Dibuja sobre el backbuffer
|
||||||
auto *temp = SDL_GetRenderTarget(renderer);
|
auto *temp = SDL_GetRenderTarget(renderer);
|
||||||
@@ -112,7 +112,7 @@ void Fade::update()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case fadeType::RANDOM_SQUARE:
|
case FadeType::RANDOM_SQUARE:
|
||||||
{
|
{
|
||||||
if (counter % fadeRandomSquaresDelay == 0)
|
if (counter % fadeRandomSquaresDelay == 0)
|
||||||
{
|
{
|
||||||
@@ -146,7 +146,7 @@ void Fade::update()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case fadeType::VENETIAN:
|
case FadeType::VENETIAN:
|
||||||
{
|
{
|
||||||
// Counter debe ir de 0 a 150
|
// Counter debe ir de 0 a 150
|
||||||
if (square.back().h < param.fade.venetianSize)
|
if (square.back().h < param.fade.venetianSize)
|
||||||
@@ -209,14 +209,14 @@ void Fade::activate()
|
|||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case fadeType::FULLSCREEN:
|
case FadeType::FULLSCREEN:
|
||||||
{
|
{
|
||||||
// Pinta el backbuffer de color sólido
|
// Pinta el backbuffer de color sólido
|
||||||
cleanBackbuffer(r, g, b, 255);
|
cleanBackbuffer(r, g, b, 255);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case fadeType::CENTER:
|
case FadeType::CENTER:
|
||||||
{
|
{
|
||||||
rect1 = {0, 0, param.game.width, 0};
|
rect1 = {0, 0, param.game.width, 0};
|
||||||
rect2 = {0, 0, param.game.width, 0};
|
rect2 = {0, 0, param.game.width, 0};
|
||||||
@@ -224,7 +224,7 @@ void Fade::activate()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case fadeType::RANDOM_SQUARE:
|
case FadeType::RANDOM_SQUARE:
|
||||||
{
|
{
|
||||||
rect1 = {0, 0, param.game.width / numSquaresWidth, param.game.height / numSquaresHeight};
|
rect1 = {0, 0, param.game.width / numSquaresWidth, param.game.height / numSquaresHeight};
|
||||||
square.clear();
|
square.clear();
|
||||||
@@ -251,18 +251,18 @@ void Fade::activate()
|
|||||||
// Limpia la textura
|
// Limpia la textura
|
||||||
auto *temp = SDL_GetRenderTarget(renderer);
|
auto *temp = SDL_GetRenderTarget(renderer);
|
||||||
SDL_SetRenderTarget(renderer, backbuffer);
|
SDL_SetRenderTarget(renderer, backbuffer);
|
||||||
a = mode == fadeMode::OUT ? 0 : 255;
|
a = mode == FadeMode::OUT ? 0 : 255;
|
||||||
SDL_SetRenderDrawColor(renderer, r, g, b, a);
|
SDL_SetRenderDrawColor(renderer, r, g, b, a);
|
||||||
SDL_RenderClear(renderer);
|
SDL_RenderClear(renderer);
|
||||||
SDL_SetRenderTarget(renderer, temp);
|
SDL_SetRenderTarget(renderer, temp);
|
||||||
|
|
||||||
// Deja el color listo para usar
|
// Deja el color listo para usar
|
||||||
a = mode == fadeMode::OUT ? 255 : 0;
|
a = mode == FadeMode::OUT ? 255 : 0;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case fadeType::VENETIAN:
|
case FadeType::VENETIAN:
|
||||||
{
|
{
|
||||||
cleanBackbuffer(0, 0, 0, 0);
|
cleanBackbuffer(0, 0, 0, 0);
|
||||||
rect1 = {0, 0, param.game.width, 0};
|
rect1 = {0, 0, param.game.width, 0};
|
||||||
@@ -297,13 +297,13 @@ bool Fade::hasEnded() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Establece el tipo de fade
|
// Establece el tipo de fade
|
||||||
void Fade::setType(fadeType type)
|
void Fade::setType(FadeType type)
|
||||||
{
|
{
|
||||||
this->type = type;
|
this->type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Establece el modo de fade
|
// Establece el modo de fade
|
||||||
void Fade::setMode(fadeMode mode)
|
void Fade::setMode(FadeMode mode)
|
||||||
{
|
{
|
||||||
this->mode = mode;
|
this->mode = mode;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include <vector> // for vector
|
#include <vector> // for vector
|
||||||
|
|
||||||
// Tipos de fundido
|
// Tipos de fundido
|
||||||
enum class fadeType
|
enum class FadeType
|
||||||
{
|
{
|
||||||
FULLSCREEN = 0,
|
FULLSCREEN = 0,
|
||||||
CENTER = 1,
|
CENTER = 1,
|
||||||
@@ -15,7 +15,7 @@ enum class fadeType
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Modos de fundido
|
// Modos de fundido
|
||||||
enum class fadeMode
|
enum class FadeMode
|
||||||
{
|
{
|
||||||
IN = 0,
|
IN = 0,
|
||||||
OUT = 1,
|
OUT = 1,
|
||||||
@@ -30,17 +30,17 @@ private:
|
|||||||
SDL_Texture *backbuffer; // Textura para usar como backbuffer con SDL_TEXTUREACCESS_TARGET
|
SDL_Texture *backbuffer; // Textura para usar como backbuffer con SDL_TEXTUREACCESS_TARGET
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
fadeType type; // Tipo de fade a realizar
|
FadeType type; // Tipo de fade a realizar
|
||||||
fadeMode mode; // Modo de fade a realizar
|
FadeMode mode; // Modo de fade a realizar
|
||||||
Uint16 counter; // Contador interno
|
Uint16 counter; // Contador interno
|
||||||
bool enabled; // Indica si el fade está activo
|
bool enabled; // Indica si el fade está activo
|
||||||
bool finished; // Indica si ha terminado la transición
|
bool finished; // Indica si ha terminado la transición
|
||||||
Uint8 r, g, b, a; // Colores para el fade
|
Uint8 r, g, b, a; // Colores para el fade
|
||||||
SDL_Rect rect1; // Rectangulo usado para crear los efectos de transición
|
SDL_Rect rect1; // Rectangulo usado para crear los efectos de transición
|
||||||
SDL_Rect rect2; // Rectangulo usado para crear los efectos de transición
|
SDL_Rect rect2; // Rectangulo usado para crear los efectos de transición
|
||||||
int numSquaresWidth; // Cantidad total de cuadraditos en horizontal para el fadeType::RANDOM_SQUARE
|
int numSquaresWidth; // Cantidad total de cuadraditos en horizontal para el FadeType::RANDOM_SQUARE
|
||||||
int numSquaresHeight; // Cantidad total de cuadraditos en vertical para el fadeType::RANDOM_SQUARE
|
int numSquaresHeight; // Cantidad total de cuadraditos en vertical para el FadeType::RANDOM_SQUARE
|
||||||
std::vector<SDL_Rect> square; // Vector con los indices de los cuadrados para el fadeType::RANDOM_SQUARE
|
std::vector<SDL_Rect> square; // Vector con los indices de los cuadrados para el FadeType::RANDOM_SQUARE
|
||||||
int fadeRandomSquaresDelay; // Duración entre cada pintado de cuadrados
|
int fadeRandomSquaresDelay; // Duración entre cada pintado de cuadrados
|
||||||
int fadeRandomSquaresMult; // Cantidad de cuadrados que se pintaran cada vez
|
int fadeRandomSquaresMult; // Cantidad de cuadrados que se pintaran cada vez
|
||||||
int postDuration; // Duración posterior del fade tras finalizar
|
int postDuration; // Duración posterior del fade tras finalizar
|
||||||
@@ -78,10 +78,10 @@ public:
|
|||||||
bool isEnabled() const;
|
bool isEnabled() const;
|
||||||
|
|
||||||
// Establece el tipo de fade
|
// Establece el tipo de fade
|
||||||
void setType(fadeType type);
|
void setType(FadeType type);
|
||||||
|
|
||||||
// Establece el modo de fade
|
// Establece el modo de fade
|
||||||
void setMode(fadeMode mode);
|
void setMode(FadeMode mode);
|
||||||
|
|
||||||
// Establece el color del fade
|
// Establece el color del fade
|
||||||
void setColor(Uint8 r, Uint8 g, Uint8 b);
|
void setColor(Uint8 r, Uint8 g, Uint8 b);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#include "bullet.h" // for Bullet, BulletType::LEFT, BulletType::RIGHT
|
#include "bullet.h" // for Bullet, BulletType::LEFT, BulletType::RIGHT
|
||||||
#include "enemy_formations.h" // for stage_t, EnemyFormations, enemyIni...
|
#include "enemy_formations.h" // for stage_t, EnemyFormations, enemyIni...
|
||||||
#include "explosions.h" // for Explosions
|
#include "explosions.h" // for Explosions
|
||||||
#include "fade.h" // for Fade, fadeType::RANDOM_SQUARE, FADE_VEN...
|
#include "fade.h" // for Fade, FadeType::RANDOM_SQUARE, FADE_VEN...
|
||||||
#include "global_inputs.h" // for globalInputs::check
|
#include "global_inputs.h" // for globalInputs::check
|
||||||
#include "input.h" // for inputs_e, Input, INPUT_DO_NOT_ALLO...
|
#include "input.h" // for inputs_e, Input, INPUT_DO_NOT_ALLO...
|
||||||
#include "item.h" // for Item, ITEM_COFFEE_MACHINE, ITEM_CLOCK
|
#include "item.h" // for Item, ITEM_COFFEE_MACHINE, ITEM_CLOCK
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
#include "manage_hiscore_table.h" // for ManageHiScoreTable
|
#include "manage_hiscore_table.h" // for ManageHiScoreTable
|
||||||
#include "options.h" // for options
|
#include "options.h" // for options
|
||||||
#include "param.h" // for param
|
#include "param.h" // for param
|
||||||
#include "player.h" // for Player, playerStatus::PLAYING, PLA...
|
#include "player.h" // for Player, PlayerStatus::PLAYING, PLA...
|
||||||
#include "scoreboard.h" // for Scoreboard, scoreboard_modes_e
|
#include "scoreboard.h" // for Scoreboard, scoreboard_modes_e
|
||||||
#include "screen.h" // for Screen
|
#include "screen.h" // for Screen
|
||||||
#include "smart_sprite.h" // for SmartSprite
|
#include "smart_sprite.h" // for SmartSprite
|
||||||
@@ -146,7 +146,7 @@ void Game::init(int playerID)
|
|||||||
Player *player = getPlayer(playerID);
|
Player *player = getPlayer(playerID);
|
||||||
|
|
||||||
// Cambia el estado del jugador seleccionado
|
// Cambia el estado del jugador seleccionado
|
||||||
player->setStatusPlaying(playerStatus::PLAYING);
|
player->setStatusPlaying(PlayerStatus::PLAYING);
|
||||||
|
|
||||||
// Como es el principio del juego, empieza sin inmunidad
|
// Como es el principio del juego, empieza sin inmunidad
|
||||||
player->setInvulnerable(false);
|
player->setInvulnerable(false);
|
||||||
@@ -154,7 +154,7 @@ void Game::init(int playerID)
|
|||||||
// Variables relacionadas con la dificultad
|
// Variables relacionadas con la dificultad
|
||||||
switch (difficulty)
|
switch (difficulty)
|
||||||
{
|
{
|
||||||
case gameDifficulty::EASY:
|
case GameDifficulty::EASY:
|
||||||
{
|
{
|
||||||
defaultEnemySpeed = BALLOON_SPEED_1;
|
defaultEnemySpeed = BALLOON_SPEED_1;
|
||||||
difficultyScoreMultiplier = 0.5f;
|
difficultyScoreMultiplier = 0.5f;
|
||||||
@@ -163,7 +163,7 @@ void Game::init(int playerID)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case gameDifficulty::NORMAL:
|
case GameDifficulty::NORMAL:
|
||||||
{
|
{
|
||||||
defaultEnemySpeed = BALLOON_SPEED_1;
|
defaultEnemySpeed = BALLOON_SPEED_1;
|
||||||
difficultyScoreMultiplier = 1.0f;
|
difficultyScoreMultiplier = 1.0f;
|
||||||
@@ -172,7 +172,7 @@ void Game::init(int playerID)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case gameDifficulty::HARD:
|
case GameDifficulty::HARD:
|
||||||
{
|
{
|
||||||
defaultEnemySpeed = BALLOON_SPEED_5;
|
defaultEnemySpeed = BALLOON_SPEED_5;
|
||||||
difficultyScoreMultiplier = 1.5f;
|
difficultyScoreMultiplier = 1.5f;
|
||||||
@@ -192,10 +192,10 @@ void Game::init(int playerID)
|
|||||||
scoreboard->setName(player->getScoreBoardPanel(), player->getName());
|
scoreboard->setName(player->getScoreBoardPanel(), player->getName());
|
||||||
if (player->isWaiting())
|
if (player->isWaiting())
|
||||||
{
|
{
|
||||||
scoreboard->setMode(player->getScoreBoardPanel(), scoreboardMode::WAITING);
|
scoreboard->setMode(player->getScoreBoardPanel(), ScoreboardMode::WAITING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scoreboard->setMode(SCOREBOARD_CENTER_PANEL, scoreboardMode::STAGE_INFO);
|
scoreboard->setMode(SCOREBOARD_CENTER_PANEL, ScoreboardMode::STAGE_INFO);
|
||||||
|
|
||||||
// Resto de variables
|
// Resto de variables
|
||||||
hiScore.score = options.game.hiScoreTable[0].score;
|
hiScore.score = options.game.hiScoreTable[0].score;
|
||||||
@@ -255,7 +255,7 @@ void Game::init(int playerID)
|
|||||||
{
|
{
|
||||||
const int otherPlayer = playerID == 1 ? 2 : 1;
|
const int otherPlayer = playerID == 1 ? 2 : 1;
|
||||||
Player *player = getPlayer(otherPlayer);
|
Player *player = getPlayer(otherPlayer);
|
||||||
player->setStatusPlaying(playerStatus::PLAYING);
|
player->setStatusPlaying(PlayerStatus::PLAYING);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto player : players)
|
for (auto player : players)
|
||||||
@@ -274,8 +274,8 @@ void Game::init(int playerID)
|
|||||||
JA_EnableSound(false);
|
JA_EnableSound(false);
|
||||||
|
|
||||||
// Configura los marcadores
|
// Configura los marcadores
|
||||||
scoreboard->setMode(SCOREBOARD_LEFT_PANEL, scoreboardMode::DEMO);
|
scoreboard->setMode(SCOREBOARD_LEFT_PANEL, ScoreboardMode::DEMO);
|
||||||
scoreboard->setMode(SCOREBOARD_RIGHT_PANEL, scoreboardMode::DEMO);
|
scoreboard->setMode(SCOREBOARD_RIGHT_PANEL, ScoreboardMode::DEMO);
|
||||||
}
|
}
|
||||||
|
|
||||||
initPaths();
|
initPaths();
|
||||||
@@ -297,7 +297,7 @@ void Game::init(int playerID)
|
|||||||
// Inicializa el objeto para el fundido
|
// Inicializa el objeto para el fundido
|
||||||
fade->setColor(fadeColor.r, fadeColor.g, fadeColor.b);
|
fade->setColor(fadeColor.r, fadeColor.g, fadeColor.b);
|
||||||
fade->setPost(param.fade.postDuration);
|
fade->setPost(param.fade.postDuration);
|
||||||
fade->setType(fadeType::VENETIAN);
|
fade->setType(FadeType::VENETIAN);
|
||||||
|
|
||||||
// Con los globos creados, calcula el nivel de amenaza
|
// Con los globos creados, calcula el nivel de amenaza
|
||||||
evaluateAndSetMenace();
|
evaluateAndSetMenace();
|
||||||
@@ -861,7 +861,7 @@ void Game::updatePlayers()
|
|||||||
|
|
||||||
if (demo.enabled && allPlayersAreNotPlaying())
|
if (demo.enabled && allPlayersAreNotPlaying())
|
||||||
{
|
{
|
||||||
fade->setType(fadeType::RANDOM_SQUARE);
|
fade->setType(FadeType::RANDOM_SQUARE);
|
||||||
fade->activate();
|
fade->activate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1037,7 +1037,7 @@ void Game::setBalloonSpeed(float speed)
|
|||||||
void Game::incBalloonSpeed()
|
void Game::incBalloonSpeed()
|
||||||
{
|
{
|
||||||
// La velocidad solo se incrementa en el modo normal
|
// La velocidad solo se incrementa en el modo normal
|
||||||
if (difficulty == gameDifficulty::NORMAL)
|
if (difficulty == GameDifficulty::NORMAL)
|
||||||
{
|
{
|
||||||
if (enemySpeed == BALLOON_SPEED_1)
|
if (enemySpeed == BALLOON_SPEED_1)
|
||||||
{
|
{
|
||||||
@@ -1067,7 +1067,7 @@ void Game::incBalloonSpeed()
|
|||||||
void Game::decBalloonSpeed()
|
void Game::decBalloonSpeed()
|
||||||
{
|
{
|
||||||
// La velocidad solo se decrementa en el modo normal
|
// La velocidad solo se decrementa en el modo normal
|
||||||
if (difficulty == gameDifficulty::NORMAL)
|
if (difficulty == GameDifficulty::NORMAL)
|
||||||
{
|
{
|
||||||
if (enemySpeed == BALLOON_SPEED_5)
|
if (enemySpeed == BALLOON_SPEED_5)
|
||||||
{
|
{
|
||||||
@@ -1740,7 +1740,7 @@ void Game::killPlayer(Player *player)
|
|||||||
JA_PlaySound(playerCollisionSound);
|
JA_PlaySound(playerCollisionSound);
|
||||||
screen->shake();
|
screen->shake();
|
||||||
JA_PlaySound(coffeeOutSound);
|
JA_PlaySound(coffeeOutSound);
|
||||||
player->setStatusPlaying(playerStatus::DYING);
|
player->setStatusPlaying(PlayerStatus::DYING);
|
||||||
if (!demo.enabled)
|
if (!demo.enabled)
|
||||||
{ // En el modo DEMO ni se para la musica ni se añade la puntuación a la tabla
|
{ // En el modo DEMO ni se para la musica ni se añade la puntuación a la tabla
|
||||||
allPlayersAreNotPlaying() ? JA_StopMusic() : JA_ResumeMusic();
|
allPlayersAreNotPlaying() ? JA_StopMusic() : JA_ResumeMusic();
|
||||||
@@ -1840,7 +1840,7 @@ void Game::update()
|
|||||||
// Activa el fundido antes de acabar con los datos de la demo
|
// Activa el fundido antes de acabar con los datos de la demo
|
||||||
if (demo.counter == TOTAL_DEMO_DATA - 200)
|
if (demo.counter == TOTAL_DEMO_DATA - 200)
|
||||||
{
|
{
|
||||||
fade->setType(fadeType::RANDOM_SQUARE);
|
fade->setType(FadeType::RANDOM_SQUARE);
|
||||||
fade->activate();
|
fade->activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2237,7 +2237,7 @@ void Game::checkInput()
|
|||||||
// Si no está jugando, el botón de start le permite continuar jugando
|
// Si no está jugando, el botón de start le permite continuar jugando
|
||||||
if (input->checkInput(input_start, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index))
|
if (input->checkInput(input_start, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index))
|
||||||
{
|
{
|
||||||
player->setStatusPlaying(playerStatus::PLAYING);
|
player->setStatusPlaying(PlayerStatus::PLAYING);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si está continuando, los botones de fuego hacen decrementar el contador
|
// Si está continuando, los botones de fuego hacen decrementar el contador
|
||||||
@@ -2260,7 +2260,7 @@ void Game::checkInput()
|
|||||||
{
|
{
|
||||||
player->setInput(input_start);
|
player->setInput(input_start);
|
||||||
addScoreToScoreBoard(player->getRecordName(), player->getScore());
|
addScoreToScoreBoard(player->getRecordName(), player->getScore());
|
||||||
player->setStatusPlaying(playerStatus::CONTINUE);
|
player->setStatusPlaying(PlayerStatus::CONTINUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2287,7 +2287,7 @@ void Game::checkInput()
|
|||||||
{
|
{
|
||||||
player->setInput(input_start);
|
player->setInput(input_start);
|
||||||
addScoreToScoreBoard(player->getRecordName(), player->getScore());
|
addScoreToScoreBoard(player->getRecordName(), player->getScore());
|
||||||
player->setStatusPlaying(playerStatus::CONTINUE);
|
player->setStatusPlaying(PlayerStatus::CONTINUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2824,7 +2824,7 @@ void Game::checkAndUpdatePlayerStatus(int activePlayerIndex, int inactivePlayerI
|
|||||||
!players[inactivePlayerIndex]->isGameOver() &&
|
!players[inactivePlayerIndex]->isGameOver() &&
|
||||||
!players[inactivePlayerIndex]->isWaiting())
|
!players[inactivePlayerIndex]->isWaiting())
|
||||||
{
|
{
|
||||||
players[activePlayerIndex]->setStatusPlaying(playerStatus::WAITING);
|
players[activePlayerIndex]->setStatusPlaying(PlayerStatus::WAITING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2842,7 +2842,7 @@ void Game::checkPlayersStatusPlaying()
|
|||||||
// Entonces los pone en estado de Game Over
|
// Entonces los pone en estado de Game Over
|
||||||
for (auto player : players)
|
for (auto player : players)
|
||||||
{
|
{
|
||||||
player->setStatusPlaying(playerStatus::GAME_OVER);
|
player->setStatusPlaying(PlayerStatus::GAME_OVER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ private:
|
|||||||
bool coffeeMachineEnabled; // Indica si hay una máquina de café en el terreno de juego
|
bool coffeeMachineEnabled; // Indica si hay una máquina de café en el terreno de juego
|
||||||
bool gameCompleted; // Indica si se ha completado la partida, llegando al final de la ultima pantalla
|
bool gameCompleted; // Indica si se ha completado la partida, llegando al final de la ultima pantalla
|
||||||
int gameCompletedCounter; // Contador para el tramo final, cuando se ha completado la partida y ya no aparecen más enemigos
|
int gameCompletedCounter; // Contador para el tramo final, cuando se ha completado la partida y ya no aparecen más enemigos
|
||||||
gameDifficulty difficulty; // Dificultad del juego
|
GameDifficulty difficulty; // Dificultad del juego
|
||||||
float difficultyScoreMultiplier; // Multiplicador de puntos en función de la dificultad
|
float difficultyScoreMultiplier; // Multiplicador de puntos en función de la dificultad
|
||||||
color_t difficultyColor; // Color asociado a la dificultad
|
color_t difficultyColor; // Color asociado a la dificultad
|
||||||
int lastStageReached; // Contiene el número de la última pantalla que se ha alcanzado
|
int lastStageReached; // Contiene el número de la última pantalla que se ha alcanzado
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ HiScoreTable::HiScoreTable(JA_Music_t *music) : music(music)
|
|||||||
counter = 0;
|
counter = 0;
|
||||||
counterEnd = 800;
|
counterEnd = 800;
|
||||||
viewArea = {0, 0, param.game.width, param.game.height};
|
viewArea = {0, 0, param.game.width, param.game.height};
|
||||||
fadeMode = fadeMode::IN;
|
fadeMode = FadeMode::IN;
|
||||||
|
|
||||||
// Inicializa objetos
|
// Inicializa objetos
|
||||||
background->setPos(param.game.gameArea.rect);
|
background->setPos(param.game.gameArea.rect);
|
||||||
@@ -51,7 +51,7 @@ HiScoreTable::HiScoreTable(JA_Music_t *music) : music(music)
|
|||||||
background->setGradientNumber(1);
|
background->setGradientNumber(1);
|
||||||
background->setTransition(0.8f);
|
background->setTransition(0.8f);
|
||||||
fade->setColor(fadeColor.r, fadeColor.g, fadeColor.b);
|
fade->setColor(fadeColor.r, fadeColor.g, fadeColor.b);
|
||||||
fade->setType(fadeType::RANDOM_SQUARE);
|
fade->setType(FadeType::RANDOM_SQUARE);
|
||||||
fade->setPost(param.fade.postDuration);
|
fade->setPost(param.fade.postDuration);
|
||||||
fade->setMode(fadeMode);
|
fade->setMode(fadeMode);
|
||||||
fade->activate();
|
fade->activate();
|
||||||
@@ -275,14 +275,14 @@ void HiScoreTable::updateFade()
|
|||||||
{
|
{
|
||||||
fade->update();
|
fade->update();
|
||||||
|
|
||||||
if (fade->hasEnded() && fadeMode == fadeMode::IN)
|
if (fade->hasEnded() && fadeMode == FadeMode::IN)
|
||||||
{
|
{
|
||||||
fade->reset();
|
fade->reset();
|
||||||
fadeMode = fadeMode::OUT;
|
fadeMode = FadeMode::OUT;
|
||||||
fade->setMode(fadeMode);
|
fade->setMode(fadeMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fade->hasEnded() && fadeMode == fadeMode::OUT)
|
if (fade->hasEnded() && fadeMode == FadeMode::OUT)
|
||||||
{
|
{
|
||||||
section::name = section::NAME_INSTRUCTIONS;
|
section::name = section::NAME_INSTRUCTIONS;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ private:
|
|||||||
Uint32 ticks; // Contador de ticks para ajustar la velocidad del programa
|
Uint32 ticks; // Contador de ticks para ajustar la velocidad del programa
|
||||||
Uint32 ticksSpeed; // Velocidad a la que se repiten los bucles del programa
|
Uint32 ticksSpeed; // Velocidad a la que se repiten los bucles del programa
|
||||||
SDL_Rect viewArea; // Parte de la textura que se muestra en pantalla
|
SDL_Rect viewArea; // Parte de la textura que se muestra en pantalla
|
||||||
fadeMode fadeMode; // Modo de fade a utilizar
|
FadeMode fadeMode; // Modo de fade a utilizar
|
||||||
|
|
||||||
// Actualiza las variables
|
// Actualiza las variables
|
||||||
void update();
|
void update();
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include <algorithm> // for max
|
#include <algorithm> // for max
|
||||||
#include <string> // for basic_string
|
#include <string> // for basic_string
|
||||||
#include "asset.h" // for Asset
|
#include "asset.h" // for Asset
|
||||||
#include "fade.h" // for Fade, fadeType::FULLSCREEN, fadeMode::IN
|
#include "fade.h" // for Fade, FadeType::FULLSCREEN, FadeMode::IN
|
||||||
#include "global_inputs.h" // for globalInputs::check
|
#include "global_inputs.h" // for globalInputs::check
|
||||||
#include "input.h" // for Input
|
#include "input.h" // for Input
|
||||||
#include "jail_audio.h" // for JA_GetMusicState, JA_Music_state
|
#include "jail_audio.h" // for JA_GetMusicState, JA_Music_state
|
||||||
@@ -57,9 +57,9 @@ Instructions::Instructions(JA_Music_t *music)
|
|||||||
|
|
||||||
// Inicializa objetos
|
// Inicializa objetos
|
||||||
fade->setColor(fadeColor.r, fadeColor.g, fadeColor.b);
|
fade->setColor(fadeColor.r, fadeColor.g, fadeColor.b);
|
||||||
fade->setType(fadeType::FULLSCREEN);
|
fade->setType(FadeType::FULLSCREEN);
|
||||||
fade->setPost(param.fade.postDuration);
|
fade->setPost(param.fade.postDuration);
|
||||||
fade->setMode(fadeMode::IN);
|
fade->setMode(FadeMode::IN);
|
||||||
fade->activate();
|
fade->activate();
|
||||||
|
|
||||||
// Rellena la textura de texto
|
// Rellena la textura de texto
|
||||||
|
|||||||
@@ -6,11 +6,11 @@
|
|||||||
#include <vector> // for vector
|
#include <vector> // for vector
|
||||||
#include "input.h" // for inputs_e, INPUT_USE_ANY, INPUT_...
|
#include "input.h" // for inputs_e, INPUT_USE_ANY, INPUT_...
|
||||||
#include "lang.h" // for lang_e
|
#include "lang.h" // for lang_e
|
||||||
#include "screen.h" // for screenVideoMode, screenFilter
|
#include "screen.h" // for ScreenVideoMode, ScreenFilter
|
||||||
#include "utils.h" // for op_controller_t, options_t, op_...
|
#include "utils.h" // for op_controller_t, options_t, op_...
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
options_t options;
|
options_t options;
|
||||||
|
|
||||||
// Declaraciones
|
// Declaraciones
|
||||||
bool setOptions(std::string var, std::string value);
|
bool setOptions(std::string var, std::string value);
|
||||||
@@ -20,13 +20,13 @@ void initOptions()
|
|||||||
{
|
{
|
||||||
// Opciones de video
|
// Opciones de video
|
||||||
#ifdef ANBERNIC
|
#ifdef ANBERNIC
|
||||||
options.video.mode = screenVideoMode::WINDOW;
|
options.video.mode = ScreenVideoMode::WINDOW;
|
||||||
options.video.window.size = 3;
|
options.video.window.size = 3;
|
||||||
#else
|
#else
|
||||||
options.video.mode = screenVideoMode::WINDOW;
|
options.video.mode = ScreenVideoMode::WINDOW;
|
||||||
options.video.window.size = 2;
|
options.video.window.size = 2;
|
||||||
#endif
|
#endif
|
||||||
options.video.filter = screenFilter::NEAREST;
|
options.video.filter = ScreenFilter::NEAREST;
|
||||||
options.video.vSync = true;
|
options.video.vSync = true;
|
||||||
options.video.shaders = true;
|
options.video.shaders = true;
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ void initOptions()
|
|||||||
options.audio.sound.volume = 64;
|
options.audio.sound.volume = 64;
|
||||||
|
|
||||||
// Opciones de juego
|
// Opciones de juego
|
||||||
options.game.difficulty = gameDifficulty::NORMAL;
|
options.game.difficulty = GameDifficulty::NORMAL;
|
||||||
options.game.language = lang::ba_BA;
|
options.game.language = lang::ba_BA;
|
||||||
options.game.autofire = true;
|
options.game.autofire = true;
|
||||||
|
|
||||||
@@ -132,11 +132,11 @@ bool loadOptionsFile(std::string filePath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Normaliza los valores
|
// Normaliza los valores
|
||||||
const bool a = options.video.mode == screenVideoMode::WINDOW;
|
const bool a = options.video.mode == ScreenVideoMode::WINDOW;
|
||||||
const bool b = options.video.mode == screenVideoMode::FULLSCREEN;
|
const bool b = options.video.mode == ScreenVideoMode::FULLSCREEN;
|
||||||
if (!(a || b))
|
if (!(a || b))
|
||||||
{
|
{
|
||||||
options.video.mode = screenVideoMode::WINDOW;
|
options.video.mode = ScreenVideoMode::WINDOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.video.window.size < 1 || options.video.window.size > 4)
|
if (options.video.window.size < 1 || options.video.window.size > 4)
|
||||||
@@ -171,10 +171,10 @@ bool saveOptionsFile(std::string filePath)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Opciones de video
|
// Opciones de video
|
||||||
const auto valueVideoModeWinow = std::to_string(static_cast<int>(screenVideoMode::WINDOW));
|
const auto valueVideoModeWinow = std::to_string(static_cast<int>(ScreenVideoMode::WINDOW));
|
||||||
const auto valueVideoModeFullscreen = std::to_string(static_cast<int>(screenVideoMode::FULLSCREEN));
|
const auto valueVideoModeFullscreen = std::to_string(static_cast<int>(ScreenVideoMode::FULLSCREEN));
|
||||||
const auto valueFilterNearest = std::to_string(static_cast<int>(screenFilter::NEAREST));
|
const auto valueFilterNearest = std::to_string(static_cast<int>(ScreenFilter::NEAREST));
|
||||||
const auto valueFilterLineal = std::to_string(static_cast<int>(screenFilter::LINEAL));
|
const auto valueFilterLineal = std::to_string(static_cast<int>(ScreenFilter::LINEAL));
|
||||||
|
|
||||||
file << "## VIDEO\n";
|
file << "## VIDEO\n";
|
||||||
file << "## video.mode [" << valueVideoModeWinow << ": window, " << valueVideoModeFullscreen << ": fullscreen]\n";
|
file << "## video.mode [" << valueVideoModeWinow << ": window, " << valueVideoModeFullscreen << ": fullscreen]\n";
|
||||||
@@ -236,9 +236,9 @@ bool saveOptionsFile(std::string filePath)
|
|||||||
file << "audio.sound.volume=" + std::to_string(options.audio.sound.volume) + "\n";
|
file << "audio.sound.volume=" + std::to_string(options.audio.sound.volume) + "\n";
|
||||||
|
|
||||||
// Opciones del juego
|
// Opciones del juego
|
||||||
const auto valueDifficultyEasy = std::to_string(static_cast<int>(gameDifficulty::EASY));
|
const auto valueDifficultyEasy = std::to_string(static_cast<int>(GameDifficulty::EASY));
|
||||||
const auto valueDifficultyNormal = std::to_string(static_cast<int>(gameDifficulty::NORMAL));
|
const auto valueDifficultyNormal = std::to_string(static_cast<int>(GameDifficulty::NORMAL));
|
||||||
const auto valueDifficultyHard = std::to_string(static_cast<int>(gameDifficulty::HARD));
|
const auto valueDifficultyHard = std::to_string(static_cast<int>(GameDifficulty::HARD));
|
||||||
file << "\n\n## GAME\n";
|
file << "\n\n## GAME\n";
|
||||||
file << "## game.language [0: spanish, 1: valencian, 2: english]\n";
|
file << "## game.language [0: spanish, 1: valencian, 2: english]\n";
|
||||||
file << "## game.difficulty [" << valueDifficultyEasy << ": easy, " << valueDifficultyNormal << ": normal, " << valueDifficultyHard << ": hard]\n";
|
file << "## game.difficulty [" << valueDifficultyEasy << ": easy, " << valueDifficultyNormal << ": normal, " << valueDifficultyHard << ": hard]\n";
|
||||||
@@ -285,8 +285,8 @@ bool setOptions(std::string var, std::string value)
|
|||||||
// Opciones de video
|
// Opciones de video
|
||||||
if (var == "video.mode")
|
if (var == "video.mode")
|
||||||
{
|
{
|
||||||
// options.video.mode = value == std::to_string(static_cast<int>(screenVideoMode::WINDOW)) ? screenVideoMode::WINDOW : screenVideoMode::FULLSCREEN;
|
// options.video.mode = value == std::to_string(static_cast<int>(ScreenVideoMode::WINDOW)) ? ScreenVideoMode::WINDOW : ScreenVideoMode::FULLSCREEN;
|
||||||
options.video.mode = static_cast<screenVideoMode>(std::stoi(value));
|
options.video.mode = static_cast<ScreenVideoMode>(std::stoi(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (var == "video.window.size")
|
else if (var == "video.window.size")
|
||||||
@@ -300,8 +300,8 @@ bool setOptions(std::string var, std::string value)
|
|||||||
|
|
||||||
else if (var == "video.filter")
|
else if (var == "video.filter")
|
||||||
{
|
{
|
||||||
// options.video.filter = value == std::to_string(static_cast<int>(screenFilter::NEAREST)) ? screenFilter::NEAREST : screenFilter::LINEAL;
|
// options.video.filter = value == std::to_string(static_cast<int>(ScreenFilter::NEAREST)) ? ScreenFilter::NEAREST : ScreenFilter::LINEAL;
|
||||||
options.video.filter = static_cast<screenFilter>(std::stoi(value));
|
options.video.filter = static_cast<ScreenFilter>(std::stoi(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (var == "video.shaders")
|
else if (var == "video.shaders")
|
||||||
@@ -370,7 +370,7 @@ bool setOptions(std::string var, std::string value)
|
|||||||
|
|
||||||
else if (var == "game.difficulty")
|
else if (var == "game.difficulty")
|
||||||
{
|
{
|
||||||
options.game.difficulty = static_cast<gameDifficulty>(std::stoi(value));
|
options.game.difficulty = static_cast<GameDifficulty>(std::stoi(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (var == "game.autofire")
|
else if (var == "game.autofire")
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ Player::Player(int id, float x, int y, bool demo, SDL_Rect *playArea, std::vecto
|
|||||||
// Inicializa variables
|
// Inicializa variables
|
||||||
this->id = id;
|
this->id = id;
|
||||||
this->demo = demo;
|
this->demo = demo;
|
||||||
statusPlaying = playerStatus::WAITING;
|
statusPlaying = PlayerStatus::WAITING;
|
||||||
scoreBoardPanel = 0;
|
scoreBoardPanel = 0;
|
||||||
name = "";
|
name = "";
|
||||||
setRecordName(enterName->getName());
|
setRecordName(enterName->getName());
|
||||||
@@ -46,8 +46,8 @@ void Player::init()
|
|||||||
// Inicializa variables de estado
|
// Inicializa variables de estado
|
||||||
posX = defaultPosX;
|
posX = defaultPosX;
|
||||||
posY = defaultPosY;
|
posY = defaultPosY;
|
||||||
statusWalking = playerStatus::WALKING_STOP;
|
statusWalking = PlayerStatus::WALKING_STOP;
|
||||||
statusFiring = playerStatus::FIRING_NO;
|
statusFiring = PlayerStatus::FIRING_NO;
|
||||||
invulnerable = true;
|
invulnerable = true;
|
||||||
invulnerableCounter = PLAYER_INVULNERABLE_COUNTER;
|
invulnerableCounter = PLAYER_INVULNERABLE_COUNTER;
|
||||||
powerUp = false;
|
powerUp = false;
|
||||||
@@ -81,11 +81,11 @@ void Player::setInput(int input)
|
|||||||
{
|
{
|
||||||
switch (statusPlaying)
|
switch (statusPlaying)
|
||||||
{
|
{
|
||||||
case playerStatus::PLAYING:
|
case PlayerStatus::PLAYING:
|
||||||
setInputPlaying(input);
|
setInputPlaying(input);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case playerStatus::ENTERING_NAME:
|
case PlayerStatus::ENTERING_NAME:
|
||||||
setInputEnteringName(input);
|
setInputEnteringName(input);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -101,29 +101,29 @@ void Player::setInputPlaying(int input)
|
|||||||
{
|
{
|
||||||
case input_left:
|
case input_left:
|
||||||
velX = -baseSpeed;
|
velX = -baseSpeed;
|
||||||
setWalkingStatus(playerStatus::WALKING_LEFT);
|
setWalkingStatus(PlayerStatus::WALKING_LEFT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case input_right:
|
case input_right:
|
||||||
velX = baseSpeed;
|
velX = baseSpeed;
|
||||||
setWalkingStatus(playerStatus::WALKING_RIGHT);
|
setWalkingStatus(PlayerStatus::WALKING_RIGHT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case input_fire_center:
|
case input_fire_center:
|
||||||
setFiringStatus(playerStatus::FIRING_UP);
|
setFiringStatus(PlayerStatus::FIRING_UP);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case input_fire_left:
|
case input_fire_left:
|
||||||
setFiringStatus(playerStatus::FIRING_LEFT);
|
setFiringStatus(PlayerStatus::FIRING_LEFT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case input_fire_right:
|
case input_fire_right:
|
||||||
setFiringStatus(playerStatus::FIRING_RIGHT);
|
setFiringStatus(PlayerStatus::FIRING_RIGHT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
velX = 0;
|
velX = 0;
|
||||||
setWalkingStatus(playerStatus::WALKING_STOP);
|
setWalkingStatus(PlayerStatus::WALKING_STOP);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -198,7 +198,7 @@ void Player::move()
|
|||||||
// Si el cadaver abandona el area de juego por abajo
|
// Si el cadaver abandona el area de juego por abajo
|
||||||
if (playerSprite->getPosY() > param.game.playArea.rect.h)
|
if (playerSprite->getPosY() > param.game.playArea.rect.h)
|
||||||
{
|
{
|
||||||
setStatusPlaying(playerStatus::DIED);
|
setStatusPlaying(PlayerStatus::DIED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -219,7 +219,7 @@ void Player::render()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Establece el estado del jugador cuando camina
|
// Establece el estado del jugador cuando camina
|
||||||
void Player::setWalkingStatus(playerStatus status)
|
void Player::setWalkingStatus(PlayerStatus status)
|
||||||
{
|
{
|
||||||
// Si cambiamos de estado, reiniciamos la animación
|
// Si cambiamos de estado, reiniciamos la animación
|
||||||
if (statusWalking != status)
|
if (statusWalking != status)
|
||||||
@@ -229,7 +229,7 @@ void Player::setWalkingStatus(playerStatus status)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Establece el estado del jugador cuando dispara
|
// Establece el estado del jugador cuando dispara
|
||||||
void Player::setFiringStatus(playerStatus status)
|
void Player::setFiringStatus(PlayerStatus status)
|
||||||
{
|
{
|
||||||
// Si cambiamos de estado, reiniciamos la animación
|
// Si cambiamos de estado, reiniciamos la animación
|
||||||
if (statusFiring != status)
|
if (statusFiring != status)
|
||||||
@@ -242,16 +242,16 @@ void Player::setFiringStatus(playerStatus status)
|
|||||||
void Player::setAnimation()
|
void Player::setAnimation()
|
||||||
{
|
{
|
||||||
// Crea cadenas de texto para componer el nombre de la animación
|
// Crea cadenas de texto para componer el nombre de la animación
|
||||||
const std::string aWalking = statusWalking == playerStatus::WALKING_STOP ? "stand" : "walk";
|
const std::string aWalking = statusWalking == PlayerStatus::WALKING_STOP ? "stand" : "walk";
|
||||||
const std::string aFiring = statusFiring == playerStatus::FIRING_UP ? "centershoot" : "sideshoot";
|
const std::string aFiring = statusFiring == PlayerStatus::FIRING_UP ? "centershoot" : "sideshoot";
|
||||||
|
|
||||||
const SDL_RendererFlip flipWalk = statusWalking == playerStatus::WALKING_RIGHT ? SDL_FLIP_HORIZONTAL : SDL_FLIP_NONE;
|
const SDL_RendererFlip flipWalk = statusWalking == PlayerStatus::WALKING_RIGHT ? SDL_FLIP_HORIZONTAL : SDL_FLIP_NONE;
|
||||||
const SDL_RendererFlip flipFire = statusFiring == playerStatus::FIRING_RIGHT ? SDL_FLIP_HORIZONTAL : SDL_FLIP_NONE;
|
const SDL_RendererFlip flipFire = statusFiring == PlayerStatus::FIRING_RIGHT ? SDL_FLIP_HORIZONTAL : SDL_FLIP_NONE;
|
||||||
|
|
||||||
// Establece la animación a partir de las cadenas
|
// Establece la animación a partir de las cadenas
|
||||||
if (isPlaying())
|
if (isPlaying())
|
||||||
{
|
{
|
||||||
if (statusFiring == playerStatus::FIRING_NO)
|
if (statusFiring == PlayerStatus::FIRING_NO)
|
||||||
{ // No esta disparando
|
{ // No esta disparando
|
||||||
playerSprite->setCurrentAnimation(aWalking);
|
playerSprite->setCurrentAnimation(aWalking);
|
||||||
playerSprite->setFlip(flipWalk);
|
playerSprite->setFlip(flipWalk);
|
||||||
@@ -326,7 +326,7 @@ void Player::updateCooldown()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setFiringStatus(playerStatus::FIRING_NO);
|
setFiringStatus(PlayerStatus::FIRING_NO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,43 +367,43 @@ void Player::addScore(int score)
|
|||||||
// Indica si el jugador está jugando
|
// Indica si el jugador está jugando
|
||||||
bool Player::isPlaying() const
|
bool Player::isPlaying() const
|
||||||
{
|
{
|
||||||
return statusPlaying == playerStatus::PLAYING;
|
return statusPlaying == PlayerStatus::PLAYING;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Indica si el jugador está continuando
|
// Indica si el jugador está continuando
|
||||||
bool Player::isContinue() const
|
bool Player::isContinue() const
|
||||||
{
|
{
|
||||||
return statusPlaying == playerStatus::CONTINUE;
|
return statusPlaying == PlayerStatus::CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Indica si el jugador está esperando
|
// Indica si el jugador está esperando
|
||||||
bool Player::isWaiting() const
|
bool Player::isWaiting() const
|
||||||
{
|
{
|
||||||
return statusPlaying == playerStatus::WAITING;
|
return statusPlaying == PlayerStatus::WAITING;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Indica si el jugador está introduciendo su nombre
|
// Indica si el jugador está introduciendo su nombre
|
||||||
bool Player::isEnteringName() const
|
bool Player::isEnteringName() const
|
||||||
{
|
{
|
||||||
return statusPlaying == playerStatus::ENTERING_NAME;
|
return statusPlaying == PlayerStatus::ENTERING_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Indica si el jugador está muriendose
|
// Indica si el jugador está muriendose
|
||||||
bool Player::isDying() const
|
bool Player::isDying() const
|
||||||
{
|
{
|
||||||
return statusPlaying == playerStatus::DYING;
|
return statusPlaying == PlayerStatus::DYING;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Indica si el jugador ha terminado de morir
|
// Indica si el jugador ha terminado de morir
|
||||||
bool Player::hasDied() const
|
bool Player::hasDied() const
|
||||||
{
|
{
|
||||||
return statusPlaying == playerStatus::DIED;
|
return statusPlaying == PlayerStatus::DIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Indica si el jugador ya ha terminado de jugar
|
// Indica si el jugador ya ha terminado de jugar
|
||||||
bool Player::isGameOver() const
|
bool Player::isGameOver() const
|
||||||
{
|
{
|
||||||
return statusPlaying == playerStatus::GAME_OVER;
|
return statusPlaying == PlayerStatus::GAME_OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actualiza el panel del marcador
|
// Actualiza el panel del marcador
|
||||||
@@ -412,13 +412,13 @@ void Player::updateScoreboard()
|
|||||||
switch (statusPlaying)
|
switch (statusPlaying)
|
||||||
{
|
{
|
||||||
|
|
||||||
case playerStatus::CONTINUE:
|
case PlayerStatus::CONTINUE:
|
||||||
{
|
{
|
||||||
Scoreboard::get()->setContinue(getScoreBoardPanel(), getContinueCounter());
|
Scoreboard::get()->setContinue(getScoreBoardPanel(), getContinueCounter());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case playerStatus::ENTERING_NAME:
|
case PlayerStatus::ENTERING_NAME:
|
||||||
{
|
{
|
||||||
Scoreboard::get()->setRecordName(getScoreBoardPanel(), getRecordName());
|
Scoreboard::get()->setRecordName(getScoreBoardPanel(), getRecordName());
|
||||||
Scoreboard::get()->setSelectorPos(getScoreBoardPanel(), getRecordNamePos());
|
Scoreboard::get()->setSelectorPos(getScoreBoardPanel(), getRecordNamePos());
|
||||||
@@ -431,7 +431,7 @@ void Player::updateScoreboard()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Cambia el modo del marcador
|
// Cambia el modo del marcador
|
||||||
void Player::setScoreboardMode(scoreboardMode mode)
|
void Player::setScoreboardMode(ScoreboardMode mode)
|
||||||
{
|
{
|
||||||
if (!demo)
|
if (!demo)
|
||||||
{
|
{
|
||||||
@@ -440,43 +440,43 @@ void Player::setScoreboardMode(scoreboardMode mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Establece el estado del jugador en el juego
|
// Establece el estado del jugador en el juego
|
||||||
void Player::setStatusPlaying(playerStatus value)
|
void Player::setStatusPlaying(PlayerStatus value)
|
||||||
{
|
{
|
||||||
statusPlaying = value;
|
statusPlaying = value;
|
||||||
|
|
||||||
switch (statusPlaying)
|
switch (statusPlaying)
|
||||||
{
|
{
|
||||||
case playerStatus::PLAYING:
|
case PlayerStatus::PLAYING:
|
||||||
{
|
{
|
||||||
statusPlaying = playerStatus::PLAYING;
|
statusPlaying = PlayerStatus::PLAYING;
|
||||||
init();
|
init();
|
||||||
setScoreboardMode(scoreboardMode::SCORE);
|
setScoreboardMode(ScoreboardMode::SCORE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case playerStatus::CONTINUE:
|
case PlayerStatus::CONTINUE:
|
||||||
{
|
{
|
||||||
// Inicializa el contador de continuar
|
// Inicializa el contador de continuar
|
||||||
continueTicks = SDL_GetTicks();
|
continueTicks = SDL_GetTicks();
|
||||||
continueCounter = 9;
|
continueCounter = 9;
|
||||||
enterName->init();
|
enterName->init();
|
||||||
setScoreboardMode(scoreboardMode::CONTINUE);
|
setScoreboardMode(ScoreboardMode::CONTINUE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case playerStatus::WAITING:
|
case PlayerStatus::WAITING:
|
||||||
{
|
{
|
||||||
setScoreboardMode(scoreboardMode::WAITING);
|
setScoreboardMode(ScoreboardMode::WAITING);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case playerStatus::ENTERING_NAME:
|
case PlayerStatus::ENTERING_NAME:
|
||||||
{
|
{
|
||||||
setScoreboardMode(scoreboardMode::ENTER_NAME);
|
setScoreboardMode(ScoreboardMode::ENTER_NAME);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case playerStatus::DYING:
|
case PlayerStatus::DYING:
|
||||||
{
|
{
|
||||||
// Activa la animación de morir
|
// Activa la animación de morir
|
||||||
playerSprite->setAccelY(0.2f);
|
playerSprite->setAccelY(0.2f);
|
||||||
@@ -485,16 +485,16 @@ void Player::setStatusPlaying(playerStatus value)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case playerStatus::DIED:
|
case PlayerStatus::DIED:
|
||||||
{
|
{
|
||||||
const auto nextPlayerStatus = IsEligibleForHighScore() ? playerStatus::ENTERING_NAME : playerStatus::CONTINUE;
|
const auto nextPlayerStatus = IsEligibleForHighScore() ? PlayerStatus::ENTERING_NAME : PlayerStatus::CONTINUE;
|
||||||
demo ? setStatusPlaying(playerStatus::WAITING) : setStatusPlaying(nextPlayerStatus);
|
demo ? setStatusPlaying(PlayerStatus::WAITING) : setStatusPlaying(nextPlayerStatus);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case playerStatus::GAME_OVER:
|
case PlayerStatus::GAME_OVER:
|
||||||
{
|
{
|
||||||
setScoreboardMode(scoreboardMode::GAME_OVER);
|
setScoreboardMode(ScoreboardMode::GAME_OVER);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -504,7 +504,7 @@ void Player::setStatusPlaying(playerStatus value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Obtiene el estado del jugador en el juego
|
// Obtiene el estado del jugador en el juego
|
||||||
playerStatus Player::getStatusPlaying() const
|
PlayerStatus Player::getStatusPlaying() const
|
||||||
{
|
{
|
||||||
return statusPlaying;
|
return statusPlaying;
|
||||||
}
|
}
|
||||||
@@ -694,7 +694,7 @@ int Player::getContinueCounter() const
|
|||||||
// Actualiza el contador de continue
|
// Actualiza el contador de continue
|
||||||
void Player::updateContinueCounter()
|
void Player::updateContinueCounter()
|
||||||
{
|
{
|
||||||
if (statusPlaying == playerStatus::CONTINUE)
|
if (statusPlaying == PlayerStatus::CONTINUE)
|
||||||
{
|
{
|
||||||
const Uint32 ticksSpeed = 1000;
|
const Uint32 ticksSpeed = 1000;
|
||||||
|
|
||||||
@@ -724,7 +724,7 @@ void Player::decContinueCounter()
|
|||||||
continueCounter--;
|
continueCounter--;
|
||||||
if (continueCounter < 0)
|
if (continueCounter < 0)
|
||||||
{
|
{
|
||||||
setStatusPlaying(playerStatus::GAME_OVER);
|
setStatusPlaying(PlayerStatus::GAME_OVER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
#include "enter_name.h" // for EnterName
|
#include "enter_name.h" // for EnterName
|
||||||
#include "utils.h" // for circle_t
|
#include "utils.h" // for circle_t
|
||||||
class Texture; // lines 12-12
|
class Texture; // lines 12-12
|
||||||
enum class scoreboardMode;
|
enum class ScoreboardMode;
|
||||||
|
|
||||||
// Estados del jugador
|
// Estados del jugador
|
||||||
enum class playerStatus
|
enum class PlayerStatus
|
||||||
{
|
{
|
||||||
WALKING_LEFT,
|
WALKING_LEFT,
|
||||||
WALKING_RIGHT,
|
WALKING_RIGHT,
|
||||||
@@ -60,9 +60,9 @@ private:
|
|||||||
int cooldown; // Contador durante el cual no puede disparar
|
int cooldown; // Contador durante el cual no puede disparar
|
||||||
int score; // Puntos del jugador
|
int score; // Puntos del jugador
|
||||||
float scoreMultiplier; // Multiplicador de puntos
|
float scoreMultiplier; // Multiplicador de puntos
|
||||||
playerStatus statusWalking; // Estado del jugador al moverse
|
PlayerStatus statusWalking; // Estado del jugador al moverse
|
||||||
playerStatus statusFiring; // Estado del jugador al disparar
|
PlayerStatus statusFiring; // Estado del jugador al disparar
|
||||||
playerStatus statusPlaying; // Estado del jugador en el juego
|
PlayerStatus statusPlaying; // Estado del jugador en el juego
|
||||||
bool invulnerable; // Indica si el jugador es invulnerable
|
bool invulnerable; // Indica si el jugador es invulnerable
|
||||||
int invulnerableCounter; // Contador para la invulnerabilidad
|
int invulnerableCounter; // Contador para la invulnerabilidad
|
||||||
bool extraHit; // Indica si el jugador tiene un toque extra
|
bool extraHit; // Indica si el jugador tiene un toque extra
|
||||||
@@ -99,7 +99,7 @@ private:
|
|||||||
bool IsEligibleForHighScore();
|
bool IsEligibleForHighScore();
|
||||||
|
|
||||||
// Cambia el modo del marcador
|
// Cambia el modo del marcador
|
||||||
void setScoreboardMode(scoreboardMode mode);
|
void setScoreboardMode(ScoreboardMode mode);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
@@ -133,10 +133,10 @@ public:
|
|||||||
void move();
|
void move();
|
||||||
|
|
||||||
// Establece el estado del jugador
|
// Establece el estado del jugador
|
||||||
void setWalkingStatus(playerStatus status);
|
void setWalkingStatus(PlayerStatus status);
|
||||||
|
|
||||||
// Establece el estado del jugador
|
// Establece el estado del jugador
|
||||||
void setFiringStatus(playerStatus status);
|
void setFiringStatus(PlayerStatus status);
|
||||||
|
|
||||||
// Establece la animación correspondiente al estado
|
// Establece la animación correspondiente al estado
|
||||||
void setAnimation();
|
void setAnimation();
|
||||||
@@ -193,10 +193,10 @@ public:
|
|||||||
bool isGameOver() const;
|
bool isGameOver() const;
|
||||||
|
|
||||||
// Establece el estado del jugador en el juego
|
// Establece el estado del jugador en el juego
|
||||||
void setStatusPlaying(playerStatus value);
|
void setStatusPlaying(PlayerStatus value);
|
||||||
|
|
||||||
// Obtiene el estado del jugador en el juego
|
// Obtiene el estado del jugador en el juego
|
||||||
playerStatus getStatusPlaying() const;
|
PlayerStatus getStatusPlaying() const;
|
||||||
|
|
||||||
// Obtiene el valor de la variable
|
// Obtiene el valor de la variable
|
||||||
float getScoreMultiplier() const;
|
float getScoreMultiplier() const;
|
||||||
|
|||||||
@@ -54,9 +54,9 @@ Scoreboard::Scoreboard(SDL_Renderer *renderer) : renderer(renderer)
|
|||||||
hiScoreName = "";
|
hiScoreName = "";
|
||||||
color = {0, 0, 0};
|
color = {0, 0, 0};
|
||||||
rect = {0, 0, 320, 40};
|
rect = {0, 0, 320, 40};
|
||||||
panel[SCOREBOARD_LEFT_PANEL].mode = scoreboardMode::SCORE;
|
panel[SCOREBOARD_LEFT_PANEL].mode = ScoreboardMode::SCORE;
|
||||||
panel[SCOREBOARD_RIGHT_PANEL].mode = scoreboardMode::SCORE;
|
panel[SCOREBOARD_RIGHT_PANEL].mode = ScoreboardMode::SCORE;
|
||||||
panel[SCOREBOARD_CENTER_PANEL].mode = scoreboardMode::STAGE_INFO;
|
panel[SCOREBOARD_CENTER_PANEL].mode = ScoreboardMode::STAGE_INFO;
|
||||||
ticks = SDL_GetTicks();
|
ticks = SDL_GetTicks();
|
||||||
counter = 0;
|
counter = 0;
|
||||||
|
|
||||||
@@ -262,7 +262,7 @@ void Scoreboard::fillPanelTextures()
|
|||||||
|
|
||||||
switch (panel[i].mode)
|
switch (panel[i].mode)
|
||||||
{
|
{
|
||||||
case scoreboardMode::SCORE:
|
case ScoreboardMode::SCORE:
|
||||||
{
|
{
|
||||||
// SCORE
|
// SCORE
|
||||||
textScoreBoard->writeCentered(slot4_1.x, slot4_1.y, name[i]);
|
textScoreBoard->writeCentered(slot4_1.x, slot4_1.y, name[i]);
|
||||||
@@ -274,7 +274,7 @@ void Scoreboard::fillPanelTextures()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case scoreboardMode::DEMO:
|
case ScoreboardMode::DEMO:
|
||||||
{
|
{
|
||||||
// DEMO MODE
|
// DEMO MODE
|
||||||
textScoreBoard->writeCentered(slot4_1.x, slot4_1.y + 4, lang::getText(101));
|
textScoreBoard->writeCentered(slot4_1.x, slot4_1.y + 4, lang::getText(101));
|
||||||
@@ -288,7 +288,7 @@ void Scoreboard::fillPanelTextures()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case scoreboardMode::WAITING:
|
case ScoreboardMode::WAITING:
|
||||||
{
|
{
|
||||||
// GAME OVER
|
// GAME OVER
|
||||||
textScoreBoard->writeCentered(slot4_1.x, slot4_1.y + 4, lang::getText(102));
|
textScoreBoard->writeCentered(slot4_1.x, slot4_1.y + 4, lang::getText(102));
|
||||||
@@ -302,7 +302,7 @@ void Scoreboard::fillPanelTextures()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case scoreboardMode::GAME_OVER:
|
case ScoreboardMode::GAME_OVER:
|
||||||
{
|
{
|
||||||
// GAME OVER
|
// GAME OVER
|
||||||
textScoreBoard->writeCentered(slot4_1.x, slot4_1.y + 4, lang::getText(102));
|
textScoreBoard->writeCentered(slot4_1.x, slot4_1.y + 4, lang::getText(102));
|
||||||
@@ -316,7 +316,7 @@ void Scoreboard::fillPanelTextures()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case scoreboardMode::STAGE_INFO:
|
case ScoreboardMode::STAGE_INFO:
|
||||||
{
|
{
|
||||||
// STAGE
|
// STAGE
|
||||||
textScoreBoard->writeCentered(slot4_1.x, slot4_1.y, lang::getText(57) + std::to_string(stage));
|
textScoreBoard->writeCentered(slot4_1.x, slot4_1.y, lang::getText(57) + std::to_string(stage));
|
||||||
@@ -333,7 +333,7 @@ void Scoreboard::fillPanelTextures()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case scoreboardMode::CONTINUE:
|
case ScoreboardMode::CONTINUE:
|
||||||
{
|
{
|
||||||
// SCORE
|
// SCORE
|
||||||
textScoreBoard->writeCentered(slot4_1.x, slot4_1.y, name[i]);
|
textScoreBoard->writeCentered(slot4_1.x, slot4_1.y, name[i]);
|
||||||
@@ -345,7 +345,7 @@ void Scoreboard::fillPanelTextures()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case scoreboardMode::ENTER_NAME:
|
case ScoreboardMode::ENTER_NAME:
|
||||||
{
|
{
|
||||||
// SCORE
|
// SCORE
|
||||||
textScoreBoard->writeCentered(slot4_1.x, slot4_1.y, name[i]);
|
textScoreBoard->writeCentered(slot4_1.x, slot4_1.y, name[i]);
|
||||||
@@ -457,7 +457,7 @@ void Scoreboard::recalculateAnchors()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Establece el modo del marcador
|
// Establece el modo del marcador
|
||||||
void Scoreboard::setMode(int index, scoreboardMode mode)
|
void Scoreboard::setMode(int index, ScoreboardMode mode)
|
||||||
{
|
{
|
||||||
panel[index].mode = mode;
|
panel[index].mode = mode;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ constexpr int SCOREBOARD_MAX_PANELS = 3;
|
|||||||
constexpr int SCOREBOARD_TICK_SPEED = 100;
|
constexpr int SCOREBOARD_TICK_SPEED = 100;
|
||||||
|
|
||||||
// Enums
|
// Enums
|
||||||
enum class scoreboardMode
|
enum class ScoreboardMode
|
||||||
{
|
{
|
||||||
SCORE,
|
SCORE,
|
||||||
STAGE_INFO,
|
STAGE_INFO,
|
||||||
@@ -34,7 +34,7 @@ enum class scoreboardMode
|
|||||||
// Structs
|
// Structs
|
||||||
struct panel_t
|
struct panel_t
|
||||||
{
|
{
|
||||||
scoreboardMode mode; // Modo en el que se encuentra el panel
|
ScoreboardMode mode; // Modo en el que se encuentra el panel
|
||||||
SDL_Rect pos; // Posición donde dibujar el panel dentro del marcador
|
SDL_Rect pos; // Posición donde dibujar el panel dentro del marcador
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -161,5 +161,5 @@ public:
|
|||||||
void setPos(SDL_Rect rect);
|
void setPos(SDL_Rect rect);
|
||||||
|
|
||||||
// Establece el modo del marcador
|
// Establece el modo del marcador
|
||||||
void setMode(int index, scoreboardMode mode);
|
void setMode(int index, ScoreboardMode mode);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -184,16 +184,16 @@ void Screen::blit()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Establece el modo de video
|
// Establece el modo de video
|
||||||
void Screen::setVideoMode(screenVideoMode videoMode)
|
void Screen::setVideoMode(ScreenVideoMode videoMode)
|
||||||
{
|
{
|
||||||
options.video.mode = videoMode;
|
options.video.mode = videoMode;
|
||||||
#ifdef ARCADE
|
#ifdef ARCADE
|
||||||
options.video.mode = screenVideoMode::WINDOW;
|
options.video.mode = ScreenVideoMode::WINDOW;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (options.video.mode)
|
switch (options.video.mode)
|
||||||
{
|
{
|
||||||
case screenVideoMode::WINDOW:
|
case ScreenVideoMode::WINDOW:
|
||||||
{
|
{
|
||||||
// Cambia a modo de ventana
|
// Cambia a modo de ventana
|
||||||
SDL_SetWindowFullscreen(window, 0);
|
SDL_SetWindowFullscreen(window, 0);
|
||||||
@@ -213,7 +213,7 @@ void Screen::setVideoMode(screenVideoMode videoMode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Si está activo el modo de pantalla completa añade el borde
|
// Si está activo el modo de pantalla completa añade el borde
|
||||||
case screenVideoMode::FULLSCREEN:
|
case ScreenVideoMode::FULLSCREEN:
|
||||||
{
|
{
|
||||||
// Aplica el modo de video
|
// Aplica el modo de video
|
||||||
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||||
@@ -245,7 +245,7 @@ void Screen::setVideoMode(screenVideoMode videoMode)
|
|||||||
// Camibia entre pantalla completa y ventana
|
// Camibia entre pantalla completa y ventana
|
||||||
void Screen::switchVideoMode()
|
void Screen::switchVideoMode()
|
||||||
{
|
{
|
||||||
options.video.mode = options.video.mode == screenVideoMode::WINDOW ? screenVideoMode::FULLSCREEN : screenVideoMode::WINDOW;
|
options.video.mode = options.video.mode == ScreenVideoMode::WINDOW ? ScreenVideoMode::FULLSCREEN : ScreenVideoMode::WINDOW;
|
||||||
setVideoMode(options.video.mode);
|
setVideoMode(options.video.mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,7 +253,7 @@ void Screen::switchVideoMode()
|
|||||||
void Screen::setWindowSize(int size)
|
void Screen::setWindowSize(int size)
|
||||||
{
|
{
|
||||||
options.video.window.size = size;
|
options.video.window.size = size;
|
||||||
setVideoMode(screenVideoMode::WINDOW);
|
setVideoMode(ScreenVideoMode::WINDOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reduce el tamaño de la ventana
|
// Reduce el tamaño de la ventana
|
||||||
@@ -261,7 +261,7 @@ void Screen::decWindowSize()
|
|||||||
{
|
{
|
||||||
--options.video.window.size;
|
--options.video.window.size;
|
||||||
options.video.window.size = std::max(options.video.window.size, 1);
|
options.video.window.size = std::max(options.video.window.size, 1);
|
||||||
setVideoMode(screenVideoMode::WINDOW);
|
setVideoMode(ScreenVideoMode::WINDOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Aumenta el tamaño de la ventana
|
// Aumenta el tamaño de la ventana
|
||||||
@@ -269,7 +269,7 @@ void Screen::incWindowSize()
|
|||||||
{
|
{
|
||||||
++options.video.window.size;
|
++options.video.window.size;
|
||||||
options.video.window.size = std::min(options.video.window.size, 4);
|
options.video.window.size = std::min(options.video.window.size, 4);
|
||||||
setVideoMode(screenVideoMode::WINDOW);
|
setVideoMode(ScreenVideoMode::WINDOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cambia el color del borde
|
// Cambia el color del borde
|
||||||
@@ -301,7 +301,7 @@ void Screen::checkInput()
|
|||||||
if (input->checkInput(input_window_fullscreen, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
if (input->checkInput(input_window_fullscreen, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
|
||||||
{
|
{
|
||||||
switchVideoMode();
|
switchVideoMode();
|
||||||
const std::string mode = options.video.mode == screenVideoMode::WINDOW ? "Window" : "Fullscreen";
|
const std::string mode = options.video.mode == ScreenVideoMode::WINDOW ? "Window" : "Fullscreen";
|
||||||
showNotification(mode + " mode");
|
showNotification(mode + " mode");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,13 +12,13 @@ class Asset;
|
|||||||
class Input;
|
class Input;
|
||||||
class Notify;
|
class Notify;
|
||||||
|
|
||||||
enum class screenFilter
|
enum class ScreenFilter
|
||||||
{
|
{
|
||||||
NEAREST = 0,
|
NEAREST = 0,
|
||||||
LINEAL = 1,
|
LINEAL = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class screenVideoMode
|
enum class ScreenVideoMode
|
||||||
{
|
{
|
||||||
WINDOW = 0,
|
WINDOW = 0,
|
||||||
FULLSCREEN = 1,
|
FULLSCREEN = 1,
|
||||||
@@ -122,7 +122,7 @@ public:
|
|||||||
void blit();
|
void blit();
|
||||||
|
|
||||||
// Establece el modo de video
|
// Establece el modo de video
|
||||||
void setVideoMode(screenVideoMode videoMode);
|
void setVideoMode(ScreenVideoMode videoMode);
|
||||||
|
|
||||||
// Camibia entre pantalla completa y ventana
|
// Camibia entre pantalla completa y ventana
|
||||||
void switchVideoMode();
|
void switchVideoMode();
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ void Title::init()
|
|||||||
ticks = 0;
|
ticks = 0;
|
||||||
ticksSpeed = 15;
|
ticksSpeed = 15;
|
||||||
fade->setColor(fadeColor.r, fadeColor.g, fadeColor.b);
|
fade->setColor(fadeColor.r, fadeColor.g, fadeColor.b);
|
||||||
fade->setType(fadeType::RANDOM_SQUARE);
|
fade->setType(FadeType::RANDOM_SQUARE);
|
||||||
fade->setPost(param.fade.postDuration);
|
fade->setPost(param.fade.postDuration);
|
||||||
demo = true;
|
demo = true;
|
||||||
numControllers = input->getNumControllers();
|
numControllers = input->getNumControllers();
|
||||||
|
|||||||
@@ -10,11 +10,11 @@
|
|||||||
#include "input.h" // for inputs_e
|
#include "input.h" // for inputs_e
|
||||||
struct JA_Music_t;
|
struct JA_Music_t;
|
||||||
struct JA_Sound_t;
|
struct JA_Sound_t;
|
||||||
enum class screenFilter;
|
enum class ScreenFilter;
|
||||||
enum class screenVideoMode;
|
enum class ScreenVideoMode;
|
||||||
|
|
||||||
// Dificultad del juego
|
// Dificultad del juego
|
||||||
enum class gameDifficulty
|
enum class GameDifficulty
|
||||||
{
|
{
|
||||||
EASY = 0,
|
EASY = 0,
|
||||||
NORMAL = 1,
|
NORMAL = 1,
|
||||||
@@ -105,8 +105,8 @@ struct op_window_t
|
|||||||
struct op_video_t
|
struct op_video_t
|
||||||
{
|
{
|
||||||
op_window_t window; // Opciones para la ventana del programa
|
op_window_t window; // Opciones para la ventana del programa
|
||||||
screenVideoMode mode; // Contiene el valor del modo de pantalla completa
|
ScreenVideoMode mode; // Contiene el valor del modo de pantalla completa
|
||||||
screenFilter filter; // Filtro usado para el escalado de la imagen
|
ScreenFilter filter; // Filtro usado para el escalado de la imagen
|
||||||
bool vSync; // Indica si se quiere usar vsync o no
|
bool vSync; // Indica si se quiere usar vsync o no
|
||||||
bool shaders; // Indica si se van a usar shaders para los filtros de video
|
bool shaders; // Indica si se van a usar shaders para los filtros de video
|
||||||
};
|
};
|
||||||
@@ -135,7 +135,7 @@ struct op_audio_t
|
|||||||
// Estructura para las opciones del juego
|
// Estructura para las opciones del juego
|
||||||
struct op_game_t
|
struct op_game_t
|
||||||
{
|
{
|
||||||
gameDifficulty difficulty; // Dificultad del juego
|
GameDifficulty difficulty; // Dificultad del juego
|
||||||
Uint8 language; // Idioma usado en el juego
|
Uint8 language; // Idioma usado en el juego
|
||||||
bool autofire; // Indica si el jugador ha de pulsar repetidamente para disparar o basta con mantener pulsado
|
bool autofire; // Indica si el jugador ha de pulsar repetidamente para disparar o basta con mantener pulsado
|
||||||
std::vector<hiScoreEntry_t> hiScoreTable; // Tabla con las mejores puntuaciones
|
std::vector<hiScoreEntry_t> hiScoreTable; // Tabla con las mejores puntuaciones
|
||||||
@@ -197,12 +197,12 @@ struct paramGame_t
|
|||||||
// param.fade
|
// param.fade
|
||||||
struct paramFade_t
|
struct paramFade_t
|
||||||
{
|
{
|
||||||
int numSquaresWidth; // Cantidad total de cuadraditos en horizontal para el fadeType::RANDOM_SQUARE
|
int numSquaresWidth; // Cantidad total de cuadraditos en horizontal para el FadeType::RANDOM_SQUARE
|
||||||
int numSquaresHeight; // Cantidad total de cuadraditos en vertical para el fadeType::RANDOM_SQUARE
|
int numSquaresHeight; // Cantidad total de cuadraditos en vertical para el FadeType::RANDOM_SQUARE
|
||||||
int randomSquaresDelay; // Duración entre cada pintado de cuadrados
|
int randomSquaresDelay; // Duración entre cada pintado de cuadrados
|
||||||
int randomSquaresMult; // Cantidad de cuadrados que se pintaran cada vez
|
int randomSquaresMult; // Cantidad de cuadrados que se pintaran cada vez
|
||||||
int postDuration; // Duración final del fade
|
int postDuration; // Duración final del fade
|
||||||
int venetianSize; // Altura de los rectangulos para fadeType::VENETIAN
|
int venetianSize; // Altura de los rectangulos para FadeType::VENETIAN
|
||||||
};
|
};
|
||||||
|
|
||||||
// param.title
|
// param.title
|
||||||
|
|||||||
Reference in New Issue
Block a user