@@ -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
1211void 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-
10016void 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 );
0 commit comments