44#include "hud_colors.h"
55#include "triforce.h"
66#include "ocarina_buttons.h"
7+ #include "save.h"
78
89#define ICON_SIZE 0x0C
910#define MUSIC_WIDTH 0x06
@@ -172,6 +173,7 @@ static const variable_tile_data_t variable_tile_positions[NUM_VARIABLE] = {
172173 {0 , {0x4E , 0x2A }}, // Strength
173174 {0 , {0x5A , 0x2A }}, // Scale
174175};
176+ static uint8_t bronze_scale_marker = 0 ;
175177
176178typedef struct {
177179 colorRGB8_t color ;
@@ -380,8 +382,9 @@ static void populate_child_trade(const z64_file_t* file, variable_tile_t* tile);
380382static void populate_adult_trade (const z64_file_t * file , variable_tile_t * tile );
381383static void populate_magic (const z64_file_t * file , variable_tile_t * tile );
382384static void populate_upgrade_equip (const z64_file_t * file , variable_tile_t * tile , uint8_t value , uint8_t max , uint8_t base_tile );
385+ static void populate_upgrade_scale (const z64_file_t * file , variable_tile_t * tile , uint8_t value , uint8_t base_tile );
383386
384- static void populate_variable (const z64_file_t * file , variable_tile_info_t * info ) {
387+ void populate_variable (const z64_file_t * file , variable_tile_info_t * info ) {
385388 variable_tile_t * tile = info -> tiles ;
386389
387390 populate_upgrade_item ( file , tile ++ , Z64_SLOT_OCARINA , Z64_ITEM_FAIRY_OCARINA );
@@ -390,7 +393,8 @@ static void populate_variable(const z64_file_t* file, variable_tile_info_t* info
390393 populate_adult_trade ( file , tile ++ );
391394 populate_magic ( file , tile ++ );
392395 populate_upgrade_equip (file , tile ++ , file -> strength_upgrade , 3 , Z64_ITEM_GORONS_BRACELET );
393- populate_upgrade_equip (file , tile ++ , file -> diving_upgrade , 2 , Z64_ITEM_SILVER_SCALE );
396+ extended_savecontext_static_t * extended = & (((extended_sram_file_t * )file )-> additional_save_data .extended );
397+ populate_upgrade_scale (file , tile ++ , extended -> extended_scale , Z64_ITEM_SILVER_SCALE );
394398}
395399
396400
@@ -519,6 +523,11 @@ static void draw_variable(z64_disp_buf_t* db, const variable_tile_info_t* info,
519523 color = WHITE ;
520524 color .a = color_product (color .a , alpha );
521525 }
526+ if (bronze_scale_marker ) {
527+ sprite_load (db , & item_digit_sprite , 0 , 1 );
528+ sprite_draw (db , & item_digit_sprite , 0 , get_left (variable_tile_positions [NUM_VARIABLE - 1 ].pos ) + 4 ,
529+ get_top (variable_tile_positions [NUM_VARIABLE - 1 ].pos ) + 3 , 6 , 6 );
530+ }
522531}
523532
524533
@@ -935,3 +944,22 @@ static void populate_upgrade_equip(const z64_file_t* file, variable_tile_t* tile
935944 tile -> tile_index = base_tile + (value - 1 );
936945 }
937946}
947+
948+ static void populate_upgrade_scale (const z64_file_t * file , variable_tile_t * tile , uint8_t value , uint8_t base_tile ) {
949+ tile -> tile_index = base_tile ;
950+ bronze_scale_marker = 0 ;
951+ if (value == 0 ) {
952+ bronze_scale_marker = 1 ;
953+ tile -> enabled = 0 ;
954+ }
955+ if (value == 1 ) {
956+ tile -> enabled = 0 ;
957+ }
958+ if (value == 2 ) {
959+ tile -> enabled = 1 ;
960+ }
961+ if (value == 3 ) {
962+ tile -> enabled = 1 ;
963+ tile -> tile_index ++ ;
964+ }
965+ }
0 commit comments