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:
if !static_rng
PHX : PHP PHX : PHP
REP #$30 ; set 16-bit accumulator and index registers REP #$30 ; set 16-bit accumulator and index registers
AND.w #$000F 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 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 LDA Static_RNG, X ; load RNG value
PLP : PLX 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
;--------------------------------------------------------------------------------