X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmap%2FEntity.h;h=13ecacac627eb021ee9f35ede96db8b739e6ea8f;hb=0ad5ca97b5df217329bc319d62564a9f46ba11d7;hp=e1ede977e65888eea33360f20a37b3f91aa63a93;hpb=3565d69c463c39b05b4612ca3d3557139d91e310;p=l2e.git diff --git a/src/map/Entity.h b/src/map/Entity.h index e1ede97..13ecaca 100644 --- a/src/map/Entity.h +++ b/src/map/Entity.h @@ -8,6 +8,8 @@ #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" @@ -30,6 +32,9 @@ public: ORIENTATION_SOUTH = 2, ORIENTATION_WEST = 3, }; + enum Flags { + FLAG_NONBLOCKING = 0x01, + }; public: geometry::Vector &Position() { return position; } @@ -38,30 +43,61 @@ public: geometry::Vector &Velocity() { return velocity; } const geometry::Vector &Velocity() const { return velocity; } - void SetSprite(const graphics::Sprite *s) { sprite = s; } - graphics::AnimationRunner &Animation() { return animation; } - const graphics::AnimationRunner &Animation() const { return animation; } + geometry::Vector &SpriteOffset() { return spriteOffset; } + const geometry::Vector &SpriteOffset() const { return spriteOffset; } + + 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 SetOrientation(Orientation); Orientation GetOrientation() const { return orientation; } void SetSpeed(float); - bool TileLock(int width, int height) const; + void SetFlags(int f) { flags = f; } + bool Blocking() const { return !(flags & FLAG_NONBLOCKING); } + bool Hostile() const { return partyLayout && numMonsters > 0; } + + 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; } + void AddFollower(Entity *); + void RemoveFollower(Entity *); + + bool TileLock(const geometry::Vector &tileSize) const; void Update(float deltaT); void Render(SDL_Surface *, const geometry::Vector &offset) const; + static void CreateTypeDescription(); + static void Construct(void *); + static void Load(void *); + private: void UpdateVelocity(); private: - const graphics::Sprite *sprite; - graphics::AnimationRunner animation; + Entity *follower; + const graphics::Animation *animation; + battle::PartyLayout *partyLayout; + battle::Monster *monsters; + int numMonsters; + graphics::AnimationRunner runner; + geometry::Vector spriteOffset; geometry::Vector position; geometry::Vector velocity; Orientation orientation; float speed; + int flags; };