summaryrefslogtreecommitdiff
path: root/src/koopatlas/pathmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/koopatlas/pathmanager.cpp35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp
index 002b400..a5e4294 100644
--- a/src/koopatlas/pathmanager.cpp
+++ b/src/koopatlas/pathmanager.cpp
@@ -10,6 +10,8 @@ extern "C" void PlaySoundWithFunctionB4(void *spc, nw4r::snd::SoundHandle *handl
static u8 MaybeFinishingLevel[2] = {0xFF,0xFF};
void dWMPathManager_c::setup() {
+ dScKoopatlas_c *wm = dScKoopatlas_c::instance;
+
isMoving = false;
isJumping = false;
scaleAnimProgress = -1;
@@ -17,7 +19,7 @@ void dWMPathManager_c::setup() {
currentPath = 0;
reverseThroughPath = false;
- pathLayer = dScKoopatlas_c::instance->mapData.pathLayer;
+ pathLayer = wm->mapData.pathLayer;
SpammyReport("setting up PathManager\n");
SaveBlock *save = GetSaveFile()->GetBlock(-1);
@@ -29,11 +31,6 @@ void dWMPathManager_c::setup() {
levelStartWait = -1;
unlockPaths();
- if (!countdownToFadeIn)
- waitAtStart = 50;
- else
- waitAtStart = -1;
-
waitForAfterDeathAnim = -1;
mustPlayAfterDeathAnim = false;
if (LastPowerupStoreType == LOSE_LEVEL) {
@@ -45,9 +42,9 @@ void dWMPathManager_c::setup() {
SpammyReport("done\n");
// Figure out what path node to start at
- if (dScKoopatlas_c::instance->settings & 0x10000000) {
+ if (wm->settings & 0x10000000) {
// Start off from a "Change"
- u8 changeID = (dScKoopatlas_c::instance->settings >> 20) & 0xFF;
+ u8 changeID = (wm->settings >> 20) & 0xFF;
SpammyReport("entering at Change ID %d\n", changeID);
SpammyReport("Path layer: %p\n", pathLayer);
SpammyReport("Node count: %d\n", pathLayer->nodeCount);
@@ -112,7 +109,16 @@ void dWMPathManager_c::setup() {
mustComplainToMapCreator = true;
}
+ waitAtStart = -1;
} else {
+ if (!countdownToFadeIn)
+ waitAtStart = 50;
+ else
+ waitAtStart = -1;
+
+ if (wm->currentMapID == 0 && wm->settings & 0x80000000)
+ waitAtStart = 280;
+
SpammyReport("saved path node: %d\n", save->current_path_node);
if (save->current_path_node >= pathLayer->nodeCount) {
SpammyReport("out of bounds (%d), using node 0\n", pathLayer->nodeCount);
@@ -232,7 +238,6 @@ void dWMPathManager_c::unlockPaths() {
if (node->type == node->LEVEL && node->isUnlocked() && node->levelNumber[1] != 99) {
save->completions[node->levelNumber[0]-1][node->levelNumber[1]-1] |= COND_UNLOCKED;
- OSReport("beets: %d-%d\n", node->levelNumber[0], node->levelNumber[1]);
}
}
@@ -590,13 +595,11 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) {
if (Animations[id].initialEffect) {
SpawnEffect(Animations[id].initialEffect, 0, &player->pos, 0, &player->scale);
- daWMPlayer_c::instance->nextNowEffect = Animations[id].initialEffect;
}
if (Animations[id].initialSound != SE_NULL) {
nw4r::snd::SoundHandle something;
PlaySoundWithFunctionB4(SoundRelatedClass, &something, Animations[id].initialSound, 1);
- daWMPlayer_c::instance->nextNowSound = Animations[id].initialSound;
if (Animations[id].initialSound == SE_PLY_JUMP) {
nw4r::snd::SoundHandle something2;
@@ -735,10 +738,12 @@ void dWMPathManager_c::moveThroughPath() {
if (visiblyChange && dWMHud_c::instance)
dWMHud_c::instance->showFooter();
- dScKoopatlas_c::instance->setBGMTrack(world->trackID);
+ dKPMusic::play(world->trackID);
} else if (to->worldID == 0) {
OSReport("No world\n");
+ save->currentMapMusic = 0;
+ dKPMusic::play(0);
save->newerWorldName[0] = 0;
if (dWMHud_c::instance)
dWMHud_c::instance->hideFooter();
@@ -765,6 +770,7 @@ void dWMPathManager_c::moveThroughPath() {
SpammyReport("Change to map ID %d (%s), entrance ID %d\n", save->current_world, to->destMap, to->foreignID);
+ dScKoopatlas_c::instance->keepMusicPlaying = true;
ActivateWipe(to->transition);
DoSceneChange(WORLD_MAP, 0x10000000 | (to->foreignID << 20), 0);
@@ -828,10 +834,7 @@ void dWMPathManager_c::activatePoint() {
levelStartWait = 40;
enteredLevel = dLevelInfo_c::s_info.searchBySlot(w, l);
- if (dScKoopatlas_c::instance->bgm.Exists()) {
- dScKoopatlas_c::instance->bgm.Stop(50);
- dScKoopatlas_c::instance->bgm.DetachSound();
- }
+ dKPMusic::stop();
}
}