Skip to content
Open
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,114 changes: 1,063 additions & 1,051 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,497 changes: 752 additions & 745 deletions ASM/build/c_symbols.txt

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions ASM/c/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "item_effects.h"
#include "actor.h"
#include "player.h"
#include "displaygrottoname.h"

extern uint16_t current_textbox_id;

Expand Down Expand Up @@ -474,6 +475,8 @@ void draw_debug_menu(z64_disp_buf_t* db) {

z64_game.scene_load_flag = 0x14;
z64_game.fadeout_transition = 0x02;
CURRENT_GROTTO_ID = 0xFF;
DISPLAY_GROTTO_TIMER = 0;
show_warp_menu = 0;
}
}
Expand Down Expand Up @@ -550,6 +553,8 @@ void draw_debug_menu(z64_disp_buf_t* db) {
z64_file.respawn[RESPAWN_MODE_RETURN].roomIndex = room->room_index;
z64_file.respawn_flag = 2;
z64_game.scene_load_flag = 0x14;
CURRENT_GROTTO_ID = 0xFF;
DISPLAY_GROTTO_TIMER = 0;
show_warp_menu = 0;
}
}
Expand All @@ -573,6 +578,8 @@ void draw_debug_menu(z64_disp_buf_t* db) {
z64_game.entrance_index = d->entrance_index;
z64_game.scene_load_flag = 0x14;
z64_game.fadeout_transition = 0x02;
CURRENT_GROTTO_ID = 0xFF;
DISPLAY_GROTTO_TIMER = 0;
show_warp_menu = 0;
}
break;
Expand All @@ -595,6 +602,8 @@ void draw_debug_menu(z64_disp_buf_t* db) {
z64_game.entrance_index = d->entrance_index;
z64_game.scene_load_flag = 0x14;
z64_game.fadeout_transition = 0x02;
CURRENT_GROTTO_ID = 0xFF;
DISPLAY_GROTTO_TIMER = 0;
show_warp_menu = 0;
}
break;
Expand Down
109 changes: 109 additions & 0 deletions ASM/c/displaygrottoname.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
#include "z64.h"
#include "gfx.h"
#include "text.h"
#include "displaygrottoname.h"

uint8_t DISPLAY_GROTTO_TIMER = 0;

const char grottoNames[][28] = {
"Colossus Grotto",
"LH Grotto",
"ZR Storms Grotto",
"ZR Fairy Grotto",
"ZR Open Grotto",
"DMC Hammer Grotto",
"DMC Upper Grotto",
"GC Grotto",
"DMT Storms Grotto",
"DMT Cow Grotto",
"Kak Open Grotto",
"Kak Redead Grotto",
"HC Storms Grotto",
"HF Tektite Grotto",
"HF Near Kak Grotto",
"HF Fairy Grotto",
"HF Near Market Grotto",
"HF Cow Grotto",
"HF Inside Fence Grotto",
"HF Open Grotto",
"HF Southeast Grotto",
"LLR Grotto",
"SFM Wolfos Grotto",
"SFM Storms Grotto",
"SFM Fairy Grotto",
"LW Scrubs Grotto",
"LW Near Shortcuts Grotto",
"KF Storms Grotto",
"ZD Storms Grotto",
"GF Storms Grotto",
"GV Storms Grotto",
"GV Octorok Grotto",
"Deku Theater",
};

const char fairyNames[][24] = {
"Colossus GF",
"Hyrule Castle GF",
"Ganon's Castle GF",
"DM Crater GF",
"DM Trail GF",
"Zora's Fountain GF",
};

void DisplayGrottoName(z64_disp_buf_t* db) {
if (!CFG_DISPLAY_GROTTO_NAMES) {
return;
}

if (DISPLAY_GROTTO_TIMER != 0 || (z64_game.pause_ctxt.state == PAUSE_STATE_MAIN)) {
const char* text;
uint8_t alpha = 0xFF;

if (CURRENT_GROTTO_ID != 255) {
text = grottoNames[CURRENT_GROTTO_ID];
} else {
switch (z64_file.entrance_index) {
case 0x588:
text = fairyNames[0];
break;
case 0x578:
text = fairyNames[1];
break;
case 0x4C2:
text = fairyNames[2];
break;
case 0x4BE:
text = fairyNames[3];
break;
case 0x315:
text = fairyNames[4];
break;
case 0x371:
text = fairyNames[5];
break;
default:
return; // paused probably
}
}

if (z64_game.pause_ctxt.state != PAUSE_STATE_MAIN) {
DISPLAY_GROTTO_TIMER--;
if (DISPLAY_GROTTO_TIMER < 80) {
alpha = DISPLAY_GROTTO_TIMER * 3 + 10;
if (DISPLAY_GROTTO_TIMER < 60) {
DISPLAY_GROTTO_TIMER -= 3; // for alpha
}
}
}

uint8_t left = 33;
uint8_t top = 196;

gSPDisplayList(db->p++, &setup_db);
gDPSetCombineMode(db->p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
gDPSetPrimColor(db->p++, 0, 0, 0, 0, 0, alpha);
text_print_size(db, text, left + 1, top + 1, 10, 10);
gDPSetPrimColor(db->p++, 0, 0, 0xFF, 0xFF, 0xFF, alpha);
text_print_size(db, text, left, top, 10, 10);
}
}
10 changes: 10 additions & 0 deletions ASM/c/displaygrottoname.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef DISPLAY_GROTTO_NAME_H
#define DISPLAY_GROTTO_NAME_H

extern uint8_t CFG_DISPLAY_GROTTO_NAMES;
extern uint8_t CURRENT_GROTTO_ID;
extern uint8_t DISPLAY_GROTTO_TIMER;

void DisplayGrottoName(z64_disp_buf_t* db);

#endif //DISPLAY_GROTTO_NAME_H
3 changes: 3 additions & 0 deletions ASM/c/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "debug.h"
#include "inputviewer.h"
#include "message.h"
#include "displaygrottoname.h"

void Gameplay_InitSkybox(z64_game_t* globalCtx, int16_t skyboxId);

Expand Down Expand Up @@ -58,6 +59,7 @@ void after_game_state_update() {
// Checks if the prerender screen is being drawn before drawing new HUD things.
// Else this will cause graphical and/or lag issues on some emulators when pausing.
if (R_PAUSE_BG_PRERENDER_STATE != PAUSE_BG_PRERENDER_PROCESS) {
DisplayGrottoName(&rando_overlay_db);
draw_dungeon_info(&rando_overlay_db);
draw_world_info(&rando_overlay_db);
draw_triforce_count(&rando_overlay_db);
Expand All @@ -66,6 +68,7 @@ void after_game_state_update() {
draw_illegal_model_text(&rando_overlay_db);
draw_input_viewer(&rando_overlay_db);
display_song_name(&rando_overlay_db);

#if DEBUG_MODE
debug_utilities(&debug_db);
#endif
Expand Down
2 changes: 2 additions & 0 deletions ASM/src/config.asm
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ CFG_DUNGEON_PRECOMPLETED:
.endarea
DOT_CONDITION:
.byte 0x01
CFG_DISPLAY_GROTTO_NAMES:
.byte 0x00
.align 4

; These configuration values are given fixed addresses to aid auto-trackers.
Expand Down
6 changes: 5 additions & 1 deletion ASM/src/grotto.asm
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ scene_exit_hook:
addiu sp, sp, 0x10

@@return:
la t0,DISPLAY_GROTTO_TIMER ; zero in case insta-exiting grotto/GFF (set on player init)
sb zero,(t0)
jr ra
sh t6, 0x1E1A(at) ; set the entrance index to load in the context

Expand Down Expand Up @@ -104,8 +106,10 @@ handle_grotto_load:
bgez t0, @@return ; dynamic exits (entrance indexes > 0x7FF9) shouldn't be translated
li t0, 0x1000
sub t0, a0, t0
bltz t0, @@return ; normal exits (entrance indexes < 0x1000) shouldn't be translated either
bltzl t0, @@return ; normal exits (entrance indexes < 0x1000) shouldn't be translated either
nop

@@GrottoFix:
; Translate to grotto load
la t1, SAVE_CONTEXT
la t2, GROTTO_LOAD_TABLE
Expand Down
10 changes: 5 additions & 5 deletions ASM/src/hacks.asm
Original file line number Diff line number Diff line change
Expand Up @@ -3827,21 +3827,21 @@ DemoEffect_DrawJewel_AfterHook:
; Load current mask on scene change
;==================================================================================================
; Player_Init (0x80844DE8)
; Replaces:
;jal func_80834000
.orga 0xBE28EC
; Also sets display name timer for grottos/GFF
; Replaces: jal Player_UseItem
.orga 0xBE28EC ; 0x80844f3c
jal player_restore_mask

; Dumb hack to not relocate the function call to player_restore_mask
.orga 0xBF2C14
.orga 0xBF2C14 ; 0x80855264 in reloc?
nop

; Save the current mask on file save
; replaces
;lh t8, 0xA4(s1)
;lui t1, 0x8012
; SaveContext->save.info.playerData.savedSceneId = play->sceneId;
.orga 0xBC5120
.orga 0xBC5120 ; 0x80827728 in kaleidoscope_update?
jal player_save_mask
nop

Expand Down
36 changes: 31 additions & 5 deletions ASM/src/player_save_mask.asm
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,56 @@ CFG_MASK_AUTOEQUIP:
player_save_mask:
;s1 = PlayState play*
lb t1, CFG_MASK_AUTOEQUIP
beqz t1, @@return
beqz t1, @@Return
lw t1, 0x1C44(s1) ;player*
lbu t7, 0x014F(t1) ;player->currentMask
la t8, SAVE_CONTEXT
sb t7, 0x3B(t8) ;saveContext->savedMask (custom field)

; displaced code
@@return:
@@Return:
lh t8, 0xA4(s1)
jr ra
lui t1, 0x8012

; Restore a player's worn mask on player init, as well as check for grotto/GFF
; entrance to set display name timer
player_restore_mask:
lb t0, CFG_MASK_AUTOEQUIP
beqz t0, @@return
beqz t0, @@CheckGrottoText
lhu t0, 0x1C(a1) ;player->params
andi t0, t0, 0xF00
sra t0, t0, 0x8
addiu t1, r0, 0x1 ;Init mode that is set when player pulled or placed master sword
beq t0, t1, @@return
beq t0, t1, @@CheckGrottoText

lbu t0, 0x3B(s2) ;saveContext->savedMask (custom field)
sb t0, 0x014F(a1) ;player->currentMask
@@return:

@@CheckGrottoText: ; s1 play
lbu t0,CURRENT_GROTTO_ID ; Check if grotto for intro text
li at,0xFF
bne t0,at,@@SetTimer
lui t0,0x8011 ; Check if Great Fairy Fountain for intro text
ori t0,0xA5D0 ; nextEntranceIndex
lw t0,(t0)
li at,0x0588 ; Colossus
beq at,t0,@@SetTimer
li at,0x0578 ; HC
beq at,t0,@@SetTimer
li at,0x04C2 ; OGC
beq at,t0,@@SetTimer
li at,0x04BE ; DMC
beq at,t0,@@SetTimer
li at,0x0315 ; DMT
beq at,t0,@@SetTimer
li at,0x0371 ; ZF
bne at,t0,@@Return
@@SetTimer:
li t0,100
la t1,DISPLAY_GROTTO_TIMER
sb t0,(t1)
@@Return:
la t0, 0x800FE49C ;Links entry in `gKaleidoMgrOverlayTable`
lw t1, 0x0(t0) ;ovlTable->loadedRamAddr
la t2, 0x80834000 ;vram of function to jump to in Links overlay
Expand Down
3 changes: 3 additions & 0 deletions Patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -1575,6 +1575,9 @@ def update_scrub_text(message: bytearray, text_replacement: list[str], default_p
# Update grotto actors based on their new entrance
set_grotto_shuffle_data(rom, world)

if world.settings.display_grotto_names:
rom.write_byte(rom.sym('CFG_DISPLAY_GROTTO_NAMES'), 0x01)

if world.settings.shuffle_cows:
rom.write_byte(rom.sym('SHUFFLE_COWS'), 0x01)
# Move some cows because they are too close from each other in vanilla
Expand Down
13 changes: 13 additions & 0 deletions SettingsList.py
Original file line number Diff line number Diff line change
Expand Up @@ -1778,11 +1778,24 @@ class SettingInfos:
''',
default = False,
shared = True,
disable = {
False: {'settings': ['display_grotto_names']},
},
gui_params = {
'randomize_key': 'randomize_settings',
},
)

display_grotto_names = Checkbutton(
gui_text = 'Display Grotto and GF Names',
gui_tooltip = '''\
Displays the name of a grotto (as well as Great Fairy
Fountains) when entering it and on the pause screen.
''',
default = False,
shared = True,
)

shuffle_dungeon_entrances = Combobox(
gui_text = 'Shuffle Dungeon Entrances',
default = 'off',
Expand Down
2 changes: 1 addition & 1 deletion data/generated/patch_symbols.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading