From 1235357531a576821e562ef0e2ddf7e5ea99530b Mon Sep 17 00:00:00 2001 From: codemann8 Date: Thu, 15 Jun 2023 11:12:40 -0500 Subject: [PATCH] Using new overflow GFX slot and redraw after item get --- bookofmudora.asm | 1 + heartpieces.asm | 11 +++++++ inventory.asm | 1 + keydrop/dynamic_si_vram.asm | 60 +++++++++++++++++++++++++++---------- keydrop/standing_items.asm | 1 + 5 files changed, 58 insertions(+), 16 deletions(-) diff --git a/bookofmudora.asm b/bookofmudora.asm index d413984..b120b56 100644 --- a/bookofmudora.asm +++ b/bookofmudora.asm @@ -35,6 +35,7 @@ DrawBonkItemGFX: PHA LDA.w !SPRITE_REDRAW, X : BEQ .skipInit ; skip init if already ready JSL.l LoadBonkItemGFX_inner + LDA.w !SPRITE_REDRAW, X : CMP.b #$02 : BEQ .skipInit BRA .done ; don't draw on the init frame .skipInit diff --git a/heartpieces.asm b/heartpieces.asm index 1996177..5faae3a 100644 --- a/heartpieces.asm +++ b/heartpieces.asm @@ -56,6 +56,7 @@ DrawHeartPieceGFX: PHA : PHY LDA.w !SPRITE_REDRAW, X : BEQ .skipInit ; skip init if already ready JSL.l HeartPieceSpritePrep + LDA.w !SPRITE_REDRAW, X : CMP.b #$02 : BEQ .skipInit BRA .done ; don't draw on the init frame .skipInit @@ -191,6 +192,8 @@ LoadHeartPieceRoomValue: .done RTL ;-------------------------------------------------------------------------------- +!DynamicDropGFXSlotCount_UW = (FreeUWGraphics_end-FreeUWGraphics)>>1 +!DynamicDropGFXSlotCount_OW = (FreeOWGraphics_end-FreeOWGraphics)>>1 HPItemReset: PHA LDA !MULTIWORLD_ITEM_PLAYER_ID : BNE .skip @@ -200,6 +203,14 @@ HPItemReset: .skip PLA .done + PHA : PHY + LDY.b #$0F + - LDA.w $0DD0,Y : BEQ + + LDA.w !SPRITE_REDRAW, Y : CMP.b #$02 : BNE + + ; attempt redraw of any sprite using the overflow slot + LDA.b #$01 : STA.w !SPRITE_REDRAW, Y + + DEY : BPL - + PLY : PLA RTL ;-------------------------------------------------------------------------------- MaybeMarkDigSpotCollected: diff --git a/inventory.asm b/inventory.asm index 0b60e6e..fff30c6 100644 --- a/inventory.asm +++ b/inventory.asm @@ -1015,6 +1015,7 @@ DrawMushroom: PHA : PHY LDA.w !SPRITE_REDRAW, X : BEQ .skipInit ; skip init if already ready JSL.l LoadMushroom_justGFX + LDA.w !SPRITE_REDRAW, X : CMP.b #$02 : BEQ .skipInit BRA .done ; don't draw on the init frame .skipInit diff --git a/keydrop/dynamic_si_vram.asm b/keydrop/dynamic_si_vram.asm index 6f72f34..61a2829 100644 --- a/keydrop/dynamic_si_vram.asm +++ b/keydrop/dynamic_si_vram.asm @@ -22,7 +22,8 @@ RequestSlottedTile: PHX : PHY PHA - ; skip sending the request if busy with other + JSL Sprite_IsOnscreen : BCC ++ + ; skip sending the request if busy with other things LDA.b $11 : CMP.b #$21 : BCS ++ ; skip if OW is loading Map16 GFX ; TODO: Figure out how to allow submodule 22, check DMA status instead LDA.b $5D : CMP.b #$14 : BEQ ++ ; skip if we're mid-mirror LDA.b $1B : BEQ + ; OW current doesn't occupy any slots that medallion gfx do @@ -45,7 +46,7 @@ RequestSlottedTile: LDA.b #!DynamicDropGFXSlotCount_UW BRA +++ ++ LDA.b #!DynamicDropGFXSlotCount_OW - +++ STA.w SprItemGFX,X + +++ INC : STA.w SprItemGFX,X JMP .success + CMP.b #$A0 : BCC + : CMP.b #$AF+1 : BCS + ; if key, use key OAM slot LDY.b $5D : CPY.b #$19 : BCC ++ : CPY.b #$1A+1 : BCS ++ ; if getting tablet item, don't use key slot @@ -55,28 +56,28 @@ RequestSlottedTile: LDA.b #!DynamicDropGFXSlotCount_UW BRA +++ ++ LDA.b #!DynamicDropGFXSlotCount_OW - +++ INC : STA.w SprItemGFX,X + +++ INC : INC : STA.w SprItemGFX,X JMP .success + CMP.b #$B5 : BNE + ; if good bee, use bee OAM slot LDA.b $1B : BEQ ++ LDA.b #!DynamicDropGFXSlotCount_UW BRA +++ ++ LDA.b #!DynamicDropGFXSlotCount_OW - +++ INC : INC : STA.w SprItemGFX,X + +++ INC : INC : INC : STA.w SprItemGFX,X JMP .success + CMP.b #$B2 : BNE + ; if fairy, use fairy OAM slot LDA.b $1B : BEQ ++ LDA.b #!DynamicDropGFXSlotCount_UW BRA +++ ++ LDA.b #!DynamicDropGFXSlotCount_OW - +++ INC : STA.w SprItemGFX,X + +++ INC : INC : STA.w SprItemGFX,X JMP .success + CMP.b #$B1 : BNE + ; if apple, use apple OAM slot LDA.b $1B : BEQ ++ LDA.b #!DynamicDropGFXSlotCount_UW BRA +++ ++ LDA.b #!DynamicDropGFXSlotCount_OW - +++ INC : INC : STA.w SprItemGFX,X + +++ INC : INC : INC : STA.w SprItemGFX,X JMP .success + CMP.b #$6A : BNE + ; if triforce, use cutscene OAM slot PHA @@ -84,7 +85,7 @@ RequestSlottedTile: LDA.b #!DynamicDropGFXSlotCount_UW BRA +++ ++ LDA.b #!DynamicDropGFXSlotCount_OW - +++ STA.w SprItemGFX,X + +++ INC : STA.w SprItemGFX,X JMP .initRequest ; don't jump to end, we need the TF GFX to draw at $E7 + @@ -102,7 +103,26 @@ RequestSlottedTile: PLX STA.w DynamicDropGFXIndex STA.w SprItemGFX,X - + PHX + ; loop thru other sprites, check if any use the same gfx slot + LDY.b #$0F + - TYA : CMP 1,S : BEQ + ; don't check self + LDA.w $0DD0,Y : BEQ + + LDA.w !SPRITE_REDRAW, Y : BNE + + LDA.w SprItemGFX,Y : CMP.w DynamicDropGFXIndex : BNE + + LDA.w $0E20,Y : CMP.b #$EB : BEQ ++ : CMP.b #$E4 : BEQ ++ + BRA + + ++ + ; slot already in use, use overflow slot + LDA.b #$02 : STA.w !SPRITE_REDRAW, X + LDA.b $1B : BEQ ++ + LDA.b #!DynamicDropGFXSlotCount_UW + BRA +++ + ++ LDA.b #!DynamicDropGFXSlotCount_OW + +++ STA.w SprItemGFX,X + PLX : PLA : BRA .return + + DEY : BPL - + PLX .initRequest PHX @@ -351,7 +371,8 @@ DynamicOAMTileUW_thin: ; add new slots above this line - ; + dw 0, 0 : db $E3, $00, $20, $00 ; overflow slot + dw 0, 8 : db $F3, $00, $20, $00 ; above this line, add slots that we want to draw to specific slots @@ -385,6 +406,9 @@ DynamicOAMTileUW_full: ; add new rotating slots above this line + dw -4, -1 : db $A0, $00, $20, $02 ; overflow slot + dd 0, 0 + dw -4, -1 : db $E7, $00, $20, $02 ; triforce dd 0, 0 @@ -417,7 +441,8 @@ DynamicOAMTileOW_thin: ; add new slots above this line - ; + dw 0, 0 : db $E3, $00, $20, $00 ; overflow slot + dw 0, 8 : db $F3, $00, $20, $00 ; above this line, add slots that we want to draw to specific slots @@ -451,6 +476,9 @@ DynamicOAMTileOW_full: ; add new slots above this line + dw 0, 0 : db $A0, $00, $20, $02 ; overflow slot + dd 0, 0 + dw 0, 0 : db $E7, $00, $20, $02 ; triforce dd 0, 0 @@ -463,12 +491,12 @@ DynamicOAMTileOW_full: dd 0, 0 ConditionalPushBlockTransfer: - LDA.b $1B : BNE + - LDA.b #$0F ; don't transfer push block when on the OW - BRA .return-3 - + - LDA.b #$1F : STA.w $420B ; what we wrote over - .return + LDA.b $1B : BNE + + LDA.b #$0F ; don't transfer push block when on the OW + BRA .return-3 + + + LDA.b #$1F : STA.w $420B ; what we wrote over + .return RTL pushpc diff --git a/keydrop/standing_items.asm b/keydrop/standing_items.asm index d24246b..ea07642 100644 --- a/keydrop/standing_items.asm +++ b/keydrop/standing_items.asm @@ -459,6 +459,7 @@ SpriteKeyDrawGFX: LDA.w !SPRITE_REDRAW, X : BEQ + LDA $0E80, X JSL RequestSlottedTile + LDA.w !SPRITE_REDRAW, X : CMP.b #$02 : BEQ + BRA .skipDraw + LDA $0E80, X CMP.b #$24 : BNE +