From ad610772911d1f3598cf3d2e4076e0e94fd1e0ea Mon Sep 17 00:00:00 2001 From: Treeki Date: Fri, 30 Nov 2012 23:10:08 +0100 Subject: fixes to the map music or something. idk --- src/koopatlas/core.cpp | 9 ++++++++- src/koopatlas/core.h | 3 +++ src/koopatlas/map.cpp | 2 +- src/koopatlas/pathmanager.cpp | 5 ++++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/koopatlas/core.cpp b/src/koopatlas/core.cpp index fd6eace..03b8dae 100644 --- a/src/koopatlas/core.cpp +++ b/src/koopatlas/core.cpp @@ -193,7 +193,8 @@ bool WMInit_LoadResources2(void *ptr) { } if (wm->mapData.load(wm->mapPath)) { - dKPMusic::play(GetSaveFile()->GetBlock(-1)->currentMapMusic); + if (!wm->isFirstPlay) + wm->startMusic(); return true; } else return false; @@ -333,6 +334,10 @@ ActivateWipe(WIPE_MARIO); DoStartLevel(GetGameMgr(), &sl); }*/ +void dScKoopatlas_c::startMusic() { + dKPMusic::play(GetSaveFile()->GetBlock(-1)->currentMapMusic); +} + int dScKoopatlas_c::onCreate() { OSReport("KP scene settings: %08x\n", settings); @@ -405,6 +410,8 @@ int dScKoopatlas_c::onCreate() { SaveBlock *save = GetSaveFile()->GetBlock(-1); currentMapID = save->current_world; + isFirstPlay = (currentMapID == 0) && (settings & 0x80000000); + somethingAboutSound(_8042A788); return true; diff --git a/src/koopatlas/core.h b/src/koopatlas/core.h index 651b628..93cc257 100644 --- a/src/koopatlas/core.h +++ b/src/koopatlas/core.h @@ -112,6 +112,9 @@ class dScKoopatlas_c : public dScene_c { dDvdLoader_c mapListLoader; + bool isFirstPlay; + void startMusic(); + u32 iterateMapList(u32(*callback)(u32,const char *,int,int), u32 userData, int *ptrIndex = 0); const char *getMapNameForIndex(int index); int getIndexForMapName(const char *name); diff --git a/src/koopatlas/map.cpp b/src/koopatlas/map.cpp index c2cb13e..08cc0b3 100644 --- a/src/koopatlas/map.cpp +++ b/src/koopatlas/map.cpp @@ -120,7 +120,7 @@ void dWMMap_c::renderer_c::drawLayers() { baseZ = -100.0f - (2 * data->layerCount); - bool skipFirstLayer = (wm->currentMapID == 0) && !(wm->settings & 0x80000000); + bool skipFirstLayer = (wm->currentMapID == 0) && !(wm->isFirstPlay); beginRendering(); diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index a5e4294..0238cc7 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -116,7 +116,7 @@ void dWMPathManager_c::setup() { else waitAtStart = -1; - if (wm->currentMapID == 0 && wm->settings & 0x80000000) + if (wm->isFirstPlay) waitAtStart = 280; SpammyReport("saved path node: %d\n", save->current_path_node); @@ -423,6 +423,9 @@ void dWMPathManager_c::execute() { nw4r::snd::SoundHandle something; PlaySoundWithFunctionB4(SoundRelatedClass, &something, SE_VOC_MA_CS_COURSE_MISS, 1); } + + if (dScKoopatlas_c::instance->isFirstPlay) + dScKoopatlas_c::instance->startMusic(); } return; } -- cgit v1.2.3