summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-02-08 19:59:28 -0700
committerIra Rice <irarice@gmail.com>2009-02-08 19:59:28 -0700
commit40edf4e91558cffd83d9015a2cf4a16360e27855 (patch)
tree7e0f53ab1c82f694412a94856fc2a9ba05d87370
parent450edb5900a46ada0cc6292f0079a31ea5d04573 (diff)
downloadmana-client-40edf4e91558cffd83d9015a2cf4a16360e27855.tar.gz
mana-client-40edf4e91558cffd83d9015a2cf4a16360e27855.tar.bz2
mana-client-40edf4e91558cffd83d9015a2cf4a16360e27855.tar.xz
mana-client-40edf4e91558cffd83d9015a2cf4a16360e27855.zip
Mostly fixed a few field values to behave better in Windows, as well as
removed the need for sending graphics to the setSpeech function (since it isn't needed) and started actually using the time variable which it's passed (could be set to show the speech longer if the dialog is longer, for example). Signed-off-by: Ira Rice <irarice@gmail.com>
-rw-r--r--src/being.cpp4
-rw-r--r--src/being.h7
-rw-r--r--src/game.h3
-rw-r--r--src/gui/setup_audio.cpp4
-rw-r--r--src/gui/setup_joystick.cpp2
-rw-r--r--src/gui/setup_keyboard.cpp7
-rw-r--r--src/gui/setup_video.cpp52
-rw-r--r--src/gui/viewport.cpp2
-rw-r--r--src/party.cpp2
-rw-r--r--src/player_relations.cpp2
10 files changed, 42 insertions, 43 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 2b4ba767..9b8ede27 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -215,7 +215,7 @@ void Being::setSpeech(const std::string &text, Uint32 time)
}
if (mSpeech != "")
- mSpeechTime = 500;
+ mSpeechTime = time <= SPEECH_MAX_TIME ? time : SPEECH_MAX_TIME;
}
void Being::takeDamage(int amount)
@@ -501,7 +501,7 @@ void Being::drawEmotion(Graphics *graphics, int offsetX, int offsetY)
emotionSet[emotionIndex]->draw(graphics, px, py);
}
-void Being::drawSpeech(Graphics *graphics, int offsetX, int offsetY)
+void Being::drawSpeech(int offsetX, int offsetY)
{
int px = mPx + offsetX;
int py = mPy + offsetY;
diff --git a/src/being.h b/src/being.h
index 109a44ad..d722092e 100644
--- a/src/being.h
+++ b/src/being.h
@@ -39,6 +39,9 @@
#define FIRST_IGNORE_EMOTE 14
#define STATUS_EFFECTS 32
+#define SPEECH_TIME 500
+#define SPEECH_MAX_TIME 1000
+
class AnimatedSprite;
class Image;
class ItemInfo;
@@ -152,7 +155,7 @@ class Being : public Sprite
* @param text The text that should appear.
* @param time The amount of time the text should stay in milliseconds.
*/
- void setSpeech(const std::string &text, Uint32 time);
+ void setSpeech(const std::string &text, Uint32 time = 500);
/**
* Puts a damage bubble above this being.
@@ -244,7 +247,7 @@ class Being : public Sprite
/**
* Draws the speech text above the being.
*/
- void drawSpeech(Graphics *graphics, int offsetX, int offsetY);
+ void drawSpeech(int offsetX, int offsetY);
/**
* Draws the emotion picture above the being.
diff --git a/src/game.h b/src/game.h
index c9fc8d79..e885ea16 100644
--- a/src/game.h
+++ b/src/game.h
@@ -26,9 +26,6 @@
#include "configlistener.h"
-#define SPEECH_TIME 80
-#define SPEECH_MAX_TIME 100
-
class MessageHandler;
class Network;
diff --git a/src/gui/setup_audio.cpp b/src/gui/setup_audio.cpp
index 7090136e..5c189882 100644
--- a/src/gui/setup_audio.cpp
+++ b/src/gui/setup_audio.cpp
@@ -109,8 +109,8 @@ void Setup_Audio::cancel()
sound.setMusicVolume(mMusicVolume);
mMusicSlider->setValue(mMusicVolume);
- config.setValue("sound", mSoundEnabled ? 1 : 0);
- config.setValue("sfxVolume", mSfxVolume ? 1 : 0);
+ config.setValue("sound", mSoundEnabled ? true : false);
+ config.setValue("sfxVolume", mSfxVolume);
config.setValue("musicVolume", mMusicVolume);
}
diff --git a/src/gui/setup_joystick.cpp b/src/gui/setup_joystick.cpp
index 2c726b87..2ebcdbde 100644
--- a/src/gui/setup_joystick.cpp
+++ b/src/gui/setup_joystick.cpp
@@ -41,7 +41,7 @@ Setup_Joystick::Setup_Joystick():
{
setOpaque(false);
- mOriginalJoystickEnabled = (int)config.getValue("joystickEnabled", 0) != 0;
+ mOriginalJoystickEnabled = !config.getValue("joystickEnabled", false);
mJoystickEnabled->setSelected(mOriginalJoystickEnabled);
mJoystickEnabled->addActionListener(this);
diff --git a/src/gui/setup_keyboard.cpp b/src/gui/setup_keyboard.cpp
index 6a4363fe..06a5a520 100644
--- a/src/gui/setup_keyboard.cpp
+++ b/src/gui/setup_keyboard.cpp
@@ -32,7 +32,6 @@
#include "widgets/layouthelper.h"
-#include "../configuration.h"
#include "../keyboardconfig.h"
#include "../utils/gettext.h"
@@ -138,9 +137,8 @@ void Setup_Keyboard::action(const gcn::ActionEvent &event)
{
if (event.getSource() == mKeyList)
{
- if (!mKeySetting) {
+ if (!mKeySetting)
mAssignKeyButton->setEnabled(true);
- }
}
else if (event.getId() == "assign")
{
@@ -184,7 +182,8 @@ void Setup_Keyboard::refreshKeys()
void Setup_Keyboard::keyUnresolved()
{
- if (mKeySetting) {
+ if (mKeySetting)
+ {
newKeyCallback(keyboard.getNewKeyIndex());
keyboard.setNewKeyIndex(keyboard.KEY_NO_VALUE);
}
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index faf72c68..1775665f 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -104,12 +104,12 @@ ModeListModel::ModeListModel()
}
Setup_Video::Setup_Video():
- mFullScreenEnabled(config.getValue("screen", 0)),
- mOpenGLEnabled(config.getValue("opengl", 0)),
- mCustomCursorEnabled(config.getValue("customcursor", 1)),
- mParticleEffectsEnabled(config.getValue("particleeffects", 1)),
- mSpeechBubbleEnabled(config.getValue("speechbubble", 1)),
- mNameEnabled(config.getValue("showownname", 0)),
+ mFullScreenEnabled(config.getValue("screen", false)),
+ mOpenGLEnabled(config.getValue("opengl", false)),
+ mCustomCursorEnabled(config.getValue("customcursor", true)),
+ mParticleEffectsEnabled(config.getValue("particleeffects", true)),
+ mSpeechBubbleEnabled(config.getValue("speechbubble", true)),
+ mNameEnabled(config.getValue("showownname", false)),
mOpacity(config.getValue("guialpha", 0.8)),
mFps((int) config.getValue("fpslimit", 0)),
mModeListModel(new ModeListModel),
@@ -280,7 +280,7 @@ void Setup_Video::apply()
{
// Full screen changes
bool fullscreen = mFsCheckBox->isSelected();
- if (fullscreen != (config.getValue("screen", 0) == 1))
+ if (fullscreen != (config.getValue("screen", false) == 1))
{
/* The OpenGL test is only necessary on Windows, since switching
* to/from full screen works fine on Linux. On Windows we'd have to
@@ -291,7 +291,7 @@ void Setup_Video::apply()
#ifdef WIN32
// checks for opengl usage
- if (!(config.getValue("opengl", 0) == 1))
+ if (!(config.getValue("opengl", false) == 1))
{
#endif
if (!graphics->setFullscreen(fullscreen))
@@ -313,13 +313,13 @@ void Setup_Video::apply()
_("Restart needed for changes to take effect."));
}
#endif
- config.setValue("screen", fullscreen ? 1 : 0);
+ config.setValue("screen", fullscreen ? true : false);
}
// OpenGL change
if (mOpenGLCheckBox->isSelected() != mOpenGLEnabled)
{
- config.setValue("opengl", mOpenGLCheckBox->isSelected() ? 1 : 0);
+ config.setValue("opengl", mOpenGLCheckBox->isSelected() ? true : false);
// OpenGL can currently only be changed by restarting, notify user.
new OkDialog(_("Changing OpenGL"),
@@ -330,14 +330,14 @@ void Setup_Video::apply()
config.setValue("fpslimit", mFps);
// We sync old and new values at apply time
- mFullScreenEnabled = config.getValue("screen", 0);
- mCustomCursorEnabled = config.getValue("customcursor", 1);
- mParticleEffectsEnabled = config.getValue("particleeffects", 1);
- mSpeechBubbleEnabled = config.getValue("speechbubble", 1);
- mNameEnabled = config.getValue("showownname", 0);
+ mFullScreenEnabled = config.getValue("screen", false);
+ mCustomCursorEnabled = config.getValue("customcursor", true);
+ mParticleEffectsEnabled = config.getValue("particleeffects", true);
+ mSpeechBubbleEnabled = config.getValue("speechbubble", true);
+ mNameEnabled = config.getValue("showownname", false);
mOpacity = config.getValue("guialpha", 0.8);
mOverlayDetail = (int) config.getValue("OverlayDetail", 2);
- mOpenGLEnabled = config.getValue("opengl", 0);
+ mOpenGLEnabled = config.getValue("opengl", false);
}
int Setup_Video::updateSlider(gcn::Slider *slider, gcn::TextField *field,
@@ -377,13 +377,13 @@ void Setup_Video::cancel()
updateSlider(mScrollRadiusSlider, mScrollRadiusField, "ScrollRadius");
updateSlider(mScrollLazinessSlider, mScrollLazinessField, "ScrollLaziness");
- config.setValue("screen", mFullScreenEnabled ? 1 : 0);
- config.setValue("customcursor", mCustomCursorEnabled ? 1 : 0);
- config.setValue("particleeffects", mParticleEffectsEnabled ? 1 : 0);
- config.setValue("speechbubble", mSpeechBubbleEnabled ? 1 : 0);
- config.setValue("showownname", mNameEnabled ? 1 : 0);
+ config.setValue("screen", mFullScreenEnabled ? true : false);
+ config.setValue("customcursor", mCustomCursorEnabled ? true : false);
+ config.setValue("particleeffects", mParticleEffectsEnabled ? true : false);
+ config.setValue("speechbubble", mSpeechBubbleEnabled ? true : false);
+ config.setValue("showownname", mNameEnabled ? true : false);
config.setValue("guialpha", mOpacity);
- config.setValue("opengl", mOpenGLEnabled ? 1 : 0);
+ config.setValue("opengl", mOpenGLEnabled ? true : false);
}
void Setup_Video::action(const gcn::ActionEvent &event)
@@ -408,19 +408,19 @@ void Setup_Video::action(const gcn::ActionEvent &event)
else if (event.getId() == "customcursor")
{
config.setValue("customcursor",
- mCustomCursorCheckBox->isSelected() ? 1 : 0);
+ mCustomCursorCheckBox->isSelected() ? true : false);
}
else if (event.getId() == "particleeffects")
{
config.setValue("particleeffects",
- mParticleEffectsCheckBox->isSelected() ? 1 : 0);
+ mParticleEffectsCheckBox->isSelected() ? true : false);
new OkDialog(_("Particle effect settings changed"),
_("Restart your client or change maps for the change to take effect."));
}
else if (event.getId() == "speechbubble")
{
config.setValue("speechbubble",
- mSpeechBubbleCheckBox->isSelected() ? 1 : 0);
+ mSpeechBubbleCheckBox->isSelected() ? true : false);
}
else if (event.getId() == "showownname")
{
@@ -429,7 +429,7 @@ void Setup_Video::action(const gcn::ActionEvent &event)
if (player_node)
player_node->mUpdateName = true;
config.setValue("showownname",
- mNameCheckBox->isSelected() ? 1 : 0);
+ mNameCheckBox->isSelected() ? true : false);
}
else if (event.getId() == "fpslimitslider")
{
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 25e69c43..19e9a4fb 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -207,7 +207,7 @@ void Viewport::draw(gcn::Graphics *gcnGraphics)
Beings &beings = beingManager->getAll();
for (BeingIterator i = beings.begin(); i != beings.end(); i++)
{
- (*i)->drawSpeech(graphics, -(int) mPixelViewX, -(int) mPixelViewY);
+ (*i)->drawSpeech(-(int) mPixelViewX, -(int) mPixelViewY);
(*i)->drawEmotion(graphics, -(int) mPixelViewX, -(int) mPixelViewY);
}
diff --git a/src/party.cpp b/src/party.cpp
index e9304ada..70e0d3c2 100644
--- a/src/party.cpp
+++ b/src/party.cpp
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "game.h"
+#include "being.h"
#include "localplayer.h"
#include "party.h"
diff --git a/src/player_relations.cpp b/src/player_relations.cpp
index 6386c246..aa83115c 100644
--- a/src/player_relations.cpp
+++ b/src/player_relations.cpp
@@ -305,7 +305,7 @@ public:
virtual void ignore(Player *player, unsigned int flags)
{
- player->setSpeech("...", 5);
+ player->setSpeech("...", 500);
}
};