====== Collision Data ====== Collision data is loaded from a segmented pointer using the level script command 0x2E for levels, and behavior command 0x2A for objects. Special 3D objects and water box collision are also loaded in the level collision loading routine. ===== Collision Loading Routine ===== 1.) The collision data always starts with the two bytes: [ 00 40 ] 2.) The next two bytes define the number of vertices in the collision data. The vertices follow after this. For each vertex: a.) 6 bytes will follow defining the XYZ position: [ XX XX YY YY ZZ ZZ ] (All XYZ positions are signed shorts) 3.) The next two bytes define the collision type: [ 00 CC ] The two bytes after that is the number of triangles for that type. For each following triangle: a.) Either 6 or 8 bytes will follow depending on if the collision type has special parameters (see collision type list below). b.) The first 6 bytes define the three indices used to draw the triangles. Example: [ 00 00 ] [ 00 01 ] [ 00 02 ], will draw a triangle with the first, second, and third vertex in the vertices list above. c.) If the collision type has special parameters, then the next 2 bytes define them. What they do is dependent on the collision type. (Keep looping step 3 until [ 00 41 ] is reached for collision type) 4.) (Only for level collision data) If the two bytes [ 00 43 ] are encountered, then special macro objects will be defined. The two bytes after the [ 00 43 ] define the number of special objects to be added. For each following special macro object: a.) Either 8, 10, or 12 bytes will follow depending on the object's special preset. b.) The first 2 bytes are the special preset. This corresponds to an entry in the special 3d objects preset list, where the Model ID and behavior is defined. This list starts at ROM address 0xED350 in the US ROM. More info can be found here: https://pastebin.com/raw/BwzUVeq0 c.) The next 6 bytes define the XYZ position of the object: [ XX XX YY YY ZZ ZZ ] d.) If the object is 10 or 12 bytes, then the next 2 bytes will define the Y rotation. e.) If the object is 12 bytes, then the last 2 bytes define extra parameters 5.) (Only for level collision data) If the two bytes [ 00 44 ] are encountered, then water box collision will be defined. The two bytes after the [ 00 44 ] define the number of water boxes to be added. For each following water box: a.) Each water box will be 12 bytes long. b.) The first 2 bytes define the id of the water box (signed short). This id also seems to define what the water box will do. * If the id is smaller than 0x32 (including negative numbers), then it will be water. * If the id is equal to 0x32 or 0xF0, then it will be toxic haze. * If its greater than 0x32 and is not a toxic haze value like 0xF0, then it will have no effect on Mario. c.) The next 4 bytes define the XZ coordinates for the first end-point of the water box: [X1 X1] [Z1 Z1] (Both signed shorts) c.) The next 4 bytes define the XZ coordinates for the second end-point of the water box: [X2 X2] [Z2 Z2] (Both signed shorts) d.) The last 2 bytes define the Y coordinate, representing how tall the water box should be: [YY YY] (Signed short) 6.) The collision data ends with the final two bytes: [ 00 42 ] ---- ===== Collision Types ===== ^ Collision Type ^ Description ^ Special Parameters (if it has any) ^ | 0x00 | Environment default | N/A | | 0x01 | Burn / Frostbite | N/A | | 0x04 | Unused | Has exertion | | 0x05 | Ceiling that Mario can climb on | N/A | | 0x09 | Slow down Mario | N/A | | 0x0A | Death floor | N/A | | 0x0B | Close camera | N/A | | 0x0D | Water | N/A | | 0x0E | Water (flowing) | Water torrent force and rotation | | 0x12 | Intangible (Seperates BBH mansion from merry-go-round, for room usage) | N/A | | 0x13 | Slippery | N/A | | 0x14 | Slippery (slightly) | N/A | | 0x15 | Anti-slippery | N/A | | 0x1A | Varied noise depending on terrain (mostly unused) | N/A | | 0x1B | Instant warp to another area (see[[super_mario_64:level_commands#setup_instant_area_warp| Level script command 0x28]]) | N/A | | 0x1C | Instant warp to another area | N/A | | 0x1D | Instant warp to another area | N/A | | 0x1E | Instant warp to another area | N/A | | 0x21 | Sand (depth of 10 units) | N/A | | 0x22 | Quicksand (lethal, slow, depth of 160 units) | N/A | | 0x23 | Quicksand (lethal, instant) | N/A | | 0x24 | Moving quicksand (flowing, depth of 160 units) | Moving sand direction and force | | 0x25 | Moving quicksand (flowing, depth of 25 units) | Moving sand direction and force | | 0x26 | Moving quicksand (depth of 60 units) | N/A | | 0x27 | Moving quicksand (flowing, depth of 60 units) | Moving sand direction and force | | 0x28 | Wall / Fence / Cannon | N/A | | 0x29 | Default floor with noise | N/A | | 0x2A | Slippery floor with noise | N/A | | 0x2C | Wind | Wind direction | | 0x2D | Quicksand (lethal, flowing) | Moving sand direction and force | | 0x2E | Slippery Ice (CCM slide) | N/A | | 0x2F | Look up and warp (Wing cap entrance) | N/A | | 0x30 | Hard floor (Always has fall damage) | N/A | | 0x32 | Surface Warp | N/A | | 0x33 | Timer start (Peach's secret slide) | N/A | | 0x34 | Timer stop (Peach's secret slide) | N/A | | 0x35 | Hard and slippery (Always has fall damage) | N/A | | 0x36 | Hard (Slide for CCM, Always has fall damage) | N/A | | 0x37 | Non-slippery areas in ice levels | N/A | | 0x38 | Death at bottom with wind | N/A | | 0x65 | Wide camera (BOB) | N/A | | 0x66 | Walls in THI area 3 | N/A | | 0x6E | Step on 4 to make Pyramid top explode | N/A | | 0x6F | Camera-related (Bowser 1) | N/A | | 0x70 | Camera-related (BOB) | N/A | | 0x72 | Inaccessible Area, only used to restrict camera movement | N/A | | 0x73 | Slide with noise (unused) | N/A | | 0x74 | Slide with noise (unused) | N/A | | 0x75 | Camera-related (CCM) | N/A | | 0x76 | Surface with flags | N/A | | 0x77 | Surface with flags (unused) | N/A | | 0x78 | Possibly for camera behavior, has noise | N/A | | 0x79 | Slippery (for camera behavior) | N/A | | 0x7A | Activate switches or Dorrie | N/A | | 0x7B | Vanish cap walls | N/A | | 0xA6 | Painting wobble (BoB 1) | N/A | | 0xA7 | Painting wobble (BoB 2) | N/A | | 0xA8 | Painting wobble (BoB 3) | N/A | | 0xA9 | Painting wobble (CCM 1) | N/A | | 0xAA | Painting wobble (CCM 2) | N/A | | 0xAB | Painting wobble (CCM 3) | N/A | | 0xAC | Painting wobble (WF 1) | N/A | | 0xAD | Painting wobble (WF 2) | N/A | | 0xAE | Painting wobble (WF 3) | N/A | | 0xAF | Painting wobble (JRB 1) | N/A | | 0xB0 | Painting wobble (JRB 2) | N/A | | 0xB1 | Painting wobble (JRB 3) | N/A | | 0xB2 | Painting wobble (LLL 1) | N/A | | 0xB3 | Painting wobble (LLL 2) | N/A | | 0xB4 | Painting wobble (LLL 3) | N/A | | 0xB5 | Painting wobble (SSL 1) | N/A | | 0xB6 | Painting wobble (SSL 2) | N/A | | 0xB7 | Painting wobble (SSL 3) | N/A | | 0xB8 | Painting wobble (?) | N/A | | 0xB9 | Painting wobble (?) | N/A | | 0xBA | Painting wobble (?) | N/A | | 0xBB | Painting wobble (BFS?) | N/A | | 0xBC | Painting wobble (BFS?) | N/A | | 0xBD | Painting wobble (BFS?) | N/A | | 0xBE | Painting wobble (WDW 1) | N/A | | 0xBF | Painting wobble (WDW 2) | N/A | | 0xC0 | Painting wobble (WDW 3) | N/A | | 0xC1 | Painting wobble (THI t 1) | N/A | | 0xC2 | Painting wobble (THI t 2) | N/A | | 0xC3 | Painting wobble (THI t 3) | N/A | | 0xC4 | Painting wobble (TTM 1) | N/A | | 0xC5 | Painting wobble (TTM 2) | N/A | | 0xC6 | Painting wobble (TTM 3) | N/A | | 0xC7 | Painting wobble (?) | N/A | | 0xC8 | Painting wobble (?) | N/A | | 0xC9 | Painting wobble (?) | N/A | | 0xCA | Painting wobble (SML 1, unused) | N/A | | 0xCB | Painting wobble (SML 2, unused) | N/A | | 0xCC | Painting wobble (SML 3, unused) | N/A | | 0xCD | Painting wobble (THI h 1) | N/A | | 0xCE | Painting wobble (THI h 2) | N/A | | 0xCF | Painting wobble (THI h 3) | N/A | | 0xD0 | Painting wobble (Metal cap?) | N/A | | 0xD1 | Painting wobble (Metal cap?) | N/A | | 0xD2 | Painting wobble (Metal cap?) | N/A | | 0xD3 | Horizontal level entrance (still have to label these) | N/A | | 0xD4 | Horizontal level entrance () | N/A | | 0xD5 | Horizontal level entrance () | N/A | | 0xD6 | Horizontal level entrance () | N/A | | 0xD7 | Horizontal level entrance () | N/A | | 0xD8 | Horizontal level entrance () | N/A | | 0xD9 | Horizontal level entrance () | N/A | | 0xDA | Horizontal level entrance () | N/A | | 0xDB | Horizontal level entrance () | N/A | | 0xDC | Horizontal level entrance () | N/A | | 0xDD | Horizontal level entrance () | N/A | | 0xDE | Horizontal level entrance () | N/A | | 0xDF | Horizontal level entrance () | N/A | | 0xF0 | Horizontal level entrance () | N/A | | 0xF1 | Horizontal level entrance () | N/A | | 0xF2 | Horizontal level entrance () | N/A | | 0xF3 | Horizontal level entrance () | N/A | | 0xF4 | Horizontal level entrance () | N/A | | 0xF5 | Horizontal level entrance () | N/A | | 0xF6 | Horizontal level entrance () | N/A | | 0xF7 | Horizontal level entrance () | N/A | | 0xF8 | Horizontal level entrance () | N/A | | 0xF9 | Horizontal level entrance () | N/A | | 0xFA | Horizontal level entrance () | N/A | | 0xFB | Horizontal level entrance () | N/A | | 0xFC | Horizontal level entrance () | N/A | | 0xFD | Pool warp (HMC) | N/A | | 0xFF | Bowser 1 trapdoor | N/A |