]> git.localhorst.tv Git - l2e.git/blobdiff - src/map/MapState.h
better accessibility of map-related properties
[l2e.git] / src / map / MapState.h
index 89d235ddd631e22e0e99e93ac0d9d1b43031f950..b243c3b07258cf9529d0bfe6e6309e56826569cf 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,7 +38,11 @@ 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; }
 
@@ -39,6 +50,9 @@ public:
 
        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