Changed the way the scrolling was calculated. Instead of calculating it relatively...
[supertux.git] / src / special.cpp
index 064ab63..4ce1025 100644 (file)
@@ -107,7 +107,6 @@ Bullet::action(double frame_ratio)
 
   if (base.x < scroll_x ||
       base.x > scroll_x + screen->w ||
-      base.y < 0 ||
       base.y > screen->h ||
       issolid(base.x + 4, base.y + 2) ||
       issolid(base.x, base.y + 2) ||
@@ -193,13 +192,10 @@ Upgrade::action(double frame_ratio)
     }
   }
 
-  /* Off screen? Kill it! */
+  /* Away from the screen? Kill it! */
   if(base.x < scroll_x - OFFSCREEN_DISTANCE) {
-    // we don't remove growups for now, when off screen
-    if(kind != UPGRADE_GROWUP) {
       remove_me();
       return;
-    }
   }
   if(base.y > screen->h) {
     remove_me();
@@ -334,32 +330,13 @@ Upgrade::collision(void* p_c_object, int c_object, CollisionType type)
       if (kind == UPGRADE_GROWUP)
         {
           play_sound(sounds[SND_EXCELLENT], SOUND_CENTER_SPEAKER);
-          pplayer->size = BIG;
-          pplayer->base.height = 64;
-         pplayer->base.y -= 32;
-         if(collision_object_map(pplayer->base))
-            {
-              pplayer->base.height = 32;
-              pplayer->base.y += 32;
-              pplayer->duck = true;
-            }
+          pplayer->grow();
         }
       else if (kind == UPGRADE_ICEFLOWER)
         {
           play_sound(sounds[SND_COFFEE], SOUND_CENTER_SPEAKER);
+          pplayer->grow();
           pplayer->got_coffee = true;
-          if (pplayer->size == SMALL)
-            {
-              pplayer->size = BIG;
-              pplayer->base.height = 64;
-              pplayer->base.y -= 32;
-            }
-         if(collision_object_map(pplayer->base))
-            {
-              pplayer->base.height = 32;
-              pplayer->base.y += 32;
-              pplayer->duck = true;
-            }
         }
       else if (kind == UPGRADE_HERRING)
         {