diff options
author | Treeki <treeki@gmail.com> | 2013-04-08 22:39:52 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2013-04-08 22:39:52 +0200 |
commit | 3fdfdf680f89a7c9df888f24e14ea21c740b00fa (patch) | |
tree | 2cf4e30385d71223304484d6ede182596e90bda7 | |
parent | 14477e22b48ff6deaa06e6596eb21acdd59a4e90 (diff) | |
download | kamek-3fdfdf680f89a7c9df888f24e14ea21c740b00fa.tar.gz kamek-3fdfdf680f89a7c9df888f24e14ea21c740b00fa.zip |
fix possible bug with fading in paths after a map switch
-rw-r--r-- | src/koopatlas/pathmanager.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index 579934a..b555b41 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -504,9 +504,15 @@ void dWMPathManager_c::unlockPaths() { newlyAvailablePaths = 0; newlyAvailableNodes = 0; - if (oldPathAvData) { + dScKoopatlas_c *wm = dScKoopatlas_c::instance; + bool forceFlag = (wm->isAfter8Castle || wm->isAfterKamekCutscene); + + if (oldPathAvData || forceFlag) { for (int i = 0; i < pathLayer->pathCount; i++) { - if ((PathAvailabilityData[i] > 0) && (oldPathAvData[i] == 0)) { + if ((PathAvailabilityData[i] > 0) && (forceFlag || oldPathAvData[i] == 0)) { + if (forceFlag && PathAvailabilityData[i] == dKPPath_s::ALWAYS_AVAILABLE) + continue; + dKPPath_s *path = pathLayer->paths[i]; path->isAvailable = dKPPath_s::NEWLY_AVAILABLE; newlyAvailablePaths++; @@ -515,17 +521,20 @@ void dWMPathManager_c::unlockPaths() { path->setLayerAlpha(0); } } - delete[] oldPathAvData; // check nodes too for (int i = 0; i < pathLayer->nodeCount; i++) { - if ((NodeAvailabilityData[i] > 0) && (oldNodeAvData[i] == 0)) { + if ((NodeAvailabilityData[i] > 0) && (forceFlag || oldNodeAvData[i] == 0)) { dKPNode_s *node = pathLayer->nodes[i]; node->isNew = true; newlyAvailableNodes++; } } - delete[] oldNodeAvData; + + if (oldPathAvData) { + delete[] oldPathAvData; + delete[] oldNodeAvData; + } } // now set all node alphas |