From 352d1e8a22b6ac50f8bed725bd31c37925a5d9cb Mon Sep 17 00:00:00 2001 From: cassidoxa Date: Wed, 20 Apr 2022 20:33:40 -0400 Subject: [PATCH] Re-add accidentally deleted HUD stuff Fix some processor flags --- compasses.asm | 1 + hudadditions.asm | 1 + keydrop/standing_items.asm | 17 ++++------- newhud.asm | 58 +++++++++++++++++++++++++++++++++++++- 4 files changed, 65 insertions(+), 12 deletions(-) diff --git a/compasses.asm b/compasses.asm index 7873a12..482a498 100644 --- a/compasses.asm +++ b/compasses.asm @@ -3,6 +3,7 @@ ;-------------------------------------------------------------------------------- DrawDungeonCompassCounts: + SEP #$10 LDX $1B : BNE + : RTL : + ; Skip if outdoors ; extra hard safeties for getting dungeon ID to prevent crashes diff --git a/hudadditions.asm b/hudadditions.asm index 8366d61..a70dbd6 100644 --- a/hudadditions.asm +++ b/hudadditions.asm @@ -7,6 +7,7 @@ DrHudOverride: HudAdditions: { + SEP #$10 LDA.l DRFlags : AND #$0008 : BNE + : JMP .end_item_count : + LDA.l TotalItemCounter : PHA : CMP #1000 : !BLT + JSL HexToDec4Digit_fast diff --git a/keydrop/standing_items.asm b/keydrop/standing_items.asm index 173e11f..e642b85 100644 --- a/keydrop/standing_items.asm +++ b/keydrop/standing_items.asm @@ -72,11 +72,6 @@ SprItemIndex = $7E0750 SprItemMWPlayer = $7E0760 ; 0x16 SprItemFlags = $7E0770 ; 0x16 (used for both pots and drops) (combine with SprDropsItem?) -; 7F:6600-7F:684F ($250 or 592 bytes) for pots and 7F:6850-7F:6A9F ($250 or 592 bytes) for sprites - -PotItemSRAM = $7F6600 -SpriteItemSRAM = $7F6850 - ; todo: move sprites ;org $09D62E ;UWSpritesPointers ; 0x250 bytes for 0x128 rooms' 16-bit pointers @@ -164,8 +159,8 @@ RevealPotItem: ; set bit and count if first time lifting this pot LDA.b $A0 : ASL : TAY TXA : ASL : TAX : LDA.l BitFieldMasks, X : STA $0A - TYX : LDA.l PotItemSRAM, X : BIT $0A : BNE .obtained - ORA $0A : STA PotItemSRAM, X + TYX : LDA.l RoomPotData, X : BIT $0A : BNE .obtained + ORA $0A : STA RoomPotData, X PLY : PHY JSR ShouldCountNormalPot : BCC .obtained ; increment dungeon counts @@ -316,9 +311,9 @@ ShouldSpawnItem: TAX : LDA.l BitFieldMasks, X : STA $00 PLX ; restore X again LDA.w SprItemFlags, X : AND #$00FF : CMP #$0001 : BEQ + - TYX : LDA.l SpriteItemSRAM, X : BIT $00 : BEQ .notObtained + TYX : LDA.l SpritePotData, X : BIT $00 : BEQ .notObtained BRA .obtained - + TYX : LDA.l PotItemSRAM, X : BIT $00 : BEQ .notObtained + + TYX : LDA.l RoomPotData, X : BIT $00 : BEQ .notObtained .obtained SEP #$30 : PLY : PLX : LDA #$01 : RTL ; already obtained .notObtained @@ -333,8 +328,8 @@ MarkSRAMForItem: TAX : LDA.l BitFieldMasks, X : STA $00 TYX LDA.w SpawnedItemFlag : CMP #$0001 : BEQ + - LDA SpriteItemSRAM, X : ORA $00 : STA SpriteItemSRAM, X : BRA .end - + LDA PotItemSRAM, X : ORA $00 : STA PotItemSRAM, X + LDA SpritePotData, X : ORA $00 : STA SpritePotData, X : BRA .end + + LDA RoomPotData, X : ORA $00 : STA RoomPotData, X .end SEP #$30 : PLY : PLX LDA.w $0403 diff --git a/newhud.asm b/newhud.asm index ba43d5b..924fd5e 100644 --- a/newhud.asm +++ b/newhud.asm @@ -1,8 +1,64 @@ +NewDrawHud: + SEP #$30 +;================================================================================ +; Draw bomb count +!BOMBCOUNT_DRAW_ADDRESS = "$7EC75A" +!INFINITE_BOMBS = "$7F50C9" +;================================================================================ + + LDA !INFINITE_BOMBS : BNE .infinite_bombs + .finite_bombs + LDA.l $7EF343 ; bombs + JSR HudHexToDec2Digit ;requires 8 bit registers! + REP #$20 + LDX.b $06 : TXA : ORA.w #$2400 : STA !BOMBCOUNT_DRAW_ADDRESS ; Draw bombs 10 digit + LDX.b $07 : TXA : ORA.w #$2400 : STA !BOMBCOUNT_DRAW_ADDRESS+2 ; Draw bombs 1 digit + BRA + + + .infinite_bombs + REP #$20 + LDA.w #$2431 : STA !BOMBCOUNT_DRAW_ADDRESS ; infinity (left half) + INC A : STA !BOMBCOUNT_DRAW_ADDRESS+2 ; infinity (right half) + + + +;================================================================================ +; Draw rupee counter +!RUPEE_DRAW_ADDRESS = "$7EC750" +;================================================================================ + + LDA.l $7EF362 ; Drawing bombs (above) always ends with 16-bit A, so, no need to REP here + JSR HudHexToDec4Digit + LDX.b $04 : TXA : ORA.w #$2400 : STA !RUPEE_DRAW_ADDRESS ; 1000s + LDX.b $05 : TXA : ORA.w #$2400 : STA !RUPEE_DRAW_ADDRESS+2 ; 100s + LDX.b $06 : TXA : ORA.w #$2400 : STA !RUPEE_DRAW_ADDRESS+4 ; 10s + LDX.b $07 : TXA : ORA.w #$2400 : STA !RUPEE_DRAW_ADDRESS+6 ; 1s + +;================================================================================ +; Draw arrow count +!ARROWCOUNT_DRAW_ADDRESS = "$7EC760" +!INFINITE_ARROWS = "$7F50C8" +;================================================================================ + + SEP #$20 + LDA.l ArrowMode : BNE + + LDA !INFINITE_ARROWS : BNE .infinite_arrows + .finite_arrows + LDA.l $7EF377 ; arrows + JSR HudHexToDec2Digit + REP #$20 + LDX.b $06 : TXA : ORA.w #$2400 : STA !ARROWCOUNT_DRAW_ADDRESS ; Draw arrows 10 digit + LDX.b $07 : TXA : ORA.w #$2400 : STA !ARROWCOUNT_DRAW_ADDRESS+2 ; Draw arrows 1 digit + BRA + + + .infinite_arrows + REP #$20 + LDA.w #$2431 : STA !ARROWCOUNT_DRAW_ADDRESS ; infinity (left half) + INC A : STA !ARROWCOUNT_DRAW_ADDRESS+2 ; infinity (right half) + + ;================================================================================ ; Draw Goal Item Indicator !GOAL_DRAW_ADDRESS = "$7EC72A" ;================================================================================ -NewDrawHud: REP #$20 LDA.l GoalItemRequirement : BNE + : JMP .done : + ; Star Meter