From a5642786ff9640f3fbb2a1feb91706d1399e0420 Mon Sep 17 00:00:00 2001 From: "Matthew D. Steele" Date: Wed, 11 Sep 2024 17:42:26 -0400 Subject: [PATCH] Add ShadowOfficeFireball fake console interaction --- src/dialog.asm | 2 ++ src/dialog.inc | 1 + src/rooms/shadow_office.asm | 44 +++++++++++++++++++++++++++++++++++-- 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/dialog.asm b/src/dialog.asm index 008bcc80..daa4a5f5 100644 --- a/src/dialog.asm +++ b/src/dialog.asm @@ -143,6 +143,7 @@ .IMPORT DataA_Dialog_SewerPoolSign_sDialog .IMPORT DataA_Dialog_ShadowDrillScreen_sDialog .IMPORT DataA_Dialog_ShadowGateScreen_sDialog +.IMPORT DataA_Dialog_ShadowOfficeFireball_sDialog .IMPORT DataA_Dialog_ShadowOfficeTeleport_sDialog .IMPORT DataA_Dialog_ShadowTeleportScreen_sDialog .IMPORT DataA_Dialog_TempleAltarPlaque_sDialog @@ -566,6 +567,7 @@ _Finish: d_entry t, SewerPoolSign, DataA_Dialog_SewerPoolSign_sDialog d_entry t, ShadowDrillScreen, DataA_Dialog_ShadowDrillScreen_sDialog d_entry t, ShadowGateScreen, DataA_Dialog_ShadowGateScreen_sDialog + d_entry t, ShadowOfficeFireball, DataA_Dialog_ShadowOfficeFireball_sDialog d_entry t, ShadowOfficeTeleport, DataA_Dialog_ShadowOfficeTeleport_sDialog d_entry t, ShadowTeleportScreen, DataA_Dialog_ShadowTeleportScreen_sDialog d_entry t, TempleAltarPlaque, DataA_Dialog_TempleAltarPlaque_sDialog diff --git a/src/dialog.inc b/src/dialog.inc index b386059e..8db86e9f 100644 --- a/src/dialog.inc +++ b/src/dialog.inc @@ -218,6 +218,7 @@ kDialogEntryCutscene = $ff ; ends the dialog and starts a new cutscene SewerPoolSign ShadowDrillScreen ShadowGateScreen + ShadowOfficeFireball ShadowOfficeTeleport ShadowTeleportScreen TempleAltarPlaque diff --git a/src/rooms/shadow_office.asm b/src/rooms/shadow_office.asm index 4993caa4..18b69aea 100644 --- a/src/rooms/shadow_office.asm +++ b/src/rooms/shadow_office.asm @@ -44,9 +44,11 @@ .IMPORT FuncA_Terrain_FadeInShortRoomWithLava .IMPORT Func_BufferPpuTransfer .IMPORT Func_FindEmptyActorSlot +.IMPORT Func_InitActorProjFireball .IMPORT Func_InitActorSmokeExplosion .IMPORT Func_IsPointInPlatform .IMPORT Func_Noop +.IMPORT Func_PlaySfxShootFire .IMPORT Func_SetActorCenterToPoint .IMPORT Func_SetFlag .IMPORT Func_SetPointToAvatarCenter @@ -58,6 +60,8 @@ .IMPORT Sram_ProgressFlags_arr .IMPORTZP Zp_AvatarPosX_i16 .IMPORTZP Zp_AvatarPosY_i16 +.IMPORTZP Zp_PointX_i16 +.IMPORTZP Zp_RoomState ;;;=========================================================================;;; @@ -112,6 +116,15 @@ kLiftInitPlatformTop = kLiftMaxPlatformTop - kLiftInitGoalY * kBlockHeightPx ;;;=========================================================================;;; +;;; Defines room-specific state data for this particular room. +.STRUCT sState + ;; How many more frames until the fireball console can be activated again. + FireballCooldown_u8 .byte +.ENDSTRUCT +.ASSERT .sizeof(sState) <= kRoomStateSize, error + +;;;=========================================================================;;; + .SEGMENT "PRGC_Shadow" .EXPORT DataC_Shadow_Office_sRoom @@ -235,10 +248,10 @@ _Devices_sDevice_arr: d_byte Target_byte, kLiftMachineIndex D_END D_STRUCT sDevice - d_byte Type_eDevice, eDevice::FakeConsole + d_byte Type_eDevice, eDevice::ScreenGreen d_byte BlockRow_u8, 5 d_byte BlockCol_u8, 2 - d_byte Target_byte, eFake::InsufficientData ; TODO shock horz + d_byte Target_byte, eDialog::ShadowOfficeFireball D_END D_STRUCT sDevice d_byte Type_eDevice, eDevice::FakeConsole @@ -312,6 +325,11 @@ _Passages_sPassage_arr: .SEGMENT "PRGA_Room" .PROC FuncA_Room_ShadowOffice_TickRoom +_CoolDownFireball: + lda Zp_RoomState + sState::FireballCooldown_u8 + beq @done + dec Zp_RoomState + sState::FireballCooldown_u8 + @done: _MaybeTagGhost: ;; If the avatar isn't in the tag zone, don't tag the ghost. jsr Func_SetPointToAvatarCenter @@ -413,6 +431,28 @@ _Return: .SEGMENT "PRGA_Dialog" +.EXPORT DataA_Dialog_ShadowOfficeFireball_sDialog +.PROC DataA_Dialog_ShadowOfficeFireball_sDialog + dlg_Call _ShootFireball + dlg_Done +_ShootFireball: + lda Zp_RoomState + sState::FireballCooldown_u8 + bne @done + jsr Func_FindEmptyActorSlot ; returns C and X + bcs @done + jsr Func_SetPointToAvatarCenter ; preserves X + lda #$11 + sta Zp_PointX_i16 + 0 + jsr Func_SetActorCenterToPoint ; preserves X + lda #$00 ; param: angle + jsr Func_InitActorProjFireball + lda #30 + sta Zp_RoomState + sState::FireballCooldown_u8 + jmp Func_PlaySfxShootFire + @done: + rts +.ENDPROC + .EXPORT DataA_Dialog_ShadowOfficeTeleport_sDialog .PROC DataA_Dialog_ShadowOfficeTeleport_sDialog dlg_Call _TeleportAvatar