summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/koopatlas/pathmanager.cpp50
-rw-r--r--src/koopatlas/pathmanager.h4
2 files changed, 43 insertions, 11 deletions
diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp
index a80c2b4..300e628 100644
--- a/src/koopatlas/pathmanager.cpp
+++ b/src/koopatlas/pathmanager.cpp
@@ -11,6 +11,7 @@ void dWMPathManager_c::setup() {
timer = 0.0;
currentPath = 0;
reverseThroughPath = false;
+ beginWait = 120;
pathLayer = dScKoopatlas_c::instance->mapData.pathLayer;
@@ -21,6 +22,7 @@ void dWMPathManager_c::setup() {
SpammyReport("Unlocking paths\n");
isEnteringLevel = false;
+ levelStartWait = -1;
unlockPaths();
SpammyReport("done\n");
@@ -283,21 +285,44 @@ bool dWMPathManager_c::evaluateUnlockCondition(u8 *&in, SaveBlock *save, int sta
void dWMPathManager_c::execute() {
+ if (beginWait > 0) {
+ beginWait--;
+ return;
+ }
+
+ if (isEnteringLevel) {
+ if (levelStartWait > 0) {
+ levelStartWait--;
+ if (levelStartWait == 0) {
+ dScKoopatlas_c::instance->startLevel(enteredLevel);
+ }
+ }
+ return;
+ }
+
int nowPressed = Remocon_GetPressed(GetActiveRemocon());
if (isMoving) {
moveThroughPath();
} else {
- if (nowPressed & WPAD_LEFT && canUseExit(currentNode->leftExit))
- startMovementTo(currentNode->leftExit);
- else if (nowPressed & WPAD_RIGHT && canUseExit(currentNode->rightExit))
- startMovementTo(currentNode->rightExit);
- else if (nowPressed & WPAD_UP && canUseExit(currentNode->upExit))
- startMovementTo(currentNode->upExit);
- else if (nowPressed & WPAD_DOWN && canUseExit(currentNode->downExit))
- startMovementTo(currentNode->downExit);
+ // Left, right, up, down
+ int pressedDir = -1;
+ if (nowPressed & WPAD_LEFT) pressedDir = 0;
+ else if (nowPressed & WPAD_RIGHT) pressedDir = 1;
+ else if (nowPressed & WPAD_UP) pressedDir = 2;
+ else if (nowPressed & WPAD_DOWN) pressedDir = 3;
else if (nowPressed & WPAD_TWO)
activatePoint();
+
+ if (pressedDir >= 0) {
+ if (canUseExit(currentNode->exits[pressedDir])) {
+ startMovementTo(currentNode->exits[pressedDir]);
+ } else {
+ // TODO: maybe remove this? got to see how it looks
+ static u16 directions[] = {-0x4000,0x4000,-0x7FFF,0};
+ daWMPlayer_c::instance->rot.y = directions[pressedDir];
+ }
+ }
}
// handle path fading
@@ -590,6 +615,9 @@ void dWMPathManager_c::moveThroughPath() {
}
void dWMPathManager_c::activatePoint() {
+ if (levelStartWait >= 0)
+ return;
+
if (currentNode->type == dKPNode_s::LEVEL) {
int w = currentNode->levelNumber[0] - 1;
int l = currentNode->levelNumber[1] - 1;
@@ -613,11 +641,11 @@ void dWMPathManager_c::activatePoint() {
MapSoundPlayer(SoundRelatedClass, SE_SYS_GAME_START, 1);
daWMPlayer_c::instance->startAnimation(170, 1.2, 10.0, 0.0);
+ daWMPlayer_c::instance->rot.y = 0;
isEnteringLevel = true;
-
- dLevelInfo_c::entry_s *level = dScKoopatlas_c::instance->levelInfo.search(w, l);
- dScKoopatlas_c::instance->startLevel(level);
+ levelStartWait = 40;
+ enteredLevel = dScKoopatlas_c::instance->levelInfo.search(w, l);
}
}
diff --git a/src/koopatlas/pathmanager.h b/src/koopatlas/pathmanager.h
index d22168b..6f2e763 100644
--- a/src/koopatlas/pathmanager.h
+++ b/src/koopatlas/pathmanager.h
@@ -19,6 +19,8 @@ class dWMPathManager_c {
return (path != 0) && (path->isAvailable);
}
+ int beginWait;
+
void startMovementTo(dKPPath_s *path);
void moveThroughPath();
void activatePoint();
@@ -53,6 +55,8 @@ class dWMPathManager_c {
bool evaluateUnlockCondition(u8 *&in, SaveBlock *save, int stack);
bool isEnteringLevel;
+ int levelStartWait;
+ dLevelInfo_c::entry_s *enteredLevel;
};
#endif