summaryrefslogtreecommitdiff
path: root/src/koopatlas/pathmanager.cpp
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2012-09-21 13:24:57 +0200
committerTreeki <treeki@gmail.com>2012-09-21 13:24:57 +0200
commit955831a5bad45d39dfceb4a1741095b5d109b079 (patch)
tree0a8bb569a511f3d02d767700b001fbb4b10b67e6 /src/koopatlas/pathmanager.cpp
parentbadb2bf6bc25f47e711fc483e0c551b4fc18759f (diff)
downloadkamek-955831a5bad45d39dfceb4a1741095b5d109b079.tar.gz
kamek-955831a5bad45d39dfceb4a1741095b5d109b079.zip
still working on the new HUD...
Diffstat (limited to '')
-rw-r--r--src/koopatlas/pathmanager.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp
index 3d85f4c..a03541c 100644
--- a/src/koopatlas/pathmanager.cpp
+++ b/src/koopatlas/pathmanager.cpp
@@ -302,6 +302,10 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) {
SpammyReport("moving to path %p\n", path);
if (!path->isAvailable) { return; }
+ if (currentNode)
+ dWMHud_c::instance->leftNode();
+
+ calledEnteredNode = false;
SpammyReport("a\n");
isMoving = true;
@@ -496,6 +500,18 @@ void dWMPathManager_c::moveThroughPath() {
player->pos.x += move.x;
player->pos.y -= move.y;
+ // what distance is left?
+ if (to->type == dKPNode_s::LEVEL && !calledEnteredNode) {
+ Vec toEndVec = {to->x - player->pos.x, to->y + player->pos.y, 0.0f};
+ float distToEnd = VECMag(&toEndVec);
+ //OSReport("Distance: %f; To:%d,%d; Player:%f,%f; Diff:%f,%f\n", distToEnd, to->x, to->y, player->pos.x, player->pos.y, toEndVec.x, toEndVec.y);
+
+ if (distToEnd < 64.0f) {
+ calledEnteredNode = true;
+ dWMHud_c::instance->enteredNode(to);
+ }
+ }
+
// Check if we've reached the end yet
if (
((move.x > 0) ? (player->pos.x >= to->x) : (player->pos.x <= to->x)) &&
@@ -557,6 +573,8 @@ void dWMPathManager_c::moveThroughPath() {
SaveBlock *save = GetSaveFile()->GetBlock(-1);
save->current_path_node = pathLayer->findNodeID(to);
+ if (!calledEnteredNode)
+ dWMHud_c::instance->enteredNode();
if (to->type == dKPNode_s::LEVEL) {
NWRWorld nWorld = NewerWorldForLevelID(to->levelNumber[0], to->levelNumber[1]);