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

# Conflicts:
#	LTTP_RND_GeneralBugfixes.asm
#	inventory.asm
#	itemdatatables.asm
#	newitems.asm
This commit is contained in:
aerinon
2023-09-07 12:21:22 -06:00
19 changed files with 579 additions and 691 deletions

View File

@@ -149,40 +149,46 @@ AddInventory:
LDA.b #$7E : STA.b Scrap0D
LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BNE .countDungeonChecks
LDA.l StatsLocked : BNE .done
LDA.w InventoryTable_properties,Y : BIT #$01 : BEQ .done
JSR.w ShopCheck : BCS .done
.countDungeonChecks
JSR.w DungeonIncrement : BCS .done
LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BNE .totalCount
JSR.w IncrementByOne
JSR.w StampItem
REP #$30
TYA : AND.w #$00FF : ASL : TAX
SEP #$20
JSR.w IncrementYAItems
.totalCount
LDA.l !MULTIWORLD_RECEIVING_ITEM : BNE .done
REP #$20
LDA.l TotalItemCounter : INC : TAY
LDA.l BootsEquipment : BNE +
TYA : STA.l PreBootsLocations
+
LDA.l MirrorEquipment : BNE +
TYA : STA.l PreMirrorLocations
+
LDA.l FluteEquipment : BNE +
TYA : STA.l PreFluteLocations
+
TYA
STA.l TotalItemCounter
LDA.w InventoryTable_properties,X : BIT.b #$01 : BEQ .done
JSR.w ShopCheck : BCS .done
.countDungeonChecks
JSR.w DungeonIncrement : BCS .done
LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BNE .totalCount
JSR.w IncrementByOne
JSR.w StampItem
SEP #$20
JSR.w IncrementYAItems
.totalCount
LDA.l !MULTIWORLD_RECEIVING_ITEM : BNE .done
REP #$20
LDA.l TotalItemCounter : INC : TAY
LDA.l BootsEquipment : BNE +
TYA : STA.l PreBootsLocations
+
LDA.l MirrorEquipment : BNE +
TYA : STA.l PreMirrorLocations
+
LDA.l FluteEquipment : BNE +
TYA : STA.l PreFluteLocations
+
TYA
STA.l TotalItemCounter
.done
SEP #$30
PLB : PLP : PLY : PLX : PLA
RTL
ShopCheck:
; In: X - Receipt ID << 1
; TODO: If we write all shops, we can use the ShopPurchase flag instead of this
PHX
LDA.b IndoorsFlag : BEQ .count
LDA.w ItemReceiptMethod : CMP.b #$01 : BEQ .count
LDA.l ShopEnableCount : BNE .count
LDA.w InventoryTable_properties,Y : BIT.b #$02 : BNE .count
LDA.w InventoryTable_properties,X : BIT.b #$02 : BNE .count
REP #$20
LDA.b RoomIndex
CMP.w #274 : BEQ .nocount ; dark world death mountain shop, ornamental shield shop
@@ -201,16 +207,21 @@ ShopCheck:
SEP #$20
.count
CLC
PLX
RTS
.nocount
SEP #$21
PLX
RTS
DungeonIncrement:
LDA.l !MULTIWORLD_RECEIVING_ITEM : BNE .done
LDA.w InventoryTable_properties,Y : BIT.b #$40 : BEQ +
; In: X - Receipt ID << 1
PHX
LDA.l !MULTIWORLD_RECEIVING_ITEM : BNE .done
LDA.w InventoryTable_properties,X : BIT.b #$40 : BEQ +
JSL.l CountChestKeyLong
+
SEP #$10
LDA.b IndoorsFlag : BEQ .done
LDA.w DungeonID : BMI .done
CMP.l BallNChainDungeon : BNE +
@@ -218,71 +229,76 @@ DungeonIncrement:
+
CMP.b #$00 : BNE +
INC #2
+ TAX : REP #$20 : LDA.l DungeonLocationsChecked, X : INC : STA.l DungeonLocationsChecked, X : SEP #$20
TAX : REP #$20 : LDA.l DungeonLocationsChecked, X : INC : STA.l DungeonLocationsChecked, X : SEP #$20
CPX.b #$0D : BNE +
LDA.l BigKeyField : BIT.b #$04 : BNE ++
LDA.l PreGTBKLocations : INC : STA.l PreGTBKLocations
++
+
.done
CLC
REP #$11
PLX
RTS
.ballchain_bigkey
LDA.l BigKeysBigChests
CLC : ADC.b #$10
STA.l BigKeysBigChests
REP #$10
PLX
SEC
RTS
StampItem:
REP #$30
TYA : ASL : TAX
LDA.w InventoryTable_stamp,X : BEQ .skip
STA.b Scrap0B
LDA.b [Scrap0B] : BNE .skip
INC.b Scrap0B : INC.b Scrap0B
LDA.b [Scrap0B] : BNE .skip
DEC.b Scrap0B : DEC.b Scrap0B
LDA.l NMIFrames : STA.b [Scrap0B]
INC.b Scrap0B : INC.b Scrap0B
LDA.l NMIFrames+2 : STA.b [Scrap0B]
.skip
SEP #$20
RTS
IncrementYAItems:
LDA.w InventoryTable_properties,Y
BIT.b #$10 : BNE .bomb_check
BIT.b #$20 : BNE .bow_check
BIT.b #$04 : BEQ .not_y
.y_item
LDA.l YAItemCounter : !ADD #$08 : STA.l YAItemCounter
BRA .done
.not_y
BIT.b #$08 : BEQ .done
.a_item
LDA.l YAItemCounter : INC : AND.b #$07 : TAX
LDA.l YAItemCounter : AND.b #$F8 : STA.l YAItemCounter
TXA : ORA.l YAItemCounter : STA.l YAItemCounter
PHX
LDA.w InventoryTable_properties,X
BIT.b #$10 : BNE .bomb_check
BIT.b #$20 : BNE .bow_check
BIT.b #$04 : BEQ .not_y
.y_item
LDA.l YAItemCounter : !ADD #$08 : STA.l YAItemCounter
BRA .done
.not_y
BIT.b #$08 : BEQ .done
.a_item
LDA.l YAItemCounter : INC : AND.b #$07 : TAX
LDA.l YAItemCounter : AND.b #$F8 : STA.l YAItemCounter
TXA : ORA.l YAItemCounter : STA.l YAItemCounter
.done
PLX
RTS
.bow_check
LDA.l BowEquipment : BNE +
BRA .y_item
+
RTS
.bomb_check
LDA.l InventoryTracking+1 : BIT.b #$02 : BNE +
ORA.b #$02 : STA.l InventoryTracking+1
BRA .y_item
+
LDA.l InventoryTracking+1 : BIT.b #$02 : BNE +
ORA.b #$02 : STA.l InventoryTracking+1
BRA .y_item
+
PLX
RTS
IncrementByOne:
PHX
REP #$20
TYA : ASL : TAX
LDA.w InventoryTable_stat,X : BEQ .skip
STA.b Scrap0B
SEP #$21
LDA.b #$00 : ADC.b [Scrap0B] : STA.b [Scrap0B]
.skip
SEP #$20
PLX
RTS
IncrementBossSword: