Skip to content

Commit

Permalink
Start implementing cutscenes for the "give remote" ending
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsteele committed Nov 3, 2024
1 parent 6f9fbaa commit 28fbaa6
Show file tree
Hide file tree
Showing 14 changed files with 219 additions and 32 deletions.
6 changes: 6 additions & 0 deletions src/actor.asm
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
.IMPORT FuncA_Actor_TickProjSpine
.IMPORT FuncA_Actor_TickProjSteamHorz
.IMPORT FuncA_Actor_TickProjSteamUp
.IMPORT FuncA_Actor_TickSmokeAxe
.IMPORT FuncA_Actor_TickSmokeBlood
.IMPORT FuncA_Actor_TickSmokeDirt
.IMPORT FuncA_Actor_TickSmokeExplosion
Expand Down Expand Up @@ -530,6 +531,7 @@ _NoHit:
d_byte ProjSpine, kProjSpineRadius
d_byte ProjSteamHorz, kSteamMinorRadius
d_byte ProjSteamUp, kSteamMajorRadius
d_byte SmokeAxe, kProjAxeRadius
d_byte SmokeBlood, kSmokeBloodRadius
d_byte SmokeDirt, kSmokeDirtRadius
d_byte SmokeExplosion, kSmokeExplosionRadius
Expand Down Expand Up @@ -599,6 +601,7 @@ _NoHit:
d_byte ProjSpine, kProjSpineRadius
d_byte ProjSteamHorz, kSteamMinorRadius
d_byte ProjSteamUp, kSteamMajorRadius
d_byte SmokeAxe, kProjAxeRadius
d_byte SmokeBlood, kSmokeBloodRadius
d_byte SmokeDirt, kSmokeDirtRadius
d_byte SmokeExplosion, kSmokeExplosionRadius
Expand Down Expand Up @@ -668,6 +671,7 @@ _NoHit:
d_byte ProjSpine, kProjSpineRadius
d_byte ProjSteamHorz, kSteamMajorRadius
d_byte ProjSteamUp, kSteamMinorRadius
d_byte SmokeAxe, kProjAxeRadius
d_byte SmokeBlood, kSmokeBloodRadius
d_byte SmokeDirt, kSmokeDirtRadius
d_byte SmokeExplosion, kSmokeExplosionRadius
Expand Down Expand Up @@ -805,6 +809,7 @@ _TypeSpecificTick:
d_entry table, ProjSpine, FuncA_Actor_TickProjSpine
d_entry table, ProjSteamHorz, FuncA_Actor_TickProjSteamHorz
d_entry table, ProjSteamUp, FuncA_Actor_TickProjSteamUp
d_entry table, SmokeAxe, FuncA_Actor_TickSmokeAxe
d_entry table, SmokeBlood, FuncA_Actor_TickSmokeBlood
d_entry table, SmokeDirt, FuncA_Actor_TickSmokeDirt
d_entry table, SmokeExplosion, FuncA_Actor_TickSmokeExplosion
Expand Down Expand Up @@ -1049,6 +1054,7 @@ _Finish:
d_entry table, ProjSpine, FuncA_Objects_DrawActorProjSpine
d_entry table, ProjSteamHorz, FuncA_Objects_DrawActorProjSteamHorz
d_entry table, ProjSteamUp, FuncA_Objects_DrawActorProjSteamUp
d_entry table, SmokeAxe, FuncA_Objects_DrawActorProjAxe
d_entry table, SmokeBlood, FuncA_Objects_DrawActorSmokeBlood
d_entry table, SmokeDirt, FuncA_Objects_DrawActorSmokeDirt
d_entry table, SmokeExplosion, FuncA_Objects_DrawActorSmokeExplosion
Expand Down
3 changes: 2 additions & 1 deletion src/actor.inc
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ kMaxActors = 16
ProjSpine ; a spine shot by the city boss
ProjSteamHorz ; emitted horizontally from boiler machine pipes
ProjSteamUp ; emitted vertically from boiler machine pipes
SmokeAxe ; an axe thrown by Gronta in a cutscene
SmokeBlood ; a glob of blood from the temple boss
SmokeDirt ; a clump of dirt from the mine boss
SmokeExplosion ; a puff of smoke for when something explodes
Expand All @@ -101,7 +102,7 @@ kFirstNonStaticActorType = eActor::ProjAcid

;;; eActor values greater than or equal to this are "smoke" actors; that is,
;;; they are decorative animations that don't affect game physics.
kFirstSmokeActorType = eActor::SmokeBlood
kFirstSmokeActorType = eActor::SmokeAxe
;;;=========================================================================;;;
Expand Down
40 changes: 40 additions & 0 deletions src/actors/axe.asm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
.INCLUDE "axe.inc"

.IMPORT FuncA_Actor_HarmAvatarIfCollision
.IMPORT FuncA_Actor_IsInRoomBounds
.IMPORT FuncA_Actor_ZeroVel
.IMPORT FuncA_Objects_Draw2x2Actor
.IMPORT Func_FindActorWithType
Expand Down Expand Up @@ -69,6 +70,29 @@ kPaletteObjAxe = 0

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

.SEGMENT "PRGA_Cutscene"

;;; Initializes the specified actor as an axe smoke.
;;; @prereq The actor's pixel position has already been initialized.
;;; @param A The angle to throw at, measured in increments of tau/256.
;;; @param X The actor index.
;;; @preserve X, T3+
.EXPORT FuncA_Cutscene_InitActorSmokeAxe
.PROC FuncA_Cutscene_InitActorSmokeAxe
pha ; angle
add #$40
and #$80
.assert bObj::FlipH = $40, error
div #2 ; param: flags
ldy #eActor::SmokeAxe ; param: actor type
jsr Func_InitActorWithFlags ; preserves X and T0+
pla ; param: angle
ldy #kProjAxeSpeed ; param: speed
jmp Func_SetActorVelocityPolar ; preserves X and T3+
.ENDPROC

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

.SEGMENT "PRGA_Actor"

;;; Initializes the specified actor as an axe projectile.
Expand Down Expand Up @@ -181,6 +205,22 @@ _Done:
rts
.ENDPROC

;;; Performs per-frame updates for an axe smoke actor.
;;; @param X The actor index.
;;; @preserve X
.EXPORT FuncA_Actor_TickSmokeAxe
.PROC FuncA_Actor_TickSmokeAxe
inc Ram_ActorState1_byte_arr, x ; axe age in frames
beq _Expire
jsr FuncA_Actor_IsInRoomBounds ; preserves X, returns C
bcc _Expire
rts
_Expire:
lda #eActor::None
sta Ram_ActorType_eActor_arr, x
rts
.ENDPROC

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

.SEGMENT "PRGA_Objects"
Expand Down
12 changes: 6 additions & 6 deletions src/actors/axe.inc
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
;;; with Annalog. If not, see <http://www.gnu.org/licenses/>. ;;;
;;;=========================================================================;;;

;;; State bytes for axe projectiles:
;;; State bytes for axe projectiles and smoke:
;;; * Flags: The bObj::FlipH bit is set if the axe is spinning
;;; counterclockwise, or cleared if it is spinning clockwise.
;;; * State1: For AxeBoomer, this is the current age of the projectile, in
;;; frames. For AxeSmash, this is unused.
;;; * State2: For AxeBoomer, this is unused. For AxeSmash, this is the
;;; platform index to home in on.
;;; * State1: For ProjAxeBoomer and SmokeAxe, this is the current age of the
;;; projectile, in frames. For ProjAxeSmash, this is unused.
;;; * State2: For ProjAxeBoomer and SmokeAxe, this is unused. For AxeSmash,
;;; this is the platform index to home in on.
;;; * State3: Unused.
;;; * State4: Unused.

;;; The first tile ID for drawing axe projectile actors.
;;; The first tile ID for drawing axe projectile and smoke actors.
kTileIdObjProjAxeFirst = $d8

;;;=========================================================================;;;
3 changes: 0 additions & 3 deletions src/avatar.asm
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ kAvatarHorzDecelSlow = 8
;;; in subpixels per frame.
kAvatarJumpVelocity = $ffff & -850

;;; How many frames to blink the screen when the avatar is almost healed.
kAvatarHealBlinkFrames = 14

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

.ZEROPAGE
Expand Down
3 changes: 3 additions & 0 deletions src/avatar.inc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ kAvatarHarmStunFrames = 20
;;; How long the player avatar stays invincible after taking damage, in frames.
kAvatarHarmInvincibleFrames = 60

;;; How many frames to blink the screen when the avatar is almost healed.
kAvatarHealBlinkFrames = 14

;;; If Zp_AvatarHarmTimer_u8 is set to this, then the avatar has been killed
;;; and we should go to death mode.
kAvatarHarmDeath = $ff
Expand Down
3 changes: 3 additions & 0 deletions src/cutscene.asm
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
.IMPORT DataA_Cutscene_TempleNaveAlexBoosting_sCutscene
.IMPORT DataA_Cutscene_TownHouse2WakeUp_sCutscene
.IMPORT DataA_Cutscene_TownHouse4BreakerLava_sCutscene
.IMPORT DataA_Cutscene_TownOutdoorsGaveRemote_sCutscene
.IMPORT DataA_Cutscene_TownOutdoorsGetCaught_sCutscene
.IMPORT DataA_Cutscene_TownOutdoorsOrcAttack_sCutscene
.IMPORT DataA_Cutscene_TownOutdoorsYearsLater_sCutscene
Expand Down Expand Up @@ -266,6 +267,8 @@ _Finish:
DataA_Cutscene_TownHouse2WakeUp_sCutscene
d_entry table, TownHouse4BreakerLava, \
DataA_Cutscene_TownHouse4BreakerLava_sCutscene
d_entry table, TownOutdoorsGaveRemote, \
DataA_Cutscene_TownOutdoorsGaveRemote_sCutscene
d_entry table, TownOutdoorsGetCaught, \
DataA_Cutscene_TownOutdoorsGetCaught_sCutscene
d_entry table, TownOutdoorsOrcAttack, \
Expand Down
1 change: 1 addition & 0 deletions src/cutscene.inc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ kMaxForks = 4
TempleNaveAlexBoosting
TownHouse2WakeUp
TownHouse4BreakerLava
TownOutdoorsGaveRemote
TownOutdoorsGetCaught
TownOutdoorsOrcAttack
TownOutdoorsYearsLater
Expand Down
6 changes: 4 additions & 2 deletions src/dialog.asm
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
.IMPORT DataA_Dialog_CityOutskirtsAlex1_sDialog
.IMPORT DataA_Dialog_CityOutskirtsAlex2_sDialog
.IMPORT DataA_Dialog_CoreBossGrontaDying_sDialog
.IMPORT DataA_Dialog_CoreBossGrontaGive_sDialog
.IMPORT DataA_Dialog_CoreBossGrontaGive1_sDialog
.IMPORT DataA_Dialog_CoreBossGrontaGive2_sDialog
.IMPORT DataA_Dialog_CoreBossGrontaIntro_sDialog
.IMPORT DataA_Dialog_CoreBossScreen_sDialog
.IMPORT DataA_Dialog_CoreLockBreakerShadow_sDialog
Expand Down Expand Up @@ -462,7 +463,8 @@ _Finish:
d_entry t, CityOutskirtsAlex1, DataA_Dialog_CityOutskirtsAlex1_sDialog
d_entry t, CityOutskirtsAlex2, DataA_Dialog_CityOutskirtsAlex2_sDialog
d_entry t, CoreBossGrontaDying, DataA_Dialog_CoreBossGrontaDying_sDialog
d_entry t, CoreBossGrontaGive, DataA_Dialog_CoreBossGrontaGive_sDialog
d_entry t, CoreBossGrontaGive1, DataA_Dialog_CoreBossGrontaGive1_sDialog
d_entry t, CoreBossGrontaGive2, DataA_Dialog_CoreBossGrontaGive2_sDialog
d_entry t, CoreBossGrontaIntro, DataA_Dialog_CoreBossGrontaIntro_sDialog
d_entry t, CoreBossScreen, DataA_Dialog_CoreBossScreen_sDialog
d_entry t, CoreLockBreakerShadow, \
Expand Down
3 changes: 2 additions & 1 deletion src/dialog.inc
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ kDialogEntryCutscene = $ff ; ends the dialog and starts a new cutscene
CityOutskirtsAlex1
CityOutskirtsAlex2
CoreBossGrontaDying
CoreBossGrontaGive
CoreBossGrontaGive1
CoreBossGrontaGive2
CoreBossGrontaIntro
CoreBossScreen
CoreLockBreakerShadow
Expand Down
35 changes: 35 additions & 0 deletions src/finale.asm
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
.IMPORT Func_ClearRestOfOam
.IMPORT Func_FadeInFromBlackToNormal
.IMPORT Func_FadeOutToBlack
.IMPORT Func_FadeOutToBlackSlowly
.IMPORT Func_ProcessFrame
.IMPORT Func_WaitXFrames
.IMPORT Main_Explore_EnterRoom
Expand All @@ -49,6 +50,18 @@

.SEGMENT "PRG8"

;;; Mode for transitioning to the cutscene that plays in TownOutdoors after
;;; giving the B-Remote to Gronta.
;;; @prereq Rendering is enabled.
.EXPORT Main_Finale_GaveRemote
.PROC Main_Finale_GaveRemote
jsr Func_FadeOutToBlackSlowly
ldx #eRoom::TownOutdoors ; param: room to load
ldy #eMusic::Silence ; param: music to play
jsr FuncM_SwitchPrgcAndLoadRoomWithMusic
jmp_prga MainA_Death_EnterFinaleGaveRemoteCutsceneRoom
.ENDPROC

;;; Mode for displaying the "years later" text as part of the self-destruct
;;; finale, before switching to the "years later" cutscene.
;;; @prereq Rendering is enabled.
Expand Down Expand Up @@ -146,4 +159,26 @@ _ReturnRoomAndMusic:
jmp Main_Explore_EnterRoom
.ENDPROC

;;; Sets up the avatar, room scrolling, and next cutscene for the "gave remote"
;;; cutscene, then jumps to Main_Explore_EnterRoom.
;;; @prereq Rendering is disabled.
;;; @prereq Static room data is loaded.
.PROC MainA_Death_EnterFinaleGaveRemoteCutsceneRoom
;; Hide the player avatar.
lda #eAvatar::Hidden
sta Zp_AvatarPose_eAvatar
;; Position the (hidden) player avatar so as to make the room scroll
;; position be what we want. (We don't want to do this by locking
;; scrolling, because we want e.g. the vertical scroll to be able to shift
;; while the dialog window is open.)
ldax #$02c4
stax Zp_AvatarPosX_i16
ldax #$00c8
stax Zp_AvatarPosY_i16
;; Enter the room and start the cutscene.
lda #eCutscene::TownOutdoorsGaveRemote
sta Zp_Next_eCutscene
jmp Main_Explore_EnterRoom
.ENDPROC

;;;=========================================================================;;;
Loading

0 comments on commit 28fbaa6

Please sign in to comment.