Cutscene (DEF): Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
Jaap (talk | contribs)
Created page with "Have you event wanted to have a cutscene play when you start episode 1-3? You can with a few steps. First you have to define your animations with the DEF Language. In this ex..."
 
mNo edit summary
 
(16 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Have you event wanted to have a cutscene play when you start episode 1-3? You can with a few steps.
{{Under construction}}


First you have to define your animations with the DEF Language. In this example I have defined 3 animations in duke3d.def:
<span {{code}}>'''cutscene''' <ANM file> { [...] }</span>
<pre>


cutscene START0.ANM { delay 10 }
Defines a cutscene file to be played with [[startcutscene]]. The file may be an [[ANM]] or other video format such as IVF.


cutscene START1.ANM { delay 10 }
See also [[animsounds (DEF)|animsounds]], [[EVENT_CUTSCENE]], [[EVENT_PRECUTSCENE]] and [[EVENT_SCREEN]].


cutscene START2.ANM { delay 10 }
== Tokens ==


</pre>
<span {{code}}>'''delay''' <delay></span>


Delay between frames.


The cutscene command is followed by the name of the animation file to play the delay: 10 means the animation will play at 12 fps (120/10 = 12).
<span {{code}}>'''aspect''' <numerator> <denominator></span>
 
The image aspect. Using an aspect of 5:6 the ANM will have an square pixel aspect.
 
<span {{code}}>'''sounds'''</span>
 
DESCRIPTION
 
<span {{code}}>'''forcefilter'''</span>
 
Force texture filtering off
 
<span {{code}}>'''forcenofilter'''</span>
 
Force texture filtering on
 
<span {{code}}>'''texturefilter'''</span>
 
Use the same texture filtering as normal textures
 
==List of animations==
 
These are all the animations that exist by default in Duke Nukem 3D (1.5) and their framerates. All animations are played in sequence with the exception of <code>RADLOGO</code> and <code>DUKETEAM</code>, which only have a single frame and are displayed until the user gives any input. You can see the framerates in the source file [{{EDuke32 source|source/duke3d/src/anim.cpp}} anim.cpp].


You can play the animation using the startcutscene command which takes the number of a quote that contains the name of the animation file to play. In order to trigger the animation we have to use the EVENT_NEWGAME event. I have added the con code below:
{| class="wikitable"
|-
! #
! Name
! Framerate
! Description
|-
| 1
| cineov2
| 120/10 = 12 fps
| Episode 2 ending
|-
| 2
| cineov3
| 120/10 = 12 fps
| Episode 3 ending
|-
| 3
| RADLOGO
| 120/10 = 12 fps
| Duke Nukem 3D logo at the end of Episode 3
|-
| 4
| DUKETEAM
| 120/10 = 12 fps
| Development team with big heads
|-
| 5
| logo
| 120/9 &#x2248; 13.<span style="text-decoration: overline">3</span> fps
| Intro with missile exploding behind the nuke sign
|-
| 6
| vol41a
| 120/14 &#x2248; 8.<span style="text-decoration: overline">571428</span> fps
| Episode 4 intro part 1
|-
| 7
| vol42a
| 120/18 &#x2248; 6.<span style="text-decoration: overline">6</span> fps
| Episode 4 intro part 2
|-
| 8
| vol4e1
| 120/10 = 12 fps
| Episode 4 ending part 1
|-
| 9
| vol43a
| 120/10 = 12 fps
| Episode 4 intro part 3
|-
| 10
| vol4e2
| 120/14 &#x2248; 8.<span style="text-decoration: overline">571428</span> fps
| Episode 4 ending part 2
|-
| 11
| vol4e3
| 120/10 = 12 fps
| Episode 4 ending part 3
|}


<pre>
== Examples ==
onevent EVENT_NEWGAME
{
// Only trigger when we come from the skill select menu
ifvare current_menu 110
{


switch VOLUME
Have you ever wanted to have a cutscene play when you start episode 1-3? You can with a few steps.
{
case 0 // episode 1
redefinequote 254 START0.ANM
startcutscene 254
break
case 1 // episode 2
redefinequote 254 START1.ANM
startcutscene 254
break
case 2 // episode 3
redefinequote 254 START2.ANM
startcutscene 254
break


}
First you have to define your animations with the [[DEF Language]]. In this example I have defined 3 animations in duke3d.def:
endswitch


}
cutscene START0.ANM { delay 10 }
cutscene START1.ANM { delay 10 }
}
cutscene START2.ANM { delay 10 }
endevent
</pre>


This code first checks to see if current_menu is set to 110 (skill select). This is necessary because the event EVENT_NEWGAME is also fired when a saved game is loaded. After this it sets quote 254 to the name of the animation file we want to play. We do this by looking at VOLUME since that contains the number of the selected episode and redefining the quote 254 to the name of the animation we want to play for that episode.
The cutscene command is followed by the name of the animation file to play the delay: 10 means the animation will play at 12 fps (120/10 = 12).


Once quote 254 is set startcutscene is called to start the animation.
You can play the animation using the startcutscene command which takes the number of a quote that contains the name of the animation file to play. In order to trigger the animation we have to use [[EVENT_NEWGAME]]. I have added the con code below:


onevent EVENT_NEWGAME
    // Only trigger when we come from the skill select menu
    ifvare current_menu 110
    {
        switch VOLUME
            case 0 // episode 1
                redefinequote 254 START0.ANM
                startcutscene 254
                break
            case 1 // episode 2
                redefinequote 254 START1.ANM
                startcutscene 254
                break
            case 2 // episode 3
                redefinequote 254 START2.ANM
                startcutscene 254
                break
        endswitch
    }
endevent


Right now we only have an animation. We can add sounds by defining them in the DEF Language again:
This code first checks to see if current_menu is set to 110 (skill select). This is necessary because the event EVENT_NEWGAME is also fired when a saved game is loaded. After this it sets quote 254 to the name of the animation file we want to play. We do this by looking at VOLUME since that contains the number of the selected episode and redefining the quote 254 to the name of the animation we want to play for that episode.


<pre>
Once quote 254 is set, startcutscene is called to start the animation.
// START0.ANM
// frame 1 play DUKE_LOOKINTOMIRROR
// frame 50 play FLY_BY
animsounds START0.ANM { 1 252  50 244 }
</pre>


Right now we only have an animation. We can add sounds by defining them in the DEF Language again:
// START0.ANM
// frame 1 play DUKE_LOOKINTOMIRROR
// frame 50 play FLY_BY
animsounds START0.ANM { 1 252  50 244 }


More information on the [[DEF_Language|DEFS lanuage]]
[[Category:DEF commands]]

Latest revision as of 23:28, 3 August 2021

This page is under construction.
Please help review and edit this page.

cutscene <ANM file> { [...] }

Defines a cutscene file to be played with startcutscene. The file may be an ANM or other video format such as IVF.

See also animsounds, EVENT_CUTSCENE, EVENT_PRECUTSCENE and EVENT_SCREEN.

Tokens

delay <delay>

Delay between frames.

aspect <numerator> <denominator>

The image aspect. Using an aspect of 5:6 the ANM will have an square pixel aspect.

sounds

DESCRIPTION

forcefilter

Force texture filtering off

forcenofilter

Force texture filtering on

texturefilter

Use the same texture filtering as normal textures

List of animations

These are all the animations that exist by default in Duke Nukem 3D (1.5) and their framerates. All animations are played in sequence with the exception of RADLOGO and DUKETEAM, which only have a single frame and are displayed until the user gives any input. You can see the framerates in the source file anim.cpp.

# Name Framerate Description
1 cineov2 120/10 = 12 fps Episode 2 ending
2 cineov3 120/10 = 12 fps Episode 3 ending
3 RADLOGO 120/10 = 12 fps Duke Nukem 3D logo at the end of Episode 3
4 DUKETEAM 120/10 = 12 fps Development team with big heads
5 logo 120/9 ≈ 13.3 fps Intro with missile exploding behind the nuke sign
6 vol41a 120/14 ≈ 8.571428 fps Episode 4 intro part 1
7 vol42a 120/18 ≈ 6.6 fps Episode 4 intro part 2
8 vol4e1 120/10 = 12 fps Episode 4 ending part 1
9 vol43a 120/10 = 12 fps Episode 4 intro part 3
10 vol4e2 120/14 ≈ 8.571428 fps Episode 4 ending part 2
11 vol4e3 120/10 = 12 fps Episode 4 ending part 3

Examples

Have you ever wanted to have a cutscene play when you start episode 1-3? You can with a few steps.

First you have to define your animations with the DEF Language. In this example I have defined 3 animations in duke3d.def:

cutscene START0.ANM { delay 10 }
cutscene START1.ANM { delay 10 }
cutscene START2.ANM { delay 10 }

The cutscene command is followed by the name of the animation file to play the delay: 10 means the animation will play at 12 fps (120/10 = 12).

You can play the animation using the startcutscene command which takes the number of a quote that contains the name of the animation file to play. In order to trigger the animation we have to use EVENT_NEWGAME. I have added the con code below:

onevent EVENT_NEWGAME
    // Only trigger when we come from the skill select menu
    ifvare current_menu 110
    {
        switch VOLUME
            case 0 // episode 1
                redefinequote 254 START0.ANM
                startcutscene 254
                break
            case 1 // episode 2
                redefinequote 254 START1.ANM
                startcutscene 254
                break
            case 2 // episode 3
                redefinequote 254 START2.ANM
                startcutscene 254
                break
        endswitch
    }
endevent

This code first checks to see if current_menu is set to 110 (skill select). This is necessary because the event EVENT_NEWGAME is also fired when a saved game is loaded. After this it sets quote 254 to the name of the animation file we want to play. We do this by looking at VOLUME since that contains the number of the selected episode and redefining the quote 254 to the name of the animation we want to play for that episode.

Once quote 254 is set, startcutscene is called to start the animation.

Right now we only have an animation. We can add sounds by defining them in the DEF Language again:
// START0.ANM
// frame 1 play DUKE_LOOKINTOMIRROR
// frame 50 play FLY_BY
animsounds START0.ANM { 1 252  50 244 }