faster HUD
This commit is contained in:
@@ -145,7 +145,6 @@ incsrc hashalphabet.asm
|
|||||||
incsrc inverted.asm
|
incsrc inverted.asm
|
||||||
incsrc invertedmaps.asm
|
incsrc invertedmaps.asm
|
||||||
incsrc newhud.asm
|
incsrc newhud.asm
|
||||||
incsrc compasses.asm
|
|
||||||
incsrc save.asm
|
incsrc save.asm
|
||||||
incsrc password.asm
|
incsrc password.asm
|
||||||
incsrc enemy_adjustments.asm
|
incsrc enemy_adjustments.asm
|
||||||
|
|||||||
@@ -1,52 +0,0 @@
|
|||||||
DrawDungeonCompassCounts:
|
|
||||||
LDX.b IndoorsFlag : BNE + : RTL : + ; Skip if outdoors
|
|
||||||
|
|
||||||
; extra hard safeties for getting dungeon ID to prevent crashes
|
|
||||||
PHA
|
|
||||||
LDA.w DungeonID : AND.w #$00FE : TAX ; force dungeon ID to be multiple of 2
|
|
||||||
PLA
|
|
||||||
|
|
||||||
CPX.b #$1B : BCS .done ; Skip if not in a valid dungeon ID
|
|
||||||
|
|
||||||
BIT.w #$0002 : BNE ++ ; if CompassMode==2, we don't check for the compass
|
|
||||||
LDA.l CompassField : AND.l DungeonItemMasks, X ; Load compass values to A, mask with dungeon item masks
|
|
||||||
BEQ .done ; skip if we don't have compass
|
|
||||||
++
|
|
||||||
|
|
||||||
TXA : LSR : TAX
|
|
||||||
BNE +
|
|
||||||
INC
|
|
||||||
+
|
|
||||||
LDA.l CompassTotalsWRAM, X : AND.w #$00FF
|
|
||||||
SEP #$20
|
|
||||||
JSR HudHexToDec2Digit
|
|
||||||
REP #$20
|
|
||||||
PHX
|
|
||||||
LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDTileMapBuffer+$9A
|
|
||||||
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDTileMapBuffer+$9C
|
|
||||||
PLX
|
|
||||||
|
|
||||||
LDA.l DungeonLocationsChecked, X : AND.w #$00FF
|
|
||||||
SEP #$20
|
|
||||||
JSR HudHexToDec2Digit
|
|
||||||
REP #$20
|
|
||||||
LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDTileMapBuffer+$94 ; Draw the item count
|
|
||||||
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDTileMapBuffer+$96
|
|
||||||
|
|
||||||
LDA.w #$2830 : STA.l HUDTileMapBuffer+$98 ; draw the slash
|
|
||||||
|
|
||||||
.done
|
|
||||||
RTL
|
|
||||||
|
|
||||||
DungeonItemMasks: ; these are dungeon correlations to $7EF364 - $7EF369 so it knows where to store compasses, etc
|
|
||||||
dw $8000, $4000, $2000, $1000, $0800, $0400, $0200, $0100
|
|
||||||
dw $0080, $0040, $0020, $0010, $0008, $0004
|
|
||||||
;--------------------------------------------------------------------------------
|
|
||||||
InitCompassTotalsRAM:
|
|
||||||
LDX.b #$00
|
|
||||||
-
|
|
||||||
LDA.l CompassTotalsROM, X : STA.l CompassTotalsWRAM, X
|
|
||||||
INX
|
|
||||||
CPX.b #$0F : !BLT -
|
|
||||||
RTL
|
|
||||||
|
|
||||||
37
hooks.asm
37
hooks.asm
@@ -905,10 +905,6 @@ LDA.w AddReceivedItemExpanded_item_masks, X
|
|||||||
org $098769 ; 48769 - ancilla_init.asm:1005 (LDA .item_graphics_indices, Y)
|
org $098769 ; 48769 - ancilla_init.asm:1005 (LDA .item_graphics_indices, Y)
|
||||||
LDA.w ItemReceipts_graphics, Y
|
LDA.w ItemReceipts_graphics, Y
|
||||||
|
|
||||||
org $09878C
|
|
||||||
JSL TransferItemReceiptToBuffer_using_GraphicsID
|
|
||||||
|
|
||||||
|
|
||||||
org $09884D ; 4884D - ancilla_init.asm:1137 (LDA $836C, Y)
|
org $09884D ; 4884D - ancilla_init.asm:1137 (LDA $836C, Y)
|
||||||
LDA.w ItemReceipts_offset_y, Y
|
LDA.w ItemReceipts_offset_y, Y
|
||||||
org $09885B ; 4885B - ancilla_init.asm:1139 (LDA .x_offsets, X) - I think the disassembly is wrong here, should have been LDA .x_offsets, Y
|
org $09885B ; 4885B - ancilla_init.asm:1139 (LDA .x_offsets, X) - I think the disassembly is wrong here, should have been LDA .x_offsets, Y
|
||||||
@@ -2489,3 +2485,36 @@ if !FEATURE_NEW_TEXT
|
|||||||
org $0EF285
|
org $0EF285
|
||||||
JSL RenderCharSetColorExtended_close : NOP
|
JSL RenderCharSetColorExtended_close : NOP
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
;===================================================================================================
|
||||||
|
; Item decompression/loading
|
||||||
|
;===================================================================================================
|
||||||
|
; mushroom - are these even necessary in rando?
|
||||||
|
org $0283CF : JSL TransferItemReceiptToBuffer_using_GraphicsID
|
||||||
|
org $02ADB6 : JSL TransferItemReceiptToBuffer_using_GraphicsID
|
||||||
|
org $02ADE9 : JSL TransferItemReceiptToBuffer_using_GraphicsID
|
||||||
|
|
||||||
|
; big key
|
||||||
|
org $069261 : JSL TransferItemReceiptToBuffer_using_GraphicsID
|
||||||
|
|
||||||
|
; falling items
|
||||||
|
org $08CAE9 : JSL TransferItemReceiptToBuffer_using_GraphicsID
|
||||||
|
org $098BD2 : JSL TransferItemReceiptToBuffer_using_GraphicsID
|
||||||
|
|
||||||
|
; misc
|
||||||
|
org $09878C : JSL TransferItemReceiptToBuffer_using_GraphicsID
|
||||||
|
|
||||||
|
; pond items
|
||||||
|
org $098A4D : JSL TransferItemReceiptToBuffer_using_GraphicsID
|
||||||
|
org $098AEE : JSL TransferItemReceiptToBuffer_using_GraphicsID
|
||||||
|
|
||||||
|
; flute
|
||||||
|
org $098C85 : JSL TransferItemReceiptToBuffer_using_GraphicsID
|
||||||
|
|
||||||
|
; gt cutscene
|
||||||
|
org $099BBE : JSL TransferItemReceiptToBuffer_using_GraphicsID
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
18
init.asm
18
init.asm
@@ -67,8 +67,24 @@ Init_PostRAMClear:
|
|||||||
|
|
||||||
JSL MSUInit
|
JSL MSUInit
|
||||||
JSL InitRNGPointerTable
|
JSL InitRNGPointerTable
|
||||||
JSL InitCompassTotalsRAM
|
JSR InitCompassTotalsRAM
|
||||||
JSL DecompressAllItemGraphics
|
JSL DecompressAllItemGraphics
|
||||||
|
|
||||||
|
|
||||||
JML $00D463 ; The original target of the jump table that we hijacked
|
JML $00D463 ; The original target of the jump table that we hijacked
|
||||||
|
|
||||||
|
;---------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
InitCompassTotalsRAM:
|
||||||
|
LDX.b #$0F
|
||||||
|
|
||||||
|
.next
|
||||||
|
LDA.l CompassTotalsROM,X
|
||||||
|
STA.l CompassTotalsWRAM,X
|
||||||
|
|
||||||
|
DEX
|
||||||
|
BPL .next
|
||||||
|
|
||||||
|
RTS
|
||||||
|
|
||||||
|
;===================================================================================================
|
||||||
|
|||||||
503
newhud.asm
503
newhud.asm
@@ -1,259 +1,340 @@
|
|||||||
|
InfiniteTile = $2431
|
||||||
|
BlankTile = $207F
|
||||||
|
SlashTile = $2830
|
||||||
|
PTile = $296C
|
||||||
|
CTile = $295F
|
||||||
|
|
||||||
|
;===================================================================================================
|
||||||
|
|
||||||
NewDrawHud:
|
NewDrawHud:
|
||||||
SEP #$30
|
PHB
|
||||||
;================================================================================
|
|
||||||
; Draw bomb count
|
|
||||||
;================================================================================
|
|
||||||
|
|
||||||
LDA.l InfiniteBombs : BNE .infinite_bombs
|
SEP #$30
|
||||||
.finite_bombs
|
REP #$10
|
||||||
LDA.l BombsEquipment ; bombs
|
|
||||||
JSR HudHexToDec2Digit ;requires 8 bit registers!
|
|
||||||
REP #$20
|
|
||||||
LDX.b Scrap06 : TXA : ORA.w #$2490 : STA.l HUDBombCount ; Draw bombs 10 digit
|
|
||||||
LDX.b Scrap07 : TXA : ORA.w #$2490 : STA.l HUDBombCount+2 ; Draw bombs 1 digit
|
|
||||||
BRA +
|
|
||||||
|
|
||||||
.infinite_bombs
|
LDA.b #$7E
|
||||||
REP #$20
|
PHA
|
||||||
LDA.w #$2431 : STA.l HUDBombCount ; infinity (left half)
|
PLB
|
||||||
INC A : STA.l HUDBombCount+2 ; infinity (right half)
|
|
||||||
+
|
|
||||||
|
|
||||||
;================================================================================
|
;===================================================================================================
|
||||||
; Draw rupee counter
|
|
||||||
;================================================================================
|
|
||||||
|
|
||||||
LDA.l DisplayRupees ; Drawing bombs (above) always ends with 16-bit A, so, no need to REP here
|
|
||||||
JSR HudHexToDec4Digit
|
|
||||||
LDX.b Scrap04 : TXA : ORA.w #$2490 : STA.l HUDRupees ; 1000s
|
|
||||||
LDX.b Scrap05 : TXA : ORA.w #$2490 : STA.l HUDRupees+2 ; 100s
|
|
||||||
LDX.b Scrap06 : TXA : ORA.w #$2490 : STA.l HUDRupees+4 ; 10s
|
|
||||||
LDX.b Scrap07 : TXA : ORA.w #$2490 : STA.l HUDRupees+6 ; 1s
|
|
||||||
|
|
||||||
;================================================================================
|
|
||||||
; Draw arrow count
|
|
||||||
;================================================================================
|
|
||||||
|
|
||||||
|
NewHUD_DrawBombs:
|
||||||
|
LDA.l InfiniteBombs : BEQ .finite
|
||||||
|
|
||||||
|
.infinite
|
||||||
|
LDY.w #InfiniteTile+0
|
||||||
|
LDX.w #InfiniteTile+1
|
||||||
|
|
||||||
|
BRA .draw
|
||||||
|
|
||||||
|
.finite
|
||||||
|
LDA.w BombsEquipment
|
||||||
|
JSR HUDHex2Digit
|
||||||
|
|
||||||
|
.draw
|
||||||
|
STY.w HUDBombCount+0
|
||||||
|
STX.w HUDBombCount+2
|
||||||
|
|
||||||
|
;===================================================================================================
|
||||||
|
|
||||||
|
NewHUD_DrawRupees:
|
||||||
|
REP #$20
|
||||||
|
|
||||||
|
LDA.w DisplayRupees
|
||||||
|
JSR HUDHex4Digit
|
||||||
|
|
||||||
|
LDA.b Scrap04 : TAX : STX.w HUDRupees+0 ; 1000s
|
||||||
|
LDA.b Scrap05 : TAX : STX.w HUDRupees+2 ; 100s
|
||||||
|
LDA.b Scrap06 : TAX : STX.w HUDRupees+4 ; 10s
|
||||||
|
LDA.b Scrap07 : TAX : STX.w HUDRupees+6 ; 1s
|
||||||
|
|
||||||
|
;===================================================================================================
|
||||||
|
|
||||||
|
NewHUD_DrawArrows:
|
||||||
SEP #$20
|
SEP #$20
|
||||||
LDA.l ArrowMode : BNE +
|
|
||||||
LDA.l InfiniteArrows : BNE .infinite_arrows
|
LDA.l ArrowMode
|
||||||
.finite_arrows
|
BNE NewHUD_DrawGoal
|
||||||
LDA.l CurrentArrows ; arrows
|
|
||||||
JSR HudHexToDec2Digit
|
LDA.l InfiniteArrows : BEQ .finite
|
||||||
REP #$20
|
|
||||||
LDX.b Scrap06 : TXA : ORA.w #$2490 : STA.l HUDArrowCount ; Draw arrows 10 digit
|
.infinite
|
||||||
LDX.b Scrap07 : TXA : ORA.w #$2490 : STA.l HUDArrowCount+2 ; Draw arrows 1 digit
|
LDY.w #InfiniteTile+0
|
||||||
BRA +
|
LDX.w #InfiniteTile+1
|
||||||
|
|
||||||
.infinite_arrows
|
BRA .draw
|
||||||
REP #$20
|
|
||||||
LDA.w #$2431 : STA.l HUDArrowCount ; infinity (left half)
|
.finite
|
||||||
INC A : STA.l HUDArrowCount+2 ; infinity (right half)
|
LDA.w CurrentArrows
|
||||||
+
|
JSR HUDHex2Digit
|
||||||
|
|
||||||
;================================================================================
|
.draw
|
||||||
; Draw Goal Item Indicator
|
STY.w HUDArrowCount+0
|
||||||
;================================================================================
|
STX.w HUDArrowCount+2
|
||||||
|
|
||||||
|
;===================================================================================================
|
||||||
|
|
||||||
|
NewHUD_DrawGoal:
|
||||||
|
REP #$20
|
||||||
|
|
||||||
|
LDA.l GoalItemRequirement
|
||||||
|
BEQ .no_goal
|
||||||
|
|
||||||
|
LDA.l GoalItemIcon
|
||||||
|
STA.w HUDGoalIndicator
|
||||||
|
|
||||||
|
LDA.w #SlashTile
|
||||||
|
STA.w HUDGoalIndicator+8
|
||||||
|
|
||||||
|
LDA.l GoalCounter
|
||||||
|
JSR HUDHex4Digit
|
||||||
|
|
||||||
|
LDA.b Scrap05 : TAX : STX.w HUDGoalIndicator+2 ; draw 100's digit
|
||||||
|
LDA.b Scrap06 : TAX : STX.w HUDGoalIndicator+4 ; draw 10's digit
|
||||||
|
LDA.b Scrap07 : TAX : STX.w HUDGoalIndicator+6 ; draw 1's digit
|
||||||
|
|
||||||
|
|
||||||
REP #$20
|
REP #$20
|
||||||
LDA.l GoalItemRequirement : BNE + : JMP .done : + ; Star Meter
|
|
||||||
|
|
||||||
LDA.l GoalCounter
|
LDA.l GoalItemRequirement
|
||||||
JSR HudHexToDec4Digit
|
CMP.w #$FFFF
|
||||||
|
BNE .real_goal
|
||||||
|
|
||||||
LDA.l GoalItemIcon : STA.l HUDGoalIndicator ; draw star icon
|
LDX.w #BlankTile
|
||||||
|
STX.w HUDGoalIndicator+10
|
||||||
LDX.b Scrap05 : TXA : ORA.w #$2490 : STA.l HUDGoalIndicator+2 ; draw 100's digit
|
STX.w HUDGoalIndicator+12
|
||||||
LDX.b Scrap06 : TXA : ORA.w #$2490 : STA.l HUDGoalIndicator+4 ; draw 10's digit
|
STX.w HUDGoalIndicator+14
|
||||||
LDX.b Scrap07 : TXA : ORA.w #$2490 : STA.l HUDGoalIndicator+6 ; draw 1's digit
|
|
||||||
|
|
||||||
LDA.l GoalItemRequirement : CMP.w #$FFFF : BEQ .skip
|
|
||||||
LDA.l GoalItemRequirement
|
|
||||||
JSR HudHexToDec4Digit
|
|
||||||
LDA.w #$2830 : STA.l HUDGoalIndicator+8 ; draw slash
|
|
||||||
LDX.b Scrap05 : TXA : ORA.w #$2490 : STA.l HUDGoalIndicator+10 ; draw 100's digit
|
|
||||||
LDX.b Scrap06 : TXA : ORA.w #$2490 : STA.l HUDGoalIndicator+12 ; draw 10's digit
|
|
||||||
LDX.b Scrap07 : TXA : ORA.w #$2490 : STA.l HUDGoalIndicator+14 ; draw 1's digit
|
|
||||||
BRA .done
|
|
||||||
.skip
|
|
||||||
LDA.w #$207F ; transparent tile
|
|
||||||
STA.l HUDGoalIndicator+8
|
|
||||||
STA.l HUDGoalIndicator+10
|
|
||||||
STA.l HUDGoalIndicator+12
|
|
||||||
.done
|
|
||||||
|
|
||||||
;================================================================================
|
|
||||||
; Draw Dungeon Compass Counts
|
|
||||||
;================================================================================
|
|
||||||
LDA.l CompassMode : AND.w #$00FF : BEQ + ; skip if CompassMode is 0.
|
|
||||||
JSL.l DrawDungeonCompassCounts ; compasses.asm
|
|
||||||
+
|
|
||||||
|
|
||||||
;================================================================================
|
.no_goal
|
||||||
; Draw key count
|
|
||||||
;================================================================================
|
|
||||||
SEP #$20
|
SEP #$20
|
||||||
LDA.l CurrentSmallKeys : CMP.b #$FF : BEQ .not_in_dungeon
|
BRA NewHUD_DrawKeys
|
||||||
.in_dungeon
|
|
||||||
JSR HudHexToDec2Digit : REP #$20
|
|
||||||
|
|
||||||
; if 10s digit is 0, draw transparent tile instead of 0
|
|
||||||
LDX.b Scrap06 : TXA : BNE +
|
|
||||||
LDA.w #$007F
|
|
||||||
+
|
|
||||||
ORA.w #$2490 : STA.l HUDKeyDigits
|
|
||||||
|
|
||||||
; 1s digit
|
|
||||||
LDX.b Scrap07 : TXA : ORA.w #$2490 : STA.l HUDKeyDigits+2
|
|
||||||
BRA .done_keys
|
|
||||||
|
|
||||||
.not_in_dungeon
|
|
||||||
REP #$20
|
|
||||||
|
|
||||||
;in the overworld, draw transparent tiles instead of key count
|
|
||||||
LDA.w #$247F : STA.l HUDKeyDigits : STA.l HUDKeyDigits+2
|
|
||||||
STA.l HUDKeyIcon
|
|
||||||
|
|
||||||
.done_keys
|
|
||||||
|
|
||||||
|
.real_goal
|
||||||
|
JSR HUDHex4Digit
|
||||||
|
|
||||||
|
LDA.b Scrap05 : TAX : STX.w HUDGoalIndicator+10 ; draw 100's digit
|
||||||
|
LDA.b Scrap06 : TAX : STX.w HUDGoalIndicator+12 ; draw 10's digit
|
||||||
|
LDA.b Scrap07 : TAX : STX.w HUDGoalIndicator+14 ; draw 1's digit
|
||||||
|
|
||||||
|
;===================================================================================================
|
||||||
|
|
||||||
;--------------------------------------------------------------------------------
|
NewHUD_DrawKeys:
|
||||||
; Draw pendant/crystal icon
|
LDA.l CurrentSmallKeys
|
||||||
;--------------------------------------------------------------------------------
|
CMP.b #$FF
|
||||||
!P_ICON = $296C
|
BNE .in_dungeon
|
||||||
!C_ICON = $295F
|
|
||||||
|
|
||||||
SEP #$20
|
LDY.w #BlankTile
|
||||||
LDA.b IndoorsFlag : BEQ .noprize
|
STY.w HUDKeyIcon
|
||||||
|
STY.w HUDKeyDigits+0
|
||||||
|
STY.w HUDKeyDigits+2
|
||||||
|
BRA NewHUD_DrawCompassCount
|
||||||
|
|
||||||
LDX.w DungeonID
|
.in_dungeon
|
||||||
CPX #$1A : !BGE .noprize
|
JSR HUDHex2Digit
|
||||||
CPX #$04 : !BLT .noprize
|
CPY.w #$2490
|
||||||
CPX #$08 : BEQ .noprize
|
BNE .real_10s
|
||||||
|
|
||||||
LDA.b GameMode : CMP.b #$12 : BEQ .noprize
|
LDY.w #BlankTile
|
||||||
|
|
||||||
|
.real_10s
|
||||||
|
STY.w HUDKeyDigits+0
|
||||||
|
STX.w HUDKeyDigits+2
|
||||||
|
|
||||||
|
;===================================================================================================
|
||||||
|
|
||||||
|
NewHUD_DrawCompassCount:
|
||||||
|
LDA.b IndoorsFlag
|
||||||
|
BNE .indoors
|
||||||
|
|
||||||
|
JMP NewHUD_DrawMagicMeter
|
||||||
|
|
||||||
|
.indoors
|
||||||
|
LDA.l CompassMode
|
||||||
|
BEQ NewHUD_DrawPrizeIcon
|
||||||
|
|
||||||
|
SEP #$30
|
||||||
|
; force dungeon ID to a multiple of 2
|
||||||
|
LDA.w DungeonID
|
||||||
|
CMP.b #$1B : BCS NewHUD_DrawPrizeIcon ; skip if invalid dungeon
|
||||||
|
AND.b #$FE : TAX
|
||||||
|
LSR : TAY ; save reduced ID in Y
|
||||||
|
|
||||||
|
; no compass needed if this bit is set
|
||||||
|
LDA.l CompassMode
|
||||||
|
BIT.b #$02
|
||||||
|
BNE .draw_compass_count
|
||||||
|
|
||||||
|
LDA.l CompassField
|
||||||
|
AND.l DungeonItemMasks,X
|
||||||
|
BEQ NewHUD_DrawPrizeIcon
|
||||||
|
|
||||||
|
.draw_compass_count
|
||||||
|
TYX
|
||||||
|
BNE .not_sewers
|
||||||
|
|
||||||
|
INX
|
||||||
|
|
||||||
|
.not_sewers
|
||||||
|
LDA.l DungeonLocationsChecked, X
|
||||||
|
PHA
|
||||||
|
|
||||||
|
LDA.l CompassTotalsWRAM,X
|
||||||
|
|
||||||
|
JSR HUDHex2Digit
|
||||||
|
STY.w HUDTileMapBuffer+$9A
|
||||||
|
STX.w HUDTileMapBuffer+$9C
|
||||||
|
|
||||||
|
LDX.w #SlashTile
|
||||||
|
STX.w HUDTileMapBuffer+$98
|
||||||
|
|
||||||
|
PLA
|
||||||
|
JSR HUDHex2Digit
|
||||||
|
STY.w HUDTileMapBuffer+$94
|
||||||
|
STX.w HUDTileMapBuffer+$96
|
||||||
|
|
||||||
|
;===================================================================================================
|
||||||
|
|
||||||
|
NewHUD_DrawPrizeIcon:
|
||||||
|
LDA.b GameMode
|
||||||
|
CMP.b #$12
|
||||||
|
BEQ .no_prize
|
||||||
|
|
||||||
|
LDA.w DungeonID
|
||||||
|
CMP.b #$1A : BCS .no_prize
|
||||||
|
CMP.b #$04 : BCC .no_prize
|
||||||
|
CMP.b #$08 : BNE .dungeon
|
||||||
|
|
||||||
|
.no_prize
|
||||||
|
LDY.w #BlankTile
|
||||||
|
BRA .draw_prize
|
||||||
|
|
||||||
|
.dungeon
|
||||||
|
SEP #$30
|
||||||
|
TAX
|
||||||
|
LSR
|
||||||
|
TAY
|
||||||
LDA.l MapMode
|
LDA.l MapMode
|
||||||
REP #$20
|
|
||||||
BEQ .drawprize
|
REP #$30
|
||||||
|
|
||||||
LDA.l MapField
|
LDA.l MapField
|
||||||
AND.l DungeonItemMasks,X
|
AND.l DungeonItemMasks,X
|
||||||
BEQ .noprize
|
|
||||||
|
|
||||||
.drawprize
|
SEP #$20
|
||||||
TXA : LSR : TAX
|
BEQ .no_prize
|
||||||
LDA.l CrystalPendantFlags_2, X
|
|
||||||
AND.w #$0040 : BNE .is_crystal
|
|
||||||
|
|
||||||
LDA.w #!P_ICON
|
TYX
|
||||||
BRA .doneprize
|
LDA.l CrystalPendantFlags_2,X
|
||||||
|
AND.b #$40
|
||||||
|
BNE .crystal
|
||||||
|
|
||||||
.is_crystal
|
LDY.w #PTile
|
||||||
LDA.w #!C_ICON
|
BRA .draw_prize
|
||||||
BRA .doneprize
|
|
||||||
|
|
||||||
.noprize
|
.crystal
|
||||||
REP #$20
|
LDY.w #CTile
|
||||||
LDA.w #$207F
|
|
||||||
|
|
||||||
.doneprize
|
.draw_prize
|
||||||
STA.l HUDPrizeIcon
|
STY.w HUDPrizeIcon
|
||||||
|
|
||||||
|
;===================================================================================================
|
||||||
|
|
||||||
;--------------------------------------------------------------------------------
|
|
||||||
; Draw Magic Meter
|
|
||||||
DrawMagicMeter_mp_tilemap = $0DFE0F
|
DrawMagicMeter_mp_tilemap = $0DFE0F
|
||||||
;--------------------------------------------------------------------------------
|
|
||||||
LDA.l CurrentMagic : AND.w #$00FF ; crap we wrote over when placing the hook for OnDrawHud
|
|
||||||
!ADD #$0007
|
|
||||||
AND.w #$FFF8
|
|
||||||
TAX ; end of crap
|
|
||||||
|
|
||||||
LDA.l InfiniteMagic : AND.w #$00FF : BNE + : JMP .green : +
|
|
||||||
SEP #$20 : LDA.b #$80 : STA.l CurrentMagic : REP #$30 ; set magic to max
|
|
||||||
LDX.w #$0080 ; load full magic meter graphics
|
|
||||||
LDA.b FrameCounter : AND.w #$000C : LSR #2
|
|
||||||
BEQ .red
|
|
||||||
CMP.w #0001 : BEQ .yellow
|
|
||||||
CMP.w #0002 : BNE + : JMP .green : +
|
|
||||||
.blue
|
|
||||||
LDA.l DrawMagicMeter_mp_tilemap+0, X : AND.w #$EFFF : STA.l HUDTileMapBuffer+$46
|
|
||||||
LDA.l DrawMagicMeter_mp_tilemap+2, X : AND.w #$EFFF : STA.l HUDTileMapBuffer+$86
|
|
||||||
LDA.l DrawMagicMeter_mp_tilemap+4, X : AND.w #$EFFF : STA.l HUDTileMapBuffer+$C6
|
|
||||||
LDA.l DrawMagicMeter_mp_tilemap+6, X : AND.w #$EFFF : STA.l HUDTileMapBuffer+$06
|
|
||||||
RTL
|
|
||||||
.red
|
|
||||||
LDA.l DrawMagicMeter_mp_tilemap+0, X : AND.w #$E7FF : STA.l HUDTileMapBuffer+$46
|
|
||||||
LDA.l DrawMagicMeter_mp_tilemap+2, X : AND.w #$E7FF : STA.l HUDTileMapBuffer+$86
|
|
||||||
LDA.l DrawMagicMeter_mp_tilemap+4, X : AND.w #$E7FF : STA.l HUDTileMapBuffer+$C6
|
|
||||||
LDA.l DrawMagicMeter_mp_tilemap+6, X : AND.w #$E7FF : STA.l HUDTileMapBuffer+$06
|
|
||||||
RTL
|
|
||||||
.yellow
|
|
||||||
LDA.l DrawMagicMeter_mp_tilemap+0, X : AND.w #$EBFF : STA.l HUDTileMapBuffer+$46
|
|
||||||
LDA.l DrawMagicMeter_mp_tilemap+2, X : AND.w #$EBFF : STA.l HUDTileMapBuffer+$86
|
|
||||||
LDA.l DrawMagicMeter_mp_tilemap+4, X : AND.w #$EBFF : STA.l HUDTileMapBuffer+$C6
|
|
||||||
LDA.l DrawMagicMeter_mp_tilemap+6, X : AND.w #$EBFF : STA.l HUDTileMapBuffer+$0106
|
|
||||||
RTL
|
|
||||||
.orange
|
|
||||||
LDA.l DrawMagicMeter_mp_tilemap+0, X : AND.w #$E3FF : STA.l HUDTileMapBuffer+$46
|
|
||||||
LDA.l DrawMagicMeter_mp_tilemap+2, X : AND.w #$E3FF : STA.l HUDTileMapBuffer+$86
|
|
||||||
LDA.l DrawMagicMeter_mp_tilemap+4, X : AND.w #$E3FF : STA.l HUDTileMapBuffer+$C6
|
|
||||||
LDA.l DrawMagicMeter_mp_tilemap+6, X : AND.w #$E3FF : STA.l HUDTileMapBuffer+$0106
|
|
||||||
RTL
|
|
||||||
.green
|
|
||||||
LDA.l DrawMagicMeter_mp_tilemap+0, X : STA.l HUDTileMapBuffer+$46
|
|
||||||
LDA.l DrawMagicMeter_mp_tilemap+2, X : STA.l HUDTileMapBuffer+$86
|
|
||||||
LDA.l DrawMagicMeter_mp_tilemap+4, X : STA.l HUDTileMapBuffer+$C6
|
|
||||||
LDA.l DrawMagicMeter_mp_tilemap+6, X : STA.l HUDTileMapBuffer+$0106
|
|
||||||
RTL
|
|
||||||
|
|
||||||
;================================================================================
|
NewHUD_DrawMagicMeter:
|
||||||
; 16-bit A, 8-bit X
|
SEP #$31
|
||||||
; in: A(b) - Byte to Convert
|
LDA.l CurrentMagic
|
||||||
; out: $04 - $07 (high - low)
|
ADC.b #$06 ; carry set by above for +1 to get +7
|
||||||
;================================================================================
|
AND.b #$F8
|
||||||
HudHexToDec4Digit:
|
TAY
|
||||||
JSL HexToDec
|
|
||||||
|
|
||||||
REP #$20
|
LDA.l InfiniteMagic
|
||||||
|
BEQ .set_index
|
||||||
|
|
||||||
LDA.l HexToDecDigit2
|
.infinite_magic
|
||||||
STA.b Scrap04
|
LDA.b #$80
|
||||||
|
STA.l CurrentMagic
|
||||||
|
TAY
|
||||||
|
|
||||||
LDA.l HexToDecDigit4
|
LDA.b FrameCounter
|
||||||
STA.b Scrap06
|
AND.b #$0C
|
||||||
|
LSR
|
||||||
|
|
||||||
RTS
|
.set_index ; this branch is always 0000 when taken
|
||||||
|
TAX
|
||||||
|
|
||||||
;================================================================================
|
LDA.l MagicMeterColorMasks,X
|
||||||
; 8-bit registers
|
|
||||||
; in: A(b) - Byte to Convert
|
|
||||||
; out: $06 - $07 (high - low)
|
|
||||||
;================================================================================
|
|
||||||
HudHexToDec2Digit:
|
|
||||||
PHP
|
|
||||||
|
|
||||||
REP #$30
|
TYX
|
||||||
PHX
|
TAY : AND.l DrawMagicMeter_mp_tilemap+0,X : STA.w HUDTileMapBuffer+$046
|
||||||
|
TYA : AND.l DrawMagicMeter_mp_tilemap+0,X : STA.w HUDTileMapBuffer+$086
|
||||||
|
TYA : AND.l DrawMagicMeter_mp_tilemap+0,X : STA.w HUDTileMapBuffer+$0C6
|
||||||
|
TYA : AND.l DrawMagicMeter_mp_tilemap+0,X : STA.w HUDTileMapBuffer+$106
|
||||||
|
|
||||||
AND.w #$00FF
|
;===================================================================================================
|
||||||
|
|
||||||
|
NewHUD_DoneDrawing:
|
||||||
|
PLB
|
||||||
|
RTL
|
||||||
|
|
||||||
|
;===================================================================================================
|
||||||
|
|
||||||
|
MagicMeterColorMasks:
|
||||||
|
dw $FFFF ; green - KEEP GREEN FIRST
|
||||||
|
dw $EFFF ; blue
|
||||||
|
dw $E7FF ; red
|
||||||
|
dw $EBFF ; yellow
|
||||||
|
dw $E3FF ; orange
|
||||||
|
|
||||||
|
;===================================================================================================
|
||||||
|
; Exits with:
|
||||||
|
; X - ones place tile
|
||||||
|
; Y - tens place tile
|
||||||
|
;===================================================================================================
|
||||||
|
NOP ; this nop makes HUDHex2Digit be at $B00B
|
||||||
|
HUDHex2Digit:
|
||||||
|
SEP #$30 ; clear high byte of X and Y and make it so they don't get B
|
||||||
ASL
|
ASL
|
||||||
TAX
|
TAX
|
||||||
|
|
||||||
SEP #$20
|
REP #$10
|
||||||
|
|
||||||
|
LDA.b #$24 ; tile props in high byte
|
||||||
|
XBA
|
||||||
|
|
||||||
|
LDA.l FastHexTable,X
|
||||||
|
LSR
|
||||||
|
LSR
|
||||||
|
LSR
|
||||||
|
LSR
|
||||||
|
ORA.b #$90
|
||||||
|
TAY
|
||||||
|
|
||||||
LDA.l FastHexTable,X
|
LDA.l FastHexTable,X
|
||||||
AND.b #$0F
|
AND.b #$0F
|
||||||
STA.b Scrap07
|
ORA.b #$90
|
||||||
|
TAX
|
||||||
|
|
||||||
LDA.l FastHexTable,X
|
RTS
|
||||||
LSR
|
|
||||||
LSR
|
;================================================================================
|
||||||
LSR
|
|
||||||
LSR
|
HUDHex4Digit:
|
||||||
|
JSL HexToDec
|
||||||
|
|
||||||
|
REP #$30
|
||||||
|
|
||||||
|
LDA.l HexToDecDigit2
|
||||||
|
ORA.w #$9090
|
||||||
|
STA.b Scrap04
|
||||||
|
|
||||||
|
LDA.l HexToDecDigit4
|
||||||
|
ORA.w #$9090
|
||||||
STA.b Scrap06
|
STA.b Scrap06
|
||||||
|
|
||||||
PLX
|
LDA.w #$2400
|
||||||
PLP
|
|
||||||
|
SEP #$20
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
|
;===================================================================================================
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ endmacro
|
|||||||
|
|
||||||
!ColonOffset = $83
|
!ColonOffset = $83
|
||||||
!PeriodOffset = $80
|
!PeriodOffset = $80
|
||||||
BlankTile = $883D
|
BlankCreditsTile = $883D
|
||||||
|
|
||||||
RenderCreditsStatCounter:
|
RenderCreditsStatCounter:
|
||||||
PHB
|
PHB
|
||||||
@@ -309,7 +309,7 @@ RenderCreditsStatCounter:
|
|||||||
AND.w #$00FF
|
AND.w #$00FF
|
||||||
CMP.b RemoveZero
|
CMP.b RemoveZero
|
||||||
BNE +
|
BNE +
|
||||||
LDA.w #BlankTile
|
LDA.w #BlankCreditsTile
|
||||||
BRA ++
|
BRA ++
|
||||||
+ DEC.b RemoveZero
|
+ DEC.b RemoveZero
|
||||||
CLC
|
CLC
|
||||||
@@ -320,7 +320,7 @@ RenderCreditsStatCounter:
|
|||||||
AND.w #$00FF
|
AND.w #$00FF
|
||||||
CMP.b RemoveZero
|
CMP.b RemoveZero
|
||||||
BNE +
|
BNE +
|
||||||
LDA.w #BlankTile
|
LDA.w #BlankCreditsTile
|
||||||
BRA ++
|
BRA ++
|
||||||
+ DEC.b RemoveZero
|
+ DEC.b RemoveZero
|
||||||
CLC
|
CLC
|
||||||
@@ -331,7 +331,7 @@ RenderCreditsStatCounter:
|
|||||||
AND.w #$00FF
|
AND.w #$00FF
|
||||||
CMP.b RemoveZero
|
CMP.b RemoveZero
|
||||||
BNE +
|
BNE +
|
||||||
LDA.w #BlankTile
|
LDA.w #BlankCreditsTile
|
||||||
BRA ++
|
BRA ++
|
||||||
+ DEC.b RemoveZero
|
+ DEC.b RemoveZero
|
||||||
CLC
|
CLC
|
||||||
|
|||||||
11
tables.asm
11
tables.asm
@@ -1033,7 +1033,16 @@ dw $0000 : db $00 : dw $0000, $0000, $0000, $0000, $0000, $0000, $0000 : db $00,
|
|||||||
dw $0000 : db $00 : dw $0000, $0000, $0000, $0000, $0000, $0000, $0000 : db $00, $00, $00
|
dw $0000 : db $00 : dw $0000, $0000, $0000, $0000, $0000, $0000, $0000 : db $00, $00, $00
|
||||||
dw $0000 : db $00 : dw $0000, $0000, $0000, $0000, $0000, $0000, $0000 : db $00, $00, $00
|
dw $0000 : db $00 : dw $0000, $0000, $0000, $0000, $0000, $0000, $0000 : db $00, $00, $00
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
; 0x1802A0 - 0x1802FF (unused)
|
; 0x1802A0 - 0x1802BF
|
||||||
|
;---------------------------------------------------------------------------------
|
||||||
|
; these are dungeon correlations to $7EF364 - $7EF369 so it knows where to store compasses, etc
|
||||||
|
DungeonItemMasks:
|
||||||
|
dw $8000, $4000, $2000, $1000, $0800, $0400, $0200, $0100
|
||||||
|
dw $0080, $0040, $0020, $0010, $0008, $0004
|
||||||
|
|
||||||
|
;--------------------------------------------------------------------------------
|
||||||
|
; 0x1802C0 - 0x1802FF (unused)
|
||||||
|
;---------------------------------------------------------------------------------
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
; $308300 (0x180300) - $30834F (0x18034F)
|
; $308300 (0x180300) - $30834F (0x18034F)
|
||||||
org $308300 ; PC 0x180300
|
org $308300 ; PC 0x180300
|
||||||
|
|||||||
Reference in New Issue
Block a user