Move "badguy/bombfish.[ch]pp" to "badguy/skydive.[ch]pp".
authorflorianf <florianf@837edb03-e0f3-0310-88ca-d4d4e8b29345>
Tue, 9 Mar 2010 12:35:06 +0000 (12:35 +0000)
committerflorianf <florianf@837edb03-e0f3-0310-88ca-d4d4e8b29345>
Tue, 9 Mar 2010 12:35:06 +0000 (12:35 +0000)
git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@6582 837edb03-e0f3-0310-88ca-d4d4e8b29345

src/badguy/bombfish.cpp [deleted file]
src/badguy/bombfish.hpp [deleted file]
src/badguy/skydive.cpp [new file with mode: 0644]
src/badguy/skydive.hpp [new file with mode: 0644]
src/supertux/object_factory.cpp

diff --git a/src/badguy/bombfish.cpp b/src/badguy/bombfish.cpp
deleted file mode 100644 (file)
index 6c5b52f..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-//  SuperTux
-//  Copyright (C) 2010 Florian Forster <supertux at octo.it>
-//
-//  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
-//  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, see <http://www.gnu.org/licenses/>.
-
-#include "badguy/bombfish.hpp"
-
-#include "supertux/constants.hpp"
-#include "supertux/sector.hpp"
-#include "object/anchor_point.hpp"
-#include "object/player.hpp"
-#include "object/explosion.hpp"
-
-BombFish::BombFish(const Reader& reader) :
-  BadGuy(reader, "images/creatures/bombfish/bombfish.sprite"),
-  is_grabbed(false)
-{
-}
-
-BombFish::BombFish(const Vector& pos, Direction d) :
-  BadGuy(pos, d, "images/creatures/bombfish/bombfish.sprite"),
-  is_grabbed(false)
-{
-}
-
-void
-BombFish::collision_solid(const CollisionHit& hit)
-{
-  if (hit.bottom) {
-    explode ();
-    return;
-  }
-
-  if (hit.left || hit.right)
-    physic.set_velocity_x (0.0);
-} /* void collision_solid */
-
-HitResponse
-BombFish::collision_badguy(BadGuy&, const CollisionHit& hit)
-{
-  if (hit.bottom) {
-    explode ();
-    return (ABORT_MOVE);
-  }
-
-  return (FORCE_MOVE);
-} /* HitResponse collision_badguy */
-
-void
-BombFish::grab (MovingObject&, const Vector& pos, Direction dir)
-{
-  movement = pos - get_pos();
-  this->dir = dir;
-
-  is_grabbed = true;
-
-  physic.set_velocity_x (movement.x * LOGICAL_FPS);
-  physic.set_velocity_y (0.0);
-  physic.set_acceleration_y (0.0);
-  physic.enable_gravity (false);
-  set_colgroup_active (COLGROUP_DISABLED);
-}
-
-void
-BombFish::ungrab (MovingObject& , Direction)
-{
-  is_grabbed = false;
-
-  physic.set_velocity_y (0);
-  physic.set_acceleration_y (0);
-  physic.enable_gravity (true);
-  set_colgroup_active (COLGROUP_MOVING);
-}
-
-HitResponse
-BombFish::collision_player(Player&, const CollisionHit& hit)
-{
-  if (hit.bottom) {
-    explode ();
-    return (ABORT_MOVE);
-  }
-
-  return FORCE_MOVE;
-} /* HitResponse collision_player */
-
-bool
-BombFish::collision_squished (GameObject& obj)
-{
-  Player *player = dynamic_cast<Player *> (&obj);
-  if (player) {
-    player->bounce (*this);
-    return (false);
-  }
-
-  explode ();
-  return (false);
-} /* bool collision_squished */
-
-void
-BombFish::active_update (float elapsed_time)
-{
-  if (!is_grabbed)
-    movement = physic.get_movement(elapsed_time);
-} /* void active_update */
-
-void
-BombFish::explode (void)
-{
-  if (!is_valid ())
-    return;
-
-  Explosion *explosion = new Explosion (get_anchor_pos (bbox, ANCHOR_BOTTOM));
-
-  explosion->hurts (true);
-  explosion->pushes (false);
-  Sector::current()->add_object (explosion);
-
-  remove_me ();
-} /* void explode */
-
-/* vim: set sw=2 sts=2 et fdm=marker : */
-/* EOF */
diff --git a/src/badguy/bombfish.hpp b/src/badguy/bombfish.hpp
deleted file mode 100644 (file)
index b9a988b..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-//  SuperTux
-//  Copyright (C) 2010 Florian Forster <supertux at octo.it>
-//
-//  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
-//  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, see <http://www.gnu.org/licenses/>.
-
-#ifndef HEADER_SUPERTUX_BADGUY_BOMBFISH_HPP
-#define HEADER_SUPERTUX_BADGUY_BOMBFISH_HPP
-
-#include "badguy/badguy.hpp"
-#include "object/portable.hpp"
-
-class BombFish : public BadGuy, public Portable
-{
-  private:
-    bool is_grabbed;
-
-  public:
-    BombFish(const Reader& reader);
-    BombFish(const Vector& pos, Direction d);
-
-    void collision_solid(const CollisionHit& hit);
-    HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
-
-    /* Inherited from Portable */
-    void grab(MovingObject& object, const Vector& pos, Direction dir);
-    void ungrab(MovingObject& object, Direction dir);
-
-  protected:
-    HitResponse collision_player(Player& player, const CollisionHit& hit);
-    bool collision_squished (GameObject& obj);
-
-    void active_update (float elapsed_time);
-
-    void explode (void);
-};
-
-#endif /* HEADER_SUPERTUX_BADGUY_BOMBFISH_HPP */
-
-/* vim: set sw=2 sts=2 et fdm=marker : */
-/* EOF */
diff --git a/src/badguy/skydive.cpp b/src/badguy/skydive.cpp
new file mode 100644 (file)
index 0000000..8c38d6e
--- /dev/null
@@ -0,0 +1,133 @@
+//  SuperTux
+//  Copyright (C) 2010 Florian Forster <supertux at octo.it>
+//
+//  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
+//  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, see <http://www.gnu.org/licenses/>.
+
+#include "badguy/skydive.hpp"
+
+#include "supertux/constants.hpp"
+#include "supertux/sector.hpp"
+#include "object/anchor_point.hpp"
+#include "object/player.hpp"
+#include "object/explosion.hpp"
+
+BombFish::BombFish(const Reader& reader) :
+  BadGuy(reader, "images/creatures/bombfish/bombfish.sprite"),
+  is_grabbed(false)
+{
+}
+
+BombFish::BombFish(const Vector& pos, Direction d) :
+  BadGuy(pos, d, "images/creatures/bombfish/bombfish.sprite"),
+  is_grabbed(false)
+{
+}
+
+void
+BombFish::collision_solid(const CollisionHit& hit)
+{
+  if (hit.bottom) {
+    explode ();
+    return;
+  }
+
+  if (hit.left || hit.right)
+    physic.set_velocity_x (0.0);
+} /* void collision_solid */
+
+HitResponse
+BombFish::collision_badguy(BadGuy&, const CollisionHit& hit)
+{
+  if (hit.bottom) {
+    explode ();
+    return (ABORT_MOVE);
+  }
+
+  return (FORCE_MOVE);
+} /* HitResponse collision_badguy */
+
+void
+BombFish::grab (MovingObject&, const Vector& pos, Direction dir)
+{
+  movement = pos - get_pos();
+  this->dir = dir;
+
+  is_grabbed = true;
+
+  physic.set_velocity_x (movement.x * LOGICAL_FPS);
+  physic.set_velocity_y (0.0);
+  physic.set_acceleration_y (0.0);
+  physic.enable_gravity (false);
+  set_colgroup_active (COLGROUP_DISABLED);
+}
+
+void
+BombFish::ungrab (MovingObject& , Direction)
+{
+  is_grabbed = false;
+
+  physic.set_velocity_y (0);
+  physic.set_acceleration_y (0);
+  physic.enable_gravity (true);
+  set_colgroup_active (COLGROUP_MOVING);
+}
+
+HitResponse
+BombFish::collision_player(Player&, const CollisionHit& hit)
+{
+  if (hit.bottom) {
+    explode ();
+    return (ABORT_MOVE);
+  }
+
+  return FORCE_MOVE;
+} /* HitResponse collision_player */
+
+bool
+BombFish::collision_squished (GameObject& obj)
+{
+  Player *player = dynamic_cast<Player *> (&obj);
+  if (player) {
+    player->bounce (*this);
+    return (false);
+  }
+
+  explode ();
+  return (false);
+} /* bool collision_squished */
+
+void
+BombFish::active_update (float elapsed_time)
+{
+  if (!is_grabbed)
+    movement = physic.get_movement(elapsed_time);
+} /* void active_update */
+
+void
+BombFish::explode (void)
+{
+  if (!is_valid ())
+    return;
+
+  Explosion *explosion = new Explosion (get_anchor_pos (bbox, ANCHOR_BOTTOM));
+
+  explosion->hurts (true);
+  explosion->pushes (false);
+  Sector::current()->add_object (explosion);
+
+  remove_me ();
+} /* void explode */
+
+/* vim: set sw=2 sts=2 et fdm=marker : */
+/* EOF */
diff --git a/src/badguy/skydive.hpp b/src/badguy/skydive.hpp
new file mode 100644 (file)
index 0000000..b9a988b
--- /dev/null
@@ -0,0 +1,51 @@
+//  SuperTux
+//  Copyright (C) 2010 Florian Forster <supertux at octo.it>
+//
+//  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
+//  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, see <http://www.gnu.org/licenses/>.
+
+#ifndef HEADER_SUPERTUX_BADGUY_BOMBFISH_HPP
+#define HEADER_SUPERTUX_BADGUY_BOMBFISH_HPP
+
+#include "badguy/badguy.hpp"
+#include "object/portable.hpp"
+
+class BombFish : public BadGuy, public Portable
+{
+  private:
+    bool is_grabbed;
+
+  public:
+    BombFish(const Reader& reader);
+    BombFish(const Vector& pos, Direction d);
+
+    void collision_solid(const CollisionHit& hit);
+    HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
+
+    /* Inherited from Portable */
+    void grab(MovingObject& object, const Vector& pos, Direction dir);
+    void ungrab(MovingObject& object, Direction dir);
+
+  protected:
+    HitResponse collision_player(Player& player, const CollisionHit& hit);
+    bool collision_squished (GameObject& obj);
+
+    void active_update (float elapsed_time);
+
+    void explode (void);
+};
+
+#endif /* HEADER_SUPERTUX_BADGUY_BOMBFISH_HPP */
+
+/* vim: set sw=2 sts=2 et fdm=marker : */
+/* EOF */
index ebc9869..098f952 100644 (file)
@@ -26,7 +26,7 @@
 #include "badguy/angrystone.hpp"
 #include "badguy/badguy.hpp"
 #include "badguy/bomb.hpp"
-#include "badguy/bombfish.hpp"
+#include "badguy/skydive.hpp"
 #include "badguy/bouncing_snowball.hpp"
 #include "badguy/captainsnowball.hpp"
 #include "badguy/crystallo.hpp"