4 * Created on: Sep 29, 2012
11 #include "../battle/fwd.h"
12 #include "../battle/Monster.h"
13 #include "../geometry/Vector.h"
14 #include "../graphics/fwd.h"
15 #include "../graphics/Animation.h"
30 ORIENTATION_NORTH = 0,
32 ORIENTATION_SOUTH = 2,
36 FLAG_NONBLOCKING = 0x01,
40 geometry::Vector<float> &Position() { return position; }
41 const geometry::Vector<float> &Position() const { return position; }
43 geometry::Vector<float> &Velocity() { return velocity; }
44 const geometry::Vector<float> &Velocity() const { return velocity; }
46 geometry::Vector<int> &SpriteOffset() { return spriteOffset; }
47 const geometry::Vector<int> &SpriteOffset() const { return spriteOffset; }
49 void SetAnimation(const graphics::Animation *a);
50 void StartAnimation(app::Application &ctrl);
51 void StartAnimation(app::State &ctrl);
53 bool AnimationRunning() const { return runner.Running(); }
55 void SetOrientation(Orientation);
56 Orientation GetOrientation() const { return orientation; }
59 void SetFlags(int f) { flags = f; }
60 bool Blocking() const { return !(flags & FLAG_NONBLOCKING); }
61 bool Hostile() const { return partyLayout && numMonsters > 0; }
63 void SetPartyLayout(battle::PartyLayout *l) { partyLayout = l; }
64 battle::PartyLayout *PartyLayout() { return partyLayout; }
66 void SetMonsters(battle::Monster *m, int num) { monsters = m; numMonsters = num; }
67 battle::Monster *MonstersBegin() { return monsters; }
68 battle::Monster *MonstersEnd() { return monsters + numMonsters; }
70 Entity *Follower() { return follower; }
71 const Entity *Follower() const { return follower; }
72 void AddFollower(Entity *);
73 void RemoveFollower(Entity *);
75 bool TileLock(const geometry::Vector<int> &tileSize) const;
77 void Update(float deltaT);
79 void Render(SDL_Surface *, const geometry::Vector<int> &offset) const;
81 static void CreateTypeDescription();
82 static void Construct(void *);
83 static void Load(void *);
86 void UpdateVelocity();
90 const graphics::Animation *animation;
91 battle::PartyLayout *partyLayout;
92 battle::Monster *monsters;
94 graphics::AnimationRunner runner;
95 geometry::Vector<int> spriteOffset;
96 geometry::Vector<float> position;
97 geometry::Vector<float> velocity;
98 Orientation orientation;
106 #endif /* MAP_ENTITY_H_ */