diff options
Diffstat (limited to 'src/bonusRoom.cpp')
-rw-r--r-- | src/bonusRoom.cpp | 89 |
1 files changed, 52 insertions, 37 deletions
diff --git a/src/bonusRoom.cpp b/src/bonusRoom.cpp index 1f60399..7b795f6 100644 --- a/src/bonusRoom.cpp +++ b/src/bonusRoom.cpp @@ -593,7 +593,8 @@ void dSingAlong::RegisterNote(int note) { } else { OSReport("Player failed"); - PlaySound(this, SE_MG_CMN_WIN_CLOSE); + nw4r::snd::SoundHandle handle; + PlaySoundWithFunctionB4(SoundRelatedClass, &handle, SE_MG_CMN_WIN_CLOSE, 1); isResponding = 0; state.setState(&StateID_Failure); } @@ -620,7 +621,9 @@ void dSingAlong::beginState_Prize() { void dSingAlong::executeState_Prize() { if ((timer == 120) && (chorus >= 0)) { // Play a nice success sound, and wait a second - PlaySound(this, SE_MG_IH_PAIR_OK); // SE_MG_IH_NICE or SE_MG_UH_NICE + nw4r::snd::SoundHandle handle; + PlaySoundWithFunctionB4(SoundRelatedClass, &handle, SE_MG_IH_PAIR_OK, 1); + //PlaySound(this, SE_MG_IH_PAIR_OK); // SE_MG_IH_NICE or SE_MG_UH_NICE int p; p = prize[chorus]; @@ -647,7 +650,9 @@ void dSingAlong::executeState_Prize() { } SpawnEffect("Wm_en_blockcloud", 0, &(Vec){pos.x, pos.y+32.0, pos.z+500.0}, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5}); - PlaySound(this, SE_OBJ_ITEM_APPEAR); // SE_OBJ_GOOD_ITEM_APPEAR + nw4r::snd::SoundHandle handle; + PlaySoundWithFunctionB4(SoundRelatedClass, &handle, SE_OBJ_ITEM_APPEAR, 1); + //PlaySound(this, SE_OBJ_ITEM_APPEAR); // SE_OBJ_GOOD_ITEM_APPEAR OSReport("Making the prize model"); PrizeModel = (dSongPrize*)create(WM_SINKSHIP, chorus + (prize[chorus] << 16), &pos, &rot, 0); @@ -680,7 +685,8 @@ void dSingAlong::executeState_Call() { if (timer == (Songs[song][chorus][currentNote][2] * 2)) { OSReport("Playing Note %d", Songs[song][chorus][currentNote][0]); - PlaySoundAsync(this, Notes[Songs[song][chorus][currentNote][1]-1]); + nw4r::snd::SoundHandle handle; + PlaySoundWithFunctionB4(SoundRelatedClass, &handle, Notes[Songs[song][chorus][currentNote][1]-1], 1); Vec effPos; @@ -748,12 +754,17 @@ void dSingAlong::beginState_Failure() { void dSingAlong::executeState_Failure() { // Play a success/failure sound - if (timer == 20) { PlaySound(this, STRM_BGM_MINIGAME_FANFARE_BAD); StopBGMMusic(); } + if (timer == 20) { + nw4r::snd::SoundHandle handle; + PlaySoundWithFunctionB4(SoundRelatedClass, &handle, STRM_BGM_MINIGAME_FANFARE_BAD, 1); + StopBGMMusic(); + } // Delete the big powerup with a poof if it's fail if (timer == 30*1) { SpawnEffect("Wm_en_blockcloud", 0, &(Vec){pos.x, pos.y+32.0, pos.z+500.0}, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5}); - PlaySound(this, SE_MG_IH_NOPAIR_OK); + nw4r::snd::SoundHandle handle; + PlaySoundWithFunctionB4(SoundRelatedClass, &handle, SE_MG_IH_NOPAIR_OK, 1); PrizeModel->Delete(1); } @@ -762,7 +773,8 @@ void dSingAlong::executeState_Failure() { if (timer == 30*5) { if (chorus >= 1) { Pa->doStateChange(&dSongPrize::StateID_Spin); - PlaySoundAsync(this, SE_OBJ_ITEM_FROM_KINOPIO); + nw4r::snd::SoundHandle handle; + PlaySoundWithFunctionB4(SoundRelatedClass, &handle, SE_OBJ_ITEM_FROM_KINOPIO, 1); } else { timer += 29; @@ -772,7 +784,8 @@ void dSingAlong::executeState_Failure() { if (timer == 30*6) { if (chorus >= 2) { Pb->doStateChange(&dSongPrize::StateID_Spin); - PlaySoundAsync(this, SE_OBJ_ITEM_FROM_KINOPIO); + nw4r::snd::SoundHandle handle; + PlaySoundWithFunctionB4(SoundRelatedClass, &handle, SE_OBJ_ITEM_FROM_KINOPIO, 1); } else { timer += 29; @@ -782,7 +795,8 @@ void dSingAlong::executeState_Failure() { if (timer == 30*6) { if (chorus >= 3) { Pc->doStateChange(&dSongPrize::StateID_Spin); - PlaySoundAsync(this, SE_OBJ_ITEM_FROM_KINOPIO); + nw4r::snd::SoundHandle handle; + PlaySoundWithFunctionB4(SoundRelatedClass, &handle, SE_OBJ_ITEM_FROM_KINOPIO, 1); } else { timer += 29; @@ -791,11 +805,16 @@ void dSingAlong::executeState_Failure() { // If victory, make mario do a little dance/sound if (timer == 30*8) { - - if (GetSpecificPlayerActor(0) != 0) { PlaySound(this, SE_VOC_MA_GAME_OVER); } - if (GetSpecificPlayerActor(1) != 0) { PlaySound(this, SE_VOC_LU_GAME_OVER); } - if (GetSpecificPlayerActor(2) != 0) { PlaySound(this, SE_VOC_KO_GAME_OVER); } - if (GetSpecificPlayerActor(3) != 0) { PlaySound(this, SE_VOC_KO2_GAME_OVER); } + nw4r::snd::SoundHandle handle1, handle2, handle3, handle4; + + if (GetSpecificPlayerActor(0) != 0) + PlaySoundWithFunctionB4(SoundRelatedClass, &handle1, SE_VOC_MA_GAME_OVER, 1); + if (GetSpecificPlayerActor(1) != 0) + PlaySoundWithFunctionB4(SoundRelatedClass, &handle1, SE_VOC_LU_GAME_OVER, 1); + if (GetSpecificPlayerActor(2) != 0) + PlaySoundWithFunctionB4(SoundRelatedClass, &handle1, SE_VOC_KO_GAME_OVER, 1); + if (GetSpecificPlayerActor(3) != 0) + PlaySoundWithFunctionB4(SoundRelatedClass, &handle1, SE_VOC_KO2_GAME_OVER, 1); } @@ -818,37 +837,32 @@ void dSingAlong::beginState_Win() { } void dSingAlong::executeState_Win() { // Play a success/failure sound - if (timer == 30) { PlaySound(this, STRM_BGM_MINIGAME_FANFARE_GOOD); StopBGMMusic();} + if (timer == 30) { + nw4r::snd::SoundHandle handle; + PlaySoundWithFunctionB4(SoundRelatedClass, &handle, STRM_BGM_MINIGAME_FANFARE_GOOD, 1); + StopBGMMusic(); + } // Make the banked powerups do a little dance/effect // Play a sound for each powerup gained - if (timer == 30*3) { + if (timer == 30*3 || timer == 30*4 || timer == 30*5 || timer == 30*6) { Pa->doStateChange(&dSongPrize::StateID_Spin); - PlaySoundAsync(this, SE_OBJ_ITEM_FROM_KINOPIO); - } - - if (timer == 30*4) { - Pb->doStateChange(&dSongPrize::StateID_Spin); - PlaySoundAsync(this, SE_OBJ_ITEM_FROM_KINOPIO); - } - - if (timer == 30*5) { - Pc->doStateChange(&dSongPrize::StateID_Spin); - PlaySoundAsync(this, SE_OBJ_ITEM_FROM_KINOPIO); - } - - if (timer == 30*6) { - Pd->doStateChange(&dSongPrize::StateID_Spin); - PlaySoundAsync(this, SE_OBJ_ITEM_FROM_KINOPIO); + nw4r::snd::SoundHandle handle; + PlaySoundWithFunctionB4(SoundRelatedClass, &handle, SE_OBJ_ITEM_FROM_KINOPIO, 1); } // If victory, make mario do a little dance/sound if (timer == 30*8) { + nw4r::snd::SoundHandle handle1, handle2, handle3, handle4; - if (GetSpecificPlayerActor(0) != 0) { PlaySound(this, SE_VOC_MA_CLEAR_MULTI); } - if (GetSpecificPlayerActor(1) != 0) { PlaySound(this, SE_VOC_LU_CLEAR_MULTI); } - if (GetSpecificPlayerActor(2) != 0) { PlaySound(this, SE_VOC_KO_CLEAR_MULTI); } - if (GetSpecificPlayerActor(3) != 0) { PlaySound(this, SE_VOC_KO2_CLEAR_MULTI); } + if (GetSpecificPlayerActor(0) != 0) + PlaySoundWithFunctionB4(SoundRelatedClass, &handle1, SE_VOC_MA_CLEAR_MULTI, 1); + if (GetSpecificPlayerActor(1) != 0) + PlaySoundWithFunctionB4(SoundRelatedClass, &handle1, SE_VOC_LU_CLEAR_MULTI, 1); + if (GetSpecificPlayerActor(2) != 0) + PlaySoundWithFunctionB4(SoundRelatedClass, &handle1, SE_VOC_KO_CLEAR_MULTI, 1); + if (GetSpecificPlayerActor(3) != 0) + PlaySoundWithFunctionB4(SoundRelatedClass, &handle1, SE_VOC_KO2_CLEAR_MULTI, 1); SpawnEffect("Wm_ob_fireworks_y", 0, &(Vec){pos.x-80.0, pos.y+20.0, pos.z+500.0}, &(S16Vec){0,0,0}, &(Vec){0.75, 0.75, 0.75}); } @@ -1089,7 +1103,8 @@ void dSongBlock::blockWasHit(bool isDown) { else if (note == 7) { play = 23; } else if (note == 8) { play = 0; } - PlaySoundAsync(this, Notes[play]); + nw4r::snd::SoundHandle handle; + PlaySoundWithFunctionB4(SoundRelatedClass, &handle, Notes[play], 1); } else { dSingAlong::instance->RegisterNote(this->note); |