Skip to content

Commit

Permalink
load high res Gym samples (replicates GLrage)
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Mar 14, 2021
1 parent 206061c commit 87f472d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 58 deletions.
70 changes: 14 additions & 56 deletions src/specific/sndpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/specific/sndpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 87f472d

Please sign in to comment.