Skip to content

Commit 0369f71

Browse files
committed
Merge 'Fix custom song name display enabled when it should not be' (#2264)
2 parents 1b3c2e7 + 94f9248 commit 0369f71

11 files changed

Lines changed: 12367 additions & 12371 deletions

File tree

ASM/build/asm_symbols.txt

Lines changed: 370 additions & 371 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ASM/build/bundle.o

-120 Bytes
Binary file not shown.

ASM/build/c_symbols.txt

Lines changed: 396 additions & 397 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ASM/c/model_text.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ bool child_safe = false;
99

1010
bool missing_dlist = false;
1111

12+
extern uint8_t CFG_SONG_NAME_STATE;
13+
1214
const int text_width = 5;
1315
const int text_height = 10;
1416

@@ -20,7 +22,7 @@ void draw_illegal_model_text(z64_disp_buf_t* db) {
2022
}
2123

2224
// If custom music songs are displayed, only show the text in the inventory screen.
23-
if (are_song_displayed() && z64_game.pause_ctxt.screen_idx != 0) {
25+
if (CFG_SONG_NAME_STATE > SONG_NAME_NONE && z64_game.pause_ctxt.screen_idx != 0) {
2426
return;
2527
}
2628

ASM/c/music.c

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
extern uint8_t CFG_SPEEDUP_MUSIC_FOR_LAST_TRIFORCE_PIECE;
44
extern uint8_t CFG_SLOWDOWN_MUSIC_WHEN_LOWHP;
55
extern char CFG_SONG_NAMES[];
6-
extern uint8_t CFG_SONG_NAME_POSITION;
6+
extern uint8_t CFG_SONG_NAME_STATE;
77

88
static uint16_t previousSeqIndexChange = 0;
99
static uint8_t isSlowedDown = 0;
@@ -62,21 +62,17 @@ int bgm_sequence_ids[47] = {
6262
0x55, 0x56, 0x58, 0x5A, 0x5B, 0x5C, 0x5F, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x6B, 0x6C,
6363
};
6464

65-
#define TEXT_WIDTH 6
66-
#define TEXT_HEIGHT 11
67-
#define SONG_NAME_FRAMES_VISIBLE 100
68-
#define SONG_NAME_FRAMES_FADE_AWAY 80
69-
#define SONG_NAME_FRAMES_FADE_INTO 5
65+
static const uint8_t TEXT_WIDTH = 6;
66+
static const uint8_t TEXT_HEIGHT = 11;
67+
static const uint8_t SONG_NAME_FRAMES_VISIBLE = 100;
68+
static const uint8_t SONG_NAME_FRAMES_FADE_AWAY = 80;
69+
static const uint8_t SONG_NAME_FRAMES_FADE_INTO = 5;
7070
static uint32_t frames = 0;
7171
static uint32_t display_song_name_flag = 0;
7272
static uint16_t previousSeqIndexName = 0;
7373

74-
uint8_t are_song_displayed() {
75-
return *CFG_SONG_NAMES ? 1 : 0;
76-
}
77-
7874
void display_song_name(z64_disp_buf_t* db) {
79-
if (are_song_displayed() &&
75+
if (CFG_SONG_NAME_STATE > SONG_NAME_NONE &&
8076
!dungeon_info_is_drawn() && // Don't display if the custom rando pause screen if displayed.
8177
!(z64_link.state_flags_2 & 0x8000000)) { // Don't display if Link is playing the Ocarina.
8278

@@ -100,7 +96,7 @@ void display_song_name(z64_disp_buf_t* db) {
10096
alpha = 255;
10197
frames = 0;
10298
}
103-
else if (CFG_SONG_NAME_POSITION == SONG_NAME_PAUSE) {
99+
else if (CFG_SONG_NAME_STATE == SONG_NAME_PAUSE) {
104100
return;
105101
}
106102
else {
@@ -152,7 +148,7 @@ void display_song_name(z64_disp_buf_t* db) {
152148
}
153149

154150
void display_song_name_on_file_select(z64_disp_buf_t* db) {
155-
if (!dungeon_info_is_drawn() && are_song_displayed()) {
151+
if (CFG_SONG_NAME_STATE > SONG_NAME_NONE) {
156152
uint8_t top = 7;
157153
uint8_t left = 7;
158154
uint8_t alpha = 255;

ASM/c/music.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#ifndef MUSIC_H
2+
#define MUSIC_H
3+
14
#include <stdbool.h>
25
#include "z64.h"
36
#include "triforce.h"
@@ -8,11 +11,12 @@ void manage_music_changes();
811
_Bool Health_IsCritical();
912
void display_song_name(z64_disp_buf_t* db);
1013
void display_song_name_on_file_select(z64_disp_buf_t* db);
11-
uint8_t are_song_displayed();
1214

1315
typedef enum {
14-
/* 0 */ SONG_NAME_TOP, // Top of the screen.
15-
/* 1 */ SONG_NAME_PAUSE, // Pause screen only.
16+
/* 0 */ SONG_NAME_NONE, // Never displayed.
17+
/* 1 */ SONG_NAME_TOP, // Top of the screen.
18+
/* 2 */ SONG_NAME_PAUSE, // Pause screen only.
1619
} SongNamePosition;
1720

18-
#define CAN_DISPLAY_SONG_NAME ()
21+
22+
#endif

ASM/src/config.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ CFG_DPAD_ON_THE_LEFT:
9090
CFG_INPUT_VIEWER:
9191
.byte 0x00
9292

93-
CFG_SONG_NAME_POSITION:
93+
CFG_SONG_NAME_STATE:
9494
.byte 0x00
9595

9696
.area 0xA5A, 0

Cosmetics.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -978,11 +978,12 @@ def patch_input_viewer(rom: Rom, settings: Settings, log: CosmeticsLog, symbols:
978978

979979
def patch_song_names(rom: Rom, settings: Settings, log: CosmeticsLog, symbols: dict[str, int]) -> None:
980980
bytes_to_write = []
981+
rom.write_byte(symbols['CFG_SONG_NAME_STATE'], 0x00)
981982
if settings.display_custom_song_names != 'off':
982983
if settings.display_custom_song_names == 'top':
983-
rom.write_byte(symbols['CFG_SONG_NAME_POSITION'], 0x00)
984+
rom.write_byte(symbols['CFG_SONG_NAME_STATE'], 0x01)
984985
if settings.display_custom_song_names == 'pause':
985-
rom.write_byte(symbols['CFG_SONG_NAME_POSITION'], 0x01)
986+
rom.write_byte(symbols['CFG_SONG_NAME_STATE'], 0x02)
986987

987988
for index, song_name in enumerate(log.bgm.values()):
988989
if index >= 47:
@@ -1209,7 +1210,7 @@ def patch_song_names(rom: Rom, settings: Settings, log: CosmeticsLog, symbols: d
12091210
],
12101211
"symbols": {
12111212
**patch_sets[0x1F073FE1]["symbols"],
1212-
"CFG_SONG_NAME_POSITION": 0x006C,
1213+
"CFG_SONG_NAME_STATE": 0x006C,
12131214
"CFG_SONG_NAMES": 0x006D,
12141215
}
12151216
}

0 commit comments

Comments
 (0)