From e6eaf870c697e56512b8b7195db31c1d25822204 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Thu, 21 May 2026 18:51:55 +0200 Subject: [PATCH 1/4] tune(bullets): puja MAX_BALES a 50 i deshardcoded el slot per jugador --- source/core/defaults/entities.hpp | 2 +- source/game/scenes/game_scene.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/source/core/defaults/entities.hpp b/source/core/defaults/entities.hpp index 4bd5de4..56b5cd1 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 = 3; + constexpr int MAX_BALES = 50; constexpr float SHIP_RADIUS = 12.0F; constexpr float ENEMY_RADIUS = 20.0F; diff --git a/source/game/scenes/game_scene.cpp b/source/game/scenes/game_scene.cpp index dfaf3cc..fb3136a 100644 --- a/source/game/scenes/game_scene.cpp +++ b/source/game/scenes/game_scene.cpp @@ -850,9 +850,11 @@ void GameScene::fireBullet(uint8_t player_id) { float tip_y = (LOCAL_TIP_X * sin_a) + (LOCAL_TIP_Y * cos_a) + ship_centre.y; Vec2 posicio_dispar = {.x = tip_x, .y = tip_y}; - // Buscar primera bullet inactiva en el pool del player - int start_idx = player_id * 3; // P1=[0,1,2], P2=[3,4,5] - for (int i = start_idx; i < start_idx + 3; i++) { + // 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; + 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()) { bullets_[i].disparar(posicio_dispar, ship_angle, player_id); break; From 1c1fd1273b2f756192f9e8e00541d76726b54613 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Thu, 21 May 2026 18:55:01 +0200 Subject: [PATCH 2/4] tune(ship): puja MAX_VELOCITY de 120 a 180 px/s --- source/core/defaults/physics.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/core/defaults/physics.hpp b/source/core/defaults/physics.hpp index 1de337f..e3fbf4e 100644 --- a/source/core/defaults/physics.hpp +++ b/source/core/defaults/physics.hpp @@ -7,7 +7,7 @@ namespace Defaults::Physics { constexpr float ROTATION_SPEED = 3.14F; // rad/s (~180°/s) constexpr float ACCELERATION = 400.0F; // px/s² - constexpr float MAX_VELOCITY = 120.0F; // px/s + constexpr float MAX_VELOCITY = 180.0F; // px/s constexpr float FRICTION = 20.0F; // px/s² // Bullet — impacto físico contra enemigo (impulse mass-aware). From 7646daef3d355eb0dec32de109303ed99b4593d2 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Thu, 21 May 2026 18:58:33 +0200 Subject: [PATCH 3/4] =?UTF-8?q?tune(stages):=20stage=201=20a=2050=20enemic?= =?UTF-8?q?s=20i=20puja=20el=20cap=20de=20validaci=C3=B3=20a=20200?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/stages/stages.yaml | 6 +- source/game/stage_system/stage_config.hpp | 94 +++++++++++------------ 2 files changed, 50 insertions(+), 50 deletions(-) diff --git a/data/stages/stages.yaml b/data/stages/stages.yaml index d2eee4f..4b0b610 100644 --- a/data/stages/stages.yaml +++ b/data/stages/stages.yaml @@ -9,11 +9,11 @@ metadata: stages: # STAGE 1: Tutorial - Only pentagons, slow speed - stage_id: 1 - total_enemies: 5 + total_enemies: 50 spawn_config: mode: "progressive" - initial_delay: 2.0 - spawn_interval: 3.0 + initial_delay: 0.3 + spawn_interval: 0.4 enemy_distribution: pentagon: 100 cuadrado: 0 diff --git a/source/game/stage_system/stage_config.hpp b/source/game/stage_system/stage_config.hpp index 2227bf9..c8665db 100644 --- a/source/game/stage_system/stage_config.hpp +++ b/source/game/stage_system/stage_config.hpp @@ -10,46 +10,46 @@ namespace StageSystem { -// Tipo de mode de spawn -enum class ModeSpawn : std::uint8_t { - PROGRESSIVE, // Spawn progressiu con intervals - IMMEDIATE, // Todos los enemigos de cop - WAVE // Onades de 3-5 enemigos (futura extensió) -}; + // Tipo de mode de spawn + enum class ModeSpawn : std::uint8_t { + PROGRESSIVE, // Spawn progressiu con intervals + IMMEDIATE, // Todos los enemigos de cop + WAVE // Onades de 3-5 enemigos (futura extensió) + }; -// Configuración de spawn -struct ConfigSpawn { + // Configuración de spawn + struct ConfigSpawn { ModeSpawn mode; float delay_inicial; // Segons antes del primer spawn float interval_spawn; // Segons entre spawns consecutius -}; + }; -// Distribució de type de enemigos (percentatges) -struct DistribucioEnemics { + // Distribució de type de enemigos (percentatges) + struct DistribucioEnemics { uint8_t pentagon; // 0-100 - uint8_t cuadrado; // 0-100 + uint8_t cuadrado; // 0-100 uint8_t molinillo; // 0-100 // Suma ha de ser 100, validat en StageLoader -}; + }; -// Multiplicadors de dificultat -struct MultiplicadorsDificultat { - float velocity; // 0.5-2.0 típic - float rotation; // 0.5-2.0 típic + // Multiplicadors de dificultat + struct MultiplicadorsDificultat { + float velocity; // 0.5-2.0 típic + float rotation; // 0.5-2.0 típic float tracking_strength; // 0.0-1.5 (aplicat a Cuadrado) -}; + }; -// Metadades del file YAML -struct MetadataStages { + // Metadades del file YAML + struct MetadataStages { std::string version; uint8_t total_stages; std::string descripcio; -}; + }; -// Configuración completa de un stage -struct StageConfig { + // Configuración completa de un stage + struct StageConfig { uint8_t stage_id; // 1-10 - uint8_t total_enemies; // 5-15 + uint8_t total_enemies; // 1-200 (el cap simultani en pantalla el marca MAX_ORNIS) ConfigSpawn config_spawn; DistribucioEnemics distribucio; MultiplicadorsDificultat multiplicadors; @@ -59,13 +59,13 @@ struct StageConfig { // stage_id es uint8_t: el rango superior (<=255) está garantizado por // el tipo; basta con confirmar que no es 0 (sentinela "sin asignar"). return stage_id >= 1 && - total_enemies > 0 && total_enemies <= 15 && + total_enemies > 0 && total_enemies <= 200 && distribucio.pentagon + distribucio.cuadrado + distribucio.molinillo == 100; } -}; + }; -// Configuración completa del sistema (carregada desde YAML) -struct StageSystemConfig { + // Configuración completa del sistema (carregada desde YAML) + struct StageSystemConfig { MetadataStages metadata; std::vector stages; // Índex [0] = stage 1 @@ -76,26 +76,26 @@ struct StageSystemConfig { } return &stages[stage_id - 1]; } -}; + }; -// Constants per messages de transición -namespace Constants { -// Pool de messages per start de level (selecció aleatòria) -inline constexpr std::array MISSATGES_LEVEL_START = { - "ORNI ALERT!", - "INCOMING ORNIS!", - "ROLLING THREAT!", - "ENEMY WAVE!", - "WAVE OF ORNIS DETECTED!", - "NEXT SWARM APPROACHING!", - "BRACE FOR THE NEXT WAVE!", - "ANOTHER ATTACK INCOMING!", - "SENSORS DETECT HOSTILE ORNIS...", - "UNIDENTIFIED ROLLING OBJECTS INBOUND!", - "ENEMY FORCES MOBILIZING!", - "PREPARE FOR IMPACT!"}; + // Constants per messages de transición + namespace Constants { + // Pool de messages per start de level (selecció aleatòria) + inline constexpr std::array MISSATGES_LEVEL_START = { + "ORNI ALERT!", + "INCOMING ORNIS!", + "ROLLING THREAT!", + "ENEMY WAVE!", + "WAVE OF ORNIS DETECTED!", + "NEXT SWARM APPROACHING!", + "BRACE FOR THE NEXT WAVE!", + "ANOTHER ATTACK INCOMING!", + "SENSORS DETECT HOSTILE ORNIS...", + "UNIDENTIFIED ROLLING OBJECTS INBOUND!", + "ENEMY FORCES MOBILIZING!", + "PREPARE FOR IMPACT!"}; -constexpr const char* MISSATGE_LEVEL_COMPLETED = "GOOD JOB COMMANDER!"; -} // namespace Constants + constexpr const char* MISSATGE_LEVEL_COMPLETED = "GOOD JOB COMMANDER!"; + } // namespace Constants } // namespace StageSystem From dec72340de350a2f9de2b423c0fd43828f7bda7c Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Thu, 21 May 2026 19:05:42 +0200 Subject: [PATCH 4/4] feat(audio): so hit.wav quan l'enemic passa a ferit --- data/sounds/effects/hit.wav | Bin 0 -> 4090 bytes source/core/defaults/audio.hpp | 1 + source/game/entities/enemy.cpp | 2 ++ 3 files changed, 3 insertions(+) create mode 100644 data/sounds/effects/hit.wav diff --git a/data/sounds/effects/hit.wav b/data/sounds/effects/hit.wav new file mode 100644 index 0000000000000000000000000000000000000000..e2a2ee88af172e2092b8bc537aa5854509c0a38e GIT binary patch literal 4090 zcmdVc?@J090tV@ zWkOmMNgTq(5M3jZNIIlY7NZCyiHm%3(h(i^X5s#VduGg|cCXcm4t77{cOLZ_XP)mo zzvN<(=#gYvUE zmuZ5<{DH|D`<_DiW$wk?Yw$1gVKurMqrpZ@p!a(A;6i0D^~aEzXBibRO4#&@)wp0X zSL?RvGAvY#K12%oP;tW-U*dY&Rma;is{24t8~rZ0(!eJ5nGC9Hr0m%mpAp)WJ`RiY zfm}&9{Ka6(CgcfHobys__u}Yq{bY8SuSy@sWsqv*A#axzTV^z;Lx;QbZu$VU^!uSl zy0N?I9O1F7#XprYJC8Q5YsTbjPJ?dE!DeosR!U);X6WTv%Wcxh8NxF}FFf2zJ(@|D zGEr6NSB|}j!SYD4jdEvwrTz3!;^?iMY2uC_dxTcAVGsLC?p{qU7j{mX^^QDlN07lAiL$(eZz*Hd>xFs{BhK;oSfpt(t-)O?qI)?Gr6)! zmt}yCVSGMo%oZrrULnCq7+x&rod%Zna^I$TqWr54JLqFttwhY9nwCur(ja9dBAJ-= z`w>K|&YczLbhJ>pxHxV^sno>`YA|5MG>s-tB#799FAB zY_3!+9G=AzZ@0Izxvj0*`T2&=2aSydFs#{XRm$aTCc|Ygus3hqVlgC>xp#K*GCp4< zk-*JnQ!+ffgsoj(9>K8JZjaULDF_lzO_?t*n^LLt@!+5p!;n; zoy}&O5{ZP6!+}muPj{V8=Yr8_Tr8K%rS! z0|szoY_`^en-Snt7J`jn)Do~FA+g-;!y%qx`Epy&cR#Os2}30 z0fK;wdnzWVH8?GPyH=~`w~nI&!WL*b&O+4DXw<4JVURY$BFH#FVe3={5v2CYGRW+e zSmy#nw0rS}UkR^Z*C6B68-m>nb&oGKP*?ZTkfhU+n^7X-j?!)=Tv+J`>eL7(-od#8 zBH?7i+$30ZWaP*RnaG;Ii@uWbekBA<;QhhZhMNkY^KFtwOw*l^ z#utZsaBZILr`TC#ZjWG%B!SG+CDYB`udDAHSkON{aL=TYN#zIXf=$qUxXUQ~uX8$E xn|p};^zGht7VISTn7r@d=kDI=e>~p9EYtfhNGv&SkN0EY`-F6N(4Wc?`3H1@LjwQ+ literal 0 HcmV?d00001 diff --git a/source/core/defaults/audio.hpp b/source/core/defaults/audio.hpp index 6000c0f..216d186 100644 --- a/source/core/defaults/audio.hpp +++ b/source/core/defaults/audio.hpp @@ -38,6 +38,7 @@ namespace Defaults::Sound { constexpr const char* EXPLOSION = "effects/explosion.wav"; // Explosión constexpr const char* EXPLOSION2 = "effects/explosion2.wav"; // Explosión alternativa constexpr const char* FRIENDLY_FIRE_HIT = "effects/friendly_fire.wav"; // Friendly fire hit + constexpr const char* HIT = "effects/hit.wav"; // Enemic ferit (primer impacte → HURT) constexpr const char* INIT_HUD = "effects/init_hud.wav"; // Para la animación del HUD constexpr const char* LASER = "effects/laser_shoot.wav"; // Disparo constexpr const char* LOGO = "effects/logo.wav"; // Logo diff --git a/source/game/entities/enemy.cpp b/source/game/entities/enemy.cpp index c0626be..197406a 100644 --- a/source/game/entities/enemy.cpp +++ b/source/game/entities/enemy.cpp @@ -8,6 +8,7 @@ #include #include +#include "core/audio/audio.hpp" #include "core/defaults.hpp" #include "core/entities/entity.hpp" #include "core/graphics/shape_loader.hpp" @@ -276,6 +277,7 @@ void Enemy::destruir() { void Enemy::herir(uint8_t shooter_id) { wounded_timer_ = Defaults::Enemies::Wounded::DURATION; last_hit_by_ = shooter_id; + Audio::get()->playSound(Defaults::Sound::HIT, Audio::Group::GAME); } void Enemy::applyImpulse(const Vec2& impulse) {