A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
KCollisionTypes.hh File Reference

Detailed Description

This file houses information about KCL types, as well as the struct for collision prisms. KCL files define collision for Mario Kart Wii and other games. They organize collision triangles using an octree, which allows for efficient indexing. Each triangle is associated with a 16-bit flag, which determines the effect the triangle has on the player colliding with it.

KCL Flag Components
1514131211109876543210
Collision Effect
Wheel Depth
BLIGHT Index
Variant
KColType
  • KColType - 0x00 to 0x1F. The main effect the triangle will have.
  • Variant - 0 to 7. Determines the variant of the base type.
  • BLIGHT Index - Ranges from 0 to 7. Has to do with lighting.
  • Wheel Depth - 0 to 3. A higher value means player's wheel sinks further into the ground.
  • Collision effect - Bitfield that makes surfaces trickable, reject road, and/or soft wall.

Definition in file KCollisionTypes.hh.

Go to the source code of this file.

Classes

struct  Field::KColHeader
 The header of the KCL file format. It is 0x3C bytes long (for Mario Kart Wii). More...
 

Namespaces

namespace  Field
 Pertains to collision.
 

Macros

#define KCL_ATTRIBUTE_TYPE(x)
 Computes the "Base Type" portion of the KCL flags. It's the lower 5 bits of the flag.
 
#define KCL_TYPE_BIT(x)
 
#define KCL_ATTRIBUTE_TYPE_BIT(x)
 Given the full 2 byte KCL flag for a triangle, extracts the "Base Type" portion of the flag.
 
#define KCL_VARIANT_TYPE(x)
 Extracts the "Variant" portion of the 2 byte KCL flag. It's the 3 bits before the "Bast Type".
 
#define KCL_SOFT_WALL_MASK   0x8000
 
#define KCL_ANY   0xffffffff
 
#define KCL_NONE   0x00000000
 
#define KCL_TYPE_DIRECTIONAL
 0x05070000
 
#define KCL_TYPE_SOLID_SURFACE
 0xF0F8FFFF
 
#define KCL_TYPE_FLOOR
 0x20E80FFF - Any KCL that the player or items can drive/land on.
 
#define KCL_TYPE_DRIVER_FLOOR   (KCL_TYPE_FLOOR & ~KCL_TYPE_BIT(COL_TYPE_ITEM_ROAD))
 0x20E80DFF - Any KCL that the player can drive on.
 
#define KCL_TYPE_WALL
 0xD010F000
 
#define KCL_TYPE_DRIVER_WALL
 0xC010B000
 
#define KCL_TYPE_DRIVER_WALL_NO_INVISIBLE_WALL    (KCL_TYPE_DRIVER_WALL & ~KCL_TYPE_BIT(COL_TYPE_INVISIBLE_WALL))
 0xC0109000
 
#define KCL_TYPE_DRIVER_WALL_NO_INVISIBLE_WALL2    (KCL_TYPE_DRIVER_WALL & ~KCL_TYPE_BIT(COL_TYPE_INVISIBLE_WALL2))
 0x4010B000
 
#define KCL_TYPE_4010D000
 0x4010D000
 
#define KCL_TYPE_VEHICLE_INTERACTABLE
 0xEFFFBDFF
 
#define KCL_TYPE_VEHICLE_COLLIDEABLE
 0xEAF8BDFF
 
#define KCL_TYPE_NON_DIRECTIONAL
 0xE0F8BDFF
 
#define KCL_TYPE_DRIVER_SOLID_SURFACE    (KCL_TYPE_VEHICLE_COLLIDEABLE | KCL_TYPE_BIT(COL_TYPE_CANNON_TRIGGER))
 0xEAFABDFF
 
#define KCL_TYPE_B0E82DFF
 0xB0E82DFF
 
#define KCL_TYPE_64EBDFFF
 
#define KCL_TYPE_INVISIBLE_WALL    (KCL_TYPE_BIT(COL_TYPE_INVISIBLE_WALL) | KCL_TYPE_BIT(COL_TYPE_INVISIBLE_WALL2))
 0x80002000
 
#define KCL_TYPE_ANY_INVISIBLE_WALL    (KCL_TYPE_INVISIBLE_WALL | KCL_TYPE_BIT(COL_TYPE_HALFPIPE_INVISIBLE_WALL))
 0x90002000
 

Typedefs

typedef u32 Field::KCLTypeMask
 

Enumerations

enum  KColType {
  COL_TYPE_ROAD = 0 ,
  COL_TYPE_SLIPPERY_ROAD = 1 ,
  COL_TYPE_WEAK_OFF_ROAD = 2 ,
  COL_TYPE_OFF_ROAD = 3 ,
  COL_TYPE_HEAVY_OFF_ROAD = 4 ,
  COL_TYPE_SLIPPERY_ROAD_2 = 5 ,
  COL_TYPE_BOOST_PAD = 6 ,
  COL_TYPE_BOOST_RAMP = 7 ,
  COL_TYPE_JUMP_PAD = 8 ,
  COL_TYPE_ITEM_ROAD = 9 ,
  COL_TYPE_SOLID_OOB = 0xa ,
  COL_TYPE_MOVING_WATER = 0xb ,
  COL_TYPE_WALL = 0xc ,
  COL_TYPE_INVISIBLE_WALL = 0xd ,
  COL_TYPE_ITEM_WALL = 0xe ,
  COL_TYPE_WALL_2 = 0xf ,
  COL_TYPE_FALL_BOUNDARY = 0x10 ,
  COL_TYPE_CANNON_TRIGGER = 0x11 ,
  COL_TYPE_FORCE_RECALCULATE_ROUTE = 0x12 ,
  COL_TYPE_HALFPIPE_RAMP = 0x13 ,
  COL_TYPE_PLAYER_WALL = 0x14 ,
  COL_TYPE_MOVING_ROAD = 0x15 ,
  COL_TYPE_STICKY_ROAD = 0x16 ,
  COL_TYPE_ROAD2 = 0x17 ,
  COL_TYPE_SOUND_TRIGGER = 0x18 ,
  COL_TYPE_WEAK_WALL = 0x19 ,
  COL_TYPE_EFFECT_TRIGGER = 0x1a ,
  COL_TYPE_ITEM_STATE_MODIFIER = 0x1b ,
  COL_TYPE_HALFPIPE_INVISIBLE_WALL = 0x1c ,
  COL_TYPE_ROTATING_ROAD = 0x1d ,
  COL_TYPE_SPECIAL_WALL = 0x1e ,
  COL_TYPE_INVISIBLE_WALL2 = 0x1f ,
  COL_TYPE_COUNT
}
 

Functions

 STATIC_ASSERT (KCL_TYPE_64EBDFFF==0x64EBDFFF)
 
 Field::STATIC_ASSERT (sizeof(KColHeader)==0x3c)
 

Macro Definition Documentation

◆ KCL_ANY

#define KCL_ANY   0xffffffff

Definition at line 73 of file KCollisionTypes.hh.

◆ KCL_ATTRIBUTE_TYPE

#define KCL_ATTRIBUTE_TYPE ( x)
Value:
((x)&0x1f)

Computes the "Base Type" portion of the KCL flags. It's the lower 5 bits of the flag.

Definition at line 25 of file KCollisionTypes.hh.

◆ KCL_ATTRIBUTE_TYPE_BIT

#define KCL_ATTRIBUTE_TYPE_BIT ( x)
Value:
#define KCL_ATTRIBUTE_TYPE(x)
Computes the "Base Type" portion of the KCL flags. It's the lower 5 bits of the flag.
#define KCL_TYPE_BIT(x)

Given the full 2 byte KCL flag for a triangle, extracts the "Base Type" portion of the flag.

Definition at line 30 of file KCollisionTypes.hh.

◆ KCL_NONE

#define KCL_NONE   0x00000000

Definition at line 74 of file KCollisionTypes.hh.

◆ KCL_SOFT_WALL_MASK

#define KCL_SOFT_WALL_MASK   0x8000

Definition at line 72 of file KCollisionTypes.hh.

◆ KCL_TYPE_4010D000

#define KCL_TYPE_4010D000
Value:
KCL_TYPE_BIT(COL_TYPE_ITEM_WALL))
@ COL_TYPE_ITEM_WALL
Wall that is only solid for items.
@ COL_TYPE_INVISIBLE_WALL2
Identical to COL_TYPE_INVISIBLE_WALL.
#define KCL_TYPE_DRIVER_WALL_NO_INVISIBLE_WALL
0xC0109000

0x4010D000

Definition at line 127 of file KCollisionTypes.hh.

◆ KCL_TYPE_64EBDFFF

#define KCL_TYPE_64EBDFFF
Value:
@ COL_TYPE_WALL
Default wall.
@ COL_TYPE_WALL_2
Difference to COL_TYPE_WALL is unknown.
@ COL_TYPE_SPECIAL_WALL
Various other wall types, determined by variant.
@ COL_TYPE_FALL_BOUNDARY
Non-solid out-of-bounds trigger.
@ COL_TYPE_CANNON_TRIGGER
Launches player to a destination "cannon point".
@ COL_TYPE_EFFECT_TRIGGER
Activates various effects based on variant.
#define KCL_TYPE_FLOOR
0x20E80FFF - Any KCL that the player or items can drive/land on.

Definition at line 158 of file KCollisionTypes.hh.

◆ KCL_TYPE_ANY_INVISIBLE_WALL

#define KCL_TYPE_ANY_INVISIBLE_WALL    (KCL_TYPE_INVISIBLE_WALL | KCL_TYPE_BIT(COL_TYPE_HALFPIPE_INVISIBLE_WALL))

0x90002000

Definition at line 171 of file KCollisionTypes.hh.

◆ KCL_TYPE_B0E82DFF

#define KCL_TYPE_B0E82DFF
Value:
KCL_TYPE_BIT(COL_TYPE_INVISIBLE_WALL) | \
KCL_TYPE_BIT(COL_TYPE_INVISIBLE_WALL2) & ~KCL_TYPE_BIT(COL_TYPE_ITEM_ROAD))
@ COL_TYPE_INVISIBLE_WALL
Solid wall that is (typically) invisible.
@ COL_TYPE_HALFPIPE_INVISIBLE_WALL
Invisible wall after a half-pipe jump, like in BC.
@ COL_TYPE_ITEM_ROAD
Road that is only solid for items.
#define KCL_TYPE_DRIVER_FLOOR
0x20E80DFF - Any KCL that the player can drive on.

0xB0E82DFF

Definition at line 153 of file KCollisionTypes.hh.

◆ KCL_TYPE_BIT

#define KCL_TYPE_BIT ( x)
Value:
(1 << (x))

Converts an attribute to the type mask bitfield for that attribute. The game uses this method in order to create a mask that represents multiple KCL attributes.

Definition at line 28 of file KCollisionTypes.hh.

◆ KCL_TYPE_DIRECTIONAL

#define KCL_TYPE_DIRECTIONAL
Value:
@ COL_TYPE_FORCE_RECALCULATE_ROUTE
Forces CPU pathing recalculation.
@ COL_TYPE_SOUND_TRIGGER
Triggers for changing sound effects per-course.

0x05070000

Definition at line 77 of file KCollisionTypes.hh.

◆ KCL_TYPE_DRIVER_FLOOR

#define KCL_TYPE_DRIVER_FLOOR   (KCL_TYPE_FLOOR & ~KCL_TYPE_BIT(COL_TYPE_ITEM_ROAD))

0x20E80DFF - Any KCL that the player can drive on.

Definition at line 104 of file KCollisionTypes.hh.

◆ KCL_TYPE_DRIVER_SOLID_SURFACE

#define KCL_TYPE_DRIVER_SOLID_SURFACE    (KCL_TYPE_VEHICLE_COLLIDEABLE | KCL_TYPE_BIT(COL_TYPE_CANNON_TRIGGER))

0xEAFABDFF

Definition at line 149 of file KCollisionTypes.hh.

◆ KCL_TYPE_DRIVER_WALL

#define KCL_TYPE_DRIVER_WALL
Value:
(KCL_TYPE_WALL & ~KCL_TYPE_BIT(COL_TYPE_ITEM_WALL) & \
#define KCL_TYPE_WALL
0xD010F000

0xC010B000

Definition at line 114 of file KCollisionTypes.hh.

◆ KCL_TYPE_DRIVER_WALL_NO_INVISIBLE_WALL

#define KCL_TYPE_DRIVER_WALL_NO_INVISIBLE_WALL    (KCL_TYPE_DRIVER_WALL & ~KCL_TYPE_BIT(COL_TYPE_INVISIBLE_WALL))

0xC0109000

Definition at line 119 of file KCollisionTypes.hh.

◆ KCL_TYPE_DRIVER_WALL_NO_INVISIBLE_WALL2

#define KCL_TYPE_DRIVER_WALL_NO_INVISIBLE_WALL2    (KCL_TYPE_DRIVER_WALL & ~KCL_TYPE_BIT(COL_TYPE_INVISIBLE_WALL2))

0x4010B000

Definition at line 123 of file KCollisionTypes.hh.

◆ KCL_TYPE_FLOOR

#define KCL_TYPE_FLOOR
Value:
KCL_TYPE_BIT(COL_TYPE_ROTATING_ROAD))
@ COL_TYPE_OFF_ROAD
Moderate off-road slowdown.
@ COL_TYPE_MOVING_WATER
Koopa Cape and DS Yoshi Falls.
@ COL_TYPE_STICKY_ROAD
Player sticks if within 200 units (rBC stairs).
@ COL_TYPE_BOOST_RAMP
Trickable. Variant affects boost duration.
@ COL_TYPE_WEAK_OFF_ROAD
Slight off-road slowdown.
@ COL_TYPE_ROAD2
COL_TYPE_ROAD but with more variants.
@ COL_TYPE_HALFPIPE_RAMP
Bowser's Castle half-pipe ramps.
@ COL_TYPE_SLIPPERY_ROAD_2
N64 Sherbet Land.
@ COL_TYPE_ROAD
Default road.
@ COL_TYPE_SLIPPERY_ROAD
Like Dry Dry Ruins.
@ COL_TYPE_BOOST_PAD
Boost panel.
@ COL_TYPE_ROTATING_ROAD
Chain Chomp Roulette.
@ COL_TYPE_SOLID_OOB
Solid out-of-bounds trigger.
@ COL_TYPE_JUMP_PAD
Like GBA Shy Guy Beach.
@ COL_TYPE_MOVING_ROAD
TF conveyers and CM escalators.
@ COL_TYPE_HEAVY_OFF_ROAD
Heavy off-road slowdown.

0x20E80FFF - Any KCL that the player or items can drive/land on.

Definition at line 92 of file KCollisionTypes.hh.

◆ KCL_TYPE_INVISIBLE_WALL

#define KCL_TYPE_INVISIBLE_WALL    (KCL_TYPE_BIT(COL_TYPE_INVISIBLE_WALL) | KCL_TYPE_BIT(COL_TYPE_INVISIBLE_WALL2))

0x80002000

Definition at line 167 of file KCollisionTypes.hh.

◆ KCL_TYPE_NON_DIRECTIONAL

#define KCL_TYPE_NON_DIRECTIONAL
Value:
~KCL_TYPE_BIT(COL_TYPE_WEAK_WALL))
@ COL_TYPE_ITEM_STATE_MODIFIER
Stops items when leaving curved TF conveyers.
@ COL_TYPE_WEAK_WALL
Pushes player away only at low speeds.
#define KCL_TYPE_VEHICLE_COLLIDEABLE
0xEAF8BDFF

0xE0F8BDFF

Definition at line 144 of file KCollisionTypes.hh.

◆ KCL_TYPE_SOLID_SURFACE

#define KCL_TYPE_SOLID_SURFACE
Value:
(KCL_ANY & \
(~KCL_TYPE_BIT(COL_TYPE_FALL_BOUNDARY) & ~KCL_TYPE_BIT(COL_TYPE_CANNON_TRIGGER) & \
~KCL_TYPE_BIT(COL_TYPE_SOUND_TRIGGER) & ~KCL_TYPE_BIT(COL_TYPE_WEAK_WALL) & \
~KCL_TYPE_BIT(COL_TYPE_EFFECT_TRIGGER) & \

0xF0F8FFFF

Definition at line 83 of file KCollisionTypes.hh.

◆ KCL_TYPE_VEHICLE_COLLIDEABLE

#define KCL_TYPE_VEHICLE_COLLIDEABLE
Value:
~KCL_TYPE_BIT(COL_TYPE_EFFECT_TRIGGER) & ~KCL_TYPE_BIT(COL_TYPE_FALL_BOUNDARY) & \
~KCL_TYPE_BIT(COL_TYPE_CANNON_TRIGGER) & \
#define KCL_TYPE_VEHICLE_INTERACTABLE
0xEFFFBDFF

0xEAF8BDFF

Definition at line 137 of file KCollisionTypes.hh.

◆ KCL_TYPE_VEHICLE_INTERACTABLE

#define KCL_TYPE_VEHICLE_INTERACTABLE
Value:
(~KCL_TYPE_BIT(COL_TYPE_ITEM_ROAD) & ~KCL_TYPE_BIT(COL_TYPE_ITEM_WALL) & \

0xEFFFBDFF

Definition at line 132 of file KCollisionTypes.hh.

◆ KCL_TYPE_WALL

#define KCL_TYPE_WALL
Value:

0xD010F000

Definition at line 107 of file KCollisionTypes.hh.

◆ KCL_VARIANT_TYPE

#define KCL_VARIANT_TYPE ( x)
Value:
((x >> 5) & 7)

Extracts the "Variant" portion of the 2 byte KCL flag. It's the 3 bits before the "Bast Type".

Definition at line 32 of file KCollisionTypes.hh.

Enumeration Type Documentation

◆ KColType

enum KColType
Enumerator
COL_TYPE_ROAD 

Default road.

COL_TYPE_SLIPPERY_ROAD 

Like Dry Dry Ruins.

COL_TYPE_WEAK_OFF_ROAD 

Slight off-road slowdown.

COL_TYPE_OFF_ROAD 

Moderate off-road slowdown.

COL_TYPE_HEAVY_OFF_ROAD 

Heavy off-road slowdown.

COL_TYPE_SLIPPERY_ROAD_2 

N64 Sherbet Land.

COL_TYPE_BOOST_PAD 

Boost panel.

COL_TYPE_BOOST_RAMP 

Trickable. Variant affects boost duration.

COL_TYPE_JUMP_PAD 

Like GBA Shy Guy Beach.

COL_TYPE_ITEM_ROAD 

Road that is only solid for items.

COL_TYPE_SOLID_OOB 

Solid out-of-bounds trigger.

COL_TYPE_MOVING_WATER 

Koopa Cape and DS Yoshi Falls.

COL_TYPE_WALL 

Default wall.

COL_TYPE_INVISIBLE_WALL 

Solid wall that is (typically) invisible.

COL_TYPE_ITEM_WALL 

Wall that is only solid for items.

COL_TYPE_WALL_2 

Difference to COL_TYPE_WALL is unknown.

COL_TYPE_FALL_BOUNDARY 

Non-solid out-of-bounds trigger.

COL_TYPE_CANNON_TRIGGER 

Launches player to a destination "cannon point".

COL_TYPE_FORCE_RECALCULATE_ROUTE 

Forces CPU pathing recalculation.

COL_TYPE_HALFPIPE_RAMP 

Bowser's Castle half-pipe ramps.

COL_TYPE_PLAYER_WALL 

Allows items to pass through but not players.

COL_TYPE_MOVING_ROAD 

TF conveyers and CM escalators.

COL_TYPE_STICKY_ROAD 

Player sticks if within 200 units (rBC stairs).

COL_TYPE_ROAD2 

COL_TYPE_ROAD but with more variants.

COL_TYPE_SOUND_TRIGGER 

Triggers for changing sound effects per-course.

COL_TYPE_WEAK_WALL 

Pushes player away only at low speeds.

COL_TYPE_EFFECT_TRIGGER 

Activates various effects based on variant.

COL_TYPE_ITEM_STATE_MODIFIER 

Stops items when leaving curved TF conveyers.

COL_TYPE_HALFPIPE_INVISIBLE_WALL 

Invisible wall after a half-pipe jump, like in BC.

COL_TYPE_ROTATING_ROAD 

Chain Chomp Roulette.

COL_TYPE_SPECIAL_WALL 

Various other wall types, determined by variant.

COL_TYPE_INVISIBLE_WALL2 

Identical to COL_TYPE_INVISIBLE_WALL.

Definition at line 35 of file KCollisionTypes.hh.