From 067ef8599ddbecb12471165f89804e7b7ed75eca Mon Sep 17 00:00:00 2001 From: Ingo Ruhnke Date: Mon, 26 Apr 2004 13:13:51 +0000 Subject: [PATCH] - changed priority of skid and duck to avoid glitches when ducking and skiding at the same time SVN-Revision: 743 --- src/player.cpp | 51 ++++++++++++++++++++++++--------------------------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/src/player.cpp b/src/player.cpp index 4e7779df6..ec3e89960 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -508,48 +508,45 @@ Player::draw() else sprite = &largetux; - if (skidding_timer.started()) + if (duck) + { + if (dir == RIGHT) + sprite->duck_right->draw(base.x - scroll_x, base.y); + else + sprite->duck_left->draw(base.x - scroll_x, base.y); + } + else if (skidding_timer.started()) { if (dir == RIGHT) sprite->skid_right->draw(base.x - scroll_x, base.y); else sprite->skid_left->draw(base.x - scroll_x, base.y); } + else if (physic.get_velocity_y() != 0) + { + if (dir == RIGHT) + sprite->jump_right->draw(base.x - scroll_x, base.y); + else + sprite->jump_left->draw(base.x - scroll_x, base.y); + } else { - if (duck) + if (fabsf(physic.get_velocity_x()) < 1.0f) // standing { if (dir == RIGHT) - sprite->duck_right->draw(base.x - scroll_x, base.y); - else - sprite->duck_left->draw(base.x - scroll_x, base.y); - } - else if (physic.get_velocity_y() != 0) - { - if (dir == RIGHT) - sprite->jump_right->draw(base.x - scroll_x, base.y); + sprite->stand_right->draw( base.x - scroll_x, base.y); else - sprite->jump_left->draw(base.x - scroll_x, base.y); + sprite->stand_left->draw( base.x - scroll_x, base.y); } - else + else // moving { - if (fabsf(physic.get_velocity_x()) < 1.0f) // standing - { - if (dir == RIGHT) - sprite->stand_right->draw( base.x - scroll_x, base.y); - else - sprite->stand_left->draw( base.x - scroll_x, base.y); - } - else // moving - { - if (dir == RIGHT) - sprite->walk_right->draw(base.x - scroll_x, base.y); - else - sprite->walk_left->draw(base.x - scroll_x, base.y); - } + if (dir == RIGHT) + sprite->walk_right->draw(base.x - scroll_x, base.y); + else + sprite->walk_left->draw(base.x - scroll_x, base.y); } } - + // Draw arm overlay graphics when Tux is holding something if (holding_something && physic.get_velocity_y() == 0) { -- 2.11.0