From: Ricardo Cruz Date: Sat, 8 May 2004 10:41:42 +0000 (+0000) Subject: Fixes death in modes different than the autoscrolling. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=7437ab4bcff88e2c196fd322249e8f2f998f0e77;p=supertux.git Fixes death in modes different than the autoscrolling. SVN-Revision: 1039 --- diff --git a/src/player.cpp b/src/player.cpp index d447def0c..7388100a8 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -194,7 +194,6 @@ Player::action(double frame_ratio) base.x += frame_ratio * WALK_SPEED * (dir ? 1 : -1); previous_base = old_base = base; } - check_bounds(); // Land: if (!on_ground()) @@ -739,7 +738,7 @@ Player::remove_powerups() } void -Player::check_bounds() +Player::check_bounds(bool back_scrolling, bool hor_autoscroll) { /* Keep tux in bounds: */ if (base.x < 0) @@ -754,14 +753,14 @@ Player::check_bounds() kill(KILL); } - if(base.x < scroll_x) // can happen if back scrolling is disabled + if(base.x < scroll_x && (!back_scrolling || hor_autoscroll)) // can happen if back scrolling is disabled base.x = scroll_x; - if(base.x == scroll_x) - if(issolid(base.x, base.y) || (size != SMALL && issolid(base.x, base.y+32))) + if(base.x == scroll_x && hor_autoscroll) + if(issolid(base.x+32, base.y) || (size != SMALL && issolid(base.x+32, base.y+32))) kill(KILL); - if(base.x + base.width > scroll_x + screen->w) + if(base.x + base.width > scroll_x + screen->w && hor_autoscroll) base.x = scroll_x + screen->w - base.width; diff --git a/src/player.h b/src/player.h index a92855612..1de320724 100644 --- a/src/player.h +++ b/src/player.h @@ -145,7 +145,7 @@ public: void is_dying(); bool is_dead(); void player_remove_powerups(); - void check_bounds(); + void check_bounds(bool back_scrolling, bool hor_autoscroll); bool on_ground(); bool under_solid(); void grow(); diff --git a/src/world.cpp b/src/world.cpp index 80bfe7b78..3322b9fbf 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -261,6 +261,7 @@ void World::action(double frame_ratio) { tux.action(frame_ratio); + tux.check_bounds(level->back_scrolling, (bool)level->hor_autoscroll_speed); scrolling(frame_ratio); /* Handle bouncy distros: */