Cambiados muchos DEFINEs por variables de param

This commit is contained in:
2024-09-06 08:41:10 +02:00
parent c5bab7019c
commit 62b1ba84ac
23 changed files with 215 additions and 158 deletions

View File

@@ -1,8 +1,9 @@
#include "enemy_formations.h"
// Constructor
EnemyFormations::EnemyFormations()
EnemyFormations::EnemyFormations(param_t *param)
{
this->param = param;
initEnemyFormations();
initEnemyPools();
initGameStages();
@@ -16,22 +17,22 @@ EnemyFormations::~EnemyFormations()
// Inicializa las formaciones enemigas
void EnemyFormations::initEnemyFormations()
{
const int y4 = PLAY_AREA_TOP - BLOCK;
const int y4 = - BLOCK;
const int x4_0 = PLAY_AREA_LEFT;
const int x4_100 = PLAY_AREA_RIGHT - BALLOON_WIDTH_4;
const int x4_100 = param->game.playArea.rect.w - BALLOON_WIDTH_4;
const int y3 = PLAY_AREA_TOP - BLOCK;
const int y3 = - BLOCK;
const int x3_0 = PLAY_AREA_LEFT;
const int x3_100 = PLAY_AREA_RIGHT - BALLOON_WIDTH_3;
const int x3_100 = param->game.playArea.rect.w - BALLOON_WIDTH_3;
const int y2 = PLAY_AREA_TOP - BLOCK;
const int y2 = - BLOCK;
const int x2_0 = PLAY_AREA_LEFT;
const int x2_100 = PLAY_AREA_RIGHT - BALLOON_WIDTH_2;
const int x2_100 = param->game.playArea.rect.w - BALLOON_WIDTH_2;
const int y1 = PLAY_AREA_TOP - BLOCK;
const int y1 = - BLOCK;
const int x1_0 = PLAY_AREA_LEFT;
const int x1_50 = PLAY_AREA_CENTER_X - (BALLOON_WIDTH_1 / 2);
const int x1_100 = PLAY_AREA_RIGHT - BALLOON_WIDTH_1;
const int x1_50 = param->game.playArea.centerX - (BALLOON_WIDTH_1 / 2);
const int x1_100 = param->game.playArea.rect.w - BALLOON_WIDTH_1;
// Inicializa a cero las variables
for (int i = 0; i < NUMBER_OF_ENEMY_FORMATIONS; i++)
@@ -69,11 +70,11 @@ void EnemyFormations::initEnemyFormations()
// #01 - Dos enemigos BALLOON4 uno a cada cuarto. Ambos van hacia el centro
j = 1;
enemyFormation[j].numberOfEnemies = 2;
incX = PLAY_AREA_CENTER_X;
incX = param->game.playArea.centerX;
incTime = 0;
for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
{
enemyFormation[j].init[i].x = PLAY_AREA_CENTER_FIRST_QUARTER_X - (BALLOON_WIDTH_4 / 2) + (i * incX);
enemyFormation[j].init[i].x = param->game.playArea.firstQuarterX - (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;