summaryrefslogtreecommitdiff
path: root/src/koopatlas/core.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/koopatlas/core.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/koopatlas/core.cpp b/src/koopatlas/core.cpp
index 317c86c..5734300 100644
--- a/src/koopatlas/core.cpp
+++ b/src/koopatlas/core.cpp
@@ -2,6 +2,7 @@
#include "koopatlas/camera.h"
#include "koopatlas/player.h"
#include "koopatlas/subplayer.h"
+#include "music.h"
extern "C" void LoadMapScene();
@@ -192,7 +193,11 @@ bool WMInit_LoadResources2(void *ptr) {
OSReport("Load map: %s\n", wm->mapPath);
}
- return wm->mapData.load(wm->mapPath);
+ if (wm->mapData.load(wm->mapPath)) {
+ wm->playBGM();
+ return true;
+ } else
+ return false;
}
bool WMInit_SetupWait(void *ptr) {
@@ -302,8 +307,6 @@ bool WMInit_SetupWipe(void *ptr) {
SpammyReport("WMInit_SetupWipe returning true\n");
- wm->playBGM();
-
return true;
}
@@ -416,7 +419,6 @@ int dScKoopatlas_c::onCreate() {
return true;
}
-u8 hijackMusicWithSongName(const char *songName, int themeID, bool hasFast, bool useDrums, int *wantRealStreamID);
extern "C" void PlaySoundWithFunctionB4(void *spc, nw4r::snd::SoundHandle *handle, int id, int unk);
void dScKoopatlas_c::playBGM() {
@@ -442,11 +444,12 @@ void dScKoopatlas_c::playBGM() {
int realStreamID;
OSReport("I'm going to play %s!\n", cleanName);
- hijackMusicWithSongName(cleanName, -1, false, false, &realStreamID);
+ hijackMusicWithSongName(cleanName, -1, false, 16, 8, &realStreamID);
OSReport("Real Stream ID: %d\n", realStreamID);
PlaySoundWithFunctionB4(SoundRelatedClass, &bgm, realStreamID, 1);
currentBGMTrack = GetSaveFile()->GetBlock(-1)->currentMapMusic;
+ OSReport("Enabling track %d by setting bitfield 0x%x to volume 1.0f and bitfield 0x%x to volume 0.0f; both over 0 frames\n", currentBGMTrack, 1 << currentBGMTrack, 0xFF ^ (1 << currentBGMTrack));
bgm.SetTrackVolume(0xFF ^ (1 << currentBGMTrack), 0, 0.0f);
bgm.SetTrackVolume(1 << currentBGMTrack, 0, 1.0f);
}
@@ -455,6 +458,7 @@ void dScKoopatlas_c::setBGMTrack(int trackID) {
if (currentBGMTrack == trackID)
return;
+ OSReport("Enabling track %d and disabling track %d by setting bitfield 0x%x to volume 1.0f and bitfield 0x%x to volume 0.0f; both over 30 frames\n", trackID, currentBGMTrack, 1 << trackID, 1 << currentBGMTrack);
bgm.SetTrackVolume(1 << currentBGMTrack, 30, 0.0f);
bgm.SetTrackVolume(1 << trackID, 30, 1.0f);
currentBGMTrack = trackID;