From 6bc6636a5e7830338458c71019f2d3a5b4026c72 Mon Sep 17 00:00:00 2001 From: Ricardo Cruz Date: Sat, 22 May 2004 17:55:44 +0000 Subject: [PATCH] Fixes. SVN-Revision: 1298 --- src/badguy.cpp | 9 +++++++-- src/defines.h | 3 ++- src/special.cpp | 14 +++++++------- 3 files changed, 16 insertions(+), 10 deletions(-) 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); -- 2.11.0