diff options
author | Colin Noga <Tempus@chronometry.ca> | 2013-04-19 12:52:07 -0500 |
---|---|---|
committer | Colin Noga <Tempus@chronometry.ca> | 2013-04-19 12:52:07 -0500 |
commit | 8c8705cc19e6422b125f2c0bd3c4f0d26f1297a0 (patch) | |
tree | 448a249c7a17a4f34f7c43debd1e6dd212134588 /src/bonusRoom.cpp | |
parent | e995db7180b91d2cf1c74b7a678e36679faac09c (diff) | |
download | kamek-8c8705cc19e6422b125f2c0bd3c4f0d26f1297a0.tar.gz kamek-8c8705cc19e6422b125f2c0bd3c4f0d26f1297a0.zip |
Song house timing and ending touch ups
Diffstat (limited to 'src/bonusRoom.cpp')
-rw-r--r-- | src/bonusRoom.cpp | 203 |
1 files changed, 134 insertions, 69 deletions
diff --git a/src/bonusRoom.cpp b/src/bonusRoom.cpp index 3da91fd..61bea87 100644 --- a/src/bonusRoom.cpp +++ b/src/bonusRoom.cpp @@ -149,7 +149,7 @@ int Songs[16][4][16][3] = { {{5,14,0},{4,13,10},{6,16,12},{5,14,14},{3,9,16},{1,6,26},{2,7,28},{3,9,30},{3,9,32},{2,7,38},{0,0,0}}, {{6,16,0},{5,15,10},{7,18,12},{6,16,14},{4,14,16},{3,13,22},{2,11,26},{3,13,30},{2,11,32},{1,9,38},{0,0,0}}, {{6,21,0},{5,20,10},{7,23,12},{6,21,14},{4,19,16},{3,18,22},{4,19,32},{3,18,42},{6,21,44},{4,19,46},{3,18,48},{1,16,54},{0,0,0}}, - {{5,18,0},{4,17,10},{6,19,12},{5,18,14},{4,16,16},{3,15,22},{5,18,26},{4,16,30},{2,14,32},{1,13,38},{2,14,48},{4,16,54},{0,0,0}} + {{5,18,0},{4,17,10},{6,19,12},{5,18,14},{4,16,16},{3,15,22},{5,18,26},{4,16,30},{2,14,32},{1,13,38},{2,14,44},{4,16,48},{0,0,0}} }, { // Song 16 - Overworld or Cave @@ -523,6 +523,7 @@ class dSingAlong : public dStageActor_c { int counter; int Powerups[10]; int isResponding; + int success; dStateWrapper_c<dSingAlong> state; @@ -534,6 +535,7 @@ class dSingAlong : public dStageActor_c { DECLARE_STATE(Prize); DECLARE_STATE(Failure); DECLARE_STATE(Win); + DECLARE_STATE(Mistake); }; dSingAlong *dSingAlong::instance = 0; @@ -561,6 +563,7 @@ int dSingAlong::onCreate() { this->prize[3] = (this->settings >> 16) & 0xF; this->chorus = -1; this->currentNote = 0; + this->success = 0; this->Powerups[0] = 0; // Mushroom this->Powerups[1] = 0; // Fireflower @@ -615,6 +618,8 @@ void dSingAlong::RegisterNote(int note) { OSReport("Register Note begins: %d", note); OSReport("Responding is: %d", isResponding); + nw4r::snd::SoundHandle handle; + if (isResponding == 1) { OSReport("State was checked"); @@ -625,11 +630,10 @@ void dSingAlong::RegisterNote(int note) { currentNote += 1; } else { - OSReport("Player failed"); - nw4r::snd::SoundHandle handle; + OSReport("Player made a mistake"); PlaySoundWithFunctionB4(SoundRelatedClass, &handle, SE_MG_CMN_WIN_CLOSE, 1); isResponding = 0; - state.setState(&StateID_Failure); + state.setState(&StateID_Mistake); } } } @@ -767,19 +771,21 @@ void dSingAlong::executeState_Response() { isResponding = 0; OSReport("Switching to some other mode: %d", isResponding); MakeMarioEnterDemoMode(); - state.setState(&StateID_Prize); + this->success = this->success + 1; + if (success == 4) + state.setState(&StateID_Failure); + else + state.setState(&StateID_Prize); } } void dSingAlong::endState_Response() {} -/*****************************************************************************/ -// Failure -CREATE_STATE(dSingAlong, Failure); - -void dSingAlong::beginState_Failure() { - this->timer = 0; +//*****************************************************************************/ +// Prize +CREATE_STATE(dSingAlong, Mistake); +void dSingAlong::beginState_Mistake() { SBa->unglow(); SBb->unglow(); SBc->unglow(); @@ -789,92 +795,144 @@ void dSingAlong::beginState_Failure() { SBg->unglow(); MakeMarioEnterDemoMode(); + this->timer = 120; + chorus += 1; } -void dSingAlong::executeState_Failure() { - if (timer == 5 && chorus == 0) - for (int i = 0; i < 4; i++) - if (dAcPy_c *player = dAcPy_c::findByID(i)) - player->setAnimePlayWithAnimID(dm_surprise); +void dSingAlong::executeState_Mistake() { - // Play a success/failure sound - if (timer == 20) { + // if (timer == 145) + // for (int i = 0; i < 4; i++) + // if (dAcPy_c *player = dAcPy_c::findByID(i)) + // player->setAnimePlayWithAnimID(dm_surprise); + + if (timer == 60) { nw4r::snd::SoundHandle handle; - PlaySoundWithFunctionB4(SoundRelatedClass, &handle, STRM_BGM_MINIGAME_FANFARE_BAD, 1); - StopBGMMusic(); + PlaySoundWithFunctionB4(SoundRelatedClass, &handle, SE_MG_IH_NOPAIR_NG, 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}); + PrizeModel->Delete(1); } - if (timer == 260 && chorus > 0) { - nw4r::snd::SoundHandle handle; - PlaySoundWithFunctionB4(SoundRelatedClass, &handle, STRM_BGM_MINIGAME_FANFARE_GOOD, 1); - for (int i = 0; i < 4; i++) - if (dAcPy_c *player = dAcPy_c::findByID(i)) { - player->setAnimePlayWithAnimID(dm_glad); - player->setFlag(0x24); - } + if (chorus == 3 && timer == 15) { + state.setState(&StateID_Failure); + return; } - // Delete the big powerup with a poof if it's fail - if (timer == 30*1) { + if (timer == 0) { 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}); nw4r::snd::SoundHandle handle; - PlaySoundWithFunctionB4(SoundRelatedClass, &handle, SE_MG_IH_NOPAIR_OK, 1); - PrizeModel->Delete(1); - if (chorus == 0) - timer += 140; + PlaySoundWithFunctionB4(SoundRelatedClass, &handle, SE_OBJ_ITEM_APPEAR, 1); + + OSReport("Making the prize model"); + PrizeModel = (dSongPrize*)create(WM_SINKSHIP, chorus + (prize[chorus] << 16), &pos, &rot, 0); + OSReport("Prize Model Made"); } - // Make the banked powerups do a little dance/effect - // Play a sound for each powerup gained - if (timer == 30*9) { - if (chorus >= 1) { - Pa->doStateChange(&dSongPrize::StateID_Spin); - nw4r::snd::SoundHandle handle; - PlaySoundWithFunctionB4(SoundRelatedClass, &handle, SE_OBJ_ITEM_FROM_KINOPIO, 1); - } - else { - timer += 29; - } + if (timer == -90) { + state.setState(&StateID_Call); } - if (timer == 30*10) { - if (chorus >= 2) { - Pb->doStateChange(&dSongPrize::StateID_Spin); - nw4r::snd::SoundHandle handle; - PlaySoundWithFunctionB4(SoundRelatedClass, &handle, SE_OBJ_ITEM_FROM_KINOPIO, 1); + timer -= 1; +} +void dSingAlong::endState_Mistake() { + + if (chorus != 3) { + SBa->isDead = 0; + SBb->isDead = 0; + SBc->isDead = 0; + SBd->isDead = 0; + SBe->isDead = 0; + SBf->isDead = 0; + SBg->isDead = 0; + } +} + +/*****************************************************************************/ +// Failure +CREATE_STATE(dSingAlong, Failure); + +void dSingAlong::beginState_Failure() { + this->timer = 0; + + MakeMarioEnterDemoMode(); +} +void dSingAlong::executeState_Failure() { + if (timer == 5) { + if (success == 0) { + for (int i = 0; i < 4; i++) + if (dAcPy_c *player = dAcPy_c::findByID(i)) + player->setAnimePlayWithAnimID(dm_surprise); } else { - timer += 29; + for (int i = 0; i < 4; i++) + if (dAcPy_c *player = dAcPy_c::findByID(i)) { + player->setAnimePlayWithAnimID(dm_glad); + player->setFlag(0x24); + } } } - if (timer == 30*11) { - if (chorus >= 3) { - Pc->doStateChange(&dSongPrize::StateID_Spin); + // Play a success/failure sound + if (timer == 20) { + StopBGMMusic(); + nw4r::snd::SoundHandle handle; + + if (success == 0) + PlaySoundWithFunctionB4(SoundRelatedClass, &handle, STRM_BGM_MINIGAME_FANFARE_BAD, 1); + else + PlaySoundWithFunctionB4(SoundRelatedClass, &handle, STRM_BGM_MINIGAME_FANFARE_GOOD, 1); + } + + // 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}); + // nw4r::snd::SoundHandle handle; + // PlaySoundWithFunctionB4(SoundRelatedClass, &handle, SE_MG_IH_NOPAIR_OK, 1); + // PrizeModel->Delete(1); + // if (chorus == 0) + // timer += 140; + // } + + // Make the banked powerups do a little dance/effect + // Play a sound for each powerup gained + if (timer == 30*2 || timer == 30*3 || timer == 30*4 || timer == 30*5) { + dSongPrize *dancer = 0; + if (timer == 30*2) + dancer = Pa; + else if (timer == 30*3) + dancer = Pb; + else if (timer == 30*4) + dancer = Pc; + else if (timer == 30*5) + dancer = Pd; + + if (dancer) { + dancer->doStateChange(&dSongPrize::StateID_Spin); nw4r::snd::SoundHandle handle; PlaySoundWithFunctionB4(SoundRelatedClass, &handle, SE_OBJ_ITEM_FROM_KINOPIO, 1); } else { timer += 29; - } + } } // If victory, make mario do a little dance/sound - if (timer == 30*13) { + if (timer == 30*7) { nw4r::snd::SoundHandle handle1, handle2, handle3, handle4; if (GetSpecificPlayerActor(0) != 0) - PlaySoundWithFunctionB4(SoundRelatedClass, &handle1, (chorus == 0) ? SE_VOC_MA_CS_COURSE_MISS : SE_VOC_MA_CLEAR_MULTI, 1); + PlaySoundWithFunctionB4(SoundRelatedClass, &handle1, (success == 0) ? SE_VOC_MA_CS_COURSE_MISS : SE_VOC_MA_CLEAR_MULTI, 1); if (GetSpecificPlayerActor(1) != 0) - PlaySoundWithFunctionB4(SoundRelatedClass, &handle2, (chorus == 0) ? SE_VOC_LU_CS_COURSE_MISS : SE_VOC_LU_CLEAR_MULTI, 1); + PlaySoundWithFunctionB4(SoundRelatedClass, &handle2, (success == 0) ? SE_VOC_LU_CS_COURSE_MISS : SE_VOC_LU_CLEAR_MULTI, 1); if (GetSpecificPlayerActor(2) != 0) - PlaySoundWithFunctionB4(SoundRelatedClass, &handle3, (chorus == 0) ? SE_VOC_KO_CS_COURSE_MISS : SE_VOC_KO_CLEAR_MULTI, 1); + PlaySoundWithFunctionB4(SoundRelatedClass, &handle3, (success == 0) ? SE_VOC_KO_CS_COURSE_MISS : SE_VOC_KO_CLEAR_MULTI, 1); if (GetSpecificPlayerActor(3) != 0) - PlaySoundWithFunctionB4(SoundRelatedClass, &handle4, (chorus == 0) ? SE_VOC_KO2_CS_COURSE_MISS : SE_VOC_KO2_CLEAR_MULTI, 1); + PlaySoundWithFunctionB4(SoundRelatedClass, &handle4, (success == 0) ? SE_VOC_KO2_CS_COURSE_MISS : SE_VOC_KO2_CLEAR_MULTI, 1); } // Add the powerups and exit the stage - if (timer == 30*15) { + if (timer == 30*9) { this->addPowerups(); ExitStage(WORLD_MAP, 0, BEAT_LEVEL, MARIO_WIPE); } @@ -909,18 +967,24 @@ void dSingAlong::executeState_Win() { // Make the banked powerups do a little dance/effect // Play a sound for each powerup gained if (timer == 30*3 || timer == 30*4 || timer == 30*5 || timer == 30*6) { - dSongPrize *bullshit = 0; + dSongPrize *dancer = 0; if (timer == 30*3) - bullshit = Pa; + dancer = Pa; else if (timer == 30*4) - bullshit = Pb; + dancer = Pb; else if (timer == 30*5) - bullshit = Pc; + dancer = Pc; else if (timer == 30*6) - bullshit = Pd; - bullshit->doStateChange(&dSongPrize::StateID_Spin); - nw4r::snd::SoundHandle handle; - PlaySoundWithFunctionB4(SoundRelatedClass, &handle, SE_OBJ_ITEM_FROM_KINOPIO, 1); + dancer = Pd; + + if (dancer) { + dancer->doStateChange(&dSongPrize::StateID_Spin); + nw4r::snd::SoundHandle handle; + PlaySoundWithFunctionB4(SoundRelatedClass, &handle, SE_OBJ_ITEM_FROM_KINOPIO, 1); + } + else { + timer += 29; + } } // If victory, make mario do a little dance/sound @@ -1201,6 +1265,7 @@ void dSongBlock::calledWhenDownMoveExecutes() { void dSongBlock::glow() { isGlowing = 1; + isDead = 0; glowTimer = 15; } |