Refactored Potion shop hooks to allow old behaviors
This commit is contained in:
28
hooks.asm
28
hooks.asm
@@ -1189,11 +1189,14 @@ JSL.l DrawMushroom
|
|||||||
org $05EE97 ; <- 2EE97 - sprite_mushroom.asm : 81
|
org $05EE97 ; <- 2EE97 - sprite_mushroom.asm : 81
|
||||||
NOP #14
|
NOP #14
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
org $05F529 ; <- 2F52C - sprite_potion_shop.asm
|
org $06C09C ; <- - bank06.asm : 1885 (JSL SpritePrep_PotionShopLong)
|
||||||
JSL SpritePrep_ShopKeeper
|
JSL SpritePrep_ShopKeeper_PotionShop
|
||||||
LDX #$0
|
|
||||||
JSR $F539 ; <- powder spawn here
|
org $05F521
|
||||||
RTS
|
SpritePrep_PotionShopLong:
|
||||||
|
|
||||||
|
org $05F539
|
||||||
|
SpawnMagicPowder:
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
org $05F568 ; <- 2F568 - sprite_potion_shop.asm
|
org $05F568 ; <- 2F568 - sprite_potion_shop.asm
|
||||||
LDA #$b0 : STA $0D00, Y : LDA #$90 : STA $0D10, Y ; manually set position of powder item
|
LDA #$b0 : STA $0D00, Y : LDA #$90 : STA $0D10, Y ; manually set position of powder item
|
||||||
@@ -1201,12 +1204,15 @@ LDA #$21 : STA $0D20, Y : LDA #$12 : STA $0D30, Y
|
|||||||
JMP $F61D
|
JMP $F61D
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
org $05F633 ; <- 2F633 - sprite_potion_shop.asm
|
org $05F633 ; <- 2F633 - sprite_potion_shop.asm
|
||||||
LDA $0E80, X : BNE +
|
JSL Sprite_ShopKeeperPotion : RTS : NOP ;; TODO: i don't remember prices being set on top of the player
|
||||||
JSL Sprite_ShopKeeperPotion ;; TODO: i don't remember prices being set on top of the player
|
PotionShopkeeperJumpTable:
|
||||||
JSR $F893 ; <- witch behavior here
|
|
||||||
RTS : +
|
org $05F893 ; <- witch behavior here
|
||||||
JSR $F644 ; <- powder behavior here
|
Sprite_WitchAssistant:
|
||||||
RTS
|
|
||||||
|
org $05F644 ; <- powder behavior here
|
||||||
|
Sprite_MagicPowderItem:
|
||||||
|
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
org $05EB1D ; <- 2EB1D - sprite_bottle_vendor.asm : 158
|
org $05EB1D ; <- 2EB1D - sprite_bottle_vendor.asm : 158
|
||||||
JSL.l Multiworld_BottleVendor_GiveBottle
|
JSL.l Multiworld_BottleVendor_GiveBottle
|
||||||
|
|||||||
@@ -989,7 +989,6 @@ RTL
|
|||||||
!REDRAW = "$7F5000"
|
!REDRAW = "$7F5000"
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
DrawPowder:
|
DrawPowder:
|
||||||
; this fights with the shopkeep code, so had to move the powder draw there
|
|
||||||
LDA $02DA : BNE .defer ; defer if link is buying a potion
|
LDA $02DA : BNE .defer ; defer if link is buying a potion
|
||||||
LDA.l !REDRAW : BEQ +
|
LDA.l !REDRAW : BEQ +
|
||||||
LDA.l WitchItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
|
LDA.l WitchItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
|
||||||
@@ -998,8 +997,10 @@ DrawPowder:
|
|||||||
LDA #$00 : STA.l !REDRAW ; reset redraw flag
|
LDA #$00 : STA.l !REDRAW ; reset redraw flag
|
||||||
BRA .defer
|
BRA .defer
|
||||||
+
|
+
|
||||||
; LDA $0DA0, X ; Retrieve stored item type
|
; this fights with the shopkeep code, so had to move the powder draw there when potion shop is custom
|
||||||
; JSL.l DrawDynamicTile
|
LDA !SHOP_TYPE : CMP.b #$FF : BNE .defer
|
||||||
|
LDA $0DA0, X ; Retrieve stored item type
|
||||||
|
JSL.l DrawDynamicTile
|
||||||
.defer
|
.defer
|
||||||
RTL
|
RTL
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -128,6 +128,19 @@ dw $0230, $0231, $0202, $0203, $0212, $0213, $0222, $0223, $0232, $0233
|
|||||||
.digit_offsets
|
.digit_offsets
|
||||||
dw 4, 0, -4, -8
|
dw 4, 0, -4, -8
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
|
SpritePrep_ShopKeeper_PotionShop:
|
||||||
|
JSL SpritePrep_ShopKeeper
|
||||||
|
LDA.l !SHOP_TYPE : CMP.b #$FF : BNE +
|
||||||
|
JSL SpritePrep_PotionShopLong
|
||||||
|
RTL
|
||||||
|
+ LDX #$0
|
||||||
|
PHK : PEA.w .jslrtsreturn-1
|
||||||
|
PEA.w $05f527 ; an rtl address - 1 in Bank05
|
||||||
|
JML SpawnMagicPowder
|
||||||
|
.jslrtsreturn
|
||||||
|
RTL
|
||||||
|
|
||||||
|
|
||||||
SpritePrep_ShopKeeper:
|
SpritePrep_ShopKeeper:
|
||||||
PHX : PHY : PHP
|
PHX : PHY : PHP
|
||||||
|
|
||||||
@@ -252,7 +265,9 @@ SpritePrep_ShopKeeper:
|
|||||||
PLP : PLY : PLX
|
PLP : PLY : PLX
|
||||||
|
|
||||||
LDA.l !SHOP_TYPE : CMP.b #$FF : BNE +
|
LDA.l !SHOP_TYPE : CMP.b #$FF : BNE +
|
||||||
PLA : PLA : PLA
|
LDA $A0 : CMP.b #$09 : BNE ++
|
||||||
|
RTL
|
||||||
|
++ PLA : PLA : PLA
|
||||||
INC $0BA0, X
|
INC $0BA0, X
|
||||||
LDA $0E40, X
|
LDA $0E40, X
|
||||||
JML.l ShopkeeperFinishInit
|
JML.l ShopkeeperFinishInit
|
||||||
@@ -381,6 +396,16 @@ Shopkeeper_UploadVRAMTiles:
|
|||||||
PLA : STA $4301 ; restore DMA parameters
|
PLA : STA $4301 ; restore DMA parameters
|
||||||
PLA : STA $4300 ; restore DMA parameters
|
PLA : STA $4300 ; restore DMA parameters
|
||||||
RTS
|
RTS
|
||||||
|
;--------------------------------------------------------------------------------
|
||||||
|
ShopkepeerPotion_CallOriginal:
|
||||||
|
PLA : PLA : PLA
|
||||||
|
LDA.b #PotionShopkeeperJumpTable>>16 : PHA
|
||||||
|
LDA.b #PotionShopkeeperJumpTable>>8 : PHA
|
||||||
|
LDA.b #PotionShopkeeperJumpTable : PHA
|
||||||
|
LDA $0E80, X
|
||||||
|
JML.l UseImplicitRegIndexedLocalJumpTable
|
||||||
|
;--------------------------------------------------------------------------------
|
||||||
|
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
Shopkepeer_CallOriginal:
|
Shopkepeer_CallOriginal:
|
||||||
PLA : PLA : PLA
|
PLA : PLA : PLA
|
||||||
@@ -394,12 +419,28 @@ Shopkepeer_CallOriginal:
|
|||||||
;!SHOP_CAPACITY = "$7F5020"
|
;!SHOP_CAPACITY = "$7F5020"
|
||||||
;!SCRATCH_TEMP_X = "$7F5021"
|
;!SCRATCH_TEMP_X = "$7F5021"
|
||||||
Sprite_ShopKeeperPotion:
|
Sprite_ShopKeeperPotion:
|
||||||
|
LDA.l !SHOP_TYPE : CMP.b #$FF : BNE + : JMP.w ShopkepeerPotion_CallOriginal : +
|
||||||
|
TXA : BEQ +
|
||||||
|
PHK : PEA.w .jslrtsreturn2-1
|
||||||
|
PEA.w $05f527 ; an rtl address - 1 in Bank05
|
||||||
|
JML Sprite_MagicPowderItem
|
||||||
|
.jslrtsreturn2
|
||||||
|
RTL
|
||||||
|
+
|
||||||
|
|
||||||
PHB : PHK : PLB ;; we can just call the default shopkeeper but the potion shopkeeper refills your health
|
PHB : PHK : PLB ;; we can just call the default shopkeeper but the potion shopkeeper refills your health
|
||||||
LDA $A0 : CMP.b #$09 : BNE +
|
LDA $A0 : CMP.b #$09 : BNE +
|
||||||
JSR.w Shopkeeper_DrawItems
|
JSR.w Shopkeeper_DrawItems
|
||||||
JSR.w Shopkeeper_SetupHitboxes
|
JSR.w Shopkeeper_SetupHitboxes
|
||||||
+
|
+
|
||||||
PLB
|
PLB
|
||||||
|
|
||||||
|
LDA $0E80, X : BNE +
|
||||||
|
PHK : PEA.w .jslrtsreturn-1
|
||||||
|
PEA.w $05f527 ; an rtl address - 1 in Bank05
|
||||||
|
JML Sprite_WitchAssistant
|
||||||
|
.jslrtsreturn
|
||||||
|
+
|
||||||
RTL
|
RTL
|
||||||
|
|
||||||
Sprite_ShopKeeper:
|
Sprite_ShopKeeper:
|
||||||
|
|||||||
Reference in New Issue
Block a user