- fixed 'When you jump into the roof or a bonus and fall back down you collide with...
[supertux.git] / src / special.cpp
index 9c4be7b..adfebe0 100644 (file)
@@ -96,9 +96,9 @@ Bullet::action(float elapsed_time)
     physic.set_velocity_y(-9);
 
   float scroll_x =
-    World::current()->displaymanager.get_viewport().get_translation().x;
+    World::current()->camera->get_translation().x;
   float scroll_y =
-    World::current()->displaymanager.get_viewport().get_translation().y;
+    World::current()->camera->get_translation().y;
   if (base.x < scroll_x ||
       base.x > scroll_x + screen->w ||
       base.y < scroll_y ||
@@ -112,7 +112,7 @@ Bullet::action(float elapsed_time)
 }
 
 void 
-Bullet::draw(ViewPort& viewport, int )
+Bullet::draw(Camera& viewport, int )
 {
   if(kind == FIRE_BULLET)
     img_firebullet->draw(viewport.world2screen(Vector(base.x, base.y)));
@@ -187,18 +187,18 @@ Upgrade::action(float elapsed_time)
 
   /* Away from the screen? Kill it! */
   float scroll_x =
-    World::current()->displaymanager.get_viewport().get_translation().x;
+    World::current()->camera->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) {
+    World::current()->camera->get_translation().y;
+  
+  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);
@@ -243,7 +243,7 @@ Upgrade::action(float elapsed_time)
 }
 
 void
-Upgrade::draw(ViewPort& viewport, int)
+Upgrade::draw(Camera& viewport, int)
 {
   SDL_Rect dest;
 
@@ -343,24 +343,24 @@ Upgrade::collision(void* p_c_object, int c_object, CollisionType type)
       if (kind == UPGRADE_GROWUP)
         {
           play_sound(sounds[SND_EXCELLENT], SOUND_CENTER_SPEAKER);
-          pplayer->grow();
+          pplayer->grow(true);
         }
       else if (kind == UPGRADE_FIREFLOWER)
         {
           play_sound(sounds[SND_COFFEE], SOUND_CENTER_SPEAKER);
-          pplayer->grow();
+          pplayer->grow(true);
           pplayer->got_power = pplayer->FIRE_POWER;
         }
       else if (kind == UPGRADE_ICEFLOWER)
         {
           play_sound(sounds[SND_COFFEE], SOUND_CENTER_SPEAKER);
-          pplayer->grow();
+          pplayer->grow(true);
           pplayer->got_power = pplayer->ICE_POWER;
         }
       else if (kind == UPGRADE_FIREFLOWER)
         {
           play_sound(sounds[SND_COFFEE], SOUND_CENTER_SPEAKER);
-          pplayer->grow();
+          pplayer->grow(true);
           pplayer->got_power = pplayer->FIRE_POWER;
         }
       else if (kind == UPGRADE_HERRING)