summaryrefslogtreecommitdiff
path: root/src/koopatlas
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/koopatlas/core.cpp7
-rw-r--r--src/koopatlas/core.h2
-rw-r--r--src/koopatlas/pathmanager.cpp27
-rw-r--r--src/koopatlas/pathmanager.h1
4 files changed, 37 insertions, 0 deletions
diff --git a/src/koopatlas/core.cpp b/src/koopatlas/core.cpp
index b43b62a..8584ee9 100644
--- a/src/koopatlas/core.cpp
+++ b/src/koopatlas/core.cpp
@@ -1057,6 +1057,13 @@ int dScKoopatlas_c::getIndexForMapName(const char *name) {
}
+void dScKoopatlas_c::showSaveWindow() {
+ state.setState(&StateID_SaveOpen);
+ YESNO_TYPE(yesNoWindow) = 1;
+ YESNO_VISIBLE(yesNoWindow) = 1;
+}
+
+
void NewerMapDrawFunc() {
Reset3DState();
SetCurrentCameraID(0);
diff --git a/src/koopatlas/core.h b/src/koopatlas/core.h
index cfac014..7e86d72 100644
--- a/src/koopatlas/core.h
+++ b/src/koopatlas/core.h
@@ -124,6 +124,8 @@ class dScKoopatlas_c : public dScene_c {
bool canDoStuff();
bool mapIsRunning();
+
+ void showSaveWindow();
};
#endif
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) {
diff --git a/src/koopatlas/pathmanager.h b/src/koopatlas/pathmanager.h
index d0e1de0..98a68d6 100644
--- a/src/koopatlas/pathmanager.h
+++ b/src/koopatlas/pathmanager.h
@@ -63,6 +63,7 @@ class dWMPathManager_c {
bool evaluateUnlockCondition(u8 *&in, SaveBlock *save, int stack);
public:
+ bool shouldRequestSave;
bool isEnteringLevel;
bool calledEnteredNode;