summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2013-02-08 23:16:09 +0100
committerTreeki <treeki@gmail.com>2013-02-08 23:16:09 +0100
commitbea26f60b932265e072a85187978ad2ddd134630 (patch)
tree6ced216b29a766bdc90dccc92f2bbc6349b11b0d
parentf66e56e087e58c3b7319e9065c375c502228dceb (diff)
downloadkamek-bea26f60b932265e072a85187978ad2ddd134630.tar.gz
kamek-bea26f60b932265e072a85187978ad2ddd134630.zip
changed various playsound calls to playsoundwithfunctionb4
Diffstat (limited to '')
-rwxr-xr-xinclude/game.h2
-rw-r--r--src/bonusRoom.cpp89
-rw-r--r--src/boss.cpp19
-rw-r--r--src/bossPodouble.cpp5
-rw-r--r--src/bossRamboo.cpp5
-rw-r--r--src/bossThwompaDomp.cpp6
6 files changed, 77 insertions, 49 deletions
diff --git a/include/game.h b/include/game.h
index 9cd9452..17962e7 100755
--- a/include/game.h
+++ b/include/game.h
@@ -3669,5 +3669,7 @@ inline int Player_VF3D4(void *self) {
VF_END;
}
+extern "C" void PlaySoundWithFunctionB4(void *spc, nw4r::snd::SoundHandle *handle, int id, int unk);
+
#endif
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);
diff --git a/src/boss.cpp b/src/boss.cpp
index df553fb..d34ae9b 100644
--- a/src/boss.cpp
+++ b/src/boss.cpp
@@ -104,7 +104,8 @@ void OutroSetup(daBoss *actor) {
bool ShrinkBoss(daBoss *actor, Vec *pos, float scale, int timer) {
- PlaySound(actor, SE_BOSS_CMN_DAMAGE_LAST);
+ nw4r::snd::SoundHandle handle;
+ PlaySoundWithFunctionB4(SoundRelatedClass, &handle, SE_BOSS_CMN_DAMAGE_LAST, 1);
// Adjust actor to equal the scale of your boss / 80.
actor->scale.x -= scale / 80.0;
@@ -133,15 +134,21 @@ void BossExplode(daBoss *actor, Vec *pos) {
actor->dying = 1;
actor->timer = 0;
- PlaySound(actor, STRM_BGM_SHIRO_BOSS_CLEAR);
+ nw4r::snd::SoundHandle handle;
+ PlaySoundWithFunctionB4(SoundRelatedClass, &handle, STRM_BGM_SHIRO_BOSS_CLEAR, 1);
MakeMarioEnterDemoMode();
}
void PlayerVictoryCries(daBoss *actor) {
UpdateGameMgr();
- if (GetSpecificPlayerActor(0) != 0) { PlaySound(actor, SE_VOC_MA_CLEAR_BOSS); }
- if (GetSpecificPlayerActor(1) != 0) { PlaySound(actor, SE_VOC_LU_CLEAR_BOSS); }
- if (GetSpecificPlayerActor(2) != 0) { PlaySound(actor, SE_VOC_KO_CLEAR_BOSS); }
- if (GetSpecificPlayerActor(3) != 0) { PlaySound(actor, SE_VOC_KO2_CLEAR_BOSS); }
+ nw4r::snd::SoundHandle handle1, handle2, handle3, handle4;
+ if (GetSpecificPlayerActor(0) != 0)
+ PlaySoundWithFunctionB4(SoundRelatedClass, &handle1, SE_VOC_MA_CLEAR_BOSS, 1);
+ if (GetSpecificPlayerActor(1) != 0)
+ PlaySoundWithFunctionB4(SoundRelatedClass, &handle2, SE_VOC_LU_CLEAR_BOSS, 1);
+ if (GetSpecificPlayerActor(2) != 0)
+ PlaySoundWithFunctionB4(SoundRelatedClass, &handle3, SE_VOC_KO_CLEAR_BOSS, 1);
+ if (GetSpecificPlayerActor(3) != 0)
+ PlaySoundWithFunctionB4(SoundRelatedClass, &handle4, SE_VOC_KO2_CLEAR_BOSS, 1);
}
diff --git a/src/bossPodouble.cpp b/src/bossPodouble.cpp
index 4b85cf1..1bf8887 100644
--- a/src/bossPodouble.cpp
+++ b/src/bossPodouble.cpp
@@ -608,12 +608,13 @@ int daPodouble::onDraw() {
bool ret;
ret = ShrinkBoss(this, &this->pos, 3.5, this->timer);
- if (ret == true) {
+ if (ret == true) {
BossExplode(this, &this->pos);
this->dying = 1;
this->timer = 0;
+ nw4r::snd::SoundHandle handle;
+ PlaySoundWithFunctionB4(SoundRelatedClass, &handle, SE_EMY_BUBBLE_EXTINCT, 1);
}
- else { PlaySound(this, SE_EMY_BUBBLE_EXTINCT); }
this->timer += 1;
diff --git a/src/bossRamboo.cpp b/src/bossRamboo.cpp
index a2b34f0..a096e14 100644
--- a/src/bossRamboo.cpp
+++ b/src/bossRamboo.cpp
@@ -513,8 +513,9 @@ void daRamboo_c::executeState_Outro() {
this->dying = 1;
this->timer = 0;
}
- else {
- PlaySound(this, SE_EMY_BIG_TERESA_DEAD);
+ else if (timer % 15 == 0) {
+ nw4r::snd::SoundHandle handle;
+ PlaySoundWithFunctionB4(SoundRelatedClass, &handle, SE_EMY_BIG_TERESA_DEAD, 1);
}
timer = timer + 1;
diff --git a/src/bossThwompaDomp.cpp b/src/bossThwompaDomp.cpp
index 1950ced..18ea570 100644
--- a/src/bossThwompaDomp.cpp
+++ b/src/bossThwompaDomp.cpp
@@ -443,14 +443,16 @@ int daEnMegaDosun_c::onDelete() {
if (this->timer == 0) {
- PlaySound(this, SE_EMY_BIG_DOSSUN_DEAD);
+ nw4r::snd::SoundHandle handle;
+ PlaySoundWithFunctionB4(SoundRelatedClass, &handle, SE_EMY_BIG_DOSSUN_DEAD, 1);
SpawnEffect("Wm_mr_stockitemuse_b", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0});
SpawnEffect("Wm_mr_stockitemuse_c", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0});
}
if (this->timer == 60) {
- PlaySound(this, STRM_BGM_SHIRO_BOSS_CLEAR);
+ nw4r::snd::SoundHandle handle;
+ PlaySoundWithFunctionB4(SoundRelatedClass, &handle, STRM_BGM_SHIRO_BOSS_CLEAR, 1);
MakeMarioEnterDemoMode();
}