diff options
| author | Valentin Popov <valentin@popov.link> | 2026-11-25 22:42:11 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-11-25 22:42:11 +0300 |
| commit | 6f746b8e31de323a55e2a47d8117faca2aa93a50 (patch) | |
| tree | 6ede0f9b453fd7b6a08c012abf07fdb9017cb067 /apps/fparkan-game/src/main.rs | |
| parent | 9e5a8867d1a12a66772e6e97c3a0213f9636d56c (diff) | |
| download | fparkan-6f746b8e31de323a55e2a47d8117faca2aa93a50.tar.xz fparkan-6f746b8e31de323a55e2a47d8117faca2aa93a50.zip | |
fix(combat): launch AI projectiles from mounted weapon CPTs
Resolve weapon node poses and EXTO socket chains on the CPU, replace each
mounted component root with its socket, and transform the selected CPT into
the world. Test terrain sight lines from each barrel rather than the hull.
Share initial Control pose sampling with the window renderer. Count missing
mounts and animation fallbacks by original object ID without losing history
when an object dies.
Checked Control.dll RVA 0x1b4f0 by native invocation, including nonuniform
scale and a rotated world matrix. cargo fmt/check/test workspace pass, as do
licensed stock AutoDemo and scripted patrol/factory regressions. All 29
stock missions reach --sim-report 900 with no script interruption or weapon
pose fallback. Both games were observed in stock AutoDemo windows.
AI turret aim, recoil and first-shot chronology remain approximate; this
change does not establish full G7 or G8 gameplay parity.
Diffstat (limited to 'apps/fparkan-game/src/main.rs')
| -rw-r--r-- | apps/fparkan-game/src/main.rs | 59 |
1 files changed, 2 insertions, 57 deletions
diff --git a/apps/fparkan-game/src/main.rs b/apps/fparkan-game/src/main.rs index cc7061ae..ef7602ea 100644 --- a/apps/fparkan-game/src/main.rs +++ b/apps/fparkan-game/src/main.rs @@ -2,6 +2,8 @@ //! `FParkan` render-planning composition root. +use fparkan_runtime::initial_component_node_times as static_preview_node_times; + mod camera_capture; #[cfg(windows)] mod control_effects; @@ -7135,63 +7137,6 @@ fn multiply_unit_quaternions(left: [f32; 4], right: [f32; 4]) -> [f32; 4] { /// interpolated overlay mask. MSH component hierarchy, animation sampling, /// lightmaps, and gameplay visibility are handled by the preview bridge below. -fn static_preview_node_times( - node_count: usize, - bindings: &[PreparedControlNodeBinding], -) -> Result<Vec<Option<AnimationTime>>, String> { - let mut node_times = vec![Some(AnimationTime(0.0)); node_count]; - for binding in bindings { - // Disabled rows are filtered while loading CTLD, but preserve the - // native guard here in case a caller constructs MissionAssets itself. - if binding.flags & 4 != 0 { - continue; - } - if binding.node_index >= node_count { - return Err(format!( - "control binding node {} is outside model node count {node_count}", - binding.node_index - )); - } - if !binding.frame_a.is_finite() - || !binding.frame_b.is_finite() - || !binding.initial_blend.is_finite() - || binding.frame_a < 0.0 - || binding.frame_b < 0.0 - { - return Err(format!( - "control binding for node {} contains an invalid frame or blend", - binding.node_index - )); - } - - let mut blend = binding.initial_blend; - if binding.flags & 1 != 0 { - if blend > 1.0 { - blend -= 1.0; - } - if blend < 0.0 { - blend += 1.0; - } - } else { - blend = blend.clamp(0.0, 1.0); - } - if binding.flags & 2 != 0 { - blend = 1.0 - blend; - } - let sample_time = (1.0 - blend) * binding.frame_a + blend * binding.frame_b; - if !sample_time.is_finite() || sample_time < 0.0 { - return Err(format!( - "control binding for node {} produced a negative or non-finite sample time unsupported by the static sampler", - binding.node_index - )); - } - // Source order is significant: native initialization writes each - // enabled row in turn, so a later row for the same node wins. - node_times[binding.node_index] = Some(AnimationTime(sample_time)); - } - Ok(node_times) -} - fn static_preview_component_pose_buffer( model: &ModelAsset, bindings: &[PreparedControlNodeBinding], |
