Presence flag

From Custom Mario Kart
Jump to navigation Jump to search

The presence flags is a 16 bit parameter of KMP/OBJ and defined for which number of players an object is exists (visible and active).

First and wrong interpretation

The first interpretation of the flags were derived from Filesystem/Race/Course/koopa_course.szs/course.0:

<ObjDefine>
    ...
    format    sepa1_SW  user_data  1  Bool  1
    format    sepa2_SW  user_data  1  Bool  1
    format    sepa4_SW  user_data  1  Bool  1
    format    sepaW1_SW  user_data  1  Bool  1
    format    sepaW2_SW  user_data  1  Bool  1
    format    sepaW4_SW  user_data  1  Bool  1
</ObjDefine>

Because a usual presence flag has the value of 0x3f, the first (and wrong) interpretation was:

Bit
Number
Hex
Value
First and wrong interpretation
0 0x01 Offline single player and time trials.
1 0x02 Offline 2 players.
2 0x04 Offline 3 or 4 players.
3 0x08 Online single player.
4 0x10 Online 2 players.
5 0x20 Online 3 or 4 players.

Correct interpretation

In 2016, Wiimm tested all 16 possible bits of the flags and found a new interpretation: Only the 3 least significant bits are used, all other are ignored:

Bit
Number
Hex
Value
Correct interpretation
0 0x01 Single player (offline and online) and time trials.
1 0x02 2 players, offline and online.
2 0x04 3 or 4 players, offline.
3 0x08 no meaning (ignored)
4 0x10 no meaning (ignored)
5 0x20 no meaning (ignored)

It is important to hide objects for 2 players mode only, if they are decorative. Otherwise online players at split-screen will use another track than single players!
In other words: For objects with impact on the gameplay, bit 0 and bit 1 must be equal!

Typical values

The following table shows typical values. The second column (Same as) reduces the value to the 3 least significant bits:

Value Same as Description Usage
0x00 0 Object is always disabled. It's like not defined. This value is used by custom track authors to disable objects temporary.
0x01 1 Object is only enabled for single player mode (offline and online), but not for 2 or more players.
0x09 This value is used by Nintendo to reduce slow motion bug at 2-player split screen. This value is only used to hide decorative objects like WLscreenGC, but never for objects with impact on the gameplay.
0x39 This value is used by many custom track authors to reduce slow motion bug.
0x3f 7 Object is always enabled. Standard value.