From ad4ca391a7fe8397a4322b44d6c35bc667e9e0ed Mon Sep 17 00:00:00 2001 From: Treeki Date: Thu, 18 Apr 2013 00:41:28 +0200 Subject: reset static variables used by the world map in File Select --- src/fileselect.S | 5 +++++ 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(); -- cgit v1.2.3 From fcc2e32771bf44fbd5346b7bd2050f2434ae6fa0 Mon Sep 17 00:00:00 2001 From: Treeki Date: Thu, 18 Apr 2013 00:41:37 +0200 Subject: stop Peach harp fanfare properly --- src/endingMgr.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/endingMgr.cpp b/src/endingMgr.cpp index ef40613..09dfc3c 100644 --- a/src/endingMgr.cpp +++ b/src/endingMgr.cpp @@ -47,6 +47,11 @@ int dEndingMgr_c::onCreate() { } int dEndingMgr_c::onDelete() { + nw4r::snd::SoundHandle *fanfare = (nw4r::snd::SoundHandle*) + (((u32)SoundRelatedClass) + 0x900); + if (fanfare->Exists()) + fanfare->Stop(60); + daBossDemo_c::onDelete(); WLClass::instance->disableDemoControl(true); return true; @@ -216,6 +221,7 @@ void dEndingMgr_c::executeState_ThanksPeach() { if (peach->stage == 1 && peachSt == &peach->StateID_Turn) { timer++; if (timer == 1) { + // This plays the Peach harp fanfare sub_8019C390(_8042A788, 6); } if (timer > 20) { -- cgit v1.2.3 From 67a38c9e11d11e4e5113e25665bb902026a6b7a6 Mon Sep 17 00:00:00 2001 From: Treeki Date: Thu, 18 Apr 2013 00:41:50 +0200 Subject: stop fireworks on staffroll command 20 OR after 480 frames --- src/creditsMgr.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/creditsMgr.cpp b/src/creditsMgr.cpp index d66083d..c13d906 100644 --- a/src/creditsMgr.cpp +++ b/src/creditsMgr.cpp @@ -106,6 +106,7 @@ class dCreditsMgr_c : public dActorState_c { bool fireworks; int fireworksCountdown; + int endFWAfter; int fauxScrollFrame; float fauxScrollMinX, fauxScrollMaxX, fauxScrollY; @@ -245,6 +246,10 @@ int dCreditsMgr_c::onExecute() { nw4r::snd::SoundHandle handle; PlaySoundWithFunctionB4(SoundRelatedClass, &handle, SE_OBJ_GOAL_FIREWORKS, 1); + + endFWAfter--; + if (endFWAfter <= 0) + fireworks = false; } } @@ -361,6 +366,10 @@ int dCreditsMgr_c::onExecute() { case 19: fireworks = true; fireworksCountdown = 25; + endFWAfter = 480; + break; + case 20: + fireworks = false; break; } } -- cgit v1.2.3