From: Tobias Gläßer Date: Sat, 13 Mar 2004 20:08:20 +0000 (+0000) Subject: prevents stucking in some situations, when Tux is ducked. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=08cf6ac234a60d423adea8b37c781c5d0d3adfe4;p=supertux.git prevents stucking in some situations, when Tux is ducked. SVN-Revision: 206 --- diff --git a/src/player.c b/src/player.c index 3df8f89d9..507837d80 100644 --- a/src/player.c +++ b/src/player.c @@ -490,28 +490,30 @@ void player_input(player_type *pplayer) { /* Handle key and joystick state: */ - - if (pplayer->input.right == DOWN && pplayer->input.left == UP) - { - player_handle_horizontal_input(pplayer,RIGHT); - } - else if (pplayer->input.left == DOWN && pplayer->input.right == UP) + if(pplayer->duck == NO) { - player_handle_horizontal_input(pplayer,LEFT); - } - else - { - if(pplayer->base.xm > 0) + if (pplayer->input.right == DOWN && pplayer->input.left == UP) + { + player_handle_horizontal_input(pplayer,RIGHT); + } + else if (pplayer->input.left == DOWN && pplayer->input.right == UP) { - pplayer->base.xm = (int)(pplayer->base.xm - frame_ratio); - if(pplayer->base.xm < 0) - pplayer->base.xm = 0; + player_handle_horizontal_input(pplayer,LEFT); } - else if(pplayer->base.xm < 0) + else { - pplayer->base.xm = (int)(pplayer->base.xm + frame_ratio); if(pplayer->base.xm > 0) - pplayer->base.xm = 0; + { + pplayer->base.xm = (int)(pplayer->base.xm - frame_ratio); + if(pplayer->base.xm < 0) + pplayer->base.xm = 0; + } + else if(pplayer->base.xm < 0) + { + pplayer->base.xm = (int)(pplayer->base.xm + frame_ratio); + if(pplayer->base.xm > 0) + pplayer->base.xm = 0; + } } } @@ -864,10 +866,10 @@ void player_collision(player_type* pplayer, void* p_c_object, int c_object) else { pbad_c->dir = LEFT; - pbad_c->base.x = pbad_c->base.x - 32; + pbad_c->base.x = pbad_c->base.x - 32; } - - timer_start(&pbad_c->timer,5000); + + timer_start(&pbad_c->timer,5000); } else if (pbad_c->mode == FLAT && pplayer->input.fire == DOWN) {