diff --git a/source/define_buttons.cpp b/source/define_buttons.cpp index 7637189..d5d818a 100644 --- a/source/define_buttons.cpp +++ b/source/define_buttons.cpp @@ -7,109 +7,115 @@ #include "utils.h" // for OptionsController, Options, Param, ParamGame // Constructor -DefineButtons::DefineButtons(std::unique_ptr text) - : text(std::move(text)) +DefineButtons::DefineButtons(std::unique_ptr text_) + : text_(std::move(text_)) { // Copia punteros a los objetos - input = Input::get(); + input_ = Input::get(); // Inicializa variables - enabled = false; - x = param.game.width / 2; - y = param.title.press_start_position; - indexController = 0; - indexButton = 0; + enabled_ = false; + x_ = param.game.width / 2; + y_ = param.title.press_start_position; + index_controller_ = 0; + index_button_ = 0; - buttons.clear(); - db_button_t button; + buttons_.clear(); + DefineButtonsButton button; button.label = lang::getText(95); button.input = input_fire_left; button.button = SDL_CONTROLLER_BUTTON_X; - buttons.push_back(button); + buttons_.push_back(button); button.label = lang::getText(96); button.input = input_fire_center; button.button = SDL_CONTROLLER_BUTTON_Y; - buttons.push_back(button); + buttons_.push_back(button); button.label = lang::getText(97); button.input = input_fire_right; button.button = SDL_CONTROLLER_BUTTON_RIGHTSHOULDER; - buttons.push_back(button); + buttons_.push_back(button); button.label = lang::getText(98); button.input = input_start; button.button = SDL_CONTROLLER_BUTTON_START; - buttons.push_back(button); + buttons_.push_back(button); button.label = lang::getText(99); button.input = input_exit; button.button = SDL_CONTROLLER_BUTTON_BACK; - buttons.push_back(button); + buttons_.push_back(button); - for (int i = 0; i < input->getNumControllers(); ++i) + for (int i = 0; i < input_->getNumControllers(); ++i) { - controllerNames.push_back(input->getControllerName(i)); + controller_names_.push_back(input_->getControllerName(i)); } } // Dibuja el objeto en pantalla void DefineButtons::render() { - if (enabled) + if (enabled_) { - text->writeCentered(x, y - 10, lang::getText(100) + std::to_string(options.controller[indexController].player_id)); - text->writeCentered(x, y, controllerNames[indexController]); - text->writeCentered(x, y + 10, buttons[indexButton].label); + text_->writeCentered(x_, y_ - 10, lang::getText(100) + std::to_string(options.controller[index_controller_].player_id)); + text_->writeCentered(x_, y_, controller_names_[index_controller_]); + text_->writeCentered(x_, y_ + 10, buttons_[index_button_].label); } } // Comprueba el botón que se ha pulsado void DefineButtons::doControllerButtonDown(SDL_ControllerButtonEvent *event) { - int i = input->getJoyIndex(event->which); + int i = input_->getJoyIndex(event->which); // Solo pillamos botones del mando que toca - if (i != indexController) + if (i != index_controller_) { return; } - buttons[indexButton].button = (SDL_GameControllerButton)event->button; + buttons_[index_button_].button = (SDL_GameControllerButton)event->button; incIndexButton(); } -// Asigna los botones definidos al input +// Asigna los botones definidos al input_ void DefineButtons::bindButtons() { - for (int i = 0; i < (int)buttons.size(); ++i) + for (int i = 0; i < (int)buttons_.size(); ++i) { - input->bindGameControllerButton(indexController, buttons[i].input, buttons[i].button); + input_->bindGameControllerButton(index_controller_, buttons_[i].input, buttons_[i].button); } } // Comprueba las entradas void DefineButtons::checkInput() { - if (enabled) + if (enabled_) { SDL_Event event; // Comprueba los eventos que hay en la cola while (SDL_PollEvent(&event)) { - // Evento de salida de la aplicación - if (event.type == SDL_QUIT) + switch (event.type) + { + case SDL_QUIT: { section::name = section::NAME_QUIT; section::options = section::OPTIONS_QUIT_NORMAL; break; } - if (event.type == SDL_CONTROLLERBUTTONDOWN) + case SDL_CONTROLLERBUTTONDOWN: { doControllerButtonDown(&event.cbutton); + break; + } + + default: + break; } } } @@ -118,11 +124,11 @@ void DefineButtons::checkInput() // Habilita el objeto bool DefineButtons::enable(int index) { - if (index < input->getNumControllers()) + if (index < input_->getNumControllers()) { - enabled = true; - indexController = index; - indexButton = 0; + enabled_ = true; + index_controller_ = index; + index_button_ = 0; return true; } @@ -132,29 +138,29 @@ bool DefineButtons::enable(int index) // Comprueba si está habilitado bool DefineButtons::isEnabled() { - return enabled; + return enabled_; } // Incrementa el indice de los botones void DefineButtons::incIndexButton() { - indexButton++; + index_button_++; // Comprueba si ha finalizado - if (indexButton == (int)buttons.size()) + if (index_button_ == (int)buttons_.size()) { - // Asigna los botones definidos al input + // Asigna los botones definidos al input_ bindButtons(); // Guarda los cambios en las opciones saveBindingsToOptions(); - input->allActive(indexController); + input_->allActive(index_controller_); // Reinicia variables - indexButton = 0; - indexController = 0; - enabled = false; + index_button_ = 0; + index_controller_ = 0; + enabled_ = false; } } @@ -162,10 +168,10 @@ void DefineButtons::incIndexButton() void DefineButtons::saveBindingsToOptions() { // Modifica las opciones para colocar los valores asignados - options.controller[indexController].name = input->getControllerName(indexController); - for (int j = 0; j < (int)options.controller[indexController].inputs.size(); ++j) + options.controller[index_controller_].name = input_->getControllerName(index_controller_); + for (int j = 0; j < (int)options.controller[index_controller_].inputs.size(); ++j) { - options.controller[indexController].buttons[j] = input->getControllerBinding(indexController, options.controller[indexController].inputs[j]); + options.controller[index_controller_].buttons[j] = input_->getControllerBinding(index_controller_, options.controller[index_controller_].inputs[j]); } } diff --git a/source/define_buttons.h b/source/define_buttons.h index 6effa30..3c6f902 100644 --- a/source/define_buttons.h +++ b/source/define_buttons.h @@ -1,14 +1,14 @@ #pragma once -#include // for SDL_ControllerButtonEvent -#include // for SDL_GameControllerButton -#include // for string, basic_string -#include // for vector -#include "input.h" // for inputs_e +#include // for SDL_ControllerButtonEvent +#include // for SDL_GameControllerButton +#include // for string, basic_string +#include // for vector +#include "input.h" // for inputs_e #include "text.h" #include -struct db_button_t +struct DefineButtonsButton { std::string label; // Texto en pantalla para el botón inputs_e input; // Input asociado @@ -20,17 +20,17 @@ class DefineButtons { private: // Objetos - Input *input; // Objeto pata gestionar la entrada - std::shared_ptr text; // Objeto para escribir texto + Input *input_; // Objeto pata gestionar la entrada + std::shared_ptr text_; // Objeto para escribir texto // Variables - bool enabled; // Indica si el objeto está habilitado - int x; // Posición donde dibujar el texto - int y; // Posición donde dibujar el texto - std::vector buttons; // Vector con las nuevas definiciones de botones/acciones - int indexController; // Indice del controlador a reasignar - int indexButton; // Indice para saber qué bot´çon se está definiendo - std::vector controllerNames; // Nombres de los mandos + bool enabled_; // Indica si el objeto está habilitado + int x_; // Posición donde dibujar el texto + int y_; // Posición donde dibujar el texto + std::vector buttons_; // Vector con las nuevas definiciones de botones/acciones + int index_controller_; // Indice del controlador a reasignar + int index_button_; // Indice para saber qué bot´çon se está definiendo + std::vector controller_names_; // Nombres de los mandos // Incrementa el indice de los botones void incIndexButton(); diff --git a/source/director.cpp b/source/director.cpp index dce94e3..0d84d61 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -60,7 +60,7 @@ Director::Director(int argc, char *argv[]) createSystemFolder("jailgames/coffee_crisis_arcade_edition"); // Crea el objeto que controla los ficheros de recursos - Asset::init(executablePath); + Asset::init(executable_path_); // Si falta algún fichero no inicia el programa if (!setFileList()) @@ -75,7 +75,7 @@ Director::Director(int argc, char *argv[]) #ifdef ANBERNIC const std::string paramFilePath = asset->get("param_320x240.txt"); #else - const std::string paramFilePath = paramFileArgument == "--320x240" ? Asset::get()->get("param_320x240.txt") : Asset::get()->get("param_320x256.txt"); + const std::string paramFilePath = param_file_argument_ == "--320x240" ? Asset::get()->get("param_320x240.txt") : Asset::get()->get("param_320x256.txt"); #endif loadParams(paramFilePath); @@ -90,7 +90,7 @@ Director::Director(int argc, char *argv[]) initJailAudio(); // Inicializa el texto de debug - dbg_init(renderer); + dbg_init(renderer_); // Crea los objetos lang::loadFromFile(getLangFile((lang::lang_e)options.game.language)); @@ -98,7 +98,7 @@ Director::Director(int argc, char *argv[]) Input::init(Asset::get()->get("gamecontrollerdb.txt")); initInput(); - Screen::init(window, renderer); + Screen::init(window_, renderer_); OnScreenHelp::init(); @@ -120,11 +120,11 @@ Director::~Director() Screen::destroy(); OnScreenHelp::destroy(); - sounds.clear(); - musics.clear(); + sounds_.clear(); + musics_.clear(); - SDL_DestroyRenderer(renderer); - SDL_DestroyWindow(window); + SDL_DestroyRenderer(renderer_); + SDL_DestroyWindow(window_); SDL_Quit(); } @@ -290,8 +290,8 @@ bool Director::initSDL() } #endif // NO_SHADERS // Crea la ventana - window = SDL_CreateWindow(WINDOW_CAPTION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, param.game.width * options.video.window.size, param.game.height * options.video.window.size, SDL_WINDOW_HIDDEN); - if (!window) + window_ = SDL_CreateWindow(WINDOW_CAPTION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, param.game.width * options.video.window.size, param.game.height * options.video.window.size, SDL_WINDOW_HIDDEN); + if (!window_) { #ifdef VERBOSE std::cout << "Window could not be created!\nSDL Error: " << SDL_GetError() << std::endl; @@ -310,9 +310,9 @@ bool Director::initSDL() // La aceleración se activa según el define flags = flags | SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE; #endif - renderer = SDL_CreateRenderer(window, -1, flags); + renderer_ = SDL_CreateRenderer(window_, -1, flags); - if (!renderer) + if (!renderer_) { #ifdef VERBOSE std::cout << "Renderer could not be created!\nSDL Error: " << SDL_GetError() << std::endl; @@ -322,14 +322,14 @@ bool Director::initSDL() else { // Inicializa el color de renderizado - SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0xFF); + SDL_SetRenderDrawColor(renderer_, 0x00, 0x00, 0x00, 0xFF); // Establece el tamaño del buffer de renderizado - SDL_RenderSetLogicalSize(renderer, param.game.width, param.game.height); - SDL_RenderSetIntegerScale(renderer, static_cast(options.video.integer_scale)); + SDL_RenderSetLogicalSize(renderer_, param.game.width, param.game.height); + SDL_RenderSetIntegerScale(renderer_, static_cast(options.video.integer_scale)); // Establece el modo de mezcla - SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND); + SDL_SetRenderDrawBlendMode(renderer_, SDL_BLENDMODE_BLEND); } } } @@ -350,8 +350,8 @@ bool Director::setFileList() #endif // Ficheros de configuración - Asset::get()->add(systemFolder + "/config.txt", AssetType::DATA, false, true); - Asset::get()->add(systemFolder + "/score.bin", AssetType::DATA, false, true); + Asset::get()->add(system_folder_ + "/config.txt", AssetType::DATA, false, true); + Asset::get()->add(system_folder_ + "/score.bin", AssetType::DATA, false, true); Asset::get()->add(prefix + "/data/config/param_320x240.txt", AssetType::DATA); Asset::get()->add(prefix + "/data/config/param_320x256.txt", AssetType::DATA); Asset::get()->add(prefix + "/data/config/demo1.bin", AssetType::DATA); @@ -493,17 +493,17 @@ void Director::loadParams(std::string filepath) void Director::checkProgramArguments(int argc, char *argv[]) { // Establece la ruta del programa - executablePath = argv[0]; + executable_path_ = argv[0]; // Valores por defecto - paramFileArgument = ""; + param_file_argument_ = ""; // Comprueba el resto de parametros for (int i = 1; i < argc; ++i) { if (strcmp(argv[i], "--320x240") == 0) { - paramFileArgument = argv[i]; + param_file_argument_ = argv[i]; } } } @@ -512,25 +512,36 @@ void Director::checkProgramArguments(int argc, char *argv[]) void Director::createSystemFolder(std::string folder) { #ifdef _WIN32 - systemFolder = std::string(getenv("APPDATA")) + "/" + folder; + system_folder_ = std::string(getenv("APPDATA")) + "/" + folder; #elif __APPLE__ struct passwd *pw = getpwuid(getuid()); const char *homedir = pw->pw_dir; - systemFolder = std::string(homedir) + "/Library/Application Support" + "/" + folder; + system_folder_ = std::string(homedir) + "/Library/Application Support" + "/" + folder; #elif __linux__ struct passwd *pw = getpwuid(getuid()); const char *homedir = pw->pw_dir; - systemFolder = std::string(homedir) + "/.config/" + folder; + system_folder_ = std::string(homedir) + "/.config/" + folder; + + { + // Intenta crear ".config", per si no existeix + std::string config_base_folder = std::string(homedir) + "/.config"; + int ret = mkdir(config_base_folder.c_str(), S_IRWXU); + if (ret == -1 && errno != EEXIST) + { + printf("ERROR CREATING CONFIG BASE FOLDER."); + exit(EXIT_FAILURE); + } + } #endif struct stat st = {0}; - if (stat(systemFolder.c_str(), &st) == -1) + if (stat(system_folder_.c_str(), &st) == -1) { errno = 0; #ifdef _WIN32 - int ret = mkdir(systemFolder.c_str()); + int ret = mkdir(system_folder_.c_str()); #else - int ret = mkdir(systemFolder.c_str(), S_IRWXU); + int ret = mkdir(system_folder_.c_str(), S_IRWXU); #endif if (ret == -1) @@ -562,7 +573,7 @@ void Director::loadSounds() { // Obtiene la lista con las rutas a los ficheros de sonidos std::vector list = Asset::get()->getListByType(AssetType::SOUND); - sounds.clear(); + sounds_.clear(); for (auto l : list) { @@ -571,7 +582,7 @@ void Director::loadSounds() SoundFile temp; temp.name = name; // Añade el nombre del fichero temp.file = JA_LoadSound(l.c_str()); // Carga el fichero de audio - sounds.push_back(temp); + sounds_.push_back(temp); } } @@ -580,7 +591,7 @@ void Director::loadMusics() { // Obtiene la lista con las rutas a los ficheros musicales std::vector list = Asset::get()->getListByType(AssetType::MUSIC); - musics.clear(); + musics_.clear(); for (auto l : list) { @@ -589,7 +600,7 @@ void Director::loadMusics() MusicFile temp; temp.name = name; // Añade el nombre del fichero temp.file = JA_LoadMusic(l.c_str()); // Carga el fichero de audio - musics.push_back(temp); + musics_.push_back(temp); } } @@ -604,7 +615,7 @@ void Director::runLogo() // Ejecuta la sección con la secuencia de introducción void Director::runIntro() { - auto intro = new Intro(getMusic(musics, "intro.ogg")); + auto intro = new Intro(getMusic(musics_, "intro.ogg")); intro->run(); delete intro; } @@ -612,7 +623,7 @@ void Director::runIntro() // Ejecuta la sección con el titulo del juego void Director::runTitle() { - auto title = new Title(getMusic(musics, "title.ogg")); + auto title = new Title(getMusic(musics_, "title.ogg")); title->run(); delete title; } @@ -622,7 +633,7 @@ void Director::runGame() { const auto playerID = section::options == section::OPTIONS_GAME_PLAY_1P ? 1 : 2; constexpr auto currentStage = 0; - auto game = new Game(playerID, currentStage, GAME_MODE_DEMO_OFF, getMusic(musics, "playing.ogg")); + auto game = new Game(playerID, currentStage, GAME_MODE_DEMO_OFF, getMusic(musics_, "playing.ogg")); game->run(); delete game; } @@ -630,7 +641,7 @@ void Director::runGame() // Ejecuta la sección donde se muestran las instrucciones void Director::runInstructions() { - auto instructions = new Instructions(getMusic(musics, "title.ogg")); + auto instructions = new Instructions(getMusic(musics_, "title.ogg")); instructions->run(); delete instructions; } @@ -638,7 +649,7 @@ void Director::runInstructions() // Ejecuta la sección donde se muestra la tabla de puntuaciones void Director::runHiScoreTable() { - auto hiScoreTable = new HiScoreTable(getMusic(musics, "title.ogg")); + auto hiScoreTable = new HiScoreTable(getMusic(musics_, "title.ogg")); hiScoreTable->run(); delete hiScoreTable; } diff --git a/source/director.h b/source/director.h index 773bd72..92ead1c 100644 --- a/source/director.h +++ b/source/director.h @@ -8,21 +8,21 @@ #include "utils.h" // for MusicFile, SoundFile // Textos -#define WINDOW_CAPTION "Coffee Crisis Arcade Edition" +constexpr char WINDOW_CAPTION[] = "Coffee Crisis Arcade Edition"; class Director { private: // Objetos y punteros - SDL_Window *window; // La ventana donde dibujamos - SDL_Renderer *renderer; // El renderizador de la ventana + SDL_Window *window_; // La ventana donde dibujamos + SDL_Renderer *renderer_; // El renderizador de la ventana // Variables - std::string executablePath; // Path del ejecutable - std::string systemFolder; // Carpeta del sistema donde guardar datos - std::string paramFileArgument; // Argumento para gestionar el fichero con los parametros del programa - std::vector sounds; // Vector con los sonidos - std::vector musics; // Vector con las musicas + std::string executable_path_; // Path del ejecutable + std::string system_folder_; // Carpeta del sistema donde guardar datos + std::string param_file_argument_; // Argumento para gestionar el fichero con los parametros del programa + std::vector sounds_; // Vector con los sonidos + std::vector musics_; // Vector con las musicas // Inicializa jail_audio void initJailAudio(); @@ -34,7 +34,7 @@ private: void initInput(); // Carga los parametros para configurar el juego - void loadParams(std::string filepath); + void loadParams(std::string file_path); // Crea el indice de ficheros bool setFileList(); diff --git a/source/enemy_formations.cpp b/source/enemy_formations.cpp index 69c267b..0f1d364 100644 --- a/source/enemy_formations.cpp +++ b/source/enemy_formations.cpp @@ -14,19 +14,19 @@ EnemyFormations::EnemyFormations() // Inicializa las formaciones enemigas void EnemyFormations::initEnemyFormations() { - const int y4 = -BLOCK; + constexpr int y4 = -BLOCK; const int x4_0 = param.game.play_area.rect.x; const int x4_100 = param.game.play_area.rect.w - BALLOON_WIDTH_4; - const int y3 = -BLOCK; + constexpr int y3 = -BLOCK; const int x3_0 = param.game.play_area.rect.x; const int x3_100 = param.game.play_area.rect.w - BALLOON_WIDTH_3; - const int y2 = -BLOCK; + constexpr int y2 = -BLOCK; const int x2_0 = param.game.play_area.rect.x; const int x2_100 = param.game.play_area.rect.w - BALLOON_WIDTH_2; - const int y1 = -BLOCK; + constexpr int y1 = -BLOCK; const int x1_0 = param.game.play_area.rect.x; const int x1_50 = param.game.play_area.center_x - (BALLOON_WIDTH_1 / 2); const int x1_100 = param.game.play_area.rect.w - BALLOON_WIDTH_1; @@ -34,14 +34,14 @@ void EnemyFormations::initEnemyFormations() // Inicializa a cero las variables for (int i = 0; i < NUMBER_OF_ENEMY_FORMATIONS; i++) { - enemyFormation[i].numberOfEnemies = 0; + enemy_formation_[i].number_of_enemies = 0; for (int j = 0; j < MAX_NUMBER_OF_ENEMIES_IN_A_FORMATION; j++) { - 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; + enemy_formation_[i].init[j].x = 0; + enemy_formation_[i].init[j].y = 0; + enemy_formation_[i].init[j].vel_x = 0; + enemy_formation_[i].init[j].kind = 0; + enemy_formation_[i].init[j].creation_counter = 0; } } @@ -52,669 +52,669 @@ void EnemyFormations::initEnemyFormations() // #00 - Dos enemigos BALLOON4 uno a cada extremo j = 0; - enemyFormation[j].numberOfEnemies = 2; + enemy_formation_[j].number_of_enemies = 2; incX = x4_100; incTime = 0; - for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemy_formation_[j].number_of_enemies; 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); + enemy_formation_[j].init[i].x = x4_0 + (i * incX); + enemy_formation_[j].init[i].y = y4; + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE * (((i % 2) * 2) - 1); + enemy_formation_[j].init[i].kind = BALLOON_4; + enemy_formation_[j].init[i].creation_counter = creationTime + (incTime * i); } // #01 - Dos enemigos BALLOON4 uno a cada cuarto. Ambos van hacia el centro j = 1; - enemyFormation[j].numberOfEnemies = 2; + enemy_formation_[j].number_of_enemies = 2; incX = param.game.play_area.center_x; incTime = 0; - for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemy_formation_[j].number_of_enemies; i++) { - enemyFormation[j].init[i].x = param.game.play_area.first_quarter_x - (BALLOON_WIDTH_4 / 2) + (i * incX); - enemyFormation[j].init[i].y = y4; - enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE * (((i % 2) * 2) - 1); - enemyFormation[j].init[i].kind = BALLOON_4; - enemyFormation[j].init[i].creationCounter = creationTime + (incTime * i); + enemy_formation_[j].init[i].x = param.game.play_area.first_quarter_x - (BALLOON_WIDTH_4 / 2) + (i * incX); + enemy_formation_[j].init[i].y = y4; + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE * (((i % 2) * 2) - 1); + enemy_formation_[j].init[i].kind = BALLOON_4; + enemy_formation_[j].init[i].creation_counter = creationTime + (incTime * i); } // #02 - Cuatro enemigos BALLOON2 uno detras del otro. A la izquierda y hacia el centro j = 2; - enemyFormation[j].numberOfEnemies = 4; + enemy_formation_[j].number_of_enemies = 4; incX = BALLOON_WIDTH_2 + 1; incTime = 10; - for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemy_formation_[j].number_of_enemies; 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); + enemy_formation_[j].init[i].x = x2_0 + (i * incX); + enemy_formation_[j].init[i].y = y2; + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE; + enemy_formation_[j].init[i].kind = BALLOON_2; + enemy_formation_[j].init[i].creation_counter = creationTime - (incTime * i); } // #03 - Cuatro enemigos BALLOON2 uno detras del otro. A la derecha y hacia el centro j = 3; - enemyFormation[j].numberOfEnemies = 4; + enemy_formation_[j].number_of_enemies = 4; incX = BALLOON_WIDTH_2 + 1; incTime = 10; - for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemy_formation_[j].number_of_enemies; 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); + enemy_formation_[j].init[i].x = x2_100 - (i * incX); + enemy_formation_[j].init[i].y = y2; + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE; + enemy_formation_[j].init[i].kind = BALLOON_2; + enemy_formation_[j].init[i].creation_counter = creationTime - (incTime * i); } // #04 - Tres enemigos BALLOON3. 0, 25, 50. Hacia la derecha j = 4; - enemyFormation[j].numberOfEnemies = 3; + enemy_formation_[j].number_of_enemies = 3; incX = BALLOON_WIDTH_3 * 2; incTime = 10; - for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemy_formation_[j].number_of_enemies; 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); + enemy_formation_[j].init[i].x = x3_0 + (i * incX); + enemy_formation_[j].init[i].y = y3; + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE; + enemy_formation_[j].init[i].kind = BALLOON_3; + enemy_formation_[j].init[i].creation_counter = creationTime - (incTime * i); } // #05 - Tres enemigos BALLOON3. 50, 75, 100. Hacia la izquierda j = 5; - enemyFormation[j].numberOfEnemies = 3; + enemy_formation_[j].number_of_enemies = 3; incX = BALLOON_WIDTH_3 * 2; incTime = 10; - for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemy_formation_[j].number_of_enemies; 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); + enemy_formation_[j].init[i].x = x3_100 - (i * incX); + enemy_formation_[j].init[i].y = y3; + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE; + enemy_formation_[j].init[i].kind = BALLOON_3; + enemy_formation_[j].init[i].creation_counter = creationTime - (incTime * i); } // #06 - Tres enemigos BALLOON3. 0, 0, 0. Hacia la derecha j = 6; - enemyFormation[j].numberOfEnemies = 3; + enemy_formation_[j].number_of_enemies = 3; incX = BALLOON_WIDTH_3 + 1; incTime = 10; - for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemy_formation_[j].number_of_enemies; 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); + enemy_formation_[j].init[i].x = x3_0 + (i * incX); + enemy_formation_[j].init[i].y = y3; + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE; + enemy_formation_[j].init[i].kind = BALLOON_3; + enemy_formation_[j].init[i].creation_counter = creationTime - (incTime * i); } // #07 - Tres enemigos BALLOON3. 100, 100, 100. Hacia la izquierda j = 7; - enemyFormation[j].numberOfEnemies = 3; + enemy_formation_[j].number_of_enemies = 3; incX = BALLOON_WIDTH_3 + 1; incTime = 10; - for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemy_formation_[j].number_of_enemies; 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); + enemy_formation_[j].init[i].x = x3_100 - (i * incX); + enemy_formation_[j].init[i].y = y3; + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE; + enemy_formation_[j].init[i].kind = BALLOON_3; + enemy_formation_[j].init[i].creation_counter = creationTime - (incTime * i); } // #08 - Seis enemigos BALLOON1. 0, 0, 0, 0, 0, 0. Hacia la derecha j = 8; - enemyFormation[j].numberOfEnemies = 6; + enemy_formation_[j].number_of_enemies = 6; incX = BALLOON_WIDTH_1 + 1; incTime = 10; - for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemy_formation_[j].number_of_enemies; 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); + enemy_formation_[j].init[i].x = x1_0 + (i * incX); + enemy_formation_[j].init[i].y = y1; + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE; + enemy_formation_[j].init[i].kind = BALLOON_1; + enemy_formation_[j].init[i].creation_counter = creationTime - (incTime * i); } // #09 - Seis enemigos BALLOON1. 100, 100, 100, 100, 100, 100. Hacia la izquierda j = 9; - enemyFormation[j].numberOfEnemies = 6; + enemy_formation_[j].number_of_enemies = 6; incX = BALLOON_WIDTH_1 + 1; incTime = 10; - for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemy_formation_[j].number_of_enemies; 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); + enemy_formation_[j].init[i].x = x1_100 - (i * incX); + enemy_formation_[j].init[i].y = y1; + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE; + enemy_formation_[j].init[i].kind = BALLOON_1; + enemy_formation_[j].init[i].creation_counter = creationTime - (incTime * i); } // #10 - Tres enemigos BALLOON4 seguidos desde la izquierda j = 10; - enemyFormation[j].numberOfEnemies = 3; + enemy_formation_[j].number_of_enemies = 3; incX = BALLOON_WIDTH_4 + 1; incTime = 15; - for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemy_formation_[j].number_of_enemies; 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); + enemy_formation_[j].init[i].x = x4_0 + (i * incX); + enemy_formation_[j].init[i].y = y4; + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE; + enemy_formation_[j].init[i].kind = BALLOON_4; + enemy_formation_[j].init[i].creation_counter = creationTime - (incTime * i); } // #11 - Tres enemigos BALLOON4 seguidos desde la derecha j = 11; - enemyFormation[j].numberOfEnemies = 3; + enemy_formation_[j].number_of_enemies = 3; incX = BALLOON_WIDTH_4 + 1; incTime = 15; - for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemy_formation_[j].number_of_enemies; 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); + enemy_formation_[j].init[i].x = x4_100 - (i * incX); + enemy_formation_[j].init[i].y = y4; + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE; + enemy_formation_[j].init[i].kind = BALLOON_4; + enemy_formation_[j].init[i].creation_counter = creationTime - (incTime * i); } // #12 - Seis enemigos BALLOON2 uno detras del otro. A la izquierda y hacia el centro j = 12; - enemyFormation[j].numberOfEnemies = 6; + enemy_formation_[j].number_of_enemies = 6; incX = BALLOON_WIDTH_2 + 1; incTime = 10; - for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemy_formation_[j].number_of_enemies; 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); + enemy_formation_[j].init[i].x = x2_0 + (i * incX); + enemy_formation_[j].init[i].y = y2; + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE; + enemy_formation_[j].init[i].kind = BALLOON_2; + enemy_formation_[j].init[i].creation_counter = creationTime - (incTime * i); } // #13 - Seis enemigos BALLOON2 uno detras del otro. A la derecha y hacia el centro j = 13; - enemyFormation[j].numberOfEnemies = 6; + enemy_formation_[j].number_of_enemies = 6; incX = BALLOON_WIDTH_2 + 1; incTime = 10; - for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemy_formation_[j].number_of_enemies; 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); + enemy_formation_[j].init[i].x = x2_100 - (i * incX); + enemy_formation_[j].init[i].y = y2; + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE; + enemy_formation_[j].init[i].kind = BALLOON_2; + enemy_formation_[j].init[i].creation_counter = creationTime - (incTime * i); } // #14 - Cinco enemigos BALLOON3. Hacia la derecha. Separados j = 14; - enemyFormation[j].numberOfEnemies = 5; + enemy_formation_[j].number_of_enemies = 5; incX = BALLOON_WIDTH_3 * 2; incTime = 10; - for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemy_formation_[j].number_of_enemies; 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); + enemy_formation_[j].init[i].x = x3_0 + (i * incX); + enemy_formation_[j].init[i].y = y3; + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE; + enemy_formation_[j].init[i].kind = BALLOON_3; + enemy_formation_[j].init[i].creation_counter = creationTime - (incTime * i); } // #15 - Cinco enemigos BALLOON3. Hacia la izquierda. Separados j = 15; - enemyFormation[j].numberOfEnemies = 5; + enemy_formation_[j].number_of_enemies = 5; incX = BALLOON_WIDTH_3 * 2; incTime = 10; - for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemy_formation_[j].number_of_enemies; 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); + enemy_formation_[j].init[i].x = x3_100 - (i * incX); + enemy_formation_[j].init[i].y = y3; + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE; + enemy_formation_[j].init[i].kind = BALLOON_3; + enemy_formation_[j].init[i].creation_counter = creationTime - (incTime * i); } // #16 - Cinco enemigos BALLOON3. Hacia la derecha. Juntos j = 16; - enemyFormation[j].numberOfEnemies = 5; + enemy_formation_[j].number_of_enemies = 5; incX = BALLOON_WIDTH_3 + 1; incTime = 10; - for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemy_formation_[j].number_of_enemies; 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); + enemy_formation_[j].init[i].x = x3_0 + (i * incX); + enemy_formation_[j].init[i].y = y3; + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE; + enemy_formation_[j].init[i].kind = BALLOON_3; + enemy_formation_[j].init[i].creation_counter = creationTime - (incTime * i); } // #17 - Cinco enemigos BALLOON3. Hacia la izquierda. Juntos j = 17; - enemyFormation[j].numberOfEnemies = 5; + enemy_formation_[j].number_of_enemies = 5; incX = BALLOON_WIDTH_3 + 1; incTime = 10; - for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemy_formation_[j].number_of_enemies; 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); + enemy_formation_[j].init[i].x = x3_100 - (i * incX); + enemy_formation_[j].init[i].y = y3; + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE; + enemy_formation_[j].init[i].kind = BALLOON_3; + enemy_formation_[j].init[i].creation_counter = creationTime - (incTime * i); } // #18 - Doce enemigos BALLOON1. Hacia la derecha. Juntos j = 18; - enemyFormation[j].numberOfEnemies = 12; + enemy_formation_[j].number_of_enemies = 12; incX = BALLOON_WIDTH_1 + 1; incTime = 10; - for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemy_formation_[j].number_of_enemies; 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); + enemy_formation_[j].init[i].x = x1_0 + (i * incX); + enemy_formation_[j].init[i].y = y1; + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE; + enemy_formation_[j].init[i].kind = BALLOON_1; + enemy_formation_[j].init[i].creation_counter = creationTime - (incTime * i); } // #19 - Doce enemigos BALLOON1. Hacia la izquierda. Juntos j = 19; - enemyFormation[j].numberOfEnemies = 12; + enemy_formation_[j].number_of_enemies = 12; incX = BALLOON_WIDTH_1 + 1; incTime = 10; - for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemy_formation_[j].number_of_enemies; 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); + enemy_formation_[j].init[i].x = x1_100 - (i * incX); + enemy_formation_[j].init[i].y = y1; + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE; + enemy_formation_[j].init[i].kind = BALLOON_1; + enemy_formation_[j].init[i].creation_counter = creationTime - (incTime * i); } // #20 - Dos enemigos BALLOON4 seguidos desde la izquierda/derecha. Simetricos j = 20; - enemyFormation[j].numberOfEnemies = 4; + enemy_formation_[j].number_of_enemies = 4; incX = BALLOON_WIDTH_4 + 1; incTime = 0; - for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemy_formation_[j].number_of_enemies; i++) { - const int half = enemyFormation[j].numberOfEnemies / 2; + const int half = enemy_formation_[j].number_of_enemies / 2; if (i < half) { - enemyFormation[j].init[i].x = x4_0 + (i * incX); - enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; + enemy_formation_[j].init[i].x = x4_0 + (i * incX); + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE; } else { - enemyFormation[j].init[i].x = x4_100 - ((i - half) * incX); - enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; + enemy_formation_[j].init[i].x = x4_100 - ((i - half) * incX); + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE; } - enemyFormation[j].init[i].y = y4; - enemyFormation[j].init[i].kind = BALLOON_4; - enemyFormation[j].init[i].creationCounter = creationTime + (incTime * i); + enemy_formation_[j].init[i].y = y4; + enemy_formation_[j].init[i].kind = BALLOON_4; + enemy_formation_[j].init[i].creation_counter = creationTime + (incTime * i); } // #21 - Diez enemigos BALLOON2 uno detras del otro. Izquierda/derecha. Simetricos j = 21; - enemyFormation[j].numberOfEnemies = 10; + enemy_formation_[j].number_of_enemies = 10; incX = BALLOON_WIDTH_2 + 1; incTime = 3; - for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemy_formation_[j].number_of_enemies; i++) { - const int half = enemyFormation[j].numberOfEnemies / 2; + const int half = enemy_formation_[j].number_of_enemies / 2; if (i < half) { - 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); + enemy_formation_[j].init[i].x = x2_0 + (i * incX); + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE; + enemy_formation_[j].init[i].creation_counter = (creationTime) - (incTime * i); } else { - 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)); + enemy_formation_[j].init[i].x = x2_100 - ((i - half) * incX); + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE; + enemy_formation_[j].init[i].creation_counter = (creationTime) - (incTime * (i - half)); } - enemyFormation[j].init[i].y = y2; - enemyFormation[j].init[i].kind = BALLOON_2; + enemy_formation_[j].init[i].y = y2; + enemy_formation_[j].init[i].kind = BALLOON_2; } // #22 - Diez enemigos BALLOON3. Hacia la derecha/izquierda. Separados. Simetricos j = 22; - enemyFormation[j].numberOfEnemies = 10; + enemy_formation_[j].number_of_enemies = 10; incX = BALLOON_WIDTH_3 * 2; incTime = 10; - for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemy_formation_[j].number_of_enemies; i++) { - const int half = enemyFormation[j].numberOfEnemies / 2; + const int half = enemy_formation_[j].number_of_enemies / 2; if (i < half) { - 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); + enemy_formation_[j].init[i].x = x3_0 + (i * incX); + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE; + enemy_formation_[j].init[i].creation_counter = (creationTime) - (incTime * i); } else { - 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)); + enemy_formation_[j].init[i].x = x3_100 - ((i - half) * incX); + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE; + enemy_formation_[j].init[i].creation_counter = (creationTime) - (incTime * (i - half)); } - enemyFormation[j].init[i].y = y3; - enemyFormation[j].init[i].kind = BALLOON_3; + enemy_formation_[j].init[i].y = y3; + enemy_formation_[j].init[i].kind = BALLOON_3; } // #23 - Diez enemigos BALLOON3. Hacia la derecha. Juntos. Simetricos j = 23; - enemyFormation[j].numberOfEnemies = 10; + enemy_formation_[j].number_of_enemies = 10; incX = BALLOON_WIDTH_3 + 1; incTime = 10; - for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemy_formation_[j].number_of_enemies; i++) { - const int half = enemyFormation[j].numberOfEnemies / 2; + const int half = enemy_formation_[j].number_of_enemies / 2; if (i < half) { - 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); + enemy_formation_[j].init[i].x = x3_0 + (i * incX); + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE; + enemy_formation_[j].init[i].creation_counter = (creationTime) - (incTime * i); } else { - 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)); + enemy_formation_[j].init[i].x = x3_100 - ((i - half) * incX); + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE; + enemy_formation_[j].init[i].creation_counter = (creationTime) - (incTime * (i - half)); } - enemyFormation[j].init[i].y = y3; - enemyFormation[j].init[i].kind = BALLOON_3; + enemy_formation_[j].init[i].y = y3; + enemy_formation_[j].init[i].kind = BALLOON_3; } // #24 - Treinta enemigos BALLOON1. Del centro hacia los extremos. Juntos. Simetricos j = 24; - enemyFormation[j].numberOfEnemies = 30; + enemy_formation_[j].number_of_enemies = 30; incX = 0; incTime = 5; - for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemy_formation_[j].number_of_enemies; i++) { - const int half = enemyFormation[j].numberOfEnemies / 2; + const int half = enemy_formation_[j].number_of_enemies / 2; if (i < half) { - enemyFormation[j].init[i].x = x1_50; - enemyFormation[j].init[i].velX = BALLOON_VELX_POSITIVE; - enemyFormation[j].init[i].creationCounter = (creationTime) + (incTime * i); + enemy_formation_[j].init[i].x = x1_50; + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE; + enemy_formation_[j].init[i].creation_counter = (creationTime) + (incTime * i); } else { - enemyFormation[j].init[i].x = x1_50; - enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; - enemyFormation[j].init[i].creationCounter = (creationTime) + (incTime * (i - half)); + enemy_formation_[j].init[i].x = x1_50; + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE; + enemy_formation_[j].init[i].creation_counter = (creationTime) + (incTime * (i - half)); } - enemyFormation[j].init[i].y = y1; - enemyFormation[j].init[i].kind = BALLOON_1; + enemy_formation_[j].init[i].y = y1; + enemy_formation_[j].init[i].kind = BALLOON_1; } // #25 - Treinta enemigos BALLOON1. Del centro hacia adentro. Juntos. Simetricos j = 25; - enemyFormation[j].numberOfEnemies = 30; + enemy_formation_[j].number_of_enemies = 30; incX = BALLOON_WIDTH_1 + 1; incTime = 5; - for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++) + for (int i = 0; i < enemy_formation_[j].number_of_enemies; i++) { - const int half = enemyFormation[j].numberOfEnemies / 2; + const int half = enemy_formation_[j].number_of_enemies / 2; if (i < half) { - enemyFormation[j].init[i].x = x1_50 + 20; - enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE; - enemyFormation[j].init[i].creationCounter = (creationTime) - (incTime * i); + enemy_formation_[j].init[i].x = x1_50 + 20; + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE; + enemy_formation_[j].init[i].creation_counter = (creationTime) - (incTime * i); } else { - 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)); + enemy_formation_[j].init[i].x = x1_50 - 20; + enemy_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE; + enemy_formation_[j].init[i].creation_counter = (creationTime) - (incTime * (i - half)); } - enemyFormation[j].init[i].y = y1; - enemyFormation[j].init[i].kind = BALLOON_1; + enemy_formation_[j].init[i].y = y1; + enemy_formation_[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++) { - enemyFormation[k + 50].numberOfEnemies = enemyFormation[k].numberOfEnemies; - for (int i = 0; i < enemyFormation[k + 50].numberOfEnemies; i++) + enemy_formation_[k + 50].number_of_enemies = enemy_formation_[k].number_of_enemies; + for (int i = 0; i < enemy_formation_[k + 50].number_of_enemies; i++) { - 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; + enemy_formation_[k + 50].init[i].x = enemy_formation_[k].init[i].x; + enemy_formation_[k + 50].init[i].y = enemy_formation_[k].init[i].y; + enemy_formation_[k + 50].init[i].vel_x = enemy_formation_[k].init[i].vel_x; + enemy_formation_[k + 50].init[i].creation_counter = enemy_formation_[k].init[i].creation_counter; + enemy_formation_[k + 50].init[i].kind = enemy_formation_[k].init[i].kind + 4; } } // TEST - enemyFormation[99].numberOfEnemies = 4; + enemy_formation_[99].number_of_enemies = 4; - 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; + enemy_formation_[99].init[0].x = 10; + enemy_formation_[99].init[0].y = y1; + enemy_formation_[99].init[0].vel_x = 0; + enemy_formation_[99].init[0].kind = BALLOON_1; + enemy_formation_[99].init[0].creation_counter = 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; + enemy_formation_[99].init[1].x = 50; + enemy_formation_[99].init[1].y = y1; + enemy_formation_[99].init[1].vel_x = 0; + enemy_formation_[99].init[1].kind = BALLOON_2; + enemy_formation_[99].init[1].creation_counter = 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; + enemy_formation_[99].init[2].x = 90; + enemy_formation_[99].init[2].y = y1; + enemy_formation_[99].init[2].vel_x = 0; + enemy_formation_[99].init[2].kind = BALLOON_3; + enemy_formation_[99].init[2].creation_counter = 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; + enemy_formation_[99].init[3].x = 140; + enemy_formation_[99].init[3].y = y1; + enemy_formation_[99].init[3].vel_x = 0; + enemy_formation_[99].init[3].kind = BALLOON_4; + enemy_formation_[99].init[3].creation_counter = 200; } // Inicializa los conjuntos de formaciones void EnemyFormations::initEnemyPools() { // EnemyPool #0 - 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]; + enemy_pool_[0].set[0] = &enemy_formation_[0]; + enemy_pool_[0].set[1] = &enemy_formation_[1]; + enemy_pool_[0].set[2] = &enemy_formation_[2]; + enemy_pool_[0].set[3] = &enemy_formation_[3]; + enemy_pool_[0].set[4] = &enemy_formation_[4]; + enemy_pool_[0].set[5] = &enemy_formation_[5]; + enemy_pool_[0].set[6] = &enemy_formation_[6]; + enemy_pool_[0].set[7] = &enemy_formation_[7]; + enemy_pool_[0].set[8] = &enemy_formation_[8]; + enemy_pool_[0].set[9] = &enemy_formation_[9]; // EnemyPool #1 - 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]; + enemy_pool_[1].set[0] = &enemy_formation_[10]; + enemy_pool_[1].set[1] = &enemy_formation_[11]; + enemy_pool_[1].set[2] = &enemy_formation_[12]; + enemy_pool_[1].set[3] = &enemy_formation_[13]; + enemy_pool_[1].set[4] = &enemy_formation_[14]; + enemy_pool_[1].set[5] = &enemy_formation_[15]; + enemy_pool_[1].set[6] = &enemy_formation_[16]; + enemy_pool_[1].set[7] = &enemy_formation_[17]; + enemy_pool_[1].set[8] = &enemy_formation_[18]; + enemy_pool_[1].set[9] = &enemy_formation_[19]; // EnemyPool #2 - 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]; + enemy_pool_[2].set[0] = &enemy_formation_[0]; + enemy_pool_[2].set[1] = &enemy_formation_[1]; + enemy_pool_[2].set[2] = &enemy_formation_[2]; + enemy_pool_[2].set[3] = &enemy_formation_[3]; + enemy_pool_[2].set[4] = &enemy_formation_[4]; + enemy_pool_[2].set[5] = &enemy_formation_[55]; + enemy_pool_[2].set[6] = &enemy_formation_[56]; + enemy_pool_[2].set[7] = &enemy_formation_[57]; + enemy_pool_[2].set[8] = &enemy_formation_[58]; + enemy_pool_[2].set[9] = &enemy_formation_[59]; // EnemyPool #3 - 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]; + enemy_pool_[3].set[0] = &enemy_formation_[50]; + enemy_pool_[3].set[1] = &enemy_formation_[51]; + enemy_pool_[3].set[2] = &enemy_formation_[52]; + enemy_pool_[3].set[3] = &enemy_formation_[53]; + enemy_pool_[3].set[4] = &enemy_formation_[54]; + enemy_pool_[3].set[5] = &enemy_formation_[5]; + enemy_pool_[3].set[6] = &enemy_formation_[6]; + enemy_pool_[3].set[7] = &enemy_formation_[7]; + enemy_pool_[3].set[8] = &enemy_formation_[8]; + enemy_pool_[3].set[9] = &enemy_formation_[9]; // EnemyPool #4 - 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]; + enemy_pool_[4].set[0] = &enemy_formation_[60]; + enemy_pool_[4].set[1] = &enemy_formation_[61]; + enemy_pool_[4].set[2] = &enemy_formation_[62]; + enemy_pool_[4].set[3] = &enemy_formation_[63]; + enemy_pool_[4].set[4] = &enemy_formation_[64]; + enemy_pool_[4].set[5] = &enemy_formation_[65]; + enemy_pool_[4].set[6] = &enemy_formation_[66]; + enemy_pool_[4].set[7] = &enemy_formation_[67]; + enemy_pool_[4].set[8] = &enemy_formation_[68]; + enemy_pool_[4].set[9] = &enemy_formation_[69]; // EnemyPool #5 - 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]; + enemy_pool_[5].set[0] = &enemy_formation_[10]; + enemy_pool_[5].set[1] = &enemy_formation_[61]; + enemy_pool_[5].set[2] = &enemy_formation_[12]; + enemy_pool_[5].set[3] = &enemy_formation_[63]; + enemy_pool_[5].set[4] = &enemy_formation_[14]; + enemy_pool_[5].set[5] = &enemy_formation_[65]; + enemy_pool_[5].set[6] = &enemy_formation_[16]; + enemy_pool_[5].set[7] = &enemy_formation_[67]; + enemy_pool_[5].set[8] = &enemy_formation_[18]; + enemy_pool_[5].set[9] = &enemy_formation_[69]; // EnemyPool #6 - 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]; + enemy_pool_[6].set[0] = &enemy_formation_[60]; + enemy_pool_[6].set[1] = &enemy_formation_[11]; + enemy_pool_[6].set[2] = &enemy_formation_[62]; + enemy_pool_[6].set[3] = &enemy_formation_[13]; + enemy_pool_[6].set[4] = &enemy_formation_[64]; + enemy_pool_[6].set[5] = &enemy_formation_[15]; + enemy_pool_[6].set[6] = &enemy_formation_[66]; + enemy_pool_[6].set[7] = &enemy_formation_[17]; + enemy_pool_[6].set[8] = &enemy_formation_[68]; + enemy_pool_[6].set[9] = &enemy_formation_[19]; // EnemyPool #7 - 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]; + enemy_pool_[7].set[0] = &enemy_formation_[20]; + enemy_pool_[7].set[1] = &enemy_formation_[21]; + enemy_pool_[7].set[2] = &enemy_formation_[22]; + enemy_pool_[7].set[3] = &enemy_formation_[23]; + enemy_pool_[7].set[4] = &enemy_formation_[24]; + enemy_pool_[7].set[5] = &enemy_formation_[65]; + enemy_pool_[7].set[6] = &enemy_formation_[66]; + enemy_pool_[7].set[7] = &enemy_formation_[67]; + enemy_pool_[7].set[8] = &enemy_formation_[68]; + enemy_pool_[7].set[9] = &enemy_formation_[69]; // EnemyPool #8 - 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]; + enemy_pool_[8].set[0] = &enemy_formation_[70]; + enemy_pool_[8].set[1] = &enemy_formation_[71]; + enemy_pool_[8].set[2] = &enemy_formation_[72]; + enemy_pool_[8].set[3] = &enemy_formation_[73]; + enemy_pool_[8].set[4] = &enemy_formation_[74]; + enemy_pool_[8].set[5] = &enemy_formation_[15]; + enemy_pool_[8].set[6] = &enemy_formation_[16]; + enemy_pool_[8].set[7] = &enemy_formation_[17]; + enemy_pool_[8].set[8] = &enemy_formation_[18]; + enemy_pool_[8].set[9] = &enemy_formation_[19]; // EnemyPool #9 - 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]; + enemy_pool_[9].set[0] = &enemy_formation_[20]; + enemy_pool_[9].set[1] = &enemy_formation_[21]; + enemy_pool_[9].set[2] = &enemy_formation_[22]; + enemy_pool_[9].set[3] = &enemy_formation_[23]; + enemy_pool_[9].set[4] = &enemy_formation_[24]; + enemy_pool_[9].set[5] = &enemy_formation_[70]; + enemy_pool_[9].set[6] = &enemy_formation_[71]; + enemy_pool_[9].set[7] = &enemy_formation_[72]; + enemy_pool_[9].set[8] = &enemy_formation_[73]; + enemy_pool_[9].set[9] = &enemy_formation_[74]; } // Inicializa las fases del juego void EnemyFormations::initGameStages() { // STAGE 1 - stage[0].number = 1; - stage[0].powerToComplete = 200; - stage[0].minMenace = 7 + (4 * 1); - stage[0].maxMenace = 7 + (4 * 3); - stage[0].enemyPool = &enemyPool[0]; + stage_[0].number = 1; + stage_[0].power_to_complete = 200; + stage_[0].min_menace = 7 + (4 * 1); + stage_[0].max_menace = 7 + (4 * 3); + stage_[0].enemy_pool = &enemy_pool_[0]; // STAGE 2 - stage[1].number = 2; - stage[1].powerToComplete = 300; - stage[1].minMenace = 7 + (4 * 2); - stage[1].maxMenace = 7 + (4 * 4); - stage[1].enemyPool = &enemyPool[1]; + stage_[1].number = 2; + stage_[1].power_to_complete = 300; + stage_[1].min_menace = 7 + (4 * 2); + stage_[1].max_menace = 7 + (4 * 4); + stage_[1].enemy_pool = &enemy_pool_[1]; // STAGE 3 - stage[2].number = 3; - stage[2].powerToComplete = 600; - stage[2].minMenace = 7 + (4 * 3); - stage[2].maxMenace = 7 + (4 * 5); - stage[2].enemyPool = &enemyPool[2]; + stage_[2].number = 3; + stage_[2].power_to_complete = 600; + stage_[2].min_menace = 7 + (4 * 3); + stage_[2].max_menace = 7 + (4 * 5); + stage_[2].enemy_pool = &enemy_pool_[2]; // STAGE 4 - stage[3].number = 4; - stage[3].powerToComplete = 600; - stage[3].minMenace = 7 + (4 * 3); - stage[3].maxMenace = 7 + (4 * 5); - stage[3].enemyPool = &enemyPool[3]; + stage_[3].number = 4; + stage_[3].power_to_complete = 600; + stage_[3].min_menace = 7 + (4 * 3); + stage_[3].max_menace = 7 + (4 * 5); + stage_[3].enemy_pool = &enemy_pool_[3]; // STAGE 5 - stage[4].number = 5; - stage[4].powerToComplete = 600; - stage[4].minMenace = 7 + (4 * 4); - stage[4].maxMenace = 7 + (4 * 6); - stage[4].enemyPool = &enemyPool[4]; + stage_[4].number = 5; + stage_[4].power_to_complete = 600; + stage_[4].min_menace = 7 + (4 * 4); + stage_[4].max_menace = 7 + (4 * 6); + stage_[4].enemy_pool = &enemy_pool_[4]; // STAGE 6 - stage[5].number = 6; - stage[5].powerToComplete = 600; - stage[5].minMenace = 7 + (4 * 4); - stage[5].maxMenace = 7 + (4 * 6); - stage[5].enemyPool = &enemyPool[5]; + stage_[5].number = 6; + stage_[5].power_to_complete = 600; + stage_[5].min_menace = 7 + (4 * 4); + stage_[5].max_menace = 7 + (4 * 6); + stage_[5].enemy_pool = &enemy_pool_[5]; // STAGE 7 - stage[6].number = 7; - stage[6].powerToComplete = 650; - stage[6].minMenace = 7 + (4 * 5); - stage[6].maxMenace = 7 + (4 * 7); - stage[6].enemyPool = &enemyPool[6]; + stage_[6].number = 7; + stage_[6].power_to_complete = 650; + stage_[6].min_menace = 7 + (4 * 5); + stage_[6].max_menace = 7 + (4 * 7); + stage_[6].enemy_pool = &enemy_pool_[6]; // STAGE 8 - stage[7].number = 8; - stage[7].powerToComplete = 750; - stage[7].minMenace = 7 + (4 * 5); - stage[7].maxMenace = 7 + (4 * 7); - stage[7].enemyPool = &enemyPool[7]; + stage_[7].number = 8; + stage_[7].power_to_complete = 750; + stage_[7].min_menace = 7 + (4 * 5); + stage_[7].max_menace = 7 + (4 * 7); + stage_[7].enemy_pool = &enemy_pool_[7]; // STAGE 9 - stage[8].number = 9; - stage[8].powerToComplete = 850; - stage[8].minMenace = 7 + (4 * 6); - stage[8].maxMenace = 7 + (4 * 8); - stage[8].enemyPool = &enemyPool[8]; + stage_[8].number = 9; + stage_[8].power_to_complete = 850; + stage_[8].min_menace = 7 + (4 * 6); + stage_[8].max_menace = 7 + (4 * 8); + stage_[8].enemy_pool = &enemy_pool_[8]; // STAGE 10 - stage[9].number = 10; - stage[9].powerToComplete = 950; - stage[9].minMenace = 7 + (4 * 7); - stage[9].maxMenace = 7 + (4 * 10); - stage[9].enemyPool = &enemyPool[9]; + stage_[9].number = 10; + stage_[9].power_to_complete = 950; + stage_[9].min_menace = 7 + (4 * 7); + stage_[9].max_menace = 7 + (4 * 10); + stage_[9].enemy_pool = &enemy_pool_[9]; } // Devuelve una fase -stage_t EnemyFormations::getStage(int index) const +Stage EnemyFormations::getStage(int index) const { - return stage[index]; + return stage_[index]; } \ No newline at end of file diff --git a/source/enemy_formations.h b/source/enemy_formations.h index 704ae6a..5d8c4a1 100644 --- a/source/enemy_formations.h +++ b/source/enemy_formations.h @@ -1,36 +1,36 @@ #pragma once -#define NUMBER_OF_ENEMY_FORMATIONS 100 -#define MAX_NUMBER_OF_ENEMIES_IN_A_FORMATION 50 +constexpr int NUMBER_OF_ENEMY_FORMATIONS = 100; +constexpr int MAX_NUMBER_OF_ENEMIES_IN_A_FORMATION = 50; // Estructuras -struct enemyInits_t +struct EnemyFormationInit { - int x; // Posición en el eje X donde crear al enemigo - int y; // Posición en el eje Y donde crear al enemigo - float velX; // Velocidad inicial en el eje X - int kind; // Tipo de enemigo - int creationCounter; // Temporizador para la creación del enemigo + int x; // Posición en el eje X donde crear al enemigo + int y; // Posición en el eje Y donde crear al enemigo + float vel_x; // Velocidad inicial en el eje X + int kind; // Tipo de enemigo + int creation_counter; // Temporizador para la creación del enemigo }; -struct enemyFormation_t // Contiene la información de una formación enemiga +struct EnemyFormationUnit // Contiene la información de una formación enemiga { - int numberOfEnemies; // Cantidad de enemigos que forman la formación - enemyInits_t init[MAX_NUMBER_OF_ENEMIES_IN_A_FORMATION]; // Vector con todas las inicializaciones de los enemigos de la formación + int number_of_enemies; // Cantidad de enemigos que forman la formación + EnemyFormationInit init[MAX_NUMBER_OF_ENEMIES_IN_A_FORMATION]; // Vector con todas las inicializaciones de los enemigos de la formación }; -struct enemyPool_t +struct EnemyFormationPool { - enemyFormation_t *set[10]; // Conjunto de formaciones enemigas + EnemyFormationUnit *set[10]; // Conjunto de formaciones enemigas }; -struct stage_t // Contiene todas las variables relacionadas con una fase +struct Stage // Contiene todas las variables relacionadas con una fase { - enemyPool_t *enemyPool; // El conjunto de formaciones enemigas de la fase - int powerToComplete; // Cantidad de poder que se necesita para completar la fase - int maxMenace; // Umbral máximo de amenaza de la fase - int minMenace; // Umbral mínimo de amenaza de la fase - int number; // Número de fase + EnemyFormationPool *enemy_pool; // El conjunto de formaciones enemigas de la fase + int power_to_complete; // Cantidad de poder que se necesita para completar la fase + int max_menace; // Umbral máximo de amenaza de la fase + int min_menace; // Umbral mínimo de amenaza de la fase + int number; // Número de fase }; // Clase EnemyFormations, para gestionar las formaciones enemigas @@ -38,9 +38,9 @@ class EnemyFormations { private: // Variables - stage_t stage[10]; // Variable con los datos de cada pantalla - 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 + Stage stage_[10]; // Variable con los datos de cada pantalla + EnemyFormationUnit enemy_formation_[NUMBER_OF_ENEMY_FORMATIONS]; // Vector con todas las formaciones enemigas + EnemyFormationPool enemy_pool_[10]; // Variable con los diferentes conjuntos de formaciones enemigas // Inicializa las formaciones enemigas void initEnemyFormations(); @@ -59,5 +59,5 @@ public: ~EnemyFormations() = default; // Devuelve una fase - stage_t getStage(int index) const; + Stage getStage(int index) const; }; \ No newline at end of file diff --git a/source/enter_name.cpp b/source/enter_name.cpp index a6c3174..acd24d9 100644 --- a/source/enter_name.cpp +++ b/source/enter_name.cpp @@ -11,12 +11,12 @@ EnterName::EnterName() void EnterName::init() { // Obtiene el puntero al nombre - name = "A"; + name_ = "A"; // Inicia la lista de caracteres permitidos - characterList = " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-+-*/=?¿<>!\"#$%&/()"; - pos = 0; - numCharacters = (int)characterList.size(); + character_list_ = " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-+-*/=?¿<>!\"#$%&/()"; + pos_ = 0; + num_characters_ = (int)character_list_.size(); // Pone la lista de indices para que refleje el nombre updateCharacterIndex(); @@ -28,24 +28,24 @@ void EnterName::init() // Incrementa la posición void EnterName::incPos() { - pos++; - pos = std::min(pos, NAME_LENGHT - 1); + pos_++; + pos_ = std::min(pos_, NAME_LENGHT - 1); } // Decrementa la posición void EnterName::decPos() { - pos--; - pos = std::max(pos, 0); + pos_--; + pos_ = std::max(pos_, 0); } // Incrementa el índice void EnterName::incIndex() { - ++characterIndex[pos]; - if (characterIndex[pos] >= numCharacters) + ++character_index_[pos_]; + if (character_index_[pos_] >= num_characters_) { - characterIndex[pos] = 0; + character_index_[pos_] = 0; } updateName(); } @@ -53,10 +53,10 @@ void EnterName::incIndex() // Decrementa el índice void EnterName::decIndex() { - --characterIndex[pos]; - if (characterIndex[pos] < 0) + --character_index_[pos_]; + if (character_index_[pos_] < 0) { - characterIndex[pos] = numCharacters - 1; + character_index_[pos_] = num_characters_ - 1; } updateName(); } @@ -64,10 +64,10 @@ void EnterName::decIndex() // Actualiza la variable void EnterName::updateName() { - name.clear(); + name_.clear(); for (int i = 0; i < NAME_LENGHT; ++i) { - name.push_back(characterList[characterIndex[i]]); + name_.push_back(character_list_[character_index_[i]]); } } @@ -77,22 +77,22 @@ void EnterName::updateCharacterIndex() // Rellena de espacios for (int i = 0; i < NAME_LENGHT; ++i) { - characterIndex[i] = 0; + character_index_[i] = 0; } // Coloca los índices en funcion de los caracteres que forman el nombre - for (int i = 0; i < (int)name.size(); ++i) + for (int i = 0; i < (int)name_.size(); ++i) { - characterIndex[i] = findIndex(name.at(i)); + character_index_[i] = findIndex(name_.at(i)); } } -// Encuentra el indice de un caracter en "characterList" +// Encuentra el indice de un caracter en "character_list_" int EnterName::findIndex(char character) { - for (int i = 0; i < (int)characterList.size(); ++i) + for (int i = 0; i < (int)character_list_.size(); ++i) { - if (character == characterList[i]) + if (character == character_list_[i]) { return i; } @@ -103,11 +103,11 @@ int EnterName::findIndex(char character) // Obtiene el nombre std::string EnterName::getName() const { - return name; + return name_; } // Obtiene la posición que se está editando int EnterName::getPos() const { - return pos; + return pos_; } \ No newline at end of file diff --git a/source/enter_name.h b/source/enter_name.h index 114f42c..238cdc5 100644 --- a/source/enter_name.h +++ b/source/enter_name.h @@ -2,7 +2,7 @@ #include -#define NAME_LENGHT 8 +constexpr int NAME_LENGHT = 8; /* Un array, "characterList", contiene la lista de caracteres @@ -16,11 +16,11 @@ class EnterName { private: - std::string characterList; // Lista de todos los caracteres permitidos - std::string name; // Nombre introducido - int pos; // Posición a editar del nombre - int numCharacters; // Cantidad de caracteres de la lista de caracteres - int characterIndex[NAME_LENGHT]; // Indice de la lista para cada uno de los caracteres que forman el nombre + std::string character_list_; // Lista de todos los caracteres permitidos + std::string name_; // Nombre introducido + int pos_; // Posición a editar del nombre + int num_characters_; // Cantidad de caracteres de la lista de caracteres + int character_index_[NAME_LENGHT]; // Indice de la lista para cada uno de los caracteres que forman el nombre // Actualiza la variable void updateName(); diff --git a/source/explosions.cpp b/source/explosions.cpp index 843a1c8..1321900 100644 --- a/source/explosions.cpp +++ b/source/explosions.cpp @@ -1,24 +1,24 @@ #include "explosions.h" -#include "animated_sprite.h" // for AnimatedSprite +#include "animated_sprite.h" // for AnimatedSprite class Texture; // Constructor Explosions::Explosions() { - textures.clear(); - explosions.clear(); + textures_.clear(); + explosions_.clear(); } // Destructor Explosions::~Explosions() { - explosions.clear(); + explosions_.clear(); } // Actualiza la lógica de la clase void Explosions::update() { - for (auto &explosion : explosions) + for (auto &explosion : explosions_) { explosion->update(); } @@ -30,7 +30,7 @@ void Explosions::update() // Dibuja el objeto en pantalla void Explosions::render() { - for (auto &explosion : explosions) + for (auto &explosion : explosions_) { explosion->render(); } @@ -39,32 +39,32 @@ void Explosions::render() // Añade texturas al objeto void Explosions::addTexture(int size, std::shared_ptr texture, std::vector *animation) { - explosion_texture_t temp; + ExplosionTexture temp; temp.size = size; temp.texture = texture; temp.animation = animation; - textures.push_back(temp); + textures_.push_back(temp); } // Añade una explosión void Explosions::add(int x, int y, int size) { const int index = getIndexBySize(size); - auto sprite = std::make_unique(textures[index].texture, "", textures[index].animation); + auto sprite = std::make_unique(textures_[index].texture, "", textures_[index].animation); sprite->setPos(x, y); - explosions.push_back(std::move(sprite)); + explosions_.push_back(std::move(sprite)); } // Vacia el vector de elementos finalizados void Explosions::freeExplosions() { - if (explosions.empty() == false) + if (explosions_.empty() == false) { - for (int i = explosions.size() - 1; i >= 0; --i) + for (int i = explosions_.size() - 1; i >= 0; --i) { - if (explosions[i]->animationIsCompleted()) + if (explosions_[i]->animationIsCompleted()) { - explosions.erase(explosions.begin() + i); + explosions_.erase(explosions_.begin() + i); } } } @@ -73,9 +73,9 @@ void Explosions::freeExplosions() // Busca una textura a partir del tamaño int Explosions::getIndexBySize(int size) { - for (int i = 0; i < (int)textures.size();++i) + for (int i = 0; i < (int)textures_.size(); ++i) { - if (size == textures[i].size) + if (size == textures_[i].size) { return i; } diff --git a/source/explosions.h b/source/explosions.h index 290d8f3..ab07124 100644 --- a/source/explosions.h +++ b/source/explosions.h @@ -1,14 +1,14 @@ #pragma once -#include // for string -#include // for vector +#include // for string +#include // for vector #include "animated_sprite.h" #include #include "texture.h" -struct explosion_texture_t +struct ExplosionTexture { - std::shared_ptrtexture; // Textura para la explosión + std::shared_ptr texture; // Textura para la explosión std::vector *animation; // Animación para la textura int size; // Tamaño de la explosión }; @@ -18,8 +18,8 @@ class Explosions { private: // Variables - std::vector textures; // Vector con las texturas a utilizar - std::vector> explosions; // Lista con todas las explosiones + std::vector textures_; // Vector con las texturas a utilizar + std::vector> explosions_; // Lista con todas las explosiones // Vacia el vector de elementos finalizados void freeExplosions(); diff --git a/source/fade.cpp b/source/fade.cpp index ef136e9..7d50c24 100644 --- a/source/fade.cpp +++ b/source/fade.cpp @@ -7,12 +7,12 @@ #include "utils.h" // for Param, ParamGame, ParamFade // Constructor -Fade::Fade(SDL_Renderer *renderer) - : renderer(renderer) +Fade::Fade(SDL_Renderer *renderer_) + : renderer_(renderer_) { // Crea la textura donde dibujar el fade - backbuffer = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, param.game.width, param.game.height); - SDL_SetTextureBlendMode(backbuffer, SDL_BLENDMODE_BLEND); + backbuffer_ = SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, param.game.width, param.game.height); + SDL_SetTextureBlendMode(backbuffer_, SDL_BLENDMODE_BLEND); // Inicializa las variables init(); @@ -21,64 +21,65 @@ Fade::Fade(SDL_Renderer *renderer) // Destructor Fade::~Fade() { - SDL_DestroyTexture(backbuffer); - backbuffer = nullptr; + SDL_DestroyTexture(backbuffer_); + backbuffer_ = nullptr; } // Inicializa las variables void Fade::init() { - type = FadeType::CENTER; - mode = FadeMode::OUT; - enabled = false; - finished = false; - counter = 0; - r = 0; - g = 0; - b = 0; - postDuration = 20; - postCounter = 0; - numSquaresWidth = param.fade.num_squares_width; - numSquaresHeight = param.fade.num_squares_height; - fadeRandomSquaresDelay = param.fade.random_squares_delay; - fadeRandomSquaresMult = param.fade.random_squares_mult; + type_ = FadeType::CENTER; + mode_ = FadeMode::OUT; + enabled_ = false; + finished_ = false; + counter_ = 0; + r_ = 0; + g_ = 0; + b_ = 0; + a_ = 0; + post_duration_ = 20; + post_counter_ = 0; + num_squares_width_ = param.fade.num_squares_width; + num_squares_height_ = param.fade.num_squares_height; + fade_random_squares_delay_ = param.fade.random_squares_delay; + fade_random_squares_mult_ = param.fade.random_squares_mult; } // Resetea algunas variables para volver a hacer el fade sin perder ciertos parametros void Fade::reset() { - enabled = false; - finished = false; - counter = 0; + enabled_ = false; + finished_ = false; + counter_ = 0; } // Pinta una transición en pantalla void Fade::render() { - if (enabled || finished) + if (enabled_ || finished_) { - SDL_RenderCopy(renderer, backbuffer, nullptr, nullptr); + SDL_RenderCopy(renderer_, backbuffer_, nullptr, nullptr); } } // Actualiza las variables internas void Fade::update() { - if (enabled) + if (enabled_) { - switch (type) + switch (type_) { case FadeType::FULLSCREEN: { // Modifica la transparencia - a = mode == FadeMode::OUT ? std::min(counter * 4, 255) : 255 - std::min(counter * 4, 255); + a_ = mode_ == FadeMode::OUT ? std::min(counter_ * 4, 255) : 255 - std::min(counter_ * 4, 255); - SDL_SetTextureAlphaMod(backbuffer, a); + SDL_SetTextureAlphaMod(backbuffer_, a_); // Comprueba si ha terminado - if (counter >= 255 / 4) + if (counter_ >= 255 / 4) { - finished = true; + finished_ = true; } break; @@ -86,62 +87,62 @@ void Fade::update() case FadeType::CENTER: { - // Dibuja sobre el backbuffer - auto *temp = SDL_GetRenderTarget(renderer); - SDL_SetRenderTarget(renderer, backbuffer); + // Dibuja sobre el backbuffer_ + auto temp = SDL_GetRenderTarget(renderer_); + SDL_SetRenderTarget(renderer_, backbuffer_); - SDL_SetRenderDrawColor(renderer, r, g, b, a); + SDL_SetRenderDrawColor(renderer_, r_, g_, b_, a_); - for (int i = 0; i < counter; i++) + for (int i = 0; i < counter_; i++) { - rect1.h = rect2.h = i * 4; - rect2.y = param.game.height - (i * 4); + rect1_.h = rect2_.h = i * 4; + rect2_.y = param.game.height - (i * 4); - SDL_RenderFillRect(renderer, &rect1); - SDL_RenderFillRect(renderer, &rect2); + SDL_RenderFillRect(renderer_, &rect1_); + SDL_RenderFillRect(renderer_, &rect2_); } // Deja el renderizador como estaba - SDL_SetRenderTarget(renderer, temp); + SDL_SetRenderTarget(renderer_, temp); // Comprueba si ha terminado - if ((counter * 4) > param.game.height) + if ((counter_ * 4) > param.game.height) { - finished = true; - a = 255; + finished_ = true; + a_ = 255; } break; } case FadeType::RANDOM_SQUARE: { - if (counter % fadeRandomSquaresDelay == 0) + if (counter_ % fade_random_squares_delay_ == 0) { - // Dibuja sobre el backbuffer - auto *temp = SDL_GetRenderTarget(renderer); - SDL_SetRenderTarget(renderer, backbuffer); + // Dibuja sobre el backbuffer_ + auto *temp = SDL_GetRenderTarget(renderer_); + SDL_SetRenderTarget(renderer_, backbuffer_); - SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE); - SDL_SetRenderDrawColor(renderer, r, g, b, a); + SDL_SetRenderDrawBlendMode(renderer_, SDL_BLENDMODE_NONE); + SDL_SetRenderDrawColor(renderer_, r_, g_, b_, a_); // Dibuja el cuadrado correspondiente - const int index = std::min(counter / fadeRandomSquaresDelay, (numSquaresWidth * numSquaresHeight) - 1); - for (int i = 0; i < fadeRandomSquaresMult; ++i) + const int index = std::min(counter_ / fade_random_squares_delay_, (num_squares_width_ * num_squares_height_) - 1); + for (int i = 0; i < fade_random_squares_mult_; ++i) { - const int index2 = std::min(index * fadeRandomSquaresMult + i, (int)square.size() - 1); - SDL_RenderFillRect(renderer, &square[index2]); + const int index2 = std::min(index * fade_random_squares_mult_ + i, (int)square_.size() - 1); + SDL_RenderFillRect(renderer_, &square_[index2]); } - SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND); + SDL_SetRenderDrawBlendMode(renderer_, SDL_BLENDMODE_BLEND); // Deja el renderizador como estaba - SDL_SetRenderTarget(renderer, temp); + SDL_SetRenderTarget(renderer_, temp); } // Comprueba si ha terminado - if (counter * fadeRandomSquaresMult / fadeRandomSquaresDelay >= numSquaresWidth * numSquaresHeight) + if (counter_ * fade_random_squares_mult_ / fade_random_squares_delay_ >= num_squares_width_ * num_squares_height_) { - finished = true; + finished_ = true; } break; @@ -150,47 +151,47 @@ void Fade::update() case FadeType::VENETIAN: { // Counter debe ir de 0 a 150 - if (square.back().h < param.fade.venetian_size) + if (square_.back().h < param.fade.venetian_size) { - // Dibuja sobre el backbuffer - auto *temp = SDL_GetRenderTarget(renderer); - SDL_SetRenderTarget(renderer, backbuffer); + // Dibuja sobre el backbuffer_ + auto *temp = SDL_GetRenderTarget(renderer_); + SDL_SetRenderTarget(renderer_, backbuffer_); - SDL_SetRenderDrawColor(renderer, r, g, b, a); - for (auto rect : square) + SDL_SetRenderDrawColor(renderer_, r_, g_, b_, a_); + for (auto rect : square_) { - SDL_RenderFillRect(renderer, &rect); + SDL_RenderFillRect(renderer_, &rect); } // Deja el renderizador como estaba - SDL_SetRenderTarget(renderer, temp); + SDL_SetRenderTarget(renderer_, temp); - const auto h = counter / 3; - for (int i = 0; i < (int)square.size(); ++i) + const auto h = counter_ / 3; + for (int i = 0; i < (int)square_.size(); ++i) { // A partir del segundo rectangulo se pinta en función del anterior - square[i].h = i == 0 ? h : std::max(square[i - 1].h - 3, 0); + square_[i].h = i == 0 ? h : std::max(square_[i - 1].h - 3, 0); } } else { - finished = true; + finished_ = true; } break; } } - if (finished) + if (finished_) { // Actualiza el contador - postCounter == postDuration ? enabled = false : postCounter++; + post_counter_ == post_duration_ ? enabled_ = false : post_counter_++; - // Deja el backbuffer todo del mismo color - cleanBackbuffer(r, g, b, a); + // Deja el backbuffer_ todo del mismo color + cleanBackbuffer(r_, g_, b_, a_); } - counter++; + counter_++; } } @@ -198,67 +199,67 @@ void Fade::update() void Fade::activate() { // Si ya está habilitado, no hay que volverlo a activar - if (enabled) + if (enabled_) { return; } - enabled = true; - finished = false; - counter = 0; - postCounter = 0; + enabled_ = true; + finished_ = false; + counter_ = 0; + post_counter_ = 0; - switch (type) + switch (type_) { case FadeType::FULLSCREEN: { - // Pinta el backbuffer de color sólido - cleanBackbuffer(r, g, b, 255); + // Pinta el backbuffer_ de color sólido + cleanBackbuffer(r_, g_, b_, 255); break; } case FadeType::CENTER: { - rect1 = {0, 0, param.game.width, 0}; - rect2 = {0, 0, param.game.width, 0}; - a = 64; + rect1_ = {0, 0, param.game.width, 0}; + rect2_ = {0, 0, param.game.width, 0}; + a_ = 64; break; } case FadeType::RANDOM_SQUARE: { - rect1 = {0, 0, param.game.width / numSquaresWidth, param.game.height / numSquaresHeight}; - square.clear(); + rect1_ = {0, 0, param.game.width / num_squares_width_, param.game.height / num_squares_height_}; + square_.clear(); // Añade los cuadrados al vector - for (int i = 0; i < numSquaresWidth * numSquaresHeight; ++i) + for (int i = 0; i < num_squares_width_ * num_squares_height_; ++i) { - rect1.x = (i % numSquaresWidth) * rect1.w; - rect1.y = (i / numSquaresWidth) * rect1.h; - square.push_back(rect1); + rect1_.x = (i % num_squares_width_) * rect1_.w; + rect1_.y = (i / num_squares_width_) * rect1_.h; + square_.push_back(rect1_); } // Desordena el vector de cuadrados - auto num = numSquaresWidth * numSquaresHeight; + auto num = num_squares_width_ * num_squares_height_; while (num > 1) { auto num_arreu = rand() % num; - SDL_Rect temp = square[num_arreu]; - square[num_arreu] = square[num - 1]; - square[num - 1] = temp; + SDL_Rect temp = square_[num_arreu]; + square_[num_arreu] = square_[num - 1]; + square_[num - 1] = temp; num--; } // Limpia la textura - auto *temp = SDL_GetRenderTarget(renderer); - SDL_SetRenderTarget(renderer, backbuffer); - a = mode == FadeMode::OUT ? 0 : 255; - SDL_SetRenderDrawColor(renderer, r, g, b, a); - SDL_RenderClear(renderer); - SDL_SetRenderTarget(renderer, temp); + auto temp = SDL_GetRenderTarget(renderer_); + SDL_SetRenderTarget(renderer_, backbuffer_); + a_ = mode_ == FadeMode::OUT ? 0 : 255; + SDL_SetRenderDrawColor(renderer_, r_, g_, b_, a_); + SDL_RenderClear(renderer_); + SDL_SetRenderTarget(renderer_, temp); // Deja el color listo para usar - a = mode == FadeMode::OUT ? 255 : 0; + a_ = mode_ == FadeMode::OUT ? 255 : 0; break; } @@ -266,17 +267,17 @@ void Fade::activate() case FadeType::VENETIAN: { cleanBackbuffer(0, 0, 0, 0); - rect1 = {0, 0, param.game.width, 0}; - square.clear(); - a = 255; + rect1_ = {0, 0, param.game.width, 0}; + square_.clear(); + a_ = 255; // Añade los cuadrados al vector const int max = param.game.height / param.fade.venetian_size; for (int i = 0; i < max; ++i) { - rect1.y = i * param.fade.venetian_size; - square.push_back(rect1); + rect1_.y = i * param.fade.venetian_size; + square_.push_back(rect1_); } break; @@ -287,53 +288,53 @@ void Fade::activate() // Comprueba si está activo bool Fade::isEnabled() const { - return enabled; + return enabled_; } // Comprueba si ha terminado la transicion bool Fade::hasEnded() const { // Ha terminado cuando ha finalizado la transición y se ha deshabilitado - return !enabled && finished; + return !enabled_ && finished_; } // Establece el tipo de fade -void Fade::setType(FadeType type) +void Fade::setType(FadeType type_) { - this->type = type; + type_ = type_; } // Establece el modo de fade void Fade::setMode(FadeMode mode) { - this->mode = mode; + mode_ = mode; } // Establece el color del fade void Fade::setColor(Uint8 r, Uint8 g, Uint8 b) { - this->r = r; - this->g = g; - this->b = b; + r_ = r; + g_ = g; + b_ = b; } // Establece la duración posterior void Fade::setPost(int value) { - postDuration = value; + post_duration_ = value; } // Limpia el backbuffer void Fade::cleanBackbuffer(Uint8 r, Uint8 g, Uint8 b, Uint8 a) { - // Dibujamos sobre el backbuffer - auto *temp = SDL_GetRenderTarget(renderer); - SDL_SetRenderTarget(renderer, backbuffer); + // Dibujamos sobre el backbuffer_ + auto temp = SDL_GetRenderTarget(renderer_); + SDL_SetRenderTarget(renderer_, backbuffer_); // Pintamos la textura con el color del fade - SDL_SetRenderDrawColor(renderer, r, g, b, a); - SDL_RenderClear(renderer); + SDL_SetRenderDrawColor(renderer_, r, g, b, a); + SDL_RenderClear(renderer_); // Vuelve a dejar el renderizador como estaba - SDL_SetRenderTarget(renderer, temp); + SDL_SetRenderTarget(renderer_, temp); } \ No newline at end of file diff --git a/source/fade.h b/source/fade.h index e205d78..ddf8d6d 100644 --- a/source/fade.h +++ b/source/fade.h @@ -26,25 +26,25 @@ class Fade { private: // Objetos y punteros - SDL_Renderer *renderer; // El renderizador de la ventana - SDL_Texture *backbuffer; // Textura para usar como backbuffer con SDL_TEXTUREACCESS_TARGET + SDL_Renderer *renderer_; // El renderizador de la ventana + SDL_Texture *backbuffer_; // Textura para usar como backbuffer con SDL_TEXTUREACCESS_TARGET // Variables - FadeType type; // Tipo de fade a realizar - FadeMode mode; // Modo de fade a realizar - Uint16 counter; // Contador interno - bool enabled; // Indica si el fade está activo - bool finished; // Indica si ha terminado la transición - Uint8 r, g, b, a; // Colores para el fade - SDL_Rect rect1; // Rectangulo usado para crear los efectos de transición - SDL_Rect rect2; // Rectangulo usado para crear los efectos de transición - int numSquaresWidth; // Cantidad total de cuadraditos en horizontal para el FadeType::RANDOM_SQUARE - int numSquaresHeight; // Cantidad total de cuadraditos en vertical para el FadeType::RANDOM_SQUARE - std::vector square; // Vector con los indices de los cuadrados para el FadeType::RANDOM_SQUARE - int fadeRandomSquaresDelay; // Duración entre cada pintado de cuadrados - int fadeRandomSquaresMult; // Cantidad de cuadrados que se pintaran cada vez - int postDuration; // Duración posterior del fade tras finalizar - int postCounter; // Contador para la duración posterior + FadeType type_; // Tipo de fade a realizar + FadeMode mode_; // Modo de fade a realizar + Uint16 counter_; // Contador interno + bool enabled_; // Indica si el fade está activo + bool finished_; // Indica si ha terminado la transición + Uint8 r_, g_, b_, a_; // Colores para el fade + SDL_Rect rect1_; // Rectangulo usado para crear los efectos de transición + SDL_Rect rect2_; // Rectangulo usado para crear los efectos de transición + int num_squares_width_; // Cantidad total de cuadraditos en horizontal para el FadeType::RANDOM_SQUARE + int num_squares_height_; // Cantidad total de cuadraditos en vertical para el FadeType::RANDOM_SQUARE + std::vector square_; // Vector con los indices de los cuadrados para el FadeType::RANDOM_SQUARE + int fade_random_squares_delay_; // Duración entre cada pintado de cuadrados + int fade_random_squares_mult_; // Cantidad de cuadrados que se pintaran cada vez + int post_duration_; // Duración posterior del fade tras finalizar + int post_counter_; // Contador para la duración posterior // Inicializa las variables void init(); diff --git a/source/game.cpp b/source/game.cpp index 86831a1..bd9eebf 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -13,7 +13,7 @@ #include "background.h" // for Background #include "balloon.h" // for Balloon, BALLOON_SPEED_1, BALLOON_... #include "bullet.h" // for Bullet, BulletType::LEFT, BulletType::RIGHT -#include "enemy_formations.h" // for stage_t, EnemyFormations, enemyIni... +#include "enemy_formations.h" // for Stage, EnemyFormations, enemyIni... #include "explosions.h" // for Explosions #include "fade.h" // for Fade, FadeType::RANDOM_SQUARE, FADE_VEN... #include "global_inputs.h" // for globalInputs::check @@ -241,7 +241,7 @@ void Game::init(int playerID) // Actualiza el numero de globos explotados según la fase de la demo for (int i = 0; i < currentStage; ++i) { - balloonsPopped += enemyFormations->getStage(i).powerToComplete; + balloonsPopped += enemyFormations->getStage(i).power_to_complete; } // Activa o no al otro jugador @@ -277,7 +277,7 @@ void Game::init(int playerID) totalPowerToCompleteGame = 0; for (int i = 0; i < 10; ++i) { - totalPowerToCompleteGame += enemyFormations->getStage(i).powerToComplete; + totalPowerToCompleteGame += enemyFormations->getStage(i).power_to_complete; } // Modo grabar demo @@ -719,16 +719,16 @@ void Game::deployEnemyFormation() lastEnemyDeploy = set; - const stage_t stage = enemyFormations->getStage(currentStage); - const auto numEnemies = stage.enemyPool->set[set]->numberOfEnemies; + const Stage stage = enemyFormations->getStage(currentStage); + const auto numEnemies = stage.enemy_pool->set[set]->number_of_enemies; for (int i = 0; i < numEnemies; ++i) { - createBalloon(stage.enemyPool->set[set]->init[i].x, - stage.enemyPool->set[set]->init[i].y, - stage.enemyPool->set[set]->init[i].kind, - stage.enemyPool->set[set]->init[i].velX, + createBalloon(stage.enemy_pool->set[set]->init[i].x, + stage.enemy_pool->set[set]->init[i].y, + stage.enemy_pool->set[set]->init[i].kind, + stage.enemy_pool->set[set]->init[i].vel_x, enemySpeed, - stage.enemyPool->set[set]->init[i].creationCounter); + stage.enemy_pool->set[set]->init[i].creation_counter); } enemyDeployCounter = 300; @@ -810,7 +810,7 @@ void Game::renderPlayers() // Comprueba si hay cambio de fase y actualiza las variables void Game::updateStage() { - if (currentPower >= enemyFormations->getStage(currentStage).powerToComplete) + if (currentPower >= enemyFormations->getStage(currentStage).power_to_complete) { // Cambio de fase currentStage++; @@ -1014,7 +1014,7 @@ void Game::decBalloonSpeed() // Actualiza la velocidad de los globos en funcion del poder acumulado de la fase void Game::updateBalloonSpeed() { - const float percent = (float)currentPower / (float)enemyFormations->getStage(currentStage).powerToComplete; + const float percent = (float)currentPower / (float)enemyFormations->getStage(currentStage).power_to_complete; if (enemySpeed == BALLOON_SPEED_1) { if (percent > 0.2f) @@ -1930,11 +1930,11 @@ void Game::updateMenace() } const auto stage = enemyFormations->getStage(currentStage); - const float percent = currentPower / stage.powerToComplete; - const int difference = stage.maxMenace - stage.minMenace; + const float percent = currentPower / stage.power_to_complete; + const int difference = stage.max_menace - stage.min_menace; // Aumenta el nivel de amenaza en función de la puntuación - menaceThreshold = stage.minMenace + (difference * percent); + menaceThreshold = stage.min_menace + (difference * percent); // Si el nivel de amenza es inferior al umbral if (menaceCurrent < menaceThreshold) @@ -2538,15 +2538,15 @@ void Game::checkEvents() { const auto set = 0; const auto stage = enemyFormations->getStage(0); - const auto numEnemies = stage.enemyPool->set[set]->numberOfEnemies; + const auto numEnemies = stage.enemy_pool->set[set]->number_of_enemies; for (int i = 0; i < numEnemies; ++i) { - createBalloon(stage.enemyPool->set[set]->init[i].x, - stage.enemyPool->set[set]->init[i].y, - stage.enemyPool->set[set]->init[i].kind, - stage.enemyPool->set[set]->init[i].velX, + createBalloon(stage.enemy_pool->set[set]->init[i].x, + stage.enemy_pool->set[set]->init[i].y, + stage.enemy_pool->set[set]->init[i].kind, + stage.enemy_pool->set[set]->init[i].vel_x, enemySpeed, - stage.enemyPool->set[set]->init[i].creationCounter); + stage.enemy_pool->set[set]->init[i].creation_counter); } } break; @@ -2650,7 +2650,7 @@ void Game::updateScoreboard() // Resto de marcador scoreboard->setStage(enemyFormations->getStage(currentStage).number); - scoreboard->setPower((float)currentPower / (float)enemyFormations->getStage(currentStage).powerToComplete); + scoreboard->setPower((float)currentPower / (float)enemyFormations->getStage(currentStage).power_to_complete); scoreboard->setHiScore(hiScore.score); scoreboard->setHiScoreName(hiScore.name); diff --git a/source/game_logo.cpp b/source/game_logo.cpp index a73744a..dc84c06 100644 --- a/source/game_logo.cpp +++ b/source/game_logo.cpp @@ -13,24 +13,24 @@ // Constructor GameLogo::GameLogo(int x, int y) - : x(x), y(y) + : x_(x), y_(y) { // Crea los objetos - dustTexture = std::make_shared(Screen::get()->getRenderer(), Asset::get()->get("title_dust.png")); - coffeeTexture = std::make_shared(Screen::get()->getRenderer(), Asset::get()->get("title_coffee.png")); - crisisTexture = std::make_shared(Screen::get()->getRenderer(), Asset::get()->get("title_crisis.png")); - arcadeEditionTexture = std::make_shared(Screen::get()->getRenderer(), Asset::get()->get("title_arcade_edition.png")); + dust_texture_ = std::make_shared(Screen::get()->getRenderer(), Asset::get()->get("title_dust.png")); + coffee_texture_ = std::make_shared(Screen::get()->getRenderer(), Asset::get()->get("title_coffee.png")); + crisis_texture_ = std::make_shared(Screen::get()->getRenderer(), Asset::get()->get("title_crisis.png")); + arcade_edition_texture_ = std::make_shared(Screen::get()->getRenderer(), Asset::get()->get("title_arcade_edition.png")); - coffeeSprite = std::make_unique(coffeeTexture); - crisisSprite = std::make_unique(crisisTexture); + coffee_sprite_ = std::make_unique(coffee_texture_); + crisis_sprite_ = std::make_unique(crisis_texture_); - arcadeEditionSprite = std::make_unique((param.game.width - arcadeEditionTexture->getWidth()) / 2, param.title.arcade_edition_position, arcadeEditionTexture->getWidth(), arcadeEditionTexture->getHeight(), arcadeEditionTexture); + arcade_edition_sprite_ = std::make_unique((param.game.width - arcade_edition_texture_->getWidth()) / 2, param.title.arcade_edition_position, arcade_edition_texture_->getWidth(), arcade_edition_texture_->getHeight(), arcade_edition_texture_); - dustLSprite = std::make_unique(dustTexture, Asset::get()->get("title_dust.ani")); - dustRSprite = std::make_unique(dustTexture, Asset::get()->get("title_dust.ani")); + dust_left_sprite_ = std::make_unique(dust_texture_, Asset::get()->get("title_dust.ani")); + dust_right_sprite_ = std::make_unique(dust_texture_, Asset::get()->get("title_dust.ani")); // Sonidos - crashSound = JA_LoadSound(Asset::get()->get("title.wav").c_str()); + crash_sound_ = JA_LoadSound(Asset::get()->get("title.wav").c_str()); // Inicializa las variables init(); @@ -39,140 +39,140 @@ GameLogo::GameLogo(int x, int y) // Destructor GameLogo::~GameLogo() { - JA_DeleteSound(crashSound); + JA_DeleteSound(crash_sound_); } // Inicializa las variables void GameLogo::init() { - const auto xp = x - coffeeSprite->getWidth() / 2; + const auto xp = x_ - coffee_sprite_->getWidth() / 2; const auto desp = getInitialVerticalDesp(); // Variables - status = Status::DISABLED; - shake.desp = 1; - shake.delay = 2; - shake.lenght = 8; - shake.remaining = shake.lenght; - shake.counter = shake.delay; - shake.origin = xp; + status_ = Status::DISABLED; + shake_.desp = 1; + shake_.delay = 2; + shake_.lenght = 8; + shake_.remaining = shake_.lenght; + shake_.counter = shake_.delay; + shake_.origin = xp; // Inicializa el bitmap de 'Coffee' - coffeeSprite->init(); - coffeeSprite->setPosX(xp); - coffeeSprite->setPosY(y - coffeeTexture->getHeight() - desp); - coffeeSprite->setWidth(coffeeTexture->getWidth()); - coffeeSprite->setHeight(coffeeTexture->getHeight()); - coffeeSprite->setVelX(0.0f); - coffeeSprite->setVelY(2.5f); - coffeeSprite->setAccelX(0.0f); - coffeeSprite->setAccelY(0.1f); - coffeeSprite->setSpriteClip(0, 0, coffeeTexture->getWidth(), coffeeTexture->getHeight()); - coffeeSprite->setEnabled(true); - coffeeSprite->setFinishedCounter(0); - coffeeSprite->setDestX(xp); - coffeeSprite->setDestY(y - coffeeTexture->getHeight()); + coffee_sprite_->init(); + coffee_sprite_->setPosX(xp); + coffee_sprite_->setPosY(y_ - coffee_texture_->getHeight() - desp); + coffee_sprite_->setWidth(coffee_texture_->getWidth()); + coffee_sprite_->setHeight(coffee_texture_->getHeight()); + coffee_sprite_->setVelX(0.0f); + coffee_sprite_->setVelY(2.5f); + coffee_sprite_->setAccelX(0.0f); + coffee_sprite_->setAccelY(0.1f); + coffee_sprite_->setSpriteClip(0, 0, coffee_texture_->getWidth(), coffee_texture_->getHeight()); + coffee_sprite_->setEnabled(true); + coffee_sprite_->setFinishedCounter(0); + coffee_sprite_->setDestX(xp); + coffee_sprite_->setDestY(y_ - coffee_texture_->getHeight()); // Inicializa el bitmap de 'Crisis' - crisisSprite->init(); - crisisSprite->setPosX(xp + 15); - crisisSprite->setPosY(y + desp); - crisisSprite->setWidth(crisisTexture->getWidth()); - crisisSprite->setHeight(crisisTexture->getHeight()); - crisisSprite->setVelX(0.0f); - crisisSprite->setVelY(-2.5f); - crisisSprite->setAccelX(0.0f); - crisisSprite->setAccelY(-0.1f); - crisisSprite->setSpriteClip(0, 0, crisisTexture->getWidth(), crisisTexture->getHeight()); - crisisSprite->setEnabled(true); - crisisSprite->setFinishedCounter(0); - crisisSprite->setDestX(xp + 15); - crisisSprite->setDestY(y); + crisis_sprite_->init(); + crisis_sprite_->setPosX(xp + 15); + crisis_sprite_->setPosY(y_ + desp); + crisis_sprite_->setWidth(crisis_texture_->getWidth()); + crisis_sprite_->setHeight(crisis_texture_->getHeight()); + crisis_sprite_->setVelX(0.0f); + crisis_sprite_->setVelY(-2.5f); + crisis_sprite_->setAccelX(0.0f); + crisis_sprite_->setAccelY(-0.1f); + crisis_sprite_->setSpriteClip(0, 0, crisis_texture_->getWidth(), crisis_texture_->getHeight()); + crisis_sprite_->setEnabled(true); + crisis_sprite_->setFinishedCounter(0); + crisis_sprite_->setDestX(xp + 15); + crisis_sprite_->setDestY(y_); // Inicializa el bitmap de 'DustRight' - dustRSprite->resetAnimation(); - dustRSprite->setPosX(coffeeSprite->getPosX() + coffeeSprite->getWidth()); - dustRSprite->setPosY(y); - dustRSprite->setWidth(16); - dustRSprite->setHeight(16); - dustRSprite->setFlip(SDL_FLIP_HORIZONTAL); + dust_right_sprite_->resetAnimation(); + dust_right_sprite_->setPosX(coffee_sprite_->getPosX() + coffee_sprite_->getWidth()); + dust_right_sprite_->setPosY(y_); + dust_right_sprite_->setWidth(16); + dust_right_sprite_->setHeight(16); + dust_right_sprite_->setFlip(SDL_FLIP_HORIZONTAL); // Inicializa el bitmap de 'DustLeft' - dustLSprite->resetAnimation(); - dustLSprite->setPosX(coffeeSprite->getPosX() - 16); - dustLSprite->setPosY(y); - dustLSprite->setWidth(16); - dustLSprite->setHeight(16); + dust_left_sprite_->resetAnimation(); + dust_left_sprite_->setPosX(coffee_sprite_->getPosX() - 16); + dust_left_sprite_->setPosY(y_); + dust_left_sprite_->setWidth(16); + dust_left_sprite_->setHeight(16); } // Pinta la clase en pantalla void GameLogo::render() { // Dibuja el logo - coffeeSprite->render(); - crisisSprite->render(); + coffee_sprite_->render(); + crisis_sprite_->render(); - if (status == Status::FINISHED) + if (status_ == Status::FINISHED) { - arcadeEditionSprite->render(); + arcade_edition_sprite_->render(); } // Dibuja el polvillo del logo - dustRSprite->render(); - dustLSprite->render(); + dust_right_sprite_->render(); + dust_left_sprite_->render(); } // Actualiza la lógica de la clase void GameLogo::update() { - if (status == Status::MOVING) + if (status_ == Status::MOVING) { - coffeeSprite->update(); - crisisSprite->update(); + coffee_sprite_->update(); + crisis_sprite_->update(); // Si los objetos han llegado a su destino, cambiamos de Sección - if (coffeeSprite->hasFinished() && crisisSprite->hasFinished()) + if (coffee_sprite_->hasFinished() && crisis_sprite_->hasFinished()) { - status = Status::SHAKING; + status_ = Status::SHAKING; // Reproduce el efecto sonoro - JA_PlaySound(crashSound); + JA_PlaySound(crash_sound_); } } - else if (status == Status::SHAKING) + else if (status_ == Status::SHAKING) { // Agita el logo - if (shake.remaining > 0) + if (shake_.remaining > 0) { - if (shake.counter > 0) + if (shake_.counter > 0) { - shake.counter--; + shake_.counter--; } else { - shake.counter = shake.delay; - const auto desp = shake.remaining % 2 == 0 ? shake.desp * (-1) : shake.desp; - coffeeSprite->setPosX(shake.origin + desp); - crisisSprite->setPosX(shake.origin + desp + 15); - shake.remaining--; + shake_.counter = shake_.delay; + const auto desp = shake_.remaining % 2 == 0 ? shake_.desp * (-1) : shake_.desp; + coffee_sprite_->setPosX(shake_.origin + desp); + crisis_sprite_->setPosX(shake_.origin + desp + 15); + shake_.remaining--; } } else { - coffeeSprite->setPosX(shake.origin); - crisisSprite->setPosX(shake.origin + 15); - status = Status::FINISHED; + coffee_sprite_->setPosX(shake_.origin); + crisis_sprite_->setPosX(shake_.origin + 15); + status_ = Status::FINISHED; } - dustRSprite->update(); - dustLSprite->update(); + dust_right_sprite_->update(); + dust_left_sprite_->update(); } - else if (status == Status::FINISHED) + else if (status_ == Status::FINISHED) { - dustRSprite->update(); - dustLSprite->update(); + dust_right_sprite_->update(); + dust_left_sprite_->update(); } } @@ -180,28 +180,28 @@ void GameLogo::update() void GameLogo::enable() { init(); - status = Status::MOVING; + status_ = Status::MOVING; } // Indica si ha terminado la animación bool GameLogo::hasFinished() const { - return status == Status::FINISHED; + return status_ == Status::FINISHED; } // Recarga las texturas void GameLogo::reLoad() { - dustTexture->reLoad(); - coffeeTexture->reLoad(); - crisisTexture->reLoad(); + dust_texture_->reLoad(); + coffee_texture_->reLoad(); + crisis_texture_->reLoad(); } // Calcula el desplazamiento vertical inicial int GameLogo::getInitialVerticalDesp() { - auto despUp = y; - auto despDown = param.game.height - y; + auto desp_up = y_; + auto desp_down = param.game.height - y_; - return std::max(despUp, despDown); + return std::max(desp_up, desp_down); } \ No newline at end of file diff --git a/source/game_logo.h b/source/game_logo.h index f721d77..8f4062c 100644 --- a/source/game_logo.h +++ b/source/game_logo.h @@ -2,7 +2,6 @@ #include // for SDL_Renderer #include - #include "texture.h" #include "animated_sprite.h" #include "smart_sprite.h" @@ -15,24 +14,24 @@ class GameLogo { private: // Objetos y punteros - std::shared_ptr dustTexture; // Textura con los graficos del polvo - std::shared_ptr coffeeTexture; // Textura con los graficos de la palabra "COFFEE" - std::shared_ptr crisisTexture; // Textura con los graficos de la plabra "CRISIS" - std::shared_ptr arcadeEditionTexture; // Textura con los graficos de "Arcade Edition" + std::shared_ptr dust_texture_; // Textura con los graficos del polvo + std::shared_ptr coffee_texture_; // Textura con los graficos de la palabra "COFFEE" + std::shared_ptr crisis_texture_; // Textura con los graficos de la plabra "CRISIS" + std::shared_ptr arcade_edition_texture_; // Textura con los graficos de "Arcade Edition" - std::unique_ptr dustLSprite; // Sprite con la el polvo que aparece al colisionar el texto de la pantalla de titulo - std::unique_ptr dustRSprite; // Sprite con la el polvo que aparece al colisionar el texto de la pantalla de titulo + std::unique_ptr dust_left_sprite_; // Sprite con la el polvo que aparece al colisionar el texto de la pantalla de titulo + std::unique_ptr dust_right_sprite_; // Sprite con la el polvo que aparece al colisionar el texto de la pantalla de titulo - std::unique_ptr coffeeSprite; // Sprite con la palabra "COFFEE" para la pantalla de titulo - std::unique_ptr crisisSprite; // Sprite con la palabra "CRISIS" para la pantalla de titulo + std::unique_ptr coffee_sprite_; // Sprite con la palabra "COFFEE" para la pantalla de titulo + std::unique_ptr crisis_sprite_; // Sprite con la palabra "CRISIS" para la pantalla de titulo - std::unique_ptr arcadeEditionSprite; // Sprite con los graficos de "Arcade Edition" + std::unique_ptr arcade_edition_sprite_; // Sprite con los graficos de "Arcade Edition" - JA_Sound_t *crashSound; // Sonido con el impacto del título + JA_Sound_t *crash_sound_; // Sonido con el impacto del título // Variables - int x; // Posición donde dibujar el logo - int y; // Posición donde dibujar el logo + int x_; // Posición donde dibujar el logo + int y_; // Posición donde dibujar el logo enum class Status { @@ -40,7 +39,7 @@ private: MOVING, SHAKING, FINISHED, - } status; // Estado en el que se encuentra la clase + } status_; // Estado en el que se encuentra la clase struct Shake { @@ -50,7 +49,7 @@ private: int lenght; // Cantidad de desplazamientos a realizar int remaining; // Cantidad de desplazamientos pendientes a realizar int origin; // Valor inicial de la pantalla para dejarla igual tras el desplazamiento - } shake; // Estructura para generar el efecto de agitación + } shake_; // Estructura para generar el efecto de agitación // Inicializa las variables void init();