diff options
| author | Valentin Popov <valentin@popov.link> | 2026-11-26 13:08:44 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-11-26 13:08:44 +0300 |
| commit | bfc283603ff9fc48b2dff3673a56f7ad481e1031 (patch) | |
| tree | 9e44fadbde26b49595f09a595f91e0e4580ea9a4 /apps/fparkan-game/src/player_collision.rs | |
| parent | 514136ca97191672ecd24173d1836cdc4d26493b (diff) | |
| download | fparkan-bfc283603ff9fc48b2dff3673a56f7ad481e1031.tar.xz fparkan-bfc283603ff9fc48b2dff3673a56f7ad481e1031.zip | |
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.
Diffstat (limited to 'apps/fparkan-game/src/player_collision.rs')
| -rw-r--r-- | apps/fparkan-game/src/player_collision.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/apps/fparkan-game/src/player_collision.rs b/apps/fparkan-game/src/player_collision.rs index cccb3338..adf6f339 100644 --- a/apps/fparkan-game/src/player_collision.rs +++ b/apps/fparkan-game/src/player_collision.rs @@ -174,6 +174,7 @@ mod tests { let mut now = 0; let mut hero = pose(step_mission_frame(&mut engine, now).unwrap()); let mut door_blends = Vec::new(); + let mut footstep_surfaces = [false; 2]; for (index, [x, y]) in route .iter() .chain(route.iter().rev().skip(1)) @@ -238,9 +239,12 @@ mod tests { .unwrap() .unwrap(); now += 100; - let moved = pose( - frame_with_player_motion(&mut engine, now, cockpit, motion, false).unwrap(), - ); + let frame = + frame_with_player_motion(&mut engine, now, cockpit, motion, false).unwrap(); + if let Some(footstep) = frame.player_footstep { + footstep_surfaces[usize::from(footstep.building_floor)] = true; + } + let moved = pose(frame); stalled = if moved.position == hero.position { stalled + 1 } else { @@ -271,6 +275,7 @@ mod tests { } } let [x, y, z] = hero.position.map(f32::from_bits); + assert_eq!(footstep_surfaces, [true, true]); let ground = app.terrain.height_at([x, y]).unwrap().unwrap(); assert!( (ground..ground + 1.0).contains(&z), |
