From ddcd2076a1d22d4b5f9fa8e5a70c3d05be6e018f Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Tue, 26 May 2026 18:57:26 +0200 Subject: [PATCH 1/3] refactor(audio): renombrar explosion/explosion2 a enemy_explosion/player_explosion --- .../effects/{explosion.wav => enemy_explosion.wav} | Bin .../{explosion2.wav => player_explosion.wav} | Bin source/core/defaults/audio.hpp | 4 ++-- source/game/effects/debris_manager.hpp | 2 +- source/game/scenes/game_scene.cpp | 2 +- source/game/systems/enemy_event_dispatcher.cpp | 2 +- 6 files changed, 5 insertions(+), 5 deletions(-) rename data/sounds/effects/{explosion.wav => enemy_explosion.wav} (100%) rename data/sounds/effects/{explosion2.wav => player_explosion.wav} (100%) diff --git a/data/sounds/effects/explosion.wav b/data/sounds/effects/enemy_explosion.wav similarity index 100% rename from data/sounds/effects/explosion.wav rename to data/sounds/effects/enemy_explosion.wav diff --git a/data/sounds/effects/explosion2.wav b/data/sounds/effects/player_explosion.wav similarity index 100% rename from data/sounds/effects/explosion2.wav rename to data/sounds/effects/player_explosion.wav diff --git a/source/core/defaults/audio.hpp b/source/core/defaults/audio.hpp index 84ea984..ecc7f71 100644 --- a/source/core/defaults/audio.hpp +++ b/source/core/defaults/audio.hpp @@ -35,8 +35,8 @@ namespace Defaults::Music { namespace Defaults::Sound { constexpr const char* CONTINUE = "effects/continue.wav"; // Cuenta atras - constexpr const char* EXPLOSION = "effects/explosion.wav"; // Explosión - constexpr const char* EXPLOSION2 = "effects/explosion2.wav"; // Explosión alternativa + constexpr const char* ENEMY_EXPLOSION = "effects/enemy_explosion.wav"; // Explosió d'enemic (debris default) + constexpr const char* PLAYER_EXPLOSION = "effects/player_explosion.wav"; // Explosió de la nau del jugador 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* HURT = "effects/hurt.wav"; // Nau pròpia entra a HURT diff --git a/source/game/effects/debris_manager.hpp b/source/game/effects/debris_manager.hpp index 4a64be1..ec56584 100644 --- a/source/game/effects/debris_manager.hpp +++ b/source/game/effects/debris_manager.hpp @@ -64,7 +64,7 @@ namespace Effects { const Vec2& velocitat_objecte = {.x = 0.0F, .y = 0.0F}, float velocitat_angular = 0.0F, float factor_herencia_visual = 0.0F, - const std::string& sound = Defaults::Sound::EXPLOSION, + const std::string& sound = Defaults::Sound::ENEMY_EXPLOSION, SDL_Color color = {0, 0, 0, 0}, // alpha==0 → fragmentos usan oscilador global float lifetime = Defaults::Physics::Debris::TEMPS_VIDA, float friction = Defaults::Physics::Debris::ACCELERACIO, diff --git a/source/game/scenes/game_scene.cpp b/source/game/scenes/game_scene.cpp index dc1dbc2..5a61d40 100644 --- a/source/game/scenes/game_scene.cpp +++ b/source/game/scenes/game_scene.cpp @@ -801,7 +801,7 @@ void GameScene::tocado(uint8_t player_id, const Vec2& bullet_velocity) { INHERITED_VEL, 0.0F, // sense herència angular 0.0F, // sin herencia visual - Defaults::Sound::EXPLOSION2, + Defaults::Sound::PLAYER_EXPLOSION, ships_[player_id].getConfig().colors.normal, Defaults::Physics::Debris::ENEMY_LIFETIME, Defaults::Physics::Debris::ENEMY_FRICTION, diff --git a/source/game/systems/enemy_event_dispatcher.cpp b/source/game/systems/enemy_event_dispatcher.cpp index e4f6ec2..2a19957 100644 --- a/source/game/systems/enemy_event_dispatcher.cpp +++ b/source/game/systems/enemy_event_dispatcher.cpp @@ -48,7 +48,7 @@ namespace Systems::EnemyEvents { INHERITED_VEL, 0.0F, 0.0F, - Defaults::Sound::EXPLOSION, + Defaults::Sound::ENEMY_EXPLOSION, color, Defaults::Physics::Debris::ENEMY_LIFETIME, Defaults::Physics::Debris::ENEMY_FRICTION, From b936f410ce080b187722cb9043e8381ee48c79ac Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Tue, 26 May 2026 19:03:19 +0200 Subject: [PATCH 2/3] feat(audio): so enemy_hit per a debris_partial (impacte parcial a enemic amb HP>1) --- data/sounds/effects/enemy_hit.wav | Bin 0 -> 7388 bytes source/core/defaults/audio.hpp | 1 + .../game/systems/enemy_event_dispatcher.cpp | 19 +++++++++--------- 3 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 data/sounds/effects/enemy_hit.wav diff --git a/data/sounds/effects/enemy_hit.wav b/data/sounds/effects/enemy_hit.wav new file mode 100644 index 0000000000000000000000000000000000000000..50d9bbd28a013e28b658bcbd12d29282585fb216 GIT binary patch literal 7388 zcmd7W+fy1>7yxkc))!4;+o_sF?eskpn~K*cUSh&brky5$(-~t#E?T^S0YQ)rf*|*6 zpo)M|)EFZQ<}s}{3glAbQ#;c?r)L2b>@ItD#k9W<7+}9$n6u}c@9f@Zc6R=Gl}77o z<=hqyORFx?XtWC;G_Pr?=LOnlw0q14ta9)@^ZU*pm=8KxMd1BC?zoU%eZBU2^^I?7 zG(K0#wS%L4hoy!ZIt8^gbvG)n5vzbz39qWMDyaGj4F3hA>nRb>|C8IN?(HtLhv%=S zr|03L?!F%@ii(Phi$Gi~#&St0ceAv6Osq`AZNbV+(<2frVfw82S`~g%fbI zTbLbpZ{O*p;0|SXDPkTO@rMGzK*8D}aL$7M@W#uHmj$q15HB#Tqu;KFeeSc*aPD*C zae1w4@8j>1ZZ<2fa2luNxY8eg9jklVP-GbK)uLT05 znbF+BXxF%mcC*c5&1Ip;Y%yES7VB{T;K1O3=w}e3{@M7uw;9A|C6$rCxs!=xB9V+I z_ddjCp9Qk#)xwPVK*(=57lJ8=(X5va10w}9IwTRvc&5KU9DY1FJotzPrUN2>WP5*@ z{Oh@FTCI6fNG6BF>BwQH#$k8ZoK}yvx1TQ%2!sORS*4D_VR2aO+>1EUS88ky8|>4? zlDNEQm0D+deD-MK*Ec)A@8+?S&+g9dZ@VDjbz(-O7?nvLk39wt5G18{0 zGxvW(FF;Q1U^@!){>!7NXKQz zPI@8iJDFTI;hdvpHe=3lw%Z3Lx9=(S3EHkjsMbY|Cb$+}U0z)wvYcZj3}Rsl(IA>9 zq>D15bI<#a!8E*o4vpE+aJS$QueXnjsSgW}%kLFU>8453sU>0%&_JqqOl+}BNhB@p>j(NtO>5fDi3|P{n$|p<-RVpx-D+*k4 zC5bYQrXniz7jTdF?+tRYS2~lB!%3N;CRr~adQo=Co`OE}=|pnviD<}~ItH~L$)>?h G*Zc!tCXYV= literal 0 HcmV?d00001 diff --git a/source/core/defaults/audio.hpp b/source/core/defaults/audio.hpp index ecc7f71..d9453a3 100644 --- a/source/core/defaults/audio.hpp +++ b/source/core/defaults/audio.hpp @@ -36,6 +36,7 @@ namespace Defaults::Sound { constexpr const char* CONTINUE = "effects/continue.wav"; // Cuenta atras constexpr const char* ENEMY_EXPLOSION = "effects/enemy_explosion.wav"; // Explosió d'enemic (debris default) + constexpr const char* ENEMY_HIT = "effects/enemy_hit.wav"; // Impacte parcial a enemic (debris_partial — HP > 1) constexpr const char* PLAYER_EXPLOSION = "effects/player_explosion.wav"; // Explosió de la nau del jugador 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) diff --git a/source/game/systems/enemy_event_dispatcher.cpp b/source/game/systems/enemy_event_dispatcher.cpp index 2a19957..1def771 100644 --- a/source/game/systems/enemy_event_dispatcher.cpp +++ b/source/game/systems/enemy_event_dispatcher.cpp @@ -31,9 +31,10 @@ namespace Systems::EnemyEvents { } // Helper compartit per CREATE_DEBRIS i CREATE_DEBRIS_PARTIAL: única - // crida a explode(), paràmetres alineats; només canvien piece_scale - // (1.0 explosió, 0.3 xip) i el color (cos vs hit-feedback). - void spawnDebrisForEnemy(Systems::Collision::Context& ctx, const Enemy& enemy, const Bullet* bullet, float piece_scale, SDL_Color color) { + // crida a explode(), paràmetres alineats; canvien piece_scale (1.0 + // explosió, 0.3 xip), el color (cos vs hit-feedback) i el so + // (ENEMY_EXPLOSION en la mort vs ENEMY_HIT en l'impacte parcial). + void spawnDebrisForEnemy(Systems::Collision::Context& ctx, const Enemy& enemy, const Bullet* bullet, float piece_scale, SDL_Color color, const char* sound) { constexpr float SPEED_EXPLOSIO = 80.0F; const Vec2 INHERITED_VEL = enemy.getVelocityVector() * Defaults::Physics::Debris::ENEMY_VELOCITY_INHERITANCE; @@ -48,7 +49,7 @@ namespace Systems::EnemyEvents { INHERITED_VEL, 0.0F, 0.0F, - Defaults::Sound::ENEMY_EXPLOSION, + sound, color, Defaults::Physics::Debris::ENEMY_LIFETIME, Defaults::Physics::Debris::ENEMY_FRICTION, @@ -207,13 +208,13 @@ namespace Systems::EnemyEvents { doAddScore(ctx, enemy, shooter_id); break; case EnemyActionType::CREATE_DEBRIS: - // Explosió de mort: trossos en color cos (correcte físicament). - spawnDebrisForEnemy(ctx, enemy, bullet, 1.0F, enemy.getConfig().colors.normal); + // Explosió de mort: trossos en color cos + so ENEMY_EXPLOSION. + spawnDebrisForEnemy(ctx, enemy, bullet, 1.0F, enemy.getConfig().colors.normal, Defaults::Sound::ENEMY_EXPLOSION); break; case EnemyActionType::CREATE_DEBRIS_PARTIAL: - // Xip d'impacte: trossos en color wounded (daurat) per - // diferenciar-los visualment del cos i marcar "damage". - spawnDebrisForEnemy(ctx, enemy, bullet, Defaults::Enemies::Debris::PARTIAL_PIECE_SCALE, enemy.getConfig().colors.wounded); + // Xip d'impacte: trossos en color wounded (daurat) + so + // ENEMY_HIT, diferent de l'explosió per marcar damage no letal. + spawnDebrisForEnemy(ctx, enemy, bullet, Defaults::Enemies::Debris::PARTIAL_PIECE_SCALE, enemy.getConfig().colors.wounded, Defaults::Sound::ENEMY_HIT); break; case EnemyActionType::CREATE_FIREWORKS: // Burst de mort: línia blanca + glow wounded (daurat) per From 86775d4642f3e33f6f1e8ef3b7290fbed224f211 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Tue, 26 May 2026 19:05:43 +0200 Subject: [PATCH 3/3] =?UTF-8?q?refactor(audio):=20renombrar=20hit.wav=20a?= =?UTF-8?q?=20bullet=5Fzap.wav=20(desintegraci=C3=B3=20de=20bala,=20no=20H?= =?UTF-8?q?URT=20d'enemic)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/sounds/effects/{hit.wav => bullet_zap.wav} | Bin source/core/defaults/audio.hpp | 2 +- source/game/systems/collision_system.cpp | 4 ++-- 3 files changed, 3 insertions(+), 3 deletions(-) rename data/sounds/effects/{hit.wav => bullet_zap.wav} (100%) diff --git a/data/sounds/effects/hit.wav b/data/sounds/effects/bullet_zap.wav similarity index 100% rename from data/sounds/effects/hit.wav rename to data/sounds/effects/bullet_zap.wav diff --git a/source/core/defaults/audio.hpp b/source/core/defaults/audio.hpp index d9453a3..126c7a1 100644 --- a/source/core/defaults/audio.hpp +++ b/source/core/defaults/audio.hpp @@ -39,7 +39,7 @@ namespace Defaults::Sound { constexpr const char* ENEMY_HIT = "effects/enemy_hit.wav"; // Impacte parcial a enemic (debris_partial — HP > 1) constexpr const char* PLAYER_EXPLOSION = "effects/player_explosion.wav"; // Explosió de la nau del jugador 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* BULLET_ZAP = "effects/bullet_zap.wav"; // Bala desintegrant-se (qualsevol impacte o eixida de playarea) constexpr const char* HURT = "effects/hurt.wav"; // Nau pròpia entra a 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 diff --git a/source/game/systems/collision_system.cpp b/source/game/systems/collision_system.cpp index 487c4ba..1db2c63 100644 --- a/source/game/systems/collision_system.cpp +++ b/source/game/systems/collision_system.cpp @@ -15,7 +15,7 @@ namespace Systems::Collision { namespace { - // Trenca una bala en debris (8 fragments de l'octàgon) + so HIT + desactiva. + // Trenca una bala en debris (8 fragments de l'octàgon) + so BULLET_ZAP + desactiva. // S'invoca des de qualsevol desactivació de bala (impacte amb enemic, amb jugador, // o sortida del PLAYAREA) per a un feedback visual i sonor consistent. void breakBullet(Effects::DebrisManager& debris_manager, Bullet& bullet) { @@ -30,7 +30,7 @@ namespace Systems::Collision { Vec2{}, // sense herència de velocitat (fragments radials) 0.0F, // sense velocity angular heretada 0.0F, // sense rotació visual heretada - Defaults::Sound::HIT, + Defaults::Sound::BULLET_ZAP, bullet.getConfig().colors.normal, Defaults::Physics::Debris::TEMPS_VIDA, Defaults::Physics::Debris::ACCELERACIO,