Fix for shops and powder

Fix for dungeon indicator
This commit is contained in:
aerinon
2023-08-28 11:32:46 -06:00
parent 09702e659d
commit b688149dfa
8 changed files with 29 additions and 28 deletions

View File

@@ -593,6 +593,7 @@ CompassBossIndicator:
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
TotalKeys: ;27f020
db $04, $04, $02, $04, $04, $06, $06, $06, $05, $06, $01, $03, $06, $08, $00, $00
skip $10
;ChestKeys: ;27f030 - moved to B0F010
;db $01, $01, $00, $01, $02, $01, $06, $03, $03, $02, $01, $01, $04, $04, $00, $00
BigKeyStatus: ;27f040 (status 2 indicate BnC guard)

View File

@@ -65,12 +65,12 @@ DRHUD_EnemyDropIndicator:
SEP #$10 : TAX : REP #$10
DRHUD_DrawCurrentDungeonIndicator: ; mX
LDA.l DRMode : AND.b #$02 : BEQ DRHUD_Finished
LDA.l DRMode : BIT.b #$02 : BEQ DRHUD_Finished
LDY.w #!BlankTile
LDA.w CurrentHealth : BEQ .draw_indicator
REP #$20 : LDA.l DungeonReminderTable,X : SEP #$20
TAY
REP #$20 : LDA.l DungeonReminderTable,X : TAY
SEP #$20
.draw_indicator
STY.w !CurrentDungeonIndicator

View File

@@ -1214,7 +1214,7 @@ SpritePrep_PotionShopLong:
org $85F539
SpawnMagicPowder:
;--------------------------------------------------------------------------------
org $05F568 ; <- 2F568 - sprite_potion_shop.asm
org $85F568 ; <- 2F568 - sprite_potion_shop.asm
LDA #$b0 : STA $0D00, Y : LDA #$90 : STA $0D10, Y ; manually set position of powder item
LDA #$21 : STA $0D20, Y : LDA #$12 : STA $0D30, Y
JMP $F61D

View File

@@ -533,13 +533,9 @@ LoadPowder:
%GetPossiblyEncryptedItem(WitchItem, SpriteItemValues)
JSL.l ResolveLootIDLong
STA.w SpriteID, Y
STA.l $7F505E
STA.l PowderFlag
TYX
JSL.l PrepDynamicTile_loot_resolved
LDA.b #$00
STA.l $7F505F
STA.l $7F5060
STA.l $7F5061
PLX
RTL
;--------------------------------------------------------------------------------
@@ -634,7 +630,7 @@ CollectPowder:
PLA
STZ.w ItemReceiptMethod ; item from NPC
JSL.l Link_ReceiveItem
PHA : LDA.b #$00 : STA.l ShopEnableCount : PLA
PHA : LDA.b #$00 : STA.l ShopEnableCount : STA.l PowderFlag : PLA
JSL.l ItemSet_Powder
RTL
;--------------------------------------------------------------------------------

View File

@@ -139,15 +139,14 @@ AddReceivedItemExpandedGetItem:
LDA.w ItemReceiptID
JSL.l FreeDungeonItemNotice
PHA : LDA !MULTIWORLD_ITEM_PLAYER_ID : BEQ +
PHA : LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BEQ +
PLA : BRA .done
+ PLA
JSR ItemBehavior
SEP #$30
PLB : PLX
STZ.w ShopPurchaseFlag
.done
PLB : PLX
LDA.w ItemReceiptMethod : CMP.b #$01 ; thing we wrote over
RTL

15
ram.asm
View File

@@ -520,11 +520,12 @@ ShopCapacity: skip 1 ; Four lower bits of shop_config in ShopTable
ShopScratch: skip 1 ; Scratch byte used in shop drawing routines
ShopSRAMIndex: skip 1 ; SRAM index for purchase counts
ShopMerchant: skip 1 ; Loaded from ShopTable and used to jump to one of four drawing routines
ShopInventoryPlayer: skip 1 ; Multiworld id for player inventory
ShopInventoryDisguise: skip 1 ; Bee trap is disguised as another item in shop
ShopPriceColumn: skip 3 ; Stores coordinates for drawing prices in shops
ShopkeeperRefill: skip 1 ; Flag for the shopkeeper refill action
skip 6 ; Unused
PowderFlag: skip 1 ; Flag for powder junk
ShopPriceColumn: skip 3 ; Stores coordinates for drawing prices in shops
ShopInventoryPlayer: skip 3 ; Multiworld id for player inventory
ShopInventoryDisguise: skip 3 ; Bee trap is disguised as another item in shop
skip 1 ; Unused
skip 2 ; Reserved for OneMind
OneMindId: skip 1 ; Current OneMind player
OneMindTimerRAM: skip 2 ; Frame counter for OneMind
@@ -924,10 +925,10 @@ endmacro
%assertRAM(ShopScratch, $7F5061)
%assertRAM(ShopSRAMIndex, $7F5062)
%assertRAM(ShopMerchant, $7F5063)
%assertRAM(ShopInventoryPlayer, $7F5064)
%assertRAM(ShopInventoryDisguise, $7F5065)
%assertRAM(ShopkeeperRefill, $7F5064)
%assertRAM(ShopPriceColumn, $7F5066)
%assertRAM(ShopkeeperRefill, $7F5069)
%assertRAM(ShopInventoryPlayer, $7F5069)
%assertRAM(ShopInventoryDisguise, $7F506C)
%assertRAM(OneMindId, $7F5072)
%assertRAM(OneMindTimerRAM, $7F5073)
%assertRAM(ClockStatus, $7F507E)

View File

@@ -465,7 +465,7 @@ Shopkeeper_BuyItem:
REP #$20 : LDA.l CurrentRupees : !SUB ShopInventory+1, X : STA.l CurrentRupees : SEP #$20 ; Take price away
++
PHX
LDA.b #0 : XBA : TXA : LSR #2 : TAX : LDA.l ShopInventory, X : STA.l !MULTIWORLD_ITEM_PLAYER_ID
LDA.b #0 : XBA : TXA : LSR #2 : TAX : LDA.l ShopInventoryPlayer, X : STA.l !MULTIWORLD_ITEM_PLAYER_ID
TXA : !ADD ShopSRAMIndex : TAX
LDA.l PurchaseCounts, X : BNE +++ ;Is this the first time buying this slot?
LDA.l EnableShopItemCount, X : STA.l ShopEnableCount ; If so, store the permission to count the item here.
@@ -620,7 +620,7 @@ Shopkeeper_DrawItems:
LDA $A0 : CMP.b #$09 : BNE + ; render powder slot if potion shop
LDA RedrawFlag : BNE + ; if not redrawing
LDA $02DA : BNE + ; if not buying item
LDA $7F505E : BEQ + ; if potion slot filled
LDA PowderFlag : BEQ + ; if potion slot filled
LDA $0ABF : BEQ + ; haven't left the room
LDA NpcFlags+1 : AND.b #$20 : BNE +
LDX.b #$0C : LDY.b #$03 : JSR.w Shopkeeper_DrawNextItem
@@ -650,8 +650,10 @@ Shopkeeper_DrawNextItem:
PLY
PHX : LDA.b #0 : XBA : TXA : LSR #2 : TAX : LDA.l ShopInventoryDisguise, X : PLX : CMP.b #$0 : BNE ++
LDA.l ShopInventory, X ; get item id
JSL.l ResolveLootIDLong
CPX.b #$0C : BCC .not_powder
LDA.l PowderFlag : BRA .resolve
.not_powder LDA.l ShopInventory, X ; get item id
.resolve JSL.l ResolveLootIDLong
STA.b Scrap0D
++
CMP.b #$2E : BNE + : BRA .potion
@@ -675,8 +677,10 @@ Shopkeeper_DrawNextItem:
LDA.b Scrap0D
++
PHX
JSL.l GetSpritePalette_resolved : STA.l SpriteOAM+5
PLX
JSL.l GetSpritePalette_resolved
PLX : CPX.b #$0C : BCC + ; if this is powder item
ORA.b #$01
+ STA.l SpriteOAM+5
LDA.b #$00 : STA.l SpriteOAM+6
@@ -740,7 +744,7 @@ dw 8, -72
.potion_offset
dw -16, 0
.tile_indices
db $C6, $C8, $CA, $25 ; last bit is for sheet change
db $C6, $C8, $CA, $24 ; last bit is for sheet change
;--------------------------------------------------------------------------------
Shopkeeper_DrawNextPrice:
PHB : PHK : PLB