Jazz2::Scripting::Legacy::jjMASKMAP class

Editable collision mask of a tile.

A 32×32 array of pixels, true for a solid pixel and false for an empty one. It can be read from a tile and saved into a tile to change where objects collide with it.

Public static variables

static std::uint32_t Size constexpr
Size of the mask, which is always the one of a tile.

Public static functions

static auto CreateFromBool(bool filled) -> jjMASKMAP*
Creates a mask with every pixel solid or every pixel empty.
static auto CreateFromTile(std::uint16_t tileID) -> jjMASKMAP*
Creates a mask from the collision mask of a tile.

Constructors, destructors, conversion operators

jjMASKMAP()
Creates a new instance.
~jjMASKMAP()

Public functions

void AddRef()
Increments the reference count.
void Release()
Decrements the reference count.
auto operator=(const jjMASKMAP& o) -> jjMASKMAP&
auto GetPixel(std::uint32_t x, std::uint32_t y) -> bool*
Returns the pixel at the given position, true if it's solid.
auto save(std::uint16_t tileID, bool hFlip) const -> bool partially supported
Replaces the collision mask of a tile.

Function documentation

static jjMASKMAP* Jazz2::Scripting::Legacy::jjMASKMAP::CreateFromTile(std::uint16_t tileID)

Creates a mask from the collision mask of a tile.

Flips and animated tiles are handled as by the same constructor of jjPIXELMAP.

bool* Jazz2::Scripting::Legacy::jjMASKMAP::GetPixel(std::uint32_t x, std::uint32_t y)

Returns the pixel at the given position, true if it's solid.

Pixels are stored row by row, so an x past 31 continues on the following rows. A position past the end of the mask reads as false, and what's written there is lost.

bool Jazz2::Scripting::Legacy::jjMASKMAP::save(std::uint16_t tileID, bool hFlip) const

Replaces the collision mask of a tile.