implement spikes as objects and remove automake system
authorMatthias Braun <matze@braunis.de>
Thu, 25 Nov 2004 00:49:34 +0000 (00:49 +0000)
committerMatthias Braun <matze@braunis.de>
Thu, 25 Nov 2004 00:49:34 +0000 (00:49 +0000)
SVN-Revision: 2178

22 files changed:
Makefile.am [deleted file]
TODO
autogen.sh
configure.ac
data/images/supertux.strf
lib/Makefile.am [deleted file]
src/Makefile.am [deleted file]
src/badguy/badguy.cpp
src/badguy/bomb.cpp
src/badguy/bouncing_snowball.cpp
src/badguy/jumpy.cpp
src/badguy/mrbomb.cpp
src/badguy/mriceblock.cpp
src/badguy/snowball.cpp
src/badguy/spike.cpp [new file with mode: 0644]
src/badguy/spike.h [new file with mode: 0644]
src/badguy/spiky.cpp
src/badguy_specs.cpp [deleted file]
src/badguy_specs.h [deleted file]
src/player.cpp
src/sector.cpp
src/sector.h

diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644 (file)
index b6b51fd..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-SUBDIRS = lib src data
-EXTRA_DIST = LEVELDESIGN TODO contrib/levelconverter-0.0.6_0.0.7.py autogen.sh
-ACLOCAL_AMFLAGS = -I mk/autoconf
-AUTOMAKE_OPTIONS = 1.6 dist-bzip2
diff --git a/TODO b/TODO
index 37ab3ba..eea9d34 100644 (file)
--- a/TODO
+++ b/TODO
@@ -44,12 +44,12 @@ L: low priority
     few pixels higher) - hopefully ok
  * it's impossible to go into passages that have exactly the size of tux,
    either reduce collision rectangle by DELTA or round collision coordinates to
-   integers... 
+   integers... - ok for tux and most badguys
  ** implement 1up - ok
  ** implement star - ok
  * bring back the enemies
-    - add activation again
-    - make api simpler
+    - add activation again - ok
+    - make api simpler - ok
     - implement jumpy - ok
     -* implement spiky - ok
     - implement snowball - ok
@@ -69,7 +69,7 @@ L: low priority
     for  after big commit...
  * smoke clouds are too fast
  * some shots disappear in the ground with a "max collision depth reached"
-   message
+   message - ok
  * rework collision detection to take movement into account - this should fix
     the egg suddenly turning directions and the somtimes strange behaviour
     when hitting a block from the side when falling.
@@ -89,7 +89,7 @@ L: low priority
  ** having a star doesn't kill enemies - ok
  * tux always jumps to full height at the moment - ok
  * invisble blocks are visible and make the game crash when bumped - ok
- * reimplement spikes as objects
+ * reimplement spikes as objects - ok
  * what to do when stuck under tiles (after using duck-sliding)
  * do we want multi hit scores again?
  * tux doesn't stop at igloo anymore
index acdf7e7..21f40a3 100755 (executable)
@@ -18,11 +18,5 @@ sed -e 's/.*BACKSLASH.*//' -i Jamconfig.in
 echo 'INSTALL ?= "@INSTALL@" ;' >> Jamconfig.in
 echo 'JAMCONFIG_READ = yes ;' >> Jamconfig.in
 
-# we need a minimum of automake 1.6 and automake 1.8 seems to be buggy
-# this doesn't seem to work well
-# see AUTOMAKE_OPTIONS in Makefile.am
-export WANT_AUTOMAKE=1.6
-
-automake --copy --add-missing
 autoconf
 
index ef4ac99..449bef2 100644 (file)
@@ -139,3 +139,6 @@ echo " Profile Mode:   $enable_gprof"
 echo " Debug Mode:     $enable_debug"
 echo " OpenGL Support: $enable_opengl"
 echo ""
+echo ""
+echo "       NOTE: This project uses jam (and not make) as build tool"
+
index e6a892b..c20e179 100644 (file)
 
 
 ;; Bad Guys follow
+ (sprite (name "spike")
+    (action
+      (name "north")
+      (images "tilesets/spike_up.png")
+    )
+    (action
+      (name "south")
+      (images "tilesets/spike_down.png")
+    )
+    (action
+      (name "west")
+      (images "tilesets/spike_left.png")
+    )
+    (action
+      (name "east")
+      (images "tilesets/spike_right.png")
+    )
+ )
 
  ;; MrIceBlock
  (sprite (name "mriceblock")
diff --git a/lib/Makefile.am b/lib/Makefile.am
deleted file mode 100644 (file)
index 0ceecbf..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-INCLUDES = 
-METASOURCES = AUTO
-lib_LTLIBRARIES = libsupertux.la
-libsupertux_la_SOURCES =app/globals.cpp \
-                       app/setup.cpp \
-                       audio/musicref.cpp \
-                       audio/sound_manager.cpp \
-                       gui/button.cpp \
-                       gui/menu.cpp \
-                       gui/mousecursor.cpp \
-                       math/physic.cpp \
-                       math/vector.cpp \
-                       special/game_object.cpp \
-                       special/moving_object.cpp \
-                       special/sprite.cpp \
-                        special/sprite.h \
-                        special/sprite_data.cpp \
-                        special/sprite_data.h \
-                       special/sprite_manager.cpp \
-                        special/sprite_manager.h \
-                       special/timer.cpp \
-                       special/frame_rate.cpp \
-                        special/collision.h \
-                        special/collision_hit.h \
-                        special/collision.cpp \
-                       utils/configfile.cpp \
-                       utils/lispreader.cpp \
-                       utils/lispwriter.cpp \
-                       video/drawing_context.cpp \
-                       video/font.cpp \
-                       video/screen.cpp \
-                       video/surface.cpp
-libsupertuxdir = $(includedir)/supertux
-libsupertuxappdir = $(libsupertuxdir)/app
-libsupertuxaudiodir = $(libsupertuxdir)/audio
-libsupertuxguidir = $(libsupertuxdir)/gui
-libsupertuxmathdir = $(libsupertuxdir)/math
-libsupertuxspecialdir = $(libsupertuxdir)/special
-libsupertuxutilsdir = $(libsupertuxdir)/utils
-libsupertuxvideodir = $(libsupertuxdir)/video
-libsupertuxapp_HEADERS =app/setup.h \
-                       app/gettext.h \
-                       app/globals.h
-libsupertuxaudio_HEADERS =audio/musicref.h \
-                       audio/sound_manager.h
-libsupertuxgui_HEADERS =gui/button.h \
-                       gui/menu.h \
-                       gui/mousecursor.h
-libsupertuxmath_HEADERS =math/physic.h \
-                       math/vector.h
-libsupertuxspecial_HEADERS = special/game_object.h \
-                       special/moving_object.h \
-                       special/sprite.h \
-                       special/sprite_manager.h \
-                       special/timer.h \
-                       special/frame_rate.h
-libsupertuxutils_HEADERS =utils/configfile.h \
-                       utils/exceptions.h \
-                       utils/lispreader.h \
-                       utils/lispwriter.h
-libsupertuxvideo_HEADERS =video/drawing_context.h \
-                       video/font.h \
-                       video/screen.h \
-                       video/surface.h 
-libsupertux_la_LDFLAGS = -module
-
-
diff --git a/src/Makefile.am b/src/Makefile.am
deleted file mode 100644 (file)
index 10cfd76..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-localedir = $(datadir)/locale
-
-bin_PROGRAMS = supertux
-supertux_CXXFLAGS = -DLOCALEDIR=\"$(localedir)\"
-supertux_LDADD = $(top_builddir)/lib/libsupertux.la @LIBINTL@
-
-
-supertux_SOURCES = camera.cpp \
-                       camera.h collision.cpp collision.h intro.cpp intro.h \
-                       gameloop.cpp gameloop.h high_scores.cpp high_scores.h \
-                       level.cpp level.h level_subset.cpp level_subset.h \
-                        leveleditor.cpp leveleditor.h particlesystem.cpp \
-                        particlesystem.h player.cpp player.h scene.cpp \
-                       scene.h supertux.cpp title.cpp title.h worldmap.cpp \
-                       worldmap.h tile.h tile.cpp tile_manager.h tile_manager.cpp resources.h \
-                       resources.cpp gameobjs.h gameobjs.cpp background.h background.cpp tilemap.h \
-                       tilemap.cpp serializable.h sector.cpp sector.h misc.h misc.cpp defines.h \
-                       statistics.cpp badguy_specs.cpp \
-                        timer.cpp timer.h \
-                        object/coin.h object/coin.cpp \
-                        object/block.h object/block.cpp \
-                        object/platform.h object/platform.cpp \
-                        object/fireworks.h object/fireworks.cpp \
-                        object/bullet.h object/bullet.cpp \
-                        object/specialriser.h object/specialriser.cpp \
-                        object/star.h object/star.cpp \
-                        object/oneup.h object/oneup.cpp \
-                        object/flower.h object/flower.cpp \
-                        object/growup.h object/growup.cpp \
-                        object/invisible_block.h object/invisible_block.cpp \
-                        badguy/badguy.h badguy/badguy.cpp \
-                        badguy/bomb.h badguy/bomb.cpp \
-                        badguy/bouncing_snowball.h badguy/bouncing_snowball.cpp\
-                        badguy/flame.h badguy/flame.cpp \
-                        badguy/jumpy.h badguy/jumpy.cpp \
-                        badguy/mrbomb.h badguy/mrbomb.cpp \
-                        badguy/mriceblock.h badguy/mriceblock.cpp \
-                        badguy/snowball.h badguy/snowball.cpp \
-                        badguy/spiky.h badguy/spiky.cpp \
-                        trigger/trigger_base.h trigger/trigger_base.cpp \
-                        trigger/door.h trigger/door.cpp \
-                        trigger/sequence_trigger.h trigger/sequence_trigger.cpp
-
-INCLUDES = -I$(top_srcdir)/lib
index b13c0d5..b075dd1 100644 (file)
@@ -25,9 +25,9 @@ BadGuy::draw(DrawingContext& context)
   if(state == STATE_INIT || state == STATE_INACTIVE)
     return;
   if(state == STATE_FALLING) {
-      sprite->draw(context, get_pos(), LAYER_OBJECTS, VERTICAL_FLIP);
+    sprite->draw(context, get_pos(), LAYER_OBJECTS, VERTICAL_FLIP);
   } else {
-      sprite->draw(context, get_pos(), LAYER_OBJECTS);
+    sprite->draw(context, get_pos(), LAYER_OBJECTS);
   }
 }
 
index 6f884f1..62547b9 100644 (file)
@@ -9,7 +9,7 @@ Bomb::Bomb(const Vector& pos, Direction dir)
 {
   start_position = pos;
   bbox.set_pos(pos);
-  bbox.set_size(32, 32);
+  bbox.set_size(31.8, 31.8);
   sprite = sprite_manager->create("bomb");
   state = 0;
   timer.start(TICKINGTIME);
index 4f9334d..16dd18f 100644 (file)
@@ -9,7 +9,7 @@ BouncingSnowball::BouncingSnowball(LispReader& reader)
 {
   reader.read_float("x", start_position.x);
   reader.read_float("y", start_position.y);
-  bbox.set_size(32, 32);
+  bbox.set_size(31.8, 31.8);
   sprite = sprite_manager->create("bouncingsnowball");
 }
 
@@ -17,7 +17,7 @@ BouncingSnowball::BouncingSnowball(float pos_x, float pos_y)
 {
    start_position.x = pos_x;
    start_position.y = pos_y;
-   bbox.set_size(32, 32);
+   bbox.set_size(31.8, 31.8);
    sprite = sprite_manager->create("bouncingsnowball");
 }
 
index f5ce236..f7abad9 100644 (file)
@@ -8,7 +8,7 @@ Jumpy::Jumpy(LispReader& reader)
 {
   reader.read_float("x", start_position.x);
   reader.read_float("y", start_position.y);
-  bbox.set_size(32, 32);
+  bbox.set_size(31.8, 31.8);
   sprite = sprite_manager->create("jumpy");
 }
 
index dbf23b7..6a9ca03 100644 (file)
@@ -9,7 +9,7 @@ MrBomb::MrBomb(LispReader& reader)
 {
   reader.read_float("x", start_position.x);
   reader.read_float("y", start_position.y);
-  bbox.set_size(32, 32);
+  bbox.set_size(31.8, 31.8);
   sprite = sprite_manager->create("mrbomb");
 }
 
@@ -17,7 +17,7 @@ MrBomb::MrBomb(float pos_x, float pos_y)
 {
   start_position.x = pos_x;
   start_position.y = pos_y;
-  bbox.set_size(32, 32);
+  bbox.set_size(31.8, 31.8);
   sprite = sprite_manager->create("mrbomb");
 }
 
index dccfb00..cfda395 100644 (file)
@@ -11,7 +11,7 @@ MrIceBlock::MrIceBlock(LispReader& reader)
 {
   reader.read_float("x", start_position.x);
   reader.read_float("y", start_position.y);
-  bbox.set_size(32, 32);
+  bbox.set_size(31.8, 31.8);
   sprite = sprite_manager->create("mriceblock");
 }
 
index ac9b277..b16e8cf 100644 (file)
@@ -8,7 +8,7 @@ SnowBall::SnowBall(LispReader& reader)
 {
   reader.read_float("x", start_position.x);
   reader.read_float("y", start_position.y);
-  bbox.set_size(32, 32);
+  bbox.set_size(31.8, 31.8);
   sprite = sprite_manager->create("snowball");
 }
 
@@ -16,7 +16,7 @@ SnowBall::SnowBall(float pos_x, float pos_y)
 {
   start_position.x = pos_x;
   start_position.y = pos_y;
-  bbox.set_size(32, 32);
+  bbox.set_size(31.8, 31.8);
   sprite = sprite_manager->create("snowball");
 }
 
diff --git a/src/badguy/spike.cpp b/src/badguy/spike.cpp
new file mode 100644 (file)
index 0000000..905e921
--- /dev/null
@@ -0,0 +1,64 @@
+#include "spike.h"
+
+Spike::Spike(const Vector& pos, Direction dir)
+{
+  sprite = sprite_manager->create("spike");
+  start_position = pos;
+  bbox.set_pos(Vector(0, 0));
+  bbox.set_size(32, 32);
+  set_direction(dir);
+}
+
+Spike::Spike(LispReader& reader)
+{
+  sprite = sprite_manager->create("spike");
+  reader.read_float("x", start_position.x);
+  reader.read_float("y", start_position.y);
+  bbox.set_size(32, 32);
+  int idir = 0;
+  reader.read_int("direction", idir);
+  set_direction((Direction) idir);
+}
+
+void
+Spike::set_direction(Direction dir)
+{
+  spikedir = dir;
+  switch(spikedir) {
+    case NORTH:
+      sprite->set_action("north");
+      break;
+    case SOUTH:
+      sprite->set_action("south");
+      break;
+    case WEST:
+      sprite->set_action("west");
+      break;
+    case EAST:
+      sprite->set_action("east");
+      break;
+    default:
+      break;
+  }
+}
+
+void
+Spike::write(LispWriter& writer)
+{
+  writer.start_list("spike");
+  writer.write_float("x", start_position.x);
+  writer.write_float("y", start_position.y);
+  writer.write_int("direction", spikedir);
+  writer.end_list("spike");
+}
+
+void
+Spike::kill_fall()
+{
+  // you can't kill a spike
+}
+
+void
+Spike::active_action(float )
+{
+}
diff --git a/src/badguy/spike.h b/src/badguy/spike.h
new file mode 100644 (file)
index 0000000..1122270
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef __SPIKE_H__
+#define __SPIKE_H__
+
+#include "badguy.h"
+
+class Spike : public BadGuy
+{
+public:
+  enum Direction {
+    NORTH=0, SOUTH, WEST, EAST
+  };
+  Spike(const Vector& pos, Direction dir);
+  Spike(LispReader& reader);
+
+  void active_action(float elapsed_time);
+  void write(LispWriter& writer);
+  void kill_fall();
+private:
+  void set_direction(Direction dir);
+  Direction spikedir;
+};
+
+#endif
+
index ca414a4..c779faa 100644 (file)
@@ -8,7 +8,7 @@ Spiky::Spiky(LispReader& reader)
 {
   reader.read_float("x", start_position.x);
   reader.read_float("y", start_position.y);
-  bbox.set_size(32, 32);
+  bbox.set_size(31.8, 31.8);
   sprite = sprite_manager->create("spiky");
 }
 
diff --git a/src/badguy_specs.cpp b/src/badguy_specs.cpp
deleted file mode 100644 (file)
index 62f2cac..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-/***************************************************************************
-               badguy_specs.cpp  -  badguys properties table
-                     -------------------
-    begin                : Oct, 11 2004
-    copyright            : (C) 2004 by Ricardo Cruz
-    email                : rick2@aeiou.pt
- ***************************************************************************/
-
-/***************************************************************************
- *                                                                         *
- *   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.                                   *
- *                                                                         *
- ***************************************************************************/
-
-#include <config.h>
-
-#include <iostream>
-
-#include "special/sprite_manager.h"
-#include "resources.h"
-
-#include "badguy_specs.h"
-
-BadGuySpecsManager* badguyspecs_manager = 0;
-
-BadGuySpecsManager::BadGuySpecsManager(const std::string& filename)
-{
-  load_resfile(filename);
-}
-
-BadGuySpecsManager::~BadGuySpecsManager()
-{
-  for(std::map<std::string, BadGuySpecs*>::iterator i =
-     badguys_specs.begin(); i != badguys_specs.end(); ++i)
-    delete i->second;
-}
-
-void
-BadGuySpecsManager::load_resfile(const std::string& filename)
-{
-  lisp_object_t* root_obj = lisp_read_from_file(filename);
-  if (!root_obj)
-    {
-      std::cout << "BadGuySpecsManager: Couldn't load: " << filename << std::endl;
-      return;
-    }
-
-  lisp_object_t* cur = root_obj;
-
-  if (strcmp(lisp_symbol(lisp_car(cur)), "supertux-badguys-specifications") != 0)
-    return;
-  cur = lisp_cdr(cur);
-
-  while(cur)
-    {
-      lisp_object_t* el = lisp_car(cur);
-
-      if (strcmp(lisp_symbol(lisp_car(el)), "badguy") == 0)
-        {
-          LispReader reader(lisp_cdr(lisp_car(cur)));
-          BadGuySpecs* badguy_specs = new BadGuySpecs(reader);
-
-          BadGuysSpecs::iterator i = badguys_specs.find(badguy_specs->get_name());
-          if (i == badguys_specs.end())
-            {
-              badguys_specs[badguy_specs->get_name()] = badguy_specs;
-            }
-          else
-            {
-              delete i->second;
-              i->second = badguy_specs;
-              std::cerr << "Warning: dulpicate entry: '" << badguy_specs->get_name() << "'" << std::endl;
-            }
-        }
-      else
-        {
-          std::cout << "BadGuySpecsManager: Unknown tag" << std::endl;
-        }
-
-      cur = lisp_cdr(cur);
-    }
-
-  lisp_free(root_obj);
-}
-
-BadGuySpecs*
-BadGuySpecsManager::load(const std::string& name)
-{
-  BadGuysSpecs::iterator i = badguys_specs.find(name);
-  if (i == badguys_specs.end())
-    {
-      std::cerr << "Warning: BadGuy specification '" << name << "' not found" << std::endl;
-      return 0;
-    }
-  return i->second;
-}
-
-BadGuySpecs::BadGuySpecs(LispReader& reader)
-{
-  reset();
-
-  std::string str;
-  reader.read_string("kind", str);
-  kind = str;
-
-  str.clear();
-  reader.read_string("inherits", str);
-  if(!str.empty())
-    {
-    BadGuySpecs* bgspecs = badguyspecs_manager->load(str);
-    if(bgspecs)
-      {
-      sprite = bgspecs->sprite;
-      }
-    else
-      std::cerr << "Warning: inherited '" << str
-                << "was not found.\nProbably, it was declared after"
-                   "this entry '" << kind << std::endl;
-    }
-
-  str.clear();
-  reader.read_string("sprite", str);
-  if(str.empty())
-    std::cerr << "Warning: No sprite has been set to badguy " << kind << std::endl;
-  else
-    sprite = sprite_manager->create(str);
-
-  if(!sprite) {
-    std::cerr << "Warning: Sprite '" << str << "' could not be loaded.\n";
-  }
-}
-
-BadGuySpecs::BadGuySpecs(std::string& kind_)
-{
-  reset();
-  kind = kind_;
-}
-
-BadGuySpecs::~BadGuySpecs()
-{
-  delete sprite;
-}
-
-void
-BadGuySpecs::reset()
-{
-  kind.clear();
-}
-
-std::string
-BadGuySpecs::get_name()
-{
-return kind;
-}
-
-// EOF //
diff --git a/src/badguy_specs.h b/src/badguy_specs.h
deleted file mode 100644 (file)
index 9d3d851..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/***************************************************************************
-               badguy_specs.h  -  badguys properties table
-                     -------------------
-    begin                : Oct, 11 2004
-    copyright            : (C) 2004 by Ricardo Cruz
-    email                : rick2@aeiou.pt
- ***************************************************************************/
-
-/***************************************************************************
- *                                                                         *
- *   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.                                   *
- *                                                                         *
- ***************************************************************************/
-
-#ifndef SUPERTUX_BADGUY_SPECS_H
-#define SUPERTUX_BADGUY_SPECS_H
-
-#include <string>
-#include <map>
-
-#include "utils/lispreader.h"
-
-using namespace SuperTux;
-
-namespace SuperTux {
-class Sprite;
-}
-
-class BadGuySpecs;
-class BadGuySpecsManager;
-extern BadGuySpecsManager* badguyspecs_manager;
-
-class BadGuySpecsManager
-{
-public:
-  BadGuySpecsManager(const std::string& filename);
-  ~BadGuySpecsManager();
-
-  void  load_resfile(const std::string& filename);
-  /** loads a sprite.
-   * WARNING: You must not delete the returned object.
-   */
-  BadGuySpecs* load(const std::string& name);
-
-private:
-  typedef std::map<std::string, BadGuySpecs*> BadGuysSpecs;
-  BadGuysSpecs badguys_specs;
-};
-
-class BadGuySpecs
-{
-public:
-  BadGuySpecs(LispReader& reader);
-  BadGuySpecs(std::string& kind);
-  ~BadGuySpecs();
-
-  std::string get_name();
-
-  // proprities
-  std::string kind;
-  Sprite* sprite;
-
-private:
-  void reset();
-};
-
-
-#endif /*SUPERTUX_BADGUY_SPECS_H*/
index cba8829..7dd8084 100644 (file)
@@ -870,8 +870,7 @@ Player::collision(GameObject& other, const CollisionHit& hit)
       physic.set_velocity_y(.1);
     }
     
-    if(fabsf(hit.normal.x) > .5) { // hit on the side?
-      printf("s"); fflush(stdout);
+    if(fabsf(hit.normal.x) > .9) { // hit on the side?
       physic.set_velocity_x(0);
     }
 
index e5d76c9..809b119 100644 (file)
@@ -46,7 +46,6 @@
 #include "object/block.h"
 #include "object/invisible_block.h"
 #include "object/platform.h"
-#include "trigger/door.h"
 #include "object/bullet.h"
 #include "badguy/jumpy.h"
 #include "badguy/snowball.h"
@@ -55,6 +54,8 @@
 #include "badguy/mriceblock.h"
 #include "badguy/mrbomb.h"
 #include "badguy/dispenser.h"
+#include "badguy/spike.h"
+#include "trigger/door.h"
 #include "trigger/sequence_trigger.h"
 #include "trigger/secretarea_trigger.h"
 
@@ -102,7 +103,7 @@ Sector *Sector::create(const std::string& name, size_t width, size_t height)
 }
 
 GameObject*
-Sector::parseObject(const std::string& name, LispReader& reader)
+Sector::parse_object(const std::string& name, LispReader& reader)
 {
   if(name == "background") {
     background = new Background(reader);
@@ -155,6 +156,8 @@ Sector::parseObject(const std::string& name, LispReader& reader)
     return new MrBomb(reader);
   } else if(name == "dispenser") {
     return new Dispenser(reader);
+  } else if(name == "spike") {
+    return new Spike(reader);
   }
 #if 0
     else if(badguykind_from_string(name) != BAD_INVALID) {
@@ -195,7 +198,7 @@ Sector::parse(LispReader& lispreader)
       reader.read_float("y", sp->pos.y);
       spawnpoints.push_back(sp);
     } else {
-      GameObject* object = parseObject(token, reader);
+      GameObject* object = parse_object(token, reader);
       if(object) {
         add_object(object);
       }
@@ -330,7 +333,7 @@ Sector::parse_old_format(LispReader& reader)
                                                                                 
         LispReader reader(lisp_cdr(data));
 
-        GameObject* object = parseObject(object_type, reader);
+        GameObject* object = parse_object(object_type, reader);
         if(object) {
           add_object(object);
         } else {
@@ -359,6 +362,18 @@ Sector::fix_old_tiles()
       if(tile->id == 112) {
         add_object(new InvisibleBlock(pos));
         solids->change(x, y, 0);
+      } else if(tile->id == 295) {
+        add_object(new Spike(pos, Spike::NORTH));
+        solids->change(x, y, 0);
+      } else if(tile->id == 296) {
+        add_object(new Spike(pos, Spike::EAST));
+        solids->change(x, y, 0);
+      } else if(tile->id == 297) {
+        add_object(new Spike(pos, Spike::SOUTH));
+        solids->change(x, y, 0);
+      } else if(tile->id == 298) {
+        add_object(new Spike(pos, Spike::WEST));
+        solids->change(x, y, 0);
       } else if(tile->attributes & Tile::COIN) {
         add_object(new Coin(pos));
         solids->change(x, y, 0);
index e08abbb..598842b 100644 (file)
@@ -124,7 +124,7 @@ private:
   void collision_object(MovingObject* object1, MovingObject* object2);
   
   void load_music();
-  GameObject* parseObject(const std::string& name, LispReader& reader);
+  GameObject* parse_object(const std::string& name, LispReader& reader);
   
   static Sector* _current;