From bd473670d07b96e81597c38a77c19ed6da6b0929 Mon Sep 17 00:00:00 2001 From: Wulfy Date: Tue, 6 Jun 2017 02:17:19 -0400 Subject: [PATCH] Fixes for DW Aga 1 / LW Aga 2 --- glitched.asm | 35 +++++++++++++++++++++++++++++++---- hooks.asm | 12 ++++++++++-- tables.asm | 2 ++ 3 files changed, 43 insertions(+), 6 deletions(-) diff --git a/glitched.asm b/glitched.asm index 6a9615f..ab8b1ee 100644 --- a/glitched.asm +++ b/glitched.asm @@ -1,6 +1,33 @@ ;================================================================================ ; Glitched Mode Fixes ;================================================================================ +GetAgahnimPalette: + LDA $A0 ; get room id + CMP.b #13 : BNE + ; Agahnim 2 room + LDA.b #$07 ; Use Agahnim 2 + RTL + + ; Elsewhere + LDA.b #$0b ; Use Agahnim 1 + RTL +;-------------------------------------------------------------------------------- +GetAgahnimDeath: + STA $0BA0, X ; thing we wrote over + LDA $A0 ; get room id + CMP.b #13 : BNE + ; Agahnim 2 room + LDA.l Bugfix_SetWorldOnAgahnimDeath : BEQ ++ + LDA.b #$40 : STA !DARK_WORLD ; Switch to dark world + ++ + LDA.b #$01 ; Use Agahnim 2 + RTL + + ; Elsewhere + LDA.l Bugfix_SetWorldOnAgahnimDeath : BEQ ++ + LDA.b #$00 : STA !DARK_WORLD ; Switch to light world + ; (This will later get flipped to DW when Agahnim 1 + ; warps us to the pyramid) + ++ + LDA.b #$00 ; Use Agahnim 1 + RTL +;-------------------------------------------------------------------------------- GetAgahnimType: LDA $A0 ; get room id CMP.b #13 : BNE + ; Agahnim 2 room @@ -11,15 +38,15 @@ GetAgahnimType: .done RTL ;-------------------------------------------------------------------------------- -GetAgahnimPalette: - PHX +GetAgahnimSlot: + PHX ; thing we wrote over LDA $A0 ; get room id CMP.b #13 : BNE + ; Agahnim 2 room LDA.b #$01 ; Use Agahnim 2 - JML.l GetAgahnimPaletteReturn + JML.l GetAgahnimSlotReturn + ; Elsewhere LDA.b #$00 ; Use Agahnim 1 - JML.l GetAgahnimPaletteReturn + JML.l GetAgahnimSlotReturn ;-------------------------------------------------------------------------------- GetAgahnimLightning: INC $0E30, X ; thing we wrote over diff --git a/hooks.asm b/hooks.asm index 496de8f..8a5f4dc 100644 --- a/hooks.asm +++ b/hooks.asm @@ -806,13 +806,21 @@ NOP ;================================================================================ ; Glitched Mode Fixes ;-------------------------------------------------------------------------------- +org $0691AC ; <- 311AC - sprite_prep.asm:2453 (LDY $0FFF) +JSL.l GetAgahnimPalette +NOP #2 +;-------------------------------------------------------------------------------- +org $06F0DD ; <- 370DD - Bank06.asm:5399 (STA $0BA0, X) +JSL.l GetAgahnimDeath +NOP #2 +;-------------------------------------------------------------------------------- org $1ED4E6 ; <- F54E6 - sprite_agahnim.asm:314 (LDY $0FFF) JSL.l GetAgahnimType NOP #2 ;-------------------------------------------------------------------------------- org $1ED577 ; <- F5577 - sprite_agahnim.asm:418 (PHX) -JML.l GetAgahnimPalette -GetAgahnimPaletteReturn: +JML.l GetAgahnimSlot +GetAgahnimSlotReturn: ;-------------------------------------------------------------------------------- org $1ED678 ; <- F5678 - sprite_agahnim.asm:587 (INC $0E30, X) NOP #2 diff --git a/tables.asm b/tables.asm index 914da22..b242d8b 100644 --- a/tables.asm +++ b/tables.asm @@ -531,6 +531,8 @@ Bugfix_SwampWaterLevel: db #$01 ; #$00 = Original Behavior - #$01 = Randomizer Behavior (Default) Bugfix_PreAgaDWDungeonDeathToFakeDW: db #$01 ; #$00 = Original Behavior - #$01 = Randomizer Behavior (Default) +Bugfix_SetWorldOnAgahnimDeath: +db #$01 ; #$00 = Original Behavior - #$01 = Randomizer Behavior (Default) ;-------------------------------------------------------------------------------- ;org $08D01A ; PC 0x4501A - ancilla_flute.asm - 42 ;OldHauntedGroveItem: