Language…
19 users online: 1337doom, AbuseFreakHacker,  AmperSam, Beed28,  BeeKaay, ben15420, Doopu, Gorry, Green, Mecke1990, OrangeBronzeDaisy, Pink Gold Peach, playagmes169, rafaelfutbal, signature_steve, Skewer, TrashCity, wye,  YouFailMe - Guests: 279 - Bots: 337
Users: 64,795 (2,370 active)
Latest user: mathew

SM64 Geometry Layout Commands

These scripts point to the display lists, with properties and displacements applied.

Drawing Layers:
00=Unused
01=Entirely Solid
02=Unused
03=Unused
04=Transparent pixels, no semi transparency. Allows perfect layering with other transparencies around it.
05=Semi transparency enabled. Layering must be handled with the order of drawn faces.
06=Semi transparency enabled. Layering must be handled with the order of drawn faces. This layer is always drawn behind layer 05, usually for shadows.






0x01 - TERMINATE GEOMETRY LAYOUT
The ending command to close.
Usage:
0100 0000






0x02 - BRANCH GEOMETRY LAYOUT
Branches the current geo layout to another area within a RAM bank.
Syntax:
0201 0000 aabbbbbb
aa- RAM Bank
bbbbbb- Address






0x03 - END BRANCH
Ends the current geometry layout branch and returns to the area following the 0x02 command.
Usage:
0300 0000






0x04 - OPEN NODE
If you don't understand nodes, this is basically like a sub-folder. Command is 4 bytes long.
Usage:
04000000






0x05 - CLOSE NODE
Used at the end of the data within the opened node. Command is 4 bytes long.
Usage:
05000000






0x0B - START GEO LAYOUT
Starts geometry layout with no parameters whatsoever. Seems to use a pre-set render area.
Usage:
0B000000






0x0E - SWITCH CASE
Loads ASM in RAM that switches between the receding display lists within the node.
Syntax:
0E00 00aa 8029DB48
aa- Number of cases/display lists, starting at 01.

Example:
0E00 0002 8029DB48
Switches between the next 2 display lists, could be used for blinking.






0x13 LOAD DISPLAY LIST WITH POSITION OFFSET
Loads display list with drawing layer and offsets the model on X/Y/Z axis. Command is 12 bytes long.
Syntax:
13aabbbbccccddddeeffffff
aa- Drawing layer
bbbb- Offset on X axis (16-bit coordinates)
cccc- Offset on Y axis (16-bit coordinates)
dddd- Offset on Z axis (16-bit coordinates)
ee- RAM Bank
ffffff- Address

Example:
1301 0000 008A 0000 0E 000A90
Loads a display list from 0xA90 in RAM Bank 0E as a solid model, and offsets it by 0x8A (138 coordinates) on the Y axis.






0x14 - BILLBOARD MODEL
Billboards the model without needing the use of 0x21 in the behaviour script. Command is (uselessly) 8 bytes long.
Usage:
1400 0000 0000 0000






0x15 - LOAD DISPLAY LIST
Loads display list with drawing layer and no other properties. Command is 8 bytes long.
Syntax:
15aa0000bbcccccc
aa- Drawing Layer
bb- RAM Bank
cc- Address

Example:
15 04 0000 04 00B090
Loads display list on layer 04 (Transparent pixels) in 0xB090 of bank 04.






0x16 - START GEOMETRY LAYOUT WITH SHADOW
Used at start of the geo layout, with shadow type, solidity, and size. Command is 8 bytes long.
Syntax:
160000aa00bbcccc
aa- Shadow type
bb- Shadow solidity (00=Invisible, FF=Black)
cccc- Shadow scale






0x18 - LOAD POLYGONS IN RAM
Used in some original objects to point to ASM in RAM, for misc. effects such as vertex rippling. Command is 8 bytes long.
Syntax:
1800000080aaaaaa
aaaaaa- RAM Address






0x1D - SCALE MODEL UNIFORMLY
Scales the receding data uniformly. Command is 8 bytes long.
Syntax:
1Daaaaaaaaaaaaaa






0x20 - START GEO LAYOUT WITH RENDER AREA
Starts the geometry layout with no shadow and a render area.
Syntax:
2000 aaaa
aaaa- Render distance?


If there are any questions or suggestions, please don't be shy. There may have been things that I didn't explain correctly, and there are definitely things that I missed.
Some additional asm info for anyone interested

In ram geo layouts, the switch case (0E) command is like this:

010C0001 800F8ABC 800F8ABC 800F8AA4 800F8ADC 8029DB48 00000000 00080004

>command
>command pointers
>asm function (case selector)
>unused?
>case count
>selected case provided by the asm function

When a case selector function is executed, a skip option is passed to A0 and a pointer to the command is passed to A1.


Very basic function format in pseudo code:
Code
a_case_selector(A0 = bool dontskip, A1 = pointer cmd_ptr){
  if(dontskip != 1) return 0;
  *(uint16*)(cmd_ptr + 0x1E) = (desired case);
  return 0;
}
[02] [01 00 00] [0E] [00 0B F0]

[1]: 02= Jumps to address in segment, continue decoding from there.
[2,3,4]:??
[5]: Segment number
[6,7,8]: Offset in segment

------------------------------------

[03] [00 00 00]
[1]: 03= Jumps back to after where the last 0x02 jump command was called
[2,3,4]: Always 00
Added those in, Kaze, thanks for the clear explanation.