This commit is contained in:
2024-10-10 20:59:39 +02:00
parent d6c3c89872
commit 117b80bdfc
18 changed files with 197 additions and 197 deletions

View File

@@ -29,8 +29,8 @@ Background::Background(SDL_Renderer *renderer)
dst_rect_ = {0, 0, 320, 240};
base_ = rect_.h;
color_ = {param.background.attenuateColor.r, param.background.attenuateColor.g, param.background.attenuateColor.b};
alpha_color_text_ = alpha_color_text_temp_ = param.background.attenuateAlpha;
color_ = {param.background.attenuate_color.r, param.background.attenuate_color.g, param.background.attenuate_color.b};
alpha_color_text_ = alpha_color_text_temp_ = param.background.attenuate_alpha;
gradient_rect_[0] = {0, 0, rect_.w, rect_.h};
gradient_rect_[1] = {rect_.w, 0, rect_.w, rect_.h};

View File

@@ -27,8 +27,8 @@ Balloon::Balloon(float x, float y, Uint8 kind, float vel_x, float speed, Uint16
vel_x_ = vel_x;
vel_y_ = 0;
max_vel_y_ = 3.0f;
gravity_ = param.balloon1.grav;
default_vel_y_ = param.balloon1.vel;
gravity_ = param.balloon_1.grav;
default_vel_y_ = param.balloon_1.vel;
// Puntos que da el globo al ser destruido
score_ = BALLOON_SCORE_1;
@@ -49,8 +49,8 @@ Balloon::Balloon(float x, float y, Uint8 kind, float vel_x, float speed, Uint16
vel_x_ = vel_x;
vel_y_ = 0;
max_vel_y_ = 3.0f;
gravity_ = param.balloon2.grav;
default_vel_y_ = param.balloon2.vel;
gravity_ = param.balloon_2.grav;
default_vel_y_ = param.balloon_2.vel;
// Puntos que da el globo al ser destruido
score_ = BALLOON_SCORE_2;
@@ -71,8 +71,8 @@ Balloon::Balloon(float x, float y, Uint8 kind, float vel_x, float speed, Uint16
vel_x_ = vel_x;
vel_y_ = 0;
max_vel_y_ = 3.0f;
gravity_ = param.balloon3.grav;
default_vel_y_ = param.balloon3.vel;
gravity_ = param.balloon_3.grav;
default_vel_y_ = param.balloon_3.vel;
// Puntos que da el globo al ser destruido
score_ = BALLOON_SCORE_3;
@@ -93,8 +93,8 @@ Balloon::Balloon(float x, float y, Uint8 kind, float vel_x, float speed, Uint16
vel_x_ = vel_x;
vel_y_ = 0;
max_vel_y_ = 3.0f;
gravity_ = param.balloon4.grav;
default_vel_y_ = param.balloon4.vel;
gravity_ = param.balloon_4.grav;
default_vel_y_ = param.balloon_4.vel;
// Puntos que da el globo al ser destruido
score_ = BALLOON_SCORE_4;
@@ -203,8 +203,8 @@ Balloon::Balloon(float x, float y, Uint8 kind, float vel_x, float speed, Uint16
vel_x_ = vel_x;
vel_y_ = 0;
max_vel_y_ = 3.0f;
gravity_ = param.balloon4.grav;
default_vel_y_ = param.balloon4.vel;
gravity_ = param.balloon_4.grav;
default_vel_y_ = param.balloon_4.vel;
// Puntos que da el globo al ser destruido
score_ = 0;

View File

@@ -16,7 +16,7 @@ DefineButtons::DefineButtons(std::unique_ptr<Text> text)
// Inicializa variables
enabled = false;
x = param.game.width / 2;
y = param.title.pressStartPosition;
y = param.title.press_start_position;
indexController = 0;
indexButton = 0;
@@ -59,7 +59,7 @@ void DefineButtons::render()
{
if (enabled)
{
text->writeCentered(x, y - 10, lang::getText(100) + std::to_string(options.controller[indexController].playerId));
text->writeCentered(x, y - 10, lang::getText(100) + std::to_string(options.controller[indexController].player_id));
text->writeCentered(x, y, controllerNames[indexController]);
text->writeCentered(x, y + 10, buttons[indexButton].label);
}
@@ -172,7 +172,7 @@ void DefineButtons::saveBindingsToOptions()
// Intercambia los jugadores asignados a los dos primeros mandos
void DefineButtons::swapControllers()
{
const int temp = options.controller[0].playerId;
options.controller[0].playerId = options.controller[1].playerId;
options.controller[1].playerId = temp;
const int temp = options.controller[0].player_id;
options.controller[0].player_id = options.controller[1].player_id;
options.controller[1].player_id = temp;
}

View File

@@ -80,7 +80,7 @@ Director::Director(int argc, char *argv[])
loadParams(paramFilePath);
// Carga el fichero de puntuaciones
auto manager = std::make_unique<ManageHiScoreTable>(&options.game.hiScoreTable);
auto manager = std::make_unique<ManageHiScoreTable>(&options.game.hi_score_table);
manager->loadFromFile(Asset::get()->get("score.bin"));
// Inicializa SDL
@@ -302,7 +302,7 @@ bool Director::initSDL()
{
// Crea un renderizador para la ventana. El vsync se activa en funcion de las opciones
Uint32 flags = 0;
if (options.video.vSync)
if (options.video.v_sync)
{
flags = flags | SDL_RENDERER_PRESENTVSYNC;
}

View File

@@ -28,7 +28,7 @@ void EnemyFormations::initEnemyFormations()
const int y1 = -BLOCK;
const int x1_0 = param.game.play_area.rect.x;
const int x1_50 = param.game.play_area.centerX - (BALLOON_WIDTH_1 / 2);
const int x1_50 = param.game.play_area.center_x - (BALLOON_WIDTH_1 / 2);
const int x1_100 = param.game.play_area.rect.w - BALLOON_WIDTH_1;
// Inicializa a cero las variables
@@ -67,11 +67,11 @@ void EnemyFormations::initEnemyFormations()
// #01 - Dos enemigos BALLOON4 uno a cada cuarto. Ambos van hacia el centro
j = 1;
enemyFormation[j].numberOfEnemies = 2;
incX = param.game.play_area.centerX;
incX = param.game.play_area.center_x;
incTime = 0;
for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
{
enemyFormation[j].init[i].x = param.game.play_area.firstQuarterX - (BALLOON_WIDTH_4 / 2) + (i * incX);
enemyFormation[j].init[i].x = param.game.play_area.first_quarter_x - (BALLOON_WIDTH_4 / 2) + (i * incX);
enemyFormation[j].init[i].y = y4;
enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE * (((i % 2) * 2) - 1);
enemyFormation[j].init[i].kind = BALLOON_4;

View File

@@ -41,7 +41,7 @@ void Fade::init()
numSquaresWidth = param.fade.num_squares_width;
numSquaresHeight = param.fade.num_squares_height;
fadeRandomSquaresDelay = param.fade.random_squares_delay;
fadeRandomSquaresMult = param.fade.randomSquaresMult;
fadeRandomSquaresMult = param.fade.random_squares_mult;
}
// Resetea algunas variables para volver a hacer el fade sin perder ciertos parametros
@@ -150,7 +150,7 @@ void Fade::update()
case FadeType::VENETIAN:
{
// Counter debe ir de 0 a 150
if (square.back().h < param.fade.venetianSize)
if (square.back().h < param.fade.venetian_size)
{
// Dibuja sobre el backbuffer
auto *temp = SDL_GetRenderTarget(renderer);
@@ -271,11 +271,11 @@ void Fade::activate()
a = 255;
// Añade los cuadrados al vector
const int max = param.game.height / param.fade.venetianSize;
const int max = param.game.height / param.fade.venetian_size;
for (int i = 0; i < max; ++i)
{
rect1.y = i * param.fade.venetianSize;
rect1.y = i * param.fade.venetian_size;
square.push_back(rect1);
}

View File

@@ -95,7 +95,7 @@ Game::Game(int playerID, int currentStage, bool demo, JA_Music_t *music)
Game::~Game()
{
// Guarda las puntuaciones en un fichero
auto manager = std::make_unique<ManageHiScoreTable>(&options.game.hiScoreTable);
auto manager = std::make_unique<ManageHiScoreTable>(&options.game.hi_score_table);
manager->saveToFile(asset->get("score.bin"));
#ifdef RECORDING
saveDemoFile(asset->get("demo1.bin"));
@@ -122,14 +122,14 @@ void Game::init(int playerID)
players.clear();
// Crea los dos jugadores
auto player1 = std::make_unique<Player>(1, (param.game.play_area.firstQuarterX * ((0 * 2) + 1)) - 11, param.game.play_area.rect.h - 30, demo.enabled, &param.game.play_area.rect, playerTextures[0], playerAnimations);
auto player1 = std::make_unique<Player>(1, (param.game.play_area.first_quarter_x * ((0 * 2) + 1)) - 11, param.game.play_area.rect.h - 30, demo.enabled, &param.game.play_area.rect, playerTextures[0], playerAnimations);
player1->setScoreBoardPanel(SCOREBOARD_LEFT_PANEL);
player1->setName(lang::getText(53));
const auto controller1 = getController(player1->getId());
player1->setController(controller1);
players.push_back(std::move(player1));
auto player2 = std::make_unique<Player>(2, (param.game.play_area.firstQuarterX * ((1 * 2) + 1)) - 11, param.game.play_area.rect.h - 30, demo.enabled, &param.game.play_area.rect, playerTextures[1], playerAnimations);
auto player2 = std::make_unique<Player>(2, (param.game.play_area.first_quarter_x * ((1 * 2) + 1)) - 11, param.game.play_area.rect.h - 30, demo.enabled, &param.game.play_area.rect, playerTextures[1], playerAnimations);
player2->setScoreBoardPanel(SCOREBOARD_RIGHT_PANEL);
player2->setName(lang::getText(54));
const auto controller2 = getController(player2->getId());
@@ -152,7 +152,7 @@ void Game::init(int playerID)
{
defaultEnemySpeed = BALLOON_SPEED_1;
difficultyScoreMultiplier = 0.5f;
difficultyColor = difficultyEasyColor;
difficultyColor = difficulty_easy_color;
scoreboard->setColor(difficultyColor);
break;
}
@@ -161,8 +161,8 @@ void Game::init(int playerID)
{
defaultEnemySpeed = BALLOON_SPEED_1;
difficultyScoreMultiplier = 1.0f;
difficultyColor = difficultyNormalColor;
scoreboard->setColor(scoreboardColor);
difficultyColor = difficulty_normal_color;
scoreboard->setColor(scoreboard_color);
break;
}
@@ -170,7 +170,7 @@ void Game::init(int playerID)
{
defaultEnemySpeed = BALLOON_SPEED_5;
difficultyScoreMultiplier = 1.5f;
difficultyColor = difficultyHardColor;
difficultyColor = difficulty_hard_color;
scoreboard->setColor(difficultyColor);
break;
}
@@ -192,8 +192,8 @@ void Game::init(int playerID)
scoreboard->setMode(SCOREBOARD_CENTER_PANEL, ScoreboardMode::STAGE_INFO);
// Resto de variables
hiScore.score = options.game.hiScoreTable[0].score;
hiScore.name = options.game.hiScoreTable[0].name;
hiScore.score = options.game.hi_score_table[0].score;
hiScore.name = options.game.hi_score_table[0].name;
paused = false;
gameCompleted = false;
gameCompletedCounter = 0;
@@ -289,8 +289,8 @@ void Game::init(int playerID)
demo.counter = 0;
// Inicializa el objeto para el fundido
fade->setColor(fadeColor.r, fadeColor.g, fadeColor.b);
fade->setPost(param.fade.postDuration);
fade->setColor(fade_color.r, fade_color.g, fade_color.b);
fade->setPost(param.fade.post_duration);
fade->setType(FadeType::VENETIAN);
// Con los globos creados, calcula el nivel de amenaza
@@ -608,15 +608,15 @@ bool Game::loadDemoFile(std::string filePath, DemoKeys (*dataFile)[TOTAL_DEMO_DA
// Inicializas los datos y los guarda en el fichero
for (int i = 0; i < TOTAL_DEMO_DATA; ++i)
{
DemoKeys tmp;
tmp.left = 0;
tmp.right = 0;
tmp.noInput = 0;
tmp.fire = 0;
tmp.fireLeft = 0;
tmp.fireRight = 0;
(*dataFile)[i] = tmp;
SDL_RWwrite(file, &tmp, sizeof(DemoKeys), 1);
DemoKeys dk;
dk.left = 0;
dk.right = 0;
dk.no_input = 0;
dk.fire = 0;
dk.fire_left = 0;
dk.fire_right = 0;
(*dataFile)[i] = dk;
SDL_RWwrite(file, &dk, sizeof(DemoKeys), 1);
}
// Cerramos el fichero
@@ -837,7 +837,7 @@ void Game::updateStage()
stageBitmapCounter = 0;
enemySpeed = defaultEnemySpeed;
setBalloonSpeed(enemySpeed);
screen->flash(flashColor, 5);
screen->flash(flash_color, 5);
screen->shake();
}
@@ -922,7 +922,7 @@ void Game::createPowerBall()
constexpr auto posY = -BLOCK;
const auto left = param.game.play_area.rect.x;
const auto center = param.game.play_area.centerX - (BALLOON_WIDTH_4 / 2);
const auto center = param.game.play_area.center_x - (BALLOON_WIDTH_4 / 2);
const auto right = param.game.play_area.rect.w - BALLOON_WIDTH_4;
const auto vpos = BALLOON_VELX_POSITIVE;
@@ -1177,7 +1177,7 @@ void Game::destroyAllBalloons()
enemyDeployCounter = 300;
JA_PlaySound(powerBallSound);
screen->flash(flashColor, 5);
screen->flash(flash_color, 5);
screen->shake();
}
@@ -1980,7 +1980,7 @@ void Game::checkInput()
player->setInput(input_right);
}
else if (demo.dataFile[i][demo.counter].noInput == 1)
else if (demo.dataFile[i][demo.counter].no_input == 1)
{
player->setInput(input_null);
}
@@ -1996,7 +1996,7 @@ void Game::checkInput()
}
}
else if (demo.dataFile[i][demo.counter].fireLeft == 1)
else if (demo.dataFile[i][demo.counter].fire_left == 1)
{
if (player->canFire())
{
@@ -2006,7 +2006,7 @@ void Game::checkInput()
}
}
else if (demo.dataFile[i][demo.counter].fireRight == 1)
else if (demo.dataFile[i][demo.counter].fire_right == 1)
{
if (player->canFire())
{
@@ -2034,10 +2034,10 @@ void Game::checkInput()
// Resetea el teclado
demo.keys.left = 0;
demo.keys.right = 0;
demo.keys.noInput = 0;
demo.keys.no_input = 0;
demo.keys.fire = 0;
demo.keys.fireLeft = 0;
demo.keys.fireRight = 0;
demo.keys.fire_left = 0;
demo.keys.fire_right = 0;
#endif
for (auto &player : players)
{
@@ -2046,7 +2046,7 @@ void Game::checkInput()
if (player->isPlaying())
{
// Input a la izquierda
if (input->checkInput(input_left, INPUT_ALLOW_REPEAT, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index))
if (input->checkInput(input_left, INPUT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
{
player->setInput(input_left);
#ifdef RECORDING
@@ -2056,7 +2056,7 @@ void Game::checkInput()
else
{
// Input a la derecha
if (input->checkInput(input_right, INPUT_ALLOW_REPEAT, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index))
if (input->checkInput(input_right, INPUT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
{
player->setInput(input_right);
#ifdef RECORDING
@@ -2068,12 +2068,12 @@ void Game::checkInput()
// Ninguno de los dos inputs anteriores
player->setInput(input_null);
#ifdef RECORDING
demo.keys.noInput = 1;
demo.keys.no_input = 1;
#endif
}
}
// Comprueba el input de disparar al centro
if (input->checkInput(input_fire_center, autofire, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index))
if (input->checkInput(input_fire_center, autofire, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
{
if (player->canFire())
{
@@ -2090,7 +2090,7 @@ void Game::checkInput()
}
// Comprueba el input de disparar a la izquierda
else if (input->checkInput(input_fire_left, autofire, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index))
else if (input->checkInput(input_fire_left, autofire, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
{
if (player->canFire())
{
@@ -2101,13 +2101,13 @@ void Game::checkInput()
// Reproduce el sonido de disparo
JA_PlaySound(bulletSound);
#ifdef RECORDING
demo.keys.fireLeft = 1;
demo.keys.fire_left = 1;
#endif
}
}
// Comprueba el input de disparar a la derecha
else if (input->checkInput(input_fire_right, autofire, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index))
else if (input->checkInput(input_fire_right, autofire, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
{
if (player->canFire())
{
@@ -2118,7 +2118,7 @@ void Game::checkInput()
// Reproduce el sonido de disparo
JA_PlaySound(bulletSound);
#ifdef RECORDING
demo.keys.fireRight = 1;
demo.keys.fire_right = 1;
#endif
}
}
@@ -2135,15 +2135,15 @@ void Game::checkInput()
else if (player->isContinue() || player->isWaiting())
{
// 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].device_type, options.controller[controllerIndex].index))
{
player->setStatusPlaying(PlayerStatus::PLAYING);
}
// Si está continuando, los botones de fuego hacen decrementar el contador
const auto fire1 = input->checkInput(input_fire_left, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index);
const auto fire2 = input->checkInput(input_fire_center, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index);
const auto fire3 = input->checkInput(input_fire_right, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index);
const auto fire1 = input->checkInput(input_fire_left, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index);
const auto fire2 = input->checkInput(input_fire_center, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index);
const auto fire3 = input->checkInput(input_fire_right, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index);
if (fire1 || fire2 || fire3)
{
player->decContinueCounter();
@@ -2151,9 +2151,9 @@ void Game::checkInput()
}
else if (player->isEnteringName())
{
const auto fire1 = input->checkInput(input_fire_left, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index);
const auto fire2 = input->checkInput(input_fire_center, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index);
const auto fire3 = input->checkInput(input_fire_right, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index);
const auto fire1 = input->checkInput(input_fire_left, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index);
const auto fire2 = input->checkInput(input_fire_center, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index);
const auto fire3 = input->checkInput(input_fire_right, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index);
if (fire1 || fire2 || fire3)
{
if (player->getRecordNamePos() == 7)
@@ -2167,23 +2167,23 @@ void Game::checkInput()
player->setInput(input_right);
}
}
else if (input->checkInput(input_up, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index))
else if (input->checkInput(input_up, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
{
player->setInput(input_up);
}
else if (input->checkInput(input_down, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index))
else if (input->checkInput(input_down, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
{
player->setInput(input_down);
}
else if (input->checkInput(input_left, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index))
else if (input->checkInput(input_left, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
{
player->setInput(input_left);
}
else if (input->checkInput(input_right, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index))
else if (input->checkInput(input_right, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
{
player->setInput(input_right);
}
else if (input->checkInput(input_start, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].deviceType, options.controller[controllerIndex].index))
else if (input->checkInput(input_start, INPUT_DO_NOT_ALLOW_REPEAT, options.controller[controllerIndex].device_type, options.controller[controllerIndex].index))
{
player->setInput(input_start);
addScoreToScoreBoard(player->getRecordName(), player->getScore());
@@ -2206,7 +2206,7 @@ void Game::renderMessages()
// GetReady
if (counter < STAGE_COUNTER && !demo.enabled)
{
textNokiaBig2->write((int)getReadyBitmapPath[counter], param.game.play_area.centerY - 8, lang::getText(75), -2);
textNokiaBig2->write((int)getReadyBitmapPath[counter], param.game.play_area.center_y - 8, lang::getText(75), -2);
}
// Time Stopped
@@ -2214,7 +2214,7 @@ void Game::renderMessages()
{
if (timeStoppedCounter > 100 || timeStoppedCounter % 10 > 4)
{
textNokia2->writeDX(TXT_CENTER, param.game.play_area.centerX, param.game.play_area.firstQuarterY, lang::getText(36) + std::to_string(timeStoppedCounter / 10), -1, noColor, 1, shdwTxtColor);
textNokia2->writeDX(TXT_CENTER, param.game.play_area.center_x, param.game.play_area.first_quarter_y, lang::getText(36) + std::to_string(timeStoppedCounter / 10), -1, no_color, 1, shdw_txt_color);
}
if (timeStoppedCounter > 100)
@@ -2250,13 +2250,13 @@ void Game::renderMessages()
if (!gameCompleted)
{ // Escribe el número de fases restantes
textNokiaBig2->writeDX(TXT_CENTER, param.game.play_area.centerX, stageBitmapPath[stageBitmapCounter], text, -2, noColor, 2, shdwTxtColor);
textNokiaBig2->writeDX(TXT_CENTER, param.game.play_area.center_x, stageBitmapPath[stageBitmapCounter], text, -2, no_color, 2, shdw_txt_color);
}
else
{ // Escribe el texto de juego completado
text = lang::getText(50);
textNokiaBig2->writeDX(TXT_CENTER, param.game.play_area.centerX, stageBitmapPath[stageBitmapCounter], text, -2, noColor, 1, shdwTxtColor);
textNokia2->writeDX(TXT_CENTER, param.game.play_area.centerX, stageBitmapPath[stageBitmapCounter] + textNokiaBig2->getCharacterSize() + 2, lang::getText(76), -1, noColor, 1, shdwTxtColor);
textNokiaBig2->writeDX(TXT_CENTER, param.game.play_area.center_x, stageBitmapPath[stageBitmapCounter], text, -2, no_color, 1, shdw_txt_color);
textNokia2->writeDX(TXT_CENTER, param.game.play_area.center_x, stageBitmapPath[stageBitmapCounter] + textNokiaBig2->getCharacterSize() + 2, lang::getText(76), -1, no_color, 1, shdw_txt_color);
}
}
}
@@ -2353,8 +2353,8 @@ void Game::initPaths()
// Letrero de STAGE #
constexpr auto firstPart = STAGE_COUNTER / 4; // 50
constexpr auto secondPart = firstPart * 3; // 150
const auto centerPoint = param.game.play_area.centerY - (BLOCK * 2);
const auto distance = (param.game.play_area.rect.h) - (param.game.play_area.centerY - 16);
const auto centerPoint = param.game.play_area.center_y - (BLOCK * 2);
const auto distance = (param.game.play_area.rect.h) - (param.game.play_area.center_y - 16);
for (int i = 0; i < STAGE_COUNTER; ++i)
{
@@ -2378,7 +2378,7 @@ void Game::initPaths()
const auto size = textNokiaBig2->lenght(lang::getText(75), -2);
const float start1 = param.game.play_area.rect.x - size;
const float finish1 = param.game.play_area.centerX - (size / 2);
const float finish1 = param.game.play_area.center_x - (size / 2);
const float start2 = finish1;
const float finish2 = param.game.play_area.rect.w;
@@ -2669,7 +2669,7 @@ void Game::pause(bool value)
void Game::addScoreToScoreBoard(std::string name, int score)
{
const auto entry = (HiScoreEntry){trim(name), score};
auto manager = std::make_unique<ManageHiScoreTable>(&options.game.hiScoreTable);
auto manager = std::make_unique<ManageHiScoreTable>(&options.game.hi_score_table);
manager->add(entry);
manager->saveToFile(asset->get("score.bin"));
}
@@ -2723,11 +2723,11 @@ std::shared_ptr<Player> Game::getPlayer(int id)
}
// Obtiene un controlador a partir del "id" del jugador
int Game::getController(int playerId)
int Game::getController(int player_id)
{
for (int i = 0; i < (int)options.controller.size(); ++i)
{
if (options.controller[i].playerId == playerId)
if (options.controller[i].player_id == player_id)
{
return i;
}

View File

@@ -24,7 +24,7 @@ GameLogo::GameLogo(int x, int y)
coffeeSprite = std::make_unique<SmartSprite>(coffeeTexture);
crisisSprite = std::make_unique<SmartSprite>(crisisTexture);
arcadeEditionSprite = std::make_unique<Sprite>((param.game.width - arcadeEditionTexture->getWidth()) / 2, param.title.arcadeEditionPosition, arcadeEditionTexture->getWidth(), arcadeEditionTexture->getHeight(), arcadeEditionTexture);
arcadeEditionSprite = std::make_unique<Sprite>((param.game.width - arcadeEditionTexture->getWidth()) / 2, param.title.arcade_edition_position, arcadeEditionTexture->getWidth(), arcadeEditionTexture->getHeight(), arcadeEditionTexture);
dustLSprite = std::make_unique<AnimatedSprite>(dustTexture, Asset::get()->get("title_dust.ani"));
dustRSprite = std::make_unique<AnimatedSprite>(dustTexture, Asset::get()->get("title_dust.ani"));

View File

@@ -48,9 +48,9 @@ HiScoreTable::HiScoreTable(JA_Music_t *music)
background->setCloudsSpeed(-0.1f);
background->setGradientNumber(1);
background->setTransition(0.8f);
fade->setColor(fadeColor.r, fadeColor.g, fadeColor.b);
fade->setColor(fade_color.r, fade_color.g, fade_color.b);
fade->setType(FadeType::RANDOM_SQUARE);
fade->setPost(param.fade.postDuration);
fade->setPost(param.fade.post_duration);
fade->setMode(fadeMode);
fade->activate();
@@ -121,13 +121,13 @@ void HiScoreTable::fillTexture()
SDL_RenderClear(renderer);
// Escribe el texto: Mejores puntuaciones
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, param.game.game_area.centerX, firstLine, lang::getText(42), 1, orangeColor, 1, shdwTxtColor);
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, param.game.game_area.center_x, firstLine, lang::getText(42), 1, orange_color, 1, shdw_txt_color);
// Escribe los nombres de la tabla de puntuaciones
for (int i = 0; i < maxNames; ++i)
{
const auto nameLenght = options.game.hiScoreTable[i].name.length();
const auto score = format(options.game.hiScoreTable[i].score);
const auto nameLenght = options.game.hi_score_table[i].name.length();
const auto score = format(options.game.hi_score_table[i].score);
const auto scoreLenght = score.size();
const auto numDots = 25 - nameLenght - scoreLenght;
std::string dots = "";
@@ -135,8 +135,8 @@ void HiScoreTable::fillTexture()
{
dots = dots + ".";
}
const auto line = options.game.hiScoreTable[i].name + dots + score;
text->writeDX(TXT_CENTER | TXT_SHADOW, param.game.game_area.centerX, (i * spaceBetweenLines) + firstLine + spaceBetweenHeader, line, 1, orangeColor, 1, shdwTxtColor);
const auto line = options.game.hi_score_table[i].name + dots + score;
text->writeDX(TXT_CENTER | TXT_SHADOW, param.game.game_area.center_x, (i * spaceBetweenLines) + firstLine + spaceBetweenHeader, line, 1, orange_color, 1, shdw_txt_color);
}
// Cambia el destino de renderizado
@@ -150,7 +150,7 @@ void HiScoreTable::render()
Screen::get()->start();
// Limpia la pantalla
Screen::get()->clean(bgColor);
Screen::get()->clean(bg_color);
// Pinta el fondo
background->render();

View File

@@ -53,9 +53,9 @@ Instructions::Instructions(JA_Music_t *music)
itemSpace = 2;
// Inicializa objetos
fade->setColor(fadeColor.r, fadeColor.g, fadeColor.b);
fade->setColor(fade_color.r, fade_color.g, fade_color.b);
fade->setType(FadeType::FULLSCREEN);
fade->setPost(param.fade.postDuration);
fade->setPost(param.fade.post_duration);
fade->setMode(FadeMode::IN);
fade->activate();
@@ -168,25 +168,25 @@ void Instructions::fillTexture()
const int anchorItem = (param.game.width - (lenght + despX)) / 2;
// Escribe el texto de las instrucciones
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, param.game.game_area.centerX, firstLine, lang::getText(11), 1, orangeColor, 1, shdwTxtColor);
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, param.game.game_area.center_x, firstLine, lang::getText(11), 1, orange_color, 1, shdw_txt_color);
const int anchor1 = firstLine + spacePostHeader;
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, param.game.game_area.centerX, anchor1 + spaceBetweenLines * 0, lang::getText(12), 1, noColor, 1, shdwTxtColor);
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, param.game.game_area.centerX, anchor1 + spaceBetweenLines * 1, lang::getText(13), 1, noColor, 1, shdwTxtColor);
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, param.game.game_area.centerX, anchor1 + spaceNewParagraph + spaceBetweenLines * 2, lang::getText(14), 1, noColor, 1, shdwTxtColor);
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, param.game.game_area.centerX, anchor1 + spaceNewParagraph + spaceBetweenLines * 3, lang::getText(15), 1, noColor, 1, shdwTxtColor);
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, param.game.game_area.center_x, anchor1 + spaceBetweenLines * 0, lang::getText(12), 1, no_color, 1, shdw_txt_color);
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, param.game.game_area.center_x, anchor1 + spaceBetweenLines * 1, lang::getText(13), 1, no_color, 1, shdw_txt_color);
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, param.game.game_area.center_x, anchor1 + spaceNewParagraph + spaceBetweenLines * 2, lang::getText(14), 1, no_color, 1, shdw_txt_color);
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, param.game.game_area.center_x, anchor1 + spaceNewParagraph + spaceBetweenLines * 3, lang::getText(15), 1, no_color, 1, shdw_txt_color);
// Escribe el texto de los objetos y sus puntos
const int anchor2 = anchor1 + spacePreHeader + spaceNewParagraph + spaceBetweenLines * 3;
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, param.game.game_area.centerX, anchor2, lang::getText(16), 1, orangeColor, 1, shdwTxtColor);
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, param.game.game_area.center_x, anchor2, lang::getText(16), 1, orange_color, 1, shdw_txt_color);
const int anchor3 = anchor2 + spacePostHeader;
// const int anchor4 = anchor3 + ((param.game.item_size + text->getCharacterSize()) / 2);
text->writeShadowed(anchorItem + despX, anchor3 + spaceBetweenItemLines * 0, lang::getText(17), shdwTxtColor);
text->writeShadowed(anchorItem + despX, anchor3 + spaceBetweenItemLines * 1, lang::getText(18), shdwTxtColor);
text->writeShadowed(anchorItem + despX, anchor3 + spaceBetweenItemLines * 2, lang::getText(19), shdwTxtColor);
text->writeShadowed(anchorItem + despX, anchor3 + spaceBetweenItemLines * 3, lang::getText(20), shdwTxtColor);
text->writeShadowed(anchorItem + despX, anchor3 + spaceBetweenItemLines * 4, lang::getText(21), shdwTxtColor);
text->writeShadowed(anchorItem + despX, anchor3 + spaceBetweenItemLines * 0, lang::getText(17), shdw_txt_color);
text->writeShadowed(anchorItem + despX, anchor3 + spaceBetweenItemLines * 1, lang::getText(18), shdw_txt_color);
text->writeShadowed(anchorItem + despX, anchor3 + spaceBetweenItemLines * 2, lang::getText(19), shdw_txt_color);
text->writeShadowed(anchorItem + despX, anchor3 + spaceBetweenItemLines * 3, lang::getText(20), shdw_txt_color);
text->writeShadowed(anchorItem + despX, anchor3 + spaceBetweenItemLines * 4, lang::getText(21), shdw_txt_color);
// Deja el renderizador como estaba
SDL_SetRenderTarget(renderer, temp);
@@ -267,7 +267,7 @@ void Instructions::render()
Screen::get()->start();
// Limpia la pantalla
Screen::get()->clean(bgColor);
Screen::get()->clean(bg_color);
// Dibuja el mosacico de fondo
tiledbg->render();

View File

@@ -44,13 +44,13 @@ Intro::Intro(JA_Music_t *music)
ss->setWidth(128);
ss->setHeight(96);
ss->setFinishedCounter(20);
ss->setDestX(param.game.game_area.centerX - 64);
ss->setDestY(param.game.game_area.firstQuarterY - 24);
ss->setDestX(param.game.game_area.center_x - 64);
ss->setDestY(param.game.game_area.first_quarter_y - 24);
bitmaps.push_back(std::move(ss));
}
bitmaps[0]->setPosX(-128);
bitmaps[0]->setPosY(param.game.game_area.firstQuarterY - 24);
bitmaps[0]->setPosY(param.game.game_area.first_quarter_y - 24);
bitmaps[0]->setVelX(0.0f);
bitmaps[0]->setVelY(0.0f);
bitmaps[0]->setAccelX(0.6f);
@@ -58,14 +58,14 @@ Intro::Intro(JA_Music_t *music)
bitmaps[0]->setSpriteClip(0, 0, 128, 96);
bitmaps[1]->setPosX(param.game.width);
bitmaps[1]->setPosY(param.game.game_area.firstQuarterY - 24);
bitmaps[1]->setPosY(param.game.game_area.first_quarter_y - 24);
bitmaps[1]->setVelX(-1.0f);
bitmaps[1]->setVelY(0.0f);
bitmaps[1]->setAccelX(-0.3f);
bitmaps[1]->setAccelY(0.0f);
bitmaps[1]->setSpriteClip(128, 0, 128, 96);
bitmaps[2]->setPosX(param.game.game_area.centerX - 64);
bitmaps[2]->setPosX(param.game.game_area.center_x - 64);
bitmaps[2]->setPosY(-96);
bitmaps[2]->setVelX(0.0f);
bitmaps[2]->setVelY(3.0f);
@@ -74,7 +74,7 @@ Intro::Intro(JA_Music_t *music)
bitmaps[2]->setSpriteClip(0, 96, 128, 96);
bitmaps[2]->setFinishedCounter(250);
bitmaps[3]->setPosX(param.game.game_area.centerX - 64);
bitmaps[3]->setPosX(param.game.game_area.center_x - 64);
bitmaps[3]->setPosY(param.game.height);
bitmaps[3]->setVelX(0.0f);
bitmaps[3]->setVelY(-0.7f);
@@ -82,7 +82,7 @@ Intro::Intro(JA_Music_t *music)
bitmaps[3]->setAccelY(0.0f);
bitmaps[3]->setSpriteClip(128, 96, 128, 96);
bitmaps[4]->setPosX(param.game.game_area.centerX - 64);
bitmaps[4]->setPosX(param.game.game_area.center_x - 64);
bitmaps[4]->setPosY(-96);
bitmaps[4]->setVelX(0.0f);
bitmaps[4]->setVelY(3.0f);
@@ -91,7 +91,7 @@ Intro::Intro(JA_Music_t *music)
bitmaps[4]->setSpriteClip(0, 192, 128, 96);
bitmaps[5]->setPosX(param.game.width);
bitmaps[5]->setPosY(param.game.game_area.firstQuarterY - 24);
bitmaps[5]->setPosY(param.game.game_area.first_quarter_y - 24);
bitmaps[5]->setVelX(-0.7f);
bitmaps[5]->setVelY(0.0f);
bitmaps[5]->setAccelX(0.0f);
@@ -149,7 +149,7 @@ Intro::Intro(JA_Music_t *music)
for (auto &text : texts)
{
text->center(param.game.game_area.centerX);
text->center(param.game.game_area.center_x);
}
}
@@ -400,7 +400,7 @@ void Intro::render()
Screen::get()->start();
// Limpia la pantalla
Screen::get()->clean(bgColor);
Screen::get()->clean(bg_color);
// Dibuja los objetos
for (auto &bitmap : bitmaps)

View File

@@ -34,8 +34,8 @@ Logo::Logo()
endLogo_cm = 400;
postLogoDuration = 20;
speed = 8;
dest.x = param.game.game_area.centerX - jailTexture->getWidth() / 2;
dest.y = param.game.game_area.centerY - jailTexture->getHeight() / 2;
dest.x = param.game.game_area.center_x - jailTexture->getWidth() / 2;
dest.y = param.game.game_area.center_y - jailTexture->getHeight() / 2;
sinceSprite->setPosY(dest.y + jailTexture->getHeight() + 5);
sinceSprite->setSpriteClip(0, 0, sinceTexture->getWidth(), sinceTexture->getHeight());
sinceSprite->setEnabled(false);

View File

@@ -80,7 +80,7 @@ void Notify::update()
const float step = ((float)notifications[i].counter / notifications[i].travelDist);
const int alpha = 255 * step;
if (options.notification.posV == pos_top)
if (options.notification.pos_v == NotifyPosition::TOP)
{
notifications[i].rect.y++;
}
@@ -112,7 +112,7 @@ void Notify::update()
const float step = (notifications[i].counter / (float)notifications[i].travelDist);
const int alpha = 255 * (1 - step);
if (options.notification.posV == pos_top)
if (options.notification.pos_v == NotifyPosition::TOP)
{
notifications[i].rect.y--;
}
@@ -182,11 +182,11 @@ void Notify::showText(std::string text1, std::string text2, int icon)
// Posición horizontal
auto despH = 0;
if (options.notification.posH == pos_left)
if (options.notification.pos_h == NotifyPosition::LEFT)
{
despH = paddingOut;
}
else if (options.notification.posH == pos_middle)
else if (options.notification.pos_h == NotifyPosition::MIDDLE)
{
despH = ((param.game.width / 2) - (width / 2));
}
@@ -196,12 +196,12 @@ void Notify::showText(std::string text1, std::string text2, int icon)
}
// Posición vertical
const int despV = (options.notification.posV == pos_top) ? paddingOut : (param.game.height - height - paddingOut);
const int despV = (options.notification.pos_v == NotifyPosition::TOP) ? paddingOut : (param.game.height - height - paddingOut);
// Offset
const auto travelDist = height + paddingOut;
auto offset = 0;
if (options.notification.posV == pos_top)
if (options.notification.pos_v == NotifyPosition::TOP)
{
offset = (int)notifications.size() > 0 ? notifications.back().y + travelDist : despV;
}
@@ -221,7 +221,7 @@ void Notify::showText(std::string text1, std::string text2, int icon)
n.text1 = text1;
n.text2 = text2;
n.shape = shape;
auto yPos = offset + (options.notification.posV == pos_top ? -travelDist : travelDist);
auto yPos = offset + (options.notification.pos_v == NotifyPosition::TOP ? -travelDist : travelDist);
n.rect = {despH, yPos, width, height};
// Crea la textura

View File

@@ -24,14 +24,14 @@ private:
enum class NotificationPosition
{
UPPERLEFT,
UPPERCENTER,
UPPERRIGHT,
MIDDLELEFT,
MIDDLERIGHT,
BOTTOMLEFT,
BOTTOMCENTER,
BOTTOMRIGHT,
UPPER_LEFT,
UPPER_CENTER,
UPPER_RIGHT,
MIDDLE_LEFT,
MIDDLE_RIGHT,
BOTTOM_LEFT,
BOTTOM_CENTER,
BOTTOM_RIGHT,
};
enum class NotificationShape

View File

@@ -27,12 +27,12 @@ void initOptions()
options.video.window.size = 2;
#endif
options.video.filter = ScreenFilter::NEAREST;
options.video.vSync = true;
options.video.v_sync = true;
options.video.shaders = true;
// Opciones de las notificaciones
options.notification.posV = pos_top;
options.notification.posH = pos_left;
options.notification.pos_v = NotifyPosition::TOP;
options.notification.pos_h = NotifyPosition::LEFT;
options.notification.sound = false;
options.notification.color = (Color){48, 48, 48};
@@ -51,12 +51,12 @@ void initOptions()
options.controller.clear();
OptionsController c;
const int numPlayers = 2;
constexpr int numPlayers = 2;
for (int index = 0; index < numPlayers; ++index)
{
c.index = index;
c.playerId = index + 1;
c.deviceType = INPUT_USE_GAMECONTROLLER;
c.player_id = index + 1;
c.device_type = INPUT_USE_GAMECONTROLLER;
c.name = "NO NAME";
c.plugged = false;
@@ -78,11 +78,11 @@ void initOptions()
options.controller.push_back(c);
}
options.controller[0].deviceType = INPUT_USE_ANY; // El primer jugador puede usar tanto el teclado como el primer mando
options.controller[0].device_type = INPUT_USE_ANY; // El primer jugador puede usar tanto el teclado como el primer mando
}
// Carga el fichero de configuración
bool loadOptionsFile(std::string filePath)
bool loadOptionsFile(std::string file_path)
{
// Inicializa las opciones del programa
initOptions();
@@ -91,8 +91,8 @@ bool loadOptionsFile(std::string filePath)
bool success = true;
// Variables para manejar el fichero
const std::string fileName = filePath.substr(filePath.find_last_of("\\/") + 1);
std::ifstream file(filePath);
const std::string fileName = file_path.substr(file_path.find_last_of("\\/") + 1);
std::ifstream file(file_path);
// Si el fichero se puede abrir
if (file.good())
@@ -128,7 +128,7 @@ bool loadOptionsFile(std::string filePath)
// El fichero no existe
else
{ // Crea el fichero con los valores por defecto
saveOptionsFile(filePath);
saveOptionsFile(file_path);
}
// Normaliza los valores
@@ -153,10 +153,10 @@ bool loadOptionsFile(std::string filePath)
}
// Guarda el fichero de configuración
bool saveOptionsFile(std::string filePath)
bool saveOptionsFile(std::string file_path)
{
const std::string fileName = filePath.substr(filePath.find_last_of("\\/") + 1);
std::ofstream file(filePath);
const std::string fileName = file_path.substr(file_path.find_last_of("\\/") + 1);
std::ofstream file(file_path);
if (!file.good())
{
@@ -171,14 +171,14 @@ bool saveOptionsFile(std::string filePath)
#endif
// Opciones de video
const auto valueVideoModeWinow = std::to_string(static_cast<int>(ScreenVideoMode::WINDOW));
const auto valueVideoModeFullscreen = std::to_string(static_cast<int>(ScreenVideoMode::FULLSCREEN));
const auto valueFilterNearest = std::to_string(static_cast<int>(ScreenFilter::NEAREST));
const auto valueFilterLineal = std::to_string(static_cast<int>(ScreenFilter::LINEAL));
const auto value_video_mode_winow = std::to_string(static_cast<int>(ScreenVideoMode::WINDOW));
const auto value_video_mode_fullscreen = std::to_string(static_cast<int>(ScreenVideoMode::FULLSCREEN));
const auto value_filter_nearest = std::to_string(static_cast<int>(ScreenFilter::NEAREST));
const auto value_filter_lineal = std::to_string(static_cast<int>(ScreenFilter::LINEAL));
file << "## VIDEO\n";
file << "## video.mode [" << valueVideoModeWinow << ": window, " << valueVideoModeFullscreen << ": fullscreen]\n";
file << "## video.filter [" << valueFilterNearest << ": nearest, " << valueFilterLineal << ": lineal]\n";
file << "## video.mode [" << value_video_mode_winow << ": window, " << value_video_mode_fullscreen << ": fullscreen]\n";
file << "## video.filter [" << value_filter_nearest << ": nearest, " << value_filter_lineal << ": lineal]\n";
file << "\n";
const auto valueVideoMode = std::to_string(static_cast<int>(options.video.mode));
@@ -190,37 +190,37 @@ bool saveOptionsFile(std::string filePath)
file << "video.filter=" << valueFilter << "\n";
file << "video.shaders=" + boolToString(options.video.shaders) + "\n";
file << "video.vSync=" + boolToString(options.video.vSync) + "\n";
file << "video.v_sync=" + boolToString(options.video.v_sync) + "\n";
// Opciones de notificaciones
file << "\n\n## NOTIFICATION\n";
file << "## notification.posV [pos_top | pos_bottom]\n";
file << "## notification.posH [pos_left | pos_middle | pos_right]\n";
file << "## notification.pos_v [TOP | BOTTOM]\n";
file << "## notification.pos_h [LEFT | MIDDLE | RIGHT]\n";
file << "\n";
if (options.notification.posV == pos_top)
if (options.notification.pos_v == NotifyPosition::TOP)
{
file << "notification.posV=pos_top\n";
file << "notification.pos_v=TOP\n";
}
else
{
file << "notification.posV=pos_bottom\n";
file << "notification.pos_v=BOTTOM\n";
}
if (options.notification.posH == pos_left)
if (options.notification.pos_h == NotifyPosition::LEFT)
{
file << "notification.posH=pos_left\n";
file << "notification.pos_h=LEFT\n";
}
else if (options.notification.posH == pos_middle)
else if (options.notification.pos_h == NotifyPosition::MIDDLE)
{
file << "notification.posH=pos_middle\n";
file << "notification.posH=MIDDLE\n";
}
else
{
file << "notification.posH=pos_right\n";
file << "notification.pos_h=RIGHT\n";
}
file << "notification.sound=" + boolToString(options.notification.sound) + "\n";
@@ -236,12 +236,12 @@ bool saveOptionsFile(std::string filePath)
file << "audio.sound.volume=" + std::to_string(options.audio.sound.volume) + "\n";
// Opciones del juego
const auto valueDifficultyEasy = std::to_string(static_cast<int>(GameDifficulty::EASY));
const auto valueDifficultyNormal = std::to_string(static_cast<int>(GameDifficulty::NORMAL));
const auto valueDifficultyHard = std::to_string(static_cast<int>(GameDifficulty::HARD));
const auto value_difficulty_easy = std::to_string(static_cast<int>(GameDifficulty::EASY));
const auto value_difficulty_normal = std::to_string(static_cast<int>(GameDifficulty::NORMAL));
const auto value_difficulty_hard = std::to_string(static_cast<int>(GameDifficulty::HARD));
file << "\n\n## GAME\n";
file << "## game.language [0: spanish, 1: valencian, 2: english]\n";
file << "## game.difficulty [" << valueDifficultyEasy << ": easy, " << valueDifficultyNormal << ": normal, " << valueDifficultyHard << ": hard]\n";
file << "## game.difficulty [" << value_difficulty_easy << ": easy, " << value_difficulty_normal << ": normal, " << value_difficulty_hard << ": hard]\n";
file << "\n";
file << "game.language=" + std::to_string(options.game.language) + "\n";
@@ -257,7 +257,7 @@ bool saveOptionsFile(std::string filePath)
{
const std::string joyIndex = std::to_string(index + 1);
file << "controller" + joyIndex + ".name=" + options.controller[index].name + "\n";
file << "controller" + joyIndex + ".player=" + std::to_string(options.controller[index].playerId) + "\n";
file << "controller" + joyIndex + ".player=" + std::to_string(options.controller[index].player_id) + "\n";
file << "controller" + joyIndex + ".button.fire_left=" + std::to_string((int)options.controller[index].buttons[0]) + "\n";
file << "controller" + joyIndex + ".button.fire_center=" + std::to_string((int)options.controller[index].buttons[1]) + "\n";
file << "controller" + joyIndex + ".button.fire_right=" + std::to_string((int)options.controller[index].buttons[2]) + "\n";
@@ -309,31 +309,31 @@ bool setOptions(std::string var, std::string value)
options.video.shaders = stringToBool(value);
}
else if (var == "video.vSync")
else if (var == "video.v_sync")
{
options.video.vSync = stringToBool(value);
options.video.v_sync = stringToBool(value);
}
// Opciones de notificaciones
else if (var == "notification.posH")
else if (var == "notification.pos_h")
{
if (value == "pos_left")
if (value == "LEFT")
{
options.notification.posH = pos_left;
options.notification.pos_h = NotifyPosition::LEFT;
}
else if (value == "pos_middle")
else if (value == "MIDDLE")
{
options.notification.posH = pos_middle;
options.notification.pos_h = NotifyPosition::MIDDLE;
}
else
{
options.notification.posH = pos_right;
options.notification.pos_h = NotifyPosition::RIGHT;
}
}
else if (var == "notification.posV")
else if (var == "notification.pos_v")
{
options.notification.posV = value == "pos_top" ? pos_top : pos_bottom;
options.notification.pos_v = value == "TOP" ? NotifyPosition::TOP : NotifyPosition::BOTTOM;
}
else if (var == "notification.sound")
@@ -386,7 +386,7 @@ bool setOptions(std::string var, std::string value)
else if (var == "controller1.player")
{
options.controller[0].playerId = std::max(1, std::min(2, std::stoi(value)));
options.controller[0].player_id = std::max(1, std::min(2, std::stoi(value)));
}
else if (var == "controller1.button.fire_left")
@@ -421,7 +421,7 @@ bool setOptions(std::string var, std::string value)
else if (var == "controller2.player")
{
options.controller[1].playerId = std::max(1, std::min(2, std::stoi(value)));
options.controller[1].player_id = std::max(1, std::min(2, std::stoi(value)));
}
else if (var == "controller2.button.fire_left")

View File

@@ -790,5 +790,5 @@ bool Player::isRenderable() const
// Comprueba si la puntuación entra en la tabla de mejores puntuaciones
bool Player::IsEligibleForHighScore()
{
return score > options.game.hiScoreTable.back().score;
return score > options.game.hi_score_table.back().score;
}

View File

@@ -472,6 +472,6 @@ void Scoreboard::createPanelTextures()
void Scoreboard::renderSeparator()
{
// Dibuja la linea que separa el marcador de la zona de juego
SDL_SetRenderDrawColor(renderer, separatorColor.r, separatorColor.g, separatorColor.b, 255);
SDL_SetRenderDrawColor(renderer, separator_color.r, separator_color.g, separator_color.b, 255);
SDL_RenderDrawLine(renderer, 0, 0, rect.w, 0);
}

View File

@@ -36,11 +36,11 @@ Title::Title(JA_Music_t *music)
text2 = std::make_unique<Text>(asset->get("8bithud.png"), asset->get("8bithud.txt"), renderer);
miniLogoTexture = std::make_shared<Texture>(renderer, asset->get("logo_jailgames_mini.png"));
miniLogoSprite = std::make_unique<Sprite>(param.game.game_area.centerX - miniLogoTexture->getWidth() / 2, 0, miniLogoTexture->getWidth(), miniLogoTexture->getHeight(), miniLogoTexture);
miniLogoSprite = std::make_unique<Sprite>(param.game.game_area.center_x - miniLogoTexture->getWidth() / 2, 0, miniLogoTexture->getWidth(), miniLogoTexture->getHeight(), miniLogoTexture);
tiledbg = std::make_unique<Tiledbg>(asset->get("title_bg_tile.png"), (SDL_Rect){0, 0, param.game.width, param.game.height}, TILED_MODE_RANDOM);
gameLogo = std::make_unique<GameLogo>(param.game.game_area.centerX, param.title.titleCCPosition);
gameLogo = std::make_unique<GameLogo>(param.game.game_area.center_x, param.title.title_c_c_position);
gameLogo->enable();
defineButtons = std::make_unique<DefineButtons>(std::move(text2));
@@ -59,9 +59,9 @@ void Title::init()
postFade = 0;
ticks = 0;
ticksSpeed = 15;
fade->setColor(fadeColor.r, fadeColor.g, fadeColor.b);
fade->setColor(fade_color.r, fade_color.g, fade_color.b);
fade->setType(FadeType::RANDOM_SQUARE);
fade->setPost(param.fade.postDuration);
fade->setPost(param.fade.post_duration);
demo = true;
numControllers = input->getNumControllers();
}
@@ -122,7 +122,7 @@ void Title::update()
// Actualiza el mosaico de fondo
tiledbg->update();
if (counter == param.title.titleDuration)
if (counter == param.title.title_duration)
{
fade->activate();
postFade = -1;
@@ -138,7 +138,7 @@ void Title::render()
screen->start();
// Limpia la pantalla
screen->clean(bgColor);
screen->clean(bg_color);
// Dibuja el mosacico de fondo
tiledbg->render();
@@ -153,7 +153,7 @@ void Title::render()
// 'PRESS TO PLAY'
if (counter % 50 > 14 && !defineButtons->isEnabled())
{
text1->writeDX(TXT_CENTER | TXT_SHADOW, param.game.game_area.centerX, param.title.pressStartPosition, lang::getText(23), 1, noColor, 1, shadow);
text1->writeDX(TXT_CENTER | TXT_SHADOW, param.game.game_area.center_x, param.title.press_start_position, lang::getText(23), 1, no_color, 1, shadow);
}
// Mini logo
@@ -163,7 +163,7 @@ void Title::render()
miniLogoSprite->render();
// Texto con el copyright
text1->writeDX(TXT_CENTER | TXT_SHADOW, param.game.game_area.centerX, pos2, TEXT_COPYRIGHT, 1, noColor, 1, shadow);
text1->writeDX(TXT_CENTER | TXT_SHADOW, param.game.game_area.center_x, pos2, TEXT_COPYRIGHT, 1, no_color, 1, shadow);
}
// Define Buttons
@@ -242,7 +242,7 @@ void Title::checkInput()
if (section::options == section::OPTIONS_TITLE_2 || ALLOW_TITLE_ANIMATION_SKIP)
{
fade->activate();
postFade = options.controller[0].playerId;
postFade = options.controller[0].player_id;
}
}
@@ -272,7 +272,7 @@ void Title::checkInput()
if (section::options == section::OPTIONS_TITLE_2 || ALLOW_TITLE_ANIMATION_SKIP)
{
fade->activate();
postFade = options.controller[i].playerId;
postFade = options.controller[i].player_id;
return;
}
}
@@ -338,7 +338,7 @@ void Title::swapControllers()
// Obtiene para cada jugador el índice del mando correspondiente
for (int i = 0; i < MAX_CONTROLLERS; ++i)
{
playerControllerIndex[options.controller[i].playerId - 1] = i;
playerControllerIndex[options.controller[i].player_id - 1] = i;
}
// Genera el texto correspondiente