From 9c08588d92cd06d8872334f0a82068bdd053aac0 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Sat, 13 May 2023 02:07:40 -0500 Subject: [PATCH] Added a TF Cutscene when getting the TF item --- LTTP_RND_GeneralBugfixes.asm | 3 + doorrando/gfx.asm | 11 ++- elder.asm | 150 ++++++++++++++++++++++++++++++++++- hooks.asm | 6 ++ keydrop/dynamic_si_vram.asm | 20 ++++- multiworld.asm | 5 +- newitems.asm | 30 +++++-- 7 files changed, 211 insertions(+), 14 deletions(-) diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index 3fc4202..523a3e2 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -623,6 +623,9 @@ Sprite_PrepAndDrawSingleLargeLong: org $06DC00 Sprite_PrepAndDrawSingleSmallLong: +org $06E41C +Sprite_PrepOAMCoordLong: + org $06EA18 Sprite_ApplySpeedTowardsPlayerLong: diff --git a/doorrando/gfx.asm b/doorrando/gfx.asm index 94cb884..08ae228 100644 --- a/doorrando/gfx.asm +++ b/doorrando/gfx.asm @@ -92,4 +92,13 @@ OverridePaletteHeader: lda.l PaletteTable, x iny : rtl + rep #$20 : iny : lda [$0D], Y ; what we wrote over -rtl \ No newline at end of file +rtl + +Sprite_ConditionalPrepOAMCoord: + LDA.w $0E20,X : CMP.b #$62 : BNE .notMasterSword + LDA.w $0D90,X : BNE .specialCutscene + .notMasterSword + JML Sprite_PrepOAMCoordLong ; what we wrote over + .specialCutscene + SEC ; this prevents MasterSword sprite from drawing if it is a special cutscene +RTL \ No newline at end of file diff --git a/elder.asm b/elder.asm index f9a644a..4ab0111 100644 --- a/elder.asm +++ b/elder.asm @@ -12,7 +12,7 @@ JSR Elder_Code PLB RTL - +} Elder_Draw: { @@ -60,7 +60,7 @@ RTL LDA.l GoalCounter CMP.l GoalItemRequirement : !BLT + SEP #$20 - JSL.l ActivateGoal + JSL ActivateTriforceCutscene + .dont_show @@ -69,3 +69,149 @@ RTL LDA.b $1A : LSR #5 : AND.b #$01 : STA.w $0DC0, X RTS } + +;-------------------------------------------------------------------------------- +; Triforce (Pedestal) Cutscene +;-------------------------------------------------------------------------------- +ActivateTriforceCutscene: + ; despawn other sprites + LDY.b #$0F + - LDA.w $0E20,Y : CMP.b #$16 : BNE + + CPY.b #$00 : BEQ .next + ; move Murahdahla to slot 0 for draw priority reasons + LDA.w $0E20,Y : STA.w $0E20 + LDA.w $0D00,Y : STA.w $0D00 + LDA.w $0D10,Y : STA.w $0D10 + LDA.w $0D20,Y : STA.w $0D20 + LDA.w $0D30,Y : STA.w $0D30 + LDA.w $0D40,Y : STA.w $0D40 + LDA.w $0F50,Y : STA.w $0F50 + LDA.w $0E40,Y : STA.w $0E40 + LDA.w $0E60,Y : STA.w $0E60 + LDA.w $0DD0,Y : STA.w $0DD0 + LDA.b #$02 : STA.w $0F20 + + LDA.b #$00 : STA.w $0DD0,Y + .next + DEY : BPL - + + LDA.b #$62 ; MasterSword Sprite + JSL Sprite_SpawnDynamically + + ; set up coords + LDA.b $22 : STA.w $0D10,Y + LDA.b $23 : STA.w $0D30,Y + LDA.b $20 : CLC : ADC.b #$08 : STA.w $0D00,Y + LDA.b $21 : ADC.b #$00 : STA.w $0D20,Y + + LDA.b #$01 : STA.w $0D90,Y ; our indicator this is a special cutscene sprite + INC : STA.b $2F ; makes Link face downward + + ; reset modules + LDA.b $1B : BEQ + + LDA.b #$07 + BRA ++ + + LDA.b #$09 + ++ STA.b $10 + STZ.b $11 : STZ.b $B0 +RTL + +pushpc + org $058928 + MasterSword_InPedestal_DoCutscene: + org $0589B1 + MasterSword_ConditionalHandleReceipt_DoReceipt: + + org $05890E + JSL MasterSword_ConditionalActivateCutscene + org $05895F + JSL MasterSword_ConditionalGrabPose : NOP + org $058994 + JSL MasterSword_ConditionalGrabPose : NOP + org $058D1C + JML MasterSword_SpawnPendantProp_ChangePalette + MasterSword_SpawnPendantProp_ChangePalette_return: + org $0589A3 + JSL MasterSword_ConditionalHandleReceipt : NOP #2 +pullpc + +MasterSword_ConditionalActivateCutscene: + LDA.w $0D90,X : BNE .specialCutscene + JML Sprite_CheckDamageToPlayerSameLayerLong ; what we wrote over + .specialCutscene + LDA.b #$02 : STA.w $02DA ; Link's 2-hands-up pose + STA.b $EE ; draw Link on top + LDA.b #$6A : JSL RequestSlottedTile ; draw Triforce piece in VRAM + PLA : PLA : PLA : JML MasterSword_InPedestal_DoCutscene ; do cutscene + +MasterSword_ConditionalGrabPose: + PHA + LDA.w $0D90,X : BNE .specialCutscene + PLA + STA.w $0377 : LDA.b #$01 ; what we wrote over + RTL + .specialCutscene + PLA + LDA.b #$01 +RTL + +MasterSword_SpawnPendantProp_ChangePalette: + STA.w $0D40,Y : PLX ; what we wrote over + LDA.w $0D90,X : BNE .specialCutscene + BRA .done + .specialCutscene + LDA.b #$08 : STA.w $0F50,Y ; change palette + LDA.b #$02 : STA.w $0F20,Y ; change layer +.done +JML MasterSword_SpawnPendantProp_ChangePalette_return + +MasterSword_ConditionalHandleReceipt: + LDA.w $0D90,X : BNE .specialCutscene + LDX.b $8A : LDA.l $7EF280,X ; what we wrote over + RTL + .specialCutscene + PLA : PLA : PEA.w MasterSword_ConditionalHandleReceipt_DoReceipt-1 + LDA.b 4,S : TAX + LDY.b #$6A + RTL + +pushpc + org $058AB6 + MasterSword_SpawnLightWell: + org $058AD0 + MasterSword_SpawnLightFountain: + org $058B62 + MasterSword_SpawnLightBeam: + + org $058941 + JSL MasterSword_ConditionalSpawnLightWell : NOP #2 + MasterSword_SpawnLightWell_return: + org $058952 + JSL MasterSword_ConditionalSpawnLightFountain : NOP #2 + MasterSword_SpawnLightFountain_return: + org $058B64 + JSL MasterSword_ConditionalSpawnLightBeam : NOP #2 +pullpc + +MasterSword_ConditionalSpawnLightWell: + INC.w $0D80,X ; part of what we wrote over + LDA.w $0D90,X : BNE .specialCutscene + PLA : PLA : PLA : PEA.w MasterSword_SpawnLightWell_return-1 + JML MasterSword_SpawnLightWell ; part of what we wrote over + .specialCutscene + RTL + +MasterSword_ConditionalSpawnLightFountain: + INC.w $0D80,X ; part of what we wrote over + LDA.w $0D90,X : BNE .specialCutscene + PLA : PLA : PLA : PEA.w MasterSword_SpawnLightFountain_return-1 + JML MasterSword_SpawnLightFountain ; part of what we wrote over + .specialCutscene + RTL + +MasterSword_ConditionalSpawnLightBeam: + LDA.w $0D90,X : BNE .specialCutscene + LDA.b #$62 : JSL Sprite_SpawnDynamically ; what we wrote over + RTL + .specialCutscene + LDY.b #$FF + RTL diff --git a/hooks.asm b/hooks.asm index 1e112b2..5222ecd 100755 --- a/hooks.asm +++ b/hooks.asm @@ -995,9 +995,15 @@ org $00D557 ; 5557 - Bank00.asm:3486 (LDA $00 : ADC $D469, X) JSL.l GetAnimatedSpriteBufferPointer NOP +org $05FA50 +JSL Sprite_ConditionalPrepOAMCoord + org $0799F7 ; 399F7 - Bank07.asm:4107 (JSL AddReceivedItem) JSL.l AddReceivedItemExpanded +org $08C505 +JSL Ancilla22_ItemReceipt_ContinueB : NOP #2 + org $098605 ; 48605 - ancilla_init.asm:709 (TYA : STA $02E4 : PHX) JML.l Multiworld_AddReceivedItem_notCrystal NOP diff --git a/keydrop/dynamic_si_vram.asm b/keydrop/dynamic_si_vram.asm index 46d1be4..0ade337 100644 --- a/keydrop/dynamic_si_vram.asm +++ b/keydrop/dynamic_si_vram.asm @@ -69,15 +69,23 @@ RequestSlottedTile: LDA.b #!DynamicDropGFXSlotCount_UW BRA +++ ++ LDA.b #!DynamicDropGFXSlotCount_OW - +++ STA.w SprItemGFX,X + +++ INC : STA.w SprItemGFX,X JMP .success + CMP.b #$B1 : BNE + ; if apple, use apple OAM slot LDA.b $1B : BEQ ++ LDA.b #!DynamicDropGFXSlotCount_UW BRA +++ ++ LDA.b #!DynamicDropGFXSlotCount_OW - +++ INC : STA.w SprItemGFX,X + +++ INC : INC : STA.w SprItemGFX,X JMP .success + + CMP.b #$6A : BNE + ; if triforce, use cutscene OAM slot + PHA + LDA.b $1B : BEQ ++ + LDA.b #!DynamicDropGFXSlotCount_UW + BRA +++ + ++ LDA.b #!DynamicDropGFXSlotCount_OW + +++ STA.w SprItemGFX,X + JMP .initRequest ; don't jump to end, we need the TF GFX to draw at $E7 + PHA @@ -210,6 +218,7 @@ FreeUWGraphics: dw $9DC0>>1 ; add new slots above this line .end + dw $9CE0>>1 ; above this line, add slots that we want to draw to specific slots FreeOWGraphics: @@ -221,6 +230,7 @@ FreeOWGraphics: ;dw $9DC0>>1 ; Whirlpool ; add new slots above this line .end + dw $9CE0>>1 ; above this line, add slots that we want to draw to specific slots ;=================================================================================================== @@ -374,7 +384,8 @@ DynamicOAMTileUW_full: ; add new rotating slots above this line - ; + dw -4, -1 : db $E7, $00, $20, $02 ; triforce + dd 0, 0 ; above this line, add slots that we want to draw to specific slots @@ -439,7 +450,8 @@ DynamicOAMTileOW_full: ; add new slots above this line - ; + dw 0, 0 : db $E7, $00, $20, $02 ; triforce + dd 0, 0 ; above this line, add slots that we want to draw to specific slots diff --git a/multiworld.asm b/multiworld.asm index aeb3d65..ba82d71 100644 --- a/multiworld.asm +++ b/multiworld.asm @@ -240,7 +240,10 @@ Multiworld_MasterSword_GrantToPlayer: LDA PedestalSword_Player : STA !MULTIWORLD_ITEM_PLAYER_ID PLP : PLA - JSL Link_ReceiveItem ; thing we wrote over + CPY.b #$6A : BEQ + + JSL Link_ReceiveItem ; thing we wrote over + RTL + + JSL ActivateGoal RTL } diff --git a/newitems.asm b/newitems.asm index 0b29d9d..eddae26 100755 --- a/newitems.asm +++ b/newitems.asm @@ -181,14 +181,18 @@ ProcessEventItems: LDA RNGItem : INC : STA RNGItem SEP #$10 ; set 8-bit index registers - REP #$20 ; set 16-bit accumulator + REP #$20 ; set 16-bit accumulator LDA GoalItemRequirement : BEQ ++ LDA GoalCounter : INC : STA GoalCounter CMP GoalItemRequirement : !BLT ++ LDA TurnInGoalItems : AND.w #$00FF : BNE ++ - JSL.l ActivateGoal + SEP #$20 ; set 8-bit accumulator + LDA.b $8A : CMP.b #$80 : BNE +++ + LDA.b $23 : BNE +++ + JSL.l ActivateGoal + +++ ++ - SEP #$20 ; set 8-bit accumulator + SEP #$20 ; set 8-bit accumulator LDX.b #$01 : BRA .done + LDX.b #$00 @@ -330,20 +334,27 @@ AddReceivedItemExpandedGetItem: + CMP.b #$65 : BNE + ; Progressive Bow JMP .done + CMP.b #$6A : BNE + ; Goal Collectable (Single/Triforce) - JSL.l ActivateGoal + LDA.b $8A : CMP.b #$80 : BNE ++ + LDA.b $23 : BNE ++ + JSL.l ActivateGoal + ++ JMP .done + CMP.b #$6B : BNE + ; Goal Collectable (Multi/Power Star) BRA .multi_collect + CMP.b #$6C : BNE + ; Goal Collectable (Multi/Power Star) Alternate Graphic .multi_collect - REP #$20 ; set 16-bit accumulator + REP #$20 ; set 16-bit accumulator LDA.l GoalItemRequirement : BEQ ++ LDA.l GoalCounter : INC : STA.l GoalCounter CMP.w GoalItemRequirement : !BLT ++ LDA.l TurnInGoalItems : AND.w #$00FF : BNE ++ + SEP #$20 ; set 8-bit accumulator + LDA.b $8A : CMP.b #$80 : BNE +++ + LDA.b $23 : BNE +++ JSL.l ActivateGoal + +++ ++ - SEP #$20 ; set 8-bit accumulator + SEP #$20 ; set 8-bit accumulator JMP .done + CMP.b #$6D : BNE + ; Server Request F0 JSL.l ItemGetServiceRequest_F0 @@ -1263,6 +1274,13 @@ ChestPrep: SEC RTL ;-------------------------------------------------------------------------------- +Ancilla22_ItemReceipt_ContinueB: + CMP.b #$6A : BNE .return + JSL ActivateTriforceCutscene + .return + STZ.w $0C4A,X : STZ.w $0FC1 ; what we wrote over +RTL +;-------------------------------------------------------------------------------- ; Set a flag in SRAM if we pick up a compass in its own dungeon with HUD compass ; counts on MaybeFlagCompassTotalPickup: