Fixes.
authorRicardo Cruz <rick2@aeiou.pt>
Sat, 22 May 2004 17:55:44 +0000 (17:55 +0000)
committerRicardo Cruz <rick2@aeiou.pt>
Sat, 22 May 2004 17:55:44 +0000 (17:55 +0000)
SVN-Revision: 1298

src/badguy.cpp
src/defines.h
src/special.cpp

index 2cb0bcb..2e9f0f9 100644 (file)
@@ -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)
index 1c2d9b1..121fe26 100644 (file)
@@ -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
 
index 9c4be7b..b2fffe5 100644 (file)
@@ -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);