aboutsummaryrefslogtreecommitdiff
path: root/apps/fparkan-game
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-11-25 13:21:31 +0300
committerValentin Popov <valentin@popov.link>2026-11-25 13:21:31 +0300
commit7962aa90e3a3b70d6ed5bd5c6a4ad991b3bc0199 (patch)
tree4d8e2c37409cb25f654a1db8b956ca6c83fc2260 /apps/fparkan-game
parent2656cca01b65745e9e6aa7b11d80414039e4cc67 (diff)
downloadfparkan-7962aa90e3a3b70d6ed5bd5c6a4ad991b3bc0199.tar.xz
fparkan-7962aa90e3a3b70d6ed5bd5c6a4ad991b3bc0199.zip
feat(ai): deliver clan script notifications to the player
Handle clan Handler(30) through the same host command and first-message state as the Mission event. Carry clan notices in FrameResult and pass them to the existing text and voice queues without changing the Mission tick counter. Extract shared host dispatch and app presentation modules. Execute ai.dll RVA 0xc266 with the original hash guard: clan contexts 0 and 2 call the global host as (0, MESSAGE_INFO, index), reading live varset cells. Extend the licensed stock Convoy test to require message 0 after the delayed attack, and test shared first-message and AutoDemo behavior. Repeated native message UI branches remain explicit debt. Validate fmt, workspace check/tests, licensed stock-start test, release simulation and the mission window. Clock replay checks message delivery, not full mission completion.
Diffstat (limited to 'apps/fparkan-game')
-rw-r--r--apps/fparkan-game/src/main.rs57
-rw-r--r--apps/fparkan-game/src/mission_notices.rs55
2 files changed, 67 insertions, 45 deletions
diff --git a/apps/fparkan-game/src/main.rs b/apps/fparkan-game/src/main.rs
index b1a4f1e0..96dfd756 100644
--- a/apps/fparkan-game/src/main.rs
+++ b/apps/fparkan-game/src/main.rs
@@ -7,6 +7,7 @@ mod camera_capture;
mod control_effects;
use control_effects::{advance_control_effect_instances, owner_control_capacity};
mod mission_hints;
+mod mission_notices;
mod player_collision;
mod projectile_trail;
mod script_coverage;
@@ -98,9 +99,9 @@ use fparkan_runtime::{
projectile_terrain_hit, projectile_unit_hit, query_building_segment_world,
simulate_mission_report, starting_cockpit, starting_player_weapons, AutoDemoCamera,
AutoDemoView, BasementPlacementMode, BuildingMeshNode, Engine, EngineError, EngineServices,
- FrameResult, LoadedMission, MissionAssets, MissionEventStop, MissionMode, MissionNotice,
- MissionObjectDraft, MissionRequest, MissionStartupInput, PlayerMotion, PlayerProjectile,
- PlayerWeapons, StartingCockpit, SIMULATION_COVERAGE,
+ FrameResult, LoadedMission, MissionAssets, MissionEventStop, MissionMode, MissionObjectDraft,
+ MissionRequest, MissionStartupInput, PlayerMotion, PlayerProjectile, PlayerWeapons,
+ StartingCockpit, SIMULATION_COVERAGE,
};
#[cfg(test)]
use fparkan_runtime::{load_mission_with_init_stubs, plan_player_motion};
@@ -11376,48 +11377,14 @@ impl StaticVulkanApp {
for &(handle, [x, y]) in &tick.patrol_orders {
eprintln!("mission_patrol_order unit={} target=[{x},{y}] queue_time_ms={control_clock_ms}", handle.slot);
}
- for &notice in &tick.notices {
- match notice {
- MissionNotice::ObjectiveComplete(index) => eprintln!("mission_objective index={index} status=complete queue_time_ms={control_clock_ms}"),
- MissionNotice::Completed | MissionNotice::Failed => {
- let status = if notice == MissionNotice::Completed {
- "completed"
- } else {
- "failed"
- };
- eprintln!("mission_outcome status={status} queue_time_ms={control_clock_ms}");
- }
- MissionNotice::Information(index) => {
- #[cfg(windows)]
- {
- let queued = self.mission_hints.as_mut()
- .ok_or_else(|| "mission text resources unavailable".to_string())
- .and_then(|hints| hints.enqueue(index));
- if let Err(error) = queued {
- eprintln!("sim_coverage mission_text_unavailable=1 index={index} reason={error}");
- }
- }
- #[cfg(not(windows))]
- eprintln!("sim_coverage mission_text_unavailable=1 index={index} reason=platform");
- }
- }
- if let Some(audio) = &mut self.audio {
- let voice = match notice {
- MissionNotice::Information(index) => audio.queue_mission_voice(index),
- MissionNotice::ObjectiveComplete(_) => {
- audio.queue_game_voice("VOICE_OBJ_COMPLETE")
- }
- MissionNotice::Completed => {
- audio.queue_game_voice("VOICE_MISSION_COMPLETE")
- }
- MissionNotice::Failed => audio.queue_game_voice("VOICE_MISSION_FAIL"),
- };
- match voice {
- Ok(resource) => eprintln!("mission_voice notice={notice:?} resource={resource} queue_time_ms={control_clock_ms}"),
- Err(error) => eprintln!("sim_coverage mission_voice_unavailable=1 notice={notice:?} reason={error}"),
- }
- }
- }
+ }
+ for &notice in frame
+ .mission_event
+ .iter()
+ .flat_map(|tick| &tick.notices)
+ .chain(&frame.clan_notices)
+ {
+ self.present_mission_notice(notice, control_clock_ms);
}
self.mission_frame = Some(frame);
}
diff --git a/apps/fparkan-game/src/mission_notices.rs b/apps/fparkan-game/src/mission_notices.rs
new file mode 100644
index 00000000..a4ea8f05
--- /dev/null
+++ b/apps/fparkan-game/src/mission_notices.rs
@@ -0,0 +1,55 @@
+use crate::StaticVulkanApp;
+use fparkan_runtime::MissionNotice;
+
+impl StaticVulkanApp {
+ pub(super) fn present_mission_notice(&mut self, notice: MissionNotice, clock_ms: u32) {
+ match notice {
+ MissionNotice::ObjectiveComplete(index) => {
+ eprintln!(
+ "mission_objective index={index} status=complete queue_time_ms={clock_ms}"
+ );
+ }
+ MissionNotice::Completed | MissionNotice::Failed => {
+ let status = if notice == MissionNotice::Completed {
+ "completed"
+ } else {
+ "failed"
+ };
+ eprintln!("mission_outcome status={status} queue_time_ms={clock_ms}");
+ }
+ MissionNotice::Information(index) => {
+ #[cfg(windows)]
+ {
+ let queued = self
+ .mission_hints
+ .as_mut()
+ .ok_or_else(|| "mission text resources unavailable".to_string())
+ .and_then(|hints| hints.enqueue(index));
+ if let Err(error) = queued {
+ eprintln!(
+ "sim_coverage mission_text_unavailable=1 index={index} reason={error}"
+ );
+ }
+ }
+ #[cfg(not(windows))]
+ eprintln!("sim_coverage mission_text_unavailable=1 index={index} reason=platform");
+ }
+ }
+ if let Some(audio) = &mut self.audio {
+ let voice = match notice {
+ MissionNotice::Information(index) => audio.queue_mission_voice(index),
+ MissionNotice::ObjectiveComplete(_) => audio.queue_game_voice("VOICE_OBJ_COMPLETE"),
+ MissionNotice::Completed => audio.queue_game_voice("VOICE_MISSION_COMPLETE"),
+ MissionNotice::Failed => audio.queue_game_voice("VOICE_MISSION_FAIL"),
+ };
+ match voice {
+ Ok(resource) => eprintln!(
+ "mission_voice notice={notice:?} resource={resource} queue_time_ms={clock_ms}"
+ ),
+ Err(error) => eprintln!(
+ "sim_coverage mission_voice_unavailable=1 notice={notice:?} reason={error}"
+ ),
+ }
+ }
+ }
+}