Moved Explosion object to foreground, changed Mr. Rocket to use Explosion object...
authorChristoph Sommer <mail@christoph-sommer.de>
Wed, 13 Jun 2007 20:18:42 +0000 (20:18 +0000)
committerChristoph Sommer <mail@christoph-sommer.de>
Wed, 13 Jun 2007 20:18:42 +0000 (20:18 +0000)
SVN-Revision: 5105

14 files changed:
data/images/creatures/mr_bomb/bomb.sprite
data/images/creatures/mr_bomb/explosion-0.png [deleted file]
data/images/creatures/mr_bomb/explosion-1.png [deleted file]
data/images/creatures/mr_bomb/mr_bomb.sprite
data/images/creatures/mr_rocket/explosion-0.png [deleted file]
data/images/creatures/mr_rocket/explosion-1.png [deleted file]
data/images/creatures/mr_rocket/explosion.sprite [deleted file]
src/badguy/bomb.cpp
src/badguy/bomb.hpp
src/badguy/mrrocket.cpp
src/badguy/mrrocket.hpp
src/badguy/rocketexplosion.cpp [deleted file]
src/badguy/rocketexplosion.hpp [deleted file]
src/object/explosion.cpp

index 7832f81..08d5873 100644 (file)
   (hitbox 10 8 31.8 31.8)
   (mirror-action "ticking-left"))
  
- (action
-  (name "explosion")
-  (fps 8.0)
-  (hitbox 18 17 71 47)
-  (images "explosion-0.png"
-          "explosion-1.png"))
 )
 
diff --git a/data/images/creatures/mr_bomb/explosion-0.png b/data/images/creatures/mr_bomb/explosion-0.png
deleted file mode 100644 (file)
index b4137ca..0000000
Binary files a/data/images/creatures/mr_bomb/explosion-0.png and /dev/null differ
diff --git a/data/images/creatures/mr_bomb/explosion-1.png b/data/images/creatures/mr_bomb/explosion-1.png
deleted file mode 100644 (file)
index fef8c77..0000000
Binary files a/data/images/creatures/mr_bomb/explosion-1.png and /dev/null differ
index 287df50..7888335 100644 (file)
   (hitbox 10 8 31.8 31.8)
   (mirror-action "ticking-left"))
  
- (action
-  (name "explosion")
-  (fps 15.0)
-  (hitbox 18 17 71 47)
-  (images "explosion-0.png"
-          "explosion-1.png"
-"explosion-0.png"
-          "explosion-1.png"
-"explosion-0.png"
-          "explosion-1.png"
-"explosion-0.png"
-          "explosion-1.png"))
 )
diff --git a/data/images/creatures/mr_rocket/explosion-0.png b/data/images/creatures/mr_rocket/explosion-0.png
deleted file mode 100644 (file)
index 0c81833..0000000
Binary files a/data/images/creatures/mr_rocket/explosion-0.png and /dev/null differ
diff --git a/data/images/creatures/mr_rocket/explosion-1.png b/data/images/creatures/mr_rocket/explosion-1.png
deleted file mode 100644 (file)
index d7f047d..0000000
Binary files a/data/images/creatures/mr_rocket/explosion-1.png and /dev/null differ
diff --git a/data/images/creatures/mr_rocket/explosion.sprite b/data/images/creatures/mr_rocket/explosion.sprite
deleted file mode 100644 (file)
index 3d1a9c1..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-(supertux-sprite
- (action
-  (name "explosion-left")
-  (fps 15.0)
-  (hitbox 0 32 31.8 31.8)
-  (images "explosion-0.png"
-   "explosion-1.png")
- )
- (action
-  (name "explosion-right")
-  (fps 15.0)
-  (hitbox 0 32 31.8 31.8)
-  (mirror-action "explosion-left")
- )
-)
index 38ec13b..cbc96c0 100644 (file)
@@ -21,7 +21,6 @@
 
 #include "bomb.hpp"
 #include "random_generator.hpp"
-#include "object/sprite_particle.hpp"
 #include "object/explosion.hpp"
 
 Bomb::Bomb(const Vector& pos, Direction dir, std::string custom_sprite /*= "images/creatures/mr_bomb/mr_bomb.sprite"*/ )
@@ -66,37 +65,23 @@ Bomb::collision_solid(const CollisionHit& hit)
 }
 
 HitResponse
-Bomb::collision_player(Player& player, const CollisionHit& )
+Bomb::collision_player(Player& , const CollisionHit& )
 {
-  if(state == STATE_EXPLODING) {
-    player.kill(false);
-  }
   return ABORT_MOVE;
 }
 
 HitResponse
-Bomb::collision_badguy(BadGuy& badguy, const CollisionHit& )
+Bomb::collision_badguy(BadGuy& , const CollisionHit& )
 {
-  if(state == STATE_EXPLODING)
-    badguy.kill_fall();
   return ABORT_MOVE;
 }
 
 void
 Bomb::active_update(float )
 {
-  switch(state) {
-    case STATE_TICKING:
-      ticking->set_position(get_pos());
-      if(sprite->animation_done()) {
-        explode();
-      }
-      break;
-    case STATE_EXPLODING:
-      if(sprite->animation_done()) {
-        remove_me();
-      }
-      break;
+  ticking->set_position(get_pos());
+  if(sprite->animation_done()) {
+    explode();
   }
 }
 
@@ -115,6 +100,5 @@ Bomb::explode()
 void
 Bomb::kill_fall()
 {
-  if (state != STATE_EXPLODING)  // we don't want it exploding again
-    explode();
+  explode();
 }
index efce653..e75a32f 100644 (file)
@@ -38,8 +38,7 @@ public:
 
 private:
   enum State {
-    STATE_TICKING,
-    STATE_EXPLODING
+    STATE_TICKING
   };
 
   State state;
index 410cc83..4ac7045 100644 (file)
@@ -20,6 +20,7 @@
 #include <config.h>
 
 #include "mrrocket.hpp"
+#include "object/explosion.hpp"
 
 static const float SPEED = 200;
 
@@ -56,7 +57,7 @@ void
 MrRocket::active_update(float elapsed_time)
 {
   if (collision_timer.check()) {
-    Sector::current()->add_object(new RocketExplosion(get_pos(), dir));
+    Sector::current()->add_object(new Explosion(get_bbox().get_middle()));
     remove_me();
   }
   else if (!collision_timer.started()) {
index bb95805..628df37 100644 (file)
@@ -22,7 +22,6 @@
 
 #include "badguy.hpp"
 #include "timer.hpp"
-#include "rocketexplosion.hpp"
 
 class MrRocket : public BadGuy
 {
diff --git a/src/badguy/rocketexplosion.cpp b/src/badguy/rocketexplosion.cpp
deleted file mode 100644 (file)
index 2c24ccb..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-//  $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 distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  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>
-
-#include "rocketexplosion.hpp"
-
-static const float EXPLOSIONTIME = 1;
-
-RocketExplosion::RocketExplosion(const Vector& pos, Direction dir)
-       : BadGuy(pos, dir, "images/creatures/mr_rocket/explosion.sprite")
-{
-  countMe = false;
-  explode();
-}
-
-void
-RocketExplosion::write(lisp::Writer& )
-{
-  // rocket explosions are only temporarily so don't write them out...
-}
-
-HitResponse
-RocketExplosion::collision_player(Player& player, const CollisionHit& )
-{
-  player.kill(false);
-  return ABORT_MOVE;
-}
-
-HitResponse
-RocketExplosion::collision_badguy(BadGuy& badguy, const CollisionHit& )
-{
-   badguy.kill_fall();
-   return ABORT_MOVE;
-}
-
-void
-RocketExplosion::active_update(float )
-{
-   if(timer.check()) {
-      remove_me();
-   }
-}
-
-void
-RocketExplosion::explode()
-{
-  sprite->set_action(dir == LEFT ? "explosion-left" : "explosion-right");
-  sound_manager->play("sounds/explosion.wav", get_pos());
-  timer.start(EXPLOSIONTIME, true);
-}
-
-void
-RocketExplosion::kill_fall()
-{
-}
diff --git a/src/badguy/rocketexplosion.hpp b/src/badguy/rocketexplosion.hpp
deleted file mode 100644 (file)
index e334dc8..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-//  $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 distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  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.
-
-#ifndef __ROCKETEXPLOSION_H__
-#define __ROCKETEXPLOSION_H__
-
-#include "badguy.hpp"
-
-class RocketExplosion : public BadGuy
-{
-public:
-  RocketExplosion(const Vector& pos, Direction dir);
-
-  void write(lisp::Writer& writer);
-  HitResponse collision_player(Player& player, const CollisionHit& hit);
-  HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
-  void active_update(float elapsed_time);
-  void kill_fall();
-  void explode();
-
-  virtual RocketExplosion* clone() const { return new RocketExplosion(*this); }
-
-private:
-  Timer timer;
-};
-
-#endif
index 5d64ca2..c172e11 100644 (file)
 #include "explosion.hpp"
 #include "badguy/badguy.hpp"
 #include "object/sprite_particle.hpp"
-
-#include "resources.hpp"
-#include "video/drawing_context.hpp"
-#include "sprite/sprite_manager.hpp"
-#include "player.hpp"
-#include "sector.hpp"
-#include "player_status.hpp"
-#include "gameobjs.hpp"
-#include "statistics.hpp"
-#include "object_factory.hpp"
-#include "level.hpp"
 #include "random_generator.hpp"
-#include "audio/sound_source.hpp"
-#include "audio/sound_manager.hpp"
-#include "timer.hpp"
 
 Explosion::Explosion(const Vector& pos)
-       : MovingSprite(pos, "images/objects/explosion/explosion.sprite", LAYER_BACKGROUNDTILES+10, COLGROUP_TOUCHABLE), state(STATE_WAITING)
+       : MovingSprite(pos, "images/objects/explosion/explosion.sprite", LAYER_OBJECTS+40, COLGROUP_TOUCHABLE), state(STATE_WAITING)
 {
   sound_manager->preload("sounds/explosion.wav");
   set_pos(get_pos() - (get_bbox().get_middle() - get_pos()));
 }
 
 Explosion::Explosion(const lisp::Lisp& reader)
-       : MovingSprite(reader, "images/objects/explosion/explosion.sprite", LAYER_BACKGROUNDTILES+10, COLGROUP_TOUCHABLE), state(STATE_WAITING)
+       : MovingSprite(reader, "images/objects/explosion/explosion.sprite", LAYER_OBJECTS+40, COLGROUP_TOUCHABLE), state(STATE_WAITING)
 {
   sound_manager->preload("sounds/explosion.wav");
 }