diff --git a/contrib.asm b/contrib.asm index 0c0ec5b..1170417 100644 --- a/contrib.asm +++ b/contrib.asm @@ -135,4 +135,65 @@ Sprite_ShowSolicitedMessageIfPlayerFacing_Alt: RTL } -;================================================================ \ No newline at end of file +;================================================================ + +RandomAgah: +{ + LDA.l GanonAgahRNG : BNE + + JSL GetRandomInt + RTL + + + CMP #$01 : BEQ .noBlueBalls + CMP #$02 : BEQ .rigRng + + .noBlueBalls + JSL GetRandomInt + ORA #$01 ;guarantee no blue ball + RTL + + .rigRng + PHX + + LDA $A0 : CMP #$20 : BEQ + ; branch if at agah 1 (they use a different part of the random table) + ;g tower agahnim + LDX $0FA3 + LDA.l $AF8100, X ; random table + INX + STX $0FA3 + BRA .return + + + + ;light world agahnim + LDX $0FA2 + LDA.l $AF8000, X ; random table + INX + STX $0FA2 + + .return + PLX + RTL +} + +RandomGanon: +{ + LDA.l GanonAgahRNG : BNE + ; branch if not using vanilla behavior + JSL GetRandomInt + RTL + + + CMP #$01 : BEQ .noTeleports + CMP #$02 : BEQ .rigRng + + .noTeleports + JSL GetRandomInt + AND #$FE ; set least significant bit to 0 to prevent teleport + RTL + + .rigRng + PHX + LDX $0FA4 + LDA.l $AF8200, X ; random table + INX + STX $0FA4 + PLX + RTL +} \ No newline at end of file diff --git a/hooks.asm b/hooks.asm index ca09f90..496de8f 100644 --- a/hooks.asm +++ b/hooks.asm @@ -39,8 +39,8 @@ JSL.l PrepHashAlphabet ;================================================================================ ; Agahnim 0bb ;-------------------------------------------------------------------------------- -org $1ED6EF ; <- F56EF - sprite_agahnim.asm : 636 (JSL GetRandomInt : AND.b #$01 : BNE BRANCH_GAMMA) -NOP #18 +;org $1ED6EF ; <- F56EF - sprite_agahnim.asm : 636 (JSL GetRandomInt : AND.b #$01 : BNE BRANCH_GAMMA) +;NOP #18 ;-------------------------------------------------------------------------------- ;================================================================================ @@ -734,6 +734,15 @@ JSL.l RigDigRNG org $01EE94 ; <- EE94 - Bank01.asm : 14121 JSL.l RigChestRNG ;-------------------------------------------------------------------------------- +org $1ED63E ; <- F563E - sprite_agahnim.asm +JSL RandomAgah +org $1ED6EF ; <- F56EF - sprite_agahnim.asm +JSL RandomAgah +org $1D9488 ; <- E9488 - sprite_ganon.asm +JSL RandomGanon +org $1D91E3 ; <- E91E3 - sprite_ganon.asm +JSL RandomGanon +;-------------------------------------------------------------------------------- ;org $01EDB2 ; <- EDB2 - Bank01.asm : 14038 ;INC $04C4 ;-------------------------------------------------------------------------------- @@ -1334,10 +1343,10 @@ dw $05AC, $04FC, $0001, $0027, $00F0 ; Zelda in the water room ;================================================================================ ; Ganon Fixes ;-------------------------------------------------------------------------------- -org $1D91E3 ; <- E91E3 - sprite_ganon.asm : 778 +;org $1D91E3 ; <- E91E3 - sprite_ganon.asm : 778 ;JSL.l GanonWarpRNG ;NOP #2 -LDA #$00 : NOP #4 +;LDA #$00 : NOP #4 ;-------------------------------------------------------------------------------- ;================================================================================ diff --git a/tables.asm b/tables.asm index 632e5bf..914da22 100644 --- a/tables.asm +++ b/tables.asm @@ -161,6 +161,10 @@ db #$A0 ; #$A0 - Full Refill (Default) PotionMagicRefill: db #$80 ; #$80 - Full Refill (Default) ;-------------------------------------------------------------------------------- +org $308086 ; PC 0x180086 +GanonAgahRNG: +db #$01 ; $00 = vanilla behavior, $01 = no extra blue balls/warps, $02 = use the random table +;-------------------------------------------------------------------------------- org $308040 ; PC 0x180040 UncleQuote: db #$00 ; #$00 - #$1F