X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmap%2FEntity.h;h=3ddc9ccef49f5340680882be332ae216cbb1c259;hb=389d2fcb1e9ca1023cda11da80f00272ab20903a;hp=926c360fef144d740c4cc7f460372aadb3644b87;hpb=72988b5f9bd449cffea97273bebfc788735ce14d;p=l2e.git diff --git a/src/map/Entity.h b/src/map/Entity.h index 926c360..3ddc9cc 100644 --- a/src/map/Entity.h +++ b/src/map/Entity.h @@ -30,6 +30,9 @@ public: ORIENTATION_SOUTH = 2, ORIENTATION_WEST = 3, }; + enum Flags { + FLAG_NONBLOCKING = 0x01, + }; public: geometry::Vector &Position() { return position; } @@ -38,32 +41,54 @@ public: geometry::Vector &Velocity() { return velocity; } const geometry::Vector &Velocity() const { return velocity; } + geometry::Vector &SpriteOffset() { return spriteOffset; } + const geometry::Vector &SpriteOffset() const { return spriteOffset; } + void SetAnimation(const graphics::Animation *a); - void StartAnimation(app::Application &ctrl) { runner.Start(ctrl); } - void StartAnimation(app::State &ctrl) { runner.Start(ctrl); } - void StopAnimation() { runner.Stop(); } + 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 { + // NOTE: this is a stub for testing! + return Blocking(); + } + + 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: + Entity *follower; const graphics::Animation *animation; graphics::AnimationRunner runner; + geometry::Vector spriteOffset; geometry::Vector position; geometry::Vector velocity; Orientation orientation; float speed; + int flags; };