Skip to content

Commit

Permalink
Cross out pre-completed dungeons in pause A menu
Browse files Browse the repository at this point in the history
  • Loading branch information
GSKirox committed Jun 10, 2024
1 parent 1695851 commit f72fb8e
Show file tree
Hide file tree
Showing 8 changed files with 37,164 additions and 36,888 deletions.
2,696 changes: 1,349 additions & 1,347 deletions ASM/build/asm_symbols.txt

Large diffs are not rendered by default.

Binary file modified ASM/build/bundle.o
Binary file not shown.
1,157 changes: 579 additions & 578 deletions ASM/build/c_symbols.txt

Large diffs are not rendered by default.

87 changes: 71 additions & 16 deletions ASM/c/dungeon_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ extern uint8_t CFG_DUNGEON_REWARD_WORLDS[9];

extern uint8_t CFG_DUNGEON_INFO_SILVER_RUPEES;

extern int8_t CFG_DUNGEON_PRECOMPLETED[14];

extern extended_savecontext_static_t extended_savectx;
extern silver_rupee_data_t silver_rupee_vars[0x16][2];

Expand Down Expand Up @@ -293,12 +295,36 @@ void draw_dungeon_info(z64_disp_buf_t* db) {

left += icon_size + padding;

// Draw dungeon names

// First draw precompleted dungeons, greyed out with a small rectangle to cross them.
gDPSetPrimColor(db->p++, 0, 0, 0xFF, 0xFF, 0xFF, 0xBF);
for (int i = 0; i < rows; i++) {
dungeon_entry_t* d = &(dungeons[i]);
int top = start_top + ((icon_size + padding) * i) + 1;
text_print_size(d->name, left, top, font_width);
int empty = CFG_DUNGEON_PRECOMPLETED[d->index];
if (empty == 1) {
int top = start_top + ((icon_size + padding) * i) + 1;
int sizeRectangle = text_print_size(d->name, left, top, font_width) * font_width;
gDPSetCombineMode(db->p++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
gSPTextureRectangle(db->p++,
left<<2, (top + 5) <<2,
(left + sizeRectangle)<<2, ((top + 5) + 1)<<2,
0,
0, 0,
1<<10, 1<<10);
gDPPipeSync(db->p++);
gDPSetCombineMode(db->p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
}
}
gDPSetPrimColor(db->p++, 0, 0, 0xFF, 0xFF, 0xFF, 0x7F);
text_flush_size(db, font_width, font_height, 0, 0);
// Then the rest in white.
gDPSetPrimColor(db->p++, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF);
for (int i = 0; i < rows; i++) {
dungeon_entry_t* d = &(dungeons[i]);
int empty = CFG_DUNGEON_PRECOMPLETED[d->index];
if (empty == 0) {
int top = start_top + ((icon_size + padding) * i) + 1;
text_print_size(d->name, left, top, font_width);
}
}
text_flush_size(db, font_width, font_height, 0, 0);

Expand All @@ -310,23 +336,52 @@ void draw_dungeon_info(z64_disp_buf_t* db) {
// Draw small key counts
sprite_load(db, &quest_items_sprite, 17, 1);

// First draw precompleted dungeons keys grayed out.
gDPSetPrimColor(db->p++, 0, 0, 0xFF, 0xFF, 0xFF, 0x7F);
for (int i = 0; i < rows; i++) {
dungeon_entry_t* d = &(dungeons[i]);
if (!d->has_keys) continue;
int empty = CFG_DUNGEON_PRECOMPLETED[d->index];
if (empty == 1) {
if (!d->has_keys) continue;

int8_t current_keys = z64_file.dungeon_keys[d->index];
if (current_keys < 0) current_keys = 0;
if (current_keys > 9) current_keys = 9;
int8_t current_keys = z64_file.dungeon_keys[d->index];
if (current_keys < 0) current_keys = 0;
if (current_keys > 9) current_keys = 9;

int8_t total_keys = z64_file.scene_flags[d->index].unk_00_ >> 0x10;
if (total_keys < 0) total_keys = 0;
if (total_keys > 9) total_keys = 9;
int8_t total_keys = z64_file.scene_flags[d->index].unk_00_ >> 0x10;
if (total_keys < 0) total_keys = 0;
if (total_keys > 9) total_keys = 9;

char count[5] = "O(O)"; // we use O instead of 0 because it's easier to distinguish from 8
if (current_keys > 0) count[0] = current_keys + '0';
if (total_keys > 0) count[2] = total_keys + '0';
int top = start_top + ((icon_size + padding) * i) + 1;
text_print_size(count, left, top, font_width);
char count[5] = "O(O)"; // we use O instead of 0 because it's easier to distinguish from 8
if (current_keys > 0) count[0] = current_keys + '0';
if (total_keys > 0) count[2] = total_keys + '0';
int top = start_top + ((icon_size + padding) * i) + 1;
text_print_size(count, left, top, font_width);
}
}
text_flush_size(db, font_width, font_height, 0, 0);
// Then the rest in white.
gDPSetPrimColor(db->p++, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF);
for (int i = 0; i < rows; i++) {
dungeon_entry_t* d = &(dungeons[i]);
int empty = CFG_DUNGEON_PRECOMPLETED[d->index];
if (empty == 0) {
if (!d->has_keys) continue;

int8_t current_keys = z64_file.dungeon_keys[d->index];
if (current_keys < 0) current_keys = 0;
if (current_keys > 9) current_keys = 9;

int8_t total_keys = z64_file.scene_flags[d->index].unk_00_ >> 0x10;
if (total_keys < 0) total_keys = 0;
if (total_keys > 9) total_keys = 9;

char count[5] = "O(O)"; // we use O instead of 0 because it's easier to distinguish from 8
if (current_keys > 0) count[0] = current_keys + '0';
if (total_keys > 0) count[2] = total_keys + '0';
int top = start_top + ((icon_size + padding) * i) + 1;
text_print_size(count, left, top, font_width);
}
}
text_flush_size(db, font_width, font_height, 0, 0);

Expand Down
3 changes: 3 additions & 0 deletions ASM/src/config.asm
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ CFG_DUNGEON_REWARD_WORLDS:
.align 4
CFG_BIGOCTO_OVERRIDE_KEY:
.word 0
.area 14, 0x00
CFG_DUNGEON_PRECOMPLETED:
.endarea
.align 4

; These configuration values are given fixed addresses to aid auto-trackers.
Expand Down
2 changes: 2 additions & 0 deletions Patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -2771,6 +2771,7 @@ def configure_dungeon_info(rom: Rom, world: World) -> None:
dungeon_rewards[codes.index(area.dungeon_name)] = boss_reward_index(location.item)

dungeon_is_mq = [1 if world.dungeon_mq.get(c) else 0 for c in codes]
dungeon_precompleted = [1 if world.empty_dungeons[c].empty else 0 for c in codes]

rom.write_int32(rom.sym('CFG_DUNGEON_INFO_ENABLE'), 2)
rom.write_int32(rom.sym('CFG_DUNGEON_INFO_MQ_ENABLE'), int(mq_enable))
Expand All @@ -2784,6 +2785,7 @@ def configure_dungeon_info(rom: Rom, world: World) -> None:
rom.write_bytes(rom.sym('CFG_DUNGEON_REWARD_AREAS'), dungeon_reward_areas)
rom.write_byte(rom.sym('CFG_DUNGEON_INFO_REWARD_WORLDS_ENABLE'), int(world.settings.world_count > 1 and world.settings.shuffle_dungeon_rewards in ('regional', 'overworld', 'any_dungeon', 'anywhere')))
rom.write_bytes(rom.sym('CFG_DUNGEON_REWARD_WORLDS'), dungeon_reward_worlds)
rom.write_bytes(rom.sym('CFG_DUNGEON_PRECOMPLETED'), dungeon_precompleted)


# Overwrite an actor in rom w/ the actor data from LocationList
Expand Down
Loading

0 comments on commit f72fb8e

Please sign in to comment.