Sprite fixes

This commit is contained in:
cassidoxa
2023-08-25 01:38:32 -04:00
parent 247128b9f6
commit 1cbcd1d5ff
7 changed files with 89 additions and 46 deletions

View File

@@ -30,9 +30,17 @@ LoadBonkItemGFX:
LoadBonkItemGFX_inner: LoadBonkItemGFX_inner:
LDA.b #$00 : STA.l RedrawFlag LDA.b #$00 : STA.l RedrawFlag
JSR LoadBonkItem JSR LoadBonkItem
JSL.l ResolveLootIDLong
STA.w SpriteItemType, X STA.w SpriteItemType, X
STA.w SpriteID, X STA.w SpriteID, X
JSL.l PrepDynamicTile JSL.l PrepDynamicTile
PHA : PHX
LDA.w SpriteID,X : TAX
LDA.l SpriteProperties_standing_width,X : BNE +
LDA.b #$00 : STA.l SpriteOAM ; Move narrow items back to the left
LDA.b #$00 : STA.l SpriteOAM+8 ;
+
PLX : PLA
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DrawBonkItemGFX: DrawBonkItemGFX:
@@ -42,7 +50,7 @@ DrawBonkItemGFX:
BRA .done ; don't draw on the init frame BRA .done ; don't draw on the init frame
.skipInit .skipInit
JSR LoadBonkItem LDA.w SpriteID,X
JSL.l DrawDynamicTileNoShadow JSL.l DrawDynamicTileNoShadow
.done .done

View File

@@ -10,7 +10,7 @@ dw $0000, $7FFF, $27FF, $5E2D, $7FFF, $1CE7, $7A10, $64A5
.red_shield .red_shield
dw $0000, $7FFF, $27FF, $5E2D, $4F5F, $1CE7, $2E9C, $14B6 dw $0000, $7FFF, $27FF, $5E2D, $4F5F, $1CE7, $2E9C, $14B6
.mirror_shield .mirror_shield
dw $0000, $7FFF, $27FF, $5E2D, $7399, $1CE7, $02F9, $0233 dw $0000, $7E4E, $6F44, $1CF5, $7399, $1CE7, $02F9, $0233
.crystal .crystal
dw $7FFF, $7FFF, $0000, $5907, $6E0E, $0000, $7FBB, $7672 dw $7FFF, $7FFF, $0000, $5907, $6E0E, $0000, $7FBB, $7672
.off_black .off_black

View File

@@ -236,6 +236,7 @@ PostItemGet:
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
PostItemAnimation: PostItemAnimation:
PHB
LDA.b #$00 : STA.l BusyItem ; mark item as finished LDA.b #$00 : STA.l BusyItem ; mark item as finished
LDA.l TextBoxDefer : BEQ + LDA.l TextBoxDefer : BEQ +
STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
@@ -247,29 +248,32 @@ PostItemAnimation:
JSL.l IncrementChestTurnCounter JSL.l IncrementChestTurnCounter
+ +
REP #$20 REP #$20
PEA.w $7E00
PLB : PLB
LDA.w TransparencyFlag : BNE .SP05 LDA.w TransparencyFlag : BNE .SP05
LDA.l PalettesCustom_off_black+$00 : STA.l PaletteBuffer+$0170 LDA.l PalettesCustom_off_black+$00 : STA.w PaletteBuffer+$0170 : STA.w PaletteBufferAux+$0170
LDA.l PalettesCustom_off_black+$02 : STA.l PaletteBuffer+$0172 LDA.l PalettesCustom_off_black+$02 : STA.w PaletteBuffer+$0172 : STA.w PaletteBufferAux+$0172
LDA.l PalettesCustom_off_black+$04 : STA.l PaletteBuffer+$0174 STA.w PaletteBuffer+$0174 : STA.w PaletteBufferAux+$0174
LDA.l PalettesCustom_off_black+$06 : STA.l PaletteBuffer+$0176 STA.w PaletteBuffer+$0176 : STA.w PaletteBufferAux+$0176
LDA.l PalettesCustom_off_black+$08 : STA.l PaletteBuffer+$0178 STA.w PaletteBuffer+$0178 : STA.w PaletteBufferAux+$0178
LDA.l PalettesCustom_off_black+$0A : STA.l PaletteBuffer+$017A STA.w PaletteBuffer+$017A : STA.w PaletteBufferAux+$017A
LDA.l PalettesCustom_off_black+$0C : STA.l PaletteBuffer+$017C STA.w PaletteBuffer+$017C : STA.w PaletteBufferAux+$017C
LDA.l PalettesCustom_off_black+$0E : STA.l PaletteBuffer+$017E STA.w PaletteBuffer+$017E : STA.w PaletteBufferAux+$017E
BRA .done BRA .done
.SP05 .SP05
LDA.l PalettesCustom_off_black+$00 : STA.l PaletteBuffer+$01B0 LDA.l PalettesCustom_off_black+$00 : STA.w PaletteBuffer+$01B0 : STA.w PaletteBufferAux+$01B0
LDA.l PalettesCustom_off_black+$02 : STA.l PaletteBuffer+$01B2 LDA.l PalettesCustom_off_black+$02 : STA.w PaletteBuffer+$01B2 : STA.w PaletteBufferAux+$01B2
LDA.l PalettesCustom_off_black+$04 : STA.l PaletteBuffer+$01B4 STA.w PaletteBuffer+$01B4 : STA.w PaletteBufferAux+$01B4
LDA.l PalettesCustom_off_black+$06 : STA.l PaletteBuffer+$01B6 STA.w PaletteBuffer+$01B6 : STA.w PaletteBufferAux+$01B6
LDA.l PalettesCustom_off_black+$08 : STA.l PaletteBuffer+$01B8 STA.w PaletteBuffer+$01B8 : STA.w PaletteBufferAux+$01B8
LDA.l PalettesCustom_off_black+$0A : STA.l PaletteBuffer+$01BA STA.w PaletteBuffer+$01BA : STA.w PaletteBufferAux+$01BA
LDA.l PalettesCustom_off_black+$0C : STA.l PaletteBuffer+$01BC STA.w PaletteBuffer+$01BC : STA.w PaletteBufferAux+$01BC
LDA.l PalettesCustom_off_black+$0E : STA.l PaletteBuffer+$01BE STA.w PaletteBuffer+$01BE : STA.w PaletteBufferAux+$01BE
.done .done
INC.b NMICGRAM INC.b NMICGRAM
SEP #$20 SEP #$20
STZ.w ItemReceiptMethod : LDA.w AncillaGet, X ; thing we wrote over to get here STZ.w ItemReceiptMethod : LDA.w AncillaGet, X ; thing we wrote over to get here
PLB
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -183,9 +183,9 @@ endmacro
%ReceiptProps($2B, -4, 0, $1E, $F35C, $FF, skip, bottles) ; 2B - Full bottle (red) %ReceiptProps($2B, -4, 0, $1E, $F35C, $FF, skip, bottles) ; 2B - Full bottle (red)
%ReceiptProps($2C, -4, 0, $1E, $F35C, $FF, skip, bottles) ; 2C - Full bottle (green) %ReceiptProps($2C, -4, 0, $1E, $F35C, $FF, skip, bottles) ; 2C - Full bottle (green)
%ReceiptProps($2D, -4, 0, $1E, $F35C, $FF, skip, bottles) ; 2D - Full bottle (blue) %ReceiptProps($2D, -4, 0, $1E, $F35C, $FF, skip, bottles) ; 2D - Full bottle (blue)
%ReceiptProps($2E, -4, 0, $1E, $F36D, $FF, skip, bottles) ; 2E - Potion refill (red) %ReceiptProps($2E, -4, 0, $1E, $F36D, $FF, skip, skip) ; 2E - Potion refill (red)
%ReceiptProps($2F, -4, 0, $1E, $F36E, $FF, skip, bottles) ; 2F - Potion refill (green) %ReceiptProps($2F, -4, 0, $1E, $F36E, $FF, skip, skip) ; 2F - Potion refill (green)
%ReceiptProps($30, -4, 0, $1E, $F36E, $FF, skip, bottles) ; 30 - Potion refill (blue) %ReceiptProps($30, -4, 0, $1E, $F36E, $FF, skip, skip) ; 30 - Potion refill (blue)
%ReceiptProps($31, -4, 0, $30, $F375, $FF, skip, skip) ; 31 - 10 bombs %ReceiptProps($31, -4, 0, $30, $F375, $FF, skip, skip) ; 31 - 10 bombs
%ReceiptProps($32, -4, 0, $22, $F366, $FF, dungeon_bigkey, skip) ; 32 - Big key %ReceiptProps($32, -4, 0, $22, $F366, $FF, dungeon_bigkey, skip) ; 32 - Big key
%ReceiptProps($33, -4, 0, $21, $F368, $FF, dungeon_map, skip) ; 33 - Map %ReceiptProps($33, -4, 0, $21, $F368, $FF, dungeon_map, skip) ; 33 - Map

View File

@@ -626,7 +626,12 @@ ItemBehavior:
.pendant .pendant
SEP #$20 SEP #$20
LDA.l PendantCounter : INC : STA.l PendantCounter LSR
SEC : SBC.b #$37
TAX
LDA.w PendantMasks,X : AND.l PendantsField : BNE +
LDA.l PendantCounter : INC : STA.l PendantCounter
+
RTS RTS
.dungeon_crystal .dungeon_crystal
@@ -645,9 +650,12 @@ ItemBehavior:
DEX DEX
BPL - BPL -
SEP #$20 SEP #$20
ORA.l CrystalsField : STA.l CrystalsField TAX
LDA.l CrystalCounter : INC : STA.l CrystalCounter AND.l CrystalsField : BNE +
TXA
ORA.l CrystalsField : STA.l CrystalsField
LDA.l CrystalCounter : INC : STA.l CrystalCounter
+
.done .done
RTS RTS
@@ -657,7 +665,7 @@ ResolveReceipt:
JSL.l PreItemGet JSL.l PreItemGet
LDA.w ItemReceiptID LDA.w ItemReceiptID
.get_item .get_item
JSR.w AttemptItemSubstitution JSL.l AttemptItemSubstitution
JSR.w HandleBowTracking JSR.w HandleBowTracking
JSR.w ResolveLootID JSR.w ResolveLootID
.have_item .have_item
@@ -1013,7 +1021,7 @@ AttemptItemSubstitution:
BRA - BRA -
.exit .exit
PLA : PLX PLA : PLX
RTS RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
CountBottles: CountBottles:
PHX PHX
@@ -1121,3 +1129,5 @@ dw $0004 ; EP
dw $0002 ; HC dw $0002 ; HC
dw $0000 ; Sewers dw $0000 ; Sewers
PendantMasks:
db $04, 01, 02

View File

@@ -129,17 +129,17 @@ SpritePrep_ShopKeeper:
++ ++
PLY : +++ PLY : +++
PHX : PHY PHX : PHY
PHX : TYX : LDA.l ShopInventory, X : PLX PHX : TYX : LDA.l ShopInventory, X : PLX
SEP #$10 SEP #$10
JSL.l ResolveLootIDLong JSL.l AttemptItemSubstitution
TAY JSL.l ResolveLootIDLong
REP #$30 TAY
LDA.b 1,s : TAX : LDA.l .tile_offsets, X : TAX REP #$30
JSR.w SetupTileTransfer LDA.b 1,s : TAX : LDA.l .tile_offsets, X : TAX
PLY : PLX JSR.w SetupTileTransfer
INY #4 PLY : PLX
INY #4
.next .next
INX #8 INX #8
JMP - JMP -
@@ -561,6 +561,7 @@ Shopkeeper_DrawNextItem:
PLY PLY
LDA.l ShopInventory, X ; get item id LDA.l ShopInventory, X ; get item id
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong JSL.l ResolveLootIDLong
STA.b Scrap0D STA.b Scrap0D
CMP.b #$2E : BNE + : BRA .potion CMP.b #$2E : BNE + : BRA .potion

View File

@@ -6,7 +6,7 @@
; out: A - Sprite GFX ID ; out: A - Sprite GFX ID
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
GetSpriteID: GetSpriteID:
JSR.w AttemptItemSubstitution JSL.l AttemptItemSubstitution
JSR.w ResolveLootID JSR.w ResolveLootID
CMP.b #$6D : BEQ .server_F0 ; Server Request F0 CMP.b #$6D : BEQ .server_F0 ; Server Request F0
CMP.b #$6E : BEQ .server_F1 ; Server Request F1 CMP.b #$6E : BEQ .server_F1 ; Server Request F1
@@ -32,7 +32,7 @@ RTL
; out: A - Palette ; out: A - Palette
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
GetSpritePalette: GetSpritePalette:
JSR AttemptItemSubstitution JSL.l AttemptItemSubstitution
JSR.w ResolveLootID JSR.w ResolveLootID
.resolved .resolved
TAX TAX
@@ -359,23 +359,43 @@ LoadItemPalette:
; Out: A - Sprite palette index ; Out: A - Sprite palette index
PHX : PHY : PHB PHX : PHY : PHB
LDA.b #PalettesVanillaBank>>16 : STA.b Scrap0C LDA.b #PalettesVanillaBank>>16 : STA.b Scrap0C
LDA.b #$7E PEA $7E00
PHA : PLB PLB : PLB
REP #$30 REP #$30
TXA : ASL : TAX TXA : ASL : TAX
LDA.l SpriteProperties_palette_addr,X : STA.b Scrap0A LDA.l SpriteProperties_palette_addr,X : STA.b Scrap0A
LDY.w #$000E LDY.w #$000E
LDA.w TransparencyFlag : BNE .SP05 LDA.l FadeTimer : BNE .aux
LDA.w TransparencyFlag : BNE .SP05
-
LDA.b [Scrap0A], Y
STA.w PaletteBuffer+$0170,Y
DEY #2
BPL -
LDA.w #$0003
BRA .done
.SP05
- -
LDA.b [Scrap0A], Y : STA.w PaletteBuffer+$0170,Y LDA.b [Scrap0A], Y
STA.w PaletteBuffer+$01B0,Y
DEY #2
BPL -
LDA.w #$0005
BRA .done
.aux
LDA.w TransparencyFlag : BNE .SP05_aux
-
LDA.b [Scrap0A], Y
STA.w PaletteBufferAux+$0170,Y
DEY #2 DEY #2
BPL - BPL -
LDA.w #$0003 LDA.w #$0003
BRA .done BRA .done
.SP05 .SP05_aux
- -
LDA.b [Scrap0A], Y : STA.w PaletteBuffer+$01B0,Y LDA.b [Scrap0A], Y
STA.w PaletteBufferAux+$01B0,Y
DEY #2 DEY #2
BPL - BPL -
LDA.w #$0005 LDA.w #$0005