implement remote item checks

This commit is contained in:
Bonta-kun
2020-01-18 06:38:47 +01:00
committed by caitsith2
parent c3c5ba9d53
commit 2a5e305fc6
6 changed files with 70 additions and 15 deletions

View File

@@ -92,6 +92,10 @@ db #$20, #$19, #$08, #$31 ; year/month/day
!MULTIWORLD_ITEM_FROM = "$7EF4D3"
!MULTIWORLD_ROOMID = "$7EF4D4"
!MULTIWORLD_ROOMDATA = "$7EF4D6"
!MULTIWORLD_SCOUT_LOCATION = "$7EF4D7"
!MULTIWORLD_SCOUTREPLY_LOCATION = "$7EF4D8"
!MULTIWORLD_SCOUTREPLY_ITEM = "$7EF4D9"
!MULTIWORLD_SCOUTREPLY_PLAYER = "$7EF4DA"
!MULTIWORLD_RECEIVING_ITEM = "$7EC057" ; 0 = default | 1 = receiving
!MULTIWORLD_HUD_CHARACTER_DATA = "$7EC058" ; 0x40 bytes
!MULTIWORLD_ITEM_PLAYER_ID = "$7EC098" ; 0 = disabled

View File

@@ -64,16 +64,13 @@ DrawHeartPieceGFX:
.skipLoad
PHA
JSL.l IsNarrowSprite : BCC +
LDA $0E60, X : ORA.b #$20 : STA $0E60, X
+
;LDA $0E60, X : ORA.b #$10 : STA $0E60, X
PLA
JSL.l DrawDynamicTile
JSL.l Sprite_DrawShadowLong
CMP #$03 : BNE +
PHA : LDA $0E60, X : ORA.b #$20 : STA $0E60, X : PLA
+
JSL.l Sprite_DrawShadowLong
.done
PLY : PLA

View File

@@ -434,19 +434,28 @@ RTL
AddReceivedItemExpanded:
{
PHA : PHX
LDA RemoteItems : BEQ + : LDA !MULTIWORLD_ITEM_PLAYER_ID : BEQ +
LDA $02E9 : BEQ ++ : CMP #$03 : BNE +++ : ++
; fromTextOrObject
LDA $0345 : BEQ ++ : LDA.b #$04 : ++ : STA $5D ; Restore Link to his swimming state
STZ $02DA : STZ $037B : STZ $02E4
LDA #$0E : STA $012F
+++
STZ $02D8 : STZ $02D9 : STZ $02E9
PHY : LDY.b #$00 : JSL AddInventory : PLY
PLX : PLA : RTL
+
JSL.l PreItemGet
LDA $02D8 : PHA ; Item Value
LDA !MULTIWORLD_ITEM_PLAYER_ID : BNE +
PLA
LDA $02D8
JSR AttemptItemSubstitution
STA $02D8
JSR IncrementItemCounters
BRA ++
+
PLA
++
LDA $02D8 ; Item Value
CMP.b #$16 : BEQ .bottle ; Bottle
CMP.b #$2B : BEQ .bottle ; Red Potion w/bottle

View File

@@ -1817,6 +1817,10 @@ db #$00
ChestGameItem_Player: ; 0x18636B
db #$00
;--------------------------------------------------------------------------------
org $30E36C ; PC 0x18636C
RemoteItems:
db #$00 ; $00 = off; $01 = on (default: off)
;--------------------------------------------------------------------------------
; Player names (32 bytes/player)
;--------------------------------------------------------------------------------
org $30E380 ; PC 0x186380

View File

@@ -18,7 +18,6 @@ ItemCheck_BombosTablet:
RTL
;--------------------------------------------------------------------------------
SetTabletItem:
JSL.l GetSpriteID
PHA
LDA $8A : CMP.b #$03 : BEQ .ether ; if we're on the map where ether is, we're the ether tablet
.bombos

View File

@@ -389,6 +389,19 @@ RTL
;-------------------------------------------------------------------------------- 20/8477
PrepDynamicTile:
PHA : PHX : PHY
TAX : LDA RemoteItems : BEQ +
TXA
CMP !MULTIWORLD_SCOUTREPLY_LOCATION : BNE ++
LDA !MULTIWORLD_SCOUTREPLY_PLAYER : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA !MULTIWORLD_SCOUTREPLY_ITEM
TAX
BRA +
++
STA !MULTIWORLD_SCOUT_LOCATION
LDA #$00 : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDX #$6B
+
TXA
JSR.w LoadDynamicTileOAMTable
JSL.l GetSpriteID ; convert loot id to sprite id
JSL.l GetAnimatedSpriteTile_variable
@@ -446,6 +459,8 @@ RTS
!SKIP_EOR = "$7F5008"
;--------------------------------------------------------------------------------
DrawDynamicTile:
JSR PrepDrawRemoteItemSprite
JSL.l IsNarrowSprite : BCS .narrow
.full
@@ -475,6 +490,8 @@ DrawDynamicTile:
RTL
;--------------------------------------------------------------------------------
DrawDynamicTileNoShadow:
JSR PrepDrawRemoteItemSprite
JSL.l IsNarrowSprite : BCS .narrow
.full
@@ -501,6 +518,31 @@ DrawDynamicTileNoShadow:
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
PrepDrawRemoteItemSprite:
PHA
LDA RemoteItems : BEQ +
PLA
CMP !MULTIWORLD_SCOUTREPLY_LOCATION : BNE ++
LDA !MULTIWORLD_SCOUT_LOCATION : BEQ +++
LDA !MULTIWORLD_SCOUTREPLY_LOCATION
JSL PrepDynamicTile
LDA #$00
BRA ++
+++
LDA !MULTIWORLD_SCOUTREPLY_PLAYER : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA !MULTIWORLD_SCOUTREPLY_ITEM
RTS
++
STA !MULTIWORLD_SCOUT_LOCATION
LDA #$00 : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA #$6B
RTS
+
PLA
RTS
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
!TILE_UPLOAD_OFFSET_OVERRIDE = "$7F5042"
LoadModifiedTileBufferAddress: