From 2743fdb7b15d53354fef5096de5438de4fac5ed6 Mon Sep 17 00:00:00 2001 From: Christoph Sommer Date: Wed, 5 Jul 2006 11:05:22 +0000 Subject: [PATCH] FlipLevelTransformer takes care of (Bonus)Blocks that move SVN-Revision: 3891 --- src/flip_level_transformer.cpp | 10 ++++++++++ src/flip_level_transformer.hpp | 2 ++ src/object/block.hpp | 3 +++ 3 files changed, 15 insertions(+) diff --git a/src/flip_level_transformer.cpp b/src/flip_level_transformer.cpp index 2d966de7a..e56ac2a5b 100644 --- a/src/flip_level_transformer.cpp +++ b/src/flip_level_transformer.cpp @@ -56,6 +56,10 @@ FlipLevelTransformer::transform_sector(Sector* sector) if(platform) { transform_platform(height, *platform); } + Block* block = dynamic_cast (object); + if(block) { + transform_block(height, *block); + } MovingObject* mobject = dynamic_cast (object); if(mobject) { transform_moving_object(height, mobject); @@ -123,3 +127,9 @@ FlipLevelTransformer::transform_platform(float height, Platform& platform) pos.y = height - pos.y - platform.get_bbox().get_height(); } } + +void +FlipLevelTransformer::transform_block(float height, Block& block) +{ + block.original_y = height - block.original_y - block.get_bbox().get_height(); +} diff --git a/src/flip_level_transformer.hpp b/src/flip_level_transformer.hpp index fde90f8b8..bfb0c6f0e 100644 --- a/src/flip_level_transformer.hpp +++ b/src/flip_level_transformer.hpp @@ -23,6 +23,7 @@ #include "level_transformer.hpp" #include "object/platform.hpp" #include "object/path.hpp" +#include "object/block.hpp" class TileMap; class BadGuy; @@ -41,6 +42,7 @@ private: void transform_badguy(float height, BadGuy* badguy); void transform_spawnpoint(float height, SpawnPoint* spawnpoint); void transform_platform(float height, Platform& platform); + void transform_block(float height, Block& block); }; #endif diff --git a/src/object/block.hpp b/src/object/block.hpp index ac7bdd233..07b37cbb0 100644 --- a/src/object/block.hpp +++ b/src/object/block.hpp @@ -37,6 +37,8 @@ public: virtual void draw(DrawingContext& context); protected: + friend class FlipLevelTransformer; + virtual void hit(Player& player) = 0; void start_bounce(); @@ -45,6 +47,7 @@ protected: float bounce_dir; float bounce_offset; float original_y; + }; class BonusBlock : public Block -- 2.11.0