Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross out pre-completed dungeons in dungeon info menu #2244

Merged
merged 4 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,802 changes: 1,402 additions & 1,400 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,237 changes: 619 additions & 618 deletions ASM/build/c_symbols.txt

Large diffs are not rendered by default.

47 changes: 41 additions & 6 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 @@ -217,7 +219,7 @@ void draw_dungeon_info(z64_disp_buf_t* db) {
int bg_left = (Z64_SCREEN_WIDTH - bg_width) / 2;
int bg_top = (Z64_SCREEN_HEIGHT - bg_height) / 2;

int left = bg_left + padding;
uint16_t left = bg_left + padding;
int start_top = bg_top + padding;

// Draw background
Expand Down Expand Up @@ -293,12 +295,29 @@ void draw_dungeon_info(z64_disp_buf_t* db) {

left += icon_size + padding;

// Draw dungeon names

// Draw the list of dungeons.
// Pre completed dungeons are grayed and crossed out.
for (int i = 0; i < rows; i++) {
gDPPipeSync(db->p++);
dungeon_entry_t* d = &(dungeons[i]);
bool empty = CFG_DUNGEON_PRECOMPLETED[d->index];
int top = start_top + ((icon_size + padding) * i) + 1;
text_print_size(db, d->name, left, top, font_width, font_height);
if (empty) {
gDPSetPrimColor(db->p++, 0, 0, 0xFF, 0xFF, 0xFF, 0x7F);
uint16_t sizeRectangle = text_print_size(db, d->name, left, top, font_width, font_height) - left;
gDPSetPrimColor(db->p++, 0, 0, 0xFF, 0xFF, 0xFF, 0xBF);
gDPSetCombineMode(db->p++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
gSPTextureRectangle(db->p++,
left * 4, (top + 5) * 4,
(left + sizeRectangle) * 4, ((top + 5) + 1) * 4,
0,
0, 0,
1024, 1024);
gDPSetCombineMode(db->p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
} else {
gDPSetPrimColor(db->p++, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF);
text_print_size(db, d->name, left, top, font_width, font_height);
}
}

left += ((SHUFFLE_CHEST_GAME == 1 ? 11 : 8) * font_width) + padding;
Expand Down Expand Up @@ -829,20 +848,36 @@ void draw_dungeon_info(z64_disp_buf_t* db) {
int start_top = bg_top + padding;

draw_background(db, bg_left, bg_top, bg_width, bg_height);
gDPSetPrimColor(db->p++, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF);

// Draw dungeon names

for (int i = 0; i < 12; i++) {
dungeon_entry_t* d = &(dungeons[i + (i > 9 ? 1 : 0)]); // skip Hideout
bool empty = CFG_DUNGEON_PRECOMPLETED[d->index];
int top = start_top + ((icon_size + padding) * i) + 1;
text_print(db, d->name, left, top);
if (empty) {
gDPSetPrimColor(db->p++, 0, 0, 0xFF, 0xFF, 0xFF, 0x7F);
uint16_t sizeRectangle = text_print(db, d->name, left, top) - left;
gDPSetPrimColor(db->p++, 0, 0, 0xFF, 0xFF, 0xFF, 0xBF);
gDPSetCombineMode(db->p++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
gSPTextureRectangle(db->p++,
left * 4, (top + 6) * 4,
(left + sizeRectangle) * 4, (top + 6 + 2) * 4,
0,
0, 0,
1024, 1024);
gDPSetCombineMode(db->p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
} else {
gDPSetPrimColor(db->p++, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF);
text_print(db, d->name, left, top);
fenhl marked this conversation as resolved.
Show resolved Hide resolved
}
}

left += (8 * font_sprite.tile_w) + padding;

// Draw maps and compasses

gDPSetPrimColor(db->p++, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF);
if (show_map_compass) {
// Draw maps

Expand Down
3 changes: 3 additions & 0 deletions ASM/src/config.asm
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ PASSWORD:
.endarea
REWARDS_AS_ITEMS:
.byte 0x00
.area 14, 0x00
CFG_DUNGEON_PRECOMPLETED:
.endarea
fenhl marked this conversation as resolved.
Show resolved Hide resolved
.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 @@ -2790,6 +2790,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]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existing names chosen for pre-completed dungeons seem to be misleading. They aren't empty dungeons, and empty as a property on the dungeon almost looks like a language feature to check if the index in an array is empty.

For clarity maybe these should be renamed to precompleted_dungeons and precompleted?

Copy link
Collaborator

@fenhl fenhl Jun 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure the .empty attribute access is needed at all. I think World.empty_dungeons could just be a dict[str, bool] (or maybe even set[str]). I guess this PR is as good a time to change it as any, but it shouldn't be a blocker since it could also be handled in a separate PR. Regarding the name change, the current name matches the internal/plando name for the setting, so it should stay for now imo. Hopefully we can eventually accept #1839 so we can rename it.


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 @@ -2803,6 +2804,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
Loading