Use catalog sound identifiers throughout runtime
build / mod (push) Failing after 19s

Co-Authored-By: Codex <noreply@openai.com>
This commit is contained in:
2026-11-04 15:59:12 +03:00
parent 1553976484
commit daa9ed7cbc
6 changed files with 83 additions and 60 deletions
+8 -6
View File
@@ -4,6 +4,8 @@
//! world and a director's camera (a full-screen camera view) follows them —
//! behind the drone, then behind the interceptor or from the side — slowing
//! time round the moment itself.
use crate::sim::catalog::sound;
use crate::film::{self, Film};
use crate::panel::distance;
use crate::sim::Ground;
@@ -526,11 +528,11 @@ impl Player {
for e in rec.events.iter().filter(|e| (self.heard..self.t).contains(&(e.at as f64))) {
let event = match e.kind {
EventKind::Kill { kind, outcome, .. } => crate::sim::outcome::look(kind, outcome).3,
EventKind::Hit { power, .. } | EventKind::Crash { power, .. } => ["airdef:blast.air", "airdef:blast.medium", "airdef:blast.big", "airdef:blast.heavy", "airdef:blast.huge"][(power as usize).min(4)],
EventKind::SamLost { .. } => "airdef:blast.big",
EventKind::Split { .. } => "airdef:boom.sonic",
EventKind::Hit { power, .. } | EventKind::Crash { power, .. } => [sound::BLAST_AIR, sound::BLAST_MEDIUM, sound::BLAST_BIG, sound::BLAST_HEAVY, sound::BLAST_HUGE][(power as usize).min(4)],
EventKind::SamLost { .. } => sound::BLAST_BIG,
EventKind::Split { .. } => sound::BOOM_SONIC,
EventKind::Strike { result: StrikeResult::Halted, .. } => continue,
EventKind::Strike { result, .. } => ["airdef:blast.air", "airdef:blast.medium", "airdef:blast.big", "airdef:blast.heavy", "airdef:blast.huge"][match result {
EventKind::Strike { result, .. } => [sound::BLAST_AIR, sound::BLAST_MEDIUM, sound::BLAST_BIG, sound::BLAST_HEAVY, sound::BLAST_HUGE][match result {
StrikeResult::Destroyed => 4,
StrikeResult::Intercepted => 0,
_ => 3,
@@ -539,7 +541,7 @@ impl Player {
let gain = if let EventKind::Kill { kind, outcome, .. } = e.kind { crate::sim::outcome::look(kind, outcome).2 } else { 1.0 };
out.sound(event, heard(e.pos), gain, 1.0);
if let EventKind::Kill { outcome: crate::sim::outcome::Outcome::AirDetonation, .. } = e.kind {
out.sound("airdef:boom.sonic", heard(e.pos), 0.8, 1.2);
out.sound(sound::BOOM_SONIC, heard(e.pos), 0.8, 1.2);
}
}
// New recordings carry the exact launch and ignition sounds and their actual positions.
@@ -570,7 +572,7 @@ impl Player {
for tr in rec.tracks.iter().filter(|tr| matches!(tr.what, What::StrikeCarrier(_))) {
let at = tr.first as f64 + crate::sim::strike::EJECT_TICKS as f64;
if (self.heard..self.t).contains(&at) && let Some(p) = tr.at(rec.origin, at) {
out.sound("airdef:launch.s400", heard(p), 1.0, 1.0);
out.sound(sound::LAUNCH_S400, heard(p), 1.0, 1.0);
}
}
self.heard = self.t;