diff options
Diffstat (limited to 'src/koopatlas/pathmanager.cpp')
-rw-r--r-- | src/koopatlas/pathmanager.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index 64e001a..49ba3cd 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -4,6 +4,8 @@ #include "koopatlas/player.h" #include <sfx.h> +static u8 MaybeFinishingLevel[2] = {0xFF,0xFF}; + void dWMPathManager_c::setup() { isMoving = false; isJumping = false; @@ -107,6 +109,16 @@ void dWMPathManager_c::setup() { for (int i = 0; i < pathLayer->nodeCount; i++) if (pathLayer->nodes[i]->type == dKPNode_s::LEVEL) pathLayer->nodes[i]->setupNodeExtra(); + + // did we just beat a level? + if (MaybeFinishingLevel[0] != 0xFF) { + SaveBlock *save = GetSaveFile()->GetBlock(-1); + if (save->CheckLevelCondition(MaybeFinishingLevel[0], MaybeFinishingLevel[1], COND_NORMAL)) { + shouldRequestSave = true; + } + + MaybeFinishingLevel[0] = 0xFF; + } } static u8 *PathAvailabilityData = 0; @@ -120,6 +132,16 @@ dWMPathManager_c::~dWMPathManager_c() { delete[] NodeAvailabilityData; NodeAvailabilityData = 0; } + + if (isEnteringLevel) { + SaveBlock *save = GetSaveFile()->GetBlock(-1); + if (enteredLevel->displayLevel >= 21 && enteredLevel->displayLevel <= 28 && enteredLevel->displayLevel != 26) { + if (!save->CheckLevelCondition(enteredLevel->worldSlot, enteredLevel->levelSlot, COND_NORMAL)) { + MaybeFinishingLevel[0] = enteredLevel->worldSlot; + MaybeFinishingLevel[1] = enteredLevel->levelSlot; + } + } + } } void dWMPathManager_c::unlockPaths() { @@ -348,6 +370,11 @@ void dWMPathManager_c::execute() { return; } + if (shouldRequestSave) { + dScKoopatlas_c::instance->showSaveWindow(); + shouldRequestSave = false; + } + int nowPressed = Remocon_GetPressed(GetActiveRemocon()); if (isMoving) { |