aboutsummaryrefslogtreecommitdiff
path: root/apps/fparkan-game/src/audio.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-11-14 05:15:43 +0300
committerValentin Popov <valentin@popov.link>2026-11-14 05:15:43 +0300
commita64952035364c82f778381f39e221be0c4ee1415 (patch)
tree39ab82994d667028562c84633e71f602d3de2aed /apps/fparkan-game/src/audio.rs
parentdb3f404b3d6d24144c49ae5248262ab1d8d55e21 (diff)
downloadfparkan-a64952035364c82f778381f39e221be0c4ee1415.tar.xz
fparkan-a64952035364c82f778381f39e221be0c4ee1415.zip
feat(runtime): resolve mission objectives and outcome
Diffstat (limited to 'apps/fparkan-game/src/audio.rs')
-rw-r--r--apps/fparkan-game/src/audio.rs19
1 files changed, 18 insertions, 1 deletions
diff --git a/apps/fparkan-game/src/audio.rs b/apps/fparkan-game/src/audio.rs
index 5f7001d4..80cf97f9 100644
--- a/apps/fparkan-game/src/audio.rs
+++ b/apps/fparkan-game/src/audio.rs
@@ -998,8 +998,25 @@ impl GameAudio {
.map_err(|error| error.to_string())?;
let (archive, file) = voice_resource(&mission, &symbol)?
.ok_or_else(|| format!("voice resource {symbol} is missing in {mission_cfg}"))?;
+ self.queue_voice_asset(&archive, &file)
+ }
+
+ pub(crate) fn queue_game_voice(&mut self, symbol: &str) -> Result<String, String> {
+ let path = normalize_relative(b"ui/game_resources.cfg", PathPolicy::StrictLegacy)
+ .expect("valid game resources path");
+ let bytes = self
+ .library
+ .vfs
+ .read(&path)
+ .map_err(|error| error.to_string())?;
+ let (archive, file) = voice_resource(&bytes, symbol)?
+ .ok_or_else(|| format!("voice resource {symbol} is missing in {}", path.as_str()))?;
+ self.queue_voice_asset(&archive, &file)
+ }
+
+ fn queue_voice_asset(&mut self, archive: &str, file: &str) -> Result<String, String> {
let asset = self
- .dynamic_sound(&archive, &file)
+ .dynamic_sound(archive, file)
.map_err(|error| error.to_string())?;
self.mission_voice
.append(decoder_for(&asset).map_err(|error| error.to_string())?);