More fixes

This commit is contained in:
cassidoxa
2023-08-02 15:39:03 -04:00
parent ddfb8eed0f
commit d446bd3c1b
9 changed files with 71 additions and 59 deletions

View File

@@ -4,19 +4,19 @@
LoadLibraryItemGFX:
%GetPossiblyEncryptedItem(LibraryItem, SpriteItemValues)
JSL.l ResolveLootIDLong
STA.w SpriteItemType, X
STA.w SpriteID, X
JSL.l PrepDynamicTile_loot_resolved
RTL
;--------------------------------------------------------------------------------
DrawLibraryItemGFX:
PHA
LDA.w SpriteItemType, X
LDA.w SpriteID, X
JSL.l DrawDynamicTile
PLA
RTL
;--------------------------------------------------------------------------------
SetLibraryItem:
LDY.w SpriteItemType, X
LDY.w SpriteID, X
JSL.l ItemSet_Library ; contains thing we wrote over
RTL
;--------------------------------------------------------------------------------
@@ -31,6 +31,7 @@ LoadBonkItemGFX_inner:
LDA.b #$00 : STA.l RedrawFlag
JSR LoadBonkItem
STA.w SpriteItemType, X
STA.w SpriteID, X
JSL.l PrepDynamicTile
RTL
;--------------------------------------------------------------------------------

View File

@@ -3,7 +3,7 @@
;--------------------------------------------------------------------------------
HeartPieceGet:
PHX : PHY
LDY.w SpriteItemType, X ; load item value into Y register
LDY.w SpriteID, X ; load item value into Y register
BNE +
JSL.l LoadHeartPieceRoomValue : TAY
+
@@ -23,7 +23,7 @@ RTL
HeartContainerGet:
PHX : PHY
JSL.l IncrementBossSword
LDY.w SpriteItemType, X : BNE +
LDY.w SpriteID, X : BNE +
JSL.l LoadHeartContainerRoomValue : TAY
+
BRA HeartPieceGet_skipLoad
@@ -36,7 +36,7 @@ DrawHeartPieceGFX:
JSL.l HeartPieceSpritePrep
JMP .done ; don't draw on the init frame
.skipInit
LDA.w SpriteItemType, X ; Retrieve stored item type
LDA.w SpriteID, X ; Retrieve stored item type
.skipLoad
PHA : PHX
TAX
@@ -66,7 +66,7 @@ DrawHeartContainerGFX:
BRA DrawHeartPieceGFX_done ; don't draw on the init frame
.skipInit
LDA.w SpriteItemType, X ; Retrieve stored item type
LDA.w SpriteID, X ; Retrieve stored item type
BRA DrawHeartPieceGFX_skipLoad
;--------------------------------------------------------------------------------
@@ -110,7 +110,7 @@ HeartPieceSpritePrep:
LDA.b #$00 : STA.l RedrawFlag
JSL.l LoadHeartPieceRoomValue
JSL.l ResolveLootIDLong
STA.w SpriteItemType, X
STA.w SpriteID, X
JSL.l PrepDynamicTile_loot_resolved
.skip
@@ -123,7 +123,7 @@ HeartContainerSpritePrep:
LDA.b #$00 : STA.l RedrawFlag
JSL.l LoadHeartContainerRoomValue ; load item type
JSL.l ResolveLootIDLong
STA.w SpriteItemType, X ; Store item type
STA.w SpriteID, X
JSL.l PrepDynamicTile_loot_resolved
PLA

View File

@@ -490,10 +490,14 @@ RTL
; LoadPowder:
;--------------------------------------------------------------------------------
LoadPowder:
PHX
JSL.l Sprite_SpawnDynamically ; thing we wrote over
%GetPossiblyEncryptedItem(WitchItem, SpriteItemValues)
STA.w SpriteAuxTable, Y ; Store item type
JSL.l PrepDynamicTile
JSL.l ResolveLootIDLong
STA.w SpriteID, Y
TYX
JSL.l PrepDynamicTile_loot_resolved
PLX
RTL
;--------------------------------------------------------------------------------
@@ -516,12 +520,12 @@ RTL
DrawPowder:
LDA.w ItemReceiptPose : BNE .defer ; defer if link is buying a potion
LDA.l RedrawFlag : BEQ +
LDA.w SpriteAuxTable, X ; Retrieve stored item type
JSL.l PrepDynamicTile
; LDA.w SpriteAuxTable, X ; Retrieve stored item type
JSL.l PrepDynamicTile_loot_resolved
LDA.b #$00 : STA.l RedrawFlag ; reset redraw flag
BRA .defer
+
LDA.w SpriteAuxTable, X ; Retrieve stored item type
LDA.w SpriteID, X ; Retrieve stored item type
JSL.l DrawDynamicTile
.defer
RTL
@@ -541,7 +545,7 @@ LoadMushroom:
LDA.b #$00 : STA.l RedrawFlag
%GetPossiblyEncryptedItem(MushroomItem, SpriteItemValues)
STA.w SpriteItemType, X ; Store item type
STA.w SpriteID,X
JSL.l PrepDynamicTile
.skip
@@ -559,7 +563,7 @@ DrawMushroom:
BRA .done ; don't draw on the init frame
.skipInit
LDA.w SpriteItemType, X ; Retrieve stored item type
LDA.w SpriteID, X ; Retrieve stored item type
JSL.l DrawDynamicTile
.done
@@ -571,7 +575,7 @@ RTL
; CollectPowder:
;--------------------------------------------------------------------------------
CollectPowder:
LDY.w SpriteAuxTable, X ; Retrieve stored item type
LDY.w SpriteID, X ; Retrieve stored item type
BNE +
; if for any reason the item value is 0 reload it, just in case
%GetPossiblyEncryptedItem(WitchItem, SpriteItemValues) : TAY

View File

@@ -42,7 +42,7 @@ endmacro
%ReceiptProps($10, -4, 0, $1A, $F348, $01, skip, skip) ; 10 - Ether
%ReceiptProps($11, -4, 0, $1C, $F349, $01, skip, skip) ; 11 - Quake
%ReceiptProps($12, -4, 0, $14, $F34A, $01, skip, skip) ; 12 - Lamp
%ReceiptProps($13, -4, 4, $19, $F34C, $01, skip, skip) ; 13 - Shovel
%ReceiptProps($13, -4, 4, $19, $F34C, $01, shovel, skip) ; 13 - Shovel
%ReceiptProps($14, -4, 0, $0C, $F34C, $02, flute_inactive, skip) ; 14 - Flute
%ReceiptProps($15, -4, 4, $07, $F350, $01, skip, skip) ; 15 - Somaria
%ReceiptProps($16, -4, 0, $1D, $F35C, $FF, skip, bottles) ; 16 - Bottle
@@ -102,7 +102,7 @@ endmacro
%ReceiptProps($4C, -4, 0, $39, $F375, $32, bombs_50, skip) ; 4C - Bomb capacity (50)
%ReceiptProps($4D, -4, 0, $3A, $F376, $46, arrows_70, skip) ; 4D - Arrow capacity (70)
%ReceiptProps($4E, -4, 0, $3B, $F373, $80, magic_2, magic) ; 4E - 1/2 magic
%ReceiptProps($4F, -4, 0, $3C, $F373, $80, magic_4, magic) ; 4F - 1/4 magic
%ReceiptProps($4F, -4, 0, $3C, $F373, $80, magic_4, skip) ; 4F - 1/4 magic
%ReceiptProps($50, -5, 4, $18, $F359, $02, master_sword_safe, skip) ; 50 - Safe master sword
%ReceiptProps($51, -4, 0, $42, $F375, $FF, bombs_5, skip) ; 51 - Bomb capacity (+5)
%ReceiptProps($52, -4, 0, $3E, $F375, $FF, bombs_10, skip) ; 52 - Bomb capacity (+10)
@@ -306,9 +306,9 @@ endmacro
%SpriteProps($01, 0, 2, $05, $05, PalettesCustom_master_sword) ; 01 - Master sword
%SpriteProps($02, 0, 2, $05, $01, PalettesCustom_tempered_sword) ; 02 - Tempered sword
%SpriteProps($03, 0, 2, $05, $05, PalettesCustom_golden_sword) ; 03 - Golden sword
%SpriteProps($04, 0, 0, $05, $80, PalettesCustom_fighter_shield) ; 04 - Fighter shield
%SpriteProps($05, 2, 2, $05, $80, PalettesCustom_red_shield) ; 05 - Fire shield
%SpriteProps($06, 2, 2, $05, $80, PalettesCustom_mirror_shield) ; 06 - Mirror shield
%SpriteProps($04, 0, 0, $80, $80, PalettesCustom_fighter_shield) ; 04 - Fighter shield
%SpriteProps($05, 2, 2, $80, $80, PalettesCustom_red_shield) ; 05 - Fire shield
%SpriteProps($06, 2, 2, $80, $80, PalettesCustom_mirror_shield) ; 06 - Mirror shield
%SpriteProps($07, 0, 0, $01, $01, PalettesVanilla_red_melon+$0E) ; 07 - Fire rod
%SpriteProps($08, 0, 0, $02, $02, PalettesVanilla_blue_ice+$0E) ; 08 - Ice rod
%SpriteProps($09, 0, 0, $01, $01, PalettesVanilla_red_melon+$0E) ; 09 - Hammer

View File

@@ -175,6 +175,9 @@ ItemBehavior:
LDA.l InventoryTracking : ORA.b #$01
BRA .store_inventory_tracking
.shovel
LDA.l InventoryTracking : ORA.b #$04
.store_inventory_tracking
STA.l InventoryTracking
RTS
@@ -598,7 +601,9 @@ ResolveReceipt:
RTS
ResolveLootIDLong:
PHY
JSR.w ResolveLootID
PLY
RTL
ResolveLootID:

View File

@@ -52,18 +52,16 @@ RTL
ItemCheck_TreeKid2:
LDA.l NpcFlags : AND.b #$08 : CMP.b #$08 ; FluteAardvark_InitialStateFromFluteState - 225: LDA FluteEquipment : AND.b #$03
TDC ; ?? TODO
RTL
ItemCheck_TreeKid3:
JSL $8DD030 ; FluteAardvark_Draw - thing we wrote over
LDA.l NpcFlags : AND.b #$08
BNE .done
LDA.b #$05
.normal
LDA.w SpriteActivity, X
.done
RTL
@@ -135,7 +133,7 @@ RTL
ItemSet_Mushroom:
PHA
LDA.l NpcFlags+1 : ORA.b #$10 : STA.l NpcFlags+1
LDY.w SpriteItemType, X ; Retrieve stored item type
LDY.w SpriteID, X ; Retrieve stored item type
BNE +
; if for any reason the item value is 0 reload it, just in case
%GetPossiblyEncryptedItem(MushroomItem, SpriteItemValues) : TAY
@@ -189,7 +187,10 @@ JumpToSplashItemTarget:
;--------------------------------------------------------------------------------
LoadCatfishItemGFX:
LDA.l $9DE185 ; location randomizer writes catfish item to
JML PrepDynamicTile
JSL.l ResolveLootIDLong
STA.w SpriteID, Y
TYX
JML.l PrepDynamicTile_loot_resolved
;--------------------------------------------------------------------------------
DrawThrownItem:
LDA.b OverworldIndex : CMP.b #$81 : BNE .catfish
@@ -200,6 +201,7 @@ DrawThrownItem:
.catfish
LDA.l $9DE185 ; location randomizer writes catfish item to
.draw
LDA.w SpriteID,X
JML DrawDynamicTile
;--------------------------------------------------------------------------------
MarkThrownItem:

View File

@@ -186,7 +186,8 @@ RaceGameFlag = $7E021B ;
;
MessageJunk = $7E0223 ; Zeroed but never used (?)
;
CoolScratch = $7E0224 ; 0x5C bytes of free ram
;CoolScratch = $7E0224 ; 0x5C bytes of free ram
SpriteID = $7E0230 ;
;
ItemReceiptID = $7E02D8 ;
ItemReceiptPose = $7E02DA ; $00 = No pose | $01 = One hand up | $02 = Two hands up
@@ -329,7 +330,7 @@ SpriteOAMProperties = $7E0E40 ; h m w o o o o o | h = Harmless | m = m
SpriteHitPoints = $7E0E50 ; Set from $0DB173
SpriteControl = $7E0E60 ; n i o s p p p t | n = Death animation? | i = Immune to attack/collion?
; o = Shadow | p = OAM prop palette | t = OAM prop name table
SpriteItemType = $7E0E80 ; Sprite Item Type. $10 bytes.
SpriteItemType = $7E0E80 ; Sprite Item Type. Also used for jump table local. $10 bytes.
;
SpriteSpawnStep = $7E0ED0 ; Related to enemies spawning other sprites (eg pikit, zirro)
;

View File

@@ -31,22 +31,19 @@ RTS
SpawnTabletItem:
JSL.l LoadOutdoorValue
JSL.l ResolveLootIDLong
STA.w SpriteItemType, Y
PHA
LDA.b #$EB : STA.l MiniGameTime
JSL Sprite_SpawnDynamically
PLA
STA.w SpriteID,Y
TYX
JSL.l PrepDynamicTile_loot_resolved
LDA.b #$EB
STA.l MiniGameTime
JSL Sprite_SpawnDynamically
LDA.w SpriteItemType, Y ; Store item type
LDA.b LinkPosX : STA.w SpritePosXLow, Y
LDA.b LinkPosX+1 : STA.w SpritePosXHigh, Y
LDA.b LinkPosY : STA.w SpritePosYLow, Y
LDA.b LinkPosY+1 : STA.w SpritePosYHigh, Y
LDA.b #$00 : STA.w SpriteLayer, Y
LDA.b #$7F : STA.w SpriteZCoord, Y ; spawn WAY up high
RTL
;--------------------------------------------------------------------------------

View File

@@ -46,35 +46,36 @@ RTL
;--------------------------------------------------------------------------------
; PrepDynamicTile
; in: A - Loot ID
; in: SpriteID,X - Loot ID
;-------------------------------------------------------------------------------- 20/8477
PrepDynamicTile:
PHA : PHX : PHY : PHB
PHX : PHY : PHB
JSR.w ResolveLootID
-
JSR.w LoadDynamicTileOAMTable
JSL TransferItemReceiptToBuffer_using_ReceiptID
SEP #$30
PLB : PLY : PLX : PLA
PLB : PLY : PLX
RTL
.loot_resolved
PHA : PHX : PHY : PHB
PHX : PHY : PHB
BRA -
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
; LoadDynamicTileOAMTable
; in: A - Loot ID
; in: SpriteID,X - Loot ID
; out: A - Loot ID
;-------------------------------------------------------------------------------- 20/847B
LoadDynamicTileOAMTable:
PHA : PHP
PHP
REP #$20
LDA.w #$0000 : STA.l SpriteOAM : STA.l SpriteOAM+2
LDA.w #$0200 : STA.l SpriteOAM+6
SEP #$20
LDA.b #$24 : STA.l SpriteOAM+4
LDA.w SpriteItemType,X
LDA.w SpriteID,X
JSL.l GetSpritePalette_resolved
STA.l SpriteOAM+5 : STA.l SpriteOAM+13
PHX
@@ -88,8 +89,9 @@ LoadDynamicTileOAMTable:
LDA.w #$3400 : STA.l SpriteOAM+11
.done
TXA
PLX
PLP : PLA
PLP
RTS
;--------------------------------------------------------------------------------