feat(audio): so enemy_hit per a debris_partial (impacte parcial a enemic amb HP>1)

This commit is contained in:
2026-05-26 19:03:19 +02:00
parent ddcd2076a1
commit b936f410ce
3 changed files with 11 additions and 9 deletions
Binary file not shown.
+1
View File
@@ -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)
+10 -9
View File
@@ -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