Skip to content

Commit

Permalink
Engine: fixed GetDirectionalLoop to use float x/y_diff
Browse files Browse the repository at this point in the history
This solves the case where x_diff or y_diff could be less than 1, and thus truncated to 0, causing the wrong direction loop to be chosen for the character.
  • Loading branch information
AlanDrake committed Oct 4, 2023
1 parent e1ae2e6 commit 3c9f849
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Engine/ac/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ enum DirectionalLoop

// Internal direction-facing functions

DirectionalLoop GetDirectionalLoop(CharacterInfo *chinfo, int x_diff, int y_diff)
DirectionalLoop GetDirectionalLoop(CharacterInfo *chinfo, float x_diff, float y_diff)
{
DirectionalLoop next_loop = kDirLoop_Left; // NOTE: default loop was Left for some reason

Expand Down Expand Up @@ -1845,7 +1845,7 @@ void fix_player_sprite(MoveList*cmls,CharacterInfo*chinf) {
const float ypmove = cmls->ypermove[cmls->onstage];

// if not moving, do nothing
if ((xpmove == 0) && (ypmove == 0))
if ((xpmove == 0.f) && (ypmove == 0.f))
return;

const int useloop = GetDirectionalLoop(chinf, xpmove, ypmove);
Expand Down

0 comments on commit 3c9f849

Please sign in to comment.