Skip to content

Commit 3585120

Browse files
Merge pull request #2246 from AlmostSeagull/music-display-fix-round2b
music display spam fix
2 parents 03551b2 + 64e9205 commit 3585120

File tree

3 files changed

+248
-251
lines changed

3 files changed

+248
-251
lines changed

base-hack/src/misc/music_text.c

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,32 @@ void resetDisplayedMusic(void) {
2222

2323

2424
void detectSongChange(){
25-
char trackChannelsChanged = 0;
26-
for(int i = 0; i < 12; i++){
25+
char loadedSongCanceled = 0;
26+
for(int i = 11; i >= 0; i--){
2727
if(storedMusicTrackChannel[i] != MusicTrackChannels[i]){
28-
// Block song display from occurring in the pause menu
29-
// Other instances of this occurring are fair game, maybe even desired
30-
if(MusicTrackChannels[i] != 41){
31-
// New song was requested to play on this channel
32-
// Do record pause music playing, so we know when it stops playing
33-
storedMusicTrackChannel[i] = MusicTrackChannels[i];
34-
if(MusicTrackChannels[i] != 34){
35-
trackChannelsChanged = 1;
36-
}
28+
// New song was requested to play on this channel
29+
initSongDisplay(MusicTrackChannels[i]);
30+
if(MusicTrackChannels[i] == 0 && music_types[storedMusicTrackChannel[i]] == SONGTYPE_BGM){
31+
loadedSongCanceled = 1;
32+
}
33+
storedMusicTrackChannel[i] = MusicTrackChannels[i];
34+
} else if(loadedSongCanceled){
35+
// An already playing BGM got canceled. This song might have been blocking songs on lower channels from playing
36+
// So next song in line that is a BGM will be played.
37+
if(music_types[MusicTrackChannels[i]] == SONGTYPE_BGM){
38+
initSongDisplay(MusicTrackChannels[i]);
39+
// And ignore songs in lower channels. The BGM filter should be enough to make it accurate
40+
loadedSongCanceled = 0;
3741
}
3842
}
39-
}
40-
for(int i = 0; i < 12; i++){
4143
if(trackStateArray[i] != storedTrackState[i]){
4244
if(trackStateArray[i] == 2 && storedTrackState[i] == 1){
4345
// New song has loaded in and has now started
46+
// This call is so close to being obsolete, but it covers edge cases where
47+
// you enter a level in a location where one BGM has priority over another (Aztec/Galleon tunnel spawn)
4448
initSongDisplay(MusicTrackChannels[i]);
4549
}
4650
storedTrackState[i] = trackStateArray[i];
47-
} else if(trackStateArray[i] == 2 && trackChannelsChanged){
48-
// Song that was newly requested was already loaded in and has now started
49-
initSongDisplay(MusicTrackChannels[i]);
5051
}
5152
}
5253
}
@@ -55,10 +56,6 @@ void initSongDisplay(int song) {
5556
if (song == 0) {
5657
return;
5758
}
58-
if (song == 34) {
59-
// Block it from occurring in the pause menu, cause text overload
60-
return;
61-
}
6259
if (music_types[song] != SONGTYPE_BGM) {
6360
return;
6461
}

static/patches/shrink-dk64.bps

-8 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)