eliminat el punter al renderer de 50.000 llocs
This commit is contained in:
370
source/game.cpp
370
source/game.cpp
@@ -27,15 +27,7 @@ Game::Game(int playerID, int currentStage, SDL_Renderer *renderer, Screen *scree
|
||||
eventHandler = new SDL_Event();
|
||||
scoreboard = new Scoreboard(renderer, screen, asset, lang, options);
|
||||
background = new Background(renderer, screen, asset, param);
|
||||
|
||||
// Inicializa vectores
|
||||
playerAnimations.clear();
|
||||
balloonAnimations.clear();
|
||||
itemAnimations.clear();
|
||||
player1Textures.clear();
|
||||
player2Textures.clear();
|
||||
itemTextures.clear();
|
||||
balloonTextures.clear();
|
||||
explosions = new Explosions();
|
||||
|
||||
// Carga los recursos
|
||||
loadMedia();
|
||||
@@ -50,15 +42,12 @@ Game::Game(int playerID, int currentStage, SDL_Renderer *renderer, Screen *scree
|
||||
loadDemoFile(asset->get("demo2.bin"), &this->demo.dataFile[index2]);
|
||||
}
|
||||
|
||||
// Establece la máxima puntuación desde fichero o desde las puntuaciones online
|
||||
// Carga las puntuaciones desde el fichero y establece la máxima puntuación
|
||||
setHiScore();
|
||||
|
||||
n1000Sprite = new SmartSprite(gameTextTexture, renderer);
|
||||
n2500Sprite = new SmartSprite(gameTextTexture, renderer);
|
||||
n5000Sprite = new SmartSprite(gameTextTexture, renderer);
|
||||
|
||||
gameOverSprite = new Sprite(16, 80, 128, 96, gameOverTexture, renderer);
|
||||
gameOverEndSprite = new Sprite(PLAY_AREA_CENTER_X - gameOverEndTexture->getWidth() / 2, 80, 128, 96, gameOverEndTexture, renderer);
|
||||
n1000Sprite = new SmartSprite(gameTextTexture);
|
||||
n2500Sprite = new SmartSprite(gameTextTexture);
|
||||
n5000Sprite = new SmartSprite(gameTextTexture);
|
||||
|
||||
canvas = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, playArea.w, playArea.h);
|
||||
SDL_SetTextureBlendMode(canvas, SDL_BLENDMODE_BLEND);
|
||||
@@ -74,130 +63,24 @@ Game::~Game()
|
||||
saveDemoFile();
|
||||
#endif
|
||||
|
||||
if (!demo.enabled)
|
||||
{
|
||||
hiScoreEntry_t entry = {"Sergio", players[0]->getScore()};
|
||||
ManageHiScoreTable *m = new ManageHiScoreTable(&options->game.hiScoreTable);
|
||||
m->add(entry);
|
||||
delete m;
|
||||
}
|
||||
|
||||
// Elimina todos los objetos contenidos en vectores
|
||||
deleteAllVectorObjects();
|
||||
|
||||
bulletTexture->unload();
|
||||
delete bulletTexture;
|
||||
|
||||
gameTextTexture->unload();
|
||||
delete gameTextTexture;
|
||||
|
||||
gameOverTexture->unload();
|
||||
delete gameOverTexture;
|
||||
|
||||
gameOverEndTexture->unload();
|
||||
delete gameOverEndTexture;
|
||||
|
||||
// Animaciones
|
||||
for (auto animation : playerAnimations)
|
||||
{
|
||||
if (animation)
|
||||
{
|
||||
delete animation;
|
||||
}
|
||||
}
|
||||
playerAnimations.clear();
|
||||
|
||||
for (auto animation : balloonAnimations)
|
||||
{
|
||||
if (animation)
|
||||
{
|
||||
delete animation;
|
||||
}
|
||||
}
|
||||
balloonAnimations.clear();
|
||||
|
||||
for (auto animation : itemAnimations)
|
||||
{
|
||||
if (animation)
|
||||
{
|
||||
delete animation;
|
||||
}
|
||||
}
|
||||
itemAnimations.clear();
|
||||
|
||||
// Texturas
|
||||
for (auto texture : player1Textures)
|
||||
{
|
||||
if (texture)
|
||||
{
|
||||
texture->unload();
|
||||
delete texture;
|
||||
}
|
||||
}
|
||||
player1Textures.clear();
|
||||
|
||||
for (auto texture : player2Textures)
|
||||
{
|
||||
if (texture)
|
||||
{
|
||||
texture->unload();
|
||||
delete texture;
|
||||
}
|
||||
}
|
||||
player2Textures.clear();
|
||||
|
||||
for (auto texture : itemTextures)
|
||||
{
|
||||
if (texture)
|
||||
{
|
||||
texture->unload();
|
||||
delete texture;
|
||||
}
|
||||
}
|
||||
itemTextures.clear();
|
||||
|
||||
for (auto texture : balloonTextures)
|
||||
{
|
||||
if (texture)
|
||||
{
|
||||
texture->unload();
|
||||
delete texture;
|
||||
}
|
||||
}
|
||||
balloonTextures.clear();
|
||||
// Libera los recursos
|
||||
unloadMedia();
|
||||
|
||||
delete scoreboard;
|
||||
delete background;
|
||||
delete explosions;
|
||||
|
||||
delete text;
|
||||
delete textBig;
|
||||
delete textNokia2;
|
||||
delete textNokiaBig2;
|
||||
delete fade;
|
||||
delete eventHandler;
|
||||
|
||||
delete n1000Sprite;
|
||||
delete n2500Sprite;
|
||||
delete n5000Sprite;
|
||||
delete gameOverSprite;
|
||||
delete gameOverEndSprite;
|
||||
|
||||
SDL_DestroyTexture(canvas);
|
||||
|
||||
JA_DeleteSound(balloonSound);
|
||||
JA_DeleteSound(bulletSound);
|
||||
JA_DeleteSound(playerCollisionSound);
|
||||
JA_DeleteSound(hiScoreSound);
|
||||
JA_DeleteSound(itemDropSound);
|
||||
JA_DeleteSound(itemPickUpSound);
|
||||
JA_DeleteSound(coffeeOutSound);
|
||||
JA_DeleteSound(stageChangeSound);
|
||||
JA_DeleteSound(bubble1Sound);
|
||||
JA_DeleteSound(bubble2Sound);
|
||||
JA_DeleteSound(bubble3Sound);
|
||||
JA_DeleteSound(bubble4Sound);
|
||||
JA_DeleteSound(clockSound);
|
||||
JA_DeleteSound(powerBallSound);
|
||||
JA_DeleteSound(coffeeMachineSound);
|
||||
}
|
||||
|
||||
// Inicializa las variables necesarias para la sección 'Game'
|
||||
@@ -217,10 +100,10 @@ void Game::init(int playerID)
|
||||
players.clear();
|
||||
|
||||
// Crea los dos jugadores
|
||||
Player *player1 = new Player((PLAY_AREA_CENTER_FIRST_QUARTER_X * ((0 * 2) + 1)) - 11, PLAY_AREA_BOTTOM - 30, renderer, playerTextures[0], playerAnimations);
|
||||
Player *player1 = new Player((PLAY_AREA_CENTER_FIRST_QUARTER_X * ((0 * 2) + 1)) - 11, PLAY_AREA_BOTTOM - 30, playerTextures[0], playerAnimations);
|
||||
players.push_back(player1);
|
||||
|
||||
Player *player2 = new Player((PLAY_AREA_CENTER_FIRST_QUARTER_X * ((1 * 2) + 1)) - 11, PLAY_AREA_BOTTOM - 30, renderer, playerTextures[1], playerAnimations);
|
||||
Player *player2 = new Player((PLAY_AREA_CENTER_FIRST_QUARTER_X * ((1 * 2) + 1)) - 11, PLAY_AREA_BOTTOM - 30, playerTextures[1], playerAnimations);
|
||||
players.push_back(player2);
|
||||
|
||||
// Habilita el jugador seleccionado. playerID es player 1 o player 2
|
||||
@@ -432,6 +315,15 @@ void Game::loadMedia()
|
||||
<< "** LOADING RESOURCES FOR GAME SECTION" << std::endl;
|
||||
}
|
||||
|
||||
playerAnimations.clear();
|
||||
balloonAnimations.clear();
|
||||
itemAnimations.clear();
|
||||
player1Textures.clear();
|
||||
player2Textures.clear();
|
||||
itemTextures.clear();
|
||||
balloonTextures.clear();
|
||||
explosionsTextures.clear();
|
||||
|
||||
// Texturas
|
||||
bulletTexture = new Texture(renderer, asset->get("bullet.png"));
|
||||
gameTextTexture = new Texture(renderer, asset->get("game_text.png"));
|
||||
@@ -439,18 +331,43 @@ void Game::loadMedia()
|
||||
gameOverEndTexture = new Texture(renderer, asset->get("menu_game_over_end.png"));
|
||||
|
||||
// Texturas - Globos
|
||||
Texture *balloon1Texture = new Texture(renderer, asset->get("balloon1.png"));
|
||||
Texture *balloon1Texture = new Texture(renderer, asset->get("balloon1.gif"));
|
||||
balloon1Texture->addPalette(asset->get("balloon_blue_pal.gif"));
|
||||
balloon1Texture->addPalette(asset->get("balloon_yellow_pal.gif"));
|
||||
balloon1Texture->addPalette(asset->get("balloon_green_pal.gif"));
|
||||
balloonTextures.push_back(balloon1Texture);
|
||||
|
||||
Texture *balloon2Texture = new Texture(renderer, asset->get("balloon2.png"));
|
||||
Texture *balloon2Texture = new Texture(renderer, asset->get("balloon2.gif"));
|
||||
balloon2Texture->addPalette(asset->get("balloon_blue_pal.gif"));
|
||||
balloon2Texture->addPalette(asset->get("balloon_yellow_pal.gif"));
|
||||
balloon2Texture->addPalette(asset->get("balloon_green_pal.gif"));
|
||||
balloonTextures.push_back(balloon2Texture);
|
||||
|
||||
Texture *balloon3Texture = new Texture(renderer, asset->get("balloon3.png"));
|
||||
Texture *balloon3Texture = new Texture(renderer, asset->get("balloon3.gif"));
|
||||
balloon3Texture->addPalette(asset->get("balloon_blue_pal.gif"));
|
||||
balloon3Texture->addPalette(asset->get("balloon_yellow_pal.gif"));
|
||||
balloon3Texture->addPalette(asset->get("balloon_green_pal.gif"));
|
||||
balloonTextures.push_back(balloon3Texture);
|
||||
|
||||
Texture *balloon4Texture = new Texture(renderer, asset->get("balloon4.png"));
|
||||
Texture *balloon4Texture = new Texture(renderer, asset->get("balloon4.gif"));
|
||||
balloon4Texture->addPalette(asset->get("balloon_blue_pal.gif"));
|
||||
balloon4Texture->addPalette(asset->get("balloon_yellow_pal.gif"));
|
||||
balloon4Texture->addPalette(asset->get("balloon_green_pal.gif"));
|
||||
balloonTextures.push_back(balloon4Texture);
|
||||
|
||||
// Texturas - Explosiones
|
||||
Texture *explosion1Texture = new Texture(renderer, asset->get("balloon1_explosion.png"));
|
||||
explosionsTextures.push_back(explosion1Texture);
|
||||
|
||||
Texture *explosion2Texture = new Texture(renderer, asset->get("balloon1_explosion.png"));
|
||||
explosionsTextures.push_back(explosion2Texture);
|
||||
|
||||
Texture *explosion3Texture = new Texture(renderer, asset->get("balloon1_explosion.png"));
|
||||
explosionsTextures.push_back(explosion3Texture);
|
||||
|
||||
Texture *explosion4Texture = new Texture(renderer, asset->get("balloon1_explosion.png"));
|
||||
explosionsTextures.push_back(explosion4Texture);
|
||||
|
||||
// Texturas - Items
|
||||
Texture *item1 = new Texture(renderer, asset->get("item_points1_disk.png"));
|
||||
itemTextures.push_back(item1);
|
||||
@@ -520,6 +437,23 @@ void Game::loadMedia()
|
||||
loadAnimations(asset->get("balloon4.ani"), balloon4Animation);
|
||||
balloonAnimations.push_back(balloon4Animation);
|
||||
|
||||
// Animaciones -- Explosiones
|
||||
std::vector<std::string> *explosions1Animation = new std::vector<std::string>;
|
||||
loadAnimations(asset->get("balloon1_explosion.ani"), explosions1Animation);
|
||||
explosionsAnimations.push_back(explosions1Animation);
|
||||
|
||||
std::vector<std::string> *explosions2Animation = new std::vector<std::string>;
|
||||
loadAnimations(asset->get("balloon2_explosion.ani"), explosions2Animation);
|
||||
explosionsAnimations.push_back(explosions2Animation);
|
||||
|
||||
std::vector<std::string> *explosions3Animation = new std::vector<std::string>;
|
||||
loadAnimations(asset->get("balloon3_explosion.ani"), explosions3Animation);
|
||||
explosionsAnimations.push_back(explosions3Animation);
|
||||
|
||||
std::vector<std::string> *explosions4Animation = new std::vector<std::string>;
|
||||
loadAnimations(asset->get("balloon4_explosion.ani"), explosions4Animation);
|
||||
explosionsAnimations.push_back(explosions4Animation);
|
||||
|
||||
// Animaciones -- Items
|
||||
std::vector<std::string> *item1Animation = new std::vector<std::string>;
|
||||
loadAnimations(asset->get("item_points1_disk.ani"), item1Animation);
|
||||
@@ -575,6 +509,121 @@ void Game::loadMedia()
|
||||
}
|
||||
}
|
||||
|
||||
// Libera los recursos previamente cargados
|
||||
void Game::unloadMedia()
|
||||
{
|
||||
// Texturas
|
||||
delete bulletTexture;
|
||||
delete gameTextTexture;
|
||||
delete gameOverTexture;
|
||||
delete gameOverEndTexture;
|
||||
|
||||
for (auto texture : player1Textures)
|
||||
{
|
||||
if (texture)
|
||||
{
|
||||
delete texture;
|
||||
}
|
||||
}
|
||||
player1Textures.clear();
|
||||
|
||||
for (auto texture : player2Textures)
|
||||
{
|
||||
if (texture)
|
||||
{
|
||||
delete texture;
|
||||
}
|
||||
}
|
||||
player2Textures.clear();
|
||||
|
||||
for (auto texture : itemTextures)
|
||||
{
|
||||
if (texture)
|
||||
{
|
||||
delete texture;
|
||||
}
|
||||
}
|
||||
itemTextures.clear();
|
||||
|
||||
for (auto texture : balloonTextures)
|
||||
{
|
||||
if (texture)
|
||||
{
|
||||
delete texture;
|
||||
}
|
||||
}
|
||||
balloonTextures.clear();
|
||||
|
||||
for (auto texture : explosionsTextures)
|
||||
{
|
||||
if (texture)
|
||||
{
|
||||
delete texture;
|
||||
}
|
||||
}
|
||||
explosionsTextures.clear();
|
||||
|
||||
// Animaciones
|
||||
for (auto animation : playerAnimations)
|
||||
{
|
||||
if (animation)
|
||||
{
|
||||
delete animation;
|
||||
}
|
||||
}
|
||||
playerAnimations.clear();
|
||||
|
||||
for (auto animation : balloonAnimations)
|
||||
{
|
||||
if (animation)
|
||||
{
|
||||
delete animation;
|
||||
}
|
||||
}
|
||||
balloonAnimations.clear();
|
||||
|
||||
for (auto animation : explosionsAnimations)
|
||||
{
|
||||
if (animation)
|
||||
{
|
||||
delete animation;
|
||||
}
|
||||
}
|
||||
explosionsAnimations.clear();
|
||||
|
||||
for (auto animation : itemAnimations)
|
||||
{
|
||||
if (animation)
|
||||
{
|
||||
delete animation;
|
||||
}
|
||||
}
|
||||
itemAnimations.clear();
|
||||
|
||||
// Text
|
||||
delete text;
|
||||
delete textBig;
|
||||
delete textNokia2;
|
||||
delete textNokiaBig2;
|
||||
|
||||
// Sonidos
|
||||
JA_DeleteSound(balloonSound);
|
||||
JA_DeleteSound(bulletSound);
|
||||
JA_DeleteSound(playerCollisionSound);
|
||||
JA_DeleteSound(hiScoreSound);
|
||||
JA_DeleteSound(itemDropSound);
|
||||
JA_DeleteSound(itemPickUpSound);
|
||||
JA_DeleteSound(coffeeOutSound);
|
||||
JA_DeleteSound(stageChangeSound);
|
||||
JA_DeleteSound(bubble1Sound);
|
||||
JA_DeleteSound(bubble2Sound);
|
||||
JA_DeleteSound(bubble3Sound);
|
||||
JA_DeleteSound(bubble4Sound);
|
||||
JA_DeleteSound(clockSound);
|
||||
JA_DeleteSound(powerBallSound);
|
||||
JA_DeleteSound(coffeeMachineSound);
|
||||
}
|
||||
|
||||
// Carga el fichero de puntos
|
||||
bool Game::loadScoreFile()
|
||||
{
|
||||
@@ -733,6 +782,10 @@ bool Game::loadDemoFile(std::string f, demoKeys_t (*dataFile)[TOTAL_DEMO_DATA])
|
||||
// Guarda el fichero de puntos
|
||||
bool Game::saveScoreFile()
|
||||
{
|
||||
// Almacena la máxima puntuación en el fichero junto con un checksum
|
||||
scoreDataFile[0] = hiScore;
|
||||
scoreDataFile[1] = hiScore % 43;
|
||||
|
||||
bool success = true;
|
||||
const std::string p = asset->get("score.bin");
|
||||
const std::string filename = p.substr(p.find_last_of("\\/") + 1);
|
||||
@@ -1564,12 +1617,6 @@ void Game::increaseStageCurrentPower(int power)
|
||||
stage[currentStage].currentPower += power;
|
||||
}
|
||||
|
||||
// Establece el valor de la variable
|
||||
void Game::setHiScore(Uint32 score)
|
||||
{
|
||||
hiScore = score;
|
||||
}
|
||||
|
||||
// Actualiza el valor de hiScore en caso necesario
|
||||
void Game::updateHiScore()
|
||||
{
|
||||
@@ -1580,10 +1627,6 @@ void Game::updateHiScore()
|
||||
// Actualiza la máxima puntuación
|
||||
hiScore = player->getScore();
|
||||
|
||||
// Almacena la máxima puntuación en el fichero junto con un checksum
|
||||
scoreDataFile[0] = hiScore;
|
||||
scoreDataFile[1] = hiScore % 43;
|
||||
|
||||
// Si se supera la máxima puntuación emite sonido
|
||||
if (hiScoreAchieved == false)
|
||||
{
|
||||
@@ -1932,38 +1975,32 @@ void Game::popBalloon(Balloon *balloon)
|
||||
evaluateAndSetMenace();
|
||||
}
|
||||
|
||||
// Explosiona un globo. Lo destruye
|
||||
// Explosiona un globo. Lo destruye = no crea otros globos
|
||||
void Game::destroyBalloon(Balloon *balloon)
|
||||
{
|
||||
int score = 0;
|
||||
int power = 0;
|
||||
|
||||
// Calcula la puntuación y el poder que generaria el globo en caso de romperlo a él y a sus hijos
|
||||
switch (balloon->getSize())
|
||||
{
|
||||
case BALLOON_SIZE_4:
|
||||
score = BALLOON_SCORE_4 + (2 * BALLOON_SCORE_3) + (4 * BALLOON_SCORE_2) + (8 * BALLOON_SCORE_1);
|
||||
power = 15;
|
||||
break;
|
||||
|
||||
case BALLOON_SIZE_3:
|
||||
score = BALLOON_SCORE_3 + (2 * BALLOON_SCORE_2) + (4 * BALLOON_SCORE_1);
|
||||
power = 7;
|
||||
break;
|
||||
|
||||
case BALLOON_SIZE_2:
|
||||
score = BALLOON_SCORE_2 + (2 * BALLOON_SCORE_1);
|
||||
power = 3;
|
||||
break;
|
||||
|
||||
case BALLOON_SIZE_1:
|
||||
score = BALLOON_SCORE_1;
|
||||
power = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
score = 0;
|
||||
power = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1975,6 +2012,7 @@ void Game::destroyBalloon(Balloon *balloon)
|
||||
updateHiScore();
|
||||
|
||||
// Aumenta el poder de la fase
|
||||
const int power = balloon->getPower();
|
||||
increaseStageCurrentPower(power);
|
||||
balloonsPopped += power;
|
||||
|
||||
@@ -1990,7 +2028,7 @@ void Game::popAllBalloons()
|
||||
{
|
||||
for (auto balloon : balloons)
|
||||
{
|
||||
if ((balloon->isEnabled()) && (!balloon->isPopping()) && (!balloon->isBeingCreated()))
|
||||
if (balloon->canBePopped())
|
||||
{
|
||||
popBalloon(balloon);
|
||||
}
|
||||
@@ -2004,7 +2042,7 @@ void Game::destroyAllBalloons()
|
||||
{
|
||||
for (auto balloon : balloons)
|
||||
{
|
||||
if ((balloon->isEnabled()) && (!balloon->isPopping()))
|
||||
if (balloon->canBeDestroyed())
|
||||
{
|
||||
destroyBalloon(balloon);
|
||||
}
|
||||
@@ -2061,7 +2099,7 @@ int Game::countBalloons()
|
||||
return num;
|
||||
}
|
||||
|
||||
// Vacia el vector de globos
|
||||
// Vacia del vector de globos los globos que ya no sirven
|
||||
void Game::freeBalloons()
|
||||
{
|
||||
if (balloons.empty() == false)
|
||||
@@ -2243,7 +2281,7 @@ void Game::renderBullets()
|
||||
// Crea un objeto bala
|
||||
void Game::createBullet(int x, int y, int kind, bool poweredUp, int owner)
|
||||
{
|
||||
Bullet *b = new Bullet(x, y, kind, poweredUp, owner, bulletTexture, renderer);
|
||||
Bullet *b = new Bullet(x, y, kind, poweredUp, owner, bulletTexture);
|
||||
bullets.push_back(b);
|
||||
}
|
||||
|
||||
@@ -2368,7 +2406,7 @@ int Game::dropItem()
|
||||
// Crea un objeto item
|
||||
void Game::createItem(int kind, float x, float y)
|
||||
{
|
||||
Item *item = new Item(kind, x, y, itemTextures[kind - 1], itemAnimations[kind - 1], renderer);
|
||||
Item *item = new Item(kind, x, y, itemTextures[kind - 1], itemAnimations[kind - 1]);
|
||||
items.push_back(item);
|
||||
}
|
||||
|
||||
@@ -2391,7 +2429,7 @@ void Game::freeItems()
|
||||
// Crea un objeto SmartSprite para mostrar la puntuación al coger un objeto
|
||||
void Game::createItemScoreSprite(int x, int y, SmartSprite *sprite)
|
||||
{
|
||||
SmartSprite *ss = new SmartSprite(nullptr, renderer);
|
||||
SmartSprite *ss = new SmartSprite(nullptr);
|
||||
smartSprites.push_back(ss);
|
||||
|
||||
// Crea una copia del objeto
|
||||
@@ -2423,7 +2461,7 @@ void Game::freeSmartSprites()
|
||||
// Crea un SmartSprite para arrojar el item café al recibir un impacto
|
||||
void Game::throwCoffee(int x, int y)
|
||||
{
|
||||
SmartSprite *ss = new SmartSprite(itemTextures[4], renderer);
|
||||
SmartSprite *ss = new SmartSprite(itemTextures[4]);
|
||||
smartSprites.push_back(ss);
|
||||
|
||||
ss->setPosX(x - 8);
|
||||
@@ -2487,6 +2525,10 @@ void Game::killPlayer(Player *player)
|
||||
JA_PlaySound(coffeeOutSound);
|
||||
player->setAlive(false);
|
||||
allPlayersAreDead() ? JA_StopMusic() : JA_ResumeMusic();
|
||||
if (!demo.enabled)
|
||||
{
|
||||
addScoreToScoreBoard("Sergio", player->getScore());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2638,6 +2680,8 @@ void Game::update()
|
||||
// Mueve los globos
|
||||
updateBalloons();
|
||||
|
||||
explosions->update();
|
||||
|
||||
// Mueve las balas
|
||||
moveBullets();
|
||||
|
||||
@@ -2731,6 +2775,7 @@ void Game::fillCanvas()
|
||||
background->render();
|
||||
renderItems();
|
||||
renderSmartSprites();
|
||||
explosions->render();
|
||||
renderBalloons();
|
||||
renderBullets();
|
||||
renderMessages();
|
||||
@@ -2783,7 +2828,7 @@ void Game::updateMenace()
|
||||
if (menaceCurrent < menaceThreshold)
|
||||
{
|
||||
// Crea una formación de enemigos
|
||||
deployEnemyFormation();
|
||||
// deployEnemyFormation();
|
||||
|
||||
// Recalcula el nivel de amenaza con el nuevo globo
|
||||
evaluateAndSetMenace();
|
||||
@@ -3397,7 +3442,7 @@ void Game::reloadTextures()
|
||||
background->reloadTextures();
|
||||
}
|
||||
|
||||
// Establece la máxima puntuación desde fichero o desde las puntuaciones online
|
||||
// Carga las puntuaciones desde el fichero y establece la máxima puntuación
|
||||
void Game::setHiScore()
|
||||
{
|
||||
// Carga el fichero de puntos
|
||||
@@ -3432,4 +3477,13 @@ void Game::pause(bool value)
|
||||
{
|
||||
paused = value;
|
||||
screen->attenuate(paused);
|
||||
}
|
||||
|
||||
// Añade una puntuación a la tabla de records
|
||||
void Game::addScoreToScoreBoard(std::string name, int score)
|
||||
{
|
||||
hiScoreEntry_t entry = {name, score};
|
||||
ManageHiScoreTable *m = new ManageHiScoreTable(&options->game.hiScoreTable);
|
||||
m->add(entry);
|
||||
delete m;
|
||||
}
|
||||
Reference in New Issue
Block a user