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:
LDA.b #$00 : STA.l RedrawFlag
JSR LoadBonkItem
JSL.l ResolveLootIDLong
STA.w SpriteItemType, X
STA.w SpriteID, X
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
;--------------------------------------------------------------------------------
DrawBonkItemGFX:
@@ -42,7 +50,7 @@ DrawBonkItemGFX:
BRA .done ; don't draw on the init frame
.skipInit
JSR LoadBonkItem
LDA.w SpriteID,X
JSL.l DrawDynamicTileNoShadow
.done

View File

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

View File

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

View File

@@ -183,9 +183,9 @@ endmacro
%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($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($2F, -4, 0, $1E, $F36E, $FF, skip, bottles) ; 2F - Potion refill (green)
%ReceiptProps($30, -4, 0, $1E, $F36E, $FF, skip, bottles) ; 30 - Potion refill (blue)
%ReceiptProps($2E, -4, 0, $1E, $F36D, $FF, skip, skip) ; 2E - Potion refill (red)
%ReceiptProps($2F, -4, 0, $1E, $F36E, $FF, skip, skip) ; 2F - Potion refill (green)
%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($32, -4, 0, $22, $F366, $FF, dungeon_bigkey, skip) ; 32 - Big key
%ReceiptProps($33, -4, 0, $21, $F368, $FF, dungeon_map, skip) ; 33 - Map

View File

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

View File

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

View File

@@ -6,7 +6,7 @@
; out: A - Sprite GFX ID
;--------------------------------------------------------------------------------
GetSpriteID:
JSR.w AttemptItemSubstitution
JSL.l AttemptItemSubstitution
JSR.w ResolveLootID
CMP.b #$6D : BEQ .server_F0 ; Server Request F0
CMP.b #$6E : BEQ .server_F1 ; Server Request F1
@@ -32,7 +32,7 @@ RTL
; out: A - Palette
;--------------------------------------------------------------------------------
GetSpritePalette:
JSR AttemptItemSubstitution
JSL.l AttemptItemSubstitution
JSR.w ResolveLootID
.resolved
TAX
@@ -359,23 +359,43 @@ LoadItemPalette:
; Out: A - Sprite palette index
PHX : PHY : PHB
LDA.b #PalettesVanillaBank>>16 : STA.b Scrap0C
LDA.b #$7E
PHA : PLB
PEA $7E00
PLB : PLB
REP #$30
TXA : ASL : TAX
LDA.l SpriteProperties_palette_addr,X : STA.b Scrap0A
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
BPL -
LDA.w #$0003
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
BPL -
LDA.w #$0005