From a31fce06e41ac33ca6ed12065644b314ceb4bcb3 Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Fri, 25 Dec 2009 16:06:38 +0100 Subject: Added support for map background images which work exactly like overlays, just that they are drawn before the tiles instead of afterwards. Renamed overlays to foregrounds (but kept backward compatibility intact) --- src/map.h | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'src/map.h') diff --git a/src/map.h b/src/map.h index b4a8c7af..f69d3d33 100644 --- a/src/map.h +++ b/src/map.h @@ -29,7 +29,7 @@ #include "properties.h" class Animation; -class AmbientOverlay; +class AmbientLayer; class Graphics; class Image; class MapLayer; @@ -172,10 +172,10 @@ class Map : public Properties ~Map(); /** - * Initialize map overlays. Should be called after all the properties + * Initialize ambient layers. Has to be called after all the properties * are set. */ - void initializeOverlays(); + void initializeAmbientLayers(); /** * Updates animations. Called as needed. @@ -295,10 +295,22 @@ class Map : public Properties TileAnimation *getAnimationForGid(int gid) const; private: + + enum LayerType + { + FOREGROUND_LAYERS, + BACKGROUND_LAYERS + }; + /** - * Draws the overlay graphic to the given graphics output. + * Updates scrolling of ambient layers. Has to be called each game tick. */ - void drawOverlay(Graphics *graphics, float scrollX, float scrollY, + void updateAmbientLayers(float scrollX, float scrollY); + + /** + * Draws the foreground or background layers to the given graphics output. + */ + void drawAmbientLayers(Graphics *graphics, LayerType type, float scrollX, float scrollY, int detail); /** @@ -323,7 +335,8 @@ class Map : public Properties int mOnClosedList, mOnOpenList; // Overlay data - std::list mOverlays; + std::list mBackgrounds; + std::list mForegrounds; float mLastScrollX; float mLastScrollY; @@ -337,6 +350,7 @@ class Map : public Properties std::list particleEffects; std::map mTileAnimations; + }; #endif -- cgit v1.2.3-60-g2f50