Dont replace multiworld items

This commit is contained in:
Bonta-kun
2020-01-13 03:08:37 +01:00
committed by caitsith2
parent 6818c3e119
commit 94218b048b
10 changed files with 82 additions and 61 deletions

View File

@@ -95,7 +95,8 @@ db #$20, #$19, #$08, #$31 ; year/month/day
!MULTIWORLD_RECEIVING_ITEM = "$7EC057" ; 0 = default | 1 = receiving
!MULTIWORLD_HUD_CHARACTER_DATA = "$7EC058" ; 0x40 bytes
!MULTIWORLD_ITEM_PLAYER_ID = "$7EC098" ; 0 = disabled
!MULTIWORLD_HUD_TIMER = "$7EC099"
!MULTIWORLD_SPRITEITEM_PLAYER_ID = "$7EC099"
!MULTIWORLD_HUD_TIMER = "$7EC09A"
!MULTIWORLD_HUD_DELAY = "#120"
!Dungeon_ChestData = "$01E96C"

View File

@@ -2,6 +2,7 @@
; Randomize Book of Mudora
;--------------------------------------------------------------------------------
LoadLibraryItemGFX:
LDA.l LibraryItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
%GetPossiblyEncryptedItem(LibraryItem, SpriteItemValues)
STA $0E80, X ; Store item type
JSL.l PrepDynamicTile
@@ -32,6 +33,7 @@ LoadBonkItemGFX:
LDA.b #$08 : STA $0F50, X ; thing we wrote over
LoadBonkItemGFX_inner:
LDA.b #$00 : STA !REDRAW
JSR LoadBonkItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
JSR LoadBonkItem
JSL.l PrepDynamicTile
RTL
@@ -52,6 +54,7 @@ DrawBonkItemGFX:
RTL
;--------------------------------------------------------------------------------
GiveBonkItem:
JSR LoadBonkItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
JSR LoadBonkItem
CMP #$24 : BNE .notKey
.key
@@ -60,19 +63,6 @@ GiveBonkItem:
LDA.b #$2F : JSL.l Sound_SetSfx3PanLong
RTL
.notKey
PHA
LDA $A0
CMP #115 : BNE + ; Desert Bonk Key
LDA.l BonkKey_Desert_Player
BRA ++
+ : CMP #140 : BNE + ; GTower Bonk Key
LDA.l BonkKey_GTower_Player
BRA ++
+
LDA.b #$00
++
STA !MULTIWORLD_ITEM_PLAYER_ID
PLA
PHY : TAY : JSL.l Link_ReceiveItem : PLY
RTL
;--------------------------------------------------------------------------------
@@ -88,3 +78,16 @@ LoadBonkItem:
LDA.b #$24 ; default to small key
++
RTS
;--------------------------------------------------------------------------------
LoadBonkItem_Player:
LDA $A0 ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte
CMP #115 : BNE + ; Desert Bonk Key
LDA.l BonkKey_Desert_Player
BRA ++
+ : CMP #140 : BNE + ; GTower Bonk Key
LDA.l BonkKey_GTower_Player
BRA ++
+
LDA.b #$00
++
RTS

View File

@@ -3,6 +3,7 @@
;--------------------------------------------------------------------------------
!HEART_REDRAW = "$7F5000"
LoadCatfishItemGFX:
LDA.l CatfishItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA.l $1DE185 ; location randomizer writes catfish item to
JSL.l PrepDynamicTile
RTL

View File

@@ -5,6 +5,7 @@ SpawnHauntedGroveItem:
LDA $8A : CMP.b #$2A : BEQ + : RTL : + ; Skip if not the haunted grove
LDA $1B : BEQ + : RTL : + ; Skip if indoors
LDA.l HauntedGroveItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
%GetPossiblyEncryptedItem(HauntedGroveItem, HeartPieceOutdoorValues)
JSL.l PrepDynamicTile

View File

@@ -12,7 +12,7 @@ HeartPieceGet:
.skipLoad
JSL.l HeartPieceGetPlayer
JSL.l HeartPieceGetPlayer : STA !MULTIWORLD_ITEM_PLAYER_ID
STZ $02E9 ; 0 = Receiving item from an NPC or message
@@ -162,6 +162,7 @@ HeartPieceSpritePrep:
LDA $5D : CMP #$14 : BEQ .skip ; skip if we're mid-mirror
LDA #$00 : STA !REDRAW
JSL.l HeartPieceGetPlayer : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
JSL.l LoadHeartPieceRoomValue ; load item type
STA $0E80, X ; Store item type
JSL.l PrepDynamicTile
@@ -175,6 +176,7 @@ HeartContainerSpritePrep:
PHA
LDA #$00 : STA !REDRAW
JSL.l HeartPieceGetPlayer : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
JSL.l LoadHeartContainerRoomValue ; load item type
STA $0E80, X ; Store item type
JSL.l PrepDynamicTile
@@ -564,7 +566,6 @@ HeartPieceGetPlayer:
.done
AND.w #$00FF ; the loads are words but the values are 1-byte so we need to clear the top half of the accumulator - no guarantee it was 8-bit before
PLP
STA !MULTIWORLD_ITEM_PLAYER_ID
PLY
RTL
}

View File

@@ -961,6 +961,7 @@ RTL
;--------------------------------------------------------------------------------
LoadPowder:
JSL.l Sprite_SpawnDynamically ; thing we wrote over
LDA.l WitchItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
%GetPossiblyEncryptedItem(WitchItem, SpriteItemValues)
STA $0DA0, Y ; Store item type
JSL.l PrepDynamicTile
@@ -988,6 +989,7 @@ RTL
DrawPowder:
LDA $02DA : BNE .defer ; defer if link is buying a potion
LDA.l !REDRAW : BEQ +
LDA.l WitchItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA $0DA0, X ; Retrieve stored item type
JSL.l PrepDynamicTile
LDA #$00 : STA.l !REDRAW ; reset redraw flag
@@ -1014,6 +1016,7 @@ LoadMushroom:
LDA $5D : CMP #$14 : BEQ .skip ; skip if we're mid-mirror
LDA #$00 : STA !REDRAW
LDA.l MushroomItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
%GetPossiblyEncryptedItem(MushroomItem, SpriteItemValues)
STA $0E80, X ; Store item type
JSL.l PrepDynamicTile

View File

@@ -443,42 +443,30 @@ AddReceivedItemExpanded:
PLA
++
CMP.b #$16 : BNE ++ ; Bottle
JSR.w CountBottles : CMP.l BottleLimit : !BLT +++
LDA.l BottleLimitReplacement : STA $02D8
+++ : BRL .done
++ : CMP.b #$2B : BNE ++ ; Red Potion w/bottle
JSR.w CountBottles : CMP.l BottleLimit : !BLT +++
LDA.l BottleLimitReplacement : STA $02D8
+++ : BRL .done
++ : CMP.b #$2C : BNE ++ ; Green Potion w/bottle
JSR.w CountBottles : CMP.l BottleLimit : !BLT +++
LDA.l BottleLimitReplacement : STA $02D8
+++ : BRL .done
++ : CMP.b #$2D : BNE ++ ; Blue Potion w/bottle
JSR.w CountBottles : CMP.l BottleLimit : !BLT +++
LDA.l BottleLimitReplacement : STA $02D8
+++ : BRL .done
++ : CMP.b #$3C : BNE ++ ; Bee w/bottle
JSR.w CountBottles : CMP.l BottleLimit : !BLT +++
LDA.l BottleLimitReplacement : STA $02D8
+++ : BRL .done
++ : CMP.b #$3D : BNE ++ ; Fairy w/bottle
JSR.w CountBottles : CMP.l BottleLimit : !BLT +++
LDA.l BottleLimitReplacement : STA $02D8
+++ : BRL .done
++ : CMP.b #$48 : BNE ++ ; Gold Bee w/bottle
CMP.b #$16 : BEQ .bottle ; Bottle
CMP.b #$2B : BEQ .bottle ; Red Potion w/bottle
CMP.b #$2C : BEQ .bottle ; Green Potion w/bottle
CMP.b #$2D : BEQ .bottle ; Blue Potion w/bottle
CMP.b #$3C : BEQ .bottle ; Bee w/bottle
CMP.b #$3D : BEQ .bottle ; Fairy w/bottle
CMP.b #$48 : BEQ .bottle ; Gold Bee w/bottle
BRA .notBottle
.bottle
JSR.w CountBottles : CMP.l BottleLimit : !BLT +++
LDA !MULTIWORLD_ITEM_PLAYER_ID : BNE +++
LDA.l BottleLimitReplacement : STA $02D8
+++ : BRL .done
.notBottle
++ : CMP.b #$4E : BNE ++ ; Progressive Magic
LDA $7EF37B : BEQ +++
LDA.b #$4F : STA $02D8
+++ : BRL .done
++ : CMP.b #$5E : BNE ++ ; Progressive Sword
LDA !MULTIWORLD_ITEM_PLAYER_ID : BNE +
LDA $7EF359 : CMP.l ProgressiveSwordLimit : !BLT +
LDA.l ProgressiveSwordReplacement : STA $02D8 : BRL .done
+ : CMP.b #$00 : BNE + ; No Sword
+
LDA $7EF359 : CMP.b #$00 : BNE + ; No Sword
LDA.b #$49 : STA $02D8 : BRL .done
+ : CMP.b #$01 : BNE + ; Fighter Sword
LDA.b #$50 : STA $02D8 : BRL .done
@@ -487,25 +475,31 @@ AddReceivedItemExpanded:
+ ; Everything Else
LDA.b #$03 : STA $02D8 : BRL .done
++ : CMP.b #$5F : BNE ++ ; Progressive Shield
LDA !MULTIWORLD_ITEM_PLAYER_ID : BEQ +
LDA !PROGRESSIVE_SHIELD : AND.b #$C0 : BNE +++ ; No Shield
LDA.b #$04 : STA $02D8 : BRL .done
+++ : CMP.b #$40 : BNE +++ ; Fighter Shield
LDA.b #$05 : STA $02D8 : BRL .done
+++ ; Everything Else
LDA.b #$06 : STA $02D8 : BRL .done
+
LDA !PROGRESSIVE_SHIELD : LSR #6 : CMP.l ProgressiveShieldLimit : !BLT +
LDA.l ProgressiveShieldReplacement : STA $02D8 : BRL .done
+
LDA !PROGRESSIVE_SHIELD : AND.b #$C0 : BNE + ; No Shield
LDA.b #$04 : STA $02D8
LDA !MULTIWORLD_ITEM_PLAYER_ID : BEQ +++ : BRL .done : +++
LDA !PROGRESSIVE_SHIELD : !ADD.b #$40 : STA !PROGRESSIVE_SHIELD : BRL .done
LDA.b #$04 : BRA .shielddone
+ : CMP.b #$40 : BNE + ; Fighter Shield
LDA.b #$05 : STA $02D8
LDA !MULTIWORLD_ITEM_PLAYER_ID : BEQ +++ : BRL .done : +++
LDA !PROGRESSIVE_SHIELD : !ADD.b #$40 : STA !PROGRESSIVE_SHIELD : BRL .done
LDA.b #$05 : BRA .shielddone
+ ; Everything Else
LDA.b #$06 : STA $02D8
LDA !MULTIWORLD_ITEM_PLAYER_ID : BEQ +++ : BRL .done : +++
LDA.b #$06
.shielddone : STA $02D8
LDA !PROGRESSIVE_SHIELD : !ADD.b #$40 : STA !PROGRESSIVE_SHIELD : BRL .done
++ : CMP.b #$60 : BNE ++ ; Progressive Armor
LDA !MULTIWORLD_ITEM_PLAYER_ID : BNE +
LDA $7EF35B : CMP.l ProgressiveArmorLimit : !BLT +
LDA.l ProgressiveArmorReplacement : STA $02D8 : BRL .done
+ : CMP.b #$00 : BNE + ; No Armor
+
LDA $7EF35B : CMP.b #$00 : BNE + ; No Armor
LDA.b #$22 : STA $02D8 : BRL .done
+ ; Everything Else
LDA.b #$23 : STA $02D8 : BRL .done
@@ -515,9 +509,11 @@ AddReceivedItemExpanded:
+ ; Everything Else
LDA.b #$1C : STA $02D8 : BRL .done
++ : CMP.b #$64 : BNE ++ : -- ; Progressive Bow
LDA !MULTIWORLD_ITEM_PLAYER_ID : BNE +
LDA $7EF340 : INC : LSR : CMP.l ProgressiveBowLimit : !BLT +
LDA.l ProgressiveBowReplacement : STA $02D8 : BRL .done
+ : CMP.b #$00 : BNE + ; No Bow
+
LDA $7EF340 : INC : LSR : CMP.b #$00 : BNE + ; No Bow
LDA.b #$3A : STA $02D8 : BRA .done
+ ; Any Bow
LDA.b #$3B : STA $02D8 : BRA .done

View File

@@ -32,6 +32,7 @@ RTL
SpawnTabletItem:
; JSL.l HeartPieceGet
;RTL
JSL.l HeartPieceGetPlayer : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
JSL.l LoadOutdoorValue
PHA
JSL.l PrepDynamicTile

View File

@@ -22,6 +22,7 @@ GetSpriteID:
BRA .normal
.bottle
PHA : JSR.w CountBottles : CMP.l BottleLimit : !BLT +
LDA !MULTIWORLD_SPRITEITEM_PLAYER_ID : BNE +
PLA : LDA.l BottleLimitReplacement
JSL.l GetSpriteID
RTL
@@ -55,6 +56,7 @@ RTL
++ CMP.b #$FB : BNE ++ ; RNG Item (Multi)
JSL.l GetRNGItemMulti : JMP GetSpriteID
++ CMP.b #$FD : BNE ++ ; Progressive Armor
LDA !MULTIWORLD_SPRITEITEM_PLAYER_ID : BNE +
LDA $7EF35B : CMP.l ProgressiveArmorLimit : !BLT + ; Progressive Armor Limit
LDA.l ProgressiveArmorReplacement
JSL.l GetSpriteID
@@ -62,11 +64,13 @@ RTL
+
LDA.b #$04 : RTL
++ CMP.b #$FE : BNE ++ ; Progressive Sword
LDA !MULTIWORLD_SPRITEITEM_PLAYER_ID : BNE .skipswordlimit
LDA $7EF359
CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit
LDA.l ProgressiveSwordReplacement
JSL.l GetSpriteID
RTL
.skipswordlimit : LDA $7EF359
+ : CMP.b #$00 : BNE + ; No Sword
LDA.b #$43 : RTL
+ : CMP.b #$01 : BNE + ; Fighter Sword
@@ -77,11 +81,13 @@ RTL
LDA.b #$46 : RTL
+
++ : CMP.b #$FF : BNE ++ ; Progressive Shield
LDA !MULTIWORLD_SPRITEITEM_PLAYER_ID : BNE .skipshieldlimit
LDA !PROGRESSIVE_SHIELD : AND #$C0 : LSR #6
CMP.l ProgressiveShieldLimit : !BLT + ; Progressive Shield Limit
LDA.l ProgressiveShieldReplacement
JSL.l GetSpriteID
RTL
.skipshieldlimit : LDA !PROGRESSIVE_SHIELD : AND #$C0 : LSR #6
+ : CMP.b #$00 : BNE + ; No Shield
LDA.b #$2D : RTL
+ : CMP.b #$01 : BNE + ; Fighter Shield
@@ -89,8 +95,14 @@ RTL
+ ; Everything Else
LDA.b #$2E : RTL
++ : CMP.b #$F8 : BNE ++ ; Progressive Bow
LDA $7EF340
CMP.b #$00 : BNE + ; No Bow
LDA !MULTIWORLD_SPRITEITEM_PLAYER_ID : BNE .skipbowlimit
LDA $7EF340 : INC : LSR
CMP.l ProgressiveBowLimit : !BLT +
LDA.l ProgressiveBowReplacement
JSL.l GetSpriteID
RTL
.skipbowlimit : LDA $7EF340 : INC : LSR
+ : CMP.b #$00 : BNE + ; No Bow
LDA.b #$29 : RTL
+ ; Any Bow
LDA.b #$2A : RTL
@@ -376,6 +388,7 @@ PrepDynamicTile:
JSR.w LoadDynamicTileOAMTable
JSL.l GetSpriteID ; convert loot id to sprite id
JSL.l GetAnimatedSpriteTile_variable
LDA.b #$00 : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
PLY : PLX : PLA
RTL
;--------------------------------------------------------------------------------

View File

@@ -2,6 +2,7 @@
; Randomize Zora King
;--------------------------------------------------------------------------------
LoadZoraKingItemGFX:
LDA.l ZoraItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA.l $1DE1C3 ; location randomizer writes zora item to
JSL.l PrepDynamicTile
RTL