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 825d4a1ead
commit aeec3fe6c6
4 changed files with 34 additions and 7 deletions

View File

@@ -2846,6 +2846,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, $1B, $28
;--------------------------------------------------------------------------------
org $079CE6 ; Bank07.asm@4632 (LDA #$80 : TSB $3A)
JSL CheckDetonateBomb
;--------------------------------------------------------------------------------
;================================================================================
; Variable Ganon Vulnerability

View File

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

View File

@@ -301,3 +301,22 @@ StoreSwordDamage:
LDA #$05
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
.silver_arrows
PLA : CMP #$09 : BNE .not_vulnerable
LDA $7EF340 : CMP.b #$03 : !BGE +
LDA $7EF340 : CMP.b #$03 : !BGE +
LDA #$09 : BRA .not_vulnerable
+
BRA .vulnerable