With the release of NESaker 4.0.6, I decided to modify my script to make it more versatile.
So here my new version.
It's is meant to be use with the AdventureModule.MOD in NESMaker 4.0.6
Technique:
For that, I use normal screens for the cutscenes / introduction screens, design them as I want (assets, with some texts,... for exemple). And FLAG them as "cutscene" (I hijack the currently not used "Screen Flag 4" that I will rename as "Cutscene screen").
To link one screen to other, I used the "warp" functionality.
I made a script "Cutscenes_WarpToNextScreen.asm" that check if the current screen is a "Cutscene screen", if so, it triggers a Warp! Else the script does nothing. I assigned that script to the Press A button.
I modified all the the input/movement/loadScreens scripts to disable/skip some parts when on a "Cutscene screen".
Design:
In the "Project Settings > Project Labels" , I rename the "Screen Flag 4" to "Cutscene screen".
First of all, in the overworld, I make my 1st Cutscene screen with my player, some text (I made assets, for now, but could definitly use textbox when I will figure out how use it). This screen will be shown when the game Start (when PressStart / or skip start screen).
It is my FIRST Cutscene screen.
In the "Screen info", I set the screen as "Cutscene screen" and defined what screen to "Warp to", that will be my 2nd Cutscene screen.
Then, I design my 2nd Cutscene screen with some text, ...
In the "Screen info", I set the screen as "Cutscene screen" and defined what screen to "Warp to", that will be my 3nd Cutscene screen.
Then, I design my 3nd Cutscene screen with some text, ...
It's my last Cutscene screen, beause I want only 3 Cutscene screens (but if you want more you can continue...)
But even, in the "Screen info", again, I set the screen as "Cutscene screen" and defined what screen to "Warp to" the screen that will be my playable game.
My playable screen is full of tiles, monsters, pickups… (and I will put a "checkpoint" type tile, at the exact place where my player will warp in: when he loose a life, he will start from here).
Oh, and, if you have gravity (plateformer) like me, don't forget to put a solid tile under your player in each screen (else, he will fall when warped in)
Scripts:
In the "HandleScreenLoads.asm" script, at line 320 (just before the "LDA HudHandler" line), I add some code to skip/hide the HUD when on a Cutscene screen:
Code:
;; dale_coop: check for the cutscenes screens
LDA ScreenByte01
AND #%00010000 ;; check if a cutscene screen flag
BNE skipDrawingHudForCutScene
JMP continueDrawingHudForCutScene
skipDrawingHudForCutScene:
;; Uncomment, if you want Hide the player during cutscene (cf. CutScenes_WarpToNextScreen.asm too)
;;ChangeObjectState #$05, #$02 ;; change to action step 5
;; skip the HUD drawing (= no HUD)
JMP skipDrawingHud_GameHandler
continueDrawingHudForCutScene:
;; dale_coop: continue as usual
I make a "Cutscenes_WarpToNextScreen.asm" script (in the "\Routines\UserScripts\AdventureGame_Base\InputScripts\InputScripts" folder):
Code:
warpToNextScreen:
;; dale_coop: check for the cutscenes screens
LDA ScreenByte01
AND #%00010000 ;; check if a cutscene screen flag
BNE continueWarpingToNextScreen ;; if cutscene we warp
JMP doNothingForWarpingToNextScreen ;; else we do nothing
continueWarpingToNextScreen:
;; warp to the next screen:
LDA warpMap
clc
adc #$01
STA temp
GoToScreen warpToScreen, temp
doNothingForWarpingToNextScreen:
;; Uncomment, if you want Hide the player during cutscene (cf. handleScreenLoads.asm too)
;; check the current state
;;GetCurrentActionType player1_object
;;CMP #$05 ;; if action step 5 (cutscene)
;;ChangeObjectState #$00, #$02 ;; change to action step 0 (idle)
RTS
Now, in "Input Editor", I assign THAT script to the "PRESS" "A" button (or button you want to go one screen to the next one)
And, I modify all the "startMovingPlayerXxx.asm" to skip when on a Cutscene screen.
Here, for exemple the "startMovingPlayerRight.asm":
Code:
;; dale_coop: check for the cutscenes screens
LDA ScreenByte01
AND #%00010000 ;; check if a cutscene screen flag
BNE finishedMovingPlayerRight
LDX player1_object
GetCurrentActionType player1_object
CMP #$02 ;; attack
BEQ ++
CMP #$01
BEQ +
ChangeObjectState #$01, #$04
+
StartMoving player1_object, MOVE_RIGHT
++
FaceDirection player1_object, FACE_RIGHT
RTS
finishedMovingPlayerRight:
RTS
Also something similar in the "a_create_projectile.asm" script:
Code:
;; dale_coop: check for the cutscenes screens
LDA ScreenByte01
AND #%00010000 ;; check if a cutscene screen flag
BNE skipCreatingProjectile
JMP canContinueCreatingProjectile
skipCreatingProjectile:
JMP doneShooting
canContinueCreatingProjectile:
LDA gameHandler
AND #%00100000
BEQ notNPCstate_proj
JMP doneShooting
notNPCstate_proj
LDA weaponsUnlocked
AND #%00000010
BNE canShoot
JMP doneShooting
canShoot:
LDX player1_object
GetCurrentActionType player1_object
CMP #$02
BNE notAlreadyShooting
JMP doneShooting
notAlreadyShooting
;;; don't attack if already attacking.
;;; do we have to check for hurt here?
;;;;; Here, we WOULD create melee
ChangeObjectState #$02, #$02
LDA Object_movement,x
AND #%00001111
STA Object_movement,x
LDA #$00
STA Object_h_speed_hi,x
STA Object_h_speed_lo,x
STA Object_v_speed_hi,x
STA Object_v_speed_lo,x
LDA Object_x_hi,x
;;; offset x for creation
CLC
ADC #$04
STA temp
LDA Object_y_hi,x
CLC
ADC #$04
STA temp1
LDA Object_movement,x
AND #%00000111
STA temp2
CreateObject temp, temp1, #$03, #$00
;;;; x is now the newly created object's x.
LDA Object_movement,x
ORA temp2
STA Object_movement,x
LDY temp2
LDA directionTable,y
ORA Object_movement,x
STA Object_movement,x
PlaySound #sfx_shoot
doneShooting:
RTS
;;000 down
;010 right
;100 up
;110 left
And in the "b_create_melee.asm" script:
Code:
;; dale_coop: check for the cutscenes screens
LDA ScreenByte01
AND #%00010000 ;; check if a cutscene screen flag
BNE skipCreatingMelee
JMP canContinueCreatingMelee
skipCreatingMelee:
JMP doneAttacking
canContinueCreatingMelee:
LDA gameHandler
AND #%00100000
BEQ notNPCstate_attack
JMP doneAttacking
notNPCstate_attack
LDA weaponsUnlocked
AND #%00000001
BNE canAttack
JMP doneAttacking
canAttack:
LDX player1_object
GetCurrentActionType player1_object
CMP #$02
BNE notAlreadyAttacking
JMP doneAttacking
notAlreadyAttacking
;;; don't attack if already attacking.
;;; do we have to check for hurt here?
;;;;; Here, we WOULD create melee
ChangeObjectState #$02, #$02
LDA Object_movement,x
AND #%00001111
STA Object_movement,x
LDA #$00
STA Object_h_speed_hi,x
STA Object_h_speed_lo,x
STA Object_v_speed_hi,x
STA Object_v_speed_lo,x
LDA Object_x_hi,x
STA temp
LDA Object_y_hi,x
STA temp1
LDA Object_movement,x
AND #%00000111
STA temp2
AND #%00000010 ;; this will be 0 on up and down, but 1 on left right
BNE createLRmelee
LDA temp2
TAY
LDA temp
SEC
SBC #$08 ;; width of weapon
CLC
ADC weaponOffsetTableX,y
STA temp
LDA temp1
SEC
SBC #$10
CLC
ADC weaponOffsetTableY,y
STA temp1
CreateObject temp, temp1, #$01, #$00
JMP meleeCreated
createLRmelee:
LDA temp2
TAY
LDA temp
SEC
SBC #$10 ;; width of weapon
CLC
ADC projOffsetTableX,y
STA temp
LDA temp1
SEC
SBC #$08
CLC
ADC projOffsetTableY,y
STA temp1
CreateObject temp, temp1, #$02, #$00
meleeCreated:
;;;; x is now the newly created object's x.
LDA Object_movement,x
ORA temp2
STA Object_movement,x
PlaySound #sfx_slash
doneAttacking:
RTS
;;000 down
;010 right
;100 up
;110 left
Voilà. I hope to have forgotten nothing