summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-02-10 17:24:57 -0700
committerIra Rice <irarice@gmail.com>2009-02-10 17:24:57 -0700
commitd067d7da8e6ee333a4941d4fe6ee9eb926d37f00 (patch)
tree03374aa436a0f2e1f3ba7cca250f260a5b4d60d3 /src/being.cpp
parent00d8f57800042a324795b30dd35b21d67d47a2aa (diff)
downloadmana-d067d7da8e6ee333a4941d4fe6ee9eb926d37f00.tar.gz
mana-d067d7da8e6ee333a4941d4fe6ee9eb926d37f00.tar.bz2
mana-d067d7da8e6ee333a4941d4fe6ee9eb926d37f00.tar.xz
mana-d067d7da8e6ee333a4941d4fe6ee9eb926d37f00.zip
Added two more options for displaying speech overhead (don't show it at
all and show speech bubbles without names). Since a checkbox won't work any more for all of these modes, it's now a slider. Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 5676ec3f..869cc970 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -462,9 +462,6 @@ void Being::draw(Graphics *graphics, int offsetX, int offsetY) const
if (mUsedTargetCursor != NULL)
{
- const int width = mSprites[BASE_SPRITE]->getWidth();
- const int height = mSprites[BASE_SPRITE]->getHeight();
-
mUsedTargetCursor->draw(graphics, px, py);
}
@@ -492,29 +489,33 @@ void Being::drawEmotion(Graphics *graphics, int offsetX, int offsetY)
void Being::drawSpeech(int offsetX, int offsetY)
{
- int px = mPx + offsetX;
- int py = mPy + offsetY;
+ const int px = mPx + offsetX;
+ const int py = mPy + offsetY;
+ const int speech = config.getValue("speech", NAME_IN_BUBBLE);
// Draw speech above this being
- if (mSpeechTime > 0 && config.getValue("speechbubble", 1))
+ if (mSpeechTime > 0 && (speech == NAME_IN_BUBBLE ||
+ speech == NO_NAME_IN_BUBBLE))
{
+ const bool showName = (speech == NAME_IN_BUBBLE);
+
if (mText)
{
delete mText;
mText = 0;
}
- mSpeechBubble->setCaption(mName, mNameColor);
+ mSpeechBubble->setCaption(showName ? mName : "", mNameColor);
// Not quite centered, but close enough. However, it's not too important
// to get it right right now, as it doesn't take bubble collision into
// account yet.
- mSpeechBubble->setText(mSpeech);
+ mSpeechBubble->setText(mSpeech, showName);
mSpeechBubble->setPosition(px - (mSpeechBubble->getWidth() * 4 / 11),
- py - 70 - (mSpeechBubble->getNumRows() * 14));
+ py - 40 - (mSpeechBubble->getHeight()));
mSpeechBubble->setVisible(true);
}
- else if (mSpeechTime > 0 && !config.getValue("speechbubble", 1))
+ else if (mSpeechTime > 0 && speech == TEXT_OVERHEAD)
{
mSpeechBubble->setVisible(false);
// don't introduce a memory leak
@@ -524,6 +525,13 @@ void Being::drawSpeech(int offsetX, int offsetY)
mText = new Text(mSpeech, mPx + X_SPEECH_OFFSET, mPy - Y_SPEECH_OFFSET,
gcn::Graphics::CENTER, gcn::Color(255, 255, 255));
}
+ else if (speech == NO_SPEECH)
+ {
+ mSpeechBubble->setVisible(false);
+ if (mText)
+ delete mText;
+ mText = NULL;
+ }
else if (mSpeechTime == 0)
{
mSpeechBubble->setVisible(false);