Preserve grounded motion presentation snapshot
This commit is contained in:
@@ -99,7 +99,6 @@ impl FighterStateImpl for DashState {
|
||||
ground::apply_grounded_motion(
|
||||
state_context.velocity,
|
||||
state_context.translation,
|
||||
state_context.prev_translation,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -48,7 +48,6 @@ impl FighterStateImpl for RunState {
|
||||
ground::apply_grounded_motion(
|
||||
state_context.velocity,
|
||||
state_context.translation,
|
||||
state_context.prev_translation,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@ impl FighterStateImpl for WalkState {
|
||||
ground::apply_grounded_motion(
|
||||
state_context.velocity,
|
||||
state_context.translation,
|
||||
state_context.prev_translation,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user