More fast hud

Added update hud flag
This commit is contained in:
cassidoxa
2023-06-08 11:21:42 -04:00
parent 3a90df5bd4
commit 815c2ab81f
11 changed files with 89 additions and 17 deletions

View File

@@ -3,6 +3,7 @@ DungeonItemMasks: ; these are dungeon correlations to $7EF364 - $7EF369 so it kn
dw $0080, $0040, $0020, $0010, $0008, $0004 dw $0080, $0040, $0020, $0010, $0008, $0004
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
InitDungeonCounts: InitDungeonCounts:
PHB
LDX.b #$0F LDX.b #$0F
- -
LDA.l CompassTotalsROM, X : STA.l CompassTotalsWRAM, X LDA.l CompassTotalsROM, X : STA.l CompassTotalsWRAM, X
@@ -13,5 +14,18 @@ InitDungeonCounts:
LDA.l ChestKeys, X : STA.l MapTotalsWRAM, X LDA.l ChestKeys, X : STA.l MapTotalsWRAM, X
DEX DEX
BPL - BPL -
LDA.b #$7E
PHA : PLB
REP #$30
LDA.l TotalItemCount
JSL.l HUDHex4Digit_Long
SEP #$20
LDA.b Scrap04 : TAX : STX.w TotalItemCountTiles+$00
LDA.b Scrap05 : TAX : STX.w TotalItemCountTiles+$02
LDA.b Scrap06 : TAX : STX.w TotalItemCountTiles+$04
LDA.b Scrap07 : TAX : STX.w TotalItemCountTiles+$06
SEP #$10
PLB
RTL RTL

View File

@@ -155,6 +155,7 @@ JML.l AllowStartFromExitReturn
STZ.b SubSubModule STZ.b SubSubModule
STZ.w DeathReloadFlag STZ.w DeathReloadFlag
STZ.w RespawnFlag STZ.w RespawnFlag
INC.w UpdateHUD
JSL Equipment_SearchForEquippedItemLong JSL Equipment_SearchForEquippedItemLong
JSL HUD_RebuildLong2 JSL HUD_RebuildLong2

View File

@@ -17,6 +17,7 @@ JML.l ReturnFromOnDrawHud
OnDungeonEntrance: OnDungeonEntrance:
STA.l PegColor ; thing we wrote over STA.l PegColor ; thing we wrote over
JSL MaybeFlagDungeonTotalsEntrance JSL MaybeFlagDungeonTotalsEntrance
INC.w UpdateHUD
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
OnPlayerDead: OnPlayerDead:
@@ -37,6 +38,7 @@ OnDungeonExit:
PHA : PHP PHA : PHP
JSL.l HUD_RebuildLong JSL.l HUD_RebuildLong
INC.w UpdateHUD
JSL.l FloodGateResetInner JSL.l FloodGateResetInner
JSL.l SetSilverBowMode JSL.l SetSilverBowMode
PLP : PLA PLP : PLA

View File

@@ -1376,7 +1376,11 @@ MVN $217E
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $0DFB1F ; 6FB1F - headsup_display.asm : 681 (LDA $7EF340 : BEQ .hastNoBow) org $0DFB1F ; 6FB1F - headsup_display.asm : 681 (LDA $7EF340 : BEQ .hastNoBow)
JSL.l CheckHUDSilverArrows JSL.l CheckHUDSilverArrows
;--------------------------------------------------------------------------------
org $0DF1AB
JSR.w RebuildHUD_update
org $0DDFC8
JSR.w RebuildHUD_update
;================================================================================ ;================================================================================
; 300 Rupee NPC ; 300 Rupee NPC
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -689,6 +689,7 @@ Link_ReceiveItem_HUDRefresh:
+ +
JSL.l HUD_RefreshIconLong ; thing we wrote over JSL.l HUD_RefreshIconLong ; thing we wrote over
INC.w UpdateHUD
JSL.l PostItemGet JSL.l PostItemGet
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -703,6 +704,7 @@ HandleBombAbsorbtion:
LDA.b #$04 : STA.w ItemCursor ; set selected item to bombs LDA.b #$04 : STA.w ItemCursor ; set selected item to bombs
LDA.b #$01 : STA.w CurrentYItem ; set selected item to bombs LDA.b #$01 : STA.w CurrentYItem ; set selected item to bombs
JSL.l HUD_RebuildLong JSL.l HUD_RebuildLong
INC.w UpdateHUD
+ +
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -64,6 +64,8 @@ NewHUD_DrawArrows:
;================================================================================ ;================================================================================
NewHUD_DrawGoal: NewHUD_DrawGoal:
LDA.w UpdateHUD : BEQ .no_goal
REP #$20 REP #$20
LDA.l GoalItemRequirement : BEQ .no_goal LDA.l GoalItemRequirement : BEQ .no_goal
@@ -122,6 +124,7 @@ NewHUD_DrawKeys:
;================================================================================ ;================================================================================
NewHUD_DrawDungeonCounters: NewHUD_DrawDungeonCounters:
LDA.w UpdateHUD : BEQ NewHUD_DrawPrizeIcon
LDA.l CompassMode : ORA.l MapHUDMode : BIT.b #$03 : BEQ NewHUD_DrawPrizeIcon LDA.l CompassMode : ORA.l MapHUDMode : BIT.b #$03 : BEQ NewHUD_DrawPrizeIcon
LDX.b IndoorsFlag : BNE + LDX.b IndoorsFlag : BNE +
JMP.w NewHUD_DrawMagicMeter JMP.w NewHUD_DrawMagicMeter
@@ -129,7 +132,7 @@ NewHUD_DrawDungeonCounters:
SEP #$30 SEP #$30
; extra hard safeties for getting dungeon ID to prevent crashes ; extra hard safeties for getting dungeon ID to prevent crashes
LDA.w DungeonID LDA.w DungeonID
CPX.b #$1B : BCS NewHUD_DrawPrizeIcon ; Skip if not in a valid dungeon ID CMP.b #$1B : BCS NewHUD_DrawPrizeIcon ; Skip if not in a valid dungeon ID
AND.b #$FE : TAX AND.b #$FE : TAX
LSR : TAY LSR : TAY
PHX : PHY PHX : PHY
@@ -141,6 +144,8 @@ NewHUD_DrawDungeonCounters:
;================================================================================ ;================================================================================
NewHUD_DrawPrizeIcon: NewHUD_DrawPrizeIcon:
REP #$10
SEP #$20
LDA.b GameMode LDA.b GameMode
CMP.b #$12 CMP.b #$12
BEQ .no_prize BEQ .no_prize
@@ -151,7 +156,7 @@ NewHUD_DrawPrizeIcon:
CMP.b #$08 : BNE .dungeon CMP.b #$08 : BNE .dungeon
.no_prize .no_prize
LDY.w #BlankTile LDY.w #!BlankTile
BRA .draw_prize BRA .draw_prize
.dungeon .dungeon
@@ -162,16 +167,17 @@ NewHUD_DrawPrizeIcon:
LDA.l MapMode LDA.l MapMode
REP #$30 REP #$30
BEQ .prize
LDA.l MapField LDA.l MapField
AND.l DungeonItemMasks,X AND.l DungeonItemMasks,X
SEP #$20
BEQ .no_prize BEQ .no_prize
.prize
TYX TYX
LDA.l CrystalPendantFlags_2,X LDA.l CrystalPendantFlags_2,X
AND.b #$40 AND.w #$0040
BNE .crystal BNE .crystal
LDY.w #!PTile LDY.w #!PTile
@@ -183,6 +189,38 @@ NewHUD_DrawPrizeIcon:
.draw_prize .draw_prize
STY.w HUDPrizeIcon STY.w HUDPrizeIcon
;================================================================================
NewHUD_DrawItemCounter:
LDA.w UpdateHUD : BEQ NewHUD_DrawMagicMeter
LDA.l ItemCounterHUD : AND.w #$00FF : BEQ NewHUD_DrawMagicMeter
LDA.w #!SlashTile : STA.w HUDGoalIndicator+$08
LDA.l TotalItemCount : CMP.w #1000 : BCS .item_four_digits
LDA.w TotalItemCountTiles+$02 : STA.w HUDGoalIndicator+$0A
LDA.w TotalItemCountTiles+$04 : STA.w HUDGoalIndicator+$0C
LDA.w TotalItemCountTiles+$06 : STA.w HUDGoalIndicator+$0E
LDA.w TotalItemCounter
JSR.w HUDHex4Digit
LDA.b $05 : TAX : STX.w HUDGoalIndicator+$02
LDA.b $06 : TAX : STX.w HUDGoalIndicator+$04
LDA.b $07 : TAX : STX.w HUDGoalIndicator+$06
BRA NewHUD_DrawMagicMeter
.item_four_digits
LDA.w TotalItemCountTiles+$00 : STA.w HUDGoalIndicator+$0A
LDA.w TotalItemCountTiles+$02 : STA.w HUDGoalIndicator+$0C
LDA.w TotalItemCountTiles+$04 : STA.w HUDGoalIndicator+$0E
LDA.w TotalItemCountTiles+$06 : STA.w HUDGoalIndicator+$10
LDA.w TotalItemCounter
JSR.w HUDHex4Digit
LDA.b $04 : TAX : STX.w HUDGoalIndicator+$00
LDA.b $05 : TAX : STX.w HUDGoalIndicator+$02
LDA.b $06 : TAX : STX.w HUDGoalIndicator+$04
LDA.b $07 : TAX : STX.w HUDGoalIndicator+$06
;================================================================================ ;================================================================================
DrawMagicMeter_mp_tilemap = $0DFE0F DrawMagicMeter_mp_tilemap = $0DFE0F
NewHUD_DrawMagicMeter: NewHUD_DrawMagicMeter:
@@ -197,7 +235,7 @@ NewHUD_DrawMagicMeter:
.infinite_magic .infinite_magic
LDA.b #$80 LDA.b #$80
STA.l CurrentMagic STA.w CurrentMagic
TAY TAY
LDA.b FrameCounter LDA.b FrameCounter
@@ -215,13 +253,14 @@ NewHUD_DrawMagicMeter:
LDA.l MagicMeterColorMasks,X LDA.l MagicMeterColorMasks,X
TYX TYX
TAY : AND.l DrawMagicMeter_mp_tilemap+0,X : STA.l HUDTileMapBuffer+$046 TAY : AND.l DrawMagicMeter_mp_tilemap+0,X : STA.w HUDTileMapBuffer+$046
TYA : AND.l DrawMagicMeter_mp_tilemap+2,X : STA.l HUDTileMapBuffer+$086 TYA : AND.l DrawMagicMeter_mp_tilemap+2,X : STA.w HUDTileMapBuffer+$086
TYA : AND.l DrawMagicMeter_mp_tilemap+4,X : STA.l HUDTileMapBuffer+$0C6 TYA : AND.l DrawMagicMeter_mp_tilemap+4,X : STA.w HUDTileMapBuffer+$0C6
TYA : AND.l DrawMagicMeter_mp_tilemap+6,X : STA.l HUDTileMapBuffer+$106 TYA : AND.l DrawMagicMeter_mp_tilemap+6,X : STA.w HUDTileMapBuffer+$106
;================================================================================ ;================================================================================
NewHUD_DoneDrawing: NewHUD_DoneDrawing:
STZ.w UpdateHUD
PLB PLB
RTL RTL
@@ -239,6 +278,7 @@ DrawCompassCounts:
; no compass needed if this bit is set ; no compass needed if this bit is set
BIT.b #$02 : BNE .draw_compass_count BIT.b #$02 : BNE .draw_compass_count
REP #$20
LDA.l CompassField : AND.l DungeonItemMasks,X : BEQ .done LDA.l CompassField : AND.l DungeonItemMasks,X : BEQ .done
.draw_compass_count .draw_compass_count
@@ -268,6 +308,7 @@ DrawMapCounts:
; no map needed if this bit is set ; no map needed if this bit is set
BIT.b #$02 : BNE .draw_map_count BIT.b #$02 : BNE .draw_map_count
REP #$20
LDA.l MapField : AND.l DungeonItemMasks,X : BEQ .done LDA.l MapField : AND.l DungeonItemMasks,X : BEQ .done
.draw_map_count .draw_map_count
@@ -275,6 +316,7 @@ DrawMapCounts:
INX INX
.not_sewers .not_sewers
SEP #$20
LDA.l DungeonCollectedKeys, X LDA.l DungeonCollectedKeys, X
PHA PHA

View File

@@ -17,18 +17,23 @@ RTL
;================================================================================ ;================================================================================
HUDRebuildIndoorHole: HUDRebuildIndoorHole:
PHA PHA
INC.w UpdateHUD
LDA.l GenericKeys : BEQ .normal LDA.l GenericKeys : BEQ .normal
.generic .generic
PLA PLA
LDA.l CurrentGenericKeys ; generic key count LDA.l CurrentGenericKeys ; generic key count
JSL.l HUD_RebuildIndoor_Palace STA.l CurrentSmallKeys
JSL.l RebuildHUD_update
RTL RTL
.normal .normal
PLA PLA
JSL.l HUD_RebuildIndoor_Palace
STA.l CurrentSmallKeys
JSL.l RebuildHUD_update
RTL RTL
;================================================================================ ;================================================================================
HUDRebuildIndoor: HUDRebuildIndoor:
INC.w UpdateHUD
LDA.l GenericKeys : BEQ .normal LDA.l GenericKeys : BEQ .normal
.generic .generic
LDA.b #$00 : STA.l RoomDarkness LDA.b #$00 : STA.l RoomDarkness
@@ -170,6 +175,7 @@ RaiseHudMenu:
RTL RTL
;================================================================================ ;================================================================================
CheckCloseItemMenu: CheckCloseItemMenu:
INC.w UpdateHUD
LDA.l MenuCollapse : BNE + LDA.l MenuCollapse : BNE +
LDA.b Joy1A_New : AND.b #$10 : RTL LDA.b Joy1A_New : AND.b #$10 : RTL
+ +

View File

@@ -354,6 +354,8 @@ DelayTimer = $7E1CE9 ;
; ;
TextID = $7E1CF0 ; Message ID and page. Word length. TextID = $7E1CF0 ; Message ID and page. Word length.
; ;
UpdateHUD = $7E1E03 ; Flag used to mark HUD updates and avoid heavy code segments.
;
ToastBuffer = $7E1E0E ; Multiworld buffer. Word length. ToastBuffer = $7E1E0E ; Multiworld buffer. Word length.
; ;
MSUResumeTime = $7E1E6B ; Mirrored MSU block MSUResumeTime = $7E1E6B ; Mirrored MSU block
@@ -439,6 +441,7 @@ HUDArrowCount = $7EC760 ;
HUDKeyDigits = $7EC764 ; HUDKeyDigits = $7EC764 ;
; ;
BigRAM = $7EC900 ; Big buffer of free ram (0x1F00) BigRAM = $7EC900 ; Big buffer of free ram (0x1F00)
TotalItemCountTiles = $7ECB00 ; Cached total item count tiles for HUD. Four words high to low.
;================================================================================ ;================================================================================
; Bank 7F ; Bank 7F

View File

@@ -83,6 +83,7 @@ IncrementSmallKeys:
JSL.l UpdateKeys JSL.l UpdateKeys
PHY : LDY.b #24 : JSL.l FullInventoryExternal : PLY PHY : LDY.b #24 : JSL.l FullInventoryExternal : PLY
JSL.l HUD_RebuildLong JSL.l HUD_RebuildLong
INC.w UpdateHUD
PLX PLX
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -102,6 +103,7 @@ IncrementSmallKeysNoPrimary:
PLP PLP
+ +
JSL.l HUD_RebuildLong JSL.l HUD_RebuildLong
INC.w UpdateHUD
PLX PLX
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -117,11 +117,6 @@ DrawChallengeTimer:
LDA.w #$280C : STA.l HUDTileMapBuffer+$96 LDA.w #$280C : STA.l HUDTileMapBuffer+$96
RTL RTL
+ +
LDA.w #$247F : STA.l HUDTileMapBuffer+$90
STA.l HUDTileMapBuffer+$92
STA.l HUDTileMapBuffer+$94
STA.l HUDTileMapBuffer+$96
++
LDA.l TimerStyle : BNE + : RTL : + ; Hud Timer LDA.l TimerStyle : BNE + : RTL : + ; Hud Timer
LDA.w #$2807 : STA.l HUDTileMapBuffer+$92 LDA.w #$2807 : STA.l HUDTileMapBuffer+$92

View File

@@ -101,6 +101,7 @@ DrawEquipment = $0DED29 ; returns short
HUD_RebuildLong = $0DFA78 HUD_RebuildLong = $0DFA78
HUD_RebuildIndoor_Palace = $0DFA88 HUD_RebuildIndoor_Palace = $0DFA88
HUD_RebuildLong2 = $0DFA88 HUD_RebuildLong2 = $0DFA88
RebuildHUD_update = $0DFAA5
Messaging_Text = $0EEE10 Messaging_Text = $0EEE10
Overworld_TileAttr = $0FFD94 Overworld_TileAttr = $0FFD94
Overworld_DrawPersistentMap16 = $1BC97C Overworld_DrawPersistentMap16 = $1BC97C