Unify standard escape ammo fills

This commit is contained in:
2026-05-19 22:44:21 -05:00
parent 2f404873b8
commit 333159ac53
4 changed files with 76 additions and 61 deletions

View File

@@ -146,32 +146,57 @@ macro SetMinimum(base,filler,compare)
endmacro
RefreshRainAmmo:
LDA.l ProgressIndicator : CMP.b #$01 : BEQ .rain ; check if we're in rain state
RTL
.rain
LDA.l StartingEntrance
+ CMP.b #$03 : BNE + ; Uncle
%SetMinimum(CurrentMagic,MagicFiller,RainDeathRefillMagic_Uncle)
%SetMinimum(BombsEquipment,BombsFiller,RainDeathRefillBombs_Uncle)
LDA.l ArrowMode : BEQ ++
LDA.l BowEquipment : BEQ +++
++ %SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Uncle)
+++ BRA .done
RTL
.rain
LDA.l StartingEntrance : BEQ .uncle
CMP.b #$03 : BNE + ; Uncle
.uncle
LDA.l RainDeathRefillMagic_Uncle : JSR .refillMagic
LDA.l RainDeathRefillBombs_Uncle : JSR .refillBombs
LDA.l ArrowMode : BNE .rupeeBow
LDA.l RainDeathRefillArrows_Uncle : JSR .refillArrows
BRA .done
+ CMP.b #$02 : BNE + ; Cell
%SetMinimum(CurrentMagic,MagicFiller,RainDeathRefillMagic_Cell)
%SetMinimum(BombsEquipment,BombsFiller,RainDeathRefillBombs_Cell)
LDA.l ArrowMode : BEQ ++
LDA.l BowEquipment : BEQ .done
++ %SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Cell)
LDA.l RainDeathRefillMagic_Cell : JSR .refillMagic
LDA.l RainDeathRefillBombs_Cell : JSR .refillBombs
LDA.l ArrowMode : BNE .rupeeBow
LDA.l RainDeathRefillArrows_Cell : JSR .refillArrows
BRA .done
+ CMP.b #$04 : BNE + ; Mantle
%SetMinimum(CurrentMagic,MagicFiller,RainDeathRefillMagic_Mantle)
%SetMinimum(BombsEquipment,BombsFiller,RainDeathRefillBombs_Mantle)
LDA.l ArrowMode : BEQ ++
LDA.l BowEquipment : BEQ .done
++ %SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Mantle)
+
.done
LDA.l RainDeathRefillMagic_Mantle : JSR .refillMagic
LDA.l RainDeathRefillBombs_Mantle : JSR .refillBombs
LDA.l ArrowMode : BNE .rupeeBow
LDA.l RainDeathRefillArrows_Mantle : JSR .refillArrows
BRA .done
+ BRA .done
.rupeeBow
REP #$20
LDA.l RainDeathRefillRupeeBow : JSR .refillRupees
SEP #$20
.done
RTL
.refillMagic
SEC : SBC.l CurrentMagic : BCC +
STA.l MagicFiller
+ RTS
.refillBombs
SEC : SBC.l BombsEquipment : BCC +
STA.l BombsFiller
+ RTS
.refillArrows
SEC : SBC.l CurrentArrows : BCC +
STA.l ArrowsFiller
+ RTS
.refillRupees
CMP.l CurrentRupees : BCC +
STA.l CurrentRupees
+ RTS
;--------------------------------------------------------------------------------
SetEscapeAssist:
LDA.l ProgressIndicator : CMP.b #$01 : BNE .no_train ; check if we're in rain state

View File

@@ -79,29 +79,19 @@ RTL
;--------------------------------------------------------------------------------
OnUncleItemGet:
PHA
LDA.l EscapeAssist
BIT.b #$04 : BEQ + : STA.l InfiniteMagic : +
BIT.b #$02 : BEQ + : STA.l InfiniteBombs : +
BIT.b #$01 : BEQ + : STA.l InfiniteArrows : +
LDA.l UncleItem_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID
PLA
JSL Link_ReceiveItem
LDA.l UncleRefill : BIT.b #$04 : BEQ + : LDA.b #$80 : STA.l MagicFiller : + ; refill magic
LDA.l UncleRefill : BIT.b #$02 : BEQ + : LDA.b #50 : STA.l BombsFiller : + ; refill bombs
LDA.l UncleRefill : BIT.b #$01 : BEQ + ; refill arrows
LDA.b #70 : STA.l ArrowsFiller
LDA.l ArrowMode : BEQ +
LDA.l BowTracking : ORA.b #$80 : STA.l BowTracking ; enable bow toggle
REP #$20 ; set 16-bit accumulator
LDA.l CurrentRupees : !ADD.l FreeUncleItemAmount : STA.l CurrentRupees ; rupee arrows, so also give the player some money to start
SEP #$20 ; set 8-bit accumulator
+
LDA.l ProgressIndicator : BNE +
LDA.b #$01 : STA.l ProgressIndicator ; handle rain state
LDA.b #$01 : STA.l ProgressIndicator ; set rain state
JSL SetEscapeAssist
JSL RefreshRainAmmo
; grant arrows if we started with a bow in retro mode
LDA.l ArrowMode : BEQ +
LDA.l RainDeathRefillRupeeBow : ORA.l RainDeathRefillRupeeBow+1 : BEQ +
LDA.b #$01 : STA.l ArrowsFiller
+
RTL
;--------------------------------------------------------------------------------

View File

@@ -237,12 +237,8 @@ db $00
;a - Infinite Arrows
;--------------------------------------------------------------------------------
org $B0804E ; PC 0x18004E
UncleRefill:
UncleRefill_deprecated: ; no longer used
db $00
;---- -mba
;m - Refill Magic
;b - Refill Bombs
;a - Refill Arrows
;--------------------------------------------------------------------------------
org $B0804F ; PC 0x18004F
ByrnaInvulnerability:
@@ -890,8 +886,8 @@ SilverArrowsAutoEquip:
db $01 ; #$00 = Off - #$01 = Collection Time (Default) - #$02 = Entering Ganon - #$03 = Collection Time & Entering Ganon
;================================================================================
org $B08183 ; PC 0x180183
FreeUncleItemAmount:
dw $12C ; 300 rupees (Default)
RainDeathRefillRupeeBow:
dw $012C ; 300 rupees (Default)
;--------------------------------------------------------------------------------
org $B08185 ; PC 0x180185
RainDeathRefillTable:

View File

@@ -1,10 +1,14 @@
;--------------------------------------------------------------------------------
EndRainState:
LDA.l InitProgressIndicator : BIT.b #$80 : BNE + ; check for instant post-aga
LDA.b #$02 : STA.l ProgressIndicator
RTL
+
LDA.b #$03 : STA.l ProgressIndicator
LDA.l InitProgressIndicator : BIT.b #$80 : BEQ + ; check for instant post-aga
LDA.l InitLumberjackOW : STA.l OverworldEventDataWRAM+$02
LDA.b #$03
BRA ++
+
LDA.b #$02
++
STA.l ProgressIndicator
JSL SetEscapeAssist
RTL
;--------------------------------------------------------------------------------