]> git.localhorst.tv Git - l2e.git/blobdiff - src/map/MapState.h
new language, new compiler
[l2e.git] / src / map / MapState.h
index 89d235ddd631e22e0e99e93ac0d9d1b43031f950..8b9532db3bbbf7fb684bc4909a9dc6f77edba1ee 100644 (file)
@@ -1,10 +1,17 @@
 #ifndef MAP_MAPSTATE_H_
 #define MAP_MAPSTATE_H_
 
+namespace common {
+       struct GameConfig;
+}
+namespace map {
+       class Map;
+       class Trigger;
+}
+
 #include "Entity.h"
-#include "fwd.h"
 #include "../app/State.h"
-#include "../common/fwd.h"
+#include "../app/Timer.h"
 #include "../common/ScriptHost.h"
 #include "../common/ScriptRunner.h"
 #include "../math/Fixed.h"
@@ -31,14 +38,21 @@ public:
 
 public:
        void AddEntity(Entity *e) { entities.push_back(e); }
-       void ControlEntity(Entity *e) { controlled = e; camera.SetTarget(&e->Position()); }
+       void ControlEntity(Entity *e) { controlled = e; TrackControlled(); }
+       void Track(math::Vector<math::Fixed<8> > *t) { camera.SetTarget(t); }
+       void TrackControlled() { if (controlled) Track(&controlled->Position()); }
+
+       math::Vector<math::Fixed<8> > TrackPoint() const { return *camera.GetTarget(); }
 
-       void SetWalkingSpeed(math::Fixed<8> s) { walkingSpeed = s; }
+       void SetWalkingSpeed(int s);
 
        void Transition(Map *, const math::Vector<int> &coordinates);
 
        virtual void HandleSyscall(common::ScriptRunner &);
 
+       const graphics::Camera &GetCamera() const { return camera; }
+       Map *GetMap() { return map; }
+
 private:
        virtual void OnEnterState(SDL_Surface *screen);
        virtual void OnExitState(SDL_Surface *screen);
@@ -65,6 +79,7 @@ private:
 
        void LockEntities();
        bool CheckMonster();
+       void LoadBattle(Entity &hero, Entity &monster);
 
        bool CheckLockTrigger();
        bool CheckMoveTrigger();
@@ -86,6 +101,7 @@ private:
        graphics::Camera camera;
        std::vector<Entity *> entities;
        math::Fixed<8> walkingSpeed;
+       app::Timer<Uint32> tileAnimation;
        int nextDirection;
        bool afterLock;
        bool skipLock;
@@ -96,4 +112,4 @@ private:
 
 }
 
-#endif /* MAP_MAPSTATE_H_ */
+#endif