]> git.localhorst.tv Git - l2e.git/blobdiff - src/map/Entity.h
store complete entity in hero
[l2e.git] / src / map / Entity.h
index 94090a1e547806790f3bf7331303749bfc1a7568..3ddc9ccef49f5340680882be332ae216cbb1c259 100644 (file)
@@ -30,6 +30,9 @@ public:
                ORIENTATION_SOUTH = 2,
                ORIENTATION_WEST = 3,
        };
+       enum Flags {
+               FLAG_NONBLOCKING = 0x01,
+       };
 
 public:
        geometry::Vector<float> &Position() { return position; }
@@ -38,6 +41,9 @@ public:
        geometry::Vector<float> &Velocity() { return velocity; }
        const geometry::Vector<float> &Velocity() const { return velocity; }
 
+       geometry::Vector<int> &SpriteOffset() { return spriteOffset; }
+       const geometry::Vector<int> &SpriteOffset() const { return spriteOffset; }
+
        void SetAnimation(const graphics::Animation *a);
        void StartAnimation(app::Application &ctrl);
        void StartAnimation(app::State &ctrl);
@@ -48,28 +54,41 @@ public:
        Orientation GetOrientation() const { return orientation; }
        void SetSpeed(float);
 
+       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(int width, int height) const;
+       bool TileLock(const geometry::Vector<int> &tileSize) const;
 
        void Update(float deltaT);
 
        void Render(SDL_Surface *, const geometry::Vector<int> &offset) const;
 
+       static void CreateTypeDescription();
+       static void Construct(void *);
+       static void Load(void *);
+
 private:
-       void UpdateVelocity();;
+       void UpdateVelocity();
 
 private:
        Entity *follower;
        const graphics::Animation *animation;
        graphics::AnimationRunner runner;
+       geometry::Vector<int> spriteOffset;
        geometry::Vector<float> position;
        geometry::Vector<float> velocity;
        Orientation orientation;
        float speed;
+       int flags;
 
 };