From 8ac763f7bfda827016d17c66372d02b85d5a9bb5 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 26 Nov 2026 01:38:43 +0400 Subject: feat(combat): feed weapon charge from Control energy budgets Keep factory-2/30 charge in the owner's Control table. AI and player banks read it before firing, debit completed shots and wait for regeneration. Preserve one charge across bank changes and accumulate energy waits by object, including an idle bank publishing after an active bank. Mobile owners now run the resource budget. Restore the shared factory-1 callbacks, factory-2/30 charging and factory-10 passive upkeep. Factory 30 uses the weapon constructor's native disabled default. Motion demand is still an explicit zero-rate stub; unsupported budgets disable charge limiting for that owner and record the reason. Execute unmodified GOG Control.dll callbacks at RVA 0x29a40/0x29a90, 0x264b0/0x26510 and 0x21860/0x21890; check the common constructor at 0x294c0. Rust golden vectors cover disabled refill, zero capacity, negative charge and x87 rounding at control word 0x007f. SHA-256: bcb86318089028548a178b03a21accdce15df0cc85ddd91674cf3c2f55012c6e. Validated fmt, workspace check/tests, release, licensed shared-bank charge exhaustion/recovery, stock combat and damaged-profile regressions. All 29 stock missions reached 900 seconds; the only mobile-budget stub was the known motion input. Observed stock window combat and replenishment. Full live native mission comparison and motion energy remain open. --- apps/fparkan-game/src/main.rs | 6 ++++++ 1 file changed, 6 insertions(+) (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 ef7602ea..87690e3d 100644 --- a/apps/fparkan-game/src/main.rs +++ b/apps/fparkan-game/src/main.rs @@ -10494,6 +10494,9 @@ impl StaticVulkanApp { // shortcut: the camera supplies a shared aim direction until native // per-weapon CPT direction and turret alignment agree in world space. let direction = self.view_camera.forward; + if let Some(engine) = &self.mission_engine { + weapons.read_control_energy(engine, cockpit.handle); + } for (slot, weapon, barrel) in weapons.fire(trigger, clock_ms) { let hierarchy = self .component_pose_buffers @@ -10573,6 +10576,9 @@ impl StaticVulkanApp { } } } + if let Some(engine) = &mut self.mission_engine { + weapons.publish_control_energy(engine, cockpit.handle); + } } fn advance_player_projectiles(&mut self, clock_ms: u32) -> Result<(), String> { -- cgit v1.2.3