Skip to content

Commit 37e0c2f

Browse files
committed
Merge 'Fairy ocarina override' (#2080)
2 parents 775084f + 65e77ae commit 37e0c2f

File tree

13 files changed

+26084
-25983
lines changed

13 files changed

+26084
-25983
lines changed

ASM/build/asm_symbols.txt

Lines changed: 540 additions & 538 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ASM/build/bundle.o

340 Bytes
Binary file not shown.

ASM/build/c_symbols.txt

Lines changed: 234 additions & 233 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ASM/c/get_items.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,3 +895,23 @@ int give_sarias_gift() {
895895
// return 1 to skip the cutscene
896896
return OCARINAS_SHUFFLED || received_sarias_gift;
897897
}
898+
899+
// called as part of the cutscene
900+
void fairy_ocarina_getitem() {
901+
override_key_t lw_gift_from_saria = { .scene = 0xFF, .type = OVR_DELAYED, .flag = 0x02 };
902+
override_t override = lookup_override_by_key(lw_gift_from_saria);
903+
uint16_t resolved_item_id = resolve_upgrades(override);
904+
switch (resolved_item_id) {
905+
case 0x003B: { // Fairy Ocarina
906+
z64_file.items[Z64_SLOT_OCARINA] = 0x07;
907+
break;
908+
}
909+
case 0x000C: { // Ocarina of Time
910+
z64_file.items[Z64_SLOT_OCARINA] = 0x08;
911+
break;
912+
}
913+
}
914+
item_row_t *item_row = get_item_row(resolved_item_id);
915+
PLAYER_NAME_ID = override.value.base.player;
916+
z64_DisplayTextbox(&z64_game, resolve_item_text_id(item_row, resolved_item_id, PLAYER_NAME_ID != PLAYER_ID), 0);
917+
}

ASM/c/get_items.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ enum override_type {
2222
};
2323

2424

25-
typedef union overide_key_t {
25+
typedef union override_key_t {
2626
uint32_t all;
2727
struct {
2828
uint8_t scene;

ASM/src/build.asm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ RANDO_CONTEXT:
127127

128128
.include "armos.asm"
129129
.include "ocarina_buttons.asm"
130+
.include "fairy_ocarina.asm"
130131

131132

132133
.align 0x10

ASM/src/fairy_ocarina.asm

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
fairy_ocarina_getitem_override:
2+
addiu sp, sp, -0x20
3+
sw a0, 0x18(sp)
4+
sw ra, 0x1C(sp)
5+
6+
jal fairy_ocarina_getitem
7+
nop
8+
9+
lw a0, 0x18(sp)
10+
lw ra, 0x1C(sp)
11+
jr ra
12+
addiu sp, sp, 0x20

ASM/src/hacks.asm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3993,3 +3993,11 @@ courtyard_guards_kill:
39933993
; sw t7, 0x1F24(at)
39943994
jal ocarina_buttons
39953995
nop
3996+
3997+
;===================================================================================================
3998+
; Overrides the function that gives Fairy Ocarina on the Lost Woods Bridge
3999+
;===================================================================================================
4000+
.orga 0xACCDFC
4001+
; Replaces Item_Give(play, ITEM_OCARINA_FAIRY)
4002+
jal fairy_ocarina_getitem_override
4003+
nop

Patches.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -662,9 +662,6 @@ def make_bytes(txt: str, size: int) -> list[int]:
662662

663663
# Speed obtaining Fairy Ocarina
664664
rom.write_bytes(0x2151230, [0x00, 0x72, 0x00, 0x3C, 0x00, 0x3D, 0x00, 0x3D])
665-
block_code = [0x00, 0x4A, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
666-
0xFF, 0xFF, 0x00, 0x3C, 0x00, 0x81, 0xFF, 0xFF]
667-
rom.write_bytes(0x2151240, block_code)
668665
rom.write_bytes(0x2150E20, [0xFF, 0xFF, 0xFA, 0x4C])
669666

670667
if world.settings.shuffle_ocarinas:

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ issue. You should always Hard Reset to avoid this issue entirely.
168168
* Fix a softlock caused by 8-note Sun's Songs when using `Randomize Ocarina Song Notes`, again.
169169
* Fix pause screen rendering causing graphical issues on some platforms.
170170
* Fix a long-standing bug where certain fanfares kill the currently-playing backgroud music.
171+
* Fix a bug which would cause the Lost Woods bridge ocarina check, if ocarinas are unshuffled and overworld Entrance Randomizer is disabled, to give a Fairy Ocarina when it should give the Ocarina of Time.
171172
* **Hints**
172173
* Fix the cryptic hint for Ganon's Castle Boss Key.
173174
* Fix missing punctuation in dual hints.

0 commit comments

Comments
 (0)