Skip to content

Commit

Permalink
Add ShadowOfficeFireball fake console interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsteele committed Sep 11, 2024
1 parent 57c5c4d commit a564278
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/dialog.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/dialog.inc
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ kDialogEntryCutscene = $ff ; ends the dialog and starts a new cutscene
SewerPoolSign
ShadowDrillScreen
ShadowGateScreen
ShadowOfficeFireball
ShadowOfficeTeleport
ShadowTeleportScreen
TempleAltarPlaque
Expand Down
44 changes: 42 additions & 2 deletions src/rooms/shadow_office.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -58,6 +60,8 @@
.IMPORT Sram_ProgressFlags_arr
.IMPORTZP Zp_AvatarPosX_i16
.IMPORTZP Zp_AvatarPosY_i16
.IMPORTZP Zp_PointX_i16
.IMPORTZP Zp_RoomState

;;;=========================================================================;;;

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a564278

Please sign in to comment.