Allow early detonation of bombs and add build flag to remove static RNG

This commit is contained in:
2021-10-12 20:24:56 -07:00
parent 1fcde00d09
commit f3e0def5a2
4 changed files with 34 additions and 7 deletions

View File

@@ -2790,6 +2790,9 @@ db $B2, $24, $B3, $24, $C2, $24, $19, $24
db $B2, $28, $B3, $28, $C2, $28, $1A, $28 db $B2, $28, $B3, $28, $C2, $28, $1A, $28
db $B2, $28, $B3, $28, $C2, $28, $1B, $28 db $B2, $28, $B3, $28, $C2, $28, $1B, $28
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $079CE6 ; Bank07.asm@4632 (LDA #$80 : TSB $3A)
JSL CheckDetonateBomb
;--------------------------------------------------------------------------------
;================================================================================ ;================================================================================
; Variable Ganon Vulnerability ; Variable Ganon Vulnerability

View File

@@ -109,13 +109,18 @@ RTL
; Out: A = RNG Result ; Out: A = RNG Result
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!RNG_POINTERS = "$7F5200" !RNG_POINTERS = "$7F5200"
!static_rng ?= 1
GetStaticRNG: GetStaticRNG:
PHX : PHP if !static_rng
REP #$30 ; set 16-bit accumulator and index registers PHX : PHP
AND.w #$000F REP #$30 ; set 16-bit accumulator and index registers
ASL : TAX : LDA !RNG_POINTERS, X : INC : AND.w #$03FF : STA !RNG_POINTERS, X : TAX ; increment pointer and move value to X AND.w #$000F
LDA Static_RNG, X ; load RNG value ASL : TAX : LDA !RNG_POINTERS, X : INC : AND.w #$03FF : STA !RNG_POINTERS, X : TAX ; increment pointer and move value to X
PLP : PLX LDA Static_RNG, X ; load RNG value
PLP : PLX
else
JML GetRandomInt
endif
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
InitRNGPointerTable: InitRNGPointerTable:

View File

@@ -301,3 +301,22 @@ StoreSwordDamage:
LDA #$05 LDA #$05
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
CheckDetonateBomb:
LDA.l SpecialWeapons : CMP.b #$01 : BNE .not_bomb_mode
.detonate_bombs
LDX.b #09
.check_ancilla
LDA.w $0C4A, X
CMP.b #$07
BNE .next_ancilla
LDA.b #03
STA.w $039F, X
.next_ancilla
DEX
BPL .check_ancilla
.not_bomb_mode
; what we wrote over
LDA.b #$80
TSB.b $3A
RTL
;--------------------------------------------------------------------------------

View File

@@ -19,7 +19,7 @@ Ganon_CheckAncillaVulnerability:
BRA .not_vulnerable_pla BRA .not_vulnerable_pla
.silver_arrows .silver_arrows
PLA : CMP #$09 : BNE .not_vulnerable PLA : CMP #$09 : BNE .not_vulnerable
LDA $7EF340 : CMP.b #$03 : !BGE + LDA $7EF340 : CMP.b #$03 : !BGE +
LDA #$09 : BRA .not_vulnerable LDA #$09 : BRA .not_vulnerable
+ +
BRA .vulnerable BRA .vulnerable