This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
super_mario_64:level_commands [2018/03/09 18:10] trenavix created |
super_mario_64:level_commands [2020/11/21 15:10] (current) jesusyoshi54 text formating |
||
---|---|---|---|
Line 3: | Line 3: | ||
The level commands define the top-level control of the game. They are used to load levels, textures, collision data, objects, warps, etc. and determine how everything is connected. The first byte of the level command is the command type and the second byte is the length of the command in bytes. | The level commands define the top-level control of the game. They are used to load levels, textures, collision data, objects, warps, etc. and determine how everything is connected. The first byte of the level command is the command type and the second byte is the length of the command in bytes. | ||
- | ''[<color darkred>CC</color>] [<color darkgreen>LL</color>] ...'' | + | ''[<color red>CC</color>] [<color green>LL</color>] ...'' |
- | | <color darkred>C</color> | Command type (full list below) | | + | | <color red>C</color> | Command type (full list below) | |
- | | <color darkgreen>L</color> | Length of command in bytes (including <color darkred>CC</color> and <color darkgreen>LL</color>) | | + | | <color green>L</color> | Length of command in bytes (including <color red>CC</color> and <color green>LL</color>) | |
- | ===== Level Layout Commands ===== | + | |
+ | ---- | ||
==== 00: Load Raw Data and Jump ==== | ==== 00: Load Raw Data and Jump ==== | ||
Loads raw data to RAM segment and jumps to segment offset. Used for loading level scripts and then jumping to an offset in them | Loads raw data to RAM segment and jumps to segment offset. Used for loading level scripts and then jumping to an offset in them | ||
- | ''00 10 00 [<color darkred>XX</color>] [<color darkgreen>YY YY YY YY</color>] [<color darkblue>ZZ ZZ ZZ ZZ</color>] [<color purple>AA AA AA AA</color>]'' | + | ''00 10 00 [<color red>XX</color>] [<color green>YY YY YY YY</color>] [<color aqua>ZZ ZZ ZZ ZZ</color>] [<color fuchsia>AA AA AA AA</color>]'' |
- | | <color darkred>X</color> | RAM segment number | | + | | <color red>X</color> | RAM segment number | |
- | | <color darkgreen>Y</color> | ROM address start | | + | | <color green>Y</color> | ROM address start | |
- | | <color darkblue>Z</color> | ROM address end | | + | | <color aqua>Z</color> | ROM address end | |
- | | <color purple>A</color> | Segment offset of jump target | | + | | <color fuchsia>A</color> | Segment offset of jump target | |
---- | ---- | ||
Line 24: | Line 25: | ||
Load raw data to RAM segment and jump to segment offset. The only difference between this command and 0x00 is a call to 0x80278498 | Load raw data to RAM segment and jump to segment offset. The only difference between this command and 0x00 is a call to 0x80278498 | ||
- | ''01 10 00 [<color darkred>XX</color>] [<color darkgreen>YY YY YY YY</color>] [<color darkblue>ZZ ZZ ZZ ZZ</color>] [<color purple>AA AA AA AA</color>]'' | + | ''01 10 00 [<color red>XX</color>] [<color green>YY YY YY YY</color>] [<color aqua>ZZ ZZ ZZ ZZ</color>] [<color fuchsia>AA AA AA AA</color>]'' |
- | | <color darkred>X</color> | RAM segment number | | + | | <color red>X</color> | RAM segment number | |
- | | <color darkgreen>Y</color> | ROM address start | | + | | <color green>Y</color> | ROM address start | |
- | | <color darkblue>Z</color> | ROM address end | | + | | <color aqua>Z</color> | ROM address end | |
- | | <color purple>A</color> | Segment offset of jump target | | + | | <color fuchsia>A</color> | Segment offset of jump target | |
---- | ---- | ||
Line 43: | Line 44: | ||
Set flag to 0, delay X frames, set flag to 1. Sets s16 flag (8038BE20) to 0 before delay and 1 after. Does not increment level script pointer until after delay. | Set flag to 0, delay X frames, set flag to 1. Sets s16 flag (8038BE20) to 0 before delay and 1 after. Does not increment level script pointer until after delay. | ||
- | ''03 04 [<color darkred>XX XX</color>]'' | + | ''03 04 [<color red>XX XX</color>]'' |
- | | <color darkred>X</color> | number of delay frames | | + | | <color red>X</color> | number of delay frames | |
---- | ---- | ||
Line 55: | Line 56: | ||
Does not increment level pointer until after delay. | Does not increment level pointer until after delay. | ||
- | ''04 04 [<color darkred>XX XX</color>]'' | + | ''04 04 [<color red>XX XX</color>]'' |
- | | <color darkred>X</color> | number of delay frames | | + | | <color red>X</color> | number of delay frames | |
---- | ---- | ||
Line 64: | Line 65: | ||
Jump to level script at segmented address. | Jump to level script at segmented address. | ||
- | ''05 08 00 00 [<color darkred>XX XX XX XX</color>]'' | + | ''05 08 00 00 [<color red>XX XX XX XX</color>]'' |
- | | <color darkred>X</color> | segmented address of jump | | + | | <color red>X</color> | segmented address of jump | |
---- | ---- | ||
Line 74: | Line 75: | ||
Similar to 05, but also pushes current place on script stack so it can be popped later. | Similar to 05, but also pushes current place on script stack so it can be popped later. | ||
- | ''06 08 00 00 [<color darkred>XX XX XX XX</color>]'' | + | ''06 08 00 00 [<color red>XX XX XX XX</color>]'' |
- | | <color darkred>X</color> | segmented address of jump | | + | | <color red>X</color> | segmented address of jump | |
---- | ---- | ||
Line 91: | Line 92: | ||
This command is never used in any of the level scripts. | This command is never used in any of the level scripts. | ||
- | ''08 04 [<color darkred>XX XX</color>]'' | + | ''08 04 [<color red>XX XX</color>]'' |
- | | <color darkred>X</color> | 16 bit value pushed on script stack after current address | | + | | <color red>X</color> | 16 bit value pushed on script stack after current address | |
---- | ---- | ||
Line 118: | Line 119: | ||
This command is only used once in main level scripts. | This command is only used once in main level scripts. | ||
- | ''0B 08 [<color darkred>XX</color>] 00 [<color darkgreen>YY YY YY YY</color>]'' | + | ''0B 08 [<color red>XX</color>] 00 [<color green>YY YY YY YY</color>]'' |
- | | <color darkred>X</color> | operation, a0 to 8037E1A0 (unsigned 8) | | + | | <color red>X</color> | operation, a0 to 8037E1A0 (unsigned 8) | |
- | | <color darkgreen>Y</color> | argument, a1 to 8037E1A0 (signed 32) | | + | | <color green>Y</color> | argument, a1 to 8037E1A0 (signed 32) | |
^ Operations ^^ | ^ Operations ^^ | ||
Line 138: | Line 139: | ||
If result of operation is true, jumps to segmented address. | If result of operation is true, jumps to segmented address. | ||
- | ''0C 0C [<color darkred>XX</color>] 00 [<color darkgreen>YY YY YY YY</color>] [<color darkblue>ZZ ZZ ZZ ZZ</color>]'' | + | ''0C 0C [<color red>XX</color>] 00 [<color green>YY YY YY YY</color>] [<color aqua>ZZ ZZ ZZ ZZ</color>]'' |
- | | <color darkred>X</color> | operation, a0 to 8037E1A0 (unsigned 8). See [[#0B: Conditional Pop]] for valid operations | | + | | <color red>X</color> | operation, a0 to 8037E1A0 (unsigned 8). See [[#0B: Conditional Pop]] for valid operations | |
- | | <color darkgreen>Y</color> | argument, a1 to 8037E1A0 (signed 32) | | + | | <color green>Y</color> | argument, a1 to 8037E1A0 (signed 32) | |
- | | <color darkblue>Z</color> | segment address of jump | | + | | <color aqua>Z</color> | segment address of jump | |
---- | ---- | ||
Line 150: | Line 151: | ||
This command is never used in any of the level scripts. | This command is never used in any of the level scripts. | ||
- | ''0D 08 [<color darkred>XX</color>] 00 [<color darkgreen>YY YY YY YY</color>]'' | + | ''0D 08 [<color red>XX</color>] 00 [<color green>YY YY YY YY</color>]'' |
- | | <color darkred>X</color> | operation, a0 to 8037E1A0 (unsigned 8). See [[#0B: Conditional Pop]] for valid operations | | + | | <color red>X</color> | operation, a0 to 8037E1A0 (unsigned 8). See [[#0B: Conditional Pop]] for valid operations | |
- | | <color darkgreen>Y</color> | argument, a1 to 8037E1A0 (signed 32) | | + | | <color green>Y</color> | argument, a1 to 8037E1A0 (signed 32) | |
---- | ---- | ||
Line 161: | Line 162: | ||
This command is never used in any of the level scripts. | This command is never used in any of the level scripts. | ||
- | ''0E 08 [<color darkred>XX</color>] 00 [<color darkgreen>YY YY YY YY</color>]'' | + | ''0E 08 [<color red>XX</color>] 00 [<color green>YY YY YY YY</color>]'' |
- | | <color darkred>X</color> | operation, a0 to 8037E1A0 (unsigned 8). See [[#0B: Conditional Pop]] for valid operations | | + | | <color red>X</color> | operation, a0 to 8037E1A0 (unsigned 8). See [[#0B: Conditional Pop]] for valid operations | |
- | | <color darkgreen>Y</color> | argument, a1 to 8037E1A0 (signed 32) | | + | | <color green>Y</color> | argument, a1 to 8037E1A0 (signed 32) | |
Line 188: | Line 189: | ||
Set level accumulator (8038BE24) from assembly routine. | Set level accumulator (8038BE24) from assembly routine. | ||
- | ''11 08 [<color darkred>XX XX</color>] [<color darkgreen>YY YY YY YY</color>]'' | + | ''11 08 [<color red>XX XX</color>] [<color green>YY YY YY YY</color>]'' |
- | | <color darkred>X</color> | A0 value passed to function <color darkgreen>Y</color> | | + | | <color red>X</color> | A0 value passed to function <color green>Y</color> | |
- | | <color darkgreen>Y</color> | Assembly routine of format ''u32 func(u32 a0, u16 A1)'' | | + | | <color green>Y</color> | Assembly routine of format ''u32 func(u32 a0, u16 A1)'' | |
Call assembly routine Y (A0 = halfword X, A1 = word from 0x8038BE24). | Call assembly routine Y (A0 = halfword X, A1 = word from 0x8038BE24). | ||
Line 205: | Line 206: | ||
==== 12: Actively Set Accumulator ==== | ==== 12: Actively Set Accumulator ==== | ||
- | ''12 08 [<color darkred>XX XX</color>] [<color darkgreen>YY YY YY YY</color>]'' | + | ''12 08 [<color red>XX XX</color>] [<color green>YY YY YY YY</color>]'' |
- | | <color darkred>X</color> | A0 value passed to function <color darkgreen>Y</color> | | + | | <color red>X</color> | A0 value passed to function <color green>Y</color> | |
- | | <color darkgreen>Y</color> | Assembly routine of format ''u32 func(u32 a0, u16 A1)'' | | + | | <color green>Y</color> | Assembly routine of format ''u32 func(u32 a0, u16 A1)'' | |
Call assembly routine Y (A0 = halfword X, A1 = word from 0x8038BE24). | Call assembly routine Y (A0 = halfword X, A1 = word from 0x8038BE24). | ||
Line 224: | Line 225: | ||
Set level accumulator (8038BE24) to constant value. | Set level accumulator (8038BE24) to constant value. | ||
- | ''13 04 [<color darkred>XX XX</color>]'' | + | ''13 04 [<color red>XX XX</color>]'' |
- | | <color darkred>X</color> | Value to set level accumulator | | + | | <color red>X</color> | Value to set level accumulator | |
---- | ---- | ||
Line 249: | Line 250: | ||
Load raw data from ROM to absolute RAM address. Call 0x802786F0 (A0 = X, A1 = Y, A2 = Z) | Load raw data from ROM to absolute RAM address. Call 0x802786F0 (A0 = X, A1 = Y, A2 = Z) | ||
- | ''16 10 00 00 [<color darkred>XX XX XX XX</color>] [<color darkgreen>YY YY YY YY</color>] [<color darkblue>ZZ ZZ ZZ ZZ</color>]'' | + | ''16 10 00 00 [<color red>XX XX XX XX</color>] [<color green>YY YY YY YY</color>] [<color aqua>ZZ ZZ ZZ ZZ</color>]'' |
- | | <color darkred>X</color> | RAM address | | + | | <color red>X</color> | RAM address | |
- | | <color darkgreen>Y</color> | ROM address start | | + | | <color green>Y</color> | ROM address start | |
- | | <color darkblue>Z</color> | ROM address end | | + | | <color aqua>Z</color> | ROM address end | |
---- | ---- | ||
Line 260: | Line 261: | ||
Load raw data from ROM to RAM segment. | Load raw data from ROM to RAM segment. | ||
- | ''17 0C 00 [<color darkred>XX</color>] [<color darkgreen>YY YY YY YY</color>] [<color darkblue>ZZ ZZ ZZ ZZ</color>]'' | + | ''17 0C 00 [<color red>XX</color>] [<color green>YY YY YY YY</color>] [<color aqua>ZZ ZZ ZZ ZZ</color>]'' |
- | | <color darkred>X</color> | RAM segment number | | + | | <color red>X</color> | RAM segment number | |
- | | <color darkgreen>Y</color> | ROM address start | | + | | <color green>Y</color> | ROM address start | |
- | | <color darkblue>Z</color> | ROM address end | | + | | <color aqua>Z</color> | ROM address end | |
---- | ---- | ||
Line 271: | Line 272: | ||
Load and decompress MIO0 data from ROM to RAM segment. | Load and decompress MIO0 data from ROM to RAM segment. | ||
- | ''18 0C 00 [<color darkred>XX</color>] [<color darkgreen>YY YY YY YY</color>] [<color darkblue>ZZ ZZ ZZ ZZ</color>]'' | + | ''18 0C 00 [<color red>XX</color>] [<color green>YY YY YY YY</color>] [<color aqua>ZZ ZZ ZZ ZZ</color>]'' |
- | | <color darkred>X</color> | RAM segment number | | + | | <color red>X</color> | RAM segment number | |
- | | <color darkgreen>Y</color> | ROM address start | | + | | <color green>Y</color> | ROM address start | |
- | | <color darkblue>Z</color> | ROM address end | | + | | <color aqua>Z</color> | ROM address end | |
---- | ---- | ||
Line 282: | Line 283: | ||
Create Mario face for the demo screen. | Create Mario face for the demo screen. | ||
- | ''19 04 00 [<color darkred>XX</color>]'' | + | ''19 04 00 [<color red>XX</color>]'' |
- | | <color darkred>X</color> | Settings: 01 No face, 02 Regular face, 03 Game over face | | + | | <color red>X</color> | Settings: 01 No face, 02 Regular face, 03 Game over face | |
Call 0x80278120 (A0 = 0x000E1000, A1 = 0); allocate 0xE1000 bytes for mario face settings | Call 0x80278120 (A0 = 0x000E1000, A1 = 0); allocate 0xE1000 bytes for mario face settings | ||
Line 299: | Line 300: | ||
Load and decompress MIO0 data from ROM to RAM segment (level terrain textures) | Load and decompress MIO0 data from ROM to RAM segment (level terrain textures) | ||
- | ''1A 0C 00 [<color darkred>XX</color>] [<color darkgreen>YY YY YY YY</color>] [<color darkblue>ZZ ZZ ZZ ZZ</color>]'' | + | ''1A 0C 00 [<color red>XX</color>] [<color green>YY YY YY YY</color>] [<color aqua>ZZ ZZ ZZ ZZ</color>]'' |
- | | <color darkred>X</color> | RAM segment number | | + | | <color red>X</color> | RAM segment number | |
- | | <color darkgreen>Y</color> | ROM address start | | + | | <color green>Y</color> | ROM address start | |
- | | <color darkblue>Z</color> | ROM address end | | + | | <color aqua>Z</color> | ROM address end | |
---- | ---- | ||
Line 353: | Line 354: | ||
Start of an area. | Start of an area. | ||
- | ''1F 08 [<color darkred>XX</color>] 00 [<color darkgreen>YY YY YY YY</color>]'' | + | ''1F 08 [<color red>XX</color>] 00 [<color green>YY YY YY YY</color>]'' |
- | | <color darkred>X</color> | Area number | | + | | <color red>X</color> | Area number | |
- | | <color darkgreen>Y</color> | Segment offset address of geometry layout | | + | | <color green>Y</color> | Segment offset address of geometry layout | |
---- | ---- | ||
Line 370: | Line 371: | ||
Load polygon data without geometry layout. | Load polygon data without geometry layout. | ||
- | ''21 08 [<color darkred>X</color>]0 [<color darkgreen>YY</color>] [<color darkblue>ZZ ZZ ZZ ZZ</color>]'' | + | ''21 08 [<color red>X</color>]0 [<color green>YY</color>] [<color aqua>ZZ ZZ ZZ ZZ</color>]'' |
- | | <color darkred>X</color> | Drawing layer | | + | | <color red>X</color> | Drawing layer | |
- | | <color darkgreen>Y</color> | ID of the model to be used with 3D objects | | + | | <color green>Y</color> | ID of the model to be used with 3D objects | |
- | | <color darkblue>Z</color> | Segment offset address | | + | | <color aqua>Z</color> | Segment offset address | |
---- | ---- | ||
Line 381: | Line 382: | ||
Load polygon data with geometry layout. | Load polygon data with geometry layout. | ||
- | ''22 08 00 [<color darkred>XX</color>] [<color darkgreen>YY YY YY YY</color>]'' | + | ''22 08 00 [<color red>XX</color>] [<color green>YY YY YY YY</color>]'' |
- | | <color darkred>X</color> | ID of the model to be used with 3D objects | | + | | <color red>X</color> | ID of the model to be used with 3D objects | |
- | | <color darkgreen>Y</color> | Segment offset address | | + | | <color green>Y</color> | Segment offset address | |
---- | ---- | ||
Line 392: | Line 393: | ||
This command is never used in any of the level scripts. | This command is never used in any of the level scripts. | ||
- | ''23 0C [<color red>A</color>][<color green>B BB</color>] [<color blue>CC CC CC CC</color>] [<color purple>DD DD DD DD</color>]'' | + | ''23 0C [<color red>A</color>][<color green>B BB</color>] [<color aqua>CC CC CC CC</color>] [<color fuchsia>DD DD DD DD</color>]'' |
| <color red>A</color> | most significant nibble of third byte | | | <color red>A</color> | most significant nibble of third byte | | ||
| <color green>B</color> | 3 least significant nibbles of first word | | | <color green>B</color> | 3 least significant nibbles of first word | | ||
- | | <color blue>C</color> | word | | + | | <color aqua>C</color> | word | |
- | | <color purple>D</color> | float? | | + | | <color fuchsia>D</color> | float? | |
<code c> | <code c> | ||
Line 417: | Line 418: | ||
Places a 3D object in the level. | Places a 3D object in the level. | ||
- | ''24 18 [<color purple>AA</color>] [<color darkgray>ID</color>] [<color darkred>XX XX</color>] [<color darkgreen>YY YY</color>] [<color darkblue>ZZ ZZ</color>] [<color red>RX RX</color>] [<color green>RY RY</color>] [<color blue>RZ RZ</color>] [<color goldenrod>BB BB BB BB</color>] [<color darkcyan>BS BS BS BS</color>]'' | + | ''24 18 [<color fuchsia>AA</color>] [<color gray>ID</color>] [<color red>XX XX</color>] [<color green>YY YY</color>] [<color aqua>ZZ ZZ</color>] [<color red>RX RX</color>] [<color green>RY RY</color>] [<color aqua>RZ RZ</color>] [<color goldenrod>BB BB BB BB</color>] [<color cyan>BS BS BS BS</color>]'' |
- | | <color purple>AA</color> | Act mask in which this object will appear in | | + | | <color fuchsia>AA</color> | Act mask in which this object will appear in | |
- | | <color darkgray>ID</color> | ID of the model to use for this object (defined by [[#21: Load Polygon Without Geo]] and [[#22: Load Polygon With Geo]]) | | + | | <color gray>ID</color> | ID of the model to use for this object (defined by [[#21: Load Polygon Without Geo]] and [[#22: Load Polygon With Geo]]) | |
- | | <color darkred>XX</color> | X position of object (s16) | | + | | <color red>XX</color> | X position of object (s16) | |
- | | <color darkgreen>YY</color> | Y position of object (s16) | | + | | <color green>YY</color> | Y position of object (s16) | |
- | | <color darkblue>ZZ</color> | Z position of object (s16) | | + | | <color aqua>ZZ</color> | Z position of object (s16) | |
| <color red>RX</color> | Rotation across X axis in degrees (s16) | | | <color red>RX</color> | Rotation across X axis in degrees (s16) | | ||
| <color green>RY</color> | Rotation across Y axis in degrees (s16) | | | <color green>RY</color> | Rotation across Y axis in degrees (s16) | | ||
- | | <color blue>RZ</color> | Rotation across Z axis in degrees (s16) | | + | | <color aqua>RZ</color> | Rotation across Z axis in degrees (s16) | |
| <color goldenrod>BB</color> | Behavior parameters for the object. The entire word gets stored at Object→0x188, while only the second byte gets stored at Object→0x144.| | | <color goldenrod>BB</color> | Behavior parameters for the object. The entire word gets stored at Object→0x188, while only the second byte gets stored at Object→0x144.| | ||
- | | <color darkcyan>BS</color> | RAM segment address for behavior script | | + | | <color cyan>BS</color> | RAM segment address for behavior script | |
---- | ---- | ||
Line 435: | Line 436: | ||
Loads the Mario object. | Loads the Mario object. | ||
- | ''25 0C 00 [<color darkred>XX</color>] [<color darkgreen>YY YY YY YY</color>] [<color darkblue>ZZ ZZ ZZ ZZ</color>]'' | + | ''25 0C 00 [<color red>XX</color>] [<color green>YY YY YY YY</color>] [<color aqua>ZZ ZZ ZZ ZZ</color>]'' |
- | Always: ''25 0C 00 [<color darkred>01</color>] [<color darkgreen>00 00 00 01</color>] [<color darkblue>13 00 2E C0</color>]'' | + | Always: ''25 0C 00 [<color red>01</color>] [<color green>00 00 00 01</color>] [<color aqua>13 00 2E C0</color>]'' |
- | | <color darkred>X</color> | ID of the model to use for Mario (defined by [[#21: Load Polygon Without Geo]] and [[#22: Load Polygon With Geo]]) | | + | | <color red>X</color> | ID of the model to use for Mario (defined by [[#21: Load Polygon Without Geo]] and [[#22: Load Polygon With Geo]]) | |
- | | <color darkgreen>Y</color> | Behavior parameters for Mario's Object. The entire word gets stored at MarioObject->0x188, while only the second byte gets stored at MarioObject->0x144. | | + | | <color green>Y</color> | Behavior parameters for Mario's Object. The entire word gets stored at MarioObject->0x188, while only the second byte gets stored at MarioObject->0x144. | |
- | | <color darkblue>Z</color> | RAM segment for behavior script | | + | | <color aqua>Z</color> | RAM segment for behavior script | |
---- | ---- | ||
Line 448: | Line 449: | ||
Connect warps defined by previous [[#24: Place Object]] commands. | Connect warps defined by previous [[#24: Place Object]] commands. | ||
- | ''26 08 [<color red>AA</color>] [<color green>BB</color>] [<color blue>CC</color>] [<color purple>DD</color>] 00 00'' | + | ''26 08 [<color red>AA</color>] [<color green>BB</color>] [<color aqua>CC</color>] [<color fuchsia>DD</color>] [<color goldenrod>EE</color>] 00'' |
| <color red>A</color> | Warp ID to jump from (defined by [[#21: Load Polygon Without Geo]] and [[#22: Load Polygon With Geo]]) | | | <color red>A</color> | Warp ID to jump from (defined by [[#21: Load Polygon Without Geo]] and [[#22: Load Polygon With Geo]]) | | ||
| <color green>B</color> | Course ID number to warp to | | | <color green>B</color> | Course ID number to warp to | | ||
- | | <color blue>C</color> | Course area to jump to | | + | | <color aqua>C</color> | Course area to jump to | |
- | | <color purple>D</color> | Warp ID number in destination level area | | + | | <color fuchsia>D</color> | Warp ID number in destination level area | |
+ | | <color goldenrod>E</color> | If set to 0x80, then the game will create a checkpoint when the warp is triggered. | | ||
---- | ---- | ||
Line 460: | Line 462: | ||
Define level warps for paintings inside the Castle. | Define level warps for paintings inside the Castle. | ||
- | ''27 08 [<color red>AA</color>] [<color green>BB</color>] [<color blue>CC</color>] [<color purple>DD</color>] 00 00'' | + | ''27 08 [<color red>AA</color>] [<color green>BB</color>] [<color aqua>CC</color>] [<color fuchsia>DD</color>] [<color goldenrod>EE</color>] 00'' |
| <color red>A</color> | Warp ID to jump from (defined by [[#21: Load Polygon Without Geo]] and [[#22: Load Polygon With Geo]]) | | | <color red>A</color> | Warp ID to jump from (defined by [[#21: Load Polygon Without Geo]] and [[#22: Load Polygon With Geo]]) | | ||
| <color green>B</color> | Course ID number to warp to | | | <color green>B</color> | Course ID number to warp to | | ||
- | | <color blue>C</color> | Course area to jump to | | + | | <color aqua>C</color> | Course area to jump to | |
- | | <color purple>D</color> | Warp ID number in destination level area | | + | | <color fuchsia>D</color> | Warp ID number in destination level area | |
+ | | <color goldenrod>E</color> | If set to 0x80, then the game will create a checkpoint when the warp is triggered. | | ||
---- | ---- | ||
Line 472: | Line 475: | ||
Allows Mario to be instantly teleported to another area within the current level. The teleport to an area is triggered by the collision IDs 0x1B to 0x1E. | Allows Mario to be instantly teleported to another area within the current level. The teleport to an area is triggered by the collision IDs 0x1B to 0x1E. | ||
- | ''28 0C [<color darkcyan>CC</color>] [<color purple>AA</color>] [<color darkred>XX XX</color>] [<color darkgreen>YY YY</color>] [<color darkblue>ZZ ZZ</color>] 00 00'' | + | ''28 0C [<color cyan>CC</color>] [<color fuchsia>AA</color>] [<color red>XX XX</color>] [<color green>YY YY</color>] [<color aqua>ZZ ZZ</color>] 00 00'' |
- | | <color darkcyan>C</color> | Determines which collision to use starting with 0x1B. (00 = 0x1B, 01 = 0x1C, etc.) | | + | | <color cyan>C</color> | Determines which collision to use starting with 0x1B. (00 = 0x1B, 01 = 0x1C, etc.) | |
- | | <color purple>A</color> | Course area # to go to | | + | | <color fuchsia>A</color> | Course area # to go to | |
- | | <color darkred>X</color> | Teleport Mario by this amount on the X axis (s16) | | + | | <color red>X</color> | Teleport Mario by this amount on the X axis (s16) | |
- | | <color darkgreen>Y</color> | Teleport Mario by this amount on the Y axis (s16) | | + | | <color green>Y</color> | Teleport Mario by this amount on the Y axis (s16) | |
- | | <color darkblue>Z</color> | Teleport Mario by this amount on the Z axis (s16) | | + | | <color aqua>Z</color> | Teleport Mario by this amount on the Z axis (s16) | |
Teleporting between 4 areas example: | Teleporting between 4 areas example: | ||
Line 498: | Line 501: | ||
==== 29: ?? ==== | ==== 29: ?? ==== | ||
+ | ''29 04 [??] 00'' | ||
+ | | ? | Unknown | | ||
+ | |||
+ | Note: ?? is usually 01. ?? being 02 was only used once in the original game, in the Act Select level script. | ||
---- | ---- | ||
Line 507: | Line 514: | ||
==== 0x2B: Set Mario's default position in the level ==== | ==== 0x2B: Set Mario's default position in the level ==== | ||
- | 2B 0C [AA] 00 [RY RY] [XX XX] [YY YY] [ZZ ZZ] | + | '' 2B 0C [AA] 00 [RY RY] [XX XX] [YY YY] [ZZ ZZ]'' |
Line 532: | Line 539: | ||
Loads terrain collision data for level, and other special models to be placed in the level. | Loads terrain collision data for level, and other special models to be placed in the level. | ||
- | ''2E 08 00 00 [<color darkred>XX XX XX XX</color>]'' | + | ''2E 08 00 00 [<color red>XX XX XX XX</color>]'' |
- | | <color darkred>X</color> | Segmented address of [[sm64:collision_data]] | | + | | <color red>X</color> | Segmented address of [[sm64:collision_data]] | |
---- | ---- | ||
- | ==== 2F: Render Area?? ==== | + | ==== 2F: Setup Render Room ==== |
- | Decides which area of the level geometry to render. Used in BBH, HMC, and Inside Castle levels. | + | Used in the levels Big Boo's Haunt, Hazy Maze Cave, and Inside Castle. |
+ | |||
+ | The segmented pointer in this command points to a byte array, with the same length as number of collision triangles in the level. Each byte in this array will be placed into offset 0x5 in the [[super_mario_64:structs#collision_triangle|collision triangle structure]]. | ||
+ | |||
+ | When the ASM function 0x8029DBD4 is used with [[super_mario_64:geometry_layout_commands#eswitch_case|geometry layout switch command]], it will use that offset 0x5 byte of the collision triangle that is below Mario as an index to determine which display list to render. | ||
- | ''2F 08 00 00 [<color darkred>XX XX XX XX</color>]'' | + | ''2F 08 00 00 [<color red>XX XX XX XX</color>]'' |
- | | <color darkred>X</color> | Segment offset pointer to ?? | | + | | <color red>X</color> | Segment offset to the byte array | |
---- | ---- | ||
Line 550: | Line 561: | ||
Shows a dialog at the beginning of a level. Ignored if the value at 0x8038B8AC equals -1 or XX > 1. | Shows a dialog at the beginning of a level. Ignored if the value at 0x8038B8AC equals -1 or XX > 1. | ||
- | ''30 04 [<color darkred>XX</color>] [<color darkgreen>YY</color>]'' | + | ''30 04 [<color red>XX</color>] [<color green>YY</color>]'' |
- | | <color darkred>X</color> | Always 00? | | + | | <color red>X</color> | Always 00? | |
- | | <color darkgreen>Y</color> | Dialog ID | | + | | <color green>Y</color> | Dialog ID | |
Examples: | Examples: | ||
Line 567: | Line 578: | ||
Set default terrain. | Set default terrain. | ||
- | ''31 04 00 [<color darkred>XX</color>]'' | + | ''31 04 00 [<color red>XX</color>]'' |
- | | <color darkred>X</color> | 00 Normal A, 01 Normal B, 02 Snow, 03 Sand, 04 Haunted house, 05 Water levels, 06 Slippery Slide | | + | | <color red>X</color> | 00 Normal A, 01 Normal B, 02 Snow, 03 Sand, 04 Haunted house, 05 Water levels, 06 Slippery Slide | |
---- | ---- | ||
Line 575: | Line 586: | ||
==== 32: No Operation 2 ==== | ==== 32: No Operation 2 ==== | ||
No operation. This command is not used in any of the level scripts. | No operation. This command is not used in any of the level scripts. | ||
- | ''32 [<color darkred>XX</color>] '' | + | ''32 [<color red>XX</color>] '' |
---- | ---- | ||
Line 582: | Line 593: | ||
Fade/overlay screen with color. | Fade/overlay screen with color. | ||
- | ''33 08 [<color darkred>XX</color>] [<color darkgreen>YY</color>] [<color red>RR</color>] [<color green>GG</color>] [<color blue>BB</color>] 00'' | + | ''33 08 [<color red>XX</color>] [<color green>YY</color>] [<color red>RR</color>] [<color green>GG</color>] [<color aqua>BB</color>] 00'' |
- | | <color darkred>X</color> | 01 Enable, 00 Disable | | + | | <color red>X</color> | 01 Enable, 00 Disable | |
- | | <color darkgreen>Y</color> | Controls duration? usually 0x10 | | + | | <color green>Y</color> | Controls duration? usually 0x10 | |
- | | <color red>R</color>,<color green>G</color>,<color blue>B</color> = red/green/blue color value | | + | | <color red>R</color>,<color green>G</color>,<color aqua>B</color> = red/green/blue color value | |
---- | ---- | ||
Line 593: | Line 604: | ||
Calls [[http://level42.ca/projects/ultra64/Documentation/man/n64man/os/osViBlack.html|osViBlack(bool)]] (80323340), passing it X. | Calls [[http://level42.ca/projects/ultra64/Documentation/man/n64man/os/osViBlack.html|osViBlack(bool)]] (80323340), passing it X. | ||
- | ''34 04 [<color darkred>XX</color>] 00'' | + | ''34 04 [<color red>XX</color>] 00'' |
- | | <color darkred>X</color> | 1 = blackout, 0 = cancel blackout | | + | | <color red>X</color> | 1 = blackout, 0 = cancel blackout | |
---- | ---- | ||
==== 35: ?? ==== | ==== 35: ?? ==== | ||
- | ''35 04 [<color darkred>XX</color>] 00'' | + | ''35 04 [<color red>XX</color>] 00'' |
If X is 0, call 0x803733B0 (A0 = 2) | If X is 0, call 0x803733B0 (A0 = 2) | ||
Else, call 0x803733B0 (A0 = 1) | Else, call 0x803733B0 (A0 = 1) | ||
Line 607: | Line 618: | ||
==== 36: Set Music ==== | ==== 36: Set Music ==== | ||
- | Set music. Used only in screen levels, like select file, select star and mario face and demo screen. | + | Set music. |
- | ''36 08 [??] [??] [??] [<color darkred>XX</color>] 00 00'' | + | ''36 08 [??] [??] [??] [<color red>XX</color>] 00 00'' |
| ? | Other music parameters? | | | ? | Other music parameters? | | ||
- | | <color darkred>X</color> | Sequence number | | + | | <color red>X</color> | Sequence number | |
---- | ---- | ||
==== 37: Set Music ==== | ==== 37: Set Music ==== | ||
- | Set music | + | Set music. Used only in screen levels, like select file, select star and mario face and demo screen. |
- | ''37 04 00 [<color darkred>XX</color>]'' | + | ''37 04 00 [<color red>XX</color>]'' |
- | | <color darkred>X</color> | Sequence number | | + | | <color red>X</color> | Sequence number | |
---- | ---- | ||
==== 38: ?? ==== | ==== 38: ?? ==== | ||
- | ''38 04 [<color darkred>XX XX</color>]'' | + | ''38 04 [<color red>XX XX</color>]'' |
Call 0x8024922C (A0 = X) | Call 0x8024922C (A0 = X) | ||
Line 635: | Line 646: | ||
Place macro objects defined in segmented address. | Place macro objects defined in segmented address. | ||
- | ''39 08 00 00 [<color darkred>XX XX XX XX</color>]'' | + | ''39 08 00 00 [<color red>XX XX XX XX</color>]'' |
- | | <color darkred>X</color> | Segment offset pointer to object placement list | | + | | <color red>X</color> | Segment offset pointer to object placement list | |
List format: (each entry is 10 bytes) | List format: (each entry is 10 bytes) | ||
- | ''[<color purple>BB BB</color>] [<color darkred>XX XX</color>] [<color darkgreen>YY YY</color>] [<color darkblue>ZZ ZZ</color>] [?? ??]'' | + | ''[<color fuchsia>BB BB</color>] [<color red>XX XX</color>] [<color green>YY YY</color>] [<color aqua>ZZ ZZ</color>] [?? ??]'' |
- | | <color purple>B</color> | Object type ID (behavior, model, etc) | | + | | <color fuchsia>B</color> | Object type ID (references behaviour address and model id) and Y Rotation. First 7 bit are the Y-Rotation, the last 9 bit are the Object type ID. | |
- | | <color darkred>X</color>,<color darkgreen>Y</color>,<color darkblue>Z</color> | Coordinates | | + | | <color red>X</color>,<color green>Y</color>,<color aqua>Z</color> | Coordinates | |
| ?? | Always 00 00 ? | | | ?? | Always 00 00 ? | | ||
+ | |||
+ | [[sm64:macro_objects|See here for more information]] | ||
---- | ---- | ||
Line 656: | Line 669: | ||
Define jet streams in JRB or DDD that repulse or suck Mario. | Define jet streams in JRB or DDD that repulse or suck Mario. | ||
- | ''3B 0C 00 00 [<color darkred>XX XX</color>] [<color darkgreen>YY YY</color>] [<color darkblue>ZZ ZZ</color>] [<color darkgray>II II</color>]'' | + | ''3B 0C 00 00 [<color red>XX XX</color>] [<color green>YY YY</color>] [<color aqua>ZZ ZZ</color>] [<color gray>II II</color>]'' |
- | | <color darkred>X</color> | X position | | + | | <color red>X</color> | X position | |
- | | <color darkgreen>Y</color> | Y position | | + | | <color green>Y</color> | Y position | |
- | | <color darkblue>Z</color> | Z position | | + | | <color aqua>Z</color> | Z position | |
- | | <color darkgray>I</color> | Intensity. negative means repulsion, positive means suction | | + | | <color gray>I</color> | Intensity. negative means repulsion, positive means suction | |
---- | ---- | ||
Line 668: | Line 681: | ||
Get/put remote values? Only used in main or menu level scripts. | Get/put remote values? Only used in main or menu level scripts. | ||
- | ''3C 04 [<color darkred>XX</color>] [<color darkgreen>YY</color>]'' | + | ''3C 04 [<color red>XX</color>] [<color green>YY</color>]'' |
- | | <color darkred>X</color> | ?? 01 in main level scripts, 00 in menu | | + | | <color red>X</color> | ?? 01 in main level scripts, 00 in menu | |
- | | <color darkgreen>Y</color> | ?? 00, 02, 03 | | + | | <color green>Y</color> | ?? 00, 02, 03 | |
===== See Also ===== | ===== See Also ===== |