From a27251a7e2b8f8ed95deb5abdaab702c95faf048 Mon Sep 17 00:00:00 2001 From: "Matthew D. Steele" Date: Mon, 28 Oct 2024 17:05:07 -0400 Subject: [PATCH] Animate the final terminal rising from the core --- src/boss.asm | 2 +- src/chr.asm | 6 +-- src/devices/console.asm | 16 +++++-- src/platforms/{monitor.asm => terminal.asm} | 30 +++++++++++-- src/platforms/{monitor.inc => terminal.inc} | 5 ++- src/rooms/core_boss.asm | 48 +++++++++++++++++++-- src/sounds/breaker.asm | 8 ++++ src/tiles/core_pipes2.ahi | 16 +++---- src/tiles/monitor.ahi | 39 ----------------- src/tiles/platform_monitor.ahi | 20 +++++++++ src/tiles/platform_terminal.ahi | 20 +++++++++ src/tilesets/core.bg | 2 +- 12 files changed, 148 insertions(+), 64 deletions(-) rename src/platforms/{monitor.asm => terminal.asm} (69%) rename src/platforms/{monitor.inc => terminal.inc} (92%) delete mode 100644 src/tiles/monitor.ahi create mode 100644 src/tiles/platform_monitor.ahi create mode 100644 src/tiles/platform_terminal.ahi diff --git a/src/boss.asm b/src/boss.asm index 39f3376d..67d9d389 100644 --- a/src/boss.asm +++ b/src/boss.asm @@ -354,7 +354,7 @@ _FlipBreaker: cmp #eDevice::BreakerRising bne @finishedRising lda Ram_DeviceAnim_u8_arr + kBossBreakerDeviceIndex - and #$03 + mod #4 bne @done lda #6 ; param: num frames jmp Func_ShakeRoom diff --git a/src/chr.asm b/src/chr.asm index a2deea49..048aea03 100644 --- a/src/chr.asm +++ b/src/chr.asm @@ -96,8 +96,8 @@ .INCLUDE "platforms/gate.inc" .INCLUDE "platforms/girder.inc" .INCLUDE "platforms/glass.inc" -.INCLUDE "platforms/monitor.inc" .INCLUDE "platforms/stepstone.inc" +.INCLUDE "platforms/terminal.inc" .INCLUDE "platforms/water.inc" .INCLUDE "portrait.inc" .INCLUDE "rooms/boss_city.inc" @@ -1216,7 +1216,7 @@ _chr_begin: chr_inc "winch", kTileIdObjWinchFirst chr_inc "proj_grenade", kTileIdObjProjGrenadeFirst chr_inc "orc_gronta_crouch", kTileIdObjOrcGrontaCrouchFirst - chr_res $04 + chr_inc "platform_terminal", kTileIdObjPlatformTerminalFirst END_CHR_BANK .ENDPROC @@ -1422,7 +1422,7 @@ _chr_begin: chr_inc "upgrade_opaddsub", kTileIdObjUpgradeOpAddSubFirst chr_inc "machine_drums", kTileIdObjMachineDrumsFirst chr_inc "npc_duck", kTileIdObjNpcDuckFirst - chr_inc "monitor", kTileIdObjMonitorFirst + chr_inc "platform_monitor", kTileIdObjPlatformMonitorFirst chr_inc "platform_rocks", kTileIdObjPlatformRocksFirst chr_res $02 chr_inc "bad_grub", kTileIdObjBadGrubFirst diff --git a/src/devices/console.asm b/src/devices/console.asm index e94aef83..584dea38 100644 --- a/src/devices/console.asm +++ b/src/devices/console.asm @@ -80,7 +80,7 @@ kPaletteObjScreen = 1 ;; If the device is animating, blink the console screen quickly. lda Ram_DeviceAnim_u8_arr, x and #$04 - bne _Blank + bne FuncA_Objects_DrawDeviceScreenBlank ; preserves X ;; Check the machine's status. ldy Ram_DeviceTarget_byte_arr, x ; machine index lda Ram_MachineStatus_eMachine_arr, y @@ -90,7 +90,7 @@ _Error: ;; Blink the console screen slowly. lda Zp_FrameCounter_u8 and #$08 - beq _Blank + beq FuncA_Objects_DrawDeviceScreenBlank ; preserves X ;; Draw the error screen. ldy #kPaletteObjConsoleErr ; param: object flags lda #kTileIdObjConsoleErr ; param: tile ID @@ -101,7 +101,12 @@ _Ok: lda #kTileIdObjConsoleOk ; param: tile ID _Draw: jmp FuncA_Objects_Draw1x1Shape ; preserves X -_Blank: +.ENDPROC + +;;; Draws a console or screen device that's blank. +;;; @param X The device index. +;;; @preserve X +.PROC FuncA_Objects_DrawDeviceScreenBlank rts .ENDPROC @@ -139,6 +144,11 @@ _Blank: ;;; @preserve X .EXPORT FuncA_Objects_DrawDeviceScreenRed .PROC FuncA_Objects_DrawDeviceScreenRed + ;; If the device is animating, blink the screen quickly. + lda Ram_DeviceAnim_u8_arr, x + and #$04 + bne FuncA_Objects_DrawDeviceScreenBlank ; preserves X + ;; Draw the sceeen. lda #kPaletteObjScreen ; param: object flags fall FuncA_Objects_DrawDeviceScreenFloor .ENDPROC diff --git a/src/platforms/monitor.asm b/src/platforms/terminal.asm similarity index 69% rename from src/platforms/monitor.asm rename to src/platforms/terminal.asm index 188c5f15..d76257f6 100644 --- a/src/platforms/monitor.asm +++ b/src/platforms/terminal.asm @@ -18,7 +18,8 @@ ;;;=========================================================================;;; .INCLUDE "../macros.inc" -.INCLUDE "monitor.inc" +.INCLUDE "../oam.inc" +.INCLUDE "terminal.inc" .IMPORT FuncA_Objects_Draw2x2Shape .IMPORT FuncA_Objects_MoveShapeDownAndRightOneTile @@ -27,7 +28,7 @@ ;;;=========================================================================;;; ;;; The OBJ palette number used for drawing monitor platforms. -kPaletteObjMonitor = 0 +kPaletteObjTerminal = 0 ;;;=========================================================================;;; @@ -38,10 +39,31 @@ kPaletteObjMonitor = 0 ;;; @param X The platform index. .EXPORT FuncA_Objects_DrawMonitorPlatform .PROC FuncA_Objects_DrawMonitorPlatform + lda #kTileIdObjPlatformMonitorFirst ; param: first tile ID + .assert kTileIdObjPlatformMonitorFirst > 0, error + bne FuncA_Objects_DrawTerminalOrMonitorPlatform ; unconditional +.ENDPROC + +;;; Draws a platform that is a console terminal. The platform width should be +;;; kBlockWidthPx and the platform height should be kBlockHeightPx. +;;; @param X The platform index. +.EXPORT FuncA_Objects_DrawTerminalPlatform +.PROC FuncA_Objects_DrawTerminalPlatform + lda #kTileIdObjPlatformTerminalFirst ; param: first tile ID + fall FuncA_Objects_DrawTerminalOrMonitorPlatform +.ENDPROC + +;;; Draws a platform that is a console terminal or monitor. The platform width +;;; should be kBlockWidthPx and the platform height should be kBlockHeightPx. +;;; @param A The first tile ID. +;;; @param X The platform index. +;;; @preserve X +.PROC FuncA_Objects_DrawTerminalOrMonitorPlatform + pha ; first tile ID jsr FuncA_Objects_SetShapePosToPlatformTopLeft ; preserves X jsr FuncA_Objects_MoveShapeDownAndRightOneTile ; preserves X - lda #kTileIdObjMonitorFirst ; param: first tile ID - ldy #kPaletteObjMonitor ; param: flags + pla ; param: first tile ID + ldy #bObj::Pri | kPaletteObjTerminal ; param: flags jmp FuncA_Objects_Draw2x2Shape ; preserves X and T2+ .ENDPROC diff --git a/src/platforms/monitor.inc b/src/platforms/terminal.inc similarity index 92% rename from src/platforms/monitor.inc rename to src/platforms/terminal.inc index 2dd6b631..cf30a265 100644 --- a/src/platforms/monitor.inc +++ b/src/platforms/terminal.inc @@ -18,6 +18,9 @@ ;;;=========================================================================;;; ;;; OBJ tile IDs for drawing monitor platforms. -kTileIdObjMonitorFirst = $94 +kTileIdObjPlatformMonitorFirst = $94 + +;;; OBJ tile IDs for drawing terminal platforms. +kTileIdObjPlatformTerminalFirst = $fc ;;;=========================================================================;;; diff --git a/src/rooms/core_boss.asm b/src/rooms/core_boss.asm index 8df80abb..dcee0992 100644 --- a/src/rooms/core_boss.asm +++ b/src/rooms/core_boss.asm @@ -24,6 +24,7 @@ .INCLUDE "../cpu.inc" .INCLUDE "../cutscene.inc" .INCLUDE "../device.inc" +.INCLUDE "../devices/console.inc" .INCLUDE "../dialog.inc" .INCLUDE "../flag.inc" .INCLUDE "../machine.inc" @@ -55,6 +56,7 @@ .IMPORT DataA_Text1_CoreBossScreen_Intro_u8_arr .IMPORT DataA_Text1_CoreBossScreen_Reactivate_u8_arr .IMPORT DataA_Text1_CoreBossScreen_SelfDestruct_u8_arr +.IMPORT FuncA_Cutscene_PlaySfxBreakerRising .IMPORT FuncA_Machine_BlasterTick .IMPORT FuncA_Machine_BlasterTryAct .IMPORT FuncA_Machine_BlasterWriteRegM @@ -77,6 +79,7 @@ .IMPORT FuncA_Objects_DrawBlasterMirror .IMPORT FuncA_Objects_DrawCannonMachine .IMPORT FuncA_Objects_DrawLaserMachine +.IMPORT FuncA_Objects_DrawTerminalPlatform .IMPORT FuncA_Objects_DrawWinchMachineWithSpikeball .IMPORT FuncA_Objects_MoveShapeDownOneTile .IMPORT FuncA_Objects_SetShapePosToPlatformTopLeft @@ -110,6 +113,7 @@ .IMPORT Func_MovePlatformHorz .IMPORT Func_MovePlatformLeftTowardPointX .IMPORT Func_MovePlatformTopTowardPointY +.IMPORT Func_MovePlatformVert .IMPORT Func_Noop .IMPORT Func_PlaySfxExplodeSmall .IMPORT Func_ResetWinchMachineState @@ -119,6 +123,7 @@ .IMPORT Func_SetPointToAvatarCenter .IMPORT Func_SetPointToPlatformCenter .IMPORT Func_SetScrollGoalFromPoint +.IMPORT Func_ShakeRoom .IMPORT Ppu_ChrObjBoss3 .IMPORT Ram_ActorFlags_bObj_arr .IMPORT Ram_ActorPosX_i16_0_arr @@ -131,6 +136,7 @@ .IMPORT Ram_ActorVelX_i16_1_arr .IMPORT Ram_ActorVelY_i16_0_arr .IMPORT Ram_ActorVelY_i16_1_arr +.IMPORT Ram_DeviceAnim_u8_arr .IMPORT Ram_DeviceType_eDevice_arr .IMPORT Ram_MachineGoalHorz_u8_arr .IMPORT Ram_MachineGoalVert_u8_arr @@ -186,6 +192,9 @@ kCutsceneZonePlatformIndex = 7 ;;; The platform index for the wall that blocks the passage during the boss ;;; fight. kPassageBarrierPlatformIndex = 8 +;;; The platform index for drawing the final terminal that rises out of the +;;; core. +kFinalTerminalPlatformIndex = 9 ;;; The initial value for the blaster's M (mirror) register. kBlasterInitGoalM = 5 @@ -465,6 +474,14 @@ _Platforms_sPlatform_arr: d_word Left_i16, $0018 d_word Top_i16, $0140 D_END + .assert * - :- = kFinalTerminalPlatformIndex * .sizeof(sPlatform), error + D_STRUCT sPlatform + d_byte Type_ePlatform, ePlatform::Zone + d_word WidthPx_u16, $10 + d_byte HeightPx_u8, $10 + d_word Left_i16, $0110 + d_word Top_i16, $0070 + D_END ;; Top corners of reactor: D_STRUCT sPlatform d_byte Type_ePlatform, ePlatform::Solid @@ -1846,6 +1863,13 @@ _Col1: .SEGMENT "PRGA_Objects" .PROC FuncA_Objects_CoreBoss_DrawRoom +_FinalTerminal: + lda Zp_RoomState + sState::Current_eGrontaPhase + cmp #eGrontaPhase::Defeated + bne @done + ldx #kFinalTerminalPlatformIndex ; param: platform index + jsr FuncA_Objects_DrawTerminalPlatform + @done: _PassageBarrier: lda Ram_PlatformType_ePlatform_arr + kPassageBarrierPlatformIndex cmp #kFirstSolidPlatformType @@ -2021,8 +2045,11 @@ _ChangeGrontaFromNpcToBad: act_SetScrollFlags 0 act_CallFunc _LookAtTopOfCore act_WaitFrames 60 - act_CallFunc _MakeFinalTerminalAppear - act_WaitFrames 60 + act_CallFunc FuncA_Cutscene_PlaySfxBreakerRising + act_RepeatFunc 64, _RaiseFinalTerminal + act_WaitFrames 30 + act_CallFunc _TurnOnFinalTerminal + act_WaitFrames 90 act_ContinueExploring _MakeGrontaDefeated: lda #eGrontaPhase::Defeated @@ -2052,10 +2079,23 @@ _LookAtTopOfCore: stax Zp_ScrollGoalX_u16 sta Zp_ScrollGoalY_u8 rts -_MakeFinalTerminalAppear: - ;; TODO: animate the terminal rising from the core +_RaiseFinalTerminal: + txa ; repeat counter + mod #4 + bne @done + ldx #kFinalTerminalPlatformIndex ; param: platform index + lda #<-1 ; param: move by + jsr Func_MovePlatformVert + lda #6 ; param: num frames + jmp Func_ShakeRoom + @done: + rts +_TurnOnFinalTerminal: lda #eDevice::ScreenRed sta Ram_DeviceType_eDevice_arr + kFinalTerminalDeviceIndex + lda #kConsoleAnimCountdown + sta Ram_DeviceAnim_u8_arr + kFinalTerminalDeviceIndex + ;; TODO: play a sound for the terminal turning on rts .ENDPROC diff --git a/src/sounds/breaker.asm b/src/sounds/breaker.asm index 89f27127..386b9de7 100644 --- a/src/sounds/breaker.asm +++ b/src/sounds/breaker.asm @@ -69,6 +69,14 @@ jmp Func_PlaySfxSequenceNoise ; preserves T0+ .ENDPROC +;;; Starts playing the sound for when a breaker device rises from the floor. +;;; @preserve T0+ +.EXPORT FuncA_Cutscene_PlaySfxBreakerRising +.PROC FuncA_Cutscene_PlaySfxBreakerRising + ldya #Data_BreakerRising_sSfxSeq_arr + jmp Func_PlaySfxSequenceNoise ; preserves T0+ +.ENDPROC + ;;;=========================================================================;;; .SEGMENT "PRGA_Room" diff --git a/src/tiles/core_pipes2.ahi b/src/tiles/core_pipes2.ahi index 7de3b912..47e449bb 100644 --- a/src/tiles/core_pipes2.ahi +++ b/src/tiles/core_pipes2.ahi @@ -11,14 +11,14 @@ ahi1 f0 p1 i12 w8 h8 31111113 33333333 -00000000 -00000000 -00000000 -00000000 -00000000 -00000000 -00000000 -00000000 +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 03000003 33300333 diff --git a/src/tiles/monitor.ahi b/src/tiles/monitor.ahi deleted file mode 100644 index 3968d4ff..00000000 --- a/src/tiles/monitor.ahi +++ /dev/null @@ -1,39 +0,0 @@ -ahi1 f0 p1 i4 w8 h8 - -0;FF0;54;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0 - -00000000 -00002222 -00020000 -00020000 -00020000 -00020000 -00020000 -00020000 - -00020000 -00022222 -00000022 -00000000 -00000000 -00000000 -00000000 -00000000 - -00000000 -22220000 -00002000 -00002200 -00002200 -00002200 -00002200 -00002200 - -00002200 -22222000 -22000000 -00000000 -00000000 -00000000 -00000000 -00000000 diff --git a/src/tiles/platform_monitor.ahi b/src/tiles/platform_monitor.ahi new file mode 100644 index 00000000..7084f835 --- /dev/null +++ b/src/tiles/platform_monitor.ahi @@ -0,0 +1,20 @@ +ahi1 f0 p1 i1 w16 h16 + +0;FF0;54;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0 + +0000000000000000 +0000222222220000 +0002000000002000 +0002000000002200 +0002000000002200 +0002000000002200 +0002000000002200 +0002000000002200 +0002000000002200 +0002222222222000 +0000002222000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 diff --git a/src/tiles/platform_terminal.ahi b/src/tiles/platform_terminal.ahi new file mode 100644 index 00000000..c418d7c4 --- /dev/null +++ b/src/tiles/platform_terminal.ahi @@ -0,0 +1,20 @@ +ahi1 f0 p1 i1 w16 h16 + +00080;0;54;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0;FF0 + +0000000000000000 +0000222222220000 +0002000000002000 +0002000000002200 +0002000000002200 +0002000000002200 +0002000000002200 +0002000000002200 +0002000000002200 +0002222222222000 +0000002222000000 +0002222222222000 +0002111221212000 +0002222222222000 +0002222222222000 +0002222222222000 diff --git a/src/tilesets/core.bg b/src/tilesets/core.bg index 18686f2a..7dfa1bc2 100644 --- a/src/tilesets/core.bg +++ b/src/tilesets/core.bg @@ -23,4 +23,4 @@ BABABBBBBBBCBDBBBEBABABFBDBCBABABBBCBDBB DG BABABBBBBDCABOBP GAGBGAGBGA GBGA GB DEEE BBBBCABDBCBABACABCBDGAGB GB GAGB GAGBGAGBGA DIDM BEBFBBBBCABABABFBEBFGBGA EADEDEEBDG DHDG DHDG DFEGEADEDEEBDEDE DFDFEEDEDFDFDFDF -DG DHDG DHDEDEDEDEDEEEDG DKDODPDL DEDE DKDODG DH +DG DHDG DHDEDEDEDEDEEEDG DKDODPDLCBCBDEDE DKDODG DH