]> git.localhorst.tv Git - l2e.git/blobdiff - src/map/MapState.cpp
trigger handling in map state
[l2e.git] / src / map / MapState.cpp
index ec714d0588c646360746cad27003c96203c59634..3be5a4592f5d16b636c3fb2d8a33d1df7a8277f6 100644 (file)
@@ -20,7 +20,7 @@ using geometry::Vector;
 
 namespace map {
 
-MapState::MapState(const Map *map)
+MapState::MapState(Map *map)
 : map(map)
 , controlled(0)
 , tempTarget(20, 20)
@@ -102,8 +102,12 @@ void MapState::UpdateWorld(float deltaT) {
                        } else {
                                controlled->SetSpeed(0.0f);
                        }
+                       if (!controlled->AnimationRunning()) {
+                               controlled->StartAnimation(*this);
+                       }
                } else {
                        controlled->SetSpeed(0.0f);
+                       controlled->StopAnimation();
                }
                if (nowLock != lastLock) {
                        lastLock = nowLock;
@@ -116,7 +120,11 @@ void MapState::UpdateWorld(float deltaT) {
 }
 
 void MapState::OnGridLock() {
-       // TODO: check for adjacent monsters and triggers on the current tile
+       Trigger *trigger(map->TriggerAt(Vector<int>(controlled->Position())));
+       if (trigger) {
+               // TODO: run trigger
+       }
+       // TODO: check for adjacent monsters
        // TODO: force all entities into their grid positions?
 }