From: Ricardo Cruz Date: Sat, 22 May 2004 17:55:44 +0000 (+0000) Subject: Fixes. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=6bc6636a5e7830338458c71019f2d3a5b4026c72;p=supertux.git Fixes. SVN-Revision: 1298 --- diff --git a/src/badguy.cpp b/src/badguy.cpp index 2cb0bcba9..2e9f0f998 100644 --- a/src/badguy.cpp +++ b/src/badguy.cpp @@ -755,9 +755,11 @@ BadGuy::action(float elapsed_time) { float scroll_x = World::current()->displaymanager .get_viewport().get_translation().x; + float scroll_y = World::current()->displaymanager + .get_viewport().get_translation().y; // Remove if it's far off the screen: - if (base.x < scroll_x - OFFSCREEN_DISTANCE) + if (base.x < scroll_x - X_OFFSCREEN_DISTANCE) { remove_me(); return; @@ -781,7 +783,10 @@ BadGuy::action(float elapsed_time) } // Once it's on screen, it's activated! - if (base.x <= scroll_x + screen->w + OFFSCREEN_DISTANCE) + if (base.x > scroll_x - X_OFFSCREEN_DISTANCE && + base.x < scroll_x + screen->w + X_OFFSCREEN_DISTANCE && + base.y > scroll_y - Y_OFFSCREEN_DISTANCE && + base.y < scroll_y + screen->h + Y_OFFSCREEN_DISTANCE) seen = true; if(!seen) diff --git a/src/defines.h b/src/defines.h index 1c2d9b161..121fe2615 100644 --- a/src/defines.h +++ b/src/defines.h @@ -92,7 +92,8 @@ enum DyingType { /* Size constraints: */ -#define OFFSCREEN_DISTANCE 256 +#define X_OFFSCREEN_DISTANCE 280 +#define Y_OFFSCREEN_DISTANCE 240 #define LEVEL_WIDTH 375 diff --git a/src/special.cpp b/src/special.cpp index 9c4be7b3d..b2fffe5f6 100644 --- a/src/special.cpp +++ b/src/special.cpp @@ -190,15 +190,15 @@ Upgrade::action(float elapsed_time) World::current()->displaymanager.get_viewport().get_translation().x; float scroll_y = World::current()->displaymanager.get_viewport().get_translation().y; - if(base.x < scroll_x - OFFSCREEN_DISTANCE - || base.y < scroll_y - OFFSCREEN_DISTANCE) { - remove_me(); - return; - } - if(base.y > scroll_y + screen->h) { + + if(base.x < scroll_x - X_OFFSCREEN_DISTANCE || + base.x > scroll_x + screen->w + X_OFFSCREEN_DISTANCE || + base.y < scroll_y - Y_OFFSCREEN_DISTANCE || + base.y > scroll_y + screen->h + Y_OFFSCREEN_DISTANCE) + { remove_me(); return; - } + } /* Move around? */ physic.apply(elapsed_time, base.x, base.y);