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,
38 FLAG_FIXED_ORIENTATION = 0x04,
42 geometry::Vector<float> &Position() { return position; }
43 const geometry::Vector<float> &Position() const { return position; }
45 geometry::Vector<float> &Velocity() { return velocity; }
46 const geometry::Vector<float> &Velocity() const { return velocity; }
48 geometry::Vector<int> &SpriteOffset() { return spriteOffset; }
49 const geometry::Vector<int> &SpriteOffset() const { return spriteOffset; }
51 void SetAnimation(const graphics::Animation *a);
52 void StartAnimation(app::Application &ctrl);
53 void StartAnimation(app::State &ctrl);
55 bool AnimationRunning() const { return runner.Running(); }
57 void SetSprite(const graphics::Sprite *s) { sprite = s; }
59 void SetOrientation(Orientation);
60 Orientation GetOrientation() const { return orientation; }
67 void SetFlags(int f) { flags = f; }
68 bool Blocking() const { return !(flags & FLAG_NONBLOCKING); }
69 bool Hostile() const { return partyLayout && numMonsters > 0; }
70 bool Pushable() const { return flags & FLAG_PUSHABLE; }
71 bool CanTurn() const { return !(flags & FLAG_FIXED_ORIENTATION); }
73 void SetPartyLayout(battle::PartyLayout *l) { partyLayout = l; }
74 battle::PartyLayout *PartyLayout() { return partyLayout; }
76 void SetMonsters(battle::Monster *m, int num) { monsters = m; numMonsters = num; }
77 battle::Monster *MonstersBegin() { return monsters; }
78 battle::Monster *MonstersEnd() { return monsters + numMonsters; }
80 Entity *Follower() { return follower; }
81 const Entity *Follower() const { return follower; }
82 void AddFollower(Entity *);
83 void RemoveFollower(Entity *);
85 bool TileLock(const geometry::Vector<int> &tileSize) const;
87 void Update(float deltaT);
89 void Render(SDL_Surface *, const geometry::Vector<int> &offset) const;
91 static void CreateTypeDescription();
92 static void Construct(void *);
93 static void Load(void *);
96 void UpdateVelocity();
100 const graphics::Animation *animation;
101 const graphics::Sprite *sprite;
102 battle::PartyLayout *partyLayout;
103 battle::Monster *monsters;
105 graphics::AnimationRunner runner;
106 geometry::Vector<int> spriteOffset;
107 geometry::Vector<float> position;
108 geometry::Vector<float> velocity;
109 Orientation orientation;
117 #endif /* MAP_ENTITY_H_ */