summaryrefslogtreecommitdiff
path: root/src/localplayer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r--src/localplayer.cpp58
1 files changed, 49 insertions, 9 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index a719e265..70e42f88 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -34,9 +33,11 @@
#include "particle.h"
#include "simpleanimation.h"
#include "sound.h"
+#include "statuseffect.h"
#include "text.h"
#include "gui/gui.h"
+#include "gui/ministatus.h"
#include "net/messageout.h"
#include "net/protocol.h"
@@ -67,7 +68,7 @@ LocalPlayer::LocalPlayer(Uint32 id, Uint16 job, Map *map):
ATK_BONUS(0), MATK_BONUS(0), DEF_BONUS(0), MDEF_BONUS(0), FLEE_BONUS(0),
mStatPoint(0), mSkillPoint(0),
mStatsPointsToAttribute(0),
- mEquipment(new Equipment()),
+ mEquipment(new Equipment),
mXp(0), mNetwork(0),
mTarget(NULL), mPickUpTarget(NULL),
mTrading(false), mGoingToTarget(false),
@@ -386,10 +387,7 @@ void LocalPlayer::setDestination(Uint16 x, Uint16 y)
void LocalPlayer::setWalkingDir(int dir)
{
- if (mWalkingDir != dir)
- {
- mWalkingDir = dir;
- }
+ mWalkingDir = dir;
// If we're not already walking, start walking.
if (mAction != WALK && dir)
@@ -611,6 +609,48 @@ void LocalPlayer::setGotoTarget(Being *target)
setDestination(target->mX, target->mY);
}
+
+extern MiniStatusWindow *miniStatusWindow;
+
+void LocalPlayer::handleStatusEffect(StatusEffect *effect, int effectId)
+{
+ Being::handleStatusEffect(effect, effectId);
+
+
+
+ if (effect) {
+ effect->deliverMessage();
+ effect->playSFX();
+
+ AnimatedSprite *sprite = effect->getIcon();
+
+ if (!sprite) {
+ // delete sprite, if necessary
+ for (unsigned int i = 0; i < mStatusEffectIcons.size();)
+ if (mStatusEffectIcons[i] == effectId) {
+ mStatusEffectIcons.erase(mStatusEffectIcons.begin() + i);
+ miniStatusWindow->eraseIcon(i);
+ } else i++;
+ } else {
+ // replace sprite or append
+ bool found = false;
+
+ for (unsigned int i = 0; i < mStatusEffectIcons.size(); i++)
+ if (mStatusEffectIcons[i] == effectId) {
+ miniStatusWindow->setIcon(i, sprite);
+ found = true;
+ break;
+ }
+
+ if (!found) { // add new
+ int offset = mStatusEffectIcons.size();
+ miniStatusWindow->setIcon(offset, sprite);
+ mStatusEffectIcons.push_back(effectId);
+ }
+ }
+ }
+}
+
void LocalPlayer::initTargetCursor()
{
// Load target cursors
@@ -640,7 +680,7 @@ void LocalPlayer::loadTargetCursor(std::string filename, int width, int height,
ResourceManager *resman = ResourceManager::getInstance();
currentImageSet = resman->getImageSet(filename, width, height);
- Animation *anim = new Animation();
+ Animation *anim = new Animation;
for (unsigned int i = 0; i < currentImageSet->size(); ++i)
{