Scenes and Rooms

From z64 wiki
Revision as of 10:17, 4 July 2013 by Spinout (talk | contribs) (i'll add more later)
Jump to: navigation, search

Todo: Intro


Command Description Variables Usage Found in
0x00 Defines the start positions list 00xx0000 yyyyyyyy x is the number of start positons
y is the offset of that list (including the bank). Follows the actors list format.
0x01 Defines the actor list 01xx0000 yyyyyyyy x is the number of actors
y is the offset of that list (including the bank). Follows the actors list format.
0x02 Cameras used by 0x1B command (MM only?) 02xx0000 yyyyyyyy x is the number of entries, y is the offset of the entries (including the bank). Follows #Camera Entries format Unknown
0x03 Defines the collision header 03000000 yyyyyyyy y is the offset of the collision header (including the bank). Follows the collision format. scenes
0x04 Defines the maps 04xx0000 yyyyyyyy x is the number of maps
y is the offset of the map list (including the bank). Follows the map list format.
0x05 Unknown Unknown Used in Gerudo Fortress v1.0 Maps?
0x06 Defines the entrance index 06000000 yyyyyyyy The number of entrances is undefined, though it is usually equal to the number of start positions (see below) (that the entrance table accesses)
y is the offset of that list (including the bank). Follows the entrance index format.
0x07 Special objects 07??0000 0000xxxx x is the object to use for the map, either gameplay_field_keep (object 0x0002) or gameplay_dangeon_keep (object 0x0003)
Posted on z64 by xdaniel
0x08 Map behavior 08xx0000 0000yyzz x affects Sun's Song, backflipping with A

y is unknown

z affects Link's idle animation OR makes the map "Too Hot"
0x09 Unknown Unknown Unknown Unknown
0x0A Defines the mesh 0A000000 yyyyyyyy y is the offset of the mesh header (including the bank). Follows the mesh header format. maps
0x0B Defines the object list 0Bxx0000 yyyyyyyy x is the number of objects
y is the offset of the object list (including the bank). Follows the object list format.
0x0C Unknown Unknown Unknown Unknown
0x0D Pathways 0D000000 yyyyyyyy y is the offset of the path list (including the bank). Follows the path list format.
Documented by xdaniel
0x0E Defines the transition actor list 0Exx0000 yyyyyyyy x is the number of transition actors
y is the offset of that list (including the bank). Follows the transition actors list format.
0x0F Defines the environment settings 0Fxx0000 yyyyyyyy x is the number of environment settings
y is the offset of that list (including the bank). Follows the environments list format.
0x10 Time settings 10000000 xxxxyy00 x = start time (0xFFFF = current game time)
y = time speed (signed), default 0xA.
0x11 Skybox settings 11000000 xx000y00 x = Skybox number (see the skybox list)
y = disable if not 0
0x12 Skybox modifier 12000000 xx000000 Allows skyboxes to be enabled in some rooms of a scene but disabled in others.
x = disable sky if not 0 (some backgrounds still appear)
0x13 Defines the exit list 13000000 yyyyyyyy y is the offset of the exit list (including the bank). Follows the exit list format. scenes
0x14 End marker 14000000 00000000 Signals the end of the header scenes and maps
0x15 Sound settings 15xx0000 0000yyzz x = reverb
y = music playback option, 0x13 = always playing
z = track to play
0x16 Sound settings 16000000 000000xx x = echo maps
0x17 Cutscenes (OoT) 17000000 xxxxxxxx x = offset of cutscene data (including the bank). Follows the cutscene data format. scenes
(MM) 17xx0000 yyyyyyyy x = Number of cutscenes. y = offset of cutscene data (including the bank). Follows the MM cutscene format. scenes
0x18 Alternate headers 18000000 xxxxxxxx x = offset of alternate header list (including the bank). Follows the alternate header list format. scenes and maps
0x19 Camera Settings and World Map 19xx0000 000000yy x = Affects camera movement
y = Sets what location of the world map to highlight.
See camera settings
Commands beyond 0x19 are used in Majora's Mask only.
Command Description Variables Usage Found in
0x1A Unknown 1A000000 xxxxxxxx Unknown scenes
0x1B Unknown 1Bxx0000 yyyyyyyy Unknown scenes
0x1C Unknown 1C000000 xxxxxxxx Unknown scenes
0x1D Unknown Unknown Unknown Unknown
0x1E Unknown 1Exx0000 yyyyyyyy Unknown scenes

Actors List

aaaaxxxx yyyyzzzz ppppwwww rrrrvvvv (repeats for each actor)
a = Actor number
x = Position on x-axis
y = Position on y-axis
z = Position on z-axis
p = Rotation around x-axis
w = Rotation around y-axis
r = Rotation around z-axis
v = initialization variable sent to actor
If the actor is link, use 0 for a and 0xFFF for v

Maps List

Each map is two pointers, start and end, which game searches for in the file system. Format:
ssssssss eeeeeeee (repeats for each map)
s = Map (virtual) start address.
e = Map (virtual) end address.

Map Behavior

08xx0000 0000yyzz


00 - No effect/restrictions
01 - Prevents the Sun's Song time effect.
02 - Disables jumping through the action button.
05 - ??? (Used only in boss rooms)

yy - Unknown. 01 in Shadow Temple maps 0, 2, 00 in Map 1

zz - Sets extra idle animation OR makes the map too hot without the Goron Tunic

00 - Link tends to stand in place and glance back at the player
01 - Link's cold sneeze
02 - Link wipes his head
03 - Triggers the Heat timer! Camera seems to move in and out rapidly, and ever so slightly for the "heat" effect
04 - Link stretches and yawns?
06 - ?
07 - Bends over and gasps for breath
09 - Brandishes sword even if not equipped
0A - Re-adjusts his tunic?
FF - Link hops on Epona (even as a child)

Entrance Index

This is how the game chooses which map and which entrance of the start positions list to use based off of the entrance called by the exit table.
ppmm (repeats for each entry)
p = Which start position to use, defined by the start positions list (command 0x00) for the scene
m = Which map to load for this entrance

Mesh Header

ttcc0000 ssssssss eeeeeeee
t = type (see below)
c = number of entries
s = start of the entries
e = end of the entries

Mesh type 0

Simple mesh format; render all display lists specified. Format:
xxxxxxxx (repeats for each entry)
Where x is the offset (including the bank) of the display list to render.

Mesh type 1

This format uses the header slightly differently. e is not the end of the entries, but the ROM address of the JFIF image within the map. Following e are 0x14 unknown bytes, perhaps bounds of some sort. At the offset given by s are the display lists, in the same format as mesh type 0.

Mesh type 2

Mesh that clips if the player is not within certain bounds. Format:
aaaabbbb ccccdddd xxxxxxxx yyyyyyyy (repeats for each entry)
a and b = X and Z maximum player coordinates to render first display list from,
c and d = X and Z minimum player coordinates to render first display list from,
x = first (close) display list. Set to 0 if unused.
y = second (far) display list. Set to 0 if unused.

Object List

Each entry is a two-byte entry of the object number, of the game's object list. Objects are required to load any actors that are not object 1 or object 2 (if the area is not a dungeon) or object 3 (if the area is a dungeon).

Path List

Actors which have a "route" to follow, such as the carpenters or the graveyard boy, do not have the route hard-coded within them. Instead, the points which they make straight lines to are mapped out in a list. That is, a point is marked at every turning point, and they follow straight lines between the turning points. The data pointed to by the scene header is a list of:
aa000000 llllllll (repeats for each path)
a is the number of points for the given path, and
l is the location of the first point of the path
The path pointer list at offset l has a entries, each consisting of:
xxxx yyyy zzzz (repeats for each point of path)
x, y, and z are the (signed) coordinates of the specific point on the path.

xdaniel figured this out while working on SayakaGL, and the information was verified by spinout by reversal of a function which reads the data. (Graveyard boy @ func_809E1E90) (SayakaGL Implementation)

Transition Actors

Scene actors change the room that is loaded.  They usually don't have their own collision, it must be part of the collision specified by the collision command in the scene header. Format:
ffmmbbnn aaaaxxxx yyyyzzzz wwwwvvvv (repeats for each transition actor)
f = Room to switch to when triggered from the front of the object (for doors, the front has the knob on the right)
m = How the camera reacts during the front transition (effects depend on actor, best to experiment; recommended are 0, 0F, and FF)
b = Room to switch to when triggered from the back of the object
n = How the camera reacts during the back transition
a = Actor Number
x = Position along x-axis
y = Position along y-axis
z = Position along z-axis
w = Y rotation
v = actor variable

Environments list

gggggghh hhhhiiii iijjjjjj kkkkkkll llllmmmm nnnn (repeats for each environment type)
g - k = unknown colors (format RRGGBB), usually 0x462D39, 0x494949, 0xB49A8A, 0xB7B7B7, 0x14143C
l = fog color (same format)
m = fog distance
n = draw distance

Exit List

Each entry is a two-byte exit number, from the game's exit list. The length of the list is undefined, the engine assumes all indexes within the list which it asks for exist.


MM Cutscene Data

xxxxxxxx yyyyuutt
xx = Offset of cutscene data
yy = Exit
uu = Entrance cutscene activates at
tt = Event flag

Cutscene Header
xxxxxxxx yyyyyyyy
xx = Number of markers
yy = Length (Frames)

Small list of cutscene markers:

0000000A Text
0000005A Camera data
00000066 Zelda
00000070 Epona
00000078 Romani
00000082 Happy mask man
00000096 Sound effects?
00000097 ???
00000098 Screen Transition
00000099 Motion blur?
0000009B ???
0000009C ???
000000C8 Link
000000C9 Tatl
0000012C Play song
0000015E End Cutscene

The formats for these markers should be the same as they are in OoT, except for the camera data.

Alternate Header List

Each entry is the offset (including bank) of the alternate headers for the current map/scene. The number of alternate headers is undefined, but there must be a minimum of three alternate header records, one for all four combination of day/night child/adult when you add in the main header.

Camera Settings

19xx0000 000000yy

xx sets restrictions on both camera movement and c-up camera usage.

00 is used in scenes which don't rely on pre-rendered environments, and have free c-up camera control.
10 is used with shop scenes, which have a fixed camera that switch between two views, and no c-up option
20 is used in scenes which have pre-rendered backgrounds that can rotate, where pressing c-up gives you a bird eye view.
30 is used in scenes which have pre-rendered backgrounds that are fixed, no c-up option.
40 is used in scenes which have a pre-rendered backgrounds that rotate, but have no c-up option. 
50 is used in the shooting gallery.

For more details on skybox camera attributes, see collision camera data.

yy sets the scene's location on the world map.

00 Hyrule Field / not applicable
01 Kakariko
02 Grave
03 Zora River
04 Kokiri Forest
05 Sacred Forest Meadow
06 Lake Hylia
07 Zora's Domain
08 Zora's Fountain
09 Gerudo Valley
0A Lost woods
0B Desert Colossus
0C Gerudo Fortress
0D Haunted Wasteland
0E Market
0F Hyrule castle
10 Death Mountain Trail
11 Death Mountain Crater
12 Goron City
13 Lon Lon Ranch
14 ? (Windmill/Dampe's Grave)
15 Ganon's Castle
16+ Undefined


spinout, jsa, cendamos, MNGoldenEagle, xdaniel, fkualol probably others