From 8f96892abd26903702f61978f74c2c5d012236ae Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Wed, 11 Jan 2006 13:03:15 +0000 Subject: [PATCH] stop invincible music a bit earlier than invinciblility SVN-Revision: 2981 --- src/game_session.cpp | 4 +++- src/object/player.cpp | 23 +++++++++++++++-------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/game_session.cpp b/src/game_session.cpp index c1531de18..12c0bd1c0 100644 --- a/src/game_session.cpp +++ b/src/game_session.cpp @@ -579,7 +579,9 @@ GameSession::run() //frame_rate.update(); /* Handle music: */ - if (currentsector->player->invincible_timer.started() && !end_sequence) + if (currentsector->player->invincible_timer.started() && + currentsector->player->invincible_timer.get_timeleft() + > TUX_INVINCIBLE_TIME_WARNING && !end_sequence) { currentsector->play_music(HERRING_MUSIC); } diff --git a/src/object/player.cpp b/src/object/player.cpp index 1a8feb6f4..157cff1fe 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -42,6 +42,7 @@ #include "trigger/trigger_base.hpp" #include "control/joystickkeyboardcontroller.hpp" #include "main.hpp" +#include "badguy/badguy.hpp" #include "player_status.hpp" static const int TILES_FOR_BUTTJUMP = 3; @@ -487,21 +488,20 @@ Player::handle_input() bbox.move(Vector(0, 32)); bbox.set_height(31.8); } else if(!controller->hold(Controller::DOWN) && is_big() && duck) { - // try if we can really unduck + // if we have some velocity left then check if there is space for + // unducking bbox.move(Vector(0, -32)); bbox.set_height(63.8); - duck = false; - // FIXME -#if 0 - // when unducking in air we need some space to do so - if(on_ground() || !collision_object_map(bbox)) { + if(Sector::current()->is_free_space(bbox) || ( + physic.get_velocity_x() > -.01 && physic.get_velocity_x() < .01 + && physic.get_velocity_y() > -.01 && physic.get_velocity_y() < .01)) + { duck = false; } else { // undo the ducking changes bbox.move(Vector(0, 32)); - bbox.set_height(31.8); + bbox.set_height(31.8); } -#endif } } @@ -723,6 +723,11 @@ Player::collision(GameObject& other, const CollisionHit& hit) return FORCE_MOVE; } + BadGuy* badguy = dynamic_cast (&other); + if(badguy != NULL) + return CONTINUE; + +#if 0 MovingObject* moving_object = static_cast (&other); if(moving_object->get_group() == COLGROUP_TOUCHABLE) return FORCE_MOVE; @@ -731,6 +736,8 @@ Player::collision(GameObject& other, const CollisionHit& hit) return FORCE_MOVE; return CONTINUE; +#endif + return FORCE_MOVE; } void -- 2.11.0