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/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/enemy_hit.wav b/data/sounds/effects/enemy_hit.wav new file mode 100644 index 0000000..50d9bbd Binary files /dev/null and b/data/sounds/effects/enemy_hit.wav differ 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..126c7a1 100644 --- a/source/core/defaults/audio.hpp +++ b/source/core/defaults/audio.hpp @@ -35,10 +35,11 @@ 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* 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/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/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, diff --git a/source/game/systems/enemy_event_dispatcher.cpp b/source/game/systems/enemy_event_dispatcher.cpp index e4f6ec2..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::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