Merge remote-tracking branch 'baserom/master' into MergeDecompression

# Conflicts:
#	events.asm
#	newitems.asm
#	shopkeeper.asm
#	tables.asm

Plus attempt to update standing items
This commit is contained in:
aerinon
2023-08-28 12:01:57 -06:00
20 changed files with 184 additions and 116 deletions

View File

@@ -120,8 +120,8 @@ SpritePrep_ShopKeeper:
LDX.w #$0000
LDY.w #$0000
-
TYA : CMP.l ShopCapacity : !BLT ++ : JMP .stop : ++
LDA.l ShopContentsTable+1, X : CMP.b #$FF : BNE ++ : JMP .stop : ++
TYA : CMP.l ShopCapacity : !BLT ++ : JMP .done : ++
LDA.l ShopContentsTable+1, X : CMP.b #$FF : BNE ++ : JMP .done : ++
LDA.l ShopContentsTable, X : CMP.l ShopId : BEQ ++ : JMP .next : ++
LDA.l ShopContentsTable+1, X : PHX : TYX : STA.l ShopInventory, X : PLX
@@ -150,35 +150,29 @@ SpritePrep_ShopKeeper:
++
PLY : +++
PHX : PHY
PHX : PHY
PHX : TYX : LDA.l ShopInventory, X : PLX
SEP #$10
JSL.l ResolveLootIDLong
; todo: bee trap id
CMP.b #$C0 : BNE +
PHX : LDA.b #0 : XBA : TYA : LSR #2 : TAX ; This will convert the value back to the slot number (in 8-bit accumulator mode)
SEP #$10
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
; todo: bee trap id
CMP.b #$C0 : BNE +
PHX : LDA.b #0 : XBA : TYA : LSR #2 : TAX ; This will convert the value back to the slot number (in 8-bit accumulator mode)
JSL GetRandomInt : AND.b #$3F
BNE ++ : LDA.b #$49 : ++ : CMP.b #$26 : BNE ++ : LDA.b #$6A : ++ ; if 0 (fighter's sword + shield), set to just sword, if filled container (bugged palette), switch to triforce piece
STA.l ShopInventoryDisguise, X : PLX
+ : TAY
REP #$30
+ : TAY
REP #$30
LDA.b 1,s : TAX : LDA.l .tile_offsets, X : TAX
JSR.w SetupTileTransfer
PLY : PLX
INY #4
PLY : PLX
INY #4
.next
INX #9
JMP -
.stop
REP #$20
LDA.w ItemQueuePtr
DEC #2
AND.w #$00E
STA.w ItemQueuePtr
SEP #$20
.done
SEP #$20
LDA.l ShopType : BIT.b #$20 : BEQ .notTakeAll ; Take-all
.takeAll
@@ -227,19 +221,19 @@ SetupTileTransfer:
TXA : LSR #2
CLC : ADC.w #!FREE_TILE_ALT
.store_target
LDX.w ItemQueuePtr
STA.w ItemTargetQueue,X
LDX.w ItemStackPtr
STA.l ItemTargetStack,X
TYA : ASL : TAX
LDA.l StandingItemGraphicsOffsets,X
LDX.w ItemQueuePtr
STA.w ItemGFXQueue,X
LDX.w ItemStackPtr
STA.l ItemGFXStack,X
TXA
INC #2
AND.w #$000E
STA.w ItemQueuePtr
TDC
STA.l ItemStackPtr
LDA.w #$0000
REP #$10 ; set 16-bit index registers
SEP #$20
RTS
@@ -653,7 +647,9 @@ Shopkeeper_DrawNextItem:
CPX.b #$0C : BCC .not_powder
LDA.l PowderFlag : BRA .resolve
.not_powder LDA.l ShopInventory, X ; get item id
.resolve JSL.l ResolveLootIDLong
.resolve
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
STA.b Scrap0D
++
CMP.b #$2E : BNE + : BRA .potion