summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorPhilipp Sehmisch <tmw@crushnet.org>2006-08-21 16:06:50 +0000
committerPhilipp Sehmisch <tmw@crushnet.org>2006-08-21 16:06:50 +0000
commit7eef0aaedefc5d3c73301bcb02834e165124c7e6 (patch)
tree3ac39dbb0bc92db2cdf9d90db700662627f6d8df /src/resources
parente8c3de13e9f850498b9ab2dfaca758c851566d3a (diff)
downloadmana-7eef0aaedefc5d3c73301bcb02834e165124c7e6.tar.gz
mana-7eef0aaedefc5d3c73301bcb02834e165124c7e6.tar.bz2
mana-7eef0aaedefc5d3c73301bcb02834e165124c7e6.tar.xz
mana-7eef0aaedefc5d3c73301bcb02834e165124c7e6.zip
added overlays and smooth scrolling. (someone who knows what he is doing has to create the makefiles for the unix users)
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/mapreader.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 382b0797..c1ae911c 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -34,6 +34,7 @@
#include "../map.h"
#include "../tileset.h"
+#include "../utils/tostring.h"
const unsigned int DEFAULT_TILE_WIDTH = 32;
const unsigned int DEFAULT_TILE_HEIGHT = 32;
@@ -213,6 +214,32 @@ MapReader::readMap(xmlNodePtr node, const std::string &path)
}
}
+ //set Overlays
+ int i = 0;
+ ResourceManager *resman = ResourceManager::getInstance();
+
+ while (map->hasProperty("overlay" + toString(i) + "image"))
+ {
+ Image *overlayImage = resman->getImage(map->getProperty("overlay" + toString(i) + "image"));
+ float scrollX = 0.0f;
+ float scrollY = 0.0f;
+ float parallax = 0.0f;
+ if (map->hasProperty("overlay" + toString(i) + "scrollX"))
+ {
+ scrollX = atof(map->getProperty("overlay" + toString(i) + "scrollX").c_str());
+ }
+ if (map->hasProperty("overlay" + toString(i) + "scrollY"))
+ {
+ scrollY = atof(map->getProperty("overlay" + toString(i) + "scrollY").c_str());
+ }
+ if (map->hasProperty("overlay" + toString(i) + "parallax"))
+ {
+ parallax = atof(map->getProperty("overlay" + toString(i) + "parallax").c_str());
+ }
+ map->setOverlay (overlayImage, scrollX, scrollY, parallax);
+ i++;
+ }
+
return map;
}