X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fobject%2Ftilemap.cpp;h=a6765ee679a6b481cf20d63d64db3eaf845015a4;hb=86181b0a14d89cf45daf97199c3556c4dd1ee7b7;hp=d37ae5c328edde3a67e24c2f7b78b2097090e8b2;hpb=5b7f9214cb929399f1a855ef5807018a9447d510;p=supertux.git diff --git a/src/object/tilemap.cpp b/src/object/tilemap.cpp index d37ae5c32..a6765ee67 100644 --- a/src/object/tilemap.cpp +++ b/src/object/tilemap.cpp @@ -37,7 +37,7 @@ TileMap::TileMap() : solid(false), speed(1), width(0), height(0), layer(LAYER_TILES), - drawing_effect(0) + drawing_effect(NO_EFFECT) { tilemanager = tile_manager; @@ -47,7 +47,7 @@ TileMap::TileMap() TileMap::TileMap(const lisp::Lisp& reader, TileManager* new_tile_manager) : solid(false), speed(1), width(-1), height(-1), layer(LAYER_TILES), - drawing_effect(0) + drawing_effect(NO_EFFECT) { tilemanager = new_tile_manager; if(tilemanager == 0) @@ -94,7 +94,7 @@ TileMap::TileMap(const lisp::Lisp& reader, TileManager* new_tile_manager) TileMap::TileMap(int layer_, bool solid_, size_t width_, size_t height_) : solid(solid_), speed(1), width(0), height(0), layer(layer_), - drawing_effect(0) + drawing_effect(NO_EFFECT) { tilemanager = tile_manager; @@ -180,13 +180,13 @@ TileMap::draw(DrawingContext& context) for (pos.x = start_x; pos.x < end_x; pos.x += 32) { context.draw_filled_rect(Vector (pos.x, start_y), Vector(1, fabsf(start_y - end_y)), - Color(225, 225, 225), LAYER_GUI-50); + Color(0.8f, 0.8f, 0.8f), LAYER_GUI-50); } for (pos.y = start_y; pos.y < end_y; pos.y += 32) { context.draw_filled_rect(Vector (start_x, pos.y), Vector(fabsf(start_x - end_x), 1), - Color(225, 225, 225), LAYER_GUI-50); + Color(1.0f, 1.0f, 1.0f), LAYER_GUI-50); } } #endif @@ -281,4 +281,13 @@ TileMap::change_at(const Vector& pos, uint32_t newtile) change(int(pos.x)/32, int(pos.y)/32, newtile); } +void +TileMap::change_all(uint32_t oldtile, uint32_t newtile) +{ + for (size_t x = 0; x < get_width(); x++) + for (size_t y = 0; y < get_height(); y++) { + if (get_tile(x,y)->getID() == oldtile) change(x,y,newtile); + } +} + IMPLEMENT_FACTORY(TileMap, "tilemap");