started hud refresh logic
This commit is contained in:
@@ -328,7 +328,7 @@ Menu_CheckBottle:
|
||||
Menu_Exit:
|
||||
{
|
||||
; set $0303 by using $0202 to index table on exit
|
||||
JSR Menu_CheckBottle
|
||||
; JSR Menu_CheckBottle
|
||||
LDY.w $0202 : BEQ .no_item
|
||||
DEY
|
||||
LDA.w Menu_ItemIndex, Y
|
||||
@@ -342,9 +342,9 @@ Menu_Exit:
|
||||
|
||||
LDX.b #$3E
|
||||
.loop
|
||||
|
||||
LDA.l $7EC300, X : STA.l $7EC500, X
|
||||
DEX : DEX
|
||||
LDA.l $7EC300, X
|
||||
STA.l $7EC500, X
|
||||
DEX : DEX
|
||||
BPL .loop
|
||||
|
||||
INC.b $15
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
; headsup display
|
||||
|
||||
org $0DFB91
|
||||
JSL Hud_Update
|
||||
JSL HUD_Update
|
||||
RTS
|
||||
|
||||
newIgnoreItemBox:
|
||||
JSL Hud_Update_ignoreItemBox
|
||||
JSL HUD_Update_ignoreItemBox
|
||||
RTS
|
||||
|
||||
org $0DDD21
|
||||
@@ -16,10 +16,8 @@ org $0DF1BC
|
||||
JSL HUD_AnimateHeartRefill
|
||||
RTS
|
||||
|
||||
; =============================================================================
|
||||
|
||||
org $268000
|
||||
Hud_Update:
|
||||
HUD_Update:
|
||||
{
|
||||
JSR HUD_UpdateItemBox
|
||||
|
||||
@@ -79,18 +77,17 @@ Hud_Update:
|
||||
REP #$30
|
||||
|
||||
; Magic amount indicator (normal, 1/2, or 1/4)
|
||||
; LDA $7EF37B : AND.w #$00FF : CMP.w #$0001 : BCC .normalMagicMeter
|
||||
LDA $7EF37B : AND.w #$00FF : CMP.w #$0001 : BCC .normalMagicMeter
|
||||
|
||||
; draw 1/2 magic meter
|
||||
; LDA.w #$28F7 : STA $7EC704
|
||||
; LDA.w #$2851 : STA $7EC706
|
||||
; LDA.w #$28FA : STA $7EC708
|
||||
LDA.w #$2851 : STA $7EC730
|
||||
LDA.w #$28FA : STA $7EC732
|
||||
|
||||
.normalMagicMeter
|
||||
|
||||
; check player magic (ranges from 0 to 0x7F)
|
||||
; X = ((MP & 0xFF)) + 7) & 0xFFF8)
|
||||
;LDA $7EF36E : AND.w #$00FF : CLC : ADC #$0007 : AND.w #$FFF8 : TAX
|
||||
; LDA $7EF36E : AND.w #$00FF : CLC : ADC #$0007 : AND.w #$FFF8 : TAX
|
||||
|
||||
; these four writes draw the magic power bar based on how much MP you have
|
||||
; LDA MagicTilemap+0, X : STA $7EC746
|
||||
@@ -99,20 +96,20 @@ Hud_Update:
|
||||
; LDA MagicTilemap+6, X : STA $7EC806
|
||||
|
||||
; Load how many rupees the player has
|
||||
; LDA $7EF362
|
||||
LDA $7EF362
|
||||
|
||||
; JSR HexToDecimal
|
||||
JSR HexToDecimal
|
||||
|
||||
; REP #$30
|
||||
REP #$30
|
||||
|
||||
; The tile index for the first rupee digit
|
||||
; LDA $03 : AND.w #$00FF : ORA.w #$2400 : STA $7EC7D0
|
||||
LDA $03 : AND.w #$00FF : ORA.w #$2400 : STA $7EC79C
|
||||
|
||||
; The tile index for the second rupee digit
|
||||
; LDA $04 : AND.w #$00FF : ORA.w #$2400 : STA $7EC7D2
|
||||
LDA $04 : AND.w #$00FF : ORA.w #$2400 : STA $7EC79E
|
||||
|
||||
; The tile index for the third rupee digit
|
||||
; LDA $05 : AND.w #$00FF : ORA.w #$2400 : STA $7EC7D4
|
||||
LDA $05 : AND.w #$00FF : ORA.w #$2400 : STA $7EC7A0
|
||||
|
||||
; Number of bombs Link has.
|
||||
LDA $7EF343 : AND.w #$00FF
|
||||
@@ -122,10 +119,10 @@ Hud_Update:
|
||||
REP #$30
|
||||
|
||||
; The tile index for the first bomb digit
|
||||
LDA $04 : AND.w #$00FF : ORA.w #$2400 : STA $7EC7AE
|
||||
LDA $04 : AND.w #$00FF : ORA.w #$2400 : STA $7EC7B0
|
||||
|
||||
; The tile index for the second bomb digit
|
||||
LDA $05 : AND.w #$00FF : ORA.w #$2400 : STA $7EC7B0
|
||||
LDA $05 : AND.w #$00FF : ORA.w #$2400 : STA $7EC7B2
|
||||
|
||||
; ; Number of Arrows Link has.
|
||||
; LDA $7EF377 : AND.w #$00FF
|
||||
@@ -168,6 +165,241 @@ Hud_Update:
|
||||
RTL
|
||||
}
|
||||
|
||||
; =============================================================================
|
||||
; *$6DB92-$6DD29 BRANCH LOCATION
|
||||
|
||||
HUD_RefillLogic:
|
||||
{
|
||||
; Check current rupees (362) against goal rupees (360)
|
||||
; goal refers to how many we really have and current refers to the
|
||||
; number currently being displayed. When you buy something,
|
||||
; goal rupees are decreased by, say, 100, but it takes a while for the
|
||||
; current rupees indicator to catch up. When you get a gift of 300
|
||||
; rupees, the goal increases, and current has to catch up in the other direction.
|
||||
LDA $7EF362
|
||||
|
||||
CMP $7EF360 : BEQ .doneWithRupeesRefill
|
||||
BMI .addRupees
|
||||
DEC A : BPL .subtractRupees
|
||||
|
||||
LDA.w #$0000 : STA $7EF360
|
||||
|
||||
BRA .subtractRupees
|
||||
|
||||
.addRupees
|
||||
|
||||
; If current rupees <= 1000 (decimal)
|
||||
INC A : CMP.w #1000 : BCC .subtractRupees
|
||||
|
||||
; Otherwise just store 999 to the rupee amount
|
||||
LDA.w #999 : STA $7EF360
|
||||
|
||||
.subtractRupees
|
||||
|
||||
STA $7EF362
|
||||
|
||||
SEP #$30
|
||||
|
||||
LDA $012E : BNE .doneWithRupeesRefill
|
||||
|
||||
; looks like a delay counter of some sort between
|
||||
; invocations of the rupee fill sound effect
|
||||
LDA $0CFD : INC $0CFD : AND.b #$07 : BNE .skipRupeeSound
|
||||
|
||||
LDA.b #$29 : STA $012E
|
||||
|
||||
BRA .skipRupeeSound
|
||||
|
||||
.doneWithRupeesRefill
|
||||
|
||||
SEP #$30
|
||||
|
||||
STZ $0CFD
|
||||
|
||||
.skipRupeeSound
|
||||
|
||||
LDA $7EF375
|
||||
|
||||
BEQ .doneRefillingBombs
|
||||
|
||||
; decrease the bomb refill counter
|
||||
LDA $7EF375 : DEC A : STA $7EF375
|
||||
|
||||
; use the bomb upgrade index to know what max number of bombs Link can carry is
|
||||
LDA $7EF370 : TAY
|
||||
|
||||
; if it matches the max, you can't have no more bombs, son. It's the law.
|
||||
LDA $7EF343 : CMP $DB48, Y : BEQ .doneRefillingBombs
|
||||
|
||||
; You like bombs? I got lotsa bombs!
|
||||
INC A : STA $7EF343
|
||||
|
||||
.doneRefillingBombs
|
||||
|
||||
; check arrow refill counter
|
||||
LDA $7EF376
|
||||
|
||||
BEQ .doneRefillingArrows
|
||||
|
||||
LDA $7EF376 : DEC A : STA $7EF376
|
||||
|
||||
; check arrow upgrade index to see how our max limit on arrows, just like bombs.
|
||||
LDA $7EF371 : TAY
|
||||
|
||||
LDA $7EF377 : CMP $DB58, Y
|
||||
|
||||
; I reckon you get no more arrows, pardner.
|
||||
BEQ .arrowsAtMax
|
||||
|
||||
INC A : STA $7EF377
|
||||
|
||||
.arrowsAtMax
|
||||
|
||||
; see if we even have the bow.
|
||||
LDA $7EF340
|
||||
|
||||
BEQ .doneRefillingArrows
|
||||
|
||||
AND.b #$01 : CMP.b #$01
|
||||
|
||||
BNE .doneRefillingArrows
|
||||
|
||||
; changes the icon from a bow without arrows to a bow with arrows.
|
||||
LDA $7EF340 : INC A : STA $7EF340
|
||||
|
||||
JSL $0DDB7F
|
||||
|
||||
.doneRefillingArrows
|
||||
|
||||
; a frozen Link is an impervious Link, so don't beep.
|
||||
LDA $02E4
|
||||
|
||||
BNE .doneWithWarningBeep
|
||||
|
||||
; if heart refill is in process, we don't beep
|
||||
LDA $7EF372
|
||||
|
||||
BNE .doneWithWarningBeep
|
||||
|
||||
LDA $7EF36C : LSR #3 : TAX
|
||||
|
||||
; checking current health against capacity health to see
|
||||
; if we need to put on that annoying beeping noise.
|
||||
LDA $7EF36D : CMP $DB60, X
|
||||
|
||||
BCS .doneWithWarningBeep
|
||||
|
||||
LDA $04CA
|
||||
|
||||
BNE .decrementBeepTimer
|
||||
|
||||
; beep incessantly when life is low
|
||||
LDA $012E
|
||||
|
||||
BNE .doneWithWarningBeep
|
||||
|
||||
LDA.b #$20 : STA $04CA
|
||||
LDA.b #$2B : STA $012E
|
||||
|
||||
.decrementBeepTimer
|
||||
|
||||
; Timer for the low life beep sound
|
||||
DEC $04CA
|
||||
|
||||
.doneWithWarningBeep
|
||||
|
||||
; if nonzero, indicates that a heart is being "flipped" over
|
||||
; as in, filling up, currently
|
||||
LDA $020A
|
||||
|
||||
BNE .waitForHeartFillAnimation
|
||||
|
||||
; If no hearts need to be filled, branch
|
||||
LDA $7EF372
|
||||
|
||||
BEQ .doneRefillingHearts
|
||||
|
||||
; check if actual health matches capacity health
|
||||
LDA $7EF36D : CMP $7EF36C
|
||||
|
||||
BCC .notAtFullHealth
|
||||
|
||||
; just set health to full in the event it overflowed past 0xA0 (20 hearts)
|
||||
LDA $7EF36C : STA $7EF36D
|
||||
|
||||
; done refilling health so deactivate the health refill variable
|
||||
LDA.b #$00 : STA $7EF372
|
||||
|
||||
BRA .doneRefillingHearts
|
||||
|
||||
.notAtFullHealth
|
||||
|
||||
; refill health by one heart
|
||||
LDA $7EF36D : CLC : ADC.b #$08 : STA $7EF36D
|
||||
|
||||
LDA $012F
|
||||
|
||||
BNE .soundChannelInUse
|
||||
|
||||
; play heart refill sound effect
|
||||
LDA.b #$0D : STA $012F
|
||||
|
||||
.soundChannelInUse
|
||||
|
||||
; repeat the same logic from earlier, checking if health's at max and setting it to max
|
||||
; if it overflowed
|
||||
LDA $7EF36D : CMP $7EF36C
|
||||
|
||||
BCC .healthDidntOverflow
|
||||
|
||||
LDA $7EF36C : STA $7EF36D
|
||||
|
||||
.healthDidntOverflow
|
||||
|
||||
; subtract a heart from the refill variable
|
||||
LDA $7EF372 : SEC : SBC.b #$08 : STA $7EF372
|
||||
|
||||
; activate heart refill animation
|
||||
; (which will cause a small delay for the next heart if we still need to fill some up.)
|
||||
INC $020A
|
||||
|
||||
LDA.b #$07 : STA $0208
|
||||
|
||||
.waitForHeartFillAnimation
|
||||
|
||||
REP #$30
|
||||
|
||||
LDA.w #$FFFF : STA $0E
|
||||
|
||||
JSL HUD_Update_ignoreHealth
|
||||
|
||||
JSL HUD_AnimateHeartRefill
|
||||
|
||||
SEP #$30
|
||||
|
||||
INC $16
|
||||
|
||||
PLB
|
||||
|
||||
RTL
|
||||
|
||||
.doneRefillingHearts
|
||||
|
||||
REP #$30
|
||||
|
||||
LDA.w #$FFFF : STA $0E
|
||||
|
||||
JSL HUD_Update_ignoreItemBox
|
||||
|
||||
SEP #$30
|
||||
|
||||
INC $16
|
||||
|
||||
PLB
|
||||
|
||||
RTL
|
||||
}
|
||||
|
||||
; =============================================================================
|
||||
; *$6F14F-$6F1B2 LOCAL
|
||||
|
||||
@@ -223,33 +455,34 @@ HUD_AnimateHeartRefill:
|
||||
RTS
|
||||
}
|
||||
|
||||
|
||||
; ============================================================================
|
||||
; *$6FAFD-$6FB90 LOCAL
|
||||
|
||||
HUD_UpdateItemBox:
|
||||
{
|
||||
SEP #$30
|
||||
|
||||
; ; Dost thou haveth the the bow?
|
||||
; LDA $7EF340 : BEQ .havethNoBow
|
||||
; Dost thou haveth the the bow?
|
||||
LDA $7EF340 : BEQ .havethNoBow
|
||||
|
||||
; ; Dost thou haveth the silver arrows?
|
||||
; ; (okay I'll stop soon)
|
||||
; CMP.b #$03 : BCC .havethNoSilverArrows
|
||||
; Dost thou haveth the silver arrows?
|
||||
; (okay I'll stop soon)
|
||||
; CMP.b #$03 : BCC .havethNoSilverArrows
|
||||
|
||||
; ; Draw the arrow guage icon as silver rather than normal wood arrows.
|
||||
; Draw the arrow guage icon as silver rather than normal wood arrows.
|
||||
; LDA.b #$86 : STA $7EC71E
|
||||
; LDA.b #$24 : STA $7EC71F
|
||||
; LDA.b #$87 : STA $7EC720
|
||||
; LDA.b #$24 : STA $7EC721
|
||||
|
||||
; LDX.b #$04
|
||||
LDX.b #$04
|
||||
|
||||
; ; check how many arrows the player has
|
||||
; LDA $7EF377 : BNE .drawBowItemIcon
|
||||
; check how many arrows the player has
|
||||
LDA $7EF377 : BNE .drawBowItemIcon
|
||||
|
||||
; LDX.b #$03
|
||||
LDX.b #$03
|
||||
|
||||
; BRA .drawBowItemIcon
|
||||
BRA .drawBowItemIcon
|
||||
|
||||
; .havethNoSilverArrows
|
||||
|
||||
@@ -259,16 +492,16 @@ HUD_UpdateItemBox:
|
||||
|
||||
; LDX.b #$01
|
||||
|
||||
; .drawBowItemIcon
|
||||
.drawBowItemIcon
|
||||
|
||||
; ; values of X correspond to how the icon will end up drawn:
|
||||
; ; 0x01 - normal bow with no arrows
|
||||
; ; 0x02 - normal bow with arrows
|
||||
; ; 0x03 - silver bow with no silver arrows
|
||||
; ; 0x04 - silver bow with silver arrows
|
||||
; TXA : STA $7EF340
|
||||
; values of X correspond to how the icon will end up drawn:
|
||||
; 0x01 - normal bow with no arrows
|
||||
; 0x02 - normal bow with arrows
|
||||
; 0x03 - silver bow with no silver arrows
|
||||
; 0x04 - silver bow with silver arrows
|
||||
TXA : STA $7EF340
|
||||
|
||||
; .havethNoBow
|
||||
.havethNoBow
|
||||
|
||||
REP #$30
|
||||
|
||||
@@ -297,10 +530,10 @@ HUD_UpdateItemBox:
|
||||
LDA $02 : ASL #3 : TAY
|
||||
|
||||
; These addresses form the item box graphics.
|
||||
LDA ($04), Y : STA $7EC774 : INY #2
|
||||
LDA ($04), Y : STA $7EC776 : INY #2
|
||||
LDA ($04), Y : STA $7EC7B4 : INY #2
|
||||
LDA ($04), Y : STA $7EC778 : INY #2
|
||||
LDA ($04), Y : STA $7EC7B6 : INY #2
|
||||
LDA ($04), Y : STA $7EC7B8 : INY #2
|
||||
|
||||
.noEquippedItem
|
||||
|
||||
@@ -427,33 +660,34 @@ HUD_Tilemap:
|
||||
{
|
||||
dw $207F, $207F, $207F, $207F, $207F, $207F, $207F, $207F
|
||||
dw $207F, $207F, $207F, $207F, $207F, $207F, $207F, $207F
|
||||
dw $207F, $207F, $207F
|
||||
dw $207F, $207F, $207F, $207F
|
||||
|
||||
; magic bar top part
|
||||
dw $340B, $340C, $340C, $340C, $340C, $340C
|
||||
dw $200B, $200C, $200C, $200C, $200C, $200C
|
||||
; item frame top part
|
||||
dw $346C, $346D, $346E, $346F
|
||||
dw $206C, $206D, $206E, $206F
|
||||
|
||||
dw $207F, $207F, $207F, $207F, $207F, $207F, $207F, $207F
|
||||
dw $207F, $207F, $207F, $207F, $207F, $207F, $207F, $207F
|
||||
dw $207F, $207F, $207F, $207F, $207F, $207F
|
||||
|
||||
dw $341B, $2015
|
||||
dw $2015, $2015, $2015, $2015
|
||||
; magic bar
|
||||
dw $201B, $344B
|
||||
dw $344B, $344B, $344B, $344B
|
||||
|
||||
; item frame left part
|
||||
dw $34DE, $207F, $207F, $34DF
|
||||
dw $20DE, $207F, $207F, $20DF
|
||||
|
||||
dw $207F, $207F, $207F, $207F, $207F, $207F, $207F, $207F
|
||||
dw $207F, $207F, $207F, $207F, $207F, $207F, $207F, $207F
|
||||
dw $207F, $207F, $207F, $207F, $207F, $207F
|
||||
|
||||
; magic bar bottom part
|
||||
dw $B40B, $B40C
|
||||
dw $B40C, $B40C, $B40C, $B40C
|
||||
dw $A00B, $A00C
|
||||
dw $A00C, $A00C, $A00C, $A00C
|
||||
|
||||
; item frame right part
|
||||
dw $34EE, $207F, $207F, $34EF
|
||||
dw $20EE, $207F, $207F, $20EF
|
||||
|
||||
dw $207F, $207F, $207F, $207F, $207F, $207F, $207F, $207F
|
||||
dw $207F, $207F, $207F, $207F, $207F, $207F, $207F, $207F
|
||||
@@ -461,7 +695,7 @@ HUD_Tilemap:
|
||||
dw $207F, $207F, $207F, $207F
|
||||
|
||||
; item frame bottom part
|
||||
dw $347C, $347D, $347E, $341D
|
||||
dw $207C, $207D, $207E, $201D
|
||||
|
||||
dw $207F, $207F, $207F, $207F, $207F, $207F, $207F, $207F
|
||||
dw $207F, $207F, $207F, $207F, $207F, $207F, $207F, $207F
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
; =============================================================================
|
||||
; Item Selection Code
|
||||
; =============================================================================
|
||||
|
||||
Menu_ItemIndex:
|
||||
db $03 ; slingshot
|
||||
@@ -90,6 +89,7 @@ Menu_ItemCursorPositions:
|
||||
; -----------------------------------------------------------------------------
|
||||
|
||||
Menu_FindNextItem:
|
||||
{
|
||||
LDY.w $0202 : INY
|
||||
CPY.b #$19 : BCC .no_reset
|
||||
LDY.b #$01
|
||||
@@ -99,10 +99,12 @@ Menu_FindNextItem:
|
||||
LDA.l $7EF300, X
|
||||
BEQ Menu_FindNextItem
|
||||
RTS
|
||||
}
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
|
||||
Menu_FindPrevItem:
|
||||
{
|
||||
LDY.w $0202 : DEY : BNE .no_reset
|
||||
LDY.b #$18
|
||||
.no_reset
|
||||
@@ -111,9 +113,12 @@ Menu_FindPrevItem:
|
||||
LDA.l $7EF300, X
|
||||
BEQ Menu_FindPrevItem
|
||||
RTS
|
||||
}
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
|
||||
Menu_FindNextDownItem:
|
||||
{
|
||||
LDA.w $0202 : CLC : ADC.b #$06
|
||||
CMP.b #$19 : BCC .no_reset
|
||||
SBC.b #$18
|
||||
@@ -123,10 +128,12 @@ Menu_FindNextDownItem:
|
||||
LDA.l $7EF300, X
|
||||
BEQ Menu_FindNextItem
|
||||
RTS
|
||||
}
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
|
||||
Menu_FindNextUpItem:
|
||||
{
|
||||
LDA.w $0202 : SEC : SBC.b #$06
|
||||
BPL .no_reset : BNE .no_reset
|
||||
CLC : ADC.b #$18
|
||||
@@ -134,12 +141,15 @@ Menu_FindNextUpItem:
|
||||
TAY : STY.w $0202
|
||||
LDX.w Menu_AddressIndex-1, Y
|
||||
LDA.l $7EF300, X
|
||||
BEQ Menu_FindPrevItem
|
||||
BEQ Menu_FindNextItem
|
||||
RTS
|
||||
}
|
||||
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
|
||||
Menu_DeleteCursor:
|
||||
{
|
||||
REP #$30
|
||||
LDX.w Menu_ItemCursorPositions-2, Y
|
||||
|
||||
@@ -155,6 +165,7 @@ Menu_DeleteCursor:
|
||||
SEP #$30
|
||||
STZ $0207
|
||||
RTS
|
||||
}
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
|
||||
@@ -182,4 +193,34 @@ Menu_InitItemScreen:
|
||||
RTS
|
||||
}
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
; -----------------------------------------------------------------------------
|
||||
|
||||
; $0303[0x01] - (Player)
|
||||
|
||||
; In conjunction with the above variable when set to 0x13, matching the above
|
||||
; variable, the cape transformation is complete.
|
||||
|
||||
; This indicates which secondary item is equipped (aka Y-button
|
||||
; item).
|
||||
|
||||
; 0x00 - Nothing
|
||||
; 0x01 - Bombs
|
||||
; 0x02 - Boomerang
|
||||
; 0x03 - Arrows
|
||||
; 0x04 - Hammer
|
||||
; 0x05 - Fire Rod
|
||||
; 0x06 - Ice Rod
|
||||
; 0x07 - Bug catching net
|
||||
; 0x08 - Flute
|
||||
; 0x09 - Lamp
|
||||
; 0x0A - Magic Powder
|
||||
; 0x0B - Bottle
|
||||
; 0x0C - Book of Mudora
|
||||
; 0x0D - Cane of Byrna
|
||||
; 0x0E - Hookshot
|
||||
; 0x0F - Bombos Medallion
|
||||
; 0x10 - Ether Medallion
|
||||
; 0x11 - Quake Medallion
|
||||
; 0x12 - Cane of Somaria
|
||||
; 0x13 - Cape
|
||||
; 0x14 - Magic Mirror
|
||||
Reference in New Issue
Block a user