From 833abc3732c87ed4822fa31065f84d857e9018cc Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Thu, 24 Aug 2006 23:35:20 +0000 Subject: added a config option to set the grade of detail of the overlay system. --- ChangeLog | 6 ++++++ src/engine.cpp | 6 +++++- src/map.cpp | 14 +++++++++++--- src/map.h | 2 +- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 15f33696..0cef2212 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-08-25 Philipp Sehmisch + + * src/engine.cpp, src/map.h, src/map.cpp: Addded new config variable + "OverlayDetail" to control the number of drawn overlays. + 2 (or more) = all (default), 1 = only the first one, 0 = none. + 2006-08-24 Eugenio Favalli * data/help/commands.txt, README, src/game.cpp, src/gui/chat.cpp, diff --git a/src/engine.cpp b/src/engine.cpp index a80351d4..557b5d7e 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -239,7 +239,11 @@ void Engine::draw(Graphics *graphics) mCurrentMap->draw(graphics, (int)view_x, (int)view_y, 0); mCurrentMap->draw(graphics, (int)view_x, (int)view_y, 1); mCurrentMap->draw(graphics, (int)view_x, (int)view_y, 2); - mCurrentMap->drawOverlay(graphics, view_x, view_y); + mCurrentMap->drawOverlay( graphics, + view_x, + view_y, + (int)config.getValue("OverlayDetail", 2) + ); } // Find a path from the player to the mouse, and draw it. This is for debug diff --git a/src/map.cpp b/src/map.cpp index 463a8c8e..027a5440 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -167,12 +167,15 @@ Map::draw(Graphics *graphics, int scrollX, int scrollY, int layer) } void -Map::drawOverlay(Graphics *graphics, float scrollX, float scrollY) +Map::drawOverlay(Graphics *graphics, float scrollX, float scrollY, int detail) { - std::list::iterator i; - static int lastTick = tick_time; + // detail 0: no overlays + if (detail <= 0) return; + + std::list::iterator i; + // Avoid freaking out when tick_time overflows if (tick_time < lastTick) { @@ -223,6 +226,9 @@ Map::drawOverlay(Graphics *graphics, float scrollX, float scrollY) mLastScrollX = scrollX; mLastScrollY = scrollY; lastTick++; + + // detail 1: only one overlay, higher: all overlays + if (detail == 1) break; } //draw overlays @@ -237,6 +243,8 @@ Map::drawOverlay(Graphics *graphics, float scrollX, float scrollY) graphics->getHeight() + (int)(*i).scrollY ); }; + // detail 1: only one overlay, higher: all overlays + if (detail == 1) break; }; } diff --git a/src/map.h b/src/map.h index 46bf4c23..317a0b59 100644 --- a/src/map.h +++ b/src/map.h @@ -104,7 +104,7 @@ class Map : public Properties /** * Draws the overlay graphic to the given graphics output. */ - void drawOverlay(Graphics *graphics, float scrollX, float scrollY); + void drawOverlay(Graphics *graphics, float scrollX, float scrollY, int detail); /** * Sets the size of the map. This will destroy any existing map data. -- cgit v1.2.3-70-g09d2