From a705cb038b55f5d7634c646c134abaa7d16aee2b Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Thu, 25 Nov 2004 00:49:34 +0000 Subject: [PATCH] implement spikes as objects and remove automake system SVN-Revision: 2178 --- Makefile.am | 4 - TODO | 10 +-- autogen.sh | 6 -- configure.ac | 3 + data/images/supertux.strf | 18 +++++ lib/Makefile.am | 67 ----------------- src/Makefile.am | 44 ----------- src/badguy/badguy.cpp | 4 +- src/badguy/bomb.cpp | 2 +- src/badguy/bouncing_snowball.cpp | 4 +- src/badguy/jumpy.cpp | 2 +- src/badguy/mrbomb.cpp | 4 +- src/badguy/mriceblock.cpp | 2 +- src/badguy/snowball.cpp | 4 +- src/badguy/spike.cpp | 64 ++++++++++++++++ src/badguy/spike.h | 24 ++++++ src/badguy/spiky.cpp | 2 +- src/badguy_specs.cpp | 159 --------------------------------------- src/badguy_specs.h | 71 ----------------- src/player.cpp | 3 +- src/sector.cpp | 23 +++++- src/sector.h | 2 +- 22 files changed, 147 insertions(+), 375 deletions(-) delete mode 100644 Makefile.am delete mode 100644 lib/Makefile.am delete mode 100644 src/Makefile.am create mode 100644 src/badguy/spike.cpp create mode 100644 src/badguy/spike.h delete mode 100644 src/badguy_specs.cpp delete mode 100644 src/badguy_specs.h diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index b6b51fd0c..000000000 --- a/Makefile.am +++ /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 37ab3ba61..eea9d3456 100644 --- 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 diff --git a/autogen.sh b/autogen.sh index acdf7e7dc..21f40a34f 100755 --- a/autogen.sh +++ b/autogen.sh @@ -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 diff --git a/configure.ac b/configure.ac index ef4ac99d6..449bef2d2 100644 --- a/configure.ac +++ b/configure.ac @@ -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" + diff --git a/data/images/supertux.strf b/data/images/supertux.strf index e6a892b40..c20e1799f 100644 --- a/data/images/supertux.strf +++ b/data/images/supertux.strf @@ -782,6 +782,24 @@ ;; 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 index 0ceecbf1b..000000000 --- a/lib/Makefile.am +++ /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 index 10cfd76ff..000000000 --- a/src/Makefile.am +++ /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 diff --git a/src/badguy/badguy.cpp b/src/badguy/badguy.cpp index b13c0d5ab..b075dd1f5 100644 --- a/src/badguy/badguy.cpp +++ b/src/badguy/badguy.cpp @@ -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); } } diff --git a/src/badguy/bomb.cpp b/src/badguy/bomb.cpp index 6f884f109..62547b9e9 100644 --- a/src/badguy/bomb.cpp +++ b/src/badguy/bomb.cpp @@ -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); diff --git a/src/badguy/bouncing_snowball.cpp b/src/badguy/bouncing_snowball.cpp index 4f9334d7b..16dd18fd5 100644 --- a/src/badguy/bouncing_snowball.cpp +++ b/src/badguy/bouncing_snowball.cpp @@ -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"); } diff --git a/src/badguy/jumpy.cpp b/src/badguy/jumpy.cpp index f5ce236e9..f7abad908 100644 --- a/src/badguy/jumpy.cpp +++ b/src/badguy/jumpy.cpp @@ -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"); } diff --git a/src/badguy/mrbomb.cpp b/src/badguy/mrbomb.cpp index dbf23b712..6a9ca03e9 100644 --- a/src/badguy/mrbomb.cpp +++ b/src/badguy/mrbomb.cpp @@ -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"); } diff --git a/src/badguy/mriceblock.cpp b/src/badguy/mriceblock.cpp index dccfb00a6..cfda395fb 100644 --- a/src/badguy/mriceblock.cpp +++ b/src/badguy/mriceblock.cpp @@ -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"); } diff --git a/src/badguy/snowball.cpp b/src/badguy/snowball.cpp index ac9b27704..b16e8cfb5 100644 --- a/src/badguy/snowball.cpp +++ b/src/badguy/snowball.cpp @@ -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 index 000000000..905e92143 --- /dev/null +++ b/src/badguy/spike.cpp @@ -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 index 000000000..112227012 --- /dev/null +++ b/src/badguy/spike.h @@ -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 + diff --git a/src/badguy/spiky.cpp b/src/badguy/spiky.cpp index ca414a445..c779faace 100644 --- a/src/badguy/spiky.cpp +++ b/src/badguy/spiky.cpp @@ -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 index 62f2cace4..000000000 --- a/src/badguy_specs.cpp +++ /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 - -#include - -#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::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 index 9d3d851b3..000000000 --- a/src/badguy_specs.h +++ /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 -#include - -#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 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*/ diff --git a/src/player.cpp b/src/player.cpp index cba8829b3..7dd80849e 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -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); } diff --git a/src/sector.cpp b/src/sector.cpp index e5d76c9e3..809b119b0 100644 --- a/src/sector.cpp +++ b/src/sector.cpp @@ -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); diff --git a/src/sector.h b/src/sector.h index e08abbba8..598842bb5 100644 --- a/src/sector.h +++ b/src/sector.h @@ -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; -- 2.11.0