cmt.cmap.v0

cmt.cmap.v0.cmap

class cmt.cmap.v0.cmap.CMap

Bases: cmt.cmap.a_cmap.ACMap

Celaria .cmap format (version 0)

Datatypes

Abbreviation

Type

Byte size

uByte

unsigned byte

1

uShort

unsigned short

2

uInt

unsigned int

4

sShort

signed short

2

sInt

signed int

4

f32

float

4

f64

double

8

Description format

> <datatype> (<number of datatypes in sequence>) // <description>

or

> [<variable name>] : <datatype> (<number of datatypes in sequence>) // <description>

Format

> uByte (11) // string identifier
> uByte (1) // version

> nameLen : uByte (1) // number of characters in map name
> uByte (nameLen) // map name as String

> uByte (1) - boolean, if the timer will be run in singleplayer

> uByte (1) // unused byte

> times : uByte (1) - number of checkpoint times (including medal time)

> uInt (times) // checkpoint times for platin
> uInt (times) // checkpoint times for gold
> uInt (times) // checkpoint times for silver
> uInt (times) // checkpoint times for bronze

> f32 (1) // sun rotation on Z axis
> f32 (1) // sun height expressed as an angle (between 0 and 90 degrees)

> f64 (1) // preview camera position x
> f64 (1) // preview camera position y
> f64 (1) // preview camera position z
> f64 (1) // preview camera look at position x
> f64 (1) // preview camera look at position y
> f64 (1) // preview camera look at position z

> entityNumber : uInt (1) // number of entities on the map

for entity in entityNumber {
    > entityType : uInt (1) // entityType

    switch(entityType) {
        case 0: // block
            > blockType : uByte (1) // blockType/color
            > uByte (1) // unused byte
            > sInt (1) // position x
            > sInt (1) // position y
            > uInt (1) // position z
            > uInt (1) // scale x
            > uInt (1) // scale y
            > uInt (1) // scale z
            > f32 (1) // rotation on Z axis

            if (blockType == 5){ // checkpoint block
                > uByte (1) // checkpoint Number
            }

        case 1: // sphere
            > sInt (1) // position x
            > sInt (1) // position y
            > sInt (1) // position z

        case 2: // player start
            > uByte (1) // unused byte
            > sInt (1) // position x
            > sInt (1) // position y
            > sInt (1) // position z
            > f32 (1) // rotation on Z axis

        case 128: // dummy id
            > uByte (1) // ID
            > sInt (1) // position x
            > sInt (1) // position y
            > uInt (1) // position z
            > uInt (1) // scale x
            > uInt (1) // scale y
            > uInt (1) // scale z
            > f32 (1) // rotation on Z axis
}
classmethod decode(data, offset, debug=False)
Return type

CMAP

encode()
Return type

bytearray

cmt.cmap.v0.entities

class cmt.cmap.v0.entities.Block

Bases: cmt.cmap.a_entity.AEntity

classmethod decode(data, offset, debug=False)
Parameters
  • data (bytes) –

  • offset (int) – without entity type byte

  • debug (bool) –

Return type

Block

encode()

Includes the entity type.

Return type

bytearray

class cmt.cmap.v0.entities.BlockType

Bases: enum.Enum

An enumeration.

CHECKPOINT = 5
FINISH = 1
ICE = 4
JUMP = 2
NOTHING = 0
SPEED = 3
class cmt.cmap.v0.entities.Dummy

Bases: cmt.cmap.a_entity.AEntity

classmethod decode(data, offset, debug=False)
Parameters
  • data (bytes) –

  • offset (int) – without entity type byte

  • debug (bool) –

Return type

Dummy

encode()

Includes the entity type.

Return type

bytearray

class cmt.cmap.v0.entities.PlayerStart

Bases: cmt.cmap.a_entity.AEntity

classmethod decode(data, offset, debug=False)
Parameters
  • data (bytes) –

  • offset (int) – without entity type byte

  • debug (bool) –

Return type

PlayerStart

encode()

Includes the entity type.

Return type

bytearray

class cmt.cmap.v0.entities.Sphere

Bases: cmt.cmap.a_entity.AEntity

classmethod decode(data, offset, debug=False)
Parameters
  • data (bytes) –

  • offset (int) – without entity type byte

  • debug (bool) –

Return type

Sphere

encode()

Includes the entity type.

Return type

bytearray

cmt.cmap.v0.medal_time

class cmt.cmap.v0.medal_time.MedalTime(platin=0, gold=0, silver=0, bronze=0)

Bases: object

cmt.cmap.v0.medal_time.decode_medal_times(data, offset, debug=False)

Must start with the length byte.

Parameters
Return type

List[MedalTime]