summaryrefslogtreecommitdiff
path: root/src/koopatlas
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/koopatlas/core.cpp9
-rw-r--r--src/koopatlas/core.h1
-rw-r--r--src/koopatlas/pathmanager.cpp20
-rw-r--r--src/koopatlas/player.cpp5
4 files changed, 30 insertions, 5 deletions
diff --git a/src/koopatlas/core.cpp b/src/koopatlas/core.cpp
index 7435103..164ea89 100644
--- a/src/koopatlas/core.cpp
+++ b/src/koopatlas/core.cpp
@@ -429,6 +429,13 @@ bool dScKoopatlas_c::canDoStuff() {
return true;
}
+bool dScKoopatlas_c::mapIsRunning() {
+ if (QueryGlobal5758(0xFFFFFFFF)) return false;
+ if (CheckIfWeCantDoStuff()) return false;
+ if (state.getCurrentState() != &StateID_Normal) return false;
+ return true;
+}
+
int dScKoopatlas_c::onExecute() {
if (!canDoStuff()) return true;
@@ -503,8 +510,6 @@ void dScKoopatlas_c::executeState_Normal() {
} else if (nowPressed & WPAD_A) {
pathManager.unlockAllPaths(0);
}
-
- pathManager.execute();
}
void dScKoopatlas_c::executeState_CSMenu() {
diff --git a/src/koopatlas/core.h b/src/koopatlas/core.h
index 2674977..2a69927 100644
--- a/src/koopatlas/core.h
+++ b/src/koopatlas/core.h
@@ -123,6 +123,7 @@ class dScKoopatlas_c : public dScene_c {
void startLevel(dLevelInfo_c::entry_s *level);
bool canDoStuff();
+ bool mapIsRunning();
};
#endif
diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp
index a9cd003..d329c6d 100644
--- a/src/koopatlas/pathmanager.cpp
+++ b/src/koopatlas/pathmanager.cpp
@@ -41,11 +41,14 @@ void dWMPathManager_c::setup() {
found = true;
currentNode = node;
+ //OSReport("Found CHANGE node: %d %p\n", changeID, node);
+
// figure out where we should move to
dKPPath_s *exitTo = 0;
for (int i = 0; i < 4; i++) {
dKPPath_s *candidateExit = node->exits[i];
+ //OSReport("Candidate exit: %p\n", candidateExit);
if (!candidateExit)
continue;
@@ -55,9 +58,12 @@ void dWMPathManager_c::setup() {
while (true) {
dKPNode_s *destNode = (path->start == srcNode) ? path->end : path->start;
+ //OSReport("Path: %p nodes %p to %p\n", path, srcNode, destNode);
int ct = destNode->getAvailableExitCount();
+ //OSReport("Dest Node available exits: %d; type: %d\n", ct, destNode->type);
if (destNode == node || ct > 2 || destNode->type == dKPNode_s::LEVEL) {
- exitTo = path;
+ exitTo = candidateExit;
+ //OSReport("Accepting this node\n");
break;
}
@@ -84,7 +90,7 @@ void dWMPathManager_c::setup() {
currentNode = pathLayer->nodes[0];
mustComplainToMapCreator = true;
}
-
+
} else {
SpammyReport("saved path node: %d\n", save->current_path_node);
if (save->current_path_node >= pathLayer->nodeCount) {
@@ -567,7 +573,15 @@ void dWMPathManager_c::moveThroughPath() {
if (to->type == dKPNode_s::CHANGE) {
// Go to another map
- isMoving = false;
+
+ // should we continue moving?
+ if (to->getAvailableExitCount() == 1) {
+ OSReport("Stopping");
+ isMoving = false;
+ } else {
+ OSReport("Continuing");
+ startMovementTo(to->getOppositeAvailableExitTo(currentPath));
+ }
SaveBlock *save = GetSaveFile()->GetBlock(-1);
SpammyReport("node: %x, %s", to->destMap, to->destMap);
diff --git a/src/koopatlas/player.cpp b/src/koopatlas/player.cpp
index 51470da..ebd0124 100644
--- a/src/koopatlas/player.cpp
+++ b/src/koopatlas/player.cpp
@@ -38,6 +38,11 @@ int daWMPlayer_c::onDelete() {
int daWMPlayer_c::onExecute() {
+ if (!dScKoopatlas_c::instance->mapIsRunning())
+ return true;
+
+ dScKoopatlas_c::instance->pathManager.execute();
+
this->modelHandler->update();
Vec modifiedPos = {pos.x, pos.y + jumpOffset, pos.z};
this->modelHandler->setSRT(modifiedPos, this->rot, this->scale);