diff --git a/source/game.cpp b/source/game.cpp index 5c84428..51b3921 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -9,19 +9,19 @@ Game::Game(int numPlayers, int currentStage, SDL_Renderer *renderer, Screen *scr this->asset = asset; this->lang = lang; this->input = input; - this->mOptions = options; - mOnePlayerControl = mOptions->input[0].deviceType; + this->options = options; + onePlayerControl = options->input[0].deviceType; // Pasa variables - mDemo.enabled = demo; - mNumPlayers = numPlayers; - this->mCurrentStage = 5; // currentStage; - mLastStageReached = currentStage; - if (mNumPlayers == 1) + this->demo.enabled = demo; + this->numPlayers = numPlayers; + this->currentStage = 5; // currentStage; + lastStageReached = currentStage; + if (numPlayers == 1) { - mOptions->input[0].deviceType = INPUT_USE_ANY; + options->input[0].deviceType = INPUT_USE_ANY; } - mDifficulty = mOptions->difficulty; + difficulty = options->difficulty; // Crea los objetos balloon1Texture = new LTexture(renderer, asset->get("balloon1.png")); @@ -84,7 +84,7 @@ Game::~Game() saveScoreFile(); saveDemoFile(); - mOptions->input[0].deviceType = mOnePlayerControl; + options->input[0].deviceType = onePlayerControl; // Elimina todos los objetos contenidos en vectores deleteAllVectorObjects(); @@ -171,16 +171,6 @@ Game::~Game() JA_DeleteMusic(gameMusic); } -// Inicializa el vector con los valores del seno -void Game::initSin() -{ - // Vector con los valores del seno para 360 grados - for (int i = 0; i < 360; i++) - { - mSin[i] = SDL_sinf((float)i * 3.14f / 180.0f); - } -} - // Inicializa las variables necesarias para la sección 'Game' void Game::init() { @@ -191,8 +181,8 @@ void Game::init() loadScoreFile(); loadDemoFile(); - mTicks = 0; - mTicksSpeed = 15; + ticks = 0; + ticksSpeed = 15; // Crea los jugadores for (auto player : players) @@ -201,13 +191,13 @@ void Game::init() }; players.clear(); - if (mNumPlayers == 1) + if (numPlayers == 1) { Player *player = new Player(renderer, asset, PLAY_AREA_CENTER_X - 11, PLAY_AREA_BOTTOM - 24); players.push_back(player); } - else if (mNumPlayers == 2) + else if (numPlayers == 2) { Player *player1 = new Player(renderer, asset, (PLAY_AREA_CENTER_FIRST_QUARTER_X * ((0 * 2) + 1)) - 11, PLAY_AREA_BOTTOM - 24); Player *player2 = new Player(renderer, asset, (PLAY_AREA_CENTER_FIRST_QUARTER_X * ((1 * 2) + 1)) - 11, PLAY_AREA_BOTTOM - 24); @@ -216,90 +206,88 @@ void Game::init() } // Inicializa las variables - switch (mDifficulty) + switch (difficulty) { case DIFFICULTY_EASY: - mDefaultEnemySpeed = BALLOON_SPEED_1; - mDifficultyScoreMultiplier = 0.5f; + defaultEnemySpeed = BALLOON_SPEED_1; + difficultyScoreMultiplier = 0.5f; break; case DIFFICULTY_NORMAL: - mDefaultEnemySpeed = BALLOON_SPEED_1; - mDifficultyScoreMultiplier = 1.0f; + defaultEnemySpeed = BALLOON_SPEED_1; + difficultyScoreMultiplier = 1.0f; break; case DIFFICULTY_HARD: - mDefaultEnemySpeed = BALLOON_SPEED_5; - mDifficultyScoreMultiplier = 1.5f; + defaultEnemySpeed = BALLOON_SPEED_5; + difficultyScoreMultiplier = 1.5f; break; default: break; } - mGameCompleted = false; - mGameCompletedCounter = 0; - mSection.name = PROG_SECTION_GAME; - mSection.subsection = GAME_SECTION_PLAY_1P; - mMenaceCurrent = 0; - mMenaceThreshold = 0; - mHiScoreAchieved = false; - mStageBitmapCounter = STAGE_COUNTER; - mDeathCounter = DEATH_COUNTER; - mTimeStopped = false; - mTimeStoppedCounter = 0; - mCounter = 0; - mLastEnemyDeploy = 0; - mEnemyDeployCounter = 0; - mEnemySpeed = mDefaultEnemySpeed; - mEffect.flash = false; - mEffect.shake = false; - mEffect.shakeCounter = SHAKE_COUNTER; - mHelper.needCoffee = false; - mHelper.needCoffeeMachine = false; - mHelper.needPowerBall = false; - mHelper.counter = HELP_COUNTER; - mHelper.itemPoints1Odds = ITEM_POINTS_1_DISK_ODDS; - mHelper.itemPoints2Odds = ITEM_POINTS_2_GAVINA_ODDS; - mHelper.itemPoints3Odds = ITEM_POINTS_3_PACMAR_ODDS; - mHelper.itemClockOdds = ITEM_CLOCK_ODDS; - mHelper.itemCoffeeOdds = ITEM_COFFEE_ODDS; - mHelper.itemCoffeeMachineOdds = ITEM_COFFEE_MACHINE_ODDS; - mPowerBallEnabled = false; - mPowerBallCounter = 0; - mCoffeeMachineEnabled = false; - mPostFade = 0; + gameCompleted = false; + gameCompletedCounter = 0; + section.name = PROG_SECTION_GAME; + section.subsection = GAME_SECTION_PLAY_1P; + menaceCurrent = 0; + menaceThreshold = 0; + hiScoreAchieved = false; + stageBitmapCounter = STAGE_COUNTER; + deathCounter = DEATH_COUNTER; + timeStopped = false; + timeStoppedCounter = 0; + counter = 0; + lastEnemyDeploy = 0; + enemyDeployCounter = 0; + enemySpeed = defaultEnemySpeed; + effect.flash = false; + effect.shake = false; + effect.shakeCounter = SHAKE_COUNTER; + helper.needCoffee = false; + helper.needCoffeeMachine = false; + helper.needPowerBall = false; + helper.counter = HELP_COUNTER; + helper.itemPoints1Odds = ITEM_POINTS_1_DISK_ODDS; + helper.itemPoints2Odds = ITEM_POINTS_2_GAVINA_ODDS; + helper.itemPoints3Odds = ITEM_POINTS_3_PACMAR_ODDS; + helper.itemClockOdds = ITEM_CLOCK_ODDS; + helper.itemCoffeeOdds = ITEM_COFFEE_ODDS; + helper.itemCoffeeMachineOdds = ITEM_COFFEE_MACHINE_ODDS; + powerBallEnabled = false; + powerBallCounter = 0; + coffeeMachineEnabled = false; - if (mDemo.enabled) + if (demo.enabled) { const int num = rand() % 2; if (num == 0) { - mBalloonsPopped = 1000; - mCurrentStage = 3; + balloonsPopped = 1000; + currentStage = 3; } else { - mBalloonsPopped = 1800; - mCurrentStage = 6; + balloonsPopped = 1800; + currentStage = 6; } } - initSin(); initPaths(); initEnemyFormations(); initEnemyPools(); initGameStages(); // Mas variables - mBalloonsPopped = 0; - for (int i = 0; i < mCurrentStage; ++i) + balloonsPopped = 0; + for (int i = 0; i < currentStage; ++i) { - mBalloonsPopped += mStage[i].powerToComplete; + balloonsPopped += stage[i].powerToComplete; } // Modo demo - mDemo.recording = false; - mDemo.counter = 0; + demo.recording = false; + demo.counter = 0; // Inicializa el objeto para el fundido fade->init(0x27, 0x27, 0x36); @@ -419,8 +407,8 @@ bool Game::loadScoreFile() // Inicializamos los datos for (int i = 0; i < TOTAL_SCORE_DATA; ++i) { - mScoreDataFile[i] = 0; - SDL_RWwrite(file, &mScoreDataFile[i], sizeof(Uint32), 1); + scoreDataFile[i] = 0; + SDL_RWwrite(file, &scoreDataFile[i], sizeof(Uint32), 1); } // Cerramos el fichero @@ -438,25 +426,25 @@ bool Game::loadScoreFile() // Cargamos los datos printf("Reading file %s\n", filename.c_str()); for (int i = 0; i < TOTAL_SCORE_DATA; ++i) - SDL_RWread(file, &mScoreDataFile[i], sizeof(Uint32), 1); + SDL_RWread(file, &scoreDataFile[i], sizeof(Uint32), 1); // Cierra el fichero SDL_RWclose(file); } // Establece el valor de la máxima puntuación a partir del vector con los datos - if (mScoreDataFile[0] == 0) + if (scoreDataFile[0] == 0) { - mHiScore = 10000; + hiScore = 10000; } // Comprueba el checksum para ver si se ha modificado el fichero - else if (mScoreDataFile[0] % 43 == mScoreDataFile[1]) + else if (scoreDataFile[0] % 43 == scoreDataFile[1]) { - mHiScore = mScoreDataFile[0]; + hiScore = scoreDataFile[0]; } else { - mHiScore = 10000; + hiScore = 10000; } return success; @@ -485,14 +473,14 @@ bool Game::loadDemoFile() // Inicializamos los datos for (int i = 0; i < TOTAL_DEMO_DATA; ++i) { - mDemo.keys.left = 0; - mDemo.keys.right = 0; - mDemo.keys.noInput = 0; - mDemo.keys.fire = 0; - mDemo.keys.fireLeft = 0; - mDemo.keys.fireRight = 0; - mDemo.dataFile[i] = mDemo.keys; - SDL_RWwrite(file, &mDemo.dataFile[i], sizeof(demoKeys_t), 1); + demo.keys.left = 0; + demo.keys.right = 0; + demo.keys.noInput = 0; + demo.keys.fire = 0; + demo.keys.fireLeft = 0; + demo.keys.fireRight = 0; + demo.dataFile[i] = demo.keys; + SDL_RWwrite(file, &demo.dataFile[i], sizeof(demoKeys_t), 1); } // Cerramos el fichero @@ -510,7 +498,7 @@ bool Game::loadDemoFile() // Cargamos los datos printf("Reading file %s\n", filename.c_str()); for (int i = 0; i < TOTAL_DEMO_DATA; ++i) - SDL_RWread(file, &mDemo.dataFile[i], sizeof(demoKeys_t), 1); + SDL_RWread(file, &demo.dataFile[i], sizeof(demoKeys_t), 1); // Cierra el fichero SDL_RWclose(file); @@ -531,7 +519,7 @@ bool Game::saveScoreFile() // Guardamos los datos for (int i = 0; i < TOTAL_SCORE_DATA; ++i) { - SDL_RWwrite(file, &mScoreDataFile[i], sizeof(Uint32), 1); + SDL_RWwrite(file, &scoreDataFile[i], sizeof(Uint32), 1); } printf("Writing file %s\n", filename.c_str()); @@ -552,7 +540,7 @@ bool Game::saveDemoFile() bool success = true; const std::string p = asset->get("demo.bin"); const std::string filename = p.substr(p.find_last_of("\\/") + 1); - if (mDemo.recording) + if (demo.recording) { SDL_RWops *file = SDL_RWFromFile(p.c_str(), "w+b"); if (file != nullptr) @@ -560,7 +548,7 @@ bool Game::saveDemoFile() // Guardamos los datos for (int i = 0; i < TOTAL_DEMO_DATA; ++i) { - SDL_RWwrite(file, &mDemo.dataFile[i], sizeof(demoKeys_t), 1); + SDL_RWwrite(file, &demo.dataFile[i], sizeof(demoKeys_t), 1); } printf("Writing file %s\n", filename.c_str()); @@ -599,14 +587,14 @@ void Game::initEnemyFormations() // Inicializa a cero las variables for (int i = 0; i < NUMBER_OF_ENEMY_FORMATIONS; i++) { - mEnemyFormation[i].numberOfEnemies = 0; + enemyFormation[i].numberOfEnemies = 0; for (int j = 0; j < MAX_NUMBER_OF_ENEMIES_IN_A_FORMATION; j++) { - mEnemyFormation[i].init[j].x = 0; - mEnemyFormation[i].init[j].y = 0; - mEnemyFormation[i].init[j].velX = 0; - mEnemyFormation[i].init[j].kind = 0; - mEnemyFormation[i].init[j].creationCounter = 0; + enemyFormation[i].init[j].x = 0; + enemyFormation[i].init[j].y = 0; + enemyFormation[i].init[j].velX = 0; + enemyFormation[i].init[j].kind = 0; + enemyFormation[i].init[j].creationCounter = 0; } } @@ -617,682 +605,682 @@ void Game::initEnemyFormations() // #00 - Dos enemigos BALLOON4 uno a cada extremo j = 0; - mEnemyFormation[j].numberOfEnemies = 2; + enemyFormation[j].numberOfEnemies = 2; incX = x4_100; incTime = 0; - for (int i = 0; i < mEnemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) { - mEnemyFormation[j].init[i].x = x4_0 + (i * incX); - mEnemyFormation[j].init[i].y = y4; - mEnemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE * (((i % 2) * 2) - 1); - mEnemyFormation[j].init[i].kind = BALLOON_4; - mEnemyFormation[j].init[i].creationCounter = creationTime + (incTime * i); + enemyFormation[j].init[i].x = x4_0 + (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; + enemyFormation[j].init[i].creationCounter = creationTime + (incTime * i); } // #01 - Dos enemigos BALLOON4 uno a cada cuarto. Ambos van hacia el centro j = 1; - mEnemyFormation[j].numberOfEnemies = 2; + enemyFormation[j].numberOfEnemies = 2; incX = PLAY_AREA_CENTER_X; incTime = 0; - for (int i = 0; i < mEnemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) { - mEnemyFormation[j].init[i].x = PLAY_AREA_CENTER_FIRST_QUARTER_X - (BALLOON_WIDTH_4 / 2) + (i * incX); - mEnemyFormation[j].init[i].y = y4; - mEnemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE * (((i % 2) * 2) - 1); - mEnemyFormation[j].init[i].kind = BALLOON_4; - mEnemyFormation[j].init[i].creationCounter = creationTime + (incTime * i); + enemyFormation[j].init[i].x = PLAY_AREA_CENTER_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; + enemyFormation[j].init[i].creationCounter = creationTime + (incTime * i); } // #02 - Cuatro enemigos BALLOON2 uno detras del otro. A la izquierda y hacia el centro j = 2; - mEnemyFormation[j].numberOfEnemies = 4; + enemyFormation[j].numberOfEnemies = 4; incX = BALLOON_WIDTH_2 + 1; incTime = 10; - for (int i = 0; i < mEnemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) { - mEnemyFormation[j].init[i].x = x2_0 + (i * incX); - mEnemyFormation[j].init[i].y = y2; - mEnemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; - mEnemyFormation[j].init[i].kind = BALLOON_2; - mEnemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); + enemyFormation[j].init[i].x = x2_0 + (i * incX); + enemyFormation[j].init[i].y = y2; + enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; + enemyFormation[j].init[i].kind = BALLOON_2; + enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); } // #03 - Cuatro enemigos BALLOON2 uno detras del otro. A la derecha y hacia el centro j = 3; - mEnemyFormation[j].numberOfEnemies = 4; + enemyFormation[j].numberOfEnemies = 4; incX = BALLOON_WIDTH_2 + 1; incTime = 10; - for (int i = 0; i < mEnemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) { - mEnemyFormation[j].init[i].x = x2_100 - (i * incX); - mEnemyFormation[j].init[i].y = y2; - mEnemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; - mEnemyFormation[j].init[i].kind = BALLOON_2; - mEnemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); + enemyFormation[j].init[i].x = x2_100 - (i * incX); + enemyFormation[j].init[i].y = y2; + enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; + enemyFormation[j].init[i].kind = BALLOON_2; + enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); } // #04 - Tres enemigos BALLOON3. 0, 25, 50. Hacia la derecha j = 4; - mEnemyFormation[j].numberOfEnemies = 3; + enemyFormation[j].numberOfEnemies = 3; incX = BALLOON_WIDTH_3 * 2; incTime = 10; - for (int i = 0; i < mEnemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) { - mEnemyFormation[j].init[i].x = x3_0 + (i * incX); - mEnemyFormation[j].init[i].y = y3; - mEnemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; - mEnemyFormation[j].init[i].kind = BALLOON_3; - mEnemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); + enemyFormation[j].init[i].x = x3_0 + (i * incX); + enemyFormation[j].init[i].y = y3; + enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; + enemyFormation[j].init[i].kind = BALLOON_3; + enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); } // #05 - Tres enemigos BALLOON3. 50, 75, 100. Hacia la izquierda j = 5; - mEnemyFormation[j].numberOfEnemies = 3; + enemyFormation[j].numberOfEnemies = 3; incX = BALLOON_WIDTH_3 * 2; incTime = 10; - for (int i = 0; i < mEnemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) { - mEnemyFormation[j].init[i].x = x3_100 - (i * incX); - mEnemyFormation[j].init[i].y = y3; - mEnemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; - mEnemyFormation[j].init[i].kind = BALLOON_3; - mEnemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); + enemyFormation[j].init[i].x = x3_100 - (i * incX); + enemyFormation[j].init[i].y = y3; + enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; + enemyFormation[j].init[i].kind = BALLOON_3; + enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); } // #06 - Tres enemigos BALLOON3. 0, 0, 0. Hacia la derecha j = 6; - mEnemyFormation[j].numberOfEnemies = 3; + enemyFormation[j].numberOfEnemies = 3; incX = BALLOON_WIDTH_3 + 1; incTime = 10; - for (int i = 0; i < mEnemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) { - mEnemyFormation[j].init[i].x = x3_0 + (i * incX); - mEnemyFormation[j].init[i].y = y3; - mEnemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; - mEnemyFormation[j].init[i].kind = BALLOON_3; - mEnemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); + enemyFormation[j].init[i].x = x3_0 + (i * incX); + enemyFormation[j].init[i].y = y3; + enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; + enemyFormation[j].init[i].kind = BALLOON_3; + enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); } // #07 - Tres enemigos BALLOON3. 100, 100, 100. Hacia la izquierda j = 7; - mEnemyFormation[j].numberOfEnemies = 3; + enemyFormation[j].numberOfEnemies = 3; incX = BALLOON_WIDTH_3 + 1; incTime = 10; - for (int i = 0; i < mEnemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) { - mEnemyFormation[j].init[i].x = x3_100 - (i * incX); - mEnemyFormation[j].init[i].y = y3; - mEnemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; - mEnemyFormation[j].init[i].kind = BALLOON_3; - mEnemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); + enemyFormation[j].init[i].x = x3_100 - (i * incX); + enemyFormation[j].init[i].y = y3; + enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; + enemyFormation[j].init[i].kind = BALLOON_3; + enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); } // #08 - Seis enemigos BALLOON1. 0, 0, 0, 0, 0, 0. Hacia la derecha j = 8; - mEnemyFormation[j].numberOfEnemies = 6; + enemyFormation[j].numberOfEnemies = 6; incX = BALLOON_WIDTH_1 + 1; incTime = 10; - for (int i = 0; i < mEnemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) { - mEnemyFormation[j].init[i].x = x1_0 + (i * incX); - mEnemyFormation[j].init[i].y = 13; - mEnemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; - mEnemyFormation[j].init[i].kind = BALLOON_1; - mEnemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); + enemyFormation[j].init[i].x = x1_0 + (i * incX); + enemyFormation[j].init[i].y = 13; + enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; + enemyFormation[j].init[i].kind = BALLOON_1; + enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); } // #09 - Seis enemigos BALLOON1. 100, 100, 100, 100, 100, 100. Hacia la izquierda j = 9; - mEnemyFormation[j].numberOfEnemies = 6; + enemyFormation[j].numberOfEnemies = 6; incX = BALLOON_WIDTH_1 + 1; incTime = 10; - for (int i = 0; i < mEnemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) { - mEnemyFormation[j].init[i].x = x1_100 - (i * incX); - mEnemyFormation[j].init[i].y = 13; - mEnemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; - mEnemyFormation[j].init[i].kind = BALLOON_1; - mEnemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); + enemyFormation[j].init[i].x = x1_100 - (i * incX); + enemyFormation[j].init[i].y = 13; + enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; + enemyFormation[j].init[i].kind = BALLOON_1; + enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); } // #10 - Tres enemigos BALLOON4 seguidos desde la izquierda j = 10; - mEnemyFormation[j].numberOfEnemies = 3; + enemyFormation[j].numberOfEnemies = 3; incX = BALLOON_WIDTH_4 + 1; incTime = 15; - for (int i = 0; i < mEnemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) { - mEnemyFormation[j].init[i].x = x4_0 + (i * incX); - mEnemyFormation[j].init[i].y = y4; - mEnemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; - mEnemyFormation[j].init[i].kind = BALLOON_4; - mEnemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); + enemyFormation[j].init[i].x = x4_0 + (i * incX); + enemyFormation[j].init[i].y = y4; + enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; + enemyFormation[j].init[i].kind = BALLOON_4; + enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); } // #11 - Tres enemigos BALLOON4 seguidos desde la derecha j = 11; - mEnemyFormation[j].numberOfEnemies = 3; + enemyFormation[j].numberOfEnemies = 3; incX = BALLOON_WIDTH_4 + 1; incTime = 15; - for (int i = 0; i < mEnemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) { - mEnemyFormation[j].init[i].x = x4_100 - (i * incX); - mEnemyFormation[j].init[i].y = y4; - mEnemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; - mEnemyFormation[j].init[i].kind = BALLOON_4; - mEnemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); + enemyFormation[j].init[i].x = x4_100 - (i * incX); + enemyFormation[j].init[i].y = y4; + enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; + enemyFormation[j].init[i].kind = BALLOON_4; + enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); } // #12 - Seis enemigos BALLOON2 uno detras del otro. A la izquierda y hacia el centro j = 12; - mEnemyFormation[j].numberOfEnemies = 6; + enemyFormation[j].numberOfEnemies = 6; incX = BALLOON_WIDTH_2 + 1; incTime = 10; - for (int i = 0; i < mEnemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) { - mEnemyFormation[j].init[i].x = x2_0 + (i * incX); - mEnemyFormation[j].init[i].y = y2; - mEnemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; - mEnemyFormation[j].init[i].kind = BALLOON_2; - mEnemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); + enemyFormation[j].init[i].x = x2_0 + (i * incX); + enemyFormation[j].init[i].y = y2; + enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; + enemyFormation[j].init[i].kind = BALLOON_2; + enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); } // #13 - Seis enemigos BALLOON2 uno detras del otro. A la derecha y hacia el centro j = 13; - mEnemyFormation[j].numberOfEnemies = 6; + enemyFormation[j].numberOfEnemies = 6; incX = BALLOON_WIDTH_2 + 1; incTime = 10; - for (int i = 0; i < mEnemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) { - mEnemyFormation[j].init[i].x = x2_100 - (i * incX); - mEnemyFormation[j].init[i].y = y2; - mEnemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; - mEnemyFormation[j].init[i].kind = BALLOON_2; - mEnemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); + enemyFormation[j].init[i].x = x2_100 - (i * incX); + enemyFormation[j].init[i].y = y2; + enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; + enemyFormation[j].init[i].kind = BALLOON_2; + enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); } // #14 - Cinco enemigos BALLOON3. Hacia la derecha. Separados j = 14; - mEnemyFormation[j].numberOfEnemies = 5; + enemyFormation[j].numberOfEnemies = 5; incX = BALLOON_WIDTH_3 * 2; incTime = 10; - for (int i = 0; i < mEnemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) { - mEnemyFormation[j].init[i].x = x3_0 + (i * incX); - mEnemyFormation[j].init[i].y = y3; - mEnemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; - mEnemyFormation[j].init[i].kind = BALLOON_3; - mEnemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); + enemyFormation[j].init[i].x = x3_0 + (i * incX); + enemyFormation[j].init[i].y = y3; + enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; + enemyFormation[j].init[i].kind = BALLOON_3; + enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); } // #15 - Cinco enemigos BALLOON3. Hacia la izquierda. Separados j = 15; - mEnemyFormation[j].numberOfEnemies = 5; + enemyFormation[j].numberOfEnemies = 5; incX = BALLOON_WIDTH_3 * 2; incTime = 10; - for (int i = 0; i < mEnemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) { - mEnemyFormation[j].init[i].x = x3_100 - (i * incX); - mEnemyFormation[j].init[i].y = y3; - mEnemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; - mEnemyFormation[j].init[i].kind = BALLOON_3; - mEnemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); + enemyFormation[j].init[i].x = x3_100 - (i * incX); + enemyFormation[j].init[i].y = y3; + enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; + enemyFormation[j].init[i].kind = BALLOON_3; + enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); } // #16 - Cinco enemigos BALLOON3. Hacia la derecha. Juntos j = 16; - mEnemyFormation[j].numberOfEnemies = 5; + enemyFormation[j].numberOfEnemies = 5; incX = BALLOON_WIDTH_3 + 1; incTime = 10; - for (int i = 0; i < mEnemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) { - mEnemyFormation[j].init[i].x = x3_0 + (i * incX); - mEnemyFormation[j].init[i].y = y3; - mEnemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; - mEnemyFormation[j].init[i].kind = BALLOON_3; - mEnemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); + enemyFormation[j].init[i].x = x3_0 + (i * incX); + enemyFormation[j].init[i].y = y3; + enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; + enemyFormation[j].init[i].kind = BALLOON_3; + enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); } // #17 - Cinco enemigos BALLOON3. Hacia la izquierda. Juntos j = 17; - mEnemyFormation[j].numberOfEnemies = 5; + enemyFormation[j].numberOfEnemies = 5; incX = BALLOON_WIDTH_3 + 1; incTime = 10; - for (int i = 0; i < mEnemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) { - mEnemyFormation[j].init[i].x = x3_100 - (i * incX); - mEnemyFormation[j].init[i].y = y3; - mEnemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; - mEnemyFormation[j].init[i].kind = BALLOON_3; - mEnemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); + enemyFormation[j].init[i].x = x3_100 - (i * incX); + enemyFormation[j].init[i].y = y3; + enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; + enemyFormation[j].init[i].kind = BALLOON_3; + enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); } // #18 - Doce enemigos BALLOON1. Hacia la derecha. Juntos j = 18; - mEnemyFormation[j].numberOfEnemies = 12; + enemyFormation[j].numberOfEnemies = 12; incX = BALLOON_WIDTH_1 + 1; incTime = 10; - for (int i = 0; i < mEnemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) { - mEnemyFormation[j].init[i].x = x1_0 + (i * incX); - mEnemyFormation[j].init[i].y = y1; - mEnemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; - mEnemyFormation[j].init[i].kind = BALLOON_1; - mEnemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); + enemyFormation[j].init[i].x = x1_0 + (i * incX); + enemyFormation[j].init[i].y = y1; + enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; + enemyFormation[j].init[i].kind = BALLOON_1; + enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); } // #19 - Doce enemigos BALLOON1. Hacia la izquierda. Juntos j = 19; - mEnemyFormation[j].numberOfEnemies = 12; + enemyFormation[j].numberOfEnemies = 12; incX = BALLOON_WIDTH_1 + 1; incTime = 10; - for (int i = 0; i < mEnemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) { - mEnemyFormation[j].init[i].x = x1_100 - (i * incX); - mEnemyFormation[j].init[i].y = y1; - mEnemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; - mEnemyFormation[j].init[i].kind = BALLOON_1; - mEnemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); + enemyFormation[j].init[i].x = x1_100 - (i * incX); + enemyFormation[j].init[i].y = y1; + enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; + enemyFormation[j].init[i].kind = BALLOON_1; + enemyFormation[j].init[i].creationCounter = creationTime - (incTime * i); } // #20 - Dos enemigos BALLOON4 seguidos desde la izquierda/derecha. Simetricos j = 20; - mEnemyFormation[j].numberOfEnemies = 4; + enemyFormation[j].numberOfEnemies = 4; incX = BALLOON_WIDTH_4 + 1; incTime = 0; - for (int i = 0; i < mEnemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) { - Uint8 half = mEnemyFormation[j].numberOfEnemies / 2; + Uint8 half = enemyFormation[j].numberOfEnemies / 2; if (i < half) { - mEnemyFormation[j].init[i].x = x4_0 + (i * incX); - mEnemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; + enemyFormation[j].init[i].x = x4_0 + (i * incX); + enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; } else { - mEnemyFormation[j].init[i].x = x4_100 - ((i - half) * incX); - mEnemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; + enemyFormation[j].init[i].x = x4_100 - ((i - half) * incX); + enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; } - mEnemyFormation[j].init[i].y = y4; - mEnemyFormation[j].init[i].kind = BALLOON_4; - mEnemyFormation[j].init[i].creationCounter = creationTime + (incTime * i); + enemyFormation[j].init[i].y = y4; + enemyFormation[j].init[i].kind = BALLOON_4; + enemyFormation[j].init[i].creationCounter = creationTime + (incTime * i); } // #21 - Diez enemigos BALLOON2 uno detras del otro. Izquierda/derecha. Simetricos j = 21; - mEnemyFormation[j].numberOfEnemies = 10; + enemyFormation[j].numberOfEnemies = 10; incX = BALLOON_WIDTH_2 + 1; incTime = 3; - for (int i = 0; i < mEnemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) { - Uint8 half = mEnemyFormation[j].numberOfEnemies / 2; + Uint8 half = enemyFormation[j].numberOfEnemies / 2; if (i < half) { - mEnemyFormation[j].init[i].x = x2_0 + (i * incX); - mEnemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; - mEnemyFormation[j].init[i].creationCounter = (creationTime) - (incTime * i); + enemyFormation[j].init[i].x = x2_0 + (i * incX); + enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; + enemyFormation[j].init[i].creationCounter = (creationTime) - (incTime * i); } else { - mEnemyFormation[j].init[i].x = x2_100 - ((i - half) * incX); - mEnemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; - mEnemyFormation[j].init[i].creationCounter = (creationTime) - (incTime * (i - half)); + enemyFormation[j].init[i].x = x2_100 - ((i - half) * incX); + enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; + enemyFormation[j].init[i].creationCounter = (creationTime) - (incTime * (i - half)); } - mEnemyFormation[j].init[i].y = y2; - mEnemyFormation[j].init[i].kind = BALLOON_2; + enemyFormation[j].init[i].y = y2; + enemyFormation[j].init[i].kind = BALLOON_2; } // #22 - Diez enemigos BALLOON3. Hacia la derecha/izquierda. Separados. Simetricos j = 22; - mEnemyFormation[j].numberOfEnemies = 10; + enemyFormation[j].numberOfEnemies = 10; incX = BALLOON_WIDTH_3 * 2; incTime = 10; - for (int i = 0; i < mEnemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) { - Uint8 half = mEnemyFormation[j].numberOfEnemies / 2; + Uint8 half = enemyFormation[j].numberOfEnemies / 2; if (i < half) { - mEnemyFormation[j].init[i].x = x3_0 + (i * incX); - mEnemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; - mEnemyFormation[j].init[i].creationCounter = (creationTime) - (incTime * i); + enemyFormation[j].init[i].x = x3_0 + (i * incX); + enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; + enemyFormation[j].init[i].creationCounter = (creationTime) - (incTime * i); } else { - mEnemyFormation[j].init[i].x = x3_100 - ((i - half) * incX); - mEnemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; - mEnemyFormation[j].init[i].creationCounter = (creationTime) - (incTime * (i - half)); + enemyFormation[j].init[i].x = x3_100 - ((i - half) * incX); + enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; + enemyFormation[j].init[i].creationCounter = (creationTime) - (incTime * (i - half)); } - mEnemyFormation[j].init[i].y = y3; - mEnemyFormation[j].init[i].kind = BALLOON_3; + enemyFormation[j].init[i].y = y3; + enemyFormation[j].init[i].kind = BALLOON_3; } // #23 - Diez enemigos BALLOON3. Hacia la derecha. Juntos. Simetricos j = 23; - mEnemyFormation[j].numberOfEnemies = 10; + enemyFormation[j].numberOfEnemies = 10; incX = BALLOON_WIDTH_3 + 1; incTime = 10; - for (int i = 0; i < mEnemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) { - Uint8 half = mEnemyFormation[j].numberOfEnemies / 2; + Uint8 half = enemyFormation[j].numberOfEnemies / 2; if (i < half) { - mEnemyFormation[j].init[i].x = x3_0 + (i * incX); - mEnemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; - mEnemyFormation[j].init[i].creationCounter = (creationTime) - (incTime * i); + enemyFormation[j].init[i].x = x3_0 + (i * incX); + enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; + enemyFormation[j].init[i].creationCounter = (creationTime) - (incTime * i); } else { - mEnemyFormation[j].init[i].x = x3_100 - ((i - half) * incX); - mEnemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; - mEnemyFormation[j].init[i].creationCounter = (creationTime) - (incTime * (i - half)); + enemyFormation[j].init[i].x = x3_100 - ((i - half) * incX); + enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; + enemyFormation[j].init[i].creationCounter = (creationTime) - (incTime * (i - half)); } - mEnemyFormation[j].init[i].y = y3; - mEnemyFormation[j].init[i].kind = BALLOON_3; + enemyFormation[j].init[i].y = y3; + enemyFormation[j].init[i].kind = BALLOON_3; } // #24 - Treinta enemigos BALLOON1. Del centro hacia los extremos. Juntos. Simetricos j = 24; - mEnemyFormation[j].numberOfEnemies = 30; + enemyFormation[j].numberOfEnemies = 30; incX = 0; incTime = 5; - for (int i = 0; i < mEnemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) { - Uint8 half = mEnemyFormation[j].numberOfEnemies / 2; + Uint8 half = enemyFormation[j].numberOfEnemies / 2; if (i < half) { - mEnemyFormation[j].init[i].x = x1_50; - mEnemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; - mEnemyFormation[j].init[i].creationCounter = (creationTime) + (incTime * i); + enemyFormation[j].init[i].x = x1_50; + enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; + enemyFormation[j].init[i].creationCounter = (creationTime) + (incTime * i); } else { - mEnemyFormation[j].init[i].x = x1_50; - mEnemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; - mEnemyFormation[j].init[i].creationCounter = (creationTime) + (incTime * (i - half)); + enemyFormation[j].init[i].x = x1_50; + enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; + enemyFormation[j].init[i].creationCounter = (creationTime) + (incTime * (i - half)); } - mEnemyFormation[j].init[i].y = y1; - mEnemyFormation[j].init[i].kind = BALLOON_1; + enemyFormation[j].init[i].y = y1; + enemyFormation[j].init[i].kind = BALLOON_1; } // #25 - Treinta enemigos BALLOON1. Del centro hacia adentro. Juntos. Simetricos j = 25; - mEnemyFormation[j].numberOfEnemies = 30; + enemyFormation[j].numberOfEnemies = 30; incX = BALLOON_WIDTH_1 + 1; incTime = 5; - for (int i = 0; i < mEnemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) { - Uint8 half = mEnemyFormation[j].numberOfEnemies / 2; + Uint8 half = enemyFormation[j].numberOfEnemies / 2; if (i < half) { - mEnemyFormation[j].init[i].x = x1_50 + 20; - mEnemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; - mEnemyFormation[j].init[i].creationCounter = (creationTime) - (incTime * i); + enemyFormation[j].init[i].x = x1_50 + 20; + enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; + enemyFormation[j].init[i].creationCounter = (creationTime) - (incTime * i); } else { - mEnemyFormation[j].init[i].x = x1_50 - 20; - mEnemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; - mEnemyFormation[j].init[i].creationCounter = (creationTime) - (incTime * (i - half)); + enemyFormation[j].init[i].x = x1_50 - 20; + enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; + enemyFormation[j].init[i].creationCounter = (creationTime) - (incTime * (i - half)); } - mEnemyFormation[j].init[i].y = y1; - mEnemyFormation[j].init[i].kind = BALLOON_1; + enemyFormation[j].init[i].y = y1; + enemyFormation[j].init[i].kind = BALLOON_1; } // Crea las mismas formaciones pero con hexagonos a partir de la posición 50 del vector for (int k = 0; k < j + 1; k++) { - mEnemyFormation[k + 50].numberOfEnemies = mEnemyFormation[k].numberOfEnemies; - for (int i = 0; i < mEnemyFormation[k + 50].numberOfEnemies; i++) + enemyFormation[k + 50].numberOfEnemies = enemyFormation[k].numberOfEnemies; + for (int i = 0; i < enemyFormation[k + 50].numberOfEnemies; i++) { - mEnemyFormation[k + 50].init[i].x = mEnemyFormation[k].init[i].x; - mEnemyFormation[k + 50].init[i].y = mEnemyFormation[k].init[i].y; - mEnemyFormation[k + 50].init[i].velX = mEnemyFormation[k].init[i].velX; - mEnemyFormation[k + 50].init[i].creationCounter = mEnemyFormation[k].init[i].creationCounter; - mEnemyFormation[k + 50].init[i].kind = mEnemyFormation[k].init[i].kind + 4; + enemyFormation[k + 50].init[i].x = enemyFormation[k].init[i].x; + enemyFormation[k + 50].init[i].y = enemyFormation[k].init[i].y; + enemyFormation[k + 50].init[i].velX = enemyFormation[k].init[i].velX; + enemyFormation[k + 50].init[i].creationCounter = enemyFormation[k].init[i].creationCounter; + enemyFormation[k + 50].init[i].kind = enemyFormation[k].init[i].kind + 4; } } // TEST - mEnemyFormation[99].numberOfEnemies = 4; + enemyFormation[99].numberOfEnemies = 4; - mEnemyFormation[99].init[0].x = 10; - mEnemyFormation[99].init[0].y = y1; - mEnemyFormation[99].init[0].velX = 0; - mEnemyFormation[99].init[0].kind = BALLOON_1; - mEnemyFormation[99].init[0].creationCounter = 200; + enemyFormation[99].init[0].x = 10; + enemyFormation[99].init[0].y = y1; + enemyFormation[99].init[0].velX = 0; + enemyFormation[99].init[0].kind = BALLOON_1; + enemyFormation[99].init[0].creationCounter = 200; - mEnemyFormation[99].init[1].x = 50; - mEnemyFormation[99].init[1].y = y1; - mEnemyFormation[99].init[1].velX = 0; - mEnemyFormation[99].init[1].kind = BALLOON_2; - mEnemyFormation[99].init[1].creationCounter = 200; + enemyFormation[99].init[1].x = 50; + enemyFormation[99].init[1].y = y1; + enemyFormation[99].init[1].velX = 0; + enemyFormation[99].init[1].kind = BALLOON_2; + enemyFormation[99].init[1].creationCounter = 200; - mEnemyFormation[99].init[2].x = 90; - mEnemyFormation[99].init[2].y = y1; - mEnemyFormation[99].init[2].velX = 0; - mEnemyFormation[99].init[2].kind = BALLOON_3; - mEnemyFormation[99].init[2].creationCounter = 200; + enemyFormation[99].init[2].x = 90; + enemyFormation[99].init[2].y = y1; + enemyFormation[99].init[2].velX = 0; + enemyFormation[99].init[2].kind = BALLOON_3; + enemyFormation[99].init[2].creationCounter = 200; - mEnemyFormation[99].init[3].x = 140; - mEnemyFormation[99].init[3].y = y1; - mEnemyFormation[99].init[3].velX = 0; - mEnemyFormation[99].init[3].kind = BALLOON_4; - mEnemyFormation[99].init[3].creationCounter = 200; + enemyFormation[99].init[3].x = 140; + enemyFormation[99].init[3].y = y1; + enemyFormation[99].init[3].velX = 0; + enemyFormation[99].init[3].kind = BALLOON_4; + enemyFormation[99].init[3].creationCounter = 200; } // Inicializa los conjuntos de formaciones void Game::initEnemyPools() { // EnemyPool #0 - mEnemyPool[0].set[0] = &mEnemyFormation[0]; - mEnemyPool[0].set[1] = &mEnemyFormation[1]; - mEnemyPool[0].set[2] = &mEnemyFormation[2]; - mEnemyPool[0].set[3] = &mEnemyFormation[3]; - mEnemyPool[0].set[4] = &mEnemyFormation[4]; - mEnemyPool[0].set[5] = &mEnemyFormation[5]; - mEnemyPool[0].set[6] = &mEnemyFormation[6]; - mEnemyPool[0].set[7] = &mEnemyFormation[7]; - mEnemyPool[0].set[8] = &mEnemyFormation[8]; - mEnemyPool[0].set[9] = &mEnemyFormation[9]; + enemyPool[0].set[0] = &enemyFormation[0]; + enemyPool[0].set[1] = &enemyFormation[1]; + enemyPool[0].set[2] = &enemyFormation[2]; + enemyPool[0].set[3] = &enemyFormation[3]; + enemyPool[0].set[4] = &enemyFormation[4]; + enemyPool[0].set[5] = &enemyFormation[5]; + enemyPool[0].set[6] = &enemyFormation[6]; + enemyPool[0].set[7] = &enemyFormation[7]; + enemyPool[0].set[8] = &enemyFormation[8]; + enemyPool[0].set[9] = &enemyFormation[9]; // EnemyPool #1 - mEnemyPool[1].set[0] = &mEnemyFormation[10]; - mEnemyPool[1].set[1] = &mEnemyFormation[11]; - mEnemyPool[1].set[2] = &mEnemyFormation[12]; - mEnemyPool[1].set[3] = &mEnemyFormation[13]; - mEnemyPool[1].set[4] = &mEnemyFormation[14]; - mEnemyPool[1].set[5] = &mEnemyFormation[15]; - mEnemyPool[1].set[6] = &mEnemyFormation[16]; - mEnemyPool[1].set[7] = &mEnemyFormation[17]; - mEnemyPool[1].set[8] = &mEnemyFormation[18]; - mEnemyPool[1].set[9] = &mEnemyFormation[19]; + enemyPool[1].set[0] = &enemyFormation[10]; + enemyPool[1].set[1] = &enemyFormation[11]; + enemyPool[1].set[2] = &enemyFormation[12]; + enemyPool[1].set[3] = &enemyFormation[13]; + enemyPool[1].set[4] = &enemyFormation[14]; + enemyPool[1].set[5] = &enemyFormation[15]; + enemyPool[1].set[6] = &enemyFormation[16]; + enemyPool[1].set[7] = &enemyFormation[17]; + enemyPool[1].set[8] = &enemyFormation[18]; + enemyPool[1].set[9] = &enemyFormation[19]; // EnemyPool #2 - mEnemyPool[2].set[0] = &mEnemyFormation[0]; - mEnemyPool[2].set[1] = &mEnemyFormation[1]; - mEnemyPool[2].set[2] = &mEnemyFormation[2]; - mEnemyPool[2].set[3] = &mEnemyFormation[3]; - mEnemyPool[2].set[4] = &mEnemyFormation[4]; - mEnemyPool[2].set[5] = &mEnemyFormation[55]; - mEnemyPool[2].set[6] = &mEnemyFormation[56]; - mEnemyPool[2].set[7] = &mEnemyFormation[57]; - mEnemyPool[2].set[8] = &mEnemyFormation[58]; - mEnemyPool[2].set[9] = &mEnemyFormation[59]; + enemyPool[2].set[0] = &enemyFormation[0]; + enemyPool[2].set[1] = &enemyFormation[1]; + enemyPool[2].set[2] = &enemyFormation[2]; + enemyPool[2].set[3] = &enemyFormation[3]; + enemyPool[2].set[4] = &enemyFormation[4]; + enemyPool[2].set[5] = &enemyFormation[55]; + enemyPool[2].set[6] = &enemyFormation[56]; + enemyPool[2].set[7] = &enemyFormation[57]; + enemyPool[2].set[8] = &enemyFormation[58]; + enemyPool[2].set[9] = &enemyFormation[59]; // EnemyPool #3 - mEnemyPool[3].set[0] = &mEnemyFormation[50]; - mEnemyPool[3].set[1] = &mEnemyFormation[51]; - mEnemyPool[3].set[2] = &mEnemyFormation[52]; - mEnemyPool[3].set[3] = &mEnemyFormation[53]; - mEnemyPool[3].set[4] = &mEnemyFormation[54]; - mEnemyPool[3].set[5] = &mEnemyFormation[5]; - mEnemyPool[3].set[6] = &mEnemyFormation[6]; - mEnemyPool[3].set[7] = &mEnemyFormation[7]; - mEnemyPool[3].set[8] = &mEnemyFormation[8]; - mEnemyPool[3].set[9] = &mEnemyFormation[9]; + enemyPool[3].set[0] = &enemyFormation[50]; + enemyPool[3].set[1] = &enemyFormation[51]; + enemyPool[3].set[2] = &enemyFormation[52]; + enemyPool[3].set[3] = &enemyFormation[53]; + enemyPool[3].set[4] = &enemyFormation[54]; + enemyPool[3].set[5] = &enemyFormation[5]; + enemyPool[3].set[6] = &enemyFormation[6]; + enemyPool[3].set[7] = &enemyFormation[7]; + enemyPool[3].set[8] = &enemyFormation[8]; + enemyPool[3].set[9] = &enemyFormation[9]; // EnemyPool #4 - mEnemyPool[4].set[0] = &mEnemyFormation[60]; - mEnemyPool[4].set[1] = &mEnemyFormation[61]; - mEnemyPool[4].set[2] = &mEnemyFormation[62]; - mEnemyPool[4].set[3] = &mEnemyFormation[63]; - mEnemyPool[4].set[4] = &mEnemyFormation[64]; - mEnemyPool[4].set[5] = &mEnemyFormation[65]; - mEnemyPool[4].set[6] = &mEnemyFormation[66]; - mEnemyPool[4].set[7] = &mEnemyFormation[67]; - mEnemyPool[4].set[8] = &mEnemyFormation[68]; - mEnemyPool[4].set[9] = &mEnemyFormation[69]; + enemyPool[4].set[0] = &enemyFormation[60]; + enemyPool[4].set[1] = &enemyFormation[61]; + enemyPool[4].set[2] = &enemyFormation[62]; + enemyPool[4].set[3] = &enemyFormation[63]; + enemyPool[4].set[4] = &enemyFormation[64]; + enemyPool[4].set[5] = &enemyFormation[65]; + enemyPool[4].set[6] = &enemyFormation[66]; + enemyPool[4].set[7] = &enemyFormation[67]; + enemyPool[4].set[8] = &enemyFormation[68]; + enemyPool[4].set[9] = &enemyFormation[69]; // EnemyPool #5 - mEnemyPool[5].set[0] = &mEnemyFormation[10]; - mEnemyPool[5].set[1] = &mEnemyFormation[61]; - mEnemyPool[5].set[2] = &mEnemyFormation[12]; - mEnemyPool[5].set[3] = &mEnemyFormation[63]; - mEnemyPool[5].set[4] = &mEnemyFormation[14]; - mEnemyPool[5].set[5] = &mEnemyFormation[65]; - mEnemyPool[5].set[6] = &mEnemyFormation[16]; - mEnemyPool[5].set[7] = &mEnemyFormation[67]; - mEnemyPool[5].set[8] = &mEnemyFormation[18]; - mEnemyPool[5].set[9] = &mEnemyFormation[69]; + enemyPool[5].set[0] = &enemyFormation[10]; + enemyPool[5].set[1] = &enemyFormation[61]; + enemyPool[5].set[2] = &enemyFormation[12]; + enemyPool[5].set[3] = &enemyFormation[63]; + enemyPool[5].set[4] = &enemyFormation[14]; + enemyPool[5].set[5] = &enemyFormation[65]; + enemyPool[5].set[6] = &enemyFormation[16]; + enemyPool[5].set[7] = &enemyFormation[67]; + enemyPool[5].set[8] = &enemyFormation[18]; + enemyPool[5].set[9] = &enemyFormation[69]; // EnemyPool #6 - mEnemyPool[6].set[0] = &mEnemyFormation[60]; - mEnemyPool[6].set[1] = &mEnemyFormation[11]; - mEnemyPool[6].set[2] = &mEnemyFormation[62]; - mEnemyPool[6].set[3] = &mEnemyFormation[13]; - mEnemyPool[6].set[4] = &mEnemyFormation[64]; - mEnemyPool[6].set[5] = &mEnemyFormation[15]; - mEnemyPool[6].set[6] = &mEnemyFormation[66]; - mEnemyPool[6].set[7] = &mEnemyFormation[17]; - mEnemyPool[6].set[8] = &mEnemyFormation[68]; - mEnemyPool[6].set[9] = &mEnemyFormation[19]; + enemyPool[6].set[0] = &enemyFormation[60]; + enemyPool[6].set[1] = &enemyFormation[11]; + enemyPool[6].set[2] = &enemyFormation[62]; + enemyPool[6].set[3] = &enemyFormation[13]; + enemyPool[6].set[4] = &enemyFormation[64]; + enemyPool[6].set[5] = &enemyFormation[15]; + enemyPool[6].set[6] = &enemyFormation[66]; + enemyPool[6].set[7] = &enemyFormation[17]; + enemyPool[6].set[8] = &enemyFormation[68]; + enemyPool[6].set[9] = &enemyFormation[19]; // EnemyPool #7 - mEnemyPool[7].set[0] = &mEnemyFormation[20]; - mEnemyPool[7].set[1] = &mEnemyFormation[21]; - mEnemyPool[7].set[2] = &mEnemyFormation[22]; - mEnemyPool[7].set[3] = &mEnemyFormation[23]; - mEnemyPool[7].set[4] = &mEnemyFormation[24]; - mEnemyPool[7].set[5] = &mEnemyFormation[65]; - mEnemyPool[7].set[6] = &mEnemyFormation[66]; - mEnemyPool[7].set[7] = &mEnemyFormation[67]; - mEnemyPool[7].set[8] = &mEnemyFormation[68]; - mEnemyPool[7].set[9] = &mEnemyFormation[69]; + enemyPool[7].set[0] = &enemyFormation[20]; + enemyPool[7].set[1] = &enemyFormation[21]; + enemyPool[7].set[2] = &enemyFormation[22]; + enemyPool[7].set[3] = &enemyFormation[23]; + enemyPool[7].set[4] = &enemyFormation[24]; + enemyPool[7].set[5] = &enemyFormation[65]; + enemyPool[7].set[6] = &enemyFormation[66]; + enemyPool[7].set[7] = &enemyFormation[67]; + enemyPool[7].set[8] = &enemyFormation[68]; + enemyPool[7].set[9] = &enemyFormation[69]; // EnemyPool #8 - mEnemyPool[8].set[0] = &mEnemyFormation[70]; - mEnemyPool[8].set[1] = &mEnemyFormation[71]; - mEnemyPool[8].set[2] = &mEnemyFormation[72]; - mEnemyPool[8].set[3] = &mEnemyFormation[73]; - mEnemyPool[8].set[4] = &mEnemyFormation[74]; - mEnemyPool[8].set[5] = &mEnemyFormation[15]; - mEnemyPool[8].set[6] = &mEnemyFormation[16]; - mEnemyPool[8].set[7] = &mEnemyFormation[17]; - mEnemyPool[8].set[8] = &mEnemyFormation[18]; - mEnemyPool[8].set[9] = &mEnemyFormation[19]; + enemyPool[8].set[0] = &enemyFormation[70]; + enemyPool[8].set[1] = &enemyFormation[71]; + enemyPool[8].set[2] = &enemyFormation[72]; + enemyPool[8].set[3] = &enemyFormation[73]; + enemyPool[8].set[4] = &enemyFormation[74]; + enemyPool[8].set[5] = &enemyFormation[15]; + enemyPool[8].set[6] = &enemyFormation[16]; + enemyPool[8].set[7] = &enemyFormation[17]; + enemyPool[8].set[8] = &enemyFormation[18]; + enemyPool[8].set[9] = &enemyFormation[19]; // EnemyPool #9 - mEnemyPool[9].set[0] = &mEnemyFormation[20]; - mEnemyPool[9].set[1] = &mEnemyFormation[21]; - mEnemyPool[9].set[2] = &mEnemyFormation[22]; - mEnemyPool[9].set[3] = &mEnemyFormation[23]; - mEnemyPool[9].set[4] = &mEnemyFormation[24]; - mEnemyPool[9].set[5] = &mEnemyFormation[70]; - mEnemyPool[9].set[6] = &mEnemyFormation[71]; - mEnemyPool[9].set[7] = &mEnemyFormation[72]; - mEnemyPool[9].set[8] = &mEnemyFormation[73]; - mEnemyPool[9].set[9] = &mEnemyFormation[74]; + enemyPool[9].set[0] = &enemyFormation[20]; + enemyPool[9].set[1] = &enemyFormation[21]; + enemyPool[9].set[2] = &enemyFormation[22]; + enemyPool[9].set[3] = &enemyFormation[23]; + enemyPool[9].set[4] = &enemyFormation[24]; + enemyPool[9].set[5] = &enemyFormation[70]; + enemyPool[9].set[6] = &enemyFormation[71]; + enemyPool[9].set[7] = &enemyFormation[72]; + enemyPool[9].set[8] = &enemyFormation[73]; + enemyPool[9].set[9] = &enemyFormation[74]; } // Inicializa las fases del juego void Game::initGameStages() { // STAGE 1 - mStage[0].number = 1; - mStage[0].currentPower = 0; - mStage[0].powerToComplete = 200; - mStage[0].minMenace = 7 + (4 * 1); - mStage[0].maxMenace = 7 + (4 * 3); - mStage[0].enemyPool = &mEnemyPool[0]; + stage[0].number = 1; + stage[0].currentPower = 0; + stage[0].powerToComplete = 200; + stage[0].minMenace = 7 + (4 * 1); + stage[0].maxMenace = 7 + (4 * 3); + stage[0].enemyPool = &enemyPool[0]; // STAGE 2 - mStage[1].number = 2; - mStage[1].currentPower = 0; - mStage[1].powerToComplete = 300; - mStage[1].minMenace = 7 + (4 * 2); - mStage[1].maxMenace = 7 + (4 * 4); - mStage[1].enemyPool = &mEnemyPool[1]; + stage[1].number = 2; + stage[1].currentPower = 0; + stage[1].powerToComplete = 300; + stage[1].minMenace = 7 + (4 * 2); + stage[1].maxMenace = 7 + (4 * 4); + stage[1].enemyPool = &enemyPool[1]; // STAGE 3 - mStage[2].number = 3; - mStage[2].currentPower = 0; - mStage[2].powerToComplete = 600; - mStage[2].minMenace = 7 + (4 * 3); - mStage[2].maxMenace = 7 + (4 * 5); - mStage[2].enemyPool = &mEnemyPool[2]; + stage[2].number = 3; + stage[2].currentPower = 0; + stage[2].powerToComplete = 600; + stage[2].minMenace = 7 + (4 * 3); + stage[2].maxMenace = 7 + (4 * 5); + stage[2].enemyPool = &enemyPool[2]; // STAGE 4 - mStage[3].number = 4; - mStage[3].currentPower = 0; - mStage[3].powerToComplete = 600; - mStage[3].minMenace = 7 + (4 * 3); - mStage[3].maxMenace = 7 + (4 * 5); - mStage[3].enemyPool = &mEnemyPool[3]; + stage[3].number = 4; + stage[3].currentPower = 0; + stage[3].powerToComplete = 600; + stage[3].minMenace = 7 + (4 * 3); + stage[3].maxMenace = 7 + (4 * 5); + stage[3].enemyPool = &enemyPool[3]; // STAGE 5 - mStage[4].number = 5; - mStage[4].currentPower = 0; - mStage[4].powerToComplete = 600; - mStage[4].minMenace = 7 + (4 * 4); - mStage[4].maxMenace = 7 + (4 * 6); - mStage[4].enemyPool = &mEnemyPool[4]; + stage[4].number = 5; + stage[4].currentPower = 0; + stage[4].powerToComplete = 600; + stage[4].minMenace = 7 + (4 * 4); + stage[4].maxMenace = 7 + (4 * 6); + stage[4].enemyPool = &enemyPool[4]; // STAGE 6 - mStage[5].number = 6; - mStage[5].currentPower = 0; - mStage[5].powerToComplete = 600; - mStage[5].minMenace = 7 + (4 * 4); - mStage[5].maxMenace = 7 + (4 * 6); - mStage[5].enemyPool = &mEnemyPool[5]; + stage[5].number = 6; + stage[5].currentPower = 0; + stage[5].powerToComplete = 600; + stage[5].minMenace = 7 + (4 * 4); + stage[5].maxMenace = 7 + (4 * 6); + stage[5].enemyPool = &enemyPool[5]; // STAGE 7 - mStage[6].number = 7; - mStage[6].currentPower = 0; - mStage[6].powerToComplete = 650; - mStage[6].minMenace = 7 + (4 * 5); - mStage[6].maxMenace = 7 + (4 * 7); - mStage[6].enemyPool = &mEnemyPool[6]; + stage[6].number = 7; + stage[6].currentPower = 0; + stage[6].powerToComplete = 650; + stage[6].minMenace = 7 + (4 * 5); + stage[6].maxMenace = 7 + (4 * 7); + stage[6].enemyPool = &enemyPool[6]; // STAGE 8 - mStage[7].number = 8; - mStage[7].currentPower = 0; - mStage[7].powerToComplete = 750; - mStage[7].minMenace = 7 + (4 * 5); - mStage[7].maxMenace = 7 + (4 * 7); - mStage[7].enemyPool = &mEnemyPool[7]; + stage[7].number = 8; + stage[7].currentPower = 0; + stage[7].powerToComplete = 750; + stage[7].minMenace = 7 + (4 * 5); + stage[7].maxMenace = 7 + (4 * 7); + stage[7].enemyPool = &enemyPool[7]; // STAGE 9 - mStage[8].number = 9; - mStage[8].currentPower = 0; - mStage[8].powerToComplete = 850; - mStage[8].minMenace = 7 + (4 * 6); - mStage[8].maxMenace = 7 + (4 * 8); - mStage[8].enemyPool = &mEnemyPool[8]; + stage[8].number = 9; + stage[8].currentPower = 0; + stage[8].powerToComplete = 850; + stage[8].minMenace = 7 + (4 * 6); + stage[8].maxMenace = 7 + (4 * 8); + stage[8].enemyPool = &enemyPool[8]; // STAGE 10 - mStage[9].number = 10; - mStage[9].currentPower = 0; - mStage[9].powerToComplete = 950; - mStage[9].minMenace = 7 + (4 * 7); - mStage[9].maxMenace = 7 + (4 * 10); - mStage[9].enemyPool = &mEnemyPool[9]; + stage[9].number = 10; + stage[9].currentPower = 0; + stage[9].powerToComplete = 950; + stage[9].minMenace = 7 + (4 * 7); + stage[9].maxMenace = 7 + (4 * 10); + stage[9].enemyPool = &enemyPool[9]; } // Crea una formación de enemigos void Game::deployEnemyFormation() { // Solo despliega una formación enemiga si ha pasado cierto tiempo desde la última - if (mEnemyDeployCounter == 0) + if (enemyDeployCounter == 0) { // En este punto se decide entre crear una powerball o una formación enemiga @@ -1302,34 +1290,34 @@ void Game::deployEnemyFormation() createPowerBall(); // Da un poco de margen para que se creen mas enemigos - mEnemyDeployCounter = 50; + enemyDeployCounter = 50; } else { // Decrementa el contador de despliegues enemigos de la PowerBall - mPowerBallCounter > 0 ? mPowerBallCounter-- : mPowerBallCounter = 0; + powerBallCounter > 0 ? powerBallCounter-- : powerBallCounter = 0; // Elige una formación enemiga la azar Uint8 set = (rand() % 10); // Evita repetir la ultima formación enemiga desplegada - if (set == mLastEnemyDeploy) + if (set == lastEnemyDeploy) ++set %= 10; - mLastEnemyDeploy = set; + lastEnemyDeploy = set; - const Uint8 numEnemies = mStage[mCurrentStage].enemyPool->set[set]->numberOfEnemies; + const Uint8 numEnemies = stage[currentStage].enemyPool->set[set]->numberOfEnemies; for (int i = 0; i < numEnemies; ++i) { - createBalloon(mStage[mCurrentStage].enemyPool->set[set]->init[i].x, - mStage[mCurrentStage].enemyPool->set[set]->init[i].y, - mStage[mCurrentStage].enemyPool->set[set]->init[i].kind, - mStage[mCurrentStage].enemyPool->set[set]->init[i].velX, - mEnemySpeed, - mStage[mCurrentStage].enemyPool->set[set]->init[i].creationCounter); + createBalloon(stage[currentStage].enemyPool->set[set]->init[i].x, + stage[currentStage].enemyPool->set[set]->init[i].y, + stage[currentStage].enemyPool->set[set]->init[i].kind, + stage[currentStage].enemyPool->set[set]->init[i].velX, + enemySpeed, + stage[currentStage].enemyPool->set[set]->init[i].creationCounter); } - mEnemyDeployCounter = 300; + enemyDeployCounter = 300; } } } @@ -1337,34 +1325,34 @@ void Game::deployEnemyFormation() // Aumenta el poder de la fase void Game::increaseStageCurrentPower(Uint8 power) { - mStage[mCurrentStage].currentPower += power; + stage[currentStage].currentPower += power; } // Establece el valor de la variable void Game::setHiScore(Uint32 score) { - mHiScore = score; + hiScore = score; } -// Actualiza el valor de mHiScore en caso necesario +// Actualiza el valor de hiScore en caso necesario void Game::updateHiScore() { // Si la puntuación actual es mayor que la máxima puntuación for (auto player : players) - // for (int i = 0; i < mNumPlayers; i++) - if (player->getScore() > mHiScore) + // for (int i = 0; i < numPlayers; i++) + if (player->getScore() > hiScore) { // Actualiza la máxima puntuación - mHiScore = player->getScore(); + hiScore = player->getScore(); // Almacena la máxima puntuación en el fichero junto con un checksum - mScoreDataFile[0] = mHiScore; - mScoreDataFile[1] = mHiScore % 43; + scoreDataFile[0] = hiScore; + scoreDataFile[1] = hiScore % 43; // Si se supera la máxima puntuación emite sonido - if (mHiScoreAchieved == false) + if (hiScoreAchieved == false) { - mHiScoreAchieved = true; + hiScoreAchieved = true; JA_PlaySound(hiScoreSound); } } @@ -1440,7 +1428,7 @@ void Game::renderScoreBoard() textScoreBoard->writeCentered(offsetLeft, offset3, lang->getText(55)); textScoreBoard->writeCentered(offsetLeft, offset4, std::to_string(players.at(0)->getScoreMultiplier()).substr(0, 3)); - if (mNumPlayers == 2) + if (numPlayers == 2) { // PLAYER2 - SCORE textScoreBoard->writeCentered(offsetRight, offset1, lang->getText(54)); @@ -1462,19 +1450,19 @@ void Game::renderScoreBoard() } // STAGE - textScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset1, lang->getText(57) + std::to_string(mStage[mCurrentStage].number)); + textScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset1, lang->getText(57) + std::to_string(stage[currentStage].number)); // POWERMETER powerMeterSprite->setPosY(offset2); powerMeterSprite->setSpriteClip(0, 0, 40, 7); powerMeterSprite->render(); - const float percent = (mStage[mCurrentStage].currentPower * 40.0f) / mStage[mCurrentStage].powerToComplete; + const float percent = (stage[currentStage].currentPower * 40.0f) / stage[currentStage].powerToComplete; powerMeterSprite->setSpriteClip(0, 0, (int)percent, 7); powerMeterSprite->render(); // HI-SCORE textScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset3, lang->getText(56)); - textScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset4, updateScoreText(mHiScore)); + textScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset4, updateScoreText(hiScore)); } // Actualiza las variables del jugador @@ -1489,9 +1477,9 @@ void Game::updatePlayers() { if (player->isAlive()) { - if (mDemo.enabled) + if (demo.enabled) { - mSection = {PROG_SECTION_TITLE, TITLE_SECTION_INSTRUCTIONS}; + section = {PROG_SECTION_TITLE, TITLE_SECTION_INSTRUCTIONS}; } else { @@ -1517,21 +1505,21 @@ void Game::renderPlayers() // Actualiza las variables de la fase void Game::updateStage() { - if (mStage[mCurrentStage].currentPower >= mStage[mCurrentStage].powerToComplete) + if (stage[currentStage].currentPower >= stage[currentStage].powerToComplete) { // Cambio de fase - mCurrentStage++; - mLastStageReached = mCurrentStage; - if (mCurrentStage == 10) - { // Ha llegado al final el juego - mGameCompleted = true; // Marca el juego como completado - mCurrentStage = 9; // Deja el valor dentro de los limites - mStage[mCurrentStage].currentPower = 0; // Deja el poder a cero para que no vuelva a entrar en esta condición - destroyAllBalloons(); // Destruye a todos los enemigos - mStage[mCurrentStage].currentPower = 0; // Vuelve a dejar el poder a cero, por lo que hubiera podido subir al destruir todos lo globos - mMenaceCurrent = 255; // Sube el nivel de amenaza para que no cree mas globos + currentStage++; + lastStageReached = currentStage; + if (currentStage == 10) + { // Ha llegado al final el juego + gameCompleted = true; // Marca el juego como completado + currentStage = 9; // Deja el valor dentro de los limites + stage[currentStage].currentPower = 0; // Deja el poder a cero para que no vuelva a entrar en esta condición + destroyAllBalloons(); // Destruye a todos los enemigos + stage[currentStage].currentPower = 0; // Vuelve a dejar el poder a cero, por lo que hubiera podido subir al destruir todos lo globos + menaceCurrent = 255; // Sube el nivel de amenaza para que no cree mas globos for (auto player : players) - // for (int i = 0; i < mNumPlayers; i++) // Añade un millon de puntos a los jugadores que queden vivos + // for (int i = 0; i < numPlayers; i++) // Añade un millon de puntos a los jugadores que queden vivos { if (player->isAlive()) { @@ -1542,25 +1530,25 @@ void Game::updateStage() JA_StopMusic(); } JA_PlaySound(stageChangeSound); - mStageBitmapCounter = 0; - mEnemySpeed = mDefaultEnemySpeed; - setBalloonSpeed(mEnemySpeed); - mEffect.flash = true; - mEffect.shake = true; + stageBitmapCounter = 0; + enemySpeed = defaultEnemySpeed; + setBalloonSpeed(enemySpeed); + effect.flash = true; + effect.shake = true; } // Incrementa el contador del bitmap que aparece mostrando el cambio de fase - if (mStageBitmapCounter < STAGE_COUNTER) + if (stageBitmapCounter < STAGE_COUNTER) { - mStageBitmapCounter++; + stageBitmapCounter++; } // Si el juego se ha completado, el bitmap se detiene en el centro de la pantalla - if (mGameCompleted) + if (gameCompleted) { - if (mStageBitmapCounter > 100) + if (stageBitmapCounter > 100) { - mStageBitmapCounter = 100; + stageBitmapCounter = 100; } } } @@ -1571,7 +1559,7 @@ void Game::updateDeath() // Comprueba si todos los jugadores estan muertos bool allAreDead = true; for (auto player : players) - // for (int i = 0; i < mNumPlayers; i++) + // for (int i = 0; i < numPlayers; i++) { allAreDead &= (!player->isAlive()); @@ -1619,10 +1607,10 @@ void Game::updateDeath() if (allAreDead) { - if (mDeathCounter > 0) + if (deathCounter > 0) { - mDeathCounter--; - if ((mDeathCounter == 250) || (mDeathCounter == 200) || (mDeathCounter == 180) || (mDeathCounter == 120) || (mDeathCounter == 60)) + deathCounter--; + if ((deathCounter == 250) || (deathCounter == 200) || (deathCounter == 180) || (deathCounter == 120) || (deathCounter == 60)) { const Uint8 sound = rand() % 4; switch (sound) @@ -1647,7 +1635,7 @@ void Game::updateDeath() } else { - mSection.subsection = GAME_SECTION_GAMEOVER; + section.subsection = GAME_SECTION_GAMEOVER; } } } @@ -1721,11 +1709,11 @@ void Game::createPowerBall() const int x[3] = {left, center, right}; const float vx[3] = {BALLOON_VELX_POSITIVE, BALLOON_VELX_POSITIVE, BALLOON_VELX_NEGATIVE}; - Balloon *b = new Balloon(x[luck], posY, POWER_BALL, vx[luck], mEnemySpeed, 100, balloon4Texture, balloon4Animation, renderer); + Balloon *b = new Balloon(x[luck], posY, POWER_BALL, vx[luck], enemySpeed, 100, balloon4Texture, balloon4Animation, renderer); balloons.push_back(b); - mPowerBallEnabled = true; - mPowerBallCounter = POWERBALL_COUNTER; + powerBallEnabled = true; + powerBallCounter = POWERBALL_COUNTER; } // Establece la velocidad de los globos @@ -1746,18 +1734,18 @@ void Game::setBalloonSpeed(float speed) void Game::incBalloonSpeed() { // La velocidad solo se incrementa en el modo normal - if (mDifficulty == DIFFICULTY_NORMAL) + if (difficulty == DIFFICULTY_NORMAL) { - if (mEnemySpeed == BALLOON_SPEED_1) - mEnemySpeed = BALLOON_SPEED_2; - else if (mEnemySpeed == BALLOON_SPEED_2) - mEnemySpeed = BALLOON_SPEED_3; - else if (mEnemySpeed == BALLOON_SPEED_3) - mEnemySpeed = BALLOON_SPEED_4; - else if (mEnemySpeed == BALLOON_SPEED_4) - mEnemySpeed = BALLOON_SPEED_5; + if (enemySpeed == BALLOON_SPEED_1) + enemySpeed = BALLOON_SPEED_2; + else if (enemySpeed == BALLOON_SPEED_2) + enemySpeed = BALLOON_SPEED_3; + else if (enemySpeed == BALLOON_SPEED_3) + enemySpeed = BALLOON_SPEED_4; + else if (enemySpeed == BALLOON_SPEED_4) + enemySpeed = BALLOON_SPEED_5; - setBalloonSpeed(mEnemySpeed); + setBalloonSpeed(enemySpeed); } } @@ -1765,26 +1753,26 @@ void Game::incBalloonSpeed() void Game::decBalloonSpeed() { // La velocidad solo se decrementa en el modo normal - if (mDifficulty == DIFFICULTY_NORMAL) + if (difficulty == DIFFICULTY_NORMAL) { - if (mEnemySpeed == BALLOON_SPEED_5) - mEnemySpeed = BALLOON_SPEED_4; - else if (mEnemySpeed == BALLOON_SPEED_4) - mEnemySpeed = BALLOON_SPEED_3; - else if (mEnemySpeed == BALLOON_SPEED_3) - mEnemySpeed = BALLOON_SPEED_2; - else if (mEnemySpeed == BALLOON_SPEED_2) - mEnemySpeed = BALLOON_SPEED_1; + if (enemySpeed == BALLOON_SPEED_5) + enemySpeed = BALLOON_SPEED_4; + else if (enemySpeed == BALLOON_SPEED_4) + enemySpeed = BALLOON_SPEED_3; + else if (enemySpeed == BALLOON_SPEED_3) + enemySpeed = BALLOON_SPEED_2; + else if (enemySpeed == BALLOON_SPEED_2) + enemySpeed = BALLOON_SPEED_1; - setBalloonSpeed(mEnemySpeed); + setBalloonSpeed(enemySpeed); } } // Actualiza la velocidad de los globos en funcion del poder acumulado de la fase void Game::updateBalloonSpeed() { - const float percent = (float)mStage[mCurrentStage].currentPower / (float)mStage[mCurrentStage].powerToComplete; - if (mEnemySpeed == BALLOON_SPEED_1) + const float percent = (float)stage[currentStage].currentPower / (float)stage[currentStage].powerToComplete; + if (enemySpeed == BALLOON_SPEED_1) { if (percent > 0.2f) { @@ -1792,7 +1780,7 @@ void Game::updateBalloonSpeed() } } - else if (mEnemySpeed == BALLOON_SPEED_2) + else if (enemySpeed == BALLOON_SPEED_2) { if (percent > 0.4f) { @@ -1800,7 +1788,7 @@ void Game::updateBalloonSpeed() } } - else if (mEnemySpeed == BALLOON_SPEED_3) + else if (enemySpeed == BALLOON_SPEED_3) { if (percent > 0.6f) { @@ -1808,7 +1796,7 @@ void Game::updateBalloonSpeed() } } - else if (mEnemySpeed == BALLOON_SPEED_4) + else if (enemySpeed == BALLOON_SPEED_4) { if (percent > 0.8f) { @@ -1822,7 +1810,7 @@ void Game::popBalloon(Balloon *balloon) { // Aumenta el poder de la fase increaseStageCurrentPower(1); - mBalloonsPopped++; + balloonsPopped++; const Uint8 kind = balloon->getKind(); switch (kind) @@ -1839,13 +1827,13 @@ void Game::popBalloon(Balloon *balloon) // Si es del tipo PowerBall, destruye todos los globos case POWER_BALL: destroyAllBalloons(); - mPowerBallEnabled = false; - mEnemyDeployCounter = 20; + powerBallEnabled = false; + enemyDeployCounter = 20; break; // En cualquier otro caso, crea dos globos de un tipo inferior default: - const int index = createBalloon(0, balloon->getPosY(), balloon->getKind() - 1, BALLOON_VELX_NEGATIVE, mEnemySpeed, 0); + const int index = createBalloon(0, balloon->getPosY(), balloon->getKind() - 1, BALLOON_VELX_NEGATIVE, enemySpeed, 0); balloons.at(index)->allignTo(balloon->getPosX() + (balloon->getWidth() / 2)); if (balloons.at(index)->getClass() == BALLOON_CLASS) { @@ -1856,7 +1844,7 @@ void Game::popBalloon(Balloon *balloon) balloons.at(index)->setVelY(BALLOON_VELX_NEGATIVE); } - const int index2 = createBalloon(0, balloon->getPosY(), balloon->getKind() - 1, BALLOON_VELX_POSITIVE, mEnemySpeed, 0); + const int index2 = createBalloon(0, balloon->getPosY(), balloon->getKind() - 1, BALLOON_VELX_POSITIVE, enemySpeed, 0); balloons.at(index2)->allignTo(balloon->getPosX() + (balloon->getWidth() / 2)); if (balloons.at(index2)->getClass() == BALLOON_CLASS) { @@ -1914,13 +1902,13 @@ void Game::destroyBalloon(Balloon *balloon) // Otorga los puntos correspondientes al globo for (auto player : players) { - player->addScore(Uint32(score * player->getScoreMultiplier() * mDifficultyScoreMultiplier)); + player->addScore(Uint32(score * player->getScoreMultiplier() * difficultyScoreMultiplier)); } updateHiScore(); // Aumenta el poder de la fase increaseStageCurrentPower(power); - mBalloonsPopped += power; + balloonsPopped += power; // Destruye el globo balloon->pop(); @@ -1954,10 +1942,10 @@ void Game::destroyAllBalloons() } } - mEnemyDeployCounter = 255; + enemyDeployCounter = 255; JA_PlaySound(powerBallSound); - mEffect.flash = true; - mEffect.shake = true; + effect.flash = true; + effect.shake = true; } // Detiene todos los globos @@ -2146,7 +2134,7 @@ void Game::checkPlayerItemCollision(Player *player) case ITEM_COFFEE_MACHINE: player->setPowerUp(true); JA_PlaySound(itemPickUpSound); - mCoffeeMachineEnabled = false; + coffeeMachineEnabled = false; break; default: @@ -2173,14 +2161,14 @@ void Game::checkBulletBalloonCollision() // Otorga los puntos correspondientes al globo al jugador que disparó la bala int index = bullet->getOwner(); players.at(index)->incScoreMultiplier(); - players.at(index)->addScore(Uint32(balloon->getScore() * players.at(index)->getScoreMultiplier() * mDifficultyScoreMultiplier)); + players.at(index)->addScore(Uint32(balloon->getScore() * players.at(index)->getScoreMultiplier() * difficultyScoreMultiplier)); updateHiScore(); // Explota el globo popBalloon(balloon); // Si no es el modo demo, genera un sonido - if (!mDemo.enabled) + if (!demo.enabled) { JA_PlaySound(balloonSound); } @@ -2190,7 +2178,7 @@ void Game::checkBulletBalloonCollision() // Suelta el item en caso de que salga uno const Uint8 droppeditem = dropItem(); - if ((droppeditem != NO_KIND) && !(mDemo.enabled) && !(mDemo.recording)) + if ((droppeditem != NO_KIND) && !(demo.enabled) && !(demo.recording)) { if (droppeditem != ITEM_COFFEE_MACHINE) { @@ -2200,7 +2188,7 @@ void Game::checkBulletBalloonCollision() else { createItem(droppeditem, players.at(index)->getPosX(), 0); - mCoffeeMachineEnabled = true; + coffeeMachineEnabled = true; } } @@ -2272,7 +2260,7 @@ void Game::updateItems() if (item->isOnFloor()) { JA_PlaySound(coffeeMachineSound); - mEffect.shake = true; + effect.shake = true; } } } @@ -2296,62 +2284,62 @@ Uint8 Game::dropItem() switch (item) { case 0: - if (luckyNumber < mHelper.itemPoints1Odds) + if (luckyNumber < helper.itemPoints1Odds) { return ITEM_POINTS_1_DISK; } break; case 1: - if (luckyNumber < mHelper.itemPoints2Odds) + if (luckyNumber < helper.itemPoints2Odds) { return ITEM_POINTS_2_GAVINA; } break; case 2: - if (luckyNumber < mHelper.itemPoints3Odds) + if (luckyNumber < helper.itemPoints3Odds) { return ITEM_POINTS_3_PACMAR; } break; case 3: - if (luckyNumber < mHelper.itemClockOdds) + if (luckyNumber < helper.itemClockOdds) { return ITEM_CLOCK; } break; case 4: - if (luckyNumber < mHelper.itemCoffeeOdds) + if (luckyNumber < helper.itemCoffeeOdds) { - mHelper.itemCoffeeOdds = ITEM_COFFEE_ODDS; + helper.itemCoffeeOdds = ITEM_COFFEE_ODDS; return ITEM_COFFEE; } else { - if (mHelper.needCoffee) + if (helper.needCoffee) { - mHelper.itemCoffeeOdds++; + helper.itemCoffeeOdds++; } } break; case 5: - if (luckyNumber < mHelper.itemCoffeeMachineOdds) + if (luckyNumber < helper.itemCoffeeMachineOdds) { - mHelper.itemCoffeeMachineOdds = ITEM_COFFEE_MACHINE_ODDS; - if ((!mCoffeeMachineEnabled) && (mHelper.needCoffeeMachine)) + helper.itemCoffeeMachineOdds = ITEM_COFFEE_MACHINE_ODDS; + if ((!coffeeMachineEnabled) && (helper.needCoffeeMachine)) { return ITEM_COFFEE_MACHINE; } } else { - if (mHelper.needCoffeeMachine) + if (helper.needCoffeeMachine) { - mHelper.itemCoffeeMachineOdds++; + helper.itemCoffeeMachineOdds++; } } break; @@ -2421,29 +2409,29 @@ void Game::freeSmartSprites() // Dibuja el efecto de flash void Game::renderFlashEffect() { - if (mEffect.flash) + if (effect.flash) { // Pantallazo blanco SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF); SDL_RenderClear(renderer); - mEffect.flash = false; + effect.flash = false; } } // Actualiza el efecto de agitar la pantalla void Game::updateShakeEffect() { - if (mEffect.shake) + if (effect.shake) { - if (mEffect.shakeCounter > 0) + if (effect.shakeCounter > 0) { - mEffect.shakeCounter--; + effect.shakeCounter--; } else { - mEffect.shake = false; - mEffect.shakeCounter = SHAKE_COUNTER; + effect.shake = false; + effect.shakeCounter = SHAKE_COUNTER; } } } @@ -2552,12 +2540,12 @@ void Game::killPlayer(Player *player) // Calcula y establece el valor de amenaza en funcion de los globos activos void Game::evaluateAndSetMenace() { - mMenaceCurrent = 0; + menaceCurrent = 0; for (auto balloon : balloons) { if (balloon->isEnabled()) { - mMenaceCurrent += balloon->getMenace(); + menaceCurrent += balloon->getMenace(); } } } @@ -2565,31 +2553,31 @@ void Game::evaluateAndSetMenace() // Obtiene el valor de la variable Uint8 Game::getMenace() { - return mMenaceCurrent; + return menaceCurrent; } // Establece el valor de la variable void Game::setTimeStopped(bool value) { - mTimeStopped = value; + timeStopped = value; } // Obtiene el valor de la variable bool Game::isTimeStopped() { - return mTimeStopped; + return timeStopped; } // Establece el valor de la variable void Game::setTimeStoppedCounter(Uint16 value) { - mTimeStoppedCounter = value; + timeStoppedCounter = value; } // Incrementa el valor de la variable void Game::incTimeStoppedCounter(Uint16 value) { - mTimeStoppedCounter += value; + timeStoppedCounter += value; } // Actualiza y comprueba el valor de la variable @@ -2597,9 +2585,9 @@ void Game::updateTimeStoppedCounter() { if (isTimeStopped()) { - if (mTimeStoppedCounter > 0) + if (timeStoppedCounter > 0) { - mTimeStoppedCounter--; + timeStoppedCounter--; stopAllBalloons(TIME_STOPPED_COUNTER); } else @@ -2609,12 +2597,12 @@ void Game::updateTimeStoppedCounter() } } -// Actualiza la variable mEnemyDeployCounter +// Actualiza la variable enemyDeployCounter void Game::updateEnemyDeployCounter() { - if (mEnemyDeployCounter > 0) + if (enemyDeployCounter > 0) { - mEnemyDeployCounter--; + enemyDeployCounter--; } } @@ -2625,13 +2613,13 @@ void Game::update() checkEventHandler(); // Comprueba que la diferencia de ticks sea mayor a la velocidad del juego - if (SDL_GetTicks() - mTicks > mTicksSpeed) + if (SDL_GetTicks() - ticks > ticksSpeed) { // Actualiza el contador de ticks - mTicks = SDL_GetTicks(); + ticks = SDL_GetTicks(); // Actualiza el contador de juego - mCounter++; + counter++; // Comprueba el teclado/mando checkGameInput(); @@ -2651,7 +2639,7 @@ void Game::update() // Actualiza los items updateItems(); - // Actualiza el valor de mCurrentStage + // Actualiza el valor de currentStage updateStage(); // Actualiza el estado de muerte @@ -2672,7 +2660,7 @@ void Game::update() checkBulletBalloonCollision(); // Comprueba el nivel de amenaza para ver si se han de crear nuevos enemigos - if (!mGameCompleted) + if (!gameCompleted) { updateMenace(); } @@ -2719,11 +2707,11 @@ void Game::updateBackground() clouds2B->setPosX(clouds2B->getWidth()); } - grassSprite->setSpriteClip(0, (6 * (mCounter / 20 % 2)), 256, 6); + grassSprite->setSpriteClip(0, (6 * (counter / 20 % 2)), 256, 6); - if (mEffect.shake) + if (effect.shake) { - buildingsSprite->setPosX(((mEffect.shakeCounter % 2) * 2) - 1); + buildingsSprite->setPosX(((effect.shakeCounter % 2) * 2) - 1); } else { @@ -2734,7 +2722,7 @@ void Game::updateBackground() // Dibuja el fondo void Game::renderBackground() { - const float gradientNumber = std::min(((float)mBalloonsPopped / 1000.0f), 3.0f); + const float gradientNumber = std::min(((float)balloonsPopped / 1000.0f), 3.0f); const float percent = gradientNumber - (int)gradientNumber; const int alpha = std::max((255 - (int)(255 * percent)), 0); @@ -2780,14 +2768,14 @@ void Game::render() renderScoreBoard(); renderPlayers(); - if ((mDeathCounter <= 150) && !players.at(0)->isAlive()) + if ((deathCounter <= 150) && !players.at(0)->isAlive()) { - renderDeathFade(150 - mDeathCounter); + renderDeathFade(150 - deathCounter); } - if ((mGameCompleted) && (mGameCompletedCounter >= 300)) + if ((gameCompleted) && (gameCompletedCounter >= 300)) { - renderDeathFade(mGameCompletedCounter - 300); + renderDeathFade(gameCompletedCounter - 300); } renderFlashEffect(); @@ -2799,14 +2787,14 @@ void Game::render() // Gestiona el nivel de amenaza void Game::updateMenace() { - const float percent = mStage[mCurrentStage].currentPower / mStage[mCurrentStage].powerToComplete; - const Uint8 difference = mStage[mCurrentStage].maxMenace - mStage[mCurrentStage].minMenace; + const float percent = stage[currentStage].currentPower / stage[currentStage].powerToComplete; + const Uint8 difference = stage[currentStage].maxMenace - stage[currentStage].minMenace; // Aumenta el nivel de amenaza en función de la puntuación - mMenaceThreshold = mStage[mCurrentStage].minMenace + (difference * percent); + menaceThreshold = stage[currentStage].minMenace + (difference * percent); // Si el nivel de amenza es inferior al umbral - if (mMenaceCurrent < mMenaceThreshold) + if (menaceCurrent < menaceThreshold) { // Crea una formación de enemigos deployEnemyFormation(); @@ -2819,33 +2807,33 @@ void Game::updateMenace() // Gestiona la entrada durante el juego void Game::checkGameInput() { - mDemo.keys.left = 0; - mDemo.keys.right = 0; - mDemo.keys.noInput = 0; - mDemo.keys.fire = 0; - mDemo.keys.fireLeft = 0; - mDemo.keys.fireRight = 0; + demo.keys.left = 0; + demo.keys.right = 0; + demo.keys.noInput = 0; + demo.keys.fire = 0; + demo.keys.fireLeft = 0; + demo.keys.fireRight = 0; // Modo Demo activo - if (mDemo.enabled) + if (demo.enabled) { const int index = 0; - if (mDemo.dataFile[mDemo.counter].left == 1) + if (demo.dataFile[demo.counter].left == 1) { players.at(index)->setInput(INPUT_LEFT); } - if (mDemo.dataFile[mDemo.counter].right == 1) + if (demo.dataFile[demo.counter].right == 1) { players.at(index)->setInput(INPUT_RIGHT); } - if (mDemo.dataFile[mDemo.counter].noInput == 1) + if (demo.dataFile[demo.counter].noInput == 1) { players.at(index)->setInput(INPUT_NULL); } - if (mDemo.dataFile[mDemo.counter].fire == 1) + if (demo.dataFile[demo.counter].fire == 1) { if (players.at(index)->canFire()) { @@ -2854,7 +2842,7 @@ void Game::checkGameInput() players.at(index)->setFireCooldown(10); } } - if (mDemo.dataFile[mDemo.counter].fireLeft == 1) + if (demo.dataFile[demo.counter].fireLeft == 1) { if (players.at(index)->canFire()) { @@ -2864,7 +2852,7 @@ void Game::checkGameInput() } } - if (mDemo.dataFile[mDemo.counter].fireRight == 1) + if (demo.dataFile[demo.counter].fireRight == 1) { if (players.at(index)->canFire()) { @@ -2877,17 +2865,17 @@ void Game::checkGameInput() // Comprueba el input de pausa if (input->checkInput(INPUT_BUTTON_PAUSE, REPEAT_FALSE)) { - mSection.name = PROG_SECTION_TITLE; + section.name = PROG_SECTION_TITLE; } // Incrementa el contador de la demo - if (mDemo.counter < TOTAL_DEMO_DATA) + if (demo.counter < TOTAL_DEMO_DATA) { - mDemo.counter++; + demo.counter++; } else { - mSection = {PROG_SECTION_TITLE, TITLE_SECTION_INSTRUCTIONS}; + section = {PROG_SECTION_TITLE, TITLE_SECTION_INSTRUCTIONS}; } } // Modo Demo no activo @@ -2899,28 +2887,28 @@ void Game::checkGameInput() if (player->isAlive()) { // Input a la izquierda - if (input->checkInput(INPUT_LEFT, REPEAT_TRUE, mOptions->input[i].deviceType, mOptions->input[i].id)) + if (input->checkInput(INPUT_LEFT, REPEAT_TRUE, options->input[i].deviceType, options->input[i].id)) { player->setInput(INPUT_LEFT); - mDemo.keys.left = 1; + demo.keys.left = 1; } else { // Input a la derecha - if (input->checkInput(INPUT_RIGHT, REPEAT_TRUE, mOptions->input[i].deviceType, mOptions->input[i].id)) + if (input->checkInput(INPUT_RIGHT, REPEAT_TRUE, options->input[i].deviceType, options->input[i].id)) { player->setInput(INPUT_RIGHT); - mDemo.keys.right = 1; + demo.keys.right = 1; } else { // Ninguno de los dos inputs anteriores player->setInput(INPUT_NULL); - mDemo.keys.noInput = 1; + demo.keys.noInput = 1; } } // Comprueba el input de disparar al centro - if (input->checkInput(INPUT_BUTTON_2, REPEAT_TRUE, mOptions->input[i].deviceType, mOptions->input[i].id)) + if (input->checkInput(INPUT_BUTTON_2, REPEAT_TRUE, options->input[i].deviceType, options->input[i].id)) { if (player->canFire()) { @@ -2931,12 +2919,12 @@ void Game::checkGameInput() // Reproduce el sonido de disparo JA_PlaySound(bulletSound); - mDemo.keys.fire = 1; + demo.keys.fire = 1; } } // Comprueba el input de disparar a la izquierda - if (input->checkInput(INPUT_BUTTON_1, REPEAT_TRUE, mOptions->input[i].deviceType, mOptions->input[i].id)) + if (input->checkInput(INPUT_BUTTON_1, REPEAT_TRUE, options->input[i].deviceType, options->input[i].id)) { if (player->canFire()) { @@ -2947,12 +2935,12 @@ void Game::checkGameInput() // Reproduce el sonido de disparo JA_PlaySound(bulletSound); - mDemo.keys.fireLeft = 1; + demo.keys.fireLeft = 1; } } // Comprueba el input de disparar a la derecha - if (input->checkInput(INPUT_BUTTON_3, REPEAT_TRUE, mOptions->input[i].deviceType, mOptions->input[i].id)) + if (input->checkInput(INPUT_BUTTON_3, REPEAT_TRUE, options->input[i].deviceType, options->input[i].id)) { if (player->canFire()) { @@ -2963,14 +2951,14 @@ void Game::checkGameInput() // Reproduce el sonido de disparo JA_PlaySound(bulletSound); - mDemo.keys.fireRight = 1; + demo.keys.fireRight = 1; } } // Comprueba el input de pausa - if (input->checkInput(INPUT_CANCEL, REPEAT_FALSE, mOptions->input[i].deviceType, mOptions->input[i].id)) + if (input->checkInput(INPUT_CANCEL, REPEAT_FALSE, options->input[i].deviceType, options->input[i].id)) { - mSection.subsection = GAME_SECTION_PAUSE; + section.subsection = GAME_SECTION_PAUSE; if (JA_GetMusicState() == JA_MUSIC_PLAYING) { @@ -2978,17 +2966,17 @@ void Game::checkGameInput() } } - if (mDemo.counter < TOTAL_DEMO_DATA) + if (demo.counter < TOTAL_DEMO_DATA) { - if (mDemo.recording) + if (demo.recording) { - mDemo.dataFile[mDemo.counter] = mDemo.keys; + demo.dataFile[demo.counter] = demo.keys; } - mDemo.counter++; + demo.counter++; } - else if (mDemo.recording) + else if (demo.recording) { - mSection.name = PROG_SECTION_QUIT; + section.name = PROG_SECTION_QUIT; } i++; @@ -3001,29 +2989,29 @@ void Game::checkGameInput() void Game::renderMessages() { // GetReady - if ((mCounter < STAGE_COUNTER) && (!mDemo.enabled)) + if ((counter < STAGE_COUNTER) && (!demo.enabled)) { - textNokiaBig2->write((int)mGetReadyBitmapPath[mCounter], PLAY_AREA_CENTER_Y - 8, lang->getText(75), -2); + textNokiaBig2->write((int)getReadyBitmapPath[counter], PLAY_AREA_CENTER_Y - 8, lang->getText(75), -2); } // Time Stopped - if (mTimeStopped) + if (timeStopped) { - if ((mTimeStoppedCounter > 100) || (mTimeStoppedCounter % 10 > 4)) + if ((timeStoppedCounter > 100) || (timeStoppedCounter % 10 > 4)) { - textNokia2->writeDX(TXT_CENTER, PLAY_AREA_CENTER_X, PLAY_AREA_FIRST_QUARTER_Y, lang->getText(36) + std::to_string(mTimeStoppedCounter / 10), -1, noColor, 1, shdwTxtColor); + textNokia2->writeDX(TXT_CENTER, PLAY_AREA_CENTER_X, PLAY_AREA_FIRST_QUARTER_Y, lang->getText(36) + std::to_string(timeStoppedCounter / 10), -1, noColor, 1, shdwTxtColor); } - if (mTimeStoppedCounter > 100) + if (timeStoppedCounter > 100) { - if (mTimeStoppedCounter % 30 == 0) + if (timeStoppedCounter % 30 == 0) { JA_PlaySound(clockSound, false); } } else { - if (mTimeStoppedCounter % 15 == 0) + if (timeStoppedCounter % 15 == 0) { JA_PlaySound(clockSound, false); } @@ -3031,38 +3019,38 @@ void Game::renderMessages() } // D E M O - if (mDemo.enabled) + if (demo.enabled) { - if (mDemo.counter % 30 > 14) + if (demo.counter % 30 > 14) { textNokiaBig2->writeDX(TXT_CENTER, PLAY_AREA_CENTER_X, PLAY_AREA_FIRST_QUARTER_Y, lang->getText(37), 0, noColor, 2, shdwTxtColor); } } // STAGE NUMBER - if (mStageBitmapCounter < STAGE_COUNTER) + if (stageBitmapCounter < STAGE_COUNTER) { - const int stage = mStage[mCurrentStage].number; + const int stageNum = stage[currentStage].number; std::string text; - if (stage == 10) + if (stageNum == 10) { // Ultima fase text = lang->getText(79); } else { // X fases restantes - text = std::to_string(11 - mStage[mCurrentStage].number) + lang->getText(38); + text = std::to_string(11 - stage[currentStage].number) + lang->getText(38); } - if (!mGameCompleted) + if (!gameCompleted) { // Escribe el numero de fases restantes - textNokiaBig2->writeDX(TXT_CENTER, PLAY_AREA_CENTER_X, mStageBitmapPath[mStageBitmapCounter], text, -2, noColor, 2, shdwTxtColor); + textNokiaBig2->writeDX(TXT_CENTER, PLAY_AREA_CENTER_X, stageBitmapPath[stageBitmapCounter], text, -2, noColor, 2, shdwTxtColor); } else { // Escribe el texto de juego completado text = lang->getText(50); - textNokiaBig2->writeDX(TXT_CENTER, PLAY_AREA_CENTER_X, mStageBitmapPath[mStageBitmapCounter], text, -2, noColor, 1, shdwTxtColor); - textNokia2->writeDX(TXT_CENTER, PLAY_AREA_CENTER_X, mStageBitmapPath[mStageBitmapCounter] + textNokiaBig2->getCharacterSize() + 2, lang->getText(76), -1, noColor, 1, shdwTxtColor); + textNokiaBig2->writeDX(TXT_CENTER, PLAY_AREA_CENTER_X, stageBitmapPath[stageBitmapCounter], text, -2, noColor, 1, shdwTxtColor); + textNokia2->writeDX(TXT_CENTER, PLAY_AREA_CENTER_X, stageBitmapPath[stageBitmapCounter] + textNokiaBig2->getCharacterSize() + 2, lang->getText(76), -1, noColor, 1, shdwTxtColor); } } } @@ -3082,7 +3070,7 @@ void Game::enableTimeStopItem() // Deshabilita el efecto del item de detener el tiempo void Game::disableTimeStopItem() { - mTimeStopped = false; + timeStopped = false; setTimeStoppedCounter(0); startAllBalloons(); if (JA_GetMusicState() == JA_MUSIC_PAUSED) @@ -3134,28 +3122,28 @@ void Game::shakeScreen() // Bucle para el juego section_t Game::run() { - while (mSection.name == PROG_SECTION_GAME) + while (section.name == PROG_SECTION_GAME) { // Sección juego en pausa - if (mSection.subsection == GAME_SECTION_PAUSE) + if (section.subsection == GAME_SECTION_PAUSE) { runPausedGame(); } // Sección Game Over - if (mSection.subsection == GAME_SECTION_GAMEOVER) + if (section.subsection == GAME_SECTION_GAMEOVER) { runGameOverScreen(); } // Sección juego jugando - if ((mSection.subsection == GAME_SECTION_PLAY_1P) || (mSection.subsection == GAME_SECTION_PLAY_2P)) + if ((section.subsection == GAME_SECTION_PLAY_1P) || (section.subsection == GAME_SECTION_PLAY_2P)) { // Si la música no está sonando if ((JA_GetMusicState() == JA_MUSIC_INVALID) || (JA_GetMusicState() == JA_MUSIC_STOPPED)) { // Reproduce la música - if (!mGameCompleted) + if (!gameCompleted) { if (players.at(0)->isAlive()) { @@ -3172,7 +3160,7 @@ section_t Game::run() } } - return mSection; + return section; } // Bucle para el menu de pausa del juego @@ -3181,24 +3169,24 @@ void Game::runPausedGame() // Reinicia el menu pauseMenu->reset(); - while ((mSection.subsection == GAME_SECTION_PAUSE) && (mSection.name == PROG_SECTION_GAME)) + while ((section.subsection == GAME_SECTION_PAUSE) && (section.name == PROG_SECTION_GAME)) { // Comprueba los eventos que hay en la cola checkEventHandler(); // Calcula la lógica de los objetos - if (SDL_GetTicks() - mTicks > mTicksSpeed) + if (SDL_GetTicks() - ticks > ticksSpeed) { // Actualiza el contador de ticks - mTicks = SDL_GetTicks(); + ticks = SDL_GetTicks(); // Actualiza la lógica del menu pauseMenu->update(); fade->update(); if (fade->hasEnded()) { - mSection.name = PROG_SECTION_TITLE; - mSection.subsection = TITLE_SECTION_1; + section.name = PROG_SECTION_TITLE; + section.subsection = TITLE_SECTION_1; JA_StopMusic(); break; } @@ -3221,14 +3209,14 @@ void Game::runPausedGame() renderScoreBoard(); renderPlayers(); - if ((mDeathCounter <= 150) && !players.at(0)->isAlive()) + if ((deathCounter <= 150) && !players.at(0)->isAlive()) { - renderDeathFade(150 - mDeathCounter); + renderDeathFade(150 - deathCounter); } - if ((mGameCompleted) && (mGameCompletedCounter >= 300)) + if ((gameCompleted) && (gameCompletedCounter >= 300)) { - renderDeathFade(mGameCompletedCounter - 300); + renderDeathFade(gameCompletedCounter - 300); } renderFlashEffect(); @@ -3247,15 +3235,15 @@ void Game::runPausedGame() switch (pauseMenu->getItemSelected()) { case 0: - mSection.name = PROG_SECTION_GAME; + section.name = PROG_SECTION_GAME; - if (mNumPlayers == 1) + if (numPlayers == 1) { - mSection.subsection = GAME_SECTION_PLAY_1P; + section.subsection = GAME_SECTION_PLAY_1P; } else { - mSection.subsection = GAME_SECTION_PLAY_2P; + section.subsection = GAME_SECTION_PLAY_2P; } if (JA_GetMusicState() == JA_MUSIC_PAUSED) @@ -3278,13 +3266,16 @@ void Game::runPausedGame() // Bucle para la pantalla de game over void Game::runGameOverScreen() { + // Variables + int postFade = 0; + // Guarda los puntos saveScoreFile(); // Reinicia el menu gameOverMenu->reset(); - while ((mSection.subsection == GAME_SECTION_GAMEOVER) && (mSection.name == PROG_SECTION_GAME)) + while ((section.subsection == GAME_SECTION_GAMEOVER) && (section.name == PROG_SECTION_GAME)) { // Comprueba los eventos que hay en la cola while (SDL_PollEvent(eventHandler) != 0) @@ -3292,34 +3283,34 @@ void Game::runGameOverScreen() // Evento de salida de la aplicación if (eventHandler->type == SDL_QUIT) { - mSection.name = PROG_SECTION_QUIT; + section.name = PROG_SECTION_QUIT; break; } } // Calcula la lógica de los objetos - if (SDL_GetTicks() - mTicks > mTicksSpeed) + if (SDL_GetTicks() - ticks > ticksSpeed) { // Actualiza el contador de ticks - mTicks = SDL_GetTicks(); + ticks = SDL_GetTicks(); // Actualiza la lógica del menu gameOverMenu->update(); fade->update(); if (fade->hasEnded()) { - switch (mPostFade) + switch (postFade) { case 0: // YES - mSection.name = PROG_SECTION_GAME; + section.name = PROG_SECTION_GAME; deleteAllVectorObjects(); init(); - mSection.subsection = mNumPlayers == 1 ? GAME_SECTION_PLAY_1P : GAME_SECTION_PLAY_2P; + section.subsection = numPlayers == 1 ? GAME_SECTION_PLAY_1P : GAME_SECTION_PLAY_2P; break; case 1: // NO - mSection.name = PROG_SECTION_TITLE; - mSection.subsection = TITLE_SECTION_1; + section.name = PROG_SECTION_TITLE; + section.subsection = TITLE_SECTION_1; break; default: @@ -3337,7 +3328,7 @@ void Game::runGameOverScreen() screen->clean(bgColor); // Dibuja los objetos - if (mNumPlayers == 1) + if (numPlayers == 1) { textBig->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 4), lang->getText(43)); text->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 1), lang->getText(44) + std::to_string(players.at(0)->getScore())); @@ -3362,12 +3353,12 @@ void Game::runGameOverScreen() switch (gameOverMenu->getItemSelected()) { case 0: // YES - mPostFade = 0; + postFade = 0; fade->activateFade(); break; case 1: // NO - mPostFade = 1; + postFade = 1; fade->activateFade(); break; @@ -3380,7 +3371,7 @@ void Game::runGameOverScreen() // Indica si se puede crear una powerball bool Game::canPowerBallBeCreated() { - if ((!mPowerBallEnabled) && (calculateScreenPower() > POWERBALL_SCREENPOWER_MINIMUM) && (mPowerBallCounter == 0)) + if ((!powerBallEnabled) && (calculateScreenPower() > POWERBALL_SCREENPOWER_MINIMUM) && (powerBallCounter == 0)) { return true; } @@ -3407,6 +3398,13 @@ int Game::calculateScreenPower() // Inicializa las variables que contienen puntos de ruta para mover objetos void Game::initPaths() { + // Vector con los valores del seno para 360 grados + float sin[360]; + for (int i = 0; i < 360; ++i) + { + sin[i] = SDL_sinf((float)i * 3.14f / 180.0f); + } + // Letrero de STAGE # const int firstPart = STAGE_COUNTER / 4; // 50 const int secondPart = firstPart * 3; // 150 @@ -3417,17 +3415,17 @@ void Game::initPaths() { if (i < firstPart) { - mStageBitmapPath[i] = (mSin[(int)((i * 1.8f) + 90)] * (distance) + centerPoint); + stageBitmapPath[i] = (sin[(int)((i * 1.8f) + 90)] * (distance) + centerPoint); } else if (i < secondPart) { - mStageBitmapPath[i] = (int)centerPoint; + stageBitmapPath[i] = (int)centerPoint; } else { - mStageBitmapPath[i] = (mSin[(int)(((i - 149) * 1.8f) + 90)] * (centerPoint + 17) - 17); + stageBitmapPath[i] = (sin[(int)(((i - 149) * 1.8f) + 90)] * (centerPoint + 17) - 17); } } @@ -3447,19 +3445,19 @@ void Game::initPaths() { if (i < firstPart) { - mGetReadyBitmapPath[i] = mSin[(int)(i * 1.8f)]; - mGetReadyBitmapPath[i] *= distance1; - mGetReadyBitmapPath[i] -= size; + getReadyBitmapPath[i] = sin[(int)(i * 1.8f)]; + getReadyBitmapPath[i] *= distance1; + getReadyBitmapPath[i] -= size; } else if (i < secondPart) { - mGetReadyBitmapPath[i] = (int)finish1; + getReadyBitmapPath[i] = (int)finish1; } else { - mGetReadyBitmapPath[i] = mSin[(int)((i - 150) * 1.8f)]; - mGetReadyBitmapPath[i] *= distance2; - mGetReadyBitmapPath[i] += finish1; + getReadyBitmapPath[i] = sin[(int)((i - 150) * 1.8f)]; + getReadyBitmapPath[i] *= distance2; + getReadyBitmapPath[i] += finish1; } } } @@ -3467,14 +3465,14 @@ void Game::initPaths() // Actualiza el tramo final de juego, una vez completado void Game::updateGameCompleted() { - if (mGameCompleted) + if (gameCompleted) { - mGameCompletedCounter++; + gameCompletedCounter++; } - if (mGameCompletedCounter == 500) + if (gameCompletedCounter == 500) { - mSection.subsection = GAME_SECTION_GAMEOVER; + section.subsection = GAME_SECTION_GAMEOVER; } } @@ -3482,33 +3480,33 @@ void Game::updateGameCompleted() void Game::updateHelper() { // Solo ofrece ayuda cuando la amenaza es elevada - if (mMenaceCurrent > 15) + if (menaceCurrent > 15) { for (auto player : players) { if (player->getCoffees() == 0) { - mHelper.needCoffee = true; + helper.needCoffee = true; } else { - mHelper.needCoffee = false; + helper.needCoffee = false; } if (!player->isPowerUp()) { - mHelper.needCoffeeMachine = true; + helper.needCoffeeMachine = true; } else { - mHelper.needCoffeeMachine = false; + helper.needCoffeeMachine = false; } } } else { - mHelper.needCoffee = false; - mHelper.needCoffeeMachine = false; + helper.needCoffee = false; + helper.needCoffeeMachine = false; } } @@ -3532,7 +3530,7 @@ void Game::checkEventHandler() // Evento de salida de la aplicación if (eventHandler->type == SDL_QUIT) { - mSection.name = PROG_SECTION_QUIT; + section.name = PROG_SECTION_QUIT; break; } else if (eventHandler->type == SDL_KEYDOWN && eventHandler->key.repeat == 0) diff --git a/source/game.h b/source/game.h index acb52c9..84b254c 100644 --- a/source/game.h +++ b/source/game.h @@ -189,50 +189,48 @@ private: JA_Music gameMusic; // Musica de fondo // Variables - int mNumPlayers; // Numero de jugadores - Uint32 mTicks; // Contador de ticks para ajustar la velocidad del programa - Uint8 mTicksSpeed; // Velocidad a la que se repiten los bucles del programa + int numPlayers; // Numero de jugadores + Uint32 ticks; // Contador de ticks para ajustar la velocidad del programa + Uint8 ticksSpeed; // Velocidad a la que se repiten los bucles del programa - Uint32 mHiScore; // Puntuación máxima - bool mHiScoreAchieved; // Indica si se ha superado la puntuación máxima - section_t mSection; // Seccion actual dentro del juego - stage_t mStage[10]; // Variable con los datos de cada pantalla - Uint8 mCurrentStage; // Indica la fase actual - Uint8 mStageBitmapCounter; // Contador para el tiempo visible del texto de Stage - float mStageBitmapPath[STAGE_COUNTER]; // Vector con los puntos Y por donde se desplaza el texto - float mGetReadyBitmapPath[STAGE_COUNTER]; // Vector con los puntos X por donde se desplaza el texto - Uint16 mDeathCounter; // Contador para la animación de muerte del jugador - Uint8 mDeathIndex; // Indice del vector de smartsprites que contiene el sprite del jugador - Uint8 mMenaceCurrent; // Nivel de amenaza actual - Uint8 mMenaceThreshold; // Umbral del nivel de amenaza. Si el nivel de amenaza cae por debajo del umbral, se generan más globos. Si el umbral aumenta, aumenta el numero de globos - bool mTimeStopped; // Indica si el tiempo está detenido - Uint16 mTimeStoppedCounter; // Temporizador para llevar la cuenta del tiempo detenido - Uint32 mCounter; // Contador para el juego - Uint32 mScoreDataFile[TOTAL_SCORE_DATA]; // Datos del fichero de puntos - SDL_Rect skyColorsRect[4]; // Vector con las coordenadas de los 4 colores de cielo - Uint16 mBalloonsPopped; // Lleva la cuenta de los globos explotados - Uint8 mLastEnemyDeploy; // Guarda cual ha sido la última formación desplegada para no repetir; - int mEnemyDeployCounter; // Cuando se lanza una formación, se le da un valor y no sale otra hasta que llegue a cero - float mEnemySpeed; // Velocidad a la que se mueven los enemigos - float mDefaultEnemySpeed; // Velocidad base de los enemigos, sin incrementar - effect_t mEffect; // Variable para gestionar los efectos visuales - helper_t mHelper; // Variable para gestionar las ayudas - bool mPowerBallEnabled; // Indica si hay una powerball ya activa - Uint8 mPowerBallCounter; // Contador de formaciones enemigas entre la aparicion de una PowerBall y otra - bool mCoffeeMachineEnabled; // Indica si hay una máquina de café en el terreno de juego - Uint8 mPostFade; // Qué hacer al acabar el fade - float mSin[360]; // Vector con los valores del seno para 360 grados - bool mGameCompleted; // Indica si se ha completado la partida, llegando al final de la ultima pantalla - int mGameCompletedCounter; // Contador para el tramo final, cuando se ha completado la partida y ya no aparecen más enemigos - Uint8 mDifficulty; // Dificultad del juego - float mDifficultyScoreMultiplier; // Multiplicador de puntos en función de la dificultad - struct options_t *mOptions; // Variable con todas las variables de las opciones del programa - Uint8 mOnePlayerControl; // Variable para almacenar el valor de las opciones - enemyFormation_t mEnemyFormation[NUMBER_OF_ENEMY_FORMATIONS]; // Vector con todas las formaciones enemigas - enemyPool_t mEnemyPool[10]; // Variable con los diferentes conjuntos de formaciones enemigas - Uint8 mLastStageReached; // Contiene el numero de la última pantalla que se ha alcanzado + Uint32 hiScore; // Puntuación máxima + bool hiScoreAchieved; // Indica si se ha superado la puntuación máxima + section_t section; // Seccion actual dentro del juego + stage_t stage[10]; // Variable con los datos de cada pantalla + Uint8 currentStage; // Indica la fase actual + Uint8 stageBitmapCounter; // Contador para el tiempo visible del texto de Stage + float stageBitmapPath[STAGE_COUNTER]; // Vector con los puntos Y por donde se desplaza el texto + float getReadyBitmapPath[STAGE_COUNTER]; // Vector con los puntos X por donde se desplaza el texto + Uint16 deathCounter; // Contador para la animación de muerte del jugador + Uint8 deathIndex; // Indice del vector de smartsprites que contiene el sprite del jugador + Uint8 menaceCurrent; // Nivel de amenaza actual + Uint8 menaceThreshold; // Umbral del nivel de amenaza. Si el nivel de amenaza cae por debajo del umbral, se generan más globos. Si el umbral aumenta, aumenta el numero de globos + bool timeStopped; // Indica si el tiempo está detenido + Uint16 timeStoppedCounter; // Temporizador para llevar la cuenta del tiempo detenido + Uint32 counter; // Contador para el juego + Uint32 scoreDataFile[TOTAL_SCORE_DATA]; // Datos del fichero de puntos + SDL_Rect skyColorsRect[4]; // Vector con las coordenadas de los 4 colores de cielo + Uint16 balloonsPopped; // Lleva la cuenta de los globos explotados + Uint8 lastEnemyDeploy; // Guarda cual ha sido la última formación desplegada para no repetir; + int enemyDeployCounter; // Cuando se lanza una formación, se le da un valor y no sale otra hasta que llegue a cero + float enemySpeed; // Velocidad a la que se mueven los enemigos + float defaultEnemySpeed; // Velocidad base de los enemigos, sin incrementar + effect_t effect; // Variable para gestionar los efectos visuales + helper_t helper; // Variable para gestionar las ayudas + bool powerBallEnabled; // Indica si hay una powerball ya activa + Uint8 powerBallCounter; // Contador de formaciones enemigas entre la aparicion de una PowerBall y otra + 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 + int gameCompletedCounter; // Contador para el tramo final, cuando se ha completado la partida y ya no aparecen más enemigos + Uint8 difficulty; // Dificultad del juego + float difficultyScoreMultiplier; // Multiplicador de puntos en función de la dificultad + struct options_t *options; // Variable con todas las variables de las opciones del programa + Uint8 onePlayerControl; // Variable para almacenar el valor de las opciones + enemyFormation_t enemyFormation[NUMBER_OF_ENEMY_FORMATIONS]; // Vector con todas las formaciones enemigas + enemyPool_t enemyPool[10]; // Variable con los diferentes conjuntos de formaciones enemigas + Uint8 lastStageReached; // Contiene el numero de la última pantalla que se ha alcanzado - demo_t mDemo; // Variable con todas las variables relacionadas con el modo demo + demo_t demo; // Variable con todas las variables relacionadas con el modo demo // Actualiza el juego void update(); @@ -243,9 +241,6 @@ private: // Comprueba los eventos que hay en cola void checkEventHandler(); - // Inicializa el vector con los valores del seno - void initSin(); - // Inicializa las variables necesarias para la sección 'Game' void init();