Estandaritzant noms segons convencions
This commit is contained in:
@@ -74,7 +74,7 @@ Game::Game(int playerID, int currentStage, bool demo, JA_Music_t *music)
|
||||
loadDemoFile(asset->get("demo2.bin"), &this->demo.dataFile[index2]);
|
||||
}
|
||||
|
||||
background->setPos(param.game.playArea.rect);
|
||||
background->setPos(param.game.play_area.rect);
|
||||
|
||||
n1000Sprite = std::make_shared<SmartSprite>(gameTextTexture);
|
||||
n2500Sprite = std::make_shared<SmartSprite>(gameTextTexture);
|
||||
@@ -85,7 +85,7 @@ Game::Game(int playerID, int currentStage, bool demo, JA_Music_t *music)
|
||||
explosions->addTexture(3, explosionsTextures[2], explosionsAnimations[2]);
|
||||
explosions->addTexture(4, explosionsTextures[3], explosionsAnimations[3]);
|
||||
|
||||
canvas = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, param.game.playArea.rect.w, param.game.playArea.rect.h);
|
||||
canvas = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, param.game.play_area.rect.w, param.game.play_area.rect.h);
|
||||
SDL_SetTextureBlendMode(canvas, SDL_BLENDMODE_BLEND);
|
||||
|
||||
// Inicializa las variables necesarias para la sección 'Game'
|
||||
@@ -122,14 +122,14 @@ void Game::init(int playerID)
|
||||
players.clear();
|
||||
|
||||
// Crea los dos jugadores
|
||||
auto player1 = std::make_unique<Player>(1, (param.game.playArea.firstQuarterX * ((0 * 2) + 1)) - 11, param.game.playArea.rect.h - 30, demo.enabled, ¶m.game.playArea.rect, playerTextures[0], playerAnimations);
|
||||
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, ¶m.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.playArea.firstQuarterX * ((1 * 2) + 1)) - 11, param.game.playArea.rect.h - 30, demo.enabled, ¶m.game.playArea.rect, playerTextures[1], playerAnimations);
|
||||
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, ¶m.game.play_area.rect, playerTextures[1], playerAnimations);
|
||||
player2->setScoreBoardPanel(SCOREBOARD_RIGHT_PANEL);
|
||||
player2->setName(lang::getText(54));
|
||||
const auto controller2 = getController(player2->getId());
|
||||
@@ -582,7 +582,7 @@ void Game::unloadMedia()
|
||||
}
|
||||
|
||||
// Carga el fichero de datos para la demo
|
||||
bool Game::loadDemoFile(std::string filePath, demoKeys_t (*dataFile)[TOTAL_DEMO_DATA])
|
||||
bool Game::loadDemoFile(std::string filePath, DemoKeys (*dataFile)[TOTAL_DEMO_DATA])
|
||||
{
|
||||
// Indicador de éxito en la carga
|
||||
auto success = true;
|
||||
@@ -608,7 +608,7 @@ bool Game::loadDemoFile(std::string filePath, demoKeys_t (*dataFile)[TOTAL_DEMO_
|
||||
// Inicializas los datos y los guarda en el fichero
|
||||
for (int i = 0; i < TOTAL_DEMO_DATA; ++i)
|
||||
{
|
||||
demoKeys_t tmp;
|
||||
DemoKeys tmp;
|
||||
tmp.left = 0;
|
||||
tmp.right = 0;
|
||||
tmp.noInput = 0;
|
||||
@@ -616,7 +616,7 @@ bool Game::loadDemoFile(std::string filePath, demoKeys_t (*dataFile)[TOTAL_DEMO_
|
||||
tmp.fireLeft = 0;
|
||||
tmp.fireRight = 0;
|
||||
(*dataFile)[i] = tmp;
|
||||
SDL_RWwrite(file, &tmp, sizeof(demoKeys_t), 1);
|
||||
SDL_RWwrite(file, &tmp, sizeof(DemoKeys), 1);
|
||||
}
|
||||
|
||||
// Cerramos el fichero
|
||||
@@ -641,8 +641,8 @@ bool Game::loadDemoFile(std::string filePath, demoKeys_t (*dataFile)[TOTAL_DEMO_
|
||||
// Lee todos los datos del fichero y los deja en el destino
|
||||
for (int i = 0; i < TOTAL_DEMO_DATA; ++i)
|
||||
{
|
||||
demoKeys_t tmp;
|
||||
SDL_RWread(file, &tmp, sizeof(demoKeys_t), 1);
|
||||
DemoKeys tmp;
|
||||
SDL_RWread(file, &tmp, sizeof(DemoKeys), 1);
|
||||
(*dataFile)[i] = tmp;
|
||||
}
|
||||
|
||||
@@ -666,7 +666,7 @@ bool Game::saveDemoFile(std::string filePath)
|
||||
// Guardamos los datos
|
||||
for (int i = 0; i < TOTAL_DEMO_DATA; ++i)
|
||||
{
|
||||
SDL_RWwrite(file, &demo.dataFile[0][i], sizeof(demoKeys_t), 1);
|
||||
SDL_RWwrite(file, &demo.dataFile[0][i], sizeof(DemoKeys), 1);
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
@@ -800,7 +800,7 @@ void Game::renderPlayers()
|
||||
player->render();
|
||||
#ifdef DEBUG
|
||||
// SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
|
||||
// const circle_t c = player->getCollider();
|
||||
// const Circle c = player->getCollider();
|
||||
// DrawCircle(renderer, c.x, c.y, c.r);
|
||||
#endif
|
||||
}
|
||||
@@ -921,9 +921,9 @@ void Game::createPowerBall()
|
||||
constexpr auto values = 6;
|
||||
constexpr auto posY = -BLOCK;
|
||||
|
||||
const auto left = param.game.playArea.rect.x;
|
||||
const auto center = param.game.playArea.centerX - (BALLOON_WIDTH_4 / 2);
|
||||
const auto right = param.game.playArea.rect.w - BALLOON_WIDTH_4;
|
||||
const auto left = param.game.play_area.rect.x;
|
||||
const auto center = param.game.play_area.centerX - (BALLOON_WIDTH_4 / 2);
|
||||
const auto right = param.game.play_area.rect.w - BALLOON_WIDTH_4;
|
||||
|
||||
const auto vpos = BALLOON_VELX_POSITIVE;
|
||||
const auto vneg = BALLOON_VELX_NEGATIVE;
|
||||
@@ -1405,7 +1405,7 @@ void Game::renderBullets()
|
||||
// Crea un objeto bala
|
||||
void Game::createBullet(int x, int y, BulletType kind, bool poweredUp, int owner)
|
||||
{
|
||||
auto b = std::make_unique<Bullet>(x, y, kind, poweredUp, owner, &(param.game.playArea.rect), bulletTexture);
|
||||
auto b = std::make_unique<Bullet>(x, y, kind, poweredUp, owner, &(param.game.play_area.rect), bulletTexture);
|
||||
bullets.push_back(std::move(b));
|
||||
}
|
||||
|
||||
@@ -1529,7 +1529,7 @@ int Game::dropItem()
|
||||
// Crea un objeto item
|
||||
void Game::createItem(int kind, float x, float y)
|
||||
{
|
||||
auto item = std::make_unique<Item>(kind, x, y, &(param.game.playArea.rect), itemTextures[kind - 1], itemAnimations[kind - 1]);
|
||||
auto item = std::make_unique<Item>(kind, x, y, &(param.game.play_area.rect), itemTextures[kind - 1], itemAnimations[kind - 1]);
|
||||
items.push_back(std::move(item));
|
||||
}
|
||||
|
||||
@@ -1587,8 +1587,8 @@ void Game::throwCoffee(int x, int y)
|
||||
|
||||
ss->setPosX(x - 8);
|
||||
ss->setPosY(y - 8);
|
||||
ss->setWidth(param.game.itemSize);
|
||||
ss->setHeight(param.game.itemSize);
|
||||
ss->setWidth(param.game.item_size);
|
||||
ss->setHeight(param.game.item_size);
|
||||
ss->setVelX(-1.0f + ((rand() % 5) * 0.5f));
|
||||
ss->setVelY(-4.0f);
|
||||
ss->setAccelX(0.0f);
|
||||
@@ -1597,7 +1597,7 @@ void Game::throwCoffee(int x, int y)
|
||||
ss->setDestY(param.game.height + 1);
|
||||
ss->setEnabled(true);
|
||||
ss->setFinishedCounter(1);
|
||||
ss->setSpriteClip(0, param.game.itemSize, param.game.itemSize, param.game.itemSize);
|
||||
ss->setSpriteClip(0, param.game.item_size, param.game.item_size, param.game.item_size);
|
||||
ss->setRotate(true);
|
||||
ss->setRotateSpeed(10);
|
||||
ss->setRotateAmount(90.0);
|
||||
@@ -1909,7 +1909,7 @@ void Game::render()
|
||||
screen->start();
|
||||
|
||||
// Copia la textura con la zona de juego a la pantalla
|
||||
SDL_RenderCopy(renderer, canvas, nullptr, ¶m.game.playArea.rect);
|
||||
SDL_RenderCopy(renderer, canvas, nullptr, ¶m.game.play_area.rect);
|
||||
|
||||
// Dibuja el marcador
|
||||
scoreboard->render();
|
||||
@@ -2206,7 +2206,7 @@ void Game::renderMessages()
|
||||
// GetReady
|
||||
if (counter < STAGE_COUNTER && !demo.enabled)
|
||||
{
|
||||
textNokiaBig2->write((int)getReadyBitmapPath[counter], param.game.playArea.centerY - 8, lang::getText(75), -2);
|
||||
textNokiaBig2->write((int)getReadyBitmapPath[counter], param.game.play_area.centerY - 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.playArea.centerX, param.game.playArea.firstQuarterY, lang::getText(36) + std::to_string(timeStoppedCounter / 10), -1, noColor, 1, shdwTxtColor);
|
||||
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);
|
||||
}
|
||||
|
||||
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.playArea.centerX, stageBitmapPath[stageBitmapCounter], text, -2, noColor, 2, shdwTxtColor);
|
||||
textNokiaBig2->writeDX(TXT_CENTER, param.game.play_area.centerX, stageBitmapPath[stageBitmapCounter], text, -2, noColor, 2, shdwTxtColor);
|
||||
}
|
||||
else
|
||||
{ // Escribe el texto de juego completado
|
||||
text = lang::getText(50);
|
||||
textNokiaBig2->writeDX(TXT_CENTER, param.game.playArea.centerX, stageBitmapPath[stageBitmapCounter], text, -2, noColor, 1, shdwTxtColor);
|
||||
textNokia2->writeDX(TXT_CENTER, param.game.playArea.centerX, stageBitmapPath[stageBitmapCounter] + textNokiaBig2->getCharacterSize() + 2, lang::getText(76), -1, noColor, 1, shdwTxtColor);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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.playArea.centerY - (BLOCK * 2);
|
||||
const auto distance = (param.game.playArea.rect.h) - (param.game.playArea.centerY - 16);
|
||||
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);
|
||||
|
||||
for (int i = 0; i < STAGE_COUNTER; ++i)
|
||||
{
|
||||
@@ -2377,11 +2377,11 @@ void Game::initPaths()
|
||||
// Letrero de GetReady
|
||||
const auto size = textNokiaBig2->lenght(lang::getText(75), -2);
|
||||
|
||||
const float start1 = param.game.playArea.rect.x - size;
|
||||
const float finish1 = param.game.playArea.centerX - (size / 2);
|
||||
const float start1 = param.game.play_area.rect.x - size;
|
||||
const float finish1 = param.game.play_area.centerX - (size / 2);
|
||||
|
||||
const float start2 = finish1;
|
||||
const float finish2 = param.game.playArea.rect.w;
|
||||
const float finish2 = param.game.play_area.rect.w;
|
||||
|
||||
const float distance1 = finish1 - start1;
|
||||
const float distance2 = finish2 - start2;
|
||||
@@ -2668,7 +2668,7 @@ void Game::pause(bool value)
|
||||
// Añade una puntuación a la tabla de records
|
||||
void Game::addScoreToScoreBoard(std::string name, int score)
|
||||
{
|
||||
const auto entry = (hiScoreEntry_t){trim(name), score};
|
||||
const auto entry = (HiScoreEntry){trim(name), score};
|
||||
auto manager = std::make_unique<ManageHiScoreTable>(&options.game.hiScoreTable);
|
||||
manager->add(entry);
|
||||
manager->saveToFile(asset->get("score.bin"));
|
||||
|
||||
Reference in New Issue
Block a user