Skip to content

Commit b28f55a

Browse files
committed
Go back to original PR and just move the counter up
1 parent c0205ea commit b28f55a

10 files changed

Lines changed: 8470 additions & 62476 deletions

File tree

ASM/build/asm_symbols.txt

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

ASM/build/bundle.o

-256 Bytes
Binary file not shown.

ASM/build/c_symbols.txt

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

ASM/c/main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ void before_game_state_update() {
4343
rando_display_buffer_reset();
4444
handle_pending_items();
4545
handle_dpad();
46-
handle_lbutton_and_minimap_state();
4746
update_misc_colors();
4847
update_hud_colors();
4948
process_extern_ctxt();

ASM/c/triforce.c

Lines changed: 7 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -7,96 +7,12 @@ static uint32_t render_triforce_flag = 0;
77
#define TRIFORCE_FRAMES_VISIBLE 100 // 20 Frames seems to be about 1 second
88
#define TRIFORCE_FRAMES_FADE_AWAY 80
99
#define TRIFORCE_FRAMES_FADE_INTO 5
10-
uint8_t minimap_triforce_state = 0;
1110

1211
void set_triforce_render() {
1312
render_triforce_flag = 1;
1413
frames = frames > TRIFORCE_FRAMES_FADE_INTO ? TRIFORCE_FRAMES_FADE_INTO : frames;
1514
}
1615

17-
void handle_lbutton_and_minimap_state() {
18-
switch (minimap_triforce_state) {
19-
case MINIMAP_ON_SCREEN:
20-
R_MINIMAP_DISABLED = render_triforce_flag == 1;
21-
if (z64_game.common.input[0].pad_pressed.l) {
22-
minimap_triforce_state++;
23-
if (minimap_triforce_state > NONE_ON_SCREEN) {
24-
minimap_triforce_state = MINIMAP_ON_SCREEN;
25-
}
26-
PlaySFX(0x4820); //NA_SE_SY_DUMMY_32 (Notification)
27-
R_MINIMAP_DISABLED = 0;
28-
}
29-
break;
30-
case TRIFORCE_OR_SKULL_ON_SCREEN:
31-
R_MINIMAP_DISABLED = 1;
32-
if (z64_game.common.input[0].pad_pressed.l) {
33-
minimap_triforce_state++;
34-
if (minimap_triforce_state > NONE_ON_SCREEN) {
35-
minimap_triforce_state = MINIMAP_ON_SCREEN;
36-
}
37-
PlaySFX(0x4813); //NA_SE_SY_CAMERA_ZOOM_UP
38-
R_MINIMAP_DISABLED = 1;
39-
}
40-
break;
41-
case NONE_ON_SCREEN:
42-
R_MINIMAP_DISABLED = 1;
43-
if (z64_game.common.input[0].pad_pressed.l) {
44-
minimap_triforce_state++;
45-
if (minimap_triforce_state > NONE_ON_SCREEN) {
46-
minimap_triforce_state = MINIMAP_ON_SCREEN;
47-
}
48-
PlaySFX(0x4814); //NA_SE_SY_CAMERA_ZOOM_DOWN
49-
R_MINIMAP_DISABLED = 1;
50-
}
51-
break;
52-
default:
53-
break;
54-
}
55-
}
56-
57-
void draw_skull_count(z64_disp_buf_t* db) {
58-
59-
if (!CAN_DRAW_TRIFORCE || !(minimap_triforce_state == TRIFORCE_OR_SKULL_ON_SCREEN)) {
60-
return;
61-
}
62-
63-
int pieces = z64_file.gs_tokens;
64-
65-
int pieces_digits = 0;
66-
int pieces_copy = pieces;
67-
while(pieces_copy >= 1) {
68-
pieces_digits++;
69-
pieces_copy /= 10;
70-
}
71-
pieces_digits = pieces_digits == 0 ? 1 : pieces_digits;
72-
73-
// Setup draw location
74-
int str_len = pieces_digits;
75-
int total_w = str_len * font_sprite.tile_w + triforce_sprite.tile_w * 0.9;
76-
// Draw the counter symmetric to the rupee icon at (left, top) = (26, 206)
77-
int draw_x = (Z64_SCREEN_WIDTH - 26) - total_w - 1;
78-
int draw_y_text = 206;
79-
int draw_y_skull = 206;
80-
// Above Triforce counter if there is one.
81-
if (TRIFORCE_HUNT_ENABLED) {
82-
draw_y_text -= font_sprite.tile_h + 1;
83-
draw_y_skull -= font_sprite.tile_h + 1;
84-
}
85-
86-
// Call setup display list
87-
gSPDisplayList(db->p++, &setup_db);
88-
gDPPipeSync(db->p++);
89-
90-
colorRGBA8_t color = { 0xFF, 0xFF, 0xFF, 0xFF};
91-
draw_int(db, z64_file.gs_tokens, draw_x, draw_y_text, color);
92-
draw_x += str_len * font_sprite.tile_w + 1;
93-
94-
gDPPipeSync(db->p++);
95-
gDPSetCombineMode(db->p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
96-
sprite_load(db, &quest_items_sprite, 11, 1);
97-
sprite_draw(db, &quest_items_sprite, 0, draw_x, draw_y_skull, triforce_sprite.tile_w * 0.9, triforce_sprite.tile_h * 0.9);
98-
}
99-
10016
void draw_triforce_count(z64_disp_buf_t* db) {
10117

10218
// Must be triforce hunt and triforce should be drawable, and we should either be on the pause screen or the render triforce flag should be set
@@ -112,20 +28,13 @@ void draw_triforce_count(z64_disp_buf_t* db) {
11228
} else {
11329
// Do a fade in/out effect if not in pause screen
11430
if (frames <= TRIFORCE_FRAMES_FADE_INTO) {
115-
// Disable minimap until the counter is faded out.
116-
if (minimap_triforce_state == MINIMAP_ON_SCREEN) {
117-
R_MINIMAP_DISABLED = 1;
118-
}
11931
alpha = frames * 255 / TRIFORCE_FRAMES_FADE_INTO;
12032
} else if (frames <= TRIFORCE_FRAMES_FADE_INTO + TRIFORCE_FRAMES_VISIBLE ) {
12133
alpha = 255;
12234
} else if (frames <= TRIFORCE_FRAMES_FADE_INTO + TRIFORCE_FRAMES_VISIBLE + TRIFORCE_FRAMES_FADE_AWAY) {
12335
alpha = (frames - TRIFORCE_FRAMES_FADE_INTO - TRIFORCE_FRAMES_VISIBLE) * 255 / TRIFORCE_FRAMES_FADE_AWAY;
12436
alpha = 255 - alpha;
12537
} else {
126-
if (minimap_triforce_state == MINIMAP_ON_SCREEN) {
127-
R_MINIMAP_DISABLED = 0;
128-
}
12938
render_triforce_flag = 0;
13039
frames = 0;
13140
return;
@@ -156,8 +65,12 @@ void draw_triforce_count(z64_disp_buf_t* db) {
15665
// Setup draw location
15766
int str_len = required_digits + pieces_digits + 1;
15867
int total_w = str_len * font_sprite.tile_w + triforce_sprite.tile_w;
159-
// Draw the counter symmetric to the rupee icon at (left, top) = (26, 206)
160-
int draw_x = (Z64_SCREEN_WIDTH - 26) - total_w;
68+
// Draw the counter centered horizontally and at the bottom of CRT safe screen space.
69+
int draw_x = Z64_SCREEN_WIDTH / 2 - total_w / 2;
70+
// And on pause screen, keep the height but move it on the right, symmetric to the rupee icon.
71+
if (z64_game.pause_ctxt.state > PAUSE_STATE_OFF) {
72+
draw_x = (Z64_SCREEN_WIDTH - 26) - total_w;
73+
}
16174
int draw_y_text = 206;
16275
int draw_y_triforce = 206;
16376

@@ -182,7 +95,7 @@ void draw_triforce_count(z64_disp_buf_t* db) {
18295
gDPSetCombineMode(db->p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
18396
gDPSetPrimColor(db->p++, 0, 0, 0xDA, 0xD3, 0x0B, alpha);
18497

185-
text_print(text , draw_x, draw_y_text);
98+
text_print(db, text, draw_x, draw_y_text);
18699
draw_x += str_len * font_sprite.tile_w;
187100

188101
gDPSetPrimColor(db->p++, 0, 0, 0xF4, 0xEC, 0x30, alpha);

ASM/c/triforce.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ extern uint16_t TRIFORCE_HUNT_ENABLED;
1111
extern uint16_t TRIFORCE_PIECES_REQUIRED;
1212

1313
void draw_triforce_count(z64_disp_buf_t* db);
14-
void draw_skull_count(z64_disp_buf_t* db);
1514
void set_triforce_render();
16-
void handle_lbutton_and_minimap_state();
1715

1816
#define BLOCK_TRIFORCE (0x00000001 | \
1917
0x00000002 | \
@@ -27,11 +25,4 @@ void handle_lbutton_and_minimap_state();
2725
(z64_file.game_mode == 0) && \
2826
((z64_event_state_1 & 0x20) == 0))
2927

30-
typedef enum
31-
{
32-
MINIMAP_ON_SCREEN,
33-
TRIFORCE_OR_SKULL_ON_SCREEN,
34-
NONE_ON_SCREEN,
35-
} minimap_triforce_enum;
36-
3728
#endif

ASM/c/z64.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@
5151
#define BASE_REG(n, r) REG_EDITOR_DATA[(n)*REGS_PER_GROUP + (r)]
5252
#define REG(r) BASE_REG(0, (r))
5353
#define SREG(r) BASE_REG(1, (r))
54-
#define WREG(r) BASE_REG(18, (r))
5554
#define R_PAUSE_BG_PRERENDER_STATE SREG(94)
56-
#define R_MINIMAP_DISABLED WREG(31)
5755

5856
#define ITEM_ICON_WIDTH 32
5957
#define ITEM_ICON_HEIGHT 32

ASM/src/hacks.asm

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4112,33 +4112,6 @@ DemoEffect_DrawJewel_AfterHook:
41124112
; sw t7, 0x1F24(at)
41134113
jal ocarina_buttons
41144114
nop
4115-
;===================================================================================================
4116-
; Remove the minimap L button press functions to make our custom one for triforce counter
4117-
;===================================================================================================
4118-
4119-
.orga 0xAE2D0C
4120-
; Replaces jal func_800C806C
4121-
nop
4122-
4123-
.orga 0xAE2D28
4124-
; Replaces jal func_800C806C
4125-
nop
4126-
4127-
.orga 0xAE2D48
4128-
; Replaces sh t7, 0x0DD2(v1)
4129-
nop
4130-
4131-
.orga 0xAE34A0
4132-
; Replaces jal func_800C806C
4133-
nop
4134-
4135-
.orga 0xAE34C0
4136-
; Replaces jal func_800C806C
4137-
nop
4138-
4139-
.orga 0xAE34D8
4140-
; Replaces sh t7, 0x0DD2(v1)
4141-
nop
41424115

41434116
;===================================================================================================
41444117
; Overrides the function that gives Fairy Ocarina on the Lost Woods Bridge

0 commit comments

Comments
 (0)