From 2a5e305fc69ba05e9a2c546012813c03ea66fd86 Mon Sep 17 00:00:00 2001 From: Bonta-kun <40473493+Bonta0@users.noreply.github.com> Date: Sat, 18 Jan 2020 06:38:47 +0100 Subject: [PATCH] implement remote item checks --- LTTP_RND_GeneralBugfixes.asm | 4 ++++ heartpieces.asm | 15 ++++++------- newitems.asm | 19 +++++++++++----- tables.asm | 4 ++++ tablets.asm | 1 - utilities.asm | 42 ++++++++++++++++++++++++++++++++++++ 6 files changed, 70 insertions(+), 15 deletions(-) diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index e1df275..1c0f034 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -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 diff --git a/heartpieces.asm b/heartpieces.asm index 309d3c2..edee15e 100644 --- a/heartpieces.asm +++ b/heartpieces.asm @@ -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 diff --git a/newitems.asm b/newitems.asm index 59114d8..ac0950d 100755 --- a/newitems.asm +++ b/newitems.asm @@ -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 diff --git a/tables.asm b/tables.asm index a9c1da0..a10f543 100644 --- a/tables.asm +++ b/tables.asm @@ -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 diff --git a/tablets.asm b/tablets.asm index b31e720..338bef7 100644 --- a/tablets.asm +++ b/tablets.asm @@ -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 diff --git a/utilities.asm b/utilities.asm index 5699123..b08b67b 100644 --- a/utilities.asm +++ b/utilities.asm @@ -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: