From a3fe5123f1402db2c5067d4f3efc9f9eb61db182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Rom=C3=A1n=20N=C3=BA=C3=B1ez?= Date: Tue, 6 Oct 2026 20:00:24 +0200 Subject: [PATCH] Preserve grounded motion presentation snapshot --- src/fighter/state/dash.rs | 1 - src/fighter/state/ground.rs | 8 +++----- src/fighter/state/ground_attack.rs | 1 - src/fighter/state/run.rs | 1 - src/fighter/state/walk.rs | 1 - 5 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/fighter/state/dash.rs b/src/fighter/state/dash.rs index 61c04cf..523fae0 100644 --- a/src/fighter/state/dash.rs +++ b/src/fighter/state/dash.rs @@ -99,7 +99,6 @@ impl FighterStateImpl for DashState { ground::apply_grounded_motion( state_context.velocity, state_context.translation, - state_context.prev_translation, ); } diff --git a/src/fighter/state/ground.rs b/src/fighter/state/ground.rs index 024cbfe..219d13b 100644 --- a/src/fighter/state/ground.rs +++ b/src/fighter/state/ground.rs @@ -6,7 +6,7 @@ use crate::fighter::state::{ CollisionContext, FighterState, InterruptContext, air, crouch, dash, fall, ground_attack, turn, wait, walk, }; use crate::fighter::{ - FighterAttributes, FighterPreviousTranslation, FighterTranslation, FighterVelocity, + FighterAttributes, FighterTranslation, FighterVelocity, }; use crate::game_settings::GameSettings; use crate::math::int::{FGWide, FGi32}; @@ -149,10 +149,8 @@ fn resolve_grounded_position( pub fn apply_grounded_motion( velocity: &FighterVelocity, translation: &mut FighterTranslation, - prev_translation: &mut FighterPreviousTranslation, ) { // Vertical velocity should be 0 on the ground - prev_translation.0 = translation.0; translation.0 += FGVec2::new(velocity.0.x, FGi32::ZERO); } @@ -169,7 +167,7 @@ pub fn update_friction_motion(ctx: &mut crate::fighter::state::UpdateContext) { let ground_velocity = ctx.velocity.x; ctx.velocity.x += apply_grounded_friction(friction, ground_velocity); - apply_grounded_motion(ctx.velocity, ctx.translation, ctx.prev_translation); + apply_grounded_motion(ctx.velocity, ctx.translation); } pub fn collide_with_stage_grounded( @@ -246,7 +244,7 @@ pub fn collision_interrupt(ctx: &mut CollisionContext, can_walk_off: bool) -> Op mod tests { use super::*; use crate::fighter::ecb::FighterPreviousECB; - use crate::fighter::{FighterECB, FighterSurfaceState}; + use crate::fighter::{FighterECB, FighterPreviousTranslation, FighterSurfaceState}; use crate::stage::line::StagePolyType; use crate::input::FighterInput; diff --git a/src/fighter/state/ground_attack.rs b/src/fighter/state/ground_attack.rs index 80f941b..854679c 100644 --- a/src/fighter/state/ground_attack.rs +++ b/src/fighter/state/ground_attack.rs @@ -50,7 +50,6 @@ impl FighterStateImpl for GroundAttackState { ground::apply_grounded_motion( state_context.velocity, state_context.translation, - state_context.prev_translation, ); } else { ground::update_friction_motion(state_context); diff --git a/src/fighter/state/run.rs b/src/fighter/state/run.rs index 38414ac..5aa4ce0 100644 --- a/src/fighter/state/run.rs +++ b/src/fighter/state/run.rs @@ -48,7 +48,6 @@ impl FighterStateImpl for RunState { ground::apply_grounded_motion( state_context.velocity, state_context.translation, - state_context.prev_translation, ); } diff --git a/src/fighter/state/walk.rs b/src/fighter/state/walk.rs index 383f47f..a94940c 100644 --- a/src/fighter/state/walk.rs +++ b/src/fighter/state/walk.rs @@ -40,7 +40,6 @@ impl FighterStateImpl for WalkState { ground::apply_grounded_motion( state_context.velocity, state_context.translation, - state_context.prev_translation, ); }