summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-07-13 17:51:31 -0600
committerJared Adams <jaxad0127@gmail.com>2009-07-13 17:51:31 -0600
commit6c764b3c95d0c078c5ccebac607517353e64dc55 (patch)
tree7e1c62332a5f2fad4192f6799e895fbe896ecfa3
parentc0bfb778b38e0212d645c3c03d88969b8abf4423 (diff)
downloadmana-client-6c764b3c95d0c078c5ccebac607517353e64dc55.tar.gz
mana-client-6c764b3c95d0c078c5ccebac607517353e64dc55.tar.bz2
mana-client-6c764b3c95d0c078c5ccebac607517353e64dc55.tar.xz
mana-client-6c764b3c95d0c078c5ccebac607517353e64dc55.zip
Fix level experience messages
THe experience message queue is now a general queue for serial messages (ie: not messages like battle messages that should be done immediately).
-rw-r--r--src/localplayer.cpp53
-rw-r--r--src/localplayer.h8
2 files changed, 27 insertions, 34 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 5fdd29cd..69049398 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -119,10 +119,8 @@ LocalPlayer::LocalPlayer(int id, int job, Map *map):
#ifdef TMWSERV_SUPPORT
mLocalWalkTime(-1),
#endif
- mStorage(new Inventory(STORAGE_SIZE))
-#ifdef TMWSERV_SUPPORT
- , mExpMessageTime(0)
-#endif
+ mStorage(new Inventory(STORAGE_SIZE)),
+ mMessageTime(0)
{
// Variable to keep the local player from doing certain actions before a map
// is initialized. e.g. drawing a player's name using the TextManager, since
@@ -156,27 +154,29 @@ void LocalPlayer::logic()
if (get_elapsed_time(mLastAction) >= 1000)
mLastAction = -1;
-#ifdef TMWSERV_SUPPORT
// Show XP messages
- if (!mExpMessages.empty())
+ if (!mMessages.empty())
{
- if (mExpMessageTime == 0)
+ if (mMessageTime == 0)
{
- const Vector &pos = getPosition();
+ //const Vector &pos = getPosition();
particleEngine->addTextRiseFadeOutEffect(
- mExpMessages.front(),
- (int) pos.x + 16,
- (int) pos.y - 16,
+ mMessages.front(),
+ /*(int) pos.x,
+ (int) pos.y - 48,*/
+ getPixelX(),
+ getPixelY() - 48,
&guiPalette->getColor(Palette::EXP_INFO),
gui->getInfoParticleFont(), true);
- mExpMessages.pop_front();
- mExpMessageTime = 30;
+ mMessages.pop_front();
+ mMessageTime = 30;
}
- mExpMessageTime--;
+ mMessageTime--;
}
-#else
+
+#ifdef EATHENA_SUPPORT
// Targeting allowed 4 times a second
if (get_elapsed_time(mLastTarget) >= 250)
mLastTarget = -1;
@@ -188,7 +188,6 @@ void LocalPlayer::logic()
setTarget(NULL);
mLastTarget = -1;
}
-
#endif
if (mTarget)
@@ -831,13 +830,10 @@ void LocalPlayer::setExperience(int skill, int current, int next)
if (skillDialog)
name = skillDialog->update(skill);
-#ifdef TMWSERV_SUPPORT
if (mMap && cur.first != -1 && diff > 0 && !name.empty())
{
- const std::string text = strprintf("%d %s xp", diff, name.c_str());
- mExpMessages.push_back(text);
+ addMessageToQueue(strprintf("%d %s xp", diff, name.c_str()));
}
-#endif
}
std::pair<int, int> LocalPlayer::getExperience(int skill)
@@ -847,17 +843,9 @@ std::pair<int, int> LocalPlayer::getExperience(int skill)
void LocalPlayer::setLevelProgress(int percent)
{
- if (mMap && percent > percent)
+ if (mMap && percent > mLevelProgress)
{
- const std::string text = toString(percent - percent) + " xp";
-
- // Show XP number
- particleEngine->addTextRiseFadeOutEffect(
- text,
- getPixelX(),
- getPixelY() - 48,
- &guiPalette->getColor(Palette::EXP_INFO),
- gui->getInfoParticleFont(), true);
+ addMessageToQueue(toString(percent - mLevelProgress) + " xp");
}
mLevelProgress = percent;
}
@@ -1021,3 +1009,8 @@ void LocalPlayer::setInStorage(bool inStorage)
storageWindow->setVisible(inStorage);
}
#endif
+
+void LocalPlayer::addMessageToQueue(const std::string &message)
+{
+ mMessages.push_back(message);
+}
diff --git a/src/localplayer.h b/src/localplayer.h
index c1ceaf37..702ae38c 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -375,6 +375,8 @@ class LocalPlayer : public Player
const std::auto_ptr<Equipment> mEquipment;
+ void addMessageToQueue(const std::string &message);
+
protected:
virtual void handleStatusEffect(StatusEffect *effect, int effectId);
@@ -441,10 +443,8 @@ class LocalPlayer : public Player
/** Animated target cursors. */
SimpleAnimation *mTargetCursor[2][NUM_TC];
-#ifdef TMWSERV_SUPPORT
- std::list<std::string> mExpMessages; /**< Queued exp messages*/
- int mExpMessageTime;
-#endif
+ std::list<std::string> mMessages; /**< Queued exp messages*/
+ int mMessageTime;
};
extern LocalPlayer *player_node;