From 807f71ffa73dc72c53be91ab6a1d13e75d702d87 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Sun, 24 May 2026 07:57:12 +0200 Subject: [PATCH] =?UTF-8?q?refactor(defaults):=20renombra=20VELOCITAT/CANV?= =?UTF-8?q?I=5FANGLE/MAX=5FBALES=20a=20angl=C3=A8s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/core/defaults/enemies.hpp | 14 +-- source/core/defaults/entities.hpp | 2 +- source/core/defaults/physics.hpp | 18 ++-- source/game/constants.hpp | 2 +- source/game/effects/debris_manager.cpp | 4 +- source/game/entities/enemy.cpp | 18 ++-- source/game/scenes/game_scene.cpp | 6 +- source/game/scenes/game_scene.hpp | 2 +- source/game/scenes/logo_scene.cpp | 9 +- source/game/scenes/logo_scene.hpp | 120 +++++++++++------------ source/game/systems/collision_system.cpp | 6 +- source/game/systems/collision_system.hpp | 4 +- 12 files changed, 102 insertions(+), 103 deletions(-) diff --git a/source/core/defaults/enemies.hpp b/source/core/defaults/enemies.hpp index ca4c7ba..f6f4d47 100644 --- a/source/core/defaults/enemies.hpp +++ b/source/core/defaults/enemies.hpp @@ -17,10 +17,10 @@ namespace Defaults::Enemies { // Pentagon (esquivador - zigzag evasion) namespace Pentagon { - constexpr float VELOCITAT = 35.0F; // px/s (slightly slower) + constexpr float SPEED = 35.0F; // px/s (slightly slower) constexpr float MASS = 5.0F; // Masa estándar - constexpr float CANVI_ANGLE_PROB = 0.20F; // 20% per wall hit (frequent zigzag) - constexpr float CANVI_ANGLE_MAX = 1.0F; // Max random angle change (rad) + constexpr float ANGLE_CHANGE_PROB = 0.20F; // 20% per wall hit (frequent zigzag) + constexpr float ANGLE_CHANGE_MAX = 1.0F; // Max random angle change (rad) constexpr float ZIGZAG_PROB_PER_SECOND = 0.8F; // Probabilidad de zigzag por segundo constexpr float ROTATION_DELTA_MIN = 0.75F; // Min visual rotation (rad/s) [+50%] constexpr float ROTATION_DELTA_MAX = 3.75F; // Max visual rotation (rad/s) [+50%] @@ -29,7 +29,7 @@ namespace Defaults::Enemies { // Square (perseguidor - tracks player) namespace Square { - constexpr float VELOCITAT = 40.0F; // px/s (medium speed) + constexpr float SPEED = 40.0F; // px/s (medium speed) constexpr float MASS = 8.0F; // Más pesado, "tanque" constexpr float TRACKING_STRENGTH = 0.5F; // Interpolation toward player (0.0-1.0) constexpr float TRACKING_INTERVAL = 1.0F; // Seconds between angle updates @@ -40,10 +40,10 @@ namespace Defaults::Enemies { // Molinillo (agressiu - fast straight lines, proximity spin-up) namespace Pinwheel { - constexpr float VELOCITAT = 50.0F; // px/s (fastest) + constexpr float SPEED = 50.0F; // px/s (fastest) constexpr float MASS = 4.0F; // Más liviano, ágil - constexpr float CANVI_ANGLE_PROB = 0.05F; // 5% per wall hit (rare direction change) - constexpr float CANVI_ANGLE_MAX = 0.3F; // Small angle adjustments + constexpr float ANGLE_CHANGE_PROB = 0.05F; // 5% per wall hit (rare direction change) + constexpr float ANGLE_CHANGE_MAX = 0.3F; // Small angle adjustments constexpr float ROTATION_DELTA_MIN = 3.0F; // Base rotation (rad/s) [+50%] constexpr float ROTATION_DELTA_MAX = 6.0F; // [+50%] constexpr float ROTATION_DELTA_PROXIMITY_MULTIPLIER = 3.0F; // Spin-up multiplier when near ship diff --git a/source/core/defaults/entities.hpp b/source/core/defaults/entities.hpp index 56b5cd1..a1e2178 100644 --- a/source/core/defaults/entities.hpp +++ b/source/core/defaults/entities.hpp @@ -6,7 +6,7 @@ namespace Defaults::Entities { constexpr int MAX_ORNIS = 15; - constexpr int MAX_BALES = 50; + constexpr int MAX_BULLETS = 50; constexpr float SHIP_RADIUS = 12.0F; constexpr float ENEMY_RADIUS = 20.0F; diff --git a/source/core/defaults/physics.hpp b/source/core/defaults/physics.hpp index d77b678..3fa8f7a 100644 --- a/source/core/defaults/physics.hpp +++ b/source/core/defaults/physics.hpp @@ -28,14 +28,14 @@ namespace Defaults::Physics { // Explosions (debris physics) namespace Debris { - constexpr float VELOCITAT_BASE = 80.0F; // Velocidad inicial (px/s) - constexpr float VARIACIO_VELOCITAT = 40.0F; // ±variació aleatòria (px/s) - constexpr float ACCELERACIO = -60.0F; // Fricció/desacceleració (px/s²) - constexpr float ROTATION_MIN = 0.1F; // Rotación mínima (rad/s ~5.7°/s) - constexpr float ROTATION_MAX = 0.3F; // Rotación màxima (rad/s ~17.2°/s) - constexpr float TEMPS_VIDA = 2.0F; // Vida mínima garantida (s) — després pot morir per velocitat baixa - constexpr float TEMPS_VIDA_NAU = 3.0F; // Ship debris min lifetime (matches DEATH_DURATION) - constexpr float SHRINK_RATE = 1.0F; // Reducció de mida (1.0 = encoge a 0 al final del min_lifetime) + constexpr float SPEED_BASE = 80.0F; // Velocidad inicial (px/s) + constexpr float VARIACIO_SPEED = 40.0F; // ±variació aleatòria (px/s) + constexpr float ACCELERACIO = -60.0F; // Fricció/desacceleració (px/s²) + constexpr float ROTATION_MIN = 0.1F; // Rotación mínima (rad/s ~5.7°/s) + constexpr float ROTATION_MAX = 0.3F; // Rotación màxima (rad/s ~17.2°/s) + constexpr float TEMPS_VIDA = 2.0F; // Vida mínima garantida (s) — després pot morir per velocitat baixa + constexpr float TEMPS_VIDA_NAU = 3.0F; // Ship debris min lifetime (matches DEATH_DURATION) + constexpr float SHRINK_RATE = 1.0F; // Reducció de mida (1.0 = encoge a 0 al final del min_lifetime) // Política de mort: passat el min_lifetime, el fragment mor quan la // seva velocity cau per sota d'aquest llindar. Així els fragments @@ -68,7 +68,7 @@ namespace Defaults::Physics { // Angular velocity sin for trajectory inheritance // Excess above this threshold is converted to tangential linear velocity // Prevents "vortex trap" problem with high-rotation enemies - constexpr float VELOCITAT_ROT_MAX = 1.5F; // rad/s (~86°/s) + constexpr float SPEED_ROT_MAX = 1.5F; // rad/s (~86°/s) } // namespace Debris } // namespace Defaults::Physics diff --git a/source/game/constants.hpp b/source/game/constants.hpp index 0e7fda0..d6df236 100644 --- a/source/game/constants.hpp +++ b/source/game/constants.hpp @@ -7,7 +7,7 @@ namespace Constants { // Límits de objectes constexpr int MAX_ORNIS = Defaults::Entities::MAX_ORNIS; - constexpr int MAX_BALES = Defaults::Entities::MAX_BALES; + constexpr int MAX_BULLETS = Defaults::Entities::MAX_BULLETS; // Matemàtiques constexpr float PI = Defaults::Math::PI; diff --git a/source/game/effects/debris_manager.cpp b/source/game/effects/debris_manager.cpp index f384b43..18bad99 100644 --- a/source/game/effects/debris_manager.cpp +++ b/source/game/effects/debris_manager.cpp @@ -135,7 +135,7 @@ namespace Effects { float speed = velocitat_base + (((std::rand() / static_cast(RAND_MAX)) * 2.0F - 1.0F) * - Defaults::Physics::Debris::VARIACIO_VELOCITAT); + Defaults::Physics::Debris::VARIACIO_SPEED); debris->velocity.x = (direccio.x * speed) + velocitat_objecte.x; debris->velocity.y = (direccio.y * speed) + velocitat_objecte.y; debris->acceleration = friction; @@ -179,7 +179,7 @@ namespace Effects { velocitat_ang_heretada *= (1.0F + variacio); // FASE 2: Cap a la velocity màxima; l'excés es converteix en tangencial - constexpr float CAP = Defaults::Physics::Debris::VELOCITAT_ROT_MAX; + constexpr float CAP = Defaults::Physics::Debris::SPEED_ROT_MAX; float abs_ang = std::abs(velocitat_ang_heretada); float sign_ang = (velocitat_ang_heretada >= 0.0F) ? 1.0F : -1.0F; diff --git a/source/game/entities/enemy.cpp b/source/game/entities/enemy.cpp index 116e499..74020fe 100644 --- a/source/game/entities/enemy.cpp +++ b/source/game/entities/enemy.cpp @@ -65,7 +65,7 @@ void Enemy::init(EnemyType type, const Vec2* ship_pos) { switch (type_) { case EnemyType::PENTAGON: shape_file = Defaults::Enemies::Pentagon::SHAPE_FILE; - base_speed = Defaults::Enemies::Pentagon::VELOCITAT; + base_speed = Defaults::Enemies::Pentagon::SPEED; rotation_delta_min = Defaults::Enemies::Pentagon::ROTATION_DELTA_MIN; rotation_delta_max = Defaults::Enemies::Pentagon::ROTATION_DELTA_MAX; type_mass = Defaults::Enemies::Pentagon::MASS; @@ -73,7 +73,7 @@ void Enemy::init(EnemyType type, const Vec2* ship_pos) { case EnemyType::SQUARE: shape_file = Defaults::Enemies::Square::SHAPE_FILE; - base_speed = Defaults::Enemies::Square::VELOCITAT; + base_speed = Defaults::Enemies::Square::SPEED; rotation_delta_min = Defaults::Enemies::Square::ROTATION_DELTA_MIN; rotation_delta_max = Defaults::Enemies::Square::ROTATION_DELTA_MAX; type_mass = Defaults::Enemies::Square::MASS; @@ -82,7 +82,7 @@ void Enemy::init(EnemyType type, const Vec2* ship_pos) { case EnemyType::PINWHEEL: shape_file = Defaults::Enemies::Pinwheel::SHAPE_FILE; - base_speed = Defaults::Enemies::Pinwheel::VELOCITAT; + base_speed = Defaults::Enemies::Pinwheel::SPEED; rotation_delta_min = Defaults::Enemies::Pinwheel::ROTATION_DELTA_MIN; rotation_delta_max = Defaults::Enemies::Pinwheel::ROTATION_DELTA_MAX; type_mass = Defaults::Enemies::Pinwheel::MASS; @@ -92,7 +92,7 @@ void Enemy::init(EnemyType type, const Vec2* ship_pos) { std::cerr << "[Enemy] Error: tipo desconocido (" << static_cast(type_) << "), usando PENTAGON\n"; shape_file = Defaults::Enemies::Pentagon::SHAPE_FILE; - base_speed = Defaults::Enemies::Pentagon::VELOCITAT; + base_speed = Defaults::Enemies::Pentagon::SPEED; rotation_delta_min = Defaults::Enemies::Pentagon::ROTATION_DELTA_MIN; rotation_delta_max = Defaults::Enemies::Pentagon::ROTATION_DELTA_MAX; break; @@ -312,7 +312,7 @@ void Enemy::behaviorPentagon(float delta_time) { if (RAND_VAL < Defaults::Enemies::Pentagon::ZIGZAG_PROB_PER_SECOND * delta_time) { const float CURRENT_ANGLE = velocityToAngle(body_.velocity); const float DELTA = (static_cast(std::rand()) / static_cast(RAND_MAX)) * - Defaults::Enemies::Pentagon::CANVI_ANGLE_MAX; + Defaults::Enemies::Pentagon::ANGLE_CHANGE_MAX; const float NEW_ANGLE = CURRENT_ANGLE + ((std::rand() % 2 == 0) ? DELTA : -DELTA); const float SPEED = body_.velocity.length(); setVelocityFromAngle(NEW_ANGLE, SPEED); @@ -454,13 +454,13 @@ auto Enemy::computeCurrentScale() const -> float { auto Enemy::getBaseVelocity() const -> float { switch (type_) { case EnemyType::PENTAGON: - return Defaults::Enemies::Pentagon::VELOCITAT; + return Defaults::Enemies::Pentagon::SPEED; case EnemyType::SQUARE: - return Defaults::Enemies::Square::VELOCITAT; + return Defaults::Enemies::Square::SPEED; case EnemyType::PINWHEEL: - return Defaults::Enemies::Pinwheel::VELOCITAT; + return Defaults::Enemies::Pinwheel::SPEED; default: - return Defaults::Enemies::Pentagon::VELOCITAT; + return Defaults::Enemies::Pentagon::SPEED; } } diff --git a/source/game/scenes/game_scene.cpp b/source/game/scenes/game_scene.cpp index a4d2f0b..31e5556 100644 --- a/source/game/scenes/game_scene.cpp +++ b/source/game/scenes/game_scene.cpp @@ -743,7 +743,7 @@ void GameScene::tocado(uint8_t player_id) { SHIP_POS, SHIP_ANGLE, 1.0F, - Defaults::Physics::Debris::VELOCITAT_BASE, + Defaults::Physics::Debris::SPEED_BASE, SHIP_BRIGHT, INHERITED_VEL, 0.0F, // sense herència angular @@ -930,8 +930,8 @@ void GameScene::fireBullet(uint8_t player_id) { Vec2 fire_position = {.x = tip_x, .y = tip_y}; // Buscar primera bullet inactiva en el pool del player. - // El pool global té MAX_BALES slots per jugador (P1=[0..MAX-1], P2=[MAX..2*MAX-1]). - constexpr int SLOTS_PER_PLAYER = Defaults::Entities::MAX_BALES; + // El pool global té MAX_BULLETS slots per jugador (P1=[0..MAX-1], P2=[MAX..2*MAX-1]). + constexpr int SLOTS_PER_PLAYER = Defaults::Entities::MAX_BULLETS; const int START_IDX = player_id * SLOTS_PER_PLAYER; for (int i = START_IDX; i < START_IDX + SLOTS_PER_PLAYER; i++) { if (!bullets_[i].isActive()) { diff --git a/source/game/scenes/game_scene.hpp b/source/game/scenes/game_scene.hpp index 09688d8..d634f81 100644 --- a/source/game/scenes/game_scene.hpp +++ b/source/game/scenes/game_scene.hpp @@ -67,7 +67,7 @@ class GameScene final : public Scene { std::array enemies_; // 6 balas: P1=[0,1,2], P2=[3,4,5]. El cast a size_t evita la // widening conversion implícita que detecta clang-tidy. - std::array(Constants::MAX_BALES) * 2> bullets_; + std::array(Constants::MAX_BULLETS) * 2> bullets_; std::array hit_timer_per_player_; // Death timers per player (seconds) // Lives and game over system diff --git a/source/game/scenes/logo_scene.cpp b/source/game/scenes/logo_scene.cpp index 5166bc3..84125a8 100644 --- a/source/game/scenes/logo_scene.cpp +++ b/source/game/scenes/logo_scene.cpp @@ -46,9 +46,8 @@ static auto computeLetterProgress(size_t letra_index, size_t num_letras, float g LogoScene::LogoScene(SDLManager& sdl, SceneContext& context) : sdl_(sdl), context_(context), - - debris_manager_(std::make_unique(sdl.getRenderer())) - { + + debris_manager_(std::make_unique(sdl.getRenderer())) { std::cout << "SceneType Logo: Inicialitzant...\n"; // Consumir opciones (LOGO no processa opciones actualment) @@ -196,10 +195,10 @@ void LogoScene::updateExplosions(float delta_time) { debris_manager_->explode( lletra.shape, // Forma a explode - lletra.position, // Posición + lletra.position, // Posición 0.0F, // Angle (sin rotación) ESCALA_FINAL, // Escala (lletres a scale final) - VELOCITAT_EXPLOSIO, // Velocidad base + SPEED_EXPLOSIO, // Velocidad base 1.0F, // Brightness màxim (per defecte) {.x = 0.0F, .y = 0.0F} // Sin velocity (per defecte) ); diff --git a/source/game/scenes/logo_scene.hpp b/source/game/scenes/logo_scene.hpp index 418d1b2..0a347e7 100644 --- a/source/game/scenes/logo_scene.hpp +++ b/source/game/scenes/logo_scene.hpp @@ -20,76 +20,76 @@ #include "game/effects/debris_manager.hpp" class LogoScene final : public Scene { - public: - explicit LogoScene(SDLManager& sdl, SceneManager::SceneContext& context); - ~LogoScene() override; // Destructor per aturar sons + public: + explicit LogoScene(SDLManager& sdl, SceneManager::SceneContext& context); + ~LogoScene() override; // Destructor per aturar sons - // Scene interface - void handleEvent(const SDL_Event& event) override; - void update(float delta_time) override; - void draw() override; - [[nodiscard]] auto isFinished() const -> bool override; + // Scene interface + void handleEvent(const SDL_Event& event) override; + void update(float delta_time) override; + void draw() override; + [[nodiscard]] auto isFinished() const -> bool override; - private: - // Màquina de estats per l'animación - enum class AnimationState : std::uint8_t { - PRE_ANIMATION, // Pantalla negra inicial - ANIMATION, // Animación de zoom de lletres - POST_ANIMATION, // Logo complet visible - EXPLOSION, // Explosión seqüencial de lletres - POST_EXPLOSION // Espera después de l'última explosión - }; + private: + // Màquina de estats per l'animación + enum class AnimationState : std::uint8_t { + PRE_ANIMATION, // Pantalla negra inicial + ANIMATION, // Animación de zoom de lletres + POST_ANIMATION, // Logo complet visible + EXPLOSION, // Explosión seqüencial de lletres + POST_EXPLOSION // Espera después de l'última explosión + }; - SDLManager& sdl_; - SceneManager::SceneContext& context_; - AnimationState estat_actual_{AnimationState::PRE_ANIMATION}; // Estat actual de la màquina - float - temps_estat_actual_{0.0F}; // Temps en l'state actual (reset en cada transición) + SDLManager& sdl_; + SceneManager::SceneContext& context_; + AnimationState estat_actual_{AnimationState::PRE_ANIMATION}; // Estat actual de la màquina + float + temps_estat_actual_{0.0F}; // Temps en l'state actual (reset en cada transición) - // Gestor de fragments de explosions - std::unique_ptr debris_manager_; + // Gestor de fragments de explosions + std::unique_ptr debris_manager_; - // Seguiment de explosions seqüencials - size_t lletra_explosio_index_{0}; // Índex de la següent lletra a explode - float temps_des_ultima_explosio_{0.0F}; // Temps desde l'última explosión - std::vector ordre_explosio_; // Ordre aleatori de índexs de lletres + // Seguiment de explosions seqüencials + size_t lletra_explosio_index_{0}; // Índex de la següent lletra a explode + float temps_des_ultima_explosio_{0.0F}; // Temps desde l'última explosión + std::vector ordre_explosio_; // Ordre aleatori de índexs de lletres - // Estructura para cada lletra del logo - struct LetraLogo { - std::shared_ptr shape; - Vec2 position; // Posición final en pantalla - float ancho; // Ancho del bounding box - float offset_centre; // Distancia de min_x a shape_centre.x - }; + // Estructura para cada lletra del logo + struct LetraLogo { + std::shared_ptr shape; + Vec2 position; // Posición final en pantalla + float ancho; // Ancho del bounding box + float offset_centre; // Distancia de min_x a shape_centre.x + }; - std::vector lletres_; // 9 lletres: J-A-I-L-G-A-M-E-S + std::vector lletres_; // 9 lletres: J-A-I-L-G-A-M-E-S - // Seguiment de sons de lletres (evitar reproduccions repetides) - std::array so_reproduit_; // Track si cada lletra ya ha reproduit el so + // Seguiment de sons de lletres (evitar reproduccions repetides) + std::array so_reproduit_; // Track si cada lletra ya ha reproduit el so - // Constants de animación - static constexpr float DURACIO_PRE = 1.5F; // Duració PRE_ANIMATION (pantalla negra) - static constexpr float DURACIO_ZOOM = 4.0F; // Duració del zoom (segons) - static constexpr float DURACIO_POST_ANIMATION = 3.0F; // Duració POST_ANIMATION (logo complet) - static constexpr float DURACIO_POST_EXPLOSION = 3.0F; // Duració POST_EXPLOSION (espera final) - static constexpr float DELAY_ENTRE_EXPLOSIONS = 0.1F; // Temps entre explosions de lletres - static constexpr float VELOCITAT_EXPLOSIO = 240.0F; // Velocidad base fragments (px/s) - static constexpr float ESCALA_INICIAL = 0.1F; // Escala inicial (10%) - static constexpr float ESCALA_FINAL = 0.8F; // Escala final (80%) - static constexpr float ESPAI_ENTRE_LLETRES = 10.0F; // Espaiat entre lletres + // Constants de animación + static constexpr float DURACIO_PRE = 1.5F; // Duració PRE_ANIMATION (pantalla negra) + static constexpr float DURACIO_ZOOM = 4.0F; // Duració del zoom (segons) + static constexpr float DURACIO_POST_ANIMATION = 3.0F; // Duració POST_ANIMATION (logo complet) + static constexpr float DURACIO_POST_EXPLOSION = 3.0F; // Duració POST_EXPLOSION (espera final) + static constexpr float DELAY_ENTRE_EXPLOSIONS = 0.1F; // Temps entre explosions de lletres + static constexpr float SPEED_EXPLOSIO = 240.0F; // Velocidad base fragments (px/s) + static constexpr float ESCALA_INICIAL = 0.1F; // Escala inicial (10%) + static constexpr float ESCALA_FINAL = 0.8F; // Escala final (80%) + static constexpr float ESPAI_ENTRE_LLETRES = 10.0F; // Espaiat entre lletres - // Constants de animación seqüencial - static constexpr float THRESHOLD_LETRA = 0.6F; // Umbral per activar següent lletra (0.0-1.0) - static constexpr float ORIGEN_ZOOM_X = Defaults::Game::WIDTH * 0.5F; // Vec2 inicial X del zoom - static constexpr float ORIGEN_ZOOM_Y = Defaults::Game::HEIGHT * 0.4F; // Vec2 inicial Y del zoom + // Constants de animación seqüencial + static constexpr float THRESHOLD_LETRA = 0.6F; // Umbral per activar següent lletra (0.0-1.0) + static constexpr float ORIGEN_ZOOM_X = Defaults::Game::WIDTH * 0.5F; // Vec2 inicial X del zoom + static constexpr float ORIGEN_ZOOM_Y = Defaults::Game::HEIGHT * 0.4F; // Vec2 inicial Y del zoom - // Métodos privats - void initLetters(); - void updateExplosions(float delta_time); - // Estático: solo consulta Input (singleton), no estado de la escena. - static auto checkSkipButtonPressed() -> bool; + // Métodos privats + void initLetters(); + void updateExplosions(float delta_time); + // Estático: solo consulta Input (singleton), no estado de la escena. + static auto checkSkipButtonPressed() -> bool; - // Métodos de gestió de estats - void changeState(AnimationState nou_estat); - [[nodiscard]] auto allLettersComplete() const -> bool; + // Métodos de gestió de estats + void changeState(AnimationState nou_estat); + [[nodiscard]] auto allLettersComplete() const -> bool; }; diff --git a/source/game/systems/collision_system.cpp b/source/game/systems/collision_system.cpp index a59292b..0d5b1ff 100644 --- a/source/game/systems/collision_system.cpp +++ b/source/game/systems/collision_system.cpp @@ -60,14 +60,14 @@ namespace Systems::Collision { enemy.destroy(); - constexpr float VELOCITAT_EXPLOSIO = 80.0F; // px/s (explosión suave) + constexpr float SPEED_EXPLOSIO = 80.0F; // px/s (explosión suave) const Vec2 INHERITED_VEL = ENEMY_VEL * Defaults::Physics::Debris::ENEMY_VELOCITY_INHERITANCE; ctx.debris_manager.explode( SHAPE, ENEMY_POS, 0.0F, // angle (rotación interna del enemy) 1.0F, // escala - VELOCITAT_EXPLOSIO, + SPEED_EXPLOSIO, BRIGHTNESS, INHERITED_VEL, 0.0F, // sense herència angular: evita que els 5 trossos curvin en bloc @@ -297,7 +297,7 @@ namespace Systems::Collision { } void desactivateOutOfBoundsBullets( - std::array(Defaults::Entities::MAX_BALES) * 2>& bullets, + std::array(Defaults::Entities::MAX_BULLETS) * 2>& bullets, Effects::DebrisManager& debris_manager) { float min_x; float max_x; diff --git a/source/game/systems/collision_system.hpp b/source/game/systems/collision_system.hpp index 49f8647..1503603 100644 --- a/source/game/systems/collision_system.hpp +++ b/source/game/systems/collision_system.hpp @@ -32,7 +32,7 @@ namespace Systems::Collision { struct Context { std::array& ships; std::array& enemies; - std::array(Defaults::Entities::MAX_BALES) * 2>& bullets; + std::array(Defaults::Entities::MAX_BULLETS) * 2>& bullets; std::array& hit_timer_per_player; std::array& score_per_player; std::array& lives_per_player; @@ -74,7 +74,7 @@ namespace Systems::Collision { // (8 fragments de l'octàgon) i el so HIT. Cal cridar-la després de detectAll() // perquè una bala que el mateix frame xoca i alhora surt es comptabilitzi com a impacte. void desactivateOutOfBoundsBullets( - std::array(Defaults::Entities::MAX_BALES) * 2>& bullets, + std::array(Defaults::Entities::MAX_BULLETS) * 2>& bullets, Effects::DebrisManager& debris_manager); } // namespace Systems::Collision