From 7192ffdbf1ab5d5b3455b9d9c4c3a1780004b1d6 Mon Sep 17 00:00:00 2001 From: Ingo Ruhnke Date: Sat, 17 Apr 2004 14:18:00 +0000 Subject: [PATCH] sik0fewl's worldmap patch SVN-Revision: 544 --- data/levels/default/worldmap.stwm | 109 +++++++++++++++++++++++++++++++++----- src/worldmap.cpp | 16 +++++- src/worldmap.h | 1 + 3 files changed, 111 insertions(+), 15 deletions(-) diff --git a/data/levels/default/worldmap.stwm b/data/levels/default/worldmap.stwm index c8c4f3a38..67c431f0d 100644 --- a/data/levels/default/worldmap.stwm +++ b/data/levels/default/worldmap.stwm @@ -8,32 +8,113 @@ 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 11 12 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 11 16 12 11 16 16 16 16 12 9 9 9 9 11 16 16 12 9 9 14 13 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 11 16 16 16 22 19 17 15 24 25 25 26 23 16 12 9 9 14 18 18 13 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 - 9 9 11 22 19 4 19 20 18 13 15 31 32 32 34 26 19 23 16 12 9 9 9 9 9 9 11 16 16 16 16 12 9 9 9 9 9 9 9 9 + 9 9 11 22 19 47 19 20 18 13 15 31 32 32 34 26 19 23 16 12 9 9 9 9 9 9 11 16 16 16 16 12 9 9 9 9 9 9 9 9 9 9 15 19 48 42 20 13 9 9 15 31 35 29 29 28 19 19 19 23 16 12 9 9 9 11 22 19 24 25 26 23 12 11 16 16 12 9 9 9 - 9 9 15 19 47 19 17 11 16 16 22 30 28 19 48 40 4 40 39 20 18 13 9 9 11 22 19 19 30 36 34 26 23 22 19 19 23 12 9 9 - 9 9 15 19 4 19 23 22 19 19 19 19 24 26 47 19 19 19 47 23 16 16 16 16 22 48 4 40 39 31 32 34 25 25 25 25 26 17 9 9 - 9 9 15 19 37 39 19 4 40 40 40 39 30 28 41 40 4 40 44 40 40 4 40 40 40 42 19 19 47 30 29 29 29 29 29 36 27 17 9 9 - 9 9 15 19 19 47 19 47 24 25 26 4 40 40 4 24 25 25 26 20 18 18 18 21 24 25 25 26 4 40 40 4 40 40 39 31 27 23 12 9 + 9 9 15 19 47 19 17 11 16 16 22 30 28 19 48 40 40 40 39 20 18 13 9 9 11 22 19 19 30 36 34 26 23 22 19 19 23 12 9 9 + 9 9 15 19 47 19 23 22 19 19 19 19 24 26 47 19 19 19 47 23 16 16 16 16 22 48 40 40 39 31 32 34 25 25 25 25 26 17 9 9 + 9 9 15 19 37 39 19 48 40 40 40 39 30 28 41 40 40 40 44 40 40 40 40 40 40 42 19 19 47 30 29 29 29 29 29 36 27 17 9 9 + 9 9 15 19 19 47 19 47 24 25 26 37 40 40 42 24 25 25 26 20 18 18 18 21 24 25 25 26 37 40 40 40 40 40 39 31 27 23 12 9 9 9 14 18 21 47 19 47 30 29 28 19 24 25 25 33 35 29 28 17 9 9 9 15 30 29 36 27 19 19 19 19 19 19 47 31 34 26 17 9 - 9 9 9 9 15 4 40 4 19 19 24 25 33 35 29 29 28 20 18 13 9 9 9 14 18 21 31 27 48 4 40 40 40 40 4 30 36 27 17 9 + 9 9 9 9 15 37 40 42 19 19 24 25 33 35 29 29 28 20 18 13 9 9 9 14 18 21 31 27 48 40 40 40 40 40 42 30 36 27 17 9 9 9 9 9 15 19 19 24 25 25 33 32 35 28 20 18 18 13 9 9 9 9 9 9 9 15 31 27 47 24 25 25 25 26 19 19 30 28 17 9 - 9 9 9 9 14 21 19 31 32 32 32 35 28 20 13 9 9 11 16 12 9 9 9 9 9 15 30 28 4 30 36 32 35 28 20 21 19 20 13 9 + 9 9 9 9 14 21 19 31 32 32 32 35 28 20 13 9 9 11 16 12 9 9 9 9 9 15 30 28 47 30 36 32 35 28 20 21 19 20 13 9 9 9 11 12 9 14 21 30 29 29 29 28 20 13 9 11 16 22 20 13 9 9 9 9 9 14 21 19 37 39 31 32 27 20 13 14 21 17 9 9 9 9 14 13 11 12 14 18 18 18 18 18 13 9 9 14 18 18 13 9 9 9 9 9 9 9 14 21 19 47 30 36 27 17 9 9 14 13 9 9 - 9 9 9 9 14 13 9 9 9 9 11 16 16 16 12 9 9 11 16 12 9 9 9 9 9 9 9 14 21 4 19 31 27 17 9 9 9 9 9 9 + 9 9 9 9 14 13 9 9 9 9 11 16 16 16 12 9 9 11 16 12 9 9 9 9 9 9 9 14 21 47 19 31 27 17 9 9 9 9 9 9 9 9 9 9 9 9 9 11 16 16 22 24 25 26 23 16 16 22 19 23 16 16 12 9 9 9 9 9 15 47 19 30 28 17 9 9 9 9 9 9 9 9 9 11 16 16 16 22 19 19 19 30 36 34 25 26 19 24 25 25 25 26 23 16 16 16 16 16 22 47 20 18 18 13 9 9 9 9 9 9 - 9 9 9 15 24 25 26 19 19 19 19 19 30 29 29 28 19 30 29 29 36 34 25 26 19 19 48 4 40 42 17 9 9 9 9 9 9 9 9 9 - 9 9 9 15 31 32 27 4 40 39 19 48 40 40 4 19 48 40 40 4 30 29 29 28 19 19 47 20 18 18 13 9 9 9 9 9 9 9 9 9 + 9 9 9 15 24 25 26 19 19 19 19 19 30 29 29 28 19 30 29 29 36 34 25 26 19 19 48 40 40 42 17 9 9 9 9 9 9 9 9 9 + 9 9 9 15 31 32 27 40 40 39 19 48 40 40 39 19 48 40 40 39 30 29 29 28 19 19 47 20 18 18 13 9 9 9 9 9 9 9 9 9 9 9 9 15 30 36 34 26 19 47 19 47 19 19 47 19 47 19 19 47 19 19 19 48 40 40 42 23 12 9 9 9 9 11 12 9 9 9 9 9 - 9 9 9 14 21 30 29 28 19 37 4 42 19 19 47 19 47 19 19 47 19 19 19 4 19 19 24 26 17 9 9 9 9 14 13 9 9 9 9 9 - 9 9 9 9 14 18 18 18 21 19 19 19 19 19 47 19 47 19 4 42 19 19 48 42 24 25 33 27 17 9 9 9 9 9 9 9 9 9 9 9 - 9 9 9 9 9 9 9 9 14 21 19 24 25 26 4 40 42 19 47 19 19 19 47 19 30 29 36 27 17 9 9 9 9 9 9 9 9 9 9 9 - 9 9 9 11 12 9 9 9 9 14 21 30 36 34 25 26 19 19 37 40 4 40 42 19 20 21 30 28 17 9 9 11 16 16 12 9 9 9 9 9 + 9 9 9 14 21 30 29 28 19 37 40 42 19 19 47 19 47 19 19 47 19 19 19 47 19 19 24 26 17 9 9 9 9 14 13 9 9 9 9 9 + 9 9 9 9 14 18 18 18 21 19 19 19 19 19 47 19 47 19 48 42 19 19 48 42 24 25 33 27 17 9 9 9 9 9 9 9 9 9 9 9 + 9 9 9 9 9 9 9 9 14 21 19 24 25 26 37 40 42 19 47 19 19 19 47 19 30 29 36 27 17 9 9 9 9 9 9 9 9 9 9 9 + 9 9 9 11 12 9 9 9 9 14 21 30 36 34 25 26 19 19 37 40 40 40 42 19 20 21 30 28 17 9 9 11 16 16 12 9 9 9 9 9 9 9 9 14 13 9 9 9 9 9 14 21 31 32 32 34 25 25 25 25 26 19 19 20 13 14 18 18 13 9 9 14 21 19 23 12 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 15 30 29 29 29 29 29 29 29 28 19 20 13 11 12 9 9 9 9 9 9 14 18 18 13 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 14 18 18 18 18 18 18 18 18 18 18 13 9 14 13 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 )) + + (levels + (level (name "default/level1.stl") + (x 5) + (y 4)) + (level (name "default/level2.stl") + (x 4) + (y 7)) + (level (name "default/level3.stl") + (x 5) + (y 11)) + (level (name "Level 4") + (x 7) + (y 11)) + (level (name "Level 5") + (x 7) + (y 8)) + (level (name "Level 6") + (x 11) + (y 9)) + (level (name "Level 7") + (x 14) + (y 9)) + (level (name "Level 8") + (x 16) + (y 8)) + (level (name "Level 9") + (x 16) + (y 6)) + (level (name "Level 10") + (x 21) + (y 8)) + (level (name "Level 11") + (x 26) + (y 7)) + (level (name "Level 12") + (x 28) + (y 9)) + (level (name "Level 13") + (x 31) + (y 9)) + (level (name "Level 14") + (x 34) + (y 11)) + (level (name "Level 15") + (x 29) + (y 11)) + (level (name "Level 16") + (x 28) + (y 13)) + (level (name "Level 17") + (x 29) + (y 16)) + (level (name "Level 18") + (x 27) + (y 19)) + (level (name "Level 19") + (x 23) + (y 22)) + (level (name "Level 20") + (x 20) + (y 25)) + (level (name "Level 21") + (x 18) + (y 23)) + (level (name "Level 22") + (x 19) + (y 20)) + (level (name "Level 23") + (x 14) + (y 24)) + (level (name "Level 24") + (x 14) + (y 20)) + (level (name "Level 25") + (x 10) + (y 22)) + (level (name "Level 26") + (x 7) + (y 20)) + ) ) diff --git a/src/worldmap.cpp b/src/worldmap.cpp index 8c7e3fa33..abf95b23f 100644 --- a/src/worldmap.cpp +++ b/src/worldmap.cpp @@ -181,7 +181,7 @@ Tux::update(float delta) { // We reached the next tile, so we check what to do now offset -= 32; - if (worldmap->at(tile_pos)->stop) + if (worldmap->at(tile_pos)->stop || worldmap->at_level()) { stop(); } @@ -490,6 +490,20 @@ WorldMap::at(Point p) return TileManager::instance()->get(tilemap[width * p.y + p.x]); } +bool +WorldMap::at_level() +{ + for(Levels::iterator i = levels.begin(); i != levels.end(); ++i) + { + if (i->x == tux->get_tile_pos().x && + i->y == tux->get_tile_pos().y) + return true; + } + + return false; +} + + void WorldMap::draw(const Point& offset) { diff --git a/src/worldmap.h b/src/worldmap.h index 75abd837a..2e67f2d6e 100644 --- a/src/worldmap.h +++ b/src/worldmap.h @@ -166,6 +166,7 @@ public: Point get_next_tile(Point pos, Direction direction); Tile* at(Point pos); + bool at_level(); /** Check if it is possible to walk from \a pos into \a direction, if possible, write the new position to \a new_pos */ -- 2.11.0