summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2012-12-06 02:02:10 +0100
committerTreeki <treeki@gmail.com>2012-12-06 02:02:10 +0100
commitffed316fb7d237065f51265d0be33dd9cee90a9a (patch)
tree12b4c7f009d994f38bee2ce3ddc66382b8b687a1 /src
parent42069c9299c18891a81efeeb45d19007d80c70c1 (diff)
downloadkamek-ffed316fb7d237065f51265d0be33dd9cee90a9a.tar.gz
kamek-ffed316fb7d237065f51265d0be33dd9cee90a9a.zip
fixed the KP map switching crash bug
Diffstat (limited to 'src')
-rw-r--r--src/koopatlas/core.cpp6
-rw-r--r--src/koopatlas/mapmusic.cpp10
-rw-r--r--src/koopatlas/mapmusic.h1
3 files changed, 11 insertions, 6 deletions
diff --git a/src/koopatlas/core.cpp b/src/koopatlas/core.cpp
index 03b8dae..71122e5 100644
--- a/src/koopatlas/core.cpp
+++ b/src/koopatlas/core.cpp
@@ -47,6 +47,7 @@ dScKoopatlas_c *dScKoopatlas_c::build() {
}
bool WMInit_StartLoading(void*);
+bool WMInit_LoadStaticFiles(void*);
bool StockWMInit_LoadEffects(void*);
bool WMInit_LoadSIAnims(void*);
bool WMInit_EndLoading(void*);
@@ -58,6 +59,7 @@ bool WMInit_SetupWipe(void*);
ChainedFunc initFunctions[] = {
WMInit_StartLoading,
+ WMInit_LoadStaticFiles,
StockWMInit_LoadEffects,
WMInit_LoadSIAnims,
WMInit_EndLoading,
@@ -135,6 +137,10 @@ bool WMInit_StartLoading(void *ptr) {
return true;
}
+bool WMInit_LoadStaticFiles(void *ptr) {
+ return dKPMusic::loadInfo();
+}
+
bool WMInit_LoadSIAnims(void *ptr) {
SpammyReport("WMInit_LoadSIAnims called\n");
diff --git a/src/koopatlas/mapmusic.cpp b/src/koopatlas/mapmusic.cpp
index 1ccd775..8fdf264 100644
--- a/src/koopatlas/mapmusic.cpp
+++ b/src/koopatlas/mapmusic.cpp
@@ -13,7 +13,6 @@ static int s_countdownToSwitch = -1;
static int s_countdownToFadeIn = -1;
static dDvdLoader_c s_adpcmInfoLoader;
-static bool s_adpcmInfoLoaded = false;
#define FADE_OUT_LEN 30
#define FADE_IN_LEN 30
@@ -59,12 +58,11 @@ extern "C" void DVDCancel(void *crap);
extern "C" void AxVoice_SetADPCM(void *axVoice, void *adpcm);
extern "C" void Voice_SetADPCMLoop(void *voice, int channel, void *adpcmLoop);
-void dKPMusic::execute() {
- if (!s_adpcmInfoLoaded) {
- if (s_adpcmInfoLoader.load("/NewerRes/MapADPCMInfo.bin"))
- s_adpcmInfoLoaded = true;
- }
+bool dKPMusic::loadInfo() {
+ return s_adpcmInfoLoader.load("/NewerRes/MapADPCMInfo.bin");
+}
+void dKPMusic::execute() {
if (!s_playing)
return;
diff --git a/src/koopatlas/mapmusic.h b/src/koopatlas/mapmusic.h
index 785f870..e5d69f2 100644
--- a/src/koopatlas/mapmusic.h
+++ b/src/koopatlas/mapmusic.h
@@ -3,6 +3,7 @@
class dKPMusic {
public:
+ static bool loadInfo();
static void play(int id);
static void execute();
static void stop();