summaryrefslogtreecommitdiff
path: root/src/localplayer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/localplayer.h')
-rw-r--r--src/localplayer.h68
1 files changed, 63 insertions, 5 deletions
diff --git a/src/localplayer.h b/src/localplayer.h
index 6b6486e5..55e12bf1 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -25,11 +25,16 @@
#include <vector>
#include "player.h"
+#include "simpleanimation.h"
// TODO move into some sane place...
#define MAX_SLOT 2
+#define INVENTORY_SIZE 102
+#define STORAGE_SIZE 301
+
class FloorItem;
+class ImageSet;
class Inventory;
class Item;
class Network;
@@ -54,7 +59,7 @@ class LocalPlayer : public Player
*/
~LocalPlayer();
- void setName(const std::string &name) {Being::setName(name); }
+ virtual void setName(const std::string &name);
void setNetwork(Network *network) { mNetwork = network; }
Network *getNetwork() {return mNetwork; }
virtual void logic();
@@ -71,6 +76,11 @@ class LocalPlayer : public Player
Inventory* getInventory() const { return mInventory; }
/**
+ * Returns the player's storage
+ */
+ Inventory* getStorage() const { return mStorage; }
+
+ /**
* Equips an item.
*/
void equipItem(Item *item);
@@ -118,6 +128,14 @@ class LocalPlayer : public Player
void attack(Being *target = NULL, bool keep = false);
+ /**
+ * Triggers whether or not to show the name as a GM name.
+ * NOTE: This doesn't mean that just anyone can use this.
+ * If the server doesn't acknowlege you, you won't be shown
+ * as a GM on other people's clients.
+ */
+ virtual void setGM();
+
void stopAttack();
Being* getTarget() const;
@@ -166,6 +184,12 @@ class LocalPlayer : public Player
void revive();
/**
+ * Accessors for mInStorage
+ */
+ bool getInStorage() { return mInStorage; }
+ void setInStorage(bool inStorage) { mInStorage = inStorage; }
+
+ /**
* Sets the amount of XP. Shows XP gaining effect if the player is on
* a map.
*/
@@ -198,6 +222,20 @@ class LocalPlayer : public Player
Uint16 mStatPoint, mSkillPoint;
Uint16 mStatsPointsToAttribute;
+ bool mUpdateName; /** Whether or not the name settings have changed */
+
+ bool mMapInitialized; /** Whether or not the map is available yet */
+
+ float mLastAttackTime; /**< Used to synchronize the charge dialog */
+
+ void drawTargetCursor(Graphics *graphics, int offsetX, int offsetY);
+
+ /** Animated in range target cursor. */
+ SimpleAnimation *mTargetCursorInRange[NUM_TC];
+
+ /** Animated out of range target cursor. */
+ SimpleAnimation *mTargetCursorOutRange[NUM_TC];
+
protected:
virtual void
handleStatusEffect(StatusEffect *effect, int effectId);
@@ -211,15 +249,35 @@ class LocalPlayer : public Player
FloorItem *mPickUpTarget;
bool mTrading;
+ bool mInStorage; /**< Whether storage is currently accessible */
bool mGoingToTarget;
- int mLastAction; /**< Time stamp of the last action, -1 if none. */
- int mWalkingDir; /**< The direction the player is walking in. */
- int mDestX; /**< X coordinate of destination. */
- int mDestY; /**< Y coordinate of destination. */
+ bool mKeepAttacking; /** Whether or not to continue to attack */
+ int mTargetTime; /** How long the being has been targeted **/
+ int mLastAction; /**< Time stamp of the last action, -1 if none. */
+ int mLastTarget; /** Time stamp of last targeting action, -1 if none. */
+ int mWalkingDir; /**< The direction the player is walking in. */
+ int mDestX; /**< X coordinate of destination. */
+ int mDestY; /**< Y coordinate of destination. */
std::vector<int> mStatusEffectIcons;
Inventory *mInventory;
+ Inventory *mStorage;
+
+ /**
+ * Helper function for loading target cursors
+ */
+ void loadTargetCursor(std::string filename, int width, int height,
+ bool outRange, Being::TargetCursorSize size);
+
+ /** Images of in range target cursor. */
+ ImageSet *mInRangeImages[NUM_TC];
+
+ /** Images of out of range target cursor. */
+ ImageSet *mOutRangeImages[NUM_TC];
+
+ // Load the target cursors into memory
+ void initTargetCursor();
};
extern LocalPlayer *player_node;