aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-12-01 20:55:38 +0300
committerValentin Popov <valentin@popov.link>2026-12-01 20:55:38 +0300
commitd154efdd050e730c4072e5f53843cf3610651d00 (patch)
treefdd0c56d5232dd958f529d6faefb0f585944057e
parent697241b84fb0446af5feba8eb1f78b3b04cdd5a4 (diff)
downloadfparkan-d154efdd050e730c4072e5f53843cf3610651d00.tar.xz
fparkan-d154efdd050e730c4072e5f53843cf3610651d00.zip
feat(player): announce vehicle capture when the hero stays outside
Restore the original warbot and mobile command centre acknowledgement bank. A capture that also seats the hero remains silent. The bank and non-repeat selection were checked against the native DLL, and a walk from the normal Teleport start queued the authored voice before the objective notice.
-rw-r--r--apps/fparkan-game/src/audio.rs4
-rw-r--r--apps/fparkan-game/src/audio/capture_voice.rs52
-rw-r--r--apps/fparkan-game/src/main.rs1
-rw-r--r--apps/fparkan-game/src/mission_notices.rs3
-rw-r--r--crates/fparkan-runtime/src/boarding.rs9
-rw-r--r--crates/fparkan-runtime/src/lib.rs1
-rw-r--r--crates/fparkan-runtime/src/mission_events.rs2
-rw-r--r--docs/appendices/knowledge-boundaries.md3
-rw-r--r--docs/tomes/06-behavior.md10
9 files changed, 82 insertions, 3 deletions
diff --git a/apps/fparkan-game/src/audio.rs b/apps/fparkan-game/src/audio.rs
index e4580707..90ddd6d7 100644
--- a/apps/fparkan-game/src/audio.rs
+++ b/apps/fparkan-game/src/audio.rs
@@ -21,6 +21,8 @@ use std::io::Cursor;
use std::sync::{Arc, Mutex};
use std::time::{SystemTime, UNIX_EPOCH};
+mod capture_voice;
+
const SWAV_TYPE: u32 = u32::from_le_bytes(*b"SWAV");
const DEFAULT_MUSIC_TRACK: u8 = 2;
const FIRST_MUSIC_TRACK: u8 = 2;
@@ -636,6 +638,7 @@ pub(crate) struct GameAudio {
music: Player,
variations: Player,
mission_voice: Player,
+ vehicle_capture_voice: capture_voice::VehicleCaptureVoice,
mission_cfg: NormalizedPath,
weather_loop: NativeSpatialPlayer,
control_sounds: BTreeMap<ControlSoundId, NativeSpatialPlayer>,
@@ -683,6 +686,7 @@ impl GameAudio {
music,
variations,
mission_voice,
+ vehicle_capture_voice: capture_voice::VehicleCaptureVoice::new(random_seed()),
mission_cfg,
weather_loop,
control_sounds: BTreeMap::new(),
diff --git a/apps/fparkan-game/src/audio/capture_voice.rs b/apps/fparkan-game/src/audio/capture_voice.rs
new file mode 100644
index 00000000..86ecee63
--- /dev/null
+++ b/apps/fparkan-game/src/audio/capture_voice.rs
@@ -0,0 +1,52 @@
+use super::{GameAudio, VariationRng};
+
+// iron3d+0x8ecc0 selects bank 3 for warbots and mobile command centres.
+const ACKNOWLEDGEMENTS: [&str; 5] = [
+ "VOICE_ACKNOWLEDGE_B",
+ "VOICE_AFFIRMATIVE_B",
+ "VOICE_OK_B",
+ "VOICE_YES_SIR_B",
+ "VOICE_EXECUTE_B",
+];
+
+pub(super) struct VehicleCaptureVoice {
+ rng: VariationRng,
+ previous: i32,
+}
+
+impl VehicleCaptureVoice {
+ pub(super) fn new(seed: u32) -> Self {
+ Self {
+ rng: VariationRng::from_clock(seed),
+ previous: -1,
+ }
+ }
+
+ fn next(&mut self) -> &'static str {
+ let index = self
+ .rng
+ .choose(ACKNOWLEDGEMENTS.len(), &mut self.previous)
+ .expect("non-empty acknowledgement bank");
+ ACKNOWLEDGEMENTS[index]
+ }
+}
+
+impl GameAudio {
+ pub(crate) fn queue_vehicle_capture_voice(&mut self) -> Result<String, String> {
+ let symbol = self.vehicle_capture_voice.next();
+ self.queue_game_voice(symbol)
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::{VehicleCaptureVoice, ACKNOWLEDGEMENTS};
+
+ #[test]
+ fn capture_acknowledgements_follow_the_native_bank_order_and_skip_repeats() {
+ let mut voice = VehicleCaptureVoice::new(0x156a_e3bf);
+ let expected = [2, 3, 2, 3, 2, 4, 3, 4, 3, 0].map(|i| ACKNOWLEDGEMENTS[i]);
+ let actual = std::array::from_fn::<_, 10, _>(|_| voice.next());
+ assert_eq!(actual, expected);
+ }
+}
diff --git a/apps/fparkan-game/src/main.rs b/apps/fparkan-game/src/main.rs
index 77a1dec5..cd6ce717 100644
--- a/apps/fparkan-game/src/main.rs
+++ b/apps/fparkan-game/src/main.rs
@@ -10941,6 +10941,7 @@ impl StaticVulkanApp {
) {
let entry = enter_vehicle(engine, cockpit, self.boarding_target)
.map_err(|error| error.to_string())?;
+ capture_notice = entry.capture_notice();
if let Some(target) = entry.captured {
self.boarding_target = mission_object_handle(engine, target);
eprintln!(
diff --git a/apps/fparkan-game/src/mission_notices.rs b/apps/fparkan-game/src/mission_notices.rs
index 739eb628..1a0bc6a2 100644
--- a/apps/fparkan-game/src/mission_notices.rs
+++ b/apps/fparkan-game/src/mission_notices.rs
@@ -4,7 +4,7 @@ use fparkan_runtime::MissionNotice;
impl StaticVulkanApp {
pub(super) fn present_mission_notice(&mut self, notice: MissionNotice, clock_ms: u32) {
match notice {
- MissionNotice::BuildingCaptured { .. } => {}
+ MissionNotice::BuildingCaptured { .. } | MissionNotice::VehicleCaptured => {}
MissionNotice::ObjectiveComplete(index) => {
eprintln!(
"mission_objective index={index} status=complete queue_time_ms={clock_ms}"
@@ -45,6 +45,7 @@ impl StaticVulkanApp {
} else {
"VOICE_EBUILD_CAPTURE"
}),
+ MissionNotice::VehicleCaptured => audio.queue_vehicle_capture_voice(),
MissionNotice::Completed => audio.queue_game_voice("VOICE_MISSION_COMPLETE"),
MissionNotice::Failed => audio.queue_game_voice("VOICE_MISSION_FAIL"),
};
diff --git a/crates/fparkan-runtime/src/boarding.rs b/crates/fparkan-runtime/src/boarding.rs
index c1b3651e..9d15fedd 100644
--- a/crates/fparkan-runtime/src/boarding.rs
+++ b/crates/fparkan-runtime/src/boarding.rs
@@ -20,6 +20,14 @@ pub struct VehicleEntry {
pub cockpit: Option<StartingCockpit>,
}
+impl VehicleEntry {
+ /// Captures that leave the player outside the machine receive a spoken acknowledgement.
+ pub fn capture_notice(&self) -> Option<crate::MissionNotice> {
+ (self.captured.is_some() && self.cockpit.is_none())
+ .then_some(crate::MissionNotice::VehicleCaptured)
+ }
+}
+
#[derive(Clone, Copy)]
pub(super) struct Boarding {
pub(super) cockpit: StartingCockpit,
@@ -248,6 +256,7 @@ mod tests {
let entry = enter_vehicle(&mut engine, hero, None).unwrap();
assert_eq!(entry.captured, Some(id));
assert_eq!(entry.cockpit.unwrap().handle, target);
+ assert_eq!(entry.capture_notice(), None);
assert_eq!(player_vehicle(&engine), entry.cockpit);
}
}
diff --git a/crates/fparkan-runtime/src/lib.rs b/crates/fparkan-runtime/src/lib.rs
index 0cc01d72..0f2b7e49 100644
--- a/crates/fparkan-runtime/src/lib.rs
+++ b/crates/fparkan-runtime/src/lib.rs
@@ -18023,6 +18023,7 @@ mod tests {
let entry = enter_vehicle(&mut engine, cockpit, None).unwrap();
assert_eq!(entry.captured, Some(OriginalObjectId(0)));
assert_eq!(entry.cockpit, None);
+ assert_eq!(entry.capture_notice(), Some(MissionNotice::VehicleCaptured));
assert_eq!(
mission_object_handle(&engine, OriginalObjectId(0)),
Some(hq)
diff --git a/crates/fparkan-runtime/src/mission_events.rs b/crates/fparkan-runtime/src/mission_events.rs
index 1275ea93..a017eada 100644
--- a/crates/fparkan-runtime/src/mission_events.rs
+++ b/crates/fparkan-runtime/src/mission_events.rs
@@ -53,6 +53,8 @@ pub enum MissionNotice {
ObjectiveComplete(u32),
/// The player's capture took a building from a neutral or enemy clan.
BuildingCaptured { neutral: bool },
+ /// The player captured a neutral vehicle and stayed outside it.
+ VehicleCaptured,
/// Mission completed.
Completed,
/// Mission failed.
diff --git a/docs/appendices/knowledge-boundaries.md b/docs/appendices/knowledge-boundaries.md
index 1e824e35..1baf901e 100644
--- a/docs/appendices/knowledge-boundaries.md
+++ b/docs/appendices/knowledge-boundaries.md
@@ -217,8 +217,7 @@ CTL типа 24 и дорожки выстрела типа 2. ВыбранноÐ
стадийный проход, руины и эффекты ещё открыты. Для остальных классов без маркера
неподдержанная гибель сохраняется как `damage_error` / `UnsupportedNodeLifecycle`.
`player_capture_approx` отмечает выбор ближайшей машины при захвате варбота
-и мобильного МЦУ. Выбор цели по радару, смена владельца в Behavior
-и голос при захвате без посадки ещё открыты.
+и мобильного МЦУ. Выбор цели по радару и смена владельца в Behavior ещё открыты.
`player_boarding_approx` отмечает выбор союзника по лучу взгляда и
сфере варбота. Порядок кандидатов оригинала и роль комплектации МФУ
ещё требуют живой сверки.
diff --git a/docs/tomes/06-behavior.md b/docs/tomes/06-behavior.md
index 2be570eb..043fbaf4 100644
--- a/docs/tomes/06-behavior.md
+++ b/docs/tomes/06-behavior.md
@@ -3250,6 +3250,16 @@ FParkan использует исходный селектор клана раз
Из доступных машин FParkan пока берёт ближайшую по горизонтали. Оригинал
берёт выбранную игроком цель.
+Успешный захват с немедленной пересадкой обходится без голосовой реплики.
+Если герой остаётся снаружи, например при захвате МЦУ, он слышит подтверждение.
+Эту ветвь в GOG `iron3d.dll` (SHA-256
+`d1dc4ea8535e2069b0a05c9e8be2724dd438ba44cca7a83007d8b2e50f9e35fa`)
+выбирает RVA `0x724a4`. Для варбота и МЦУ RVA `0x8ecc0` выбирает общий
+набор из пяти реплик `VOICE_*_B`, заданных в `ui/game_resources.cfg`.
+Выбор использует отдельный звуковой генератор и пропускает повтор предыдущей
+реплики. Состав набора прочитан из запущенного оригинала, а последовательность
+выбора с одним состоянием проверена вызовом DLL.
+
В «Телепорте» сценарий отдельно спрашивает, есть ли в клане свободный
варбот для захвата. `ai.dll` по RVA `0x86fb` просматривает список клана
по порядку и возвращает логический ID первого варбота без задачи,