draw bombs and arrow counts only when equipped
This commit is contained in:
@@ -80,7 +80,7 @@ HUD_Update:
|
|||||||
; filling in the full and partially filled hearts (actual health)
|
; filling in the full and partially filled hearts (actual health)
|
||||||
JSR HUD_UpdateHearts
|
JSR HUD_UpdateHearts
|
||||||
|
|
||||||
.ignoreHealth ; *$6FC09 ALTERNATE ENTRY POINT ; reentry hook
|
.ignoreHealth ; *$6FC09 ALTERNATE ENTRY POINT ; reentry hook
|
||||||
|
|
||||||
REP #$30
|
REP #$30
|
||||||
|
|
||||||
@@ -118,48 +118,60 @@ HUD_Update:
|
|||||||
|
|
||||||
; The tile index for the third rupee digit
|
; The tile index for the third rupee digit
|
||||||
LDA $05 : AND.w #$00FF : ORA.w #$2400 : STA $7EC7A0
|
LDA $05 : AND.w #$00FF : ORA.w #$2400 : STA $7EC7A0
|
||||||
|
|
||||||
|
; Check if the user has bombs equipped
|
||||||
|
LDX $0202
|
||||||
|
LDA $7EF33F, X : AND.w #$00FF
|
||||||
|
CPX.w #$0004 : BNE .not_bombs
|
||||||
|
|
||||||
; Number of bombs Link has.
|
; Number of bombs Link has.
|
||||||
LDA $7EF343 : AND.w #$00FF
|
LDA $7EF343 : AND.w #$00FF
|
||||||
|
|
||||||
JSR HexToDecimal
|
JSR HexToDecimal
|
||||||
|
|
||||||
REP #$30
|
REP #$30
|
||||||
|
|
||||||
; The tile index for the first bomb digit
|
; The tile index for the first bomb digit
|
||||||
LDA $04 : AND.w #$00FF : ORA.w #$2400 : STA $7EC7B0
|
LDA $04 : AND.w #$00FF : ORA.w #$2400 : STA $7EC7B0
|
||||||
|
|
||||||
; The tile index for the second bomb digit
|
; The tile index for the second bomb digit
|
||||||
LDA $05 : AND.w #$00FF : ORA.w #$2400 : STA $7EC7B2
|
LDA $05 : AND.w #$00FF : ORA.w #$2400 : STA $7EC7B2
|
||||||
|
|
||||||
|
.not_bombs
|
||||||
|
; Check if the user has arrows equipped
|
||||||
|
LDX $0202
|
||||||
|
LDA $7EF33F, X : AND.w #$00FF
|
||||||
|
CPX.w #$0001 : BNE .not_arrows
|
||||||
|
|
||||||
; ; Number of Arrows Link has.
|
; Number of Arrows Link has.
|
||||||
; LDA $7EF377 : AND.w #$00FF
|
LDA $7EF377 : AND.w #$00FF
|
||||||
|
|
||||||
|
; converts hex to up to 3 decimal digits
|
||||||
|
JSR HexToDecimal
|
||||||
|
REP #$30
|
||||||
|
|
||||||
; ; converts hex to up to 3 decimal digits
|
; The tile index for the first arrow digit
|
||||||
; JSR HexToDecimal
|
LDA $04 : AND.w #$00FF : ORA.w #$2400 : STA $7EC7B0
|
||||||
|
|
||||||
; REP #$30
|
; The tile index for the second arrow digit
|
||||||
|
LDA $05 : AND.w #$00FF : ORA.w #$2400 : STA $7EC7B2
|
||||||
; ; The tile index for the first arrow digit
|
|
||||||
; LDA $04 : AND.w #$00FF : ORA.w #$2400 : STA $7EC75E
|
.not_arrows
|
||||||
|
LDA.w #$007F : STA $05
|
||||||
; ; The tile index for the second arrow digit
|
|
||||||
; LDA $05 : AND.w #$00FF : ORA.w #$2400 : STA $7EC760
|
; Load number of Keys Link has
|
||||||
|
LDA $7EF36F : AND.w #$00FF : CMP.w #$00FF : BEQ .noKeys
|
||||||
; LDA.w #$007F : STA $05
|
JSR HexToDecimal
|
||||||
; ; Load number of Keys Link has
|
.noKeys
|
||||||
; LDA $7EF36F : AND.w #$00FF : CMP.w #$00FF : BEQ .noKeys
|
REP #$30
|
||||||
; JSR HexToDecimal
|
|
||||||
; .noKeys
|
; The key digit, which is optionally drawn.
|
||||||
; REP #$30
|
; Also check to see if the key spot is blank
|
||||||
; ; The key digit, which is optionally drawn.
|
LDA $05 : AND.w #$00FF : ORA.w #$2400 : STA $7EC764
|
||||||
; ; Also check to see if the key spot is blank
|
CMP.w #$247F : BNE .dontBlankKeyIcon
|
||||||
; LDA $05 : AND.w #$00FF : ORA.w #$2400 : STA $7EC764
|
|
||||||
; CMP.w #$247F : BNE .dontBlankKeyIcon
|
; If the key digit is blank, also blank out the key icon.
|
||||||
; ; If the key digit is blank, also blank out the key icon.
|
STA $7EC724
|
||||||
; STA $7EC724
|
.dontBlankKeyIcon
|
||||||
; .dontBlankKeyIcon
|
SEP #$30
|
||||||
; SEP #$30
|
|
||||||
|
|
||||||
RTL
|
RTL
|
||||||
}
|
}
|
||||||
@@ -520,125 +532,91 @@ HudItems:
|
|||||||
|
|
||||||
HUD_UpdateItemBox:
|
HUD_UpdateItemBox:
|
||||||
{
|
{
|
||||||
SEP #$30
|
SEP #$30
|
||||||
|
; Dost thou haveth the the bow?
|
||||||
; Dost thou haveth the the bow?
|
LDA $7EF340 : BEQ .havethNoBow
|
||||||
LDA $7EF340 : BEQ .havethNoBow
|
LDX.b #$04
|
||||||
LDX.b #$04
|
; check how many arrows the player has
|
||||||
|
LDA $7EF377 : BNE .drawBowItemIcon
|
||||||
; check how many arrows the player has
|
LDX.b #$03
|
||||||
LDA $7EF377 : BNE .drawBowItemIcon
|
BRA .drawBowItemIcon
|
||||||
LDX.b #$03
|
|
||||||
BRA .drawBowItemIcon
|
|
||||||
|
|
||||||
.drawBowItemIcon
|
.drawBowItemIcon
|
||||||
|
; values of X correspond to how the icon will end up drawn:
|
||||||
; values of X correspond to how the icon will end up drawn:
|
; 0x01 - normal bow with no arrows
|
||||||
; 0x01 - normal bow with no arrows
|
; 0x02 - normal bow with arrows
|
||||||
; 0x02 - normal bow with arrows
|
; 0x03 - silver bow with no silver arrows
|
||||||
; 0x03 - silver bow with no silver arrows
|
; 0x04 - silver bow with silver arrows
|
||||||
; 0x04 - silver bow with silver arrows
|
TXA : STA $7EF340
|
||||||
TXA : STA $7EF340
|
|
||||||
|
|
||||||
.havethNoBow
|
.havethNoBow
|
||||||
|
REP #$30
|
||||||
REP #$30
|
LDX $0202 : BEQ .noEquippedItem
|
||||||
|
LDA $7EF33F, X : AND.w #$00FF
|
||||||
LDX $0202 : BEQ .noEquippedItem
|
CPX.w #$0004 : BNE .bombsNotEquipped
|
||||||
|
LDA.w #$0001
|
||||||
LDA Menu_ItemIndex, X : AND.w #$00FF
|
|
||||||
|
|
||||||
CPX.w #$0004 : BNE .bombsNotEquipped
|
|
||||||
|
|
||||||
LDA.w #$0001
|
|
||||||
|
|
||||||
.bombsNotEquipped
|
.bombsNotEquipped
|
||||||
|
CPX.w #$0010 : BNE .bottleNotEquipped
|
||||||
CPX.w #$0010 : BNE .bottleNotEquipped
|
TXY : TAX : LDA $7EF35B, X : AND.w #$00FF : TYX
|
||||||
|
|
||||||
TXY : TAX : LDA $7EF35B, X : AND.w #$00FF : TYX
|
|
||||||
|
|
||||||
.bottleNotEquipped
|
.bottleNotEquipped
|
||||||
|
STA $02
|
||||||
STA $02
|
TXA : DEC A : ASL A : TAX
|
||||||
|
LDA $FA93, X : STA $04
|
||||||
TXA : DEC A : ASL A : TAX
|
LDA $02 : ASL #3 : TAY
|
||||||
|
|
||||||
LDA $FA93, X : STA $04
|
; These addresses form the item box graphics.
|
||||||
|
LDA ($04), Y : STA $7EC776 : INY #2
|
||||||
LDA $02 : ASL #3 : TAY
|
LDA ($04), Y : STA $7EC778 : INY #2
|
||||||
|
LDA ($04), Y : STA $7EC7B6 : INY #2
|
||||||
; These addresses form the item box graphics.
|
LDA ($04), Y : STA $7EC7B8 : INY #2
|
||||||
LDA ($04), Y : STA $7EC776 : INY #2
|
|
||||||
LDA ($04), Y : STA $7EC778 : INY #2
|
|
||||||
LDA ($04), Y : STA $7EC7B6 : INY #2
|
|
||||||
LDA ($04), Y : STA $7EC7B8 : INY #2
|
|
||||||
|
|
||||||
.noEquippedItem
|
.noEquippedItem
|
||||||
|
|
||||||
RTS
|
RTS
|
||||||
}
|
}
|
||||||
|
|
||||||
; =============================================================================
|
; =============================================================================
|
||||||
|
|
||||||
HUD_UpdateHearts:
|
HUD_UpdateHearts:
|
||||||
{
|
{
|
||||||
; Draws hearts in a painfully slow loop
|
; Draws hearts in a painfully slow loop
|
||||||
; I used DMA to speed it up in my custom code
|
; I used DMA to speed it up in my custom code
|
||||||
; (but still needs fixing to work on 1/1/1 hardware)
|
LDX.w #$0000
|
||||||
|
|
||||||
LDX.w #$0000
|
|
||||||
|
|
||||||
.nextHeart
|
.nextHeart
|
||||||
|
LDA $00 : CMP.w #$0008 : BCC .lessThanOneHeart
|
||||||
LDA $00 : CMP.w #$0008 : BCC .lessThanOneHeart
|
; Notice no SEC was needed since carry is assumedly set.
|
||||||
|
SBC.w #$0008 : STA $00
|
||||||
; Notice no SEC was needed since carry is assumedly set.
|
LDY.w #$0004
|
||||||
SBC.w #$0008 : STA $00
|
JSR .drawHeart
|
||||||
|
INX #2
|
||||||
LDY.w #$0004
|
BRA .nextHeart
|
||||||
|
|
||||||
JSR .drawHeart
|
|
||||||
|
|
||||||
INX #2
|
|
||||||
|
|
||||||
BRA .nextHeart
|
|
||||||
|
|
||||||
.lessThanOneHeart
|
.lessThanOneHeart
|
||||||
|
CMP.w #$0005 : BCC .halfHeartOrLess
|
||||||
CMP.w #$0005 : BCC .halfHeartOrLess
|
LDY.w #$0004
|
||||||
|
BRA .drawHeart
|
||||||
LDY.w #$0004
|
|
||||||
|
|
||||||
BRA .drawHeart
|
|
||||||
|
|
||||||
.halfHeartOrLess
|
.halfHeartOrLess
|
||||||
|
CMP.w #$0001 : BCC .emptyHeart
|
||||||
CMP.w #$0001 : BCC .emptyHeart
|
LDY.w #$0002
|
||||||
|
BRA .drawHeart
|
||||||
LDY.w #$0002
|
|
||||||
|
|
||||||
BRA .drawHeart
|
|
||||||
|
|
||||||
.emptyHeart
|
.emptyHeart
|
||||||
|
RTS
|
||||||
RTS
|
|
||||||
|
|
||||||
.drawHeart
|
.drawHeart
|
||||||
|
; Compare number of hearts so far on current line to 10
|
||||||
; Compare number of hearts so far on current line to 10
|
CPX.w #$0014 : BCC .noLineChange
|
||||||
CPX.w #$0014 : BCC .noLineChange
|
; if not, we have to move down one tile in the tilemap
|
||||||
|
LDX.w #$0000
|
||||||
; if not, we have to move down one tile in the tilemap
|
LDA $07 : CLC : ADC #$0040 : STA $07
|
||||||
LDX.w #$0000
|
|
||||||
|
|
||||||
LDA $07 : CLC : ADC #$0040 : STA $07
|
|
||||||
|
|
||||||
.noLineChange
|
.noLineChange
|
||||||
|
LDA [$0A], Y : TXY : STA [$07], Y
|
||||||
LDA [$0A], Y : TXY : STA [$07], Y
|
RTS
|
||||||
|
|
||||||
RTS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
; =============================================================================
|
; =============================================================================
|
||||||
@@ -762,7 +740,6 @@ FloorIndicatorNumberLow:
|
|||||||
dw $E50C, $A50E, $007F
|
dw $E50C, $A50E, $007F
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
; *$57D0C-$57DA7 JUMP LOCATION (LONG)
|
; *$57D0C-$57DA7 JUMP LOCATION (LONG)
|
||||||
org $0AFD0C
|
org $0AFD0C
|
||||||
FloorIndicator:
|
FloorIndicator:
|
||||||
|
|||||||
Reference in New Issue
Block a user