From cd67d277987443e45307d1aaf3d798df2e94ea25 Mon Sep 17 00:00:00 2001 From: aerinon Date: Wed, 30 Aug 2023 10:25:20 -0600 Subject: [PATCH] Hud update flag added for standing items Ram addresses updated Minor multiworld fix --- doorrando/hudadditions.asm | 2 ++ events.asm | 2 +- keydrop/dynamic_si_vram.asm | 72 +++++-------------------------------- keydrop/standing_items.asm | 25 ++++--------- ram.asm | 33 +++++++++++++++-- 5 files changed, 48 insertions(+), 86 deletions(-) diff --git a/doorrando/hudadditions.asm b/doorrando/hudadditions.asm index 8786088..7569bd1 100644 --- a/doorrando/hudadditions.asm +++ b/doorrando/hudadditions.asm @@ -39,6 +39,8 @@ DRHUD_DrawIndicators: DRHUD_BossIndicator: LDA.l DRMode : BNE .continue .early_exit + REP #$10 + LDY.w #!BlankTile : STY.w !IndicatorAddress JMP DRHUD_Finished .continue LDA.w $040C : CMP.b #$1B : BCS .early_exit diff --git a/events.asm b/events.asm index 11c6db7..1f7d28e 100644 --- a/events.asm +++ b/events.asm @@ -256,6 +256,7 @@ PostItemAnimation: LDA !MULTIWORLD_ITEM_PLAYER_ID : BEQ + STZ $02E9 LDA #$00 : STA !MULTIWORLD_ITEM_PLAYER_ID + PLB JML.l Ancilla_ReceiveItem_objectFinished + @@ -291,6 +292,5 @@ PostItemAnimation: STZ.w ItemReceiptMethod : LDA.w AncillaGet, X ; thing we wrote over to get here PLB -RTL JML Ancilla_ReceiveItem_optimus+6 ;-------------------------------------------------------------------------------- diff --git a/keydrop/dynamic_si_vram.asm b/keydrop/dynamic_si_vram.asm index a199eb0..fc72af6 100644 --- a/keydrop/dynamic_si_vram.asm +++ b/keydrop/dynamic_si_vram.asm @@ -1,25 +1,8 @@ -; where we shove the decompressed graphics to send to WRAM -DynamicDropGFX = $7EF500 - -; this will just count from 0 to 4 to determine which slot we're using -; we're expecting 5 items max per room, and order is irrelevant -; we just need to keep track of where they go -DynamicDropGFXIndex = $7E1E70 - -; this will keep track of the above for each item -SprItemGFX = $7E0780 - -; this is the item requested and a flag -DynamicDropRequest = $7E1E71 -DynamicDropQueue = $7E1E72 - ; Come in with ; A = item receipt ID ; X = slot RequestStandingItemVRAMSlot: - STA.w DynamicDropQueue - LDA.b #$01 - STA.w DynamicDropRequest + PHA LDA.w DynamicDropGFXIndex INC @@ -32,21 +15,19 @@ RequestStandingItemVRAMSlot: STA.w SprItemGFX,X - PHX - LDA.w DynamicDropQueue + PLA : PHX ; unsure about substitution rules here, because they aren't skipped properly for MW yet JSL AttemptItemSubstitution JSL ResolveLootIDLong - ASL : TAX : LDA.l StandingItemGraphicsOffsets,X + REP #$30 + ASL : TAX + LDA.l StandingItemGraphicsOffsets,X LDX.w ItemStackPtr - STA.w ItemGFXStack,X - - PLX : PHX - REP #$20 + STA.l ItemGFXStack,X + LDA.w DynamicDropGFXIndex : AND.w #$000F : ASL : TAX LDA.l FreeUWGraphics,X LDX.w ItemStackPtr - STA.w ItemTargetStack,X - SEP #$20 + STA.l ItemTargetStack,X TXA : INC #2 : STA.w ItemStackPtr SEP #$30 PLX @@ -56,43 +37,6 @@ RequestStandingItemVRAMSlot: ;=================================================================================================== -TransferPotGFX: - SEP #$10 - REP #$20 - LDX.w DynamicDropRequest - BEQ .no - - STZ.w DynamicDropRequest - - LDA.w DynamicDropGFXIndex - ASL - TAX - LDA.l FreeUWGraphics,X - STA.w $2116 - - ; calculate bottom row now - CLC : ADC.w #$0200>>1 : PHA - - LDX.b #$7E : STX.w $4314 - LDA.w #DynamicDropGFX : STA.w $4302 - - LDX.b #$80 : STX.w $2115 - LDA.w #$1801 : STA.w $4300 - - LDA.w #$0040 : STA.w $4305 - LDY.b #$01 - - STY.w $420B - STA.w $4305 - - PLA - STA.w $2116 - STY.w $420B - -.no - RTL - - FreeUWGraphics: dw $8800>>1 dw $8840>>1 diff --git a/keydrop/standing_items.asm b/keydrop/standing_items.asm index 9506d16..ff47135 100644 --- a/keydrop/standing_items.asm +++ b/keydrop/standing_items.asm @@ -88,22 +88,6 @@ InitializeMirrorHDMA: org $80E3C4 LoadCommonSprites_long: -; defines -; Ram usage -SpawnedItemID = $7E0720 ; 0x02 -SpawnedItemIndex = $7E0722 ; 0x02 -SpawnedItemIsMultiWorld = $7E0724 ; 0x02 -SpawnedItemFlag = $7E0726 ; 0x02 - one for pot, 2 for sprite drop -; (flag used as a bitmask in conjunction with StandingItemCounterMask) -SpawnedItemMWPlayer = $7E0728 ; 0x02 -;!EnemyDropIndicator = $7E072A ; 0x02 either the blank tile or the blue square -; clear all of them in a loop during room load -SprDropsItem = $7E0730 ; 0x16 -SprItemReceipt = $7E0740 ; 0x16 -SprItemIndex = $7E0750 -SprItemMWPlayer = $7E0760 ; 0x16 -SprItemFlags = $7E0770 ; 0x16 (used for both pots and drops) (combine with SprDropsItem?) - org $09D62E UWSpritesPointers: ; 0x250 bytes for 0x128 rooms' 16-bit pointers @@ -239,9 +223,10 @@ RevealPotItem: ; increment dungeon counts SEP #$30 LDA $040C : CMP #$FF : BEQ + - BNE ++ + CMP.b #$00 : BNE ++ INC #2 ; treat sewers as HC ++ LSR : TAX : LDA DungeonLocationsChecked, X : INC : STA DungeonLocationsChecked, X + INC.w UpdateHUD ; Could increment GT Tower Pre Big Key but we aren't showing that stat right now + REP #$30 LDA TotalItemCounter : INC : STA TotalItemCounter ; Increment Item Total @@ -331,9 +316,10 @@ IncrementCountsForSubstitute: ORA $0A : STA RoomPotData, X SEP #$30 LDA $040C : CMP #$FF : BEQ + - BNE ++ + CMP.b #$00 : BNE ++ INC #2 ; treat sewers as HC ++ LSR : TAX : LDA DungeonLocationsChecked, X : INC : STA DungeonLocationsChecked, X + INC.w UpdateHUD ; Could increment GT Tower Pre Big Key but we aren't showing that stat right now + REP #$30 LDA TotalItemCounter : INC : STA TotalItemCounter ; Increment Item Total @@ -531,9 +517,10 @@ IncrementCountForMinor: SEP #$30 JSR SetupEnemyDropIndicator LDA $040C : CMP #$FF : BEQ + - CMP #$00 : BNE ++ + CMP.b #$00 : BNE ++ INC #2 ; treat sewers as HC ++ LSR : TAX : LDA DungeonLocationsChecked, X : INC : STA DungeonLocationsChecked, X + INC.w UpdateHUD ; Could increment GT Tower Pre Big Key but we aren't showing that stat right now + REP #$30 LDA TotalItemCounter : INC : STA TotalItemCounter ; Increment Item Total diff --git a/ram.asm b/ram.asm index e7a73f4..efe887c 100644 --- a/ram.asm +++ b/ram.asm @@ -274,7 +274,24 @@ TileMapTile32 = $7E0698 ; Tilemap location of new tile32 objects, such ; SkipOAM = $7E0710 ; Set to skip OAM updates. High byte written $FF with exploding walls OWScreenSize = $7E0712 ; Flags overworld screen size. - ; + +SpawnedItemID = $7E0720 ; ID of the Item Spawning. Word +SpawnedItemIndex = $7E0722 ; Sprite/Pot Index of Item Spawning. Word +SpawnedItemIsMultiWorld = $7E0724 ; Multiworld World Flag. Word +SpawnedItemFlag = $7E0726 ; 0x02 - one for pot, 2 for sprite drop + ; (flag used as a bitmask in conjunction with StandingItemCounterMask) +SpawnedItemMWPlayer = $7E0728 ; Player Id for spawned item if Multiworld item 0x02 + +SprDropsItem = $7E0730 ; Array for whether a sprite drops an item 0x16 +SprItemReceipt = $7E0740 ; Array for item id for each sprite 0x16 +SprItemIndex = $7E0750 ; Array for item index (see code) +SprItemMWPlayer = $7E0760 ; Player id for each sprite drop 0x16 +SprItemFlags = $7E0770 ; Array 0x16 (used for both pots and drops) (combine with SprDropsItem?) +SprItemGFX = $7E0780 ; this will keepa track of the DynamicDropGFXIndex for each item +DynamicDropGFXIndex = $7E0790 ; this will just count from 0 to 4 to determine which slot we're using + ; we're expecting 5 items max per room, and order is irrelevant + ; we just need to keep track of where they go +DynamicDropQueue = $7E1E72 ; this is the item requested and a flag OAMBuffer = $7E0800 ; Main OAM buffer sent to OAM. $200 bytes. OAMBuffer2 = $7E0A00 ; ; @@ -477,7 +494,7 @@ HUDKeyDigits = $7EC764 ; ; BigRAM = $7EC900 ; Big buffer of free ram (0x1F00) ItemGFXStack = $7ECB00 ; Pointers to source of decompressed item tiles deferred to NMI loading. -ItemGFXSBankStack = $7ECB20 ; Source bank byte for above. +ItemGFXSBankStack = $7ECB20 ; Source bank byte for above. (not used yet) ItemTargetStack = $7ECB40 ; Pointers to VRAM targets for ItemGFXStack. TotalItemCountTiles = $7ECF00 ; Cached total item count tiles for HUD. Four words high to low. @@ -774,6 +791,18 @@ endmacro %assertRAM(TileMapTile32, $7E0698) %assertRAM(SkipOAM, $7E0710) %assertRAM(OWScreenSize, $7E0712) +%assertRAM(SpawnedItemID, $7E0720) +%assertRAM(SpawnedItemIndex, $7E0722) +%assertRAM(SpawnedItemIsMultiWorld, $7E0724) +%assertRAM(SpawnedItemFlag, $7E0726) +%assertRAM(SpawnedItemMWPlayer, $7E0728) +%assertRAM(SprDropsItem, $7E0730) +%assertRAM(SprItemReceipt, $7E0740) +%assertRAM(SprItemIndex, $7E0750) +%assertRAM(SprItemMWPlayer, $7E0760) +%assertRAM(SprItemFlags, $7E0770) +%assertRAM(SprItemGFX, $7E0780) +%assertRAM(DynamicDropGFXIndex, $7E0790) %assertRAM(OAMBuffer, $7E0800) %assertRAM(OAMBuffer2, $7E0A00) %assertRAM(TransparencyFlag, $7E0ABD)