diff --git a/src/specific/sndpc.c b/src/specific/sndpc.c index a7bf5a23e..5472a038f 100644 --- a/src/specific/sndpc.c +++ b/src/specific/sndpc.c @@ -15,68 +15,25 @@ void S_CDVolume(int16_t volume) auxSetVolume(AuxDeviceID, volume_aux); } -void S_CDPlay(int16_t track) +int32_t S_CDPlay(int16_t track) { TRACE("%d", track); - if (track == 13) { - SoundEffect(SFX_SECRET, NULL, SPM_ALWAYS); - } else if (track <= 2 || track >= 22) { - if (CDTrack > 0) { - if (CDTrack >= 26 && CDTrack <= 56) { - StopSoundEffect(SFX_GYM_HINT_01 + CDTrack - 26, NULL); - } else { - CDStop(); - } - CDTrack = 0; - } - if (track >= 26 && track <= 56) { - SoundEffect(SFX_GYM_HINT_01 + track - 26, NULL, SPM_ALWAYS); - CDTrack = track; - } else if (track == 2) { - CDPlay(2); - CDTrack = 2; - } else if (track >= 22 && track <= 25) { - CDPlay(track - 15); - CDTrack = track; - } else { - if (track > 56) { - CDPlay(track - 54); - } - CDTrack = track; - } + if (track == 0) { + CDStop(); + return 0; + } + + if (track == 5) { + return 0; } + + CDTrack = track; + return CDPlay(track); } -void S_StartSyncedAudio(int16_t track) +int32_t S_StartSyncedAudio(int16_t track) { - TRACE("%d", track); - if (track == 13) { - SoundEffect(SFX_SECRET, NULL, SPM_ALWAYS); - } else if (track <= 2 || track >= 22) { - if (CDTrack > 0) { - if (CDTrack >= 26 && CDTrack <= 56) { - StopSoundEffect(SFX_GYM_HINT_01 + CDTrack - 26, NULL); - } else { - CDStop(); - } - CDTrack = 0; - } - if (track >= 26 && track <= 56) { - SoundEffect(SFX_GYM_HINT_01 + track - 26, NULL, SPM_ALWAYS); - CDTrack = track; - } else if (track == 2) { - CDPlay(2); - CDTrack = 2; - } else if (track >= 22 && track <= 25) { - CDPlay(track - 15); - CDTrack = track; - } else { - if (track > 56) { - CDPlay(track - 54); - } - CDTrack = track; - } - } + return S_CDPlay(track); } int32_t CDPlay(int16_t track) @@ -127,6 +84,7 @@ void T1MInjectSpecificSndPC() INJECT(0x00438D40, S_CDPlay); INJECT(0x00439030, S_StartSyncedAudio); INJECT(0x00437FB0, CDPlay); + // NOTE: this is a nullsub in OG and is called in many different places // for many different purposes so it's not injected. // INJECT(0x00437F30, S_CDVolume); diff --git a/src/specific/sndpc.h b/src/specific/sndpc.h index a8f70e2d7..704cc09ec 100644 --- a/src/specific/sndpc.h +++ b/src/specific/sndpc.h @@ -12,9 +12,9 @@ // clang-format on int32_t CDPlay(int16_t track_id); -void S_CDPlay(int16_t track); +int32_t S_CDPlay(int16_t track); +int32_t S_StartSyncedAudio(int16_t track); void S_CDVolume(int16_t volume); -void S_StartSyncedAudio(int16_t track); void T1MInjectSpecificSndPC();