Cauldron2D.GameMaker.Bytes (Cauldron2D.GameMaker v0.2.1)

Copy Markdown View Source

Values read at absolute offsets of a GameMaker data file.

Every number is little-endian. A string field holds the offset of the string's first byte inside the STRG chunk, with its length in the four bytes before it; 0 is no string. A pointer list is a count followed by that many absolute offsets, one per item; a simple list is a count followed by the items themselves.

Summary

Functions

A colour field as {r, g, b, a}: GameMaker stores the red byte first.

The 32-bit float at at.

A 32-bit float, read from its bits. Infinities and NaN, which Erlang has no float for, are :infinity, :neg_infinity and :nan.

The signed 32-bit number at at.

The item offsets of the pointer list at at.

The string a string field holds, nil for 0.

The string whose field is at at.

The unsigned 32-bit number at at.

The count unsigned 32-bit numbers starting at at.

Functions

colour(value)

@spec colour(non_neg_integer()) :: {byte(), byte(), byte(), byte()}

A colour field as {r, g, b, a}: GameMaker stores the red byte first.

f32(data, at)

@spec f32(binary(), non_neg_integer()) :: float() | :infinity | :neg_infinity | :nan

The 32-bit float at at.

float(arg)

@spec float(<<_::32>>) :: float() | :infinity | :neg_infinity | :nan

A 32-bit float, read from its bits. Infinities and NaN, which Erlang has no float for, are :infinity, :neg_infinity and :nan.

i32(data, at)

@spec i32(binary(), non_neg_integer()) :: integer()

The signed 32-bit number at at.

pointers(data, at)

@spec pointers(binary(), non_neg_integer()) :: [non_neg_integer()]

The item offsets of the pointer list at at.

string(data, pointer)

@spec string(binary(), non_neg_integer()) :: String.t() | nil

The string a string field holds, nil for 0.

string_at(data, at)

@spec string_at(binary(), non_neg_integer()) :: String.t() | nil

The string whose field is at at.

u32(data, at)

@spec u32(binary(), non_neg_integer()) :: non_neg_integer()

The unsigned 32-bit number at at.

u32s(data, at, count)

The count unsigned 32-bit numbers starting at at.