aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-12-02 12:41:14 +0300
committerValentin Popov <valentin@popov.link>2026-12-02 12:41:14 +0300
commitf12b2c55910fe4c79272a9a7b17ed49293078e4a (patch)
treea944ce00b748ea75b11d1eaa1dd2c4c66adac4ea /crates/fparkan-runtime
parentc846377ead77ef7184cdeddd25c3f2c9d76a6736 (diff)
downloadfparkan-f12b2c55910fe4c79272a9a7b17ed49293078e4a.tar.xz
fparkan-f12b2c55910fe4c79272a9a7b17ed49293078e4a.zip
feat(ui): play original warbot selection voices
Resolve the three original sound banks through the mission voice queue. Compare the first selection, repeated clicks, a reopened list, and heavy and medium warbots from the stock Two Fortresses start.
Diffstat (limited to 'crates/fparkan-runtime')
-rw-r--r--crates/fparkan-runtime/src/strategic_roster.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/crates/fparkan-runtime/src/strategic_roster.rs b/crates/fparkan-runtime/src/strategic_roster.rs
index f5fc4dfd..8abe3d44 100644
--- a/crates/fparkan-runtime/src/strategic_roster.rs
+++ b/crates/fparkan-runtime/src/strategic_roster.rs
@@ -71,6 +71,8 @@ pub struct WarbotRow {
pub chassis: u32,
/// Whether the unit is eligible for automatic selection.
pub selectable: bool,
+ /// Original sound resource symbol played when selecting this unit.
+ pub selection_voice: &'static str,
/// Remaining provider capacity of all nodes, rounded as in the original list.
pub durability_percent: Option<i32>,
}
@@ -124,6 +126,7 @@ pub fn warbot_rows(engine: &Engine, cockpit: StartingCockpit) -> Vec<WarbotRow>
size,
chassis,
selectable: !table.node_provider_depletion_marked,
+ selection_voice: selection_voice(class, size),
durability_percent: crate::warbot_stats::durability_percent(table),
};
Some((sequence, row))
@@ -133,6 +136,15 @@ pub fn warbot_rows(engine: &Engine, cockpit: StartingCockpit) -> Vec<WarbotRow>
rows.into_iter().map(|(_, row)| row).collect()
}
+fn selection_voice(class: u32, size: u32) -> &'static str {
+ // iron3d+0x61fb0 tests the command vehicle descriptor before its size.
+ match (class, size) {
+ (COMMAND_WARBOT, _) | (_, 4 | 5) => "VOICE_SELECTED_B",
+ (_, 1 | 2) => "VOICE_SELECTED_S",
+ _ => "VOICE_SELECTED",
+ }
+}
+
fn letter(alphabet: &[u8], value: u32) -> char {
char::from(alphabet.get(value as usize).copied().unwrap_or(b'?'))
}
@@ -162,6 +174,15 @@ mod tests {
use super::*;
#[test]
+ fn warbot_selection_voice_uses_the_native_size_banks() {
+ assert_eq!(selection_voice(WARBOT, 1), "VOICE_SELECTED_S");
+ assert_eq!(selection_voice(WARBOT, 2), "VOICE_SELECTED_S");
+ assert_eq!(selection_voice(WARBOT, 3), "VOICE_SELECTED");
+ assert_eq!(selection_voice(WARBOT, 4), "VOICE_SELECTED_B");
+ assert_eq!(selection_voice(COMMAND_WARBOT, 2), "VOICE_SELECTED_B");
+ }
+
+ #[test]
fn numbers_all_mobile_classes_per_creation_clan_without_reusing_a_stale_handle() {
let mut serials = UnitSerials::default();
let handle = |slot, generation| ObjectHandle { slot, generation };