From ef835d9dd72a5d70e5361f87654e6aa1f0ae35a5 Mon Sep 17 00:00:00 2001 From: Treeki Date: Tue, 28 Aug 2012 05:43:53 +0200 Subject: fixed some bugs in the path manager --- src/koopatlas/pathmanager.cpp | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index 9ecc8d5..6c58107 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -18,6 +18,11 @@ void dWMPathManager_c::setup() { mustComplainToMapCreator = false; + SpammyReport("Unlocking paths\n"); + isEnteringLevel = false; + unlockPaths(); + SpammyReport("done\n"); + // Figure out what path node to start at if (dScKoopatlas_c::instance->settings & 0x10000000) { // Start off from a "Change" @@ -61,11 +66,6 @@ void dWMPathManager_c::setup() { } } - SpammyReport("Unlocking paths\n"); - isEnteringLevel = false; - unlockPaths(); - SpammyReport("done\n"); - for (int i = 0; i < pathLayer->nodeCount; i++) if (pathLayer->nodes[i]->type == dKPNode_s::LEVEL) pathLayer->nodes[i]->setupNodeExtra(); @@ -489,14 +489,20 @@ void dWMPathManager_c::moveThroughPath() { SpammyReport("reached path end (%p)\n", to); - // Quick check: do we *actually* need to stop on this node? - // If it's a junction with more than two exits, but only two are open, - // take the opposite open one - bool stopOverride = false; + bool reallyStop = false; - if (to->type == dKPNode_s::STOP) { - if (to->getExitCount() > 2 && to->getAvailableExitCount() == 2) - stopOverride = true; + if (to->type == dKPNode_s::PASS_THROUGH) { + // If there's only one exit here, then stop even though + // it's a passthrough node + reallyStop = (to->getAvailableExitCount() == 1); + } else { + // Quick check: do we *actually* need to stop on this node? + // If it's a junction with more than two exits, but only two are open, + // take the opposite open one + if (to->getExitCount() > 2 && to->getAvailableExitCount() == 2) + reallyStop = false; + else + reallyStop = true; } if (to->type == dKPNode_s::CHANGE) { @@ -511,7 +517,7 @@ void dWMPathManager_c::moveThroughPath() { DoSceneChange(WORLD_MAP, 0x10000000 | to->foreignID, 0); - } else if (to->type != dKPNode_s::PASS_THROUGH && !stopOverride) { + } else if (reallyStop) { // Stop here player->startAnimation(0, 1.2, 10.0, 0.0); player->hasEffect = false; -- cgit v1.2.3