From bfc283603ff9fc48b2dff3673a56f7ad481e1031 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 26 Nov 2026 14:08:44 +0400 Subject: feat(player): play footsteps on ground and building floors Select the original step effects from the hero's Control rows. A footfall follows the accepted movement and the camera rhythm. The Firing Range window starts the ground sound on the step and stays quiet when the player stops. --- crates/fparkan-runtime/src/lib.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'crates/fparkan-runtime/src/lib.rs') diff --git a/crates/fparkan-runtime/src/lib.rs b/crates/fparkan-runtime/src/lib.rs index 11bac68d..23e18cae 100644 --- a/crates/fparkan-runtime/src/lib.rs +++ b/crates/fparkan-runtime/src/lib.rs @@ -155,7 +155,7 @@ pub use mission_events::{ capture_building, capture_building_with_notice, capture_neutral_building, capture_neutral_warbot, MissionEventStop, MissionEventTick, MissionNotice, }; -pub use player_gait::player_walk_camera_lift; +pub use player_gait::{player_walk_camera_lift, PlayerFootstep}; pub use player_motion::{ plan_player_motion, plan_player_motion_with_collision, PlayerMotion, PlayerMotionStep, }; @@ -1394,6 +1394,8 @@ pub struct FrameResult { pub clan_notices: Vec, /// Vertical aim of the controlled hero as an IEEE-754 radian value. pub player_pitch_bits: u32, + /// Footstep from the accepted player motion, if this tick reached a footfall. + pub player_footstep: Option, /// Autonomous combat events during the step. pub autodemo_combat_events: Vec, /// Autonomous impact or flight operations that could not execute. @@ -2984,6 +2986,7 @@ pub fn step_headless( produced_unit, production_failure, researched_component, + player_footstep: None, player_pitch_bits: engine .loaded .as_ref() @@ -3029,6 +3032,16 @@ pub fn frame_with_player_motion( if let Some(mission) = &mut engine.loaded { mission.player_pitch_bits = motion.pitch_bits; frame.player_pitch_bits = motion.pitch_bits; + if !blocked + && !drowned + && mission.player_gait.footfall + && mission.local_hero == Some(cockpit.handle) + { + frame.player_footstep = Some(PlayerFootstep { + position_bits: pose.position, + building_floor: motion.on_building_floor(), + }); + } } Ok(frame) } -- cgit v1.2.3