#ifndef MAP_ENTITY_H_
#define MAP_ENTITY_H_
-#include "../battle/fwd.h"
-#include "../battle/Monster.h"
+namespace app {
+ class Application;
+ class State;
+}
+namespace battle {
+ class Monster;
+ class PartyLayout;
+}
+
+#include "../math/Fixed.h"
#include "../math/Vector.h"
-#include "../graphics/fwd.h"
#include "../graphics/Animation.h"
#include <functional>
public:
/// Pixel resolved position of the entity's top left corner on the map.
- math::Vector<float> &Position() { return position; }
- const math::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.
- math::Vector<float> &Velocity() { return velocity; }
- const math::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().
math::Vector<int> &SpriteOffset() { return spriteOffset; }
/// west sprites at offsets (0,0), (1,0), (2,0), and (3,0) respectively.
void SetSprite(const graphics::Sprite *s) { sprite = s; }
- /// Change the entity's orientation to given one.
- /// If the entity is moving, velocity is changed accordingly.
+ /// Change the entity's facing direction.
+ /// If the entity is moving, velocity is untouched.
void SetOrientation(Orientation);
Orientation GetOrientation() const { return orientation; }
+ /// Change the entity's orientation to given one.
+ /// If the entity is moving, velocity is changed accordingly.
+ /// Also changes the orientation to given direction.
+ void SetDirection(Orientation);
+ Orientation GetDirection() const { return direction; }
/// Set the entity's speed in pixels per second.
- /// This speed is then combined with the orientation to form a velocity.
- void SetSpeed(float);
+ /// This speed is then combined with the direction to form a velocity.
+ void SetSpeed(math::Fixed<8>);
/// Change to a natural, relaxed animation state (row offset 0).
void SetHandsFree();
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 math::Vector<int> &offset) const;
graphics::AnimationRunner runner;
math::Vector<int> spriteOffset;
math::Vector<int> tilePosition;
- math::Vector<float> position;
- math::Vector<float> velocity;
+ math::Vector<math::Fixed<8> > position;
+ math::Vector<math::Fixed<8> > velocity;
+ Orientation direction;
Orientation orientation;
- float speed;
+ math::Fixed<8> speed;
int flags;
};
}
-#endif /* MAP_ENTITY_H_ */
+#endif