Cutscenes

From CloudModding OoT Wiki
Jump to: navigation, search

Finding Cutscenes

There are a few ways that you can locate a cutscene.

Cutscene Pointer

You can always find the start of a cutscene in memory by watching the cutscene pointer with a memory viewer. It's located at 80213D88 in the Debug Rom, and 801CA208 in v1.0. Be aware that the cutscene pointer does not null itself once the cutscene has finished playing, but as long as you don't leave the immediate area this won't be an issue.

Scenes

Many, but not all, cutscenes are stored within scene files. These are either referenced directly from the scene header, or by a table in code that triggers a cutscene on entering from a specific entrance.

Header References

The main scene header can contain a command (the 0x18 command) that defines extra headers for the purpose of creating different variations of the same scene. Some of these extra headers exist with the purpose of playing a single cutscene. This is done by defining the 0x17 command, which in turn points to the start of the cutscene header by a segment offset.

The main header and thee first three alternate headers (if they exist) will never define the 0x17 command, as they are reserved as being playable setups (typically they define up to 4 combinations of day/night child/adult variations).

See Scenes and Rooms for more information on the header commands.

Entrance Cutscenes

For more information, see Entrance Cutscenes.

Cutscene Commands

Cutscenes begin with a simple 8 byte header of the following form:

/*0x00*/ int Commands; // number of commands in the cutscene. 
/*0x04*/ int EndFrame; // Last frame of the cutscene.

Notes:

  • If the number of commands or end frame variables are negative, the cutscene will not be parsed, and normal play will resume.
  • Other commands can (and typically will) terminate the cutscene before the end frame is reached.

Following that are the cutscene commands. Every command is at least 8 bytes long. Valid commands are 0x01-0x90, 0x3E8, and -1

Marker Description Variables Usage Notes
00000001 Camera Positions wwwwxxxx yyyyzzzz w = ?
x = start frame
y = end frame
z = ?
Combine with 0002 command
Position List wwrr0000 aaaaaaaa

xxxxyyyy zzzz0000

w = FF on last entry, 00 for more entries
r = camera roll (signed byte, unused)
a = angle of view in degrees (float, unused)
x y z = x,y,z position
Combine with 0002 command entry
00000002 Camera Focus Points wwwwxxxx yyyyzzzz w = ?
x = start frame
y = end frame
z = ?
Combine with 0001 command
Focus Point List wwrrffff aaaaaaaa

xxxxyyyy zzzz0000

w = 00 for more entries, FF for last entry
r = Camera Roll (signed byte). Positive rotates image clockwise.
f = frames to reach the next point
a = angle of view in degrees (float)
x y z = x,y,z position
Combine with 0001 command entry
00000003 Special Execution 00000001
Actor Path
struct
See Actor Path for variable usage, and Actor Entity 0003 for actions
00000005 Camera Positions
Relative to Link
wwwwxxxx yyyyzzzz w = ?
x = start frame
y = end frame
z = ?
Combine with 0006 command
Position List wwrrffff aaaaaaaa

xxxxyyyy zzzz0000

w = 00 for more entries, FF for last entry
r = Camera Roll (signed byte). Positive rotates image clockwise.
f = frames to reach the next point
a = angle of view in degrees (float)
x y z = x,y,z position
Combine with 0006 command entry
00000006 Camera Focus Points
Relative to Link
wwwwxxxx yyyyzzzz w = ?
x = start frame
y = end frame
z = ?
Combine with 0005 command
Focus Point List wwrrffff aaaaaaaa

xxxxyyyy zzzz0000

w = 00 for more entries, FF for last entry
r = Camera Roll (signed byte). Positive rotates image clockwise.
f = frames to reach the next point
a = angle of view in degrees (float)
x y z = x,y,z position
Combine with 0005 command entry
00000009 Unknown 0000xxxx x = Entries
Unknown 0009 Entry aaaabbbb ccccdddd
eeeeffff
a = ?
b = Frame Start?
c = Frame End?
d = ?
e = ?
f = ?, possibly padding
00000013 Textbox 0000xxxx x = Entries End Frame waits for text/action to finish before continuing cutscene. The frame counter will be stopped at one less than the End Frame value
No Text FFFFssss eeeeFFFF

FFFFFFFF

s = start frame
e = end frame
Display Text iiiissss eeeeoooo

yyyynnnn

i = message id
s = start frame
e = end frame
o = Type. Set 0 for standard dialog, 1 for yes/no branching dialog
y = yes/no top option branch
n = yes/no bottom option branch
Learn
Song
iiiissss eeee0002

mmmmFFFF

i = Ocarina Song Action
s = start frame
e = end frame
m = message id displayed when making a mistake. 088B is used here.
0000002D Scene Transition Effects 00000001 xxxxyyyy

zzzz[zzzz]

00000001 = constant?
x = transition (probably the same as entrance/exit transitions)
y = start frame
z = end frame (seems to be repeated)
000003E8 Cutscene Terminator
Asm execution
00000001 xxxxyyyy

zzzz[zzzz]

00000001 = constant?
x = jump table index for asm execution, range 0x01 to 0x77
y = start frame
z = end frame (seems to be repeated)
The jump table is located at 8013AF78 in the Debug Rom. The addresses in the jump table point to the machine code that executes after the cutscene. Used for setting the next entrance/cutscene, giving items, toggling Link's age.
FFFFFFFF Cutscene Terminator 00000000 Commands beyond this one will not be parsed, even if the number of commands is higher
0000aaaa Actor Command 0000yyyy a = Marker, where a relates to a specific actor.
y = Number of entries.
Marker values are NOT the same numbers used to load an actor in a room.
Actor Path aaaabbbb ccccdddd
???????? eeeeeeee
ffffffff gggggggg
hhhhhhhh iiiiiiii
jjjjjjjj kkkkkkkk
llllllll mmmmmmmm
a = Actor Action/Animation
b = Start frame for path.
c = End frame for path.
d = ?
e f g = Path start vertex coordinate (x,y,z)
h i j = Path end vertex coordinate (x,y,z)
k l m = Vertex normal for the path, single precision floats.

Ocarina Song Action Ids

Value Purpose
01 Can free play Ocarina (why?)
02 Sheik plays Minuet of Forest
03 Sheik plays Bolero of Fire
04 Sheik plays Serenade of Water
05 Sheik plays Requiem of Spirit
06 Sheik plays Nocturne of Shadow
07 Sheik plays Prelude of Light
08 Saria plays Saria's Song
09 Malon sings Epona's Song
0A Impa whistles Zelda's Lullaby
0B Stone teaches Sun's Song
0C Zelda plays Song of Time
0D Guru-Guru plays Song of Storms
0E  ?
0F Play back Minuet (Gives song if successful)
10 Play back Bolero (Gives song if successful)
11 Play back Serenade (Gives song if successful)
12 Play back Requiem (Gives song if successful)
13 Play back Nocturne (Gives song if successful)
14 Play back Prelude (Gives song if successful)

Actor Entities

Marker Actor Action Param (v)
0003 Deku Tree 000B Tree dies
Earthquake Camera Effect 0010 begin shaking
0011 end shaking
Lake Hylia Water 0015 Lake Hylia water rises
Title Logo (0171) 001E fades in logo
001F fades out logo
0004 Set Environment Setting 0001 is first environment setting, etc.
000A Link (0000) See Link Action Parameters below
0027 Rauru 0003 Raise hands (giving Light Medallion)
0028 Saria 0003 Raise hands (giving Forest Medallion)
0029 Darunia 0003 Raise hands (giving Fire Medallion)
002A Ruto (Adult) 0001 Hide under the ground
0002 Rise out of the ground
0003 Raise hands (giving Water Medallion)
003E Navi (0018) 0003 Bounces up and down in a rhythmic pattern
003D Path/animation for something
0055 Princess Zelda (Adult) 0001 Invisible, for Sheik transformation
0002 Idle
0003 Walking
0056 Music Changer Song to play = (v - 1)
007C Music Fade Out 0003 = ?
0004 Default Value
Duration sets fade length?, max 255 frames?

Link Action Parameters

0001 Walk cycle?
0003 Shocked
0006 Turn around and look up in shock
0007 Look at hands, as if an item was in them
0008 Raise hands as if lifting an item
0009 Put down hands
000A Get off ground and brush off
000D Floating down from crystal
000E Look at self
000F Get wrecked
0010 pick self up
0011 pull ocarina (puts ocarina model in hand)
0012 hold item at side?
0013 turn and lift item (chests)
0015 different blinking pattern?
0016 squint? (possibly Zora Sapphire cutscene)
0017 fall off the log (Zora Sapphire cutscene)
0018 Surface water, idle swimming
0019 Receive Zora Sapphire in water
001A Draw sword defensively (Ganondorf encounter, kokiri sword model in hand)
001B Knocked to the ground?
001C Sleeping on bed
001D Sleeping Roll over
001E Wake up
001F Nod, get off the bed
0020 Struck by Ganondorf's attack (Zelda Escape)
0021 Get up, look to left
0027 Look up to the sky
0028 Slowly back up a few steps
0029 Put hands on surface (Zelda's Crystal?)
002A Pull out sword/shield
002B Run up to Zelda's Crystal and put hands on
002C Pound on Zelda's Crystal
002D Look up, watching Zelda's Crystal rise
002E Turn around
002F Lower hand (after 0030)
0030 Shield Eyes (Zelda->Sheik)
0031 Look around
0032 Stepping onto Rainbow Bridge
0034 Get down on one knee, Bongo Shadow Cutscene? (sword/shield need to be put into hands)
0035 Lying flat on the ground
0036 Pick self up after 0035, shake head
0037 Shield out, sword drawn back in spin attack stance (stiff knees), (sword/shield need to be put into hands)
0038 Idle standing, precedes 0039
0039 Give up Ocarina of Time (need ocarina in hand)
003A Take hand away from Ocarina of Time
003C Lifted up by blue warp
003D Look around at surroundings
003E Learn Ocarina Song
003F Return to neutral stance after 003E
0044 Look right, happy (Look to Zelda after Tower Collapse
0045 Look up, happy (look to Navi after Tower Collapse
0046 Stand alert, not happy (loud noise after Tower Collapse
0047 Spin attack stance, animated rocking (need Sword/Shield in hand)
0048 Play with sword (reverts to animation 0047 after for some reason)
004A Flashing red, launched forward to the ground, get up
004B Look to the sky, surprised look
004C Notice tremor, ground shaking
004D Pull Master Sword, Ganon Fight?

Exit Parameters

Register States

S0 = Global Context
V1 = Save Data Context

^^ Merged some information from a few posts by Twili and xdaniel on the GCN

Position Tweening Algorithm

The following formula is known to work for Cameras. Actor positioning may be different.

In order to tween between points, a minimum of 4 points is required.

tween = 
  p0 * (1 - t)^3/6 
+ p1 * (t^3/2 - t^2 + 2/3)
+ p2 * (-t^3/2 +  t^2/2 + t/2 + 1/6)
+ p3 * (t^3/6)

Hard-Coded Stuff

The sound-effect triggers for various actions are hard-coded to trigger on a specific frame. Some examples:

  • All of the medallion's "flash" sfxs
  • Deku Tree's death
  • Probably the rumbling sfx when the Ganondorf attacks the Temple of Time

Minor facial expression changes are hard-coded as well. Some examples:

  • Darunia's face while pounding Link into the ground during the Goron Ruby cutscene

Relevant Actors