diff options
author | Ira Rice <irarice@gmail.com> | 2009-01-09 21:24:13 -0700 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-01-09 21:24:13 -0700 |
commit | 0dabbade690301ef89da2fb2562da8e48afc22d3 (patch) | |
tree | af73cc3f45c48dc0cf97b8c0fc3048f11eaaec03 /src/gui | |
parent | 43630ab7969fa26cb0a3e2773e7266f2f9647867 (diff) | |
download | mana-0dabbade690301ef89da2fb2562da8e48afc22d3.tar.gz mana-0dabbade690301ef89da2fb2562da8e48afc22d3.tar.bz2 mana-0dabbade690301ef89da2fb2562da8e48afc22d3.tar.xz mana-0dabbade690301ef89da2fb2562da8e48afc22d3.zip |
Added the ability to see your own name in game.
Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/chat.cpp | 12 | ||||
-rw-r--r-- | src/gui/setup_video.cpp | 22 | ||||
-rw-r--r-- | src/gui/setup_video.h | 2 | ||||
-rw-r--r-- | src/gui/viewport.cpp | 11 |
4 files changed, 44 insertions, 3 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 35976963..d4818504 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -95,8 +95,7 @@ ChatWindow::~ChatWindow() delete mRecorder; } -void - ChatWindow::logic() +void ChatWindow::logic() { // todo: only do this when the size changes (updateWidgets?) @@ -296,6 +295,15 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg) } // Prepare ordinary message if (msg.substr(0, 1) != "/") { + // The server never tells you about your own GM status, so work around + // this for now by intercepting it here. NOTE: This assumes that the + // assert works, when it's not guaranteed to. + + std::size_t space = msg.find(" "); + const std::string command = msg.substr(1, space); + if (msg.at(0) == '@' && command == "assert") + player_node->setGM(); + msg = nick + " : " + msg; MessageOut outMsg(mNetwork); diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 724ce8b4..a23f5923 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -38,6 +38,7 @@ #include "../configuration.h" #include "../graphics.h" +#include "../localplayer.h" #include "../log.h" #include "../main.h" #include "../particle.h" @@ -106,6 +107,7 @@ Setup_Video::Setup_Video(): mCustomCursorEnabled(config.getValue("customcursor", 1)), mParticleEffectsEnabled(config.getValue("particleeffects", 1)), mSpeechBubbleEnabled(config.getValue("speechbubble", 1)), + mNameEnabled(config.getValue("showownname", 0)), mOpacity(config.getValue("guialpha", 0.8)), mFps((int) config.getValue("fpslimit", 0)), mModeListModel(new ModeListModel), @@ -115,6 +117,7 @@ Setup_Video::Setup_Video(): mCustomCursorCheckBox(new CheckBox(_("Custom cursor"), mCustomCursorEnabled)), mParticleEffectsCheckBox(new CheckBox(_("Particle effects"), mParticleEffectsEnabled)), mSpeechBubbleCheckBox(new CheckBox(_("Speech bubbles"), mSpeechBubbleEnabled)), + mNameCheckBox(new CheckBox(_("Show name"), mNameEnabled)), mAlphaSlider(new Slider(0.2, 1.0)), mFpsCheckBox(new CheckBox(_("FPS Limit:"))), mFpsSlider(new Slider(10, 200)), @@ -145,8 +148,9 @@ Setup_Video::Setup_Video(): mModeList->setDimension(gcn::Rectangle(0, 0, 60, 70)); scrollArea->setDimension(gcn::Rectangle(10, 10, 90, 70)); mFsCheckBox->setPosition(110, 10); + mNameCheckBox->setPosition(195, 10); mOpenGLCheckBox->setPosition(110, 30); - mParticleEffectsCheckBox->setPosition(175, 30); + mParticleEffectsCheckBox->setPosition(180, 30); mCustomCursorCheckBox->setPosition(110, 50); mSpeechBubbleCheckBox->setPosition(110, 70); mAlphaSlider->setDimension(gcn::Rectangle(10, 100, 75, 10)); @@ -170,6 +174,7 @@ Setup_Video::Setup_Video(): mCustomCursorCheckBox->setActionEventId("customcursor"); mParticleEffectsCheckBox->setActionEventId("particleeffects"); mSpeechBubbleCheckBox->setActionEventId("speechbubble"); + mNameCheckBox->setActionEventId("showownname"); mAlphaSlider->setActionEventId("guialpha"); mFpsCheckBox->setActionEventId("fpslimitcheckbox"); mFpsSlider->setActionEventId("fpslimitslider"); @@ -186,6 +191,7 @@ Setup_Video::Setup_Video(): mCustomCursorCheckBox->addActionListener(this); mParticleEffectsCheckBox->addActionListener(this); mSpeechBubbleCheckBox->addActionListener(this); + mNameCheckBox->addActionListener(this); mAlphaSlider->addActionListener(this); mFpsCheckBox->addActionListener(this); mFpsSlider->addActionListener(this); @@ -262,6 +268,7 @@ Setup_Video::Setup_Video(): add(mCustomCursorCheckBox); add(mParticleEffectsCheckBox); add(mSpeechBubbleCheckBox); + add(mNameCheckBox); add(mAlphaSlider); add(alphaLabel); add(mFpsCheckBox); @@ -344,6 +351,7 @@ void Setup_Video::apply() mCustomCursorEnabled = config.getValue("customcursor", 1); mParticleEffectsEnabled = config.getValue("particleeffects", 1); mSpeechBubbleEnabled = config.getValue("speechbubble", 1); + mNameEnabled = config.getValue("showownname", 0); mOpacity = config.getValue("guialpha", 0.8); mOverlayDetail = (int)config.getValue("OverlayDetail", 2); mOpenGLEnabled = config.getValue("opengl", 0); @@ -375,6 +383,9 @@ void Setup_Video::cancel() mFsCheckBox->setSelected(mFullScreenEnabled); mOpenGLCheckBox->setSelected(mOpenGLEnabled); mCustomCursorCheckBox->setSelected(mCustomCursorEnabled); + mParticleEffectsCheckBox->setSelected(mParticleEffectsEnabled); + mSpeechBubbleCheckBox->setSelected(mSpeechBubbleEnabled); + mNameCheckBox->setSelected(mNameEnabled); mAlphaSlider->setValue(mOpacity); mOverlayDetailSlider->setValue(mOverlayDetail); mParticleDetailSlider->setValue(mParticleDetail); @@ -388,6 +399,7 @@ void Setup_Video::cancel() 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("guialpha", mOpacity); config.setValue("opengl", mOpenGLEnabled ? 1 : 0); } @@ -445,6 +457,14 @@ void Setup_Video::action(const gcn::ActionEvent &event) config.setValue("speechbubble", mSpeechBubbleCheckBox->isSelected() ? 1 : 0); } + else if (event.getId() == "showownname") + { + // Notify the local player that settings have changed for the name + // and requires an update + player_node->mUpdateName = true; + config.setValue("showownname", + mNameCheckBox->isSelected() ? 1 : 0); + } else if (event.getId() == "fpslimitslider") { mFps = (int) mFpsSlider->getValue(); diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h index 4103c5ef..dfc3da38 100644 --- a/src/gui/setup_video.h +++ b/src/gui/setup_video.h @@ -51,6 +51,7 @@ class Setup_Video : public SetupTab, public gcn::ActionListener, bool mCustomCursorEnabled; bool mParticleEffectsEnabled; bool mSpeechBubbleEnabled; + bool mNameEnabled; double mOpacity; int mFps; @@ -62,6 +63,7 @@ class Setup_Video : public SetupTab, public gcn::ActionListener, gcn::CheckBox *mCustomCursorCheckBox; gcn::CheckBox *mParticleEffectsCheckBox; gcn::CheckBox *mSpeechBubbleCheckBox; + gcn::CheckBox *mNameCheckBox; gcn::Slider *mAlphaSlider; gcn::CheckBox *mFpsCheckBox; diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 080ebddc..75b756f5 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -93,6 +93,10 @@ Viewport::draw(gcn::Graphics *gcnGraphics) Graphics *graphics = static_cast<Graphics*>(gcnGraphics); + // Ensure the client doesn't freak out if a feature localplayer uses + // is dependent on a map. + player_node->mMapInitialized = true; + // Avoid freaking out when tick_time overflows if (tick_time < lastTick) { @@ -196,6 +200,13 @@ Viewport::draw(gcn::Graphics *gcnGraphics) } } + if (player_node->mUpdateName) + { + player_node->mUpdateName = false; + player_node->setName(player_node->getName()); + } + + // Draw text if (textManager) { |