summaryrefslogtreecommitdiff
path: root/src/bonusRoom.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/bonusRoom.cpp81
1 files changed, 63 insertions, 18 deletions
diff --git a/src/bonusRoom.cpp b/src/bonusRoom.cpp
index 7b795f6..b7fd395 100644
--- a/src/bonusRoom.cpp
+++ b/src/bonusRoom.cpp
@@ -4,12 +4,16 @@
#include <sfx.h>
#include <stage.h>
+extern "C" void *MakeMarioEnterDemoMode();
+extern "C" void *MakeMarioExitDemoMode();
extern "C" bool SpawnEffect(const char*, int, Vec*, S16Vec*, Vec*);
extern "C" void *StopBGMMusic();
extern "C" void *StartBGMMusic();
extern "C" void *SoundRelatedClass;
extern "C" void *MapSoundPlayer(void *SoundClass, int soundID, int unk);
+// THIS IS A DUMB NAME
+extern bool NoMichaelBuble;
int Songs[16][4][16][3] = {
@@ -367,18 +371,20 @@ void dSongPrize::beginState_Shrink() {
// /* keysX[i] = { frame, value, slope }; */
keysX[0] = (HermiteKey){ 0.0, pos.x, 0.8 };
keysY[0] = (HermiteKey){ 0.0, pos.y, 0.8 };
- keysS[0] = (HermiteKey){ 0.0, 3.0, 0.8 };
+ keysS[0] = (HermiteKey){ 0.0, 3.0, -0.8 };
keysX[1] = (HermiteKey){ 60.0, pos.x + (30.0 * queue) - 172.0, 1.0 };
keysY[1] = (HermiteKey){ 60.0, pos.y + 64.0, 1.0 };
- keysS[1] = (HermiteKey){ 60.0, 1.0, 1.0 };
+ keysS[1] = (HermiteKey){ 60.0, 1.0, 0.0 };
}
void dSongPrize::executeState_Shrink() {
float modX = GetHermiteCurveValue(timer, keysX, Xkey_count);
float modY = GetHermiteCurveValue(timer, keysY, Ykey_count);
- float modS = GetHermiteCurveValue(timer, keysS, Skey_count);
+ //float modS = GetHermiteCurveValue(timer, keysS, Skey_count);
+ float modS = 3.0f - (timer * (2.0f / 60.0f));
pos = (Vec){ modX, modY, pos.z };
+ //OSReport("Item scale according to Hermite Keys: %f from frame %d\n", modS, timer);
scale = (Vec){ modS, modS, modS };
if (timer == 60) { doStateChange(&StateID_Wait); }
@@ -462,7 +468,7 @@ class dSingAlong : public dStageActor_c {
int onExecute();
int onDraw();
- int beforeExecute() { return true; }
+ //int beforeExecute() { return true; }
int afterExecute(int) { return true; }
dSingAlong() : state(this, &StateID_Intro) { }
@@ -519,6 +525,7 @@ dSingAlong *dSingAlong::build() {
/*****************************************************************************/
// Events
int dSingAlong::onCreate() {
+ NoMichaelBuble = true;
OSReport("Creating the Sing Along gang.");
// Load in the settings
@@ -608,6 +615,7 @@ CREATE_STATE(dSingAlong, Intro);
void dSingAlong::beginState_Intro() {}
void dSingAlong::endState_Intro() {}
void dSingAlong::executeState_Intro() {
+ MakeMarioEnterDemoMode();
state.setState(&StateID_Prize);
}
@@ -712,7 +720,9 @@ void dSingAlong::executeState_Call() {
timer += 1;
}
-void dSingAlong::endState_Call() {}
+void dSingAlong::endState_Call() {
+ MakeMarioExitDemoMode();
+}
/*****************************************************************************/
@@ -729,6 +739,7 @@ void dSingAlong::executeState_Response() {
if (Songs[song][chorus][currentNote][0] == 0) {
isResponding = 0;
OSReport("Switching to some other mode: %d", isResponding);
+ MakeMarioEnterDemoMode();
state.setState(&StateID_Prize);
}
}
@@ -750,8 +761,13 @@ void dSingAlong::beginState_Failure() {
SBf->unglow();
SBg->unglow();
+ MakeMarioEnterDemoMode();
}
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);
// Play a success/failure sound
if (timer == 20) {
@@ -760,17 +776,29 @@ void dSingAlong::executeState_Failure() {
StopBGMMusic();
}
+ 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);
+ }
+ }
+
// 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*5) {
+ if (timer == 30*9) {
if (chorus >= 1) {
Pa->doStateChange(&dSongPrize::StateID_Spin);
nw4r::snd::SoundHandle handle;
@@ -781,7 +809,7 @@ void dSingAlong::executeState_Failure() {
}
}
- if (timer == 30*6) {
+ if (timer == 30*10) {
if (chorus >= 2) {
Pb->doStateChange(&dSongPrize::StateID_Spin);
nw4r::snd::SoundHandle handle;
@@ -792,7 +820,7 @@ void dSingAlong::executeState_Failure() {
}
}
- if (timer == 30*6) {
+ if (timer == 30*11) {
if (chorus >= 3) {
Pc->doStateChange(&dSongPrize::StateID_Spin);
nw4r::snd::SoundHandle handle;
@@ -804,22 +832,22 @@ void dSingAlong::executeState_Failure() {
}
// If victory, make mario do a little dance/sound
- if (timer == 30*8) {
+ if (timer == 30*13) {
nw4r::snd::SoundHandle handle1, handle2, handle3, handle4;
if (GetSpecificPlayerActor(0) != 0)
- PlaySoundWithFunctionB4(SoundRelatedClass, &handle1, SE_VOC_MA_GAME_OVER, 1);
+ PlaySoundWithFunctionB4(SoundRelatedClass, &handle1, (chorus == 0) ? SE_VOC_MA_CS_COURSE_MISS : SE_VOC_MA_CLEAR_MULTI, 1);
if (GetSpecificPlayerActor(1) != 0)
- PlaySoundWithFunctionB4(SoundRelatedClass, &handle1, SE_VOC_LU_GAME_OVER, 1);
+ PlaySoundWithFunctionB4(SoundRelatedClass, &handle2, (chorus == 0) ? SE_VOC_LU_CS_COURSE_MISS : SE_VOC_LU_CLEAR_MULTI, 1);
if (GetSpecificPlayerActor(2) != 0)
- PlaySoundWithFunctionB4(SoundRelatedClass, &handle1, SE_VOC_KO_GAME_OVER, 1);
+ PlaySoundWithFunctionB4(SoundRelatedClass, &handle3, (chorus == 0) ? SE_VOC_KO_CS_COURSE_MISS : SE_VOC_KO_CLEAR_MULTI, 1);
if (GetSpecificPlayerActor(3) != 0)
- PlaySoundWithFunctionB4(SoundRelatedClass, &handle1, SE_VOC_KO2_GAME_OVER, 1);
+ PlaySoundWithFunctionB4(SoundRelatedClass, &handle4, (chorus == 0) ? SE_VOC_KO2_CS_COURSE_MISS : SE_VOC_KO2_CLEAR_MULTI, 1);
}
// Add the powerups and exit the stage
- if (timer == 30*10) {
+ if (timer == 30*15) {
this->addPowerups();
ExitStage(WORLD_MAP, 0, BEAT_LEVEL, MARIO_WIPE);
}
@@ -834,8 +862,16 @@ CREATE_STATE(dSingAlong, Win);
void dSingAlong::beginState_Win() {
this->timer = 0;
+ MakeMarioEnterDemoMode();
}
void dSingAlong::executeState_Win() {
+ if (timer == 5)
+ for (int i = 0; i < 4; i++)
+ if (dAcPy_c *player = dAcPy_c::findByID(i)) {
+ player->setAnimePlayWithAnimID(dm_glad);
+ player->setFlag(0x24);
+ }
+
// Play a success/failure sound
if (timer == 30) {
nw4r::snd::SoundHandle handle;
@@ -846,7 +882,16 @@ 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) {
- Pa->doStateChange(&dSongPrize::StateID_Spin);
+ dSongPrize *bullshit = 0;
+ if (timer == 30*3)
+ bullshit = Pa;
+ else if (timer == 30*4)
+ bullshit = Pb;
+ else if (timer == 30*5)
+ bullshit = 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);
}
@@ -858,11 +903,11 @@ void dSingAlong::executeState_Win() {
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);
+ PlaySoundWithFunctionB4(SoundRelatedClass, &handle2, SE_VOC_LU_CLEAR_MULTI, 1);
if (GetSpecificPlayerActor(2) != 0)
- PlaySoundWithFunctionB4(SoundRelatedClass, &handle1, SE_VOC_KO_CLEAR_MULTI, 1);
+ PlaySoundWithFunctionB4(SoundRelatedClass, &handle3, SE_VOC_KO_CLEAR_MULTI, 1);
if (GetSpecificPlayerActor(3) != 0)
- PlaySoundWithFunctionB4(SoundRelatedClass, &handle1, SE_VOC_KO2_CLEAR_MULTI, 1);
+ PlaySoundWithFunctionB4(SoundRelatedClass, &handle4, 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});
}