From 87cac1a113bd4e6129cb525317dd9778592ad8d4 Mon Sep 17 00:00:00 2001 From: Catobat <69204835+Catobat@users.noreply.github.com> Date: Mon, 13 Jun 2022 20:37:59 +0200 Subject: [PATCH 01/10] Shuffle Back of Tavern --- doorframefixes.asm | 38 ++++++++++++++++++++++++++++++++++++++ hooks.asm | 17 ++++++++++++++++- tables.asm | 5 +++++ 3 files changed, 59 insertions(+), 1 deletion(-) diff --git a/doorframefixes.asm b/doorframefixes.asm index 921dee5..c233c26 100644 --- a/doorframefixes.asm +++ b/doorframefixes.asm @@ -37,3 +37,41 @@ WalkDownIntoTavern: CMP #$43 RTL ;-------------------------------------------------------------------------------- + +;-------------------------------------------------------------------------------- +; TurnAroundOnUnderworld +;-------------------------------------------------------------------------------- +TurnAroundOnUnderworld: + LDA $26 : BEQ .done + ; turn around if ($010E == #$43) != ($7F5099 == #$43) + LDX #$00 + LDA #$43 : CMP $010E : BEQ + + INX + + + CMP $7F5099 : BEQ + + DEX + + + CPX #$00 : BEQ .done + LDA $26 : EOR #$0C : STA $26 +.done +JML $0FFD65 ; what we overwrote + +;-------------------------------------------------------------------------------- +; TurnUpOnOverworld +;-------------------------------------------------------------------------------- +TurnUpOnOverworld: + LDA.l EntranceTavernBack : CMP #$43 : BEQ .done + LDA #$08 : STA $26 ; only fix this glitch if exit not vanilla +.done +JML $07E68F ; what we overwrote + +;-------------------------------------------------------------------------------- +; WalkUpOnOverworld +;-------------------------------------------------------------------------------- +WalkUpOnOverworld: + LDA $20 : CMP #$091B : BNE .normal ; hardcoded Y coordinate + STZ $2F + RTL + .normal + LDA #$0002 : STA $2F ; what we overwrote +RTL \ No newline at end of file diff --git a/hooks.asm b/hooks.asm index e85870e..421b082 100755 --- a/hooks.asm +++ b/hooks.asm @@ -2886,4 +2886,19 @@ if !FEATURE_NEW_TEXT JSL RenderCharSetColorExtended_init org $0EF285 JSL RenderCharSetColorExtended_close : NOP -endif \ No newline at end of file +endif +;-------------------------------------------------------------------------------- +; Back of tavern fixes +;-------------------------------------------------------------------------------- +org $028177 ; JSL Underworld_LoadCustomTileAttributes +JSL TurnAroundOnUnderworld + +org $02ABC1 ; JSL Link_HandleMovingAnimation_FullLongEntry +JSL TurnUpOnOverworld + +org $02E297 ; LDA.w #$0002 : STA.b $2F +JSL WalkUpOnOverworld +NOP + +org $02D7D2 ; BEQ .face_up +NOP #2 ; this fixes Link's direction after mirroring and falling after entering through back of tavern \ No newline at end of file diff --git a/tables.asm b/tables.asm index 13ada44..3f667c4 100644 --- a/tables.asm +++ b/tables.asm @@ -956,6 +956,11 @@ dw #$0000, #$0000 org $09E3BB ; PC 0x4E3BB db $E4 ; Hera Basement Key (Set to programmable HP $EB) (set to $E4 for original hookable/boomable key behavior) ;================================================================================ +org $02D7D0 ; PC 0x157D0 +EntranceTavernBack: +dw $0043 ; Overworld door that leads to back of tavern (update this when this entrance is shuffled) +; Note: If shuffled, the overworld door on the north side of the tavern is expected to have a Y coordinate of $091B in the exit data (table at $02DDB5) +;================================================================================ org $308210 ; PC 0x180210 RandomizerSeedType: db #$00 ; #$00 = Casual (default) - #$01 = Glitched - #$02 = Speedrunner - #$A0 = Super Metroid Combo - #$FF = Not Randomizer From 2579038832915e58d44f82f77838e149dc4dd9c9 Mon Sep 17 00:00:00 2001 From: aerinon Date: Tue, 14 Jun 2022 12:36:04 -0600 Subject: [PATCH 02/10] Mirror scroll spawns in Zelda's cell instead of last entrance (mirror remains unchanged) Tapestry is open when spawning in the throne room. --- LTTP_RND_GeneralBugfixes.asm | 3 +++ hooks.asm | 3 +++ mantle.asm | 17 ++++++++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index 064d457..8033477 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -518,6 +518,9 @@ Dungeon_SaveRoomData_justKeys: org $02B861 Dungeon_SaveRoomQuadrantData: +org $02D9B9 +Underworld_LoadSpawnEntrance: + org $02FD8A ; 17D8A - Bank0E.asm: 3732 Note: Different bank LoadGearPalettes_bunny: diff --git a/hooks.asm b/hooks.asm index e85870e..029e9e0 100755 --- a/hooks.asm +++ b/hooks.asm @@ -2439,6 +2439,9 @@ NOP #6 ; remove check org $068841 ; <- 30841 - sprite_prep.asm:269 (LDA $0D00, X : ADD.b #$03 : STA $0D00, X) JSL.l Mantle_CorrectPosition : NOP #2 ;-------------------------------------------------------------------------------- +org $02D6FC ; <- bank02 : Underworld_LoadEntrance.not_a_respawn (LDA.w $010E : AND.w #$00FF) +JSL MirrorScrollSpawnZelda : NOP #2 +;-------------------------------------------------------------------------------- org $0DFA53 ; <- 6FA53 - hud check for lantern JSL.l LampCheck ;-------------------------------------------------------------------------------- diff --git a/mantle.asm b/mantle.asm index 5b60c1b..f5f0f98 100644 --- a/mantle.asm +++ b/mantle.asm @@ -2,7 +2,9 @@ ; Mantle Object Changes ;-------------------------------------------------------------------------------- Mantle_CorrectPosition: - LDA ProgressFlags : AND.b #$04 : BEQ + + LDA.l ProgressFlags : AND.b #$04 : BNE .spawnOpen + LDA.l StartingEntrance : CMP.b #$04 : BNE + + .spawnOpen LDA.b #$0A : STA $0D10, X ; just spawn it off to the side where we know it should be LDA.b #$03 : STA $0D30, X LDA.b #$90 : STA $0ED0, X @@ -10,3 +12,16 @@ Mantle_CorrectPosition: LDA $0D00, X : !ADD.b #$03 ; thing we did originally RTL ;-------------------------------------------------------------------------------- + +MirrorScrollSpawnZelda: + SEP #$20 + LDA.l StartingEntrance : CMP.b #$02 : BNE + + LDA.l MirrorEquipment : CMP.b #$01 : BNE + + REP #$20 + PLA ; remove JSL 16 bits + PEA.w Underworld_LoadSpawnEntrance-1 + RTL + + REP #$20 + ; what we replaced + LDA.w $010E : AND.w #$00FF +RTL \ No newline at end of file From 92c155f5c0a1cac00bfdf2a9a1a2b5464b6dbe9f Mon Sep 17 00:00:00 2001 From: aerinon Date: Thu, 16 Jun 2022 12:32:31 -0600 Subject: [PATCH 03/10] Re-implemented mirror scroll during escape behavior to not affect entrance and include the throne spawn point --- hooks.asm | 4 ++-- mantle.asm | 15 +++++---------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/hooks.asm b/hooks.asm index 029e9e0..a354271 100755 --- a/hooks.asm +++ b/hooks.asm @@ -2439,8 +2439,8 @@ NOP #6 ; remove check org $068841 ; <- 30841 - sprite_prep.asm:269 (LDA $0D00, X : ADD.b #$03 : STA $0D00, X) JSL.l Mantle_CorrectPosition : NOP #2 ;-------------------------------------------------------------------------------- -org $02D6FC ; <- bank02 : Underworld_LoadEntrance.not_a_respawn (LDA.w $010E : AND.w #$00FF) -JSL MirrorScrollSpawnZelda : NOP #2 +org $0297FD ; <- bank02 : Module07_19_MirrorFade (STZ.b $11 : STZ.b $14) +JSL MirrorScrollSpawnZelda ;-------------------------------------------------------------------------------- org $0DFA53 ; <- 6FA53 - hud check for lantern JSL.l LampCheck diff --git a/mantle.asm b/mantle.asm index f5f0f98..4496898 100644 --- a/mantle.asm +++ b/mantle.asm @@ -12,16 +12,11 @@ Mantle_CorrectPosition: LDA $0D00, X : !ADD.b #$03 ; thing we did originally RTL ;-------------------------------------------------------------------------------- - MirrorScrollSpawnZelda: - SEP #$20 - LDA.l StartingEntrance : CMP.b #$02 : BNE + - LDA.l MirrorEquipment : CMP.b #$01 : BNE + - REP #$20 - PLA ; remove JSL 16 bits - PEA.w Underworld_LoadSpawnEntrance-1 - RTL - + REP #$20 + LDA.l MirrorEquipment : CMP.b #$01 : BNE + ;mirror scroll + LDA.l StartingEntrance : CMP.b #$02 : BEQ ++ ; zelda's cell + CMP.b #$04 : BNE + + ++ INC $04AA ; what we replaced - LDA.w $010E : AND.w #$00FF + + STZ.b $11 : STZ.b $14 RTL \ No newline at end of file From 4e6acaf7b983946400b32fa53b11dd376011873d Mon Sep 17 00:00:00 2001 From: aerinon Date: Wed, 6 Jul 2022 09:48:42 -0600 Subject: [PATCH 04/10] Big key door double-sided check --- doorrando/doorrando.asm | 14 ++++++++++++++ doorrando/drhooks.asm | 17 ++++++----------- doorrando/overrides.asm | 6 ++++++ 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/doorrando/doorrando.asm b/doorrando/doorrando.asm index cc134be..94402b4 100644 --- a/doorrando/doorrando.asm +++ b/doorrando/doorrando.asm @@ -21,6 +21,20 @@ org $278000 ;138000 db $44, $52 ;DR DRMode: dw 0 +; xxpg rmse +; xxxx xBDM +; x - unused + +; p - use the original palette for the dungeon rooms instead of the DR table +; g - fix the EG glitch in more places (should be off for no logic) +; r - The collection rate flag +; m - Whether to display keys Map Info +; s - Start with Mirror Scroll +; e - GT minibosses marked as defeated instead of spawning heart container in all dungeons + +; B - Big Key doors can displayed and be opened on the "south" side in addition +; D - Enabled spawning as a bunny in the Dark World underworld +; M - hides the total number in the collection rate DRFlags: dw 0 DRScroll: diff --git a/doorrando/drhooks.asm b/doorrando/drhooks.asm index 708bd11..d3b8012 100644 --- a/doorrando/drhooks.asm +++ b/doorrando/drhooks.asm @@ -198,20 +198,15 @@ Underworld_DoorDown_Call: org $02C3F3 dw $8AD9 ; address of Bank02.asm:2085 -; These two, if enabled together, have implications for vanilla BK doors in IP/Hera/Mire -; IPBJ is common enough to consider not doing this. Mire is not a concern for vanilla - maybe glitched modes -; Hera BK door back can be seen with Pot clipping - likely useful for no logic seeds +org $01aa90 +JSL BigKeyDoorCheck -;Kill big key (1e) check for south doors -;org $1aa90 -;DontCheck: -;bra .done -;nop #3 -;.done +org $01AAA2 +RoomDraw_OneSidedShutters_South_onesided_shutter_or_big_key_door: ;Enable south facing bk graphic -;org $00CE24 -;dw $2ac8 +org $00CE24 +dw $2ac8 org $01b714 ; PC: b714 OpenableDoors: diff --git a/doorrando/overrides.asm b/doorrando/overrides.asm index a8338ac..fa7c0ed 100644 --- a/doorrando/overrides.asm +++ b/doorrando/overrides.asm @@ -152,3 +152,9 @@ BlindsAtticHint: SEP #$20 : RTL ; skip the dialog box if the hole is already open + SEP #$20 : JML Main_ShowTextMessage +BigKeyDoorCheck: + CPY.w #$001E : BNE + ; skip if it isn't a BK door + LDA.l DRFlags : AND #$0400 : BNE + ; skip if the flag is set - bk doors can be double-sided + PLA : PEA.w RoomDraw_OneSidedShutters_South_onesided_shutter_or_big_key_door-1 ++ RTL + From a6577b4e4b5e15630ac22e315692bb960dd2cbb3 Mon Sep 17 00:00:00 2001 From: aerinon Date: Fri, 5 Aug 2022 13:31:18 -0600 Subject: [PATCH 05/10] Output for collection rate config --- stats/statConfig.asm | 1 + 1 file changed, 1 insertion(+) diff --git a/stats/statConfig.asm b/stats/statConfig.asm index 3b2f3db..f353ecd 100755 --- a/stats/statConfig.asm +++ b/stats/statConfig.asm @@ -17,5 +17,6 @@ %AddStat(FaerieRevivalCounter, 0, 0, 08, 3, !FAERIE_REVIVALS_X, !FAERIE_REVIVALS_Y) %AddStat(MenuFrames, 1, 8, 32, 4, !TOTAL_MENU_TIME_X, !TOTAL_MENU_TIME_Y) %AddStat($7F5038, 1, 0, 32, 4, !TOTAL_LAG_TIME_X, !TOTAL_LAG_TIME_Y) +print "Colletion Rate config: ", pc %AddStat(TotalItemCounter, 0, 0, 16, 3, !COLLECTION_RATE_X, !COLLECTION_RATE_Y) %AddStat(NMIFrames, 1, 0, 32, 4, !TOTAL_TIME_X, !TOTAL_TIME_Y) From e3212996034528d95ad17af5136f8d7db3100145 Mon Sep 17 00:00:00 2001 From: aerinon Date: Mon, 8 Aug 2022 10:33:01 -0600 Subject: [PATCH 06/10] Fix for crash --- doorrando/drhooks.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doorrando/drhooks.asm b/doorrando/drhooks.asm index d3b8012..3f786b0 100644 --- a/doorrando/drhooks.asm +++ b/doorrando/drhooks.asm @@ -198,8 +198,8 @@ Underworld_DoorDown_Call: org $02C3F3 dw $8AD9 ; address of Bank02.asm:2085 -org $01aa90 -JSL BigKeyDoorCheck +org $01AA90 +JSL BigKeyDoorCheck : NOP org $01AAA2 RoomDraw_OneSidedShutters_South_onesided_shutter_or_big_key_door: From 2acee4abb93f9be922dce2e537d80689c3aec0d1 Mon Sep 17 00:00:00 2001 From: aerinon Date: Wed, 7 Sep 2022 15:09:04 -0600 Subject: [PATCH 07/10] Flute activated pickup sfx --- hooks.asm | 5 +++++ inventory.asm | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/hooks.asm b/hooks.asm index e9f0016..30981a1 100755 --- a/hooks.asm +++ b/hooks.asm @@ -1036,6 +1036,11 @@ NOP org $07B57D ; 3B57D - Bank07.asm:8527 (LDA Link_ReceiveItemAlternates, Y : STA $03) JSL.l Link_ReceiveItemAlternatesExpanded_loadAlternate NOP + +org $08C563 +JML ItemGetAlternateSFX : NOP +org $0988A5 +JSL ItemGetOverworldAlternateSFX : NOP #5 ;-------------------------------------------------------------------------------- org $09892E ; 4892E - ancilla_init.asm:1307 (LDA BottleList, X) LDA.w BottleListExpanded, X diff --git a/inventory.asm b/inventory.asm index 1b6b953..a0fdd29 100644 --- a/inventory.asm +++ b/inventory.asm @@ -1183,3 +1183,21 @@ RTL } ;-------------------------------------------------------------------------------- +; A = item id being collected +ItemGetAlternateSFX: +PEA.w $C567 ; SNES to RTS to in bank 08 +LDA.w $0C5E,X : CMP.b #$4A : BNE + + ; collecting pre-activated flute + LDA.b #$13 : JML $088007 ++ ; normal itemget sfx +LDA.b #$0F : JML $08800E ; what we wrote over + +; A = item id being collected +ItemGetOverworldAlternateSFX: +CMP.b #$4A : BNE + + JSL Sound_SetSfxPanWithPlayerCoords : ORA.b #$13 : STA.w $012E + RTL ++ ; normal itemget sfx +JSL Sound_SetSfxPanWithPlayerCoords : ORA.b #$0F : STA.w $012F ; what we wrote over +RTL +;-------------------------------------------------------------------------------- \ No newline at end of file From 6b853222f2b525c12f4f23a66a805a7ad8204277 Mon Sep 17 00:00:00 2001 From: aerinon Date: Wed, 7 Sep 2022 16:51:29 -0600 Subject: [PATCH 08/10] Fix for rain prevented doors and key door numbering --- doorrando/overrides.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doorrando/overrides.asm b/doorrando/overrides.asm index c1a3f6d..3f3fbf7 100644 --- a/doorrando/overrides.asm +++ b/doorrando/overrides.asm @@ -132,7 +132,7 @@ RainPrevention: - INX #2 : LDA.l RemoveRainDoorsRoom, X : CMP #$FFFF : BEQ .done CMP $A0 : BNE - SEP #$20 : LDA.l RainDoorMatch, X : CMP $00 : BNE .continue - REP #$20 : PLA : SEC : RTL + INC.w $0460 : INC.w $0460 : REP #$20 : PLA : SEC : RTL .continue REP #$20 : BRA - .done PLA : CLC : RTL From 686bb0c0646aa416d0aab668f35bb36a0325e59c Mon Sep 17 00:00:00 2001 From: aerinon Date: Fri, 30 Sep 2022 15:28:45 -0600 Subject: [PATCH 09/10] Big key door fix --- doorrando/overrides.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doorrando/overrides.asm b/doorrando/overrides.asm index 3f3fbf7..90cddb9 100644 --- a/doorrando/overrides.asm +++ b/doorrando/overrides.asm @@ -163,5 +163,5 @@ BigKeyDoorCheck: CPY.w #$001E : BNE + ; skip if it isn't a BK door LDA.l DRFlags : AND #$0400 : BNE + ; skip if the flag is set - bk doors can be double-sided PLA : PEA.w RoomDraw_OneSidedShutters_South_onesided_shutter_or_big_key_door-1 -+ RTL ++ LDA.w #$0000 : RTL From 3af9e75dbd2a087990c3f0de385488f8ed6fac0b Mon Sep 17 00:00:00 2001 From: aerinon Date: Thu, 1 Dec 2022 10:01:37 -0700 Subject: [PATCH 10/10] Possible fix for standing items after Aga transition --- keydrop/standing_items.asm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/keydrop/standing_items.asm b/keydrop/standing_items.asm index a75efa4..76a7100 100644 --- a/keydrop/standing_items.asm +++ b/keydrop/standing_items.asm @@ -3,6 +3,9 @@ org $01E6B0 JSL RevealPotItem RTS +org $029C25 + JSL SetTheSceneFix + org $09C2BB JSL ClearSpriteData @@ -76,6 +79,10 @@ org $0db818 Sprite_LoadProperties: org $06D038 KeyRoomFlagMasks: +org $00FDEE +InitializeMirrorHDMA: +org $00E3C4 +LoadCommonSprites_long: ; defines ; Ram usage @@ -591,6 +598,10 @@ CheckIfPotIsSpecial: .specialpot ; zero flag already set, so gtg RTL +SetTheSceneFix: + JSL InitializeMirrorHDMA + JSL LoadCommonSprites_long +RTL incsrc dynamic_si_vram.asm