summaryrefslogtreecommitdiff
path: root/src/koopatlas/core.cpp
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2012-11-13 23:28:58 +0100
committerTreeki <treeki@gmail.com>2012-11-13 23:28:58 +0100
commitb81a4623e90eeb1d7a0d9e0f321b54ac6666798a (patch)
tree266ccb56f52f1355cf393f66504e08be302c3940 /src/koopatlas/core.cpp
parenta1ca2b30e4f05037d2a0d60b821e2f8699ab8891 (diff)
downloadkamek-b81a4623e90eeb1d7a0d9e0f321b54ac6666798a.tar.gz
kamek-b81a4623e90eeb1d7a0d9e0f321b54ac6666798a.zip
music fixes?
Diffstat (limited to 'src/koopatlas/core.cpp')
-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;