Merged changes from branches/supertux-milestone2-grumbel/ to trunk/supertux/
[supertux.git] / src / object / bullet.cpp
index 30e6dfa..62baac0 100644 (file)
@@ -1,12 +1,10 @@
-//  $Id$
-//
 //  SuperTux
 //  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
 //
-//  This program is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU General Public License
-//  as published by the Free Software Foundation; either version 2
-//  of the License, or (at your option) any later version.
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
 //
 //  This program is distributed in the hope that it will be useful,
 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
 //  GNU General Public License for more details.
 //
 //  You should have received a copy of the GNU General Public License
-//  along with this program; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-#include <config.h>
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-#include <math.h>
-#include "bullet.hpp"
-#include "resources.hpp"
-#include "camera.hpp"
-#include "sector.hpp"
+#include "object/bullet.hpp"
+#include "object/camera.hpp"
 #include "sprite/sprite_manager.hpp"
-#include "badguy/badguy.hpp"
-#include "main.hpp"
+#include "supertux/main.hpp"
+#include "supertux/sector.hpp"
 
 namespace {
-  const float BULLET_XM = 600;
-  const float BULLET_STARTING_YM = 0;
+const float BULLET_XM = 600;
+const float BULLET_STARTING_YM = 0;
 }
 
 Bullet::Bullet(const Vector& pos, float xm, int dir, BonusType type)
@@ -40,14 +32,14 @@ Bullet::Bullet(const Vector& pos, float xm, int dir, BonusType type)
   physic.set_velocity_x(speed + xm);
 
   if(type == FIRE_BONUS) {
-    sprite.reset(sprite_manager->create("images/objects/bullets/firebullet.sprite"));
+    sprite = sprite_manager->create("images/objects/bullets/firebullet.sprite");
   } else if(type == ICE_BONUS) {
     life_count = 10;
-    sprite.reset(sprite_manager->create("images/objects/bullets/icebullet.sprite"));
+    sprite = sprite_manager->create("images/objects/bullets/icebullet.sprite");
   } else {
     log_warning << "Bullet::Bullet called with unknown BonusType" << std::endl;
     life_count = 10;
-    sprite.reset(sprite_manager->create("images/objects/bullets/firebullet.sprite"));
+    sprite = sprite_manager->create("images/objects/bullets/firebullet.sprite");
   }
 
   bbox.set_pos(pos);
@@ -68,7 +60,7 @@ Bullet::update(float elapsed_time)
     Sector::current()->camera->get_translation().y;
   if (get_pos().x < scroll_x ||
       get_pos().x > scroll_x + SCREEN_WIDTH ||
-//     get_pos().y < scroll_y ||
+      //     get_pos().y < scroll_y ||
       get_pos().y > scroll_y + SCREEN_HEIGHT ||
       life_count <= 0) {
     remove_me();
@@ -110,3 +102,5 @@ Bullet::collision(GameObject& , const CollisionHit& )
 {
   return FORCE_MOVE;
 }
+
+/* EOF */