diff options
Diffstat (limited to 'src/koopatlas/pathmanager.cpp')
-rw-r--r-- | src/koopatlas/pathmanager.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index 2b85aaa..536b43a 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -372,10 +372,12 @@ void dWMPathManager_c::execute() { void dWMPathManager_c::startMovementTo(dKPPath_s *path) { SpammyReport("moving to path %p [%d,%d to %d,%d]\n", path, path->start->x, path->start->y, path->end->x, path->end->y); - dWMHud_c::instance->hidePointBar(); - SpammyReport("point bar hidden\n"); if (!path->isAvailable) { return; } + if (currentNode) + dWMHud_c::instance->leftNode(); + + calledEnteredNode = false; SpammyReport("a\n"); isMoving = true; @@ -549,6 +551,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)) && @@ -621,6 +635,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]); @@ -628,9 +644,6 @@ void dWMPathManager_c::moveThroughPath() { save->currentNewerWorld = (u8)nWorld; } } - - dWMHud_c::instance->showPointBar(); - SpammyReport("Point bar shown\n"); } else { startMovementTo(to->getOppositeAvailableExitTo(currentPath)); SpammyReport("passthrough node, continuing to next path\n"); |