Cutscene (DEF)

From EDukeWiki
Revision as of 03:08, 21 February 2020 by Fox (talk | contribs)
Jump to navigation Jump to search

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

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

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
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.c.

# 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 }