fix: no aparecían nunca diskitos

This commit is contained in:
2024-07-12 18:48:51 +02:00
parent a4dc3d20e2
commit 2ca218c075
6 changed files with 89 additions and 89 deletions

View File

@@ -802,10 +802,10 @@ void Game::initEnemyFormations()
}
}
const Uint16 creationTime = 300;
const int creationTime = 300;
int incX = 0;
Uint8 incTime = 0;
Uint8 j = 0;
int incTime = 0;
int j = 0;
// #00 - Dos enemigos BALLOON4 uno a cada extremo
j = 0;
@@ -1094,7 +1094,7 @@ void Game::initEnemyFormations()
incTime = 0;
for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
{
Uint8 half = enemyFormation[j].numberOfEnemies / 2;
const int half = enemyFormation[j].numberOfEnemies / 2;
if (i < half)
{
enemyFormation[j].init[i].x = x4_0 + (i * incX);
@@ -1117,7 +1117,7 @@ void Game::initEnemyFormations()
incTime = 3;
for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
{
Uint8 half = enemyFormation[j].numberOfEnemies / 2;
const int half = enemyFormation[j].numberOfEnemies / 2;
if (i < half)
{
enemyFormation[j].init[i].x = x2_0 + (i * incX);
@@ -1141,7 +1141,7 @@ void Game::initEnemyFormations()
incTime = 10;
for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
{
Uint8 half = enemyFormation[j].numberOfEnemies / 2;
const int half = enemyFormation[j].numberOfEnemies / 2;
if (i < half)
{
enemyFormation[j].init[i].x = x3_0 + (i * incX);
@@ -1165,7 +1165,7 @@ void Game::initEnemyFormations()
incTime = 10;
for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
{
Uint8 half = enemyFormation[j].numberOfEnemies / 2;
const int half = enemyFormation[j].numberOfEnemies / 2;
if (i < half)
{
enemyFormation[j].init[i].x = x3_0 + (i * incX);
@@ -1189,7 +1189,7 @@ void Game::initEnemyFormations()
incTime = 5;
for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
{
Uint8 half = enemyFormation[j].numberOfEnemies / 2;
const int half = enemyFormation[j].numberOfEnemies / 2;
if (i < half)
{
enemyFormation[j].init[i].x = x1_50;
@@ -1213,7 +1213,7 @@ void Game::initEnemyFormations()
incTime = 5;
for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
{
Uint8 half = enemyFormation[j].numberOfEnemies / 2;
const int half = enemyFormation[j].numberOfEnemies / 2;
if (i < half)
{
enemyFormation[j].init[i].x = x1_50 + 20;
@@ -1502,7 +1502,7 @@ void Game::deployEnemyFormation()
powerBallCounter > 0 ? powerBallCounter-- : powerBallCounter = 0;
// Elige una formación enemiga la azar
Uint8 set = (rand() % 10);
int set = rand() % 10;
// Evita repetir la ultima formación enemiga desplegada
if (set == lastEnemyDeploy)
@@ -1510,7 +1510,7 @@ void Game::deployEnemyFormation()
lastEnemyDeploy = set;
const Uint8 numEnemies = stage[currentStage].enemyPool->set[set]->numberOfEnemies;
const int numEnemies = stage[currentStage].enemyPool->set[set]->numberOfEnemies;
for (int i = 0; i < numEnemies; ++i)
{
createBalloon(stage[currentStage].enemyPool->set[set]->init[i].x,
@@ -1527,7 +1527,7 @@ void Game::deployEnemyFormation()
}
// Aumenta el poder de la fase
void Game::increaseStageCurrentPower(Uint8 power)
void Game::increaseStageCurrentPower(int power)
{
stage[currentStage].currentPower += power;
}
@@ -1666,7 +1666,7 @@ void Game::updateDeath()
if ((deathCounter == 250) || (deathCounter == 200) || (deathCounter == 180) || (deathCounter == 120) || (deathCounter == 60))
{
// Hace sonar aleatoriamente uno de los 4 sonidos de burbujas
const Uint8 index = rand() % 4;
const int index = rand() % 4;
JA_Sound_t *sound[4] = {bubble1Sound, bubble2Sound, bubble3Sound, bubble4Sound};
JA_PlaySound(sound[index], 0);
}
@@ -1704,12 +1704,12 @@ void Game::renderBalloons()
}
// Crea un globo nuevo en el vector de globos
Uint8 Game::createBalloon(float x, int y, Uint8 kind, float velx, float speed, Uint16 creationtimer)
int Game::createBalloon(float x, int y, int kind, float velx, float speed, int creationtimer)
{
const int index = (kind - 1) % 4;
Balloon *b = new Balloon(x, y, kind, velx, speed, creationtimer, balloonTextures[index], balloonAnimations[index], renderer);
balloons.push_back(b);
return (Uint8)(balloons.size() - 1);
return (int)(balloons.size() - 1);
}
// Crea una PowerBall
@@ -1848,7 +1848,7 @@ void Game::popBalloon(Balloon *balloon)
increaseStageCurrentPower(1);
balloonsPopped++;
const Uint8 kind = balloon->getKind();
const int kind = balloon->getKind();
switch (kind)
{
// Si es del tipo más pequeño, simplemente elimina el globo
@@ -1904,7 +1904,7 @@ void Game::popBalloon(Balloon *balloon)
void Game::destroyBalloon(Balloon *balloon)
{
int score = 0;
Uint8 power = 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())
@@ -1985,7 +1985,7 @@ void Game::destroyAllBalloons()
}
// Detiene todos los globos
void Game::stopAllBalloons(Uint16 time)
void Game::stopAllBalloons(int time)
{
for (auto balloon : balloons)
{
@@ -2011,9 +2011,9 @@ void Game::startAllBalloons()
}
// Obtiene el número de globos activos
Uint8 Game::countBalloons()
int Game::countBalloons()
{
Uint8 num = 0;
int num = 0;
for (auto balloon : balloons)
{
@@ -2158,7 +2158,7 @@ void Game::checkBulletBalloonCollision()
bullet->disable();
// Suelta el item en caso de que salga uno
const Uint8 droppeditem = dropItem();
const int droppeditem = dropItem();
// if ((droppeditem != NO_KIND) && !(demo.enabled) && !(demo.recording))
if ((droppeditem != NO_KIND) && !(demo.recording))
{
@@ -2209,7 +2209,7 @@ void Game::renderBullets()
}
// Crea un objeto bala
void Game::createBullet(int x, int y, Uint8 kind, bool poweredUp, int owner)
void Game::createBullet(int x, int y, int kind, bool poweredUp, int owner)
{
Bullet *b = new Bullet(x, y, kind, poweredUp, owner, bulletTexture, renderer);
bullets.push_back(b);
@@ -2258,10 +2258,10 @@ void Game::renderItems()
}
// Devuelve un item al azar y luego segun sus probabilidades
Uint8 Game::dropItem()
int Game::dropItem()
{
const Uint8 luckyNumber = rand() % 100;
const Uint8 item = rand() % 6;
const int luckyNumber = rand() % 100;
const int item = rand() % 6;
switch (item)
{
@@ -2334,9 +2334,9 @@ Uint8 Game::dropItem()
}
// Crea un objeto item
void Game::createItem(Uint8 kind, float x, float y)
void Game::createItem(int kind, float x, float y)
{
Item *item = new Item(kind, x, y, itemTextures[kind], itemAnimations[kind], renderer);
Item *item = new Item(kind, x, y, itemTextures[kind - 1], itemAnimations[kind - 1], renderer);
items.push_back(item);
}
@@ -2481,7 +2481,7 @@ void Game::evaluateAndSetMenace()
}
// Obtiene el valor de la variable
Uint8 Game::getMenace()
int Game::getMenace()
{
return menaceCurrent;
}
@@ -2499,13 +2499,13 @@ bool Game::isTimeStopped()
}
// Establece el valor de la variable
void Game::setTimeStoppedCounter(Uint16 value)
void Game::setTimeStoppedCounter(int value)
{
timeStoppedCounter = value;
}
// Incrementa el valor de la variable
void Game::incTimeStoppedCounter(Uint16 value)
void Game::incTimeStoppedCounter(int value)
{
timeStoppedCounter += value;
}
@@ -2749,7 +2749,7 @@ void Game::updateMenace()
}
const float percent = stage[currentStage].currentPower / stage[currentStage].powerToComplete;
const Uint8 difference = stage[currentStage].maxMenace - stage[currentStage].minMenace;
const int difference = stage[currentStage].maxMenace - stage[currentStage].minMenace;
// Aumenta el nivel de amenaza en función de la puntuación
menaceThreshold = stage[currentStage].minMenace + (difference * percent);