diff options
-rw-r--r-- | src/being.cpp | 30 | ||||
-rw-r--r-- | src/gui/setup_video.cpp | 2 |
2 files changed, 21 insertions, 11 deletions
diff --git a/src/being.cpp b/src/being.cpp index 4958700f..f05652f3 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -164,16 +164,6 @@ void Being::setSpeech(const std::string &text, Uint32 time) { mSpeech = text; - if (!config.getValue("speechbubble", 1)) - { - // don't introduce a memory leak - delete mText; - - mText = new Text(text, mPx + X_SPEECH_OFFSET, mPy - Y_SPEECH_OFFSET, - gcn::Graphics::CENTER, speechFont, - gcn::Color(255, 255, 255)); - } - mSpeechTime = 500; } @@ -468,6 +458,12 @@ void Being::drawSpeech(Graphics *graphics, int offsetX, int offsetY) // Draw speech above this being if (mSpeechTime > 0 && config.getValue("speechbubble", 1)) { + if (mText) + { + delete mText; + mText = 0; + } + mSpeechBubble->setCaption(mName); mSpeechBubble->setWindowName(mName); // Not quite centered, but close enough. However, it's not too important to get @@ -477,6 +473,20 @@ void Being::drawSpeech(Graphics *graphics, int offsetX, int offsetY) (mSpeechBubble->getNumRows()*14)); mSpeechBubble->setVisible(true); } + else if (!config.getValue("speechbubble", 1)) + { + mSpeechBubble->setVisible(false); + // don't introduce a memory leak + if (mText) + { + delete mText; + mText = 0; + } + + mText = new Text(mSpeech, mPx + X_SPEECH_OFFSET, mPy - Y_SPEECH_OFFSET, + gcn::Graphics::CENTER, speechFont, + gcn::Color(255, 255, 255)); + } else if (mSpeechTime == 0) { mSpeechBubble->setVisible(false); diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 6a246501..879a3066 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -151,7 +151,7 @@ Setup_Video::Setup_Video(): mParticleEffectsCheckBox->setPosition(175, 30); mCustomCursorCheckBox->setPosition(110, 50); mSpeechBubbleCheckBox->setPosition(110, 70); - mAlphaSlider->setDimension(gcn::Rectangle(10, 100, 100, 10)); + mAlphaSlider->setDimension(gcn::Rectangle(10, 100, 75, 10)); alphaLabel->setPosition(20 + mAlphaSlider->getWidth(), mAlphaSlider->getY()); mFpsCheckBox->setPosition(90, 120); |