From 6c4acb1e5b14c19925a3a407ff966bb4bbe72002 Mon Sep 17 00:00:00 2001 From: cassidoxa Date: Wed, 19 Jan 2022 20:17:02 -0500 Subject: [PATCH] Check new value in SRAM to determine if Aga 2 duck comes Added pushpc/pullpc to sram.asm --- events.asm | 5 +++-- hooks.asm | 10 ++++------ sram.asm | 7 ++++++- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/events.asm b/events.asm index ec22500..0c65d5d 100644 --- a/events.asm +++ b/events.asm @@ -80,8 +80,9 @@ OnUncleItemGet: RTL ;-------------------------------------------------------------------------------- OnAga2Defeated: - JSL.l Dungeon_SaveRoomData_justKeys ; thing we wrote over, make sure this is first - JML.l IncrementAgahnim2Sword + JSL.l Dungeon_SaveRoomData_justKeys ; thing we wrote over, make sure this is first + LDA.b #$01 : STA Aga2Duck + JML.l IncrementAgahnim2Sword ;-------------------------------------------------------------------------------- OnFileCreation: TAX ; what we wrote over diff --git a/hooks.asm b/hooks.asm index 8584242..a848d7d 100755 --- a/hooks.asm +++ b/hooks.asm @@ -2394,15 +2394,13 @@ Overworld_Hole_End: ;-------------------------------------------------------------------------------- ;================================================================================ -; Disable pyramid hole check for killing aga2 +; Replace pyramid hole check for killing aga2 ; ; this check is intended to prevent getting fluted out a second time if you -; return to his room after already killing him once. But with a pre-opened -; pyramid hole, it can cause you to get stuck there on killing him the first -; time. So we change it, and accept the flute out if you return. +; return to his room after already killing him once. ;--------------------------------------------------------------------------------- -org $01C753 ; 0C753 = Bank01:10398 (LDA $7EF2DB : AND.b #$20 : BNE .return) -db $00 ; (originally $20) +org $01C74E ; 00C74E - bank_01.asm:13281 - (LDA.l $7EF2DB : AND.b #$20) +LDA.l Aga2Duck : NOP #2 ;================================================================================ ; Music fixes diff --git a/sram.asm b/sram.asm index 11f98c5..c170586 100644 --- a/sram.asm +++ b/sram.asm @@ -8,6 +8,7 @@ ; $7F6000 - $7F6FFF in WRAM maps to the next 4k bytes, occupying the 2nd and 3rd vanilla ; save file locations. ($700500 - $701500) ;-------------------------------------------------------------------------------- +pushpc org 0 ; This module writes no bytes. Asar gives bank cross errors without this. ;================================================================================ @@ -225,7 +226,9 @@ CompassCountDisplay: skip 2 ; Compass count display flags (bitfield) ; High Byte: x c e d a s p m ; x = Sewers | c = Hyrule Castle | e = Eastern Palace | d = Desert Palace ; a = Castle Tower | s = Swamp Palace | p = PoD | m = Mire -skip 11 ; +skip 10 ; +Aga2Duck: skip 1 ; Used in lieu of pyramid hole for checking if the duck should come + ; 0 = Haven't called post-Aga 2 bird | 1 = Have called post-Aga 2 bird NpcFlags: skip 2 ; l - c s t k z o (bitfield) ; l = Library | c = Catfish | s = Sahasrahla | t = Stumpy ; k = Sick Kid | z = King Zora | o = Old Man @@ -514,6 +517,7 @@ endmacro %assertSRAM(GameCounter, $7EF3FF) %assertSRAM(PostGameCounter, $7EF401) %assertSRAM(CompassCountDisplay, $7EF403) +%assertSRAM(Aga2Duck, $7EF40F) %assertSRAM(NpcFlags, $7EF410) %assertSRAM(MapOverlay, $7EF414) %assertSRAM(HudFlag, $7EF416) @@ -636,3 +640,4 @@ endmacro %assertSRAM(RomVersionSRAM, $701FFC) %assertSRAM(PasswordSRAM, $703000) +pullpc