diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-08-07 03:37:30 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-08-07 03:37:30 +0300 |
commit | 0b4ce8c4594c2e70c2e3157c58491757e13558be (patch) | |
tree | ed3582b146eb1bcb984cbc44407b99a20fee60fd | |
parent | b2fa201dc05db0472fb9eeb0f8ef11ecb231dcb4 (diff) | |
download | plus-0b4ce8c4594c2e70c2e3157c58491757e13558be.tar.gz plus-0b4ce8c4594c2e70c2e3157c58491757e13558be.tar.bz2 plus-0b4ce8c4594c2e70c2e3157c58491757e13558be.tar.xz plus-0b4ce8c4594c2e70c2e3157c58491757e13558be.zip |
Add option "show beings transparency". Disabled by default.
-rw-r--r-- | src/defaults.cpp | 1 | ||||
-rw-r--r-- | src/gui/setup_other.cpp | 2 | ||||
-rw-r--r-- | src/gui/setup_video.cpp | 16 | ||||
-rw-r--r-- | src/gui/setup_video.h | 4 | ||||
-rw-r--r-- | src/map.cpp | 22 | ||||
-rw-r--r-- | src/map.h | 1 |
6 files changed, 34 insertions, 12 deletions
diff --git a/src/defaults.cpp b/src/defaults.cpp index ad908ad78..fcb32bf06 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -208,6 +208,7 @@ DefaultsData* getConfigDefaults() AddDEF(configData, "enableAdvert", true); AddDEF(configData, "enableMapReduce", true); AddDEF(configData, "showPlayersStatus", true); + AddDEF(configData, "beingopacity", false); return configData; } diff --git a/src/gui/setup_other.cpp b/src/gui/setup_other.cpp index ca70133a2..ac047e34b 100644 --- a/src/gui/setup_other.cpp +++ b/src/gui/setup_other.cpp @@ -166,6 +166,8 @@ Setup_Other::Setup_Other() new SetupItemCheckBox(_("Hide shield sprite"), "", "hideShield", this, "hideShieldEvent"); + new SetupItemCheckBox(_("Show background"), "", "showBackground", + this, "showBackgroundEvent"); setDimension(gcn::Rectangle(0, 0, 550, 350)); } diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index d3ee64f3a..72c2e151b 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -284,7 +284,7 @@ Setup_Video::Setup_Video(): mAltFps(config.getIntValue("altfpslimit")), mAlphaCache(config.getBoolValue("alphaCache")), mEnableMapReduce(config.getBoolValue("enableMapReduce")), - mShowBackground(config.getBoolValue("showBackground")), + mBeingOpacity(config.getBoolValue("beingopacity")), mSpeechMode(static_cast<Being::Speech>( config.getIntValue("speech"))), mModeListModel(new ModeListModel), @@ -304,8 +304,8 @@ Setup_Video::Setup_Video(): mAlphaCacheCheckBox(new CheckBox(_("Enable opacity cache"), mAlphaCache)), mEnableMapReduceCheckBox(new CheckBox(_("Enable map reduce"), mEnableMapReduce)), - mShowBackgroundCheckBox(new CheckBox(_("Show background"), - mShowBackground)), + mBeingOpacityCheckBox(new CheckBox(_("Show beings transparency"), + mBeingOpacity)), mSpeechSlider(new Slider(0, 3)), mSpeechLabel(new Label("")), mAlphaSlider(new Slider(0.1, 1.0)), @@ -425,7 +425,7 @@ Setup_Video::Setup_Video(): place(1, 1, mCustomCursorCheckBox, 3); - place(1, 2, mShowBackgroundCheckBox); + place(1, 2, mBeingOpacityCheckBox); place(1, 3, mParticleEffectsCheckBox, 2); place(1, 4, mPickupNotifyLabel, 4); @@ -552,7 +552,7 @@ void Setup_Video::apply() config.setValue("alphaCache", mAlphaCacheCheckBox->isSelected()); config.setValue("enableMapReduce", mEnableMapReduceCheckBox->isSelected()); - config.setValue("showBackground", mShowBackgroundCheckBox->isSelected()); + config.setValue("beingopacity", mBeingOpacityCheckBox->isSelected()); // We sync old and new values at apply time mFullScreenEnabled = config.getBoolValue("screen"); @@ -560,7 +560,7 @@ void Setup_Video::apply() mParticleEffectsEnabled = config.getBoolValue("particleeffects"); mAlphaCache = config.getBoolValue("alphaCache"); mEnableMapReduce = config.getBoolValue("enableMapReduce"); - mShowBackground = config.getBoolValue("showBackground"); + mBeingOpacity = config.getBoolValue("beingopacity"); mSpeechMode = static_cast<Being::Speech>( config.getIntValue("speech")); @@ -587,7 +587,7 @@ void Setup_Video::cancel() mSpeechSlider->setValue(mSpeechMode); mAlphaCacheCheckBox->setSelected(mAlphaCache); mEnableMapReduceCheckBox->setSelected(mEnableMapReduce); - mShowBackgroundCheckBox->setSelected(mShowBackground); + mBeingOpacityCheckBox->setSelected(mBeingOpacity); mAlphaSlider->setValue(mOpacity); mOverlayDetailSlider->setValue(mOverlayDetail); mParticleDetailSlider->setValue(mParticleDetail); @@ -609,7 +609,7 @@ void Setup_Video::cancel() config.setValue("speech", static_cast<int>(mSpeechMode)); config.setValue("alphaCache", mAlphaCache); config.setValue("enableMapReduce", mEnableMapReduce); - config.setValue("showBackground", mShowBackground); + config.setValue("beingopacity", mBeingOpacity); config.setValue("guialpha", mOpacity); Image::setEnableAlpha(mOpacity != 1.0f); config.setValue("opengl", mOpenGLEnabled); diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h index 4448b05c8..f5d3208c8 100644 --- a/src/gui/setup_video.h +++ b/src/gui/setup_video.h @@ -65,7 +65,7 @@ class Setup_Video : public SetupTab, public gcn::KeyListener int mAltFps; bool mAlphaCache; bool mEnableMapReduce; - bool mShowBackground; + bool mBeingOpacity; Being::Speech mSpeechMode; ModeListModel *mModeListModel; @@ -92,7 +92,7 @@ class Setup_Video : public SetupTab, public gcn::KeyListener gcn::CheckBox *mAlphaCacheCheckBox; gcn::CheckBox *mEnableMapReduceCheckBox; - gcn::CheckBox *mShowBackgroundCheckBox; + gcn::CheckBox *mBeingOpacityCheckBox; gcn::Slider *mSpeechSlider; gcn::Label *mSpeechLabel; gcn::Slider *mAlphaSlider; diff --git a/src/map.cpp b/src/map.cpp index f8c4e007e..abf6d73f0 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -622,7 +622,8 @@ Map::Map(int width, int height, int tileWidth, int tileHeight): mDrawY(-1), mDrawScrollX(-1), mDrawScrollY(-1), - mRedrawMap(true) + mRedrawMap(true), + mBeingOpacity(false) { const int size = mWidth * mHeight; @@ -639,6 +640,7 @@ Map::Map(int width, int height, int tileWidth, int tileHeight): config.addListener("OverlayDetail", this); config.addListener("guialpha", this); + config.addListener("beingopacity", this); #ifdef USE_OPENGL mOpenGL = config.getIntValue("opengl"); @@ -651,6 +653,7 @@ Map::~Map() { config.removeListener("OverlayDetail", this); config.removeListener("guialpha", this); + config.removeListener("beingopacity", this); // delete metadata, layers, tilesets and overlays delete[] mMetaTiles; @@ -675,9 +678,24 @@ Map::~Map() void Map::optionChanged(const std::string &value) { if (value == "OverlayDetail") + { mOverlayDetail = config.getIntValue("OverlayDetail"); + } else if (value == "guialpha") + { mOpacity = config.getFloatValue("guialpha"); + if (mOpacity != 1.0f) + mBeingOpacity = config.getBoolValue("beingopacity"); + else + mBeingOpacity = false; + } + else if (value == "beingopacity") + { + if (mOpacity != 1.0f) + mBeingOpacity = config.getBoolValue("beingopacity"); + else + mBeingOpacity = false; + } } void Map::initializeAmbientLayers() @@ -895,7 +913,7 @@ void Map::draw(Graphics *graphics, int scrollX, int scrollY) } // Dont draw if gui opacity == 1 - if (mOpacity != 1.0f) + if (mBeingOpacity && mOpacity != 1.0f) { // Draws beings with a lower opacity to make them visible // even when covered by a wall or some other elements... @@ -615,6 +615,7 @@ class Map : public Properties, public ConfigListener int mDrawScrollX; int mDrawScrollY; bool mRedrawMap; + bool mBeingOpacity; }; |