diff options
author | Treeki <treeki@gmail.com> | 2013-04-18 00:41:28 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2013-04-18 00:42:11 +0200 |
commit | ad4ca391a7fe8397a4322b44d6c35bc667e9e0ed (patch) | |
tree | 579ff6031a33e2db708990478ca6e05d92fcf5f5 | |
parent | 737948128161916ffa9e5422d910d983179f1e7f (diff) | |
download | kamek-ad4ca391a7fe8397a4322b44d6c35bc667e9e0ed.tar.gz kamek-ad4ca391a7fe8397a4322b44d6c35bc667e9e0ed.zip |
reset static variables used by the world map in File Select
-rw-r--r-- | src/fileselect.S | 5 | ||||
-rw-r--r-- | src/koopatlas/pathmanager.cpp | 17 |
2 files changed, 18 insertions, 4 deletions
diff --git a/src/fileselect.S b/src/fileselect.S index 5847201..25b1805 100644 --- a/src/fileselect.S +++ b/src/fileselect.S @@ -160,6 +160,11 @@ chosenWName: li r5, 0 bl InsertIntIntoTextBox1 +.extern ResetAllCompletionCandidates__Fv +.extern ClearOldPathAvailabilityData__Fv + bl ResetAllCompletionCandidates__Fv + bl ClearOldPathAvailabilityData__Fv + lwz r22, 0x24(r1) lwz r21, 0x28(r1) lwz r20, 0x2C(r1) diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index ad39c69..697b9fb 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -18,6 +18,7 @@ bool CanFinishAllCoins = false; bool CanFinishAllExits = false; bool CanFinishEverything = false; void ResetAllCompletionCandidates() { + // This is called by File Select, btw MaybeFinishingLevel[0] = 0xFF; LastLevelPlayed[0] = 0xFF; CanFinishCoins = false; @@ -273,15 +274,23 @@ void dWMPathManager_c::setup() { static u8 *PathAvailabilityData = 0; static u8 *NodeAvailabilityData = 0; -dWMPathManager_c::~dWMPathManager_c() { - bool entering8_25 = (MaybeFinishingLevel[0] == 7) && (MaybeFinishingLevel[1] == 24); - if (PathAvailabilityData && !isEnteringLevel && !entering8_25) { +void ClearOldPathAvailabilityData() { + // This is called by File Select + if (PathAvailabilityData) { delete[] PathAvailabilityData; PathAvailabilityData = 0; - + } + if (NodeAvailabilityData) { delete[] NodeAvailabilityData; NodeAvailabilityData = 0; } +} + +dWMPathManager_c::~dWMPathManager_c() { + bool entering8_25 = (MaybeFinishingLevel[0] == 7) && (MaybeFinishingLevel[1] == 24); + if (!isEnteringLevel && !entering8_25) { + ClearOldPathAvailabilityData(); + } if (isEnteringLevel) { ResetAllCompletionCandidates(); |