Fix jump sfx incorrectly played

main
En Yi 2024-12-08 15:39:06 +08:00
parent 518c2def93
commit ee64133de7
1 changed files with 3 additions and 1 deletions

View File

@ -464,21 +464,23 @@ void player_movement_input_system(Scene_t* scene)
{ {
if (p_cjump->jump_released && p_pstate->jump_pressed && p_cjump->jumps > 0 && p_cjump->jump_ready) if (p_cjump->jump_released && p_pstate->jump_pressed && p_cjump->jumps > 0 && p_cjump->jump_ready)
{ {
play_sfx(scene->engine, PLAYER_JMP_SFX);
p_cjump->jumps--; p_cjump->jumps--;
if (!in_water) if (!in_water)
{ {
if (p_mstate->ground_state & 1 || p_cjump->coyote_timer > 0) if (p_mstate->ground_state & 1 || p_cjump->coyote_timer > 0)
{ {
play_sfx(scene->engine, PLAYER_JMP_SFX);
p_ctransform->velocity.y = -p_cjump->jump_speed; p_ctransform->velocity.y = -p_cjump->jump_speed;
} }
else if (p_pstate->ladder_state) else if (p_pstate->ladder_state)
{ {
play_sfx(scene->engine, PLAYER_JMP_SFX);
p_ctransform->velocity.y = -p_cjump->jump_speed / 1.4; p_ctransform->velocity.y = -p_cjump->jump_speed / 1.4;
} }
} }
else else
{ {
play_sfx(scene->engine, PLAYER_JMP_SFX);
p_ctransform->velocity.y = -p_cjump->jump_speed p_ctransform->velocity.y = -p_cjump->jump_speed
/ ( / (
((p_mstate->ground_state & 1) ? 1 : 1.2) ((p_mstate->ground_state & 1) ? 1 : 1.2)