Fix a bug with premature slide recovery

This commit is contained in:
Lucas S. Vieira 2025-04-17 01:32:10 -03:00
parent 3c64597f21
commit b111971343

View file

@ -669,6 +669,7 @@ _player_update_collision_tb(Player *player)
player->sliding = 0; player->sliding = 0;
if(player->action == ACTION_GLIDE) { if(player->action == ACTION_GLIDE) {
if(abs(player->vel.vx) <= KNUX_GLIDE_FRICTION) { if(abs(player->vel.vx) <= KNUX_GLIDE_FRICTION) {
// (duplicated on gliding action)
player_set_action(player, ACTION_GLIDERECOVER); player_set_action(player, ACTION_GLIDERECOVER);
player->framecount = 12; player->framecount = 12;
player->vel.vx = 0; player->vel.vx = 0;
@ -1202,10 +1203,20 @@ player_update(Player *player)
player->spinrev = 0; player->spinrev = 0;
} else if(player->action == ACTION_GLIDE) { } else if(player->action == ACTION_GLIDE) {
if(!input_pressing(&player->input, PAD_CROSS)) { if(!input_pressing(&player->input, PAD_CROSS)) {
// Cancel gliding if(player->sliding) {
player_set_action(player, ACTION_DROP); // Prevent erroneously treating a premature slide
player->vel.vx >>= 2; // times 0.25 // interruption as a drop.
player->airdirlock = 1; // (duplicated code from sliding part on ground collision)
player->sliding = 0;
player_set_action(player, ACTION_GLIDERECOVER);
player->framecount = 12;
player->vel.vx = 0;
} else {
// Cancel gliding
player_set_action(player, ACTION_DROP);
player->vel.vx >>= 2; // times 0.25
player->airdirlock = 1;
}
} }
} else if(player->action == ACTION_CLIMB) { } else if(player->action == ACTION_CLIMB) {
if(!player->ev_climbdrop.collided) { if(!player->ev_climbdrop.collided) {