From c63fadd7c2aa0e0d9f81f65aa88ef9fe905e76e3 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Wed, 25 Nov 2026 20:47:00 +0400 Subject: fix(ai): age script deadlines while the world is paused Record paused wall time separately from simulation time. After resuming, Mission and clan AI check their expired deadlines once, then schedule the next interval without replaying missed cycles. Move application pause handling into its own module and retain frozen world, animation and audio. Live ai.dll timer calls confirm that Mission runs before the paused world clock refreshes and the next AI callback uses an already expired deadline. Record the unresolved AutoDemo sphere and first-projectile boundaries. Validation: workspace fmt/check/tests, release build, licensed stock-clock pause test, all 29 missions at --sim-report 900 without script stops, and a stock mission-28 window with a 33-second pause and unchanged world time. Full AI chronology and minimized-window timing remain open. --- apps/fparkan-game/src/main.rs | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) (limited to 'apps/fparkan-game/src/main.rs') diff --git a/apps/fparkan-game/src/main.rs b/apps/fparkan-game/src/main.rs index 72ee3c74..cc7061ae 100644 --- a/apps/fparkan-game/src/main.rs +++ b/apps/fparkan-game/src/main.rs @@ -8,6 +8,7 @@ mod control_effects; use control_effects::{advance_control_effect_instances, owner_control_capacity}; mod mission_hints; mod mission_notices; +mod mission_pause; mod player_collision; mod projectile_trail; mod script_coverage; @@ -9984,6 +9985,7 @@ struct StaticVulkanApp { simulation_last_tick: Instant, live_clock_paused_for_zero_extent: bool, mission_paused: bool, + mission_pause_started: Option, window_focused: bool, last_presented_mission_scene: Option, simulation_elapsed: Duration, @@ -10127,6 +10129,7 @@ impl StaticVulkanApp { simulation_last_tick: Instant::now(), live_clock_paused_for_zero_extent: false, mission_paused: false, + mission_pause_started: None, window_focused: true, last_presented_mission_scene: None, simulation_elapsed: Duration::ZERO, @@ -10872,30 +10875,6 @@ impl StaticVulkanApp { } } - fn set_mission_paused_at(&mut self, paused: bool, now: Instant) { - self.mission_paused = paused; - self.player_mouse = [0.0; 2]; - self.player_move_pressed = Default::default(); - self.player_capture_pressed = false; - self.player_select_friend_pressed = false; - self.player_build_pressed = false; - self.player_research_pressed = false; - self.player_mine_pressed = false; - self.player_disembark_pressed = false; - if self.cockpit.is_some() && self.demo_camera.is_none() { - self.set_mouse_look(self.window_focused && !paused); - } - self.simulation_last_tick = now; - eprintln!( - "mission_pause paused={paused} queue_time_ms={}", - self.simulation_time_ms - ); - self.update_mission_title(); - if let Some(audio) = self.audio.as_mut() { - audio.set_paused(paused || !self.window_focused); - } - } - fn update_mission_title(&mut self) { let Some(window) = &self.window else { return; -- cgit v1.2.3