From: Marek Moeckel Date: Sat, 27 Nov 2004 14:14:30 +0000 (+0000) Subject: patch contributed by markos_64: X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=44c614038ecdc2d1b69a6fee255d9c0ebc2a5098;p=supertux.git patch contributed by markos_64: -adds invisible tile (permanent, cannot be bumped) -add spiky to sector.cpp (which someone apparantly forgot to do) -fixed fireballs appearing behind tux added an invisible tile to simple.stl, for testing SVN-Revision: 2207 --- diff --git a/data/images/tilesets/supertux.stgt b/data/images/tilesets/supertux.stgt index f3408212c..e998e4062 100644 --- a/data/images/tilesets/supertux.stgt +++ b/data/images/tilesets/supertux.stgt @@ -4528,4 +4528,9 @@ ) (solid #t) ) + (tile + (id 1311) + (solid #t) + (editor-images "bonus-invisible.png") + ) ) diff --git a/data/levels/test/simple.stl b/data/levels/test/simple.stl index ee75a2c54..c78b5da72 100644 --- a/data/levels/test/simple.stl +++ b/data/levels/test/simple.stl @@ -64,7 +64,7 @@ 61 0 0 0 0 0 1063 0 1064 0 1065 0 1066 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 61 61 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 48 48 0 0 0 0 0 0 0 61 61 48 0 0 0 0 0 0 0 0 0 0 48 48 0 0 0 0 0 0 48 48 0 0 0 0 0 0 0 61 - 61 48 48 48 0 0 0 0 0 0 0 0 48 48 0 0 0 0 0 0 48 48 0 0 0 0 0 0 0 61 + 61 48 48 48 0 1311 0 0 0 0 0 0 48 48 0 0 0 0 0 0 48 48 0 0 0 0 0 0 0 61 61 0 0 0 0 0 0 0 0 0 0 0 48 48 0 0 0 0 0 0 48 48 0 0 0 0 0 0 48 61 61 0 0 0 0 0 0 0 0 0 0 0 48 48 0 0 0 0 0 0 48 48 0 0 0 0 0 0 0 61 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 diff --git a/src/object/invisible_tile.cpp b/src/object/invisible_tile.cpp new file mode 100644 index 000000000..f60d0ce1c --- /dev/null +++ b/src/object/invisible_tile.cpp @@ -0,0 +1,24 @@ +#include + +#include "invisible_tile.h" +#include "resources.h" +#include "special/sprite.h" +#include "special/sprite_manager.h" +#include "video/drawing_context.h" + +InvisibleTile::InvisibleTile(const Vector& pos) + : Block(pos, sprite_manager->create("invisibleblock")), visible(false) +{ + flags |= FLAG_SOLID; +} + +void +InvisibleTile::draw(DrawingContext& context) +{ +} + +void +InvisibleTile::hit(Player& ) +{ +} + diff --git a/src/object/invisible_tile.h b/src/object/invisible_tile.h new file mode 100644 index 000000000..0924e752a --- /dev/null +++ b/src/object/invisible_tile.h @@ -0,0 +1,21 @@ +#ifndef __INBUMPABLE_BLOCK_H__ +#define __INBUMPABLE_BLOCK_H__ + +#include "block.h" + +class InvisibleTile : public Block +{ +public: + InvisibleTile(const Vector& pos); + + virtual void draw(DrawingContext& context); + +protected: + virtual void hit(Player& player); + +private: + bool visible; +}; + +#endif + diff --git a/src/object/player.cpp b/src/object/player.cpp index 11a6ae214..fcbe65849 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -661,7 +661,9 @@ Player::handle_input() /* Shoot! */ if (input.fire == DOWN && input.old_fire == UP && got_power != NONE_POWER) { if(Sector::current()->add_bullet( - get_pos() + Vector(0, bbox.get_height()/2), +// get_pos() + Vector(0, bbox.get_height()/2), + get_pos() + ((dir == LEFT)? Vector(0, bbox.get_height()/2) + : Vector(32, bbox.get_height()/2)), physic.get_velocity_x(), dir)) shooting_timer.start(SHOOTING_TIME); input.old_fire = DOWN; diff --git a/src/sector.cpp b/src/sector.cpp index 2cefe8b73..a33ad644a 100644 --- a/src/sector.cpp +++ b/src/sector.cpp @@ -45,6 +45,7 @@ #include "object/coin.h" #include "object/block.h" #include "object/invisible_block.h" +#include "object/invisible_tile.h" #include "object/platform.h" #include "object/bullet.h" #include "badguy/jumpy.h" @@ -55,6 +56,7 @@ #include "badguy/mrbomb.h" #include "badguy/dispenser.h" #include "badguy/spike.h" +#include "badguy/spiky.h" #include "badguy/nolok_01.h" #include "trigger/door.h" #include "trigger/sequence_trigger.h" @@ -130,6 +132,8 @@ Sector::parse_object(const std::string& name, LispReader& reader) return new Dispenser(reader); } else if(name == "spike") { return new Spike(reader); + } else if(name == "spiky") { + return new Spiky(reader); } else if(name == "nolok_01") { return new Nolok_01(reader); } @@ -334,6 +338,9 @@ Sector::fix_old_tiles() if(tile->getID() == 112) { add_object(new InvisibleBlock(pos)); solids->change(x, y, 0); + } else if(tile->getID() == 1311) { + add_object(new InvisibleTile(pos)); + solids->change(x, y, 0); } else if(tile->getID() == 295) { add_object(new Spike(pos, Spike::NORTH)); solids->change(x, y, 0);