Fix potions to work normally in Spike cave

This commit is contained in:
sporchia
2018-01-19 22:18:21 -05:00
parent 39b20f9a05
commit d0efce2e98

View File

@@ -4,8 +4,15 @@
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!BUSY_HEALTH = $7F5092 !BUSY_HEALTH = $7F5092
RefillHealth: RefillHealth:
;STA $FFFFFF REP #$20 ; set 16-bit accumulator
LDA.l PotionHealthRefill : CMP.b #$A0 : !BGE + LDA $A0 ; these are all decimal because i got them that way
CMP.w #279 : BNE + ; Spike Cave bottles work normally
SEP #$20 ; set 8-bit accumulator
LDA #$A0
BRA .done
+
SEP #$20 ; set 8-bit accumulator
LDA.l PotionHealthRefill : CMP.b #$A0 : !BGE .done
LDA !BUSY_HEALTH : BNE ++ LDA !BUSY_HEALTH : BNE ++
LDA.l PotionHealthRefill ; load refill amount LDA.l PotionHealthRefill ; load refill amount
!ADD $7EF36D ; add to current health !ADD $7EF36D ; add to current health
@@ -24,7 +31,7 @@ RefillHealth:
.notDone .notDone
CLC CLC
RTL RTL
+ .done
; Check goal health versus actual health. ; Check goal health versus actual health.
; if(actual < goal) then branch. ; if(actual < goal) then branch.
@@ -44,7 +51,15 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!BUSY_MAGIC = $7F5093 !BUSY_MAGIC = $7F5093
RefillMagic: RefillMagic:
LDA.l PotionMagicRefill : CMP.b #$80 : !BGE + REP #$20 ; set 16-bit accumulator
LDA $A0 ; these are all decimal because i got them that way
CMP.w #279 : BNE + ; Spike Cave bottles work normally
SEP #$20 ; set 8-bit accumulator
LDA #$80
BRA .done
+
SEP #$20 ; set 8-bit accumulator
LDA.l PotionMagicRefill : CMP.b #$80 : !BGE .done
LDA !BUSY_MAGIC : BNE ++ LDA !BUSY_MAGIC : BNE ++
LDA.l PotionMagicRefill ; load refill amount LDA.l PotionMagicRefill ; load refill amount
!ADD $7EF36E ; add to current magic !ADD $7EF36E ; add to current magic
@@ -60,7 +75,7 @@ RefillMagic:
LDA.b #$01 : STA $7EF373 ; refill some magic LDA.b #$01 : STA $7EF373 ; refill some magic
CLC CLC
RTL RTL
+ .done
SEP #$30 SEP #$30
; Check if Link's magic meter is full ; Check if Link's magic meter is full