diff options
author | Colin Noga <Tempus@chronometry.ca> | 2012-09-26 11:51:03 -0500 |
---|---|---|
committer | Colin Noga <Tempus@chronometry.ca> | 2012-09-26 11:51:03 -0500 |
commit | f9afbf1109b30bbc6011e81109b7e11961a4361a (patch) | |
tree | 46883b3ccd9ab82b439c192a657e0632414e906a /src/koopatlas/pathmanager.cpp | |
parent | 3268b1fab87a34897289faa8a1f5ee0679f74e19 (diff) | |
parent | 46b65dfd76411bec6f8356c581f337f8a1944013 (diff) | |
download | kamek-f9afbf1109b30bbc6011e81109b7e11961a4361a.tar.gz kamek-f9afbf1109b30bbc6011e81109b7e11961a4361a.zip |
Merge remote-tracking branch 'origin/new-hud' into level-select
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"); |