From 9824ccf5946c86df1cf497b797c5f3da5d481d28 Mon Sep 17 00:00:00 2001 From: "madcamel@gmail.com" Date: Sat, 16 Oct 2010 14:35:24 +0200 Subject: Added Low CPU Mode toggle in video setup. Defaults to On. This disables the Image::setAlpha() function, which uses 60% of the client's CPU cycles. When enabled, visual quality is slightly decreased, especially with the particle system. Toggling this setting On from an Off state requires a client restart or the graphics look quite funny. Bertram's addition: - Renamed 'Low CPU' to 'Disable transparency (Low CPU)' in the gui for better understanding. - Removed the sprite display with 30% opacity when disabling transparency since it made monsters and drops be drawn above all layers at full opacity. - Made the OpenGL mode disable the 'low CPU mode'. - Fixed the GUI logic as much as possible. Please note that the GUI opacity slider stays enabled when transparency is disabled even if told to be disabled in that case. Reviewed-by: CodyMartin, 4144, MadCamel. --- src/map.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src/map.cpp') diff --git a/src/map.cpp b/src/map.cpp index f1f8d091..2de0a4a8 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -330,21 +330,25 @@ void Map::draw(Graphics *graphics, int scrollX, int scrollY) mSprites, mDebugFlags); } - // Draws beings with a lower opacity to make them visible - // even when covered by a wall or some other elements... - MapSprites::const_iterator si = mSprites.begin(); - while (si != mSprites.end()) + // If the transparency hasn't been disabled, + if (config.getValue("opengl", false) || !config.getValue("lowcpu", true)) { - if (Sprite *sprite = *si) + // We draw beings with a lower opacity to make them visible + // even when covered by a wall or some other elements... + MapSprites::const_iterator si = mSprites.begin(); + while (si != mSprites.end()) { - // For now, just draw sprites with only one layer. - if (sprite->getNumberOfLayers() == 1) + if (Sprite *sprite = *si) { - sprite->setAlpha(0.3f); - sprite->draw(graphics, -scrollX, -scrollY); + // For now, just draw sprites with only one layer. + if (sprite->getNumberOfLayers() == 1) + { + sprite->setAlpha(0.3f); + sprite->draw(graphics, -scrollX, -scrollY); + } } + si++; } - si++; } drawAmbientLayers(graphics, FOREGROUND_LAYERS, scrollX, scrollY, -- cgit v1.2.3-70-g09d2