]> git.localhorst.tv Git - l2e.git/blobdiff - src/map/MapState.h
use scripts for map triggers
[l2e.git] / src / map / MapState.h
index 2b530698ea48211fc5c08ed51e208a47bf45f4ea..952bcee393d242cca8d73cdf793c23f5afba062e 100644 (file)
@@ -11,6 +11,9 @@
 #include "Entity.h"
 #include "fwd.h"
 #include "../app/State.h"
+#include "../common/fwd.h"
+#include "../common/ScriptHost.h"
+#include "../common/ScriptRunner.h"
 #include "../geometry/Vector.h"
 #include "../graphics/Camera.h"
 
 namespace map {
 
 class MapState
-: public app::State {
+: public app::State
+, public common::ScriptHost {
 
 public:
-       explicit MapState(Map *);
+       explicit MapState(common::GameConfig *, Map *);
        virtual ~MapState() { }
 
 public:
@@ -42,21 +46,55 @@ public:
 
        void SetWalkingSpeed(float s) { walkingSpeed = s; }
 
+       void Transition(Map *, const geometry::Vector<int> &coordinates);
+
+       virtual void HandleSyscall(common::ScriptRunner &);
+
 private:
        static bool ZCompare(const Entity *lhs, const Entity *rhs);
-       void OnGridLock();
-       void OnMove();
+
+       void UnloadMap();
+       void LoadMap(Map *);
+
+       bool CheckBlocking();
+       bool CheckBlocking(const geometry::Vector<int> &position, Entity::Orientation direction) const;
+
+       void OnTileLock();
+       bool OnGridLock();
+       void OnMove(bool);
+
+       void UpdateFollower(Entity &);
+       void StopFollowers(Entity &);
+
+       void LockEntities();
+       bool CheckMonster();
+
+       bool CheckLockTrigger();
+       bool CheckMoveTrigger();
+       void RunTrigger(Trigger &);
+
+       enum Syscalls {
+               TRANSITION = 1,
+               WARP = 2,
+       };
 
 private:
+       common::GameConfig *game;
+       app::Application *ctrl;
        Map *map;
        Entity *controlled;
-       geometry::Vector<float> tempTarget;
+       Entity *pushed;
+       common::ScriptRunner runner;
+       app::Timer<float> moveTimer;
        geometry::Vector<int> lastLock;
        graphics::Camera camera;
        std::vector<Entity *> entities;
        float walkingSpeed;
        int nextDirection;
        bool afterLock;
+       bool skipLock;
+       bool pushing;
+       bool debug;
 
 };