From 58afd70ea8a836bc41e6da8dd376728d90d27431 Mon Sep 17 00:00:00 2001 From: Wolfgang Becker Date: Sun, 22 Sep 2013 02:07:06 +0200 Subject: [PATCH] When creating a brick object to handle tiles with attribute brick the iced image is used for icy variant of the tiles (ID 78 and 105). --- data/images/objects/bonus_block/brickIce.sprite | 8 ++++++++ src/object/brick.cpp | 4 ++-- src/object/brick.hpp | 2 +- src/supertux/sector.cpp | 9 ++++++++- 4 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 data/images/objects/bonus_block/brickIce.sprite diff --git a/data/images/objects/bonus_block/brickIce.sprite b/data/images/objects/bonus_block/brickIce.sprite new file mode 100644 index 000000000..d476506b1 --- /dev/null +++ b/data/images/objects/bonus_block/brickIce.sprite @@ -0,0 +1,8 @@ +(supertux-sprite + (action + (name "empty") + (images "empty.png")) + (action + (name "normal") + (images "../../tiles/blocks/brick1.png")) +) diff --git a/src/object/brick.cpp b/src/object/brick.cpp index f9a1d61d2..f37c6092a 100644 --- a/src/object/brick.cpp +++ b/src/object/brick.cpp @@ -26,8 +26,8 @@ #include "supertux/constants.hpp" #include "supertux/sector.hpp" -Brick::Brick(const Vector& pos, int data) - : Block(sprite_manager->create("images/objects/bonus_block/brick.sprite")), breakable(false), +Brick::Brick(const Vector& pos, int data, const std::string& spriteName) + : Block(sprite_manager->create(spriteName)), breakable(false), coin_counter(0) { bbox.set_pos(pos); diff --git a/src/object/brick.hpp b/src/object/brick.hpp index 617a3e908..15a3aa879 100644 --- a/src/object/brick.hpp +++ b/src/object/brick.hpp @@ -22,7 +22,7 @@ class Brick : public Block { public: - Brick(const Vector& pos, int data); + Brick(const Vector& pos, int data, const std::string& spriteName); void try_break(Player* player); HitResponse collision(GameObject& other, const CollisionHit& hit); diff --git a/src/supertux/sector.cpp b/src/supertux/sector.cpp index 91b469d97..2355fbc3f 100644 --- a/src/supertux/sector.cpp +++ b/src/supertux/sector.cpp @@ -421,7 +421,14 @@ Sector::fix_old_tiles() add_object(new BonusBlock(pos, tile->getData())); solids->change(x, y, 0); } else if(tile->getAttributes() & Tile::BRICK) { - add_object(new Brick(pos, tile->getData())); + if( ( id == 78 ) || ( id == 105 ) ){ + add_object( new Brick(pos, tile->getData(), "images/objects/bonus_block/brickIce.sprite") ); + } else if( ( id == 77 ) || ( id == 104 ) ){ + add_object( new Brick(pos, tile->getData(), "images/objects/bonus_block/brick.sprite") ); + } else { + log_warning << "attribute 'brick #t' is not supported for tile-id " << id << std::endl; + add_object( new Brick(pos, tile->getData(), "images/objects/bonus_block/brick.sprite") ); + } solids->change(x, y, 0); } else if(tile->getAttributes() & Tile::GOAL) { std::string sequence = tile->getData() == 0 ? "endsequence" : "stoptux"; -- 2.11.0