]> git.localhorst.tv Git - l2e.git/blobdiff - src/map/Entity.h
removed lazy fwd headers
[l2e.git] / src / map / Entity.h
index 8d5c6a5bbb2b8b1d825211e4328e0e9356ad9f6e..64a319dc623051c1b1447df8d38e928f16568c8b 100644 (file)
@@ -1,17 +1,17 @@
-/*
- * Entity.h
- *
- *  Created on: Sep 29, 2012
- *      Author: holy
- */
-
 #ifndef MAP_ENTITY_H_
 #define MAP_ENTITY_H_
 
-#include "../battle/fwd.h"
-#include "../battle/Monster.h"
-#include "../geometry/Vector.h"
-#include "../graphics/fwd.h"
+namespace app {
+       class Application;
+       class State;
+}
+namespace battle {
+       class Monster;
+       class PartyLayout;
+}
+
+#include "../math/Fixed.h"
+#include "../math/Vector.h"
 #include "../graphics/Animation.h"
 
 #include <functional>
@@ -23,6 +23,9 @@ namespace map {
 /// interact with the player.
 class Entity {
 
+public:
+       static const int TYPE_ID = 605;
+
 public:
        Entity();
        ~Entity() { }
@@ -42,20 +45,20 @@ public:
 
 public:
        /// Pixel resolved position of the entity's top left corner on the map.
-       geometry::Vector<float> &Position() { return position; }
-       const geometry::Vector<float> &Position() const { return position; }
+       math::Vector<math::Fixed<8> > &Position() { return position; }
+       const math::Vector<math::Fixed<8> > &Position() const { return position; }
 
        /// Velocity of the entity in pixels per second.
-       geometry::Vector<float> &Velocity() { return velocity; }
-       const geometry::Vector<float> &Velocity() const { return velocity; }
+       math::Vector<math::Fixed<8> > &Velocity() { return velocity; }
+       const math::Vector<math::Fixed<8> > &Velocity() const { return velocity; }
 
        /// Offset of the entity's sprite's to left corner relative to Position().
-       geometry::Vector<int> &SpriteOffset() { return spriteOffset; }
-       const geometry::Vector<int> &SpriteOffset() const { return spriteOffset; }
+       math::Vector<int> &SpriteOffset() { return spriteOffset; }
+       const math::Vector<int> &SpriteOffset() const { return spriteOffset; }
 
        /// Reset the entity to the stored tile coordinates (usually set when
        /// loading game data).
-       void ResetPosition(const geometry::Vector<int> &tileSize) { position = tilePosition * tileSize; }
+       void ResetPosition(const math::Vector<int> &tileSize) { position = tilePosition * tileSize; }
 
        /// Set the animation to use for animated entities.
        /// For orientable entities, the animation  should have north, south, east,
@@ -83,7 +86,7 @@ public:
        Orientation GetOrientation() const { return orientation; }
        /// Set the entity's speed in pixels per second.
        /// This speed is then combined with the orientation to form a velocity.
-       void SetSpeed(float);
+       void SetSpeed(math::Fixed<8>);
 
        /// Change to a natural, relaxed animation state (row offset 0).
        void SetHandsFree();
@@ -114,9 +117,9 @@ public:
 
        /// Add monsters. This will cause the entity to be Hostile() and result in a
        /// battle scene with given monsters when touched.
-       void SetMonsters(battle::Monster *m, int num) { monsters = m; numMonsters = num; }
-       battle::Monster *MonstersBegin() { return monsters; }
-       battle::Monster *MonstersEnd() { return monsters + numMonsters; }
+       void SetMonsters(battle::Monster **m, int num) { monsters = m; numMonsters = num; }
+       battle::Monster **MonstersBegin() { return monsters; }
+       battle::Monster **MonstersEnd() { return monsters + numMonsters; }
 
        /// Get an entity that should follow in this one's steps or 0 if none.
        Entity *Follower() { return follower; }
@@ -128,12 +131,12 @@ public:
        void RemoveFollower(Entity *);
 
        /// Check if position locks into grid defined by given tileSize.
-       bool TileLock(const geometry::Vector<int> &tileSize) const;
+       bool TileLock(const math::Vector<int> &tileSize) const;
 
        /// Integrate this entity's physical properties over given time interval.
-       void Update(float deltaT);
+       void Update(Uint32 deltaT);
 
-       void Render(SDL_Surface *, const geometry::Vector<int> &offset) const;
+       void Render(SDL_Surface *, const math::Vector<int> &offset) const;
 
        static void CreateTypeDescription();
        static void Construct(void *);
@@ -147,15 +150,15 @@ private:
        const graphics::Animation *animation;
        const graphics::Sprite *sprite;
        battle::PartyLayout *partyLayout;
-       battle::Monster *monsters;
+       battle::Monster **monsters;
        int numMonsters;
        graphics::AnimationRunner runner;
-       geometry::Vector<int> spriteOffset;
-       geometry::Vector<int> tilePosition;
-       geometry::Vector<float> position;
-       geometry::Vector<float> velocity;
+       math::Vector<int> spriteOffset;
+       math::Vector<int> tilePosition;
+       math::Vector<math::Fixed<8> > position;
+       math::Vector<math::Fixed<8> > velocity;
        Orientation orientation;
-       float speed;
+       math::Fixed<8> speed;
        int flags;
 
 };