#ifndef MAP_ENTITY_H_
#define MAP_ENTITY_H_
+#include "../battle/fwd.h"
+#include "../battle/Monster.h"
#include "../geometry/Vector.h"
#include "../graphics/fwd.h"
#include "../graphics/Animation.h"
};
enum Flags {
FLAG_NONBLOCKING = 0x01,
+ FLAG_PUSHABLE = 0x02,
+ FLAG_FIXED_ORIENTATION = 0x04,
};
public:
geometry::Vector<int> &SpriteOffset() { return spriteOffset; }
const geometry::Vector<int> &SpriteOffset() const { return spriteOffset; }
+ void ResetPosition(const geometry::Vector<int> &tileSize) { position = tilePosition * tileSize; }
+
void SetAnimation(const graphics::Animation *a);
void StartAnimation(app::Application &ctrl);
void StartAnimation(app::State &ctrl);
void StopAnimation();
bool AnimationRunning() const { return runner.Running(); }
+ void SetSprite(const graphics::Sprite *s) { sprite = s; }
+
void SetOrientation(Orientation);
Orientation GetOrientation() const { return orientation; }
void SetSpeed(float);
+ void SetHandsFree();
+ void SetCarrying();
+ void SetPushing();
+
void SetFlags(int f) { flags = f; }
bool Blocking() const { return !(flags & FLAG_NONBLOCKING); }
- bool Hostile() const {
- // NOTE: this is a stub for testing!
- return Blocking();
- }
+ bool Hostile() const { return partyLayout && numMonsters > 0; }
+ bool Pushable() const { return flags & FLAG_PUSHABLE; }
+ bool CanTurn() const { return !(flags & FLAG_FIXED_ORIENTATION); }
+
+ void SetPartyLayout(battle::PartyLayout *l) { partyLayout = l; }
+ battle::PartyLayout *PartyLayout() { return partyLayout; }
+
+ void SetMonsters(battle::Monster *m, int num) { monsters = m; numMonsters = num; }
+ battle::Monster *MonstersBegin() { return monsters; }
+ battle::Monster *MonstersEnd() { return monsters + numMonsters; }
Entity *Follower() { return follower; }
const Entity *Follower() const { return follower; }
private:
Entity *follower;
const graphics::Animation *animation;
+ const graphics::Sprite *sprite;
+ battle::PartyLayout *partyLayout;
+ battle::Monster *monsters;
+ int numMonsters;
graphics::AnimationRunner runner;
geometry::Vector<int> spriteOffset;
+ geometry::Vector<int> tilePosition;
geometry::Vector<float> position;
geometry::Vector<float> velocity;
Orientation orientation;