Jazz2::Tiles namespace

Tile sets and maps.

Classes

struct AnimatedTile
Represents an animated tile.
struct AnimatedTileFrame
Represents a single frame of an animated tile.
class ITileMapLayerOverride
Draws images in place of the tiles of layers, as the level editor does for a view from far away.
class ITileMapOwner
Interface used to notify tile map owner of various events.
struct LayerDescription
Describes the configuration of a tile map layer.
struct LayerEffectsTarget
What the special tile layers need from the viewport they are drawn in.
class LayerLayout
Tiles of a single TileMapLayer, in blocks and in one of two forms.
struct LayerTile
Represents a single tile placed in a tile map layer.
struct TileCollisionParams
Describes how the object interacts and collides with the environment.
class TileMap
Represents a renderable tile map, consists of multiple layers.
struct TileMapLayer
Represents a single tile map layer.
struct TileMapLayerImage
An image drawn in place of the tiles of a layer, see ITileMapLayerOverride.
struct TileMapViewOptions
Options of how a tile map is shown.
class TileSet
Represents tile set used by tile map, consists of texture and collision mask.

Enums

enum class LayerSpeedModel { Default, AlwaysOnTop, FitLevel, SpeedMultipliers, FromStart }
Describes how a layer's parallax scrolling speed is interpreted.
enum class LayerRendererType { Default, Solid, Tinted, XRay, BlurBehind, PaletteShift, SingleColor, AlphaMap = 8, PaletteMapping, Sky = 10, Tunnel, TileMenu = 13, Wave = 14, Cylinder = 15, Reflection = 16 }
Specifies how a layer is rendered.
enum class LayerBlend : std::uint8_t { Normal, Translucent, ChromaKey, Screen, Multiply, Darken, Lighten, Hue, Saturation, Color, Luminosity, Dissolve, Overlay, HardLight, SoftLight, Difference, Dodge, Burn, Exclusion, Last = Exclusion }
How a layer is blended over what is behind it.
enum class TileDestructType : std::uint8_t { None = 0x00, Weapon = 0x01, Speed = 0x02, Collapse = 0x04, Special = 0x08, Trigger = 0x10, IgnoreSolidTiles = 0x20, VerticalMove = 0x40, SuspendTiles = 0x80 }
Specifies how a tile reacts when collided with.
enum class LayerTileFlags : std::uint8_t { None = 0x00, FlipX = 0x01, FlipY = 0x02, Heat = 0x04, OneWay = 0x10, Collapsing = 0x80 }
Per-tile state flags of a tile placed in a layer.
enum class LayerPlacement : std::uint8_t { Gameplay, ReferenceView }
How the layers of a tile map are placed relative to the view.

Enum documentation

enum class Jazz2::Tiles::LayerSpeedModel

Describes how a layer's parallax scrolling speed is interpreted.

Selected per axis in LayerDescription to control how a layer follows the camera — the default parallax model, the same counted from the top/left of the level, locking to the top/left of the screen, fitting the whole layer into view, or treating the speed values as multipliers of the camera size rather than its position.

They are the speed models of JJ2+ (LAYERSPEEDMODEL) under other values, and a layer is placed as JJ2+ places it, measured with Tests/Level/LayerProbe.j2as (see LayerDescription::GetViewCoordinates()). NORMAL has no model of its own, it's Default without the speed for a layer that has an auto speed.

Enumerators
Default

Default model, as LAYERSPEEDMODEL::BOTHSPEEDS — moves by the speed and the auto speed, with the origin depending on the size of the view.

AlwaysOnTop

Ignores all speed and offset settings to be tied to the top/left side of the screen, as LAYERSPEEDMODEL::LAYER8. A textured layer in the perspective of JJ2+ (Formats::TexturedLayerParams::Fullscreen) is placed where layer 5 of the original game is drawn instead, or at the screen without one, and moved by its own auto speed, as there. Since 4.0.0.

FitLevel

Ignores the speed and auto speed properties, and instead ensures that the full extent of this layer will be visible and no blank space outside of it will be shown.

SpeedMultipliers

Treats the layer's speed and auto speed properties on this axis as multipliers of the current camera size, rather than camera position.

FromStart

As Default, but with the origin at the top/left side of the level whatever the size of the view, and without the inherent offset, as LAYERSPEEDMODEL::FROMSTART. Since 4.0.0, earlier versions place such a layer as one of Default.

enum class Jazz2::Tiles::LayerRendererType

Specifies how a layer is rendered.

Stored in LayerDescription to choose the rendering path for a layer — ordinary textured tiles, a solid or color-tinted fill, tiles with their colors moved through the palette, one of the two layers that show something of what is behind them (x-ray and blur), one of the special textured background effects (sky, tunnel, wave or cylinder) used for distant parallax backdrops, or a reflection of what is above its horizon.

The x-ray, blur and reflection layers need a backend that can sample a render target in a shader. Elsewhere an x-ray layer is drawn as a default one showing its animated tiles as they are outside the objects, and a blur or a reflection layer isn't drawn at all, so a level looks as it would without the effects.

The textured background effects take the values the textured layers of JJ2+ have (TEXTURE::Style, the type of the textured background of a layer of the original game). Any number of layers can be textured or reflections, each is drawn with a texture of its own, made of its tiles.

Enumerators
Default

Default rendering

Solid

Solid color rendering

Tinted

Color-tinted rendering

XRay

X-ray — the last frame of an animated tile of the layer is its mask frame, shown only where an object is behind it, in the object's silhouette. Elsewhere the tile animates through the frames before it as usual, and a tile of a single frame shows nothing at all. Any frame may be the empty tile, which cuts the object out of the layer or shows the tile only over the object. Static tiles are drawn as usual.

BlurBehind

Blur behind — the layer isn't drawn, it shows what is below it instead, per pixel by the channels of its tiles: moved horizontally by red and vertically by green (128 leaves it in place, every step away from it moves it by a quarter of the layer's pixel, so up to 32 pixels either way), mirrored vertically by blue, and blurred by alpha - the reflection too, so a gradient fades a reflection out into a blur. A pixel of no alpha does nothing at all, whatever its colour, so alpha 1 is one that moves or mirrors without a blur. The alpha of the layer's color sets how strong all of it is. The mirror line of a reflection is the first visible row of the topmost tile of the uninterrupted column of reflective tiles it belongs to, so a taller column reflects more of what is above it. The blur follows the blur effects option, the rest is always shown.

PaletteShift

Palette shift, as SPRITE::PALSHIFT of JJ2+ — every pixel of the tiles takes the color the given number of entries further in the palette, wrapping around after its end. The shift is the red of the layer's color (0 to 255, as a byte), its alpha how opaque the layer is. The transparent pixels (index 0) stay transparent, a pixel moved onto index 0 shows its color. It follows the palette as it changes. Tiles stored in true color aren't changed. Readers before 4.0.0 draw such a layer as an ordinary one.

SingleColor

Single color, as SPRITE::SINGLECOLOR of JJ2+ — every visible pixel of the tiles takes the same color, the entry of the palette the red of the layer's color is (0 to 255, as a byte), so only the shapes of the tiles are seen, e.g. a shadow of another layer. It follows the palette as it changes, but only the color of the entry is taken, not its alpha. The alpha is how opaque the layer is. Readers before 4.0.0 draw such a layer as an ordinary one.

AlphaMap

Alpha map, as SPRITE::ALPHAMAP of JJ2+ — every pixel of the tiles takes the color of the entry of the palette the red of the layer's color is (0 to 255, as a byte), as opaque as its palette index is high (index 255 fully opaque), so a gradient of indices is a glow of that color. It follows the palette as it changes. The alpha is how opaque the layer is. Tiles stored in true color aren't changed.

PaletteMapping

Palette mapping, as SPRITE::MAPPING of JJ2+ in 16-bit color — the tiles are drawn through one of the additional palettes of the level instead of its palette, the red of the layer's color is its index (0 to 255, as a byte), so they keep their colors whatever happens to the palette of the level. The alpha is how opaque the layer is. Without such a palette, and for tiles stored in true color, it's drawn as an ordinary layer.

Sky

Textured background — sky, as TEXTURE::WARPHORIZON of JJ2+: the tiles of a layer of 8×8 tiles as two planes stretching to the horizon, fading into the red, green and blue of the layer's color there; non-zero alpha shows stars over the horizon. Where the vanishing point and the horizon are (LayerDescription::TextureFadePosition) and whether it fades out (LayerDescription::TextureFade) are kept apart from the color (see Formats::TexturedLayerParams), readers before 4.0.0 draw them in the middle, fading. A layer of another size is drawn as ordinary tiles, unless it has a texture of its own (see Formats::LayerPropertiesChunk::Entry::Texture), which any textured background takes instead of its tiles.

Any textured background can also be drawn only where the layer is placed, as an ordinary layer would be, as SURFACE::INNERWINDOW and SURFACE::INNERLAYER of JJ2+ (LayerDescription::TextureFlags), but a wave. Over the whole view, a sky, a tunnel and a cylinder are drawn as the sky layers always were here, or in the perspective of JJ2+ with the texture placed by the speeds of the layer as SURFACE::FULLSCREEN (see Formats::TexturedLayerParams::Fullscreen), which the inner surfaces are always drawn in.

Tunnel

Textured background — tunnel, as TEXTURE::TUNNEL of JJ2+: the tiles of a layer of 8×8 tiles as circles getting smaller into the distance, fading into the red, green and blue of the layer's color in the center; non-zero alpha shows stars over it. Where the center is (LayerDescription::TextureFadePosition), whether it fades out (LayerDescription::TextureFade) and whether the circles spiral (LayerDescription::TextureFlags) are kept apart from the color (see Formats::TexturedLayerParams). A layer of another size is drawn as ordinary tiles, unless it has a texture of its own (see Sky).

TileMenu

Textured background — tile menu, as TEXTURE::TILEMENU of JJ2+: the rotating background of the main menu of the original, three layers repeated over the view, each turning and zooming in and out at its own pace. The frontmost is the texture of the layer (its 8×8 tiles at the top left, or its texture of its own, see Sky), the middle one the 2×2 tiles at the top left of the sprite layer and the back one its tile (0, 2). They're drawn at half their size, at their own size with non-zero alpha of the layer's color. The point all of them turn around is a fraction of the view (LayerDescription::TextureFadePosition), they turn and zoom at the pace of JJ2+, whatever the speeds of the layer are. Readers before 4.0.0 draw such a layer as ordinary tiles.

Wave

Textured background — wave, as TEXTURE::WAVE of JJ2+: the tiles of a layer of 8×8 tiles as a texture repeated where the layer's own tiles would be, with each row moved left or right and each column up or down by sine waves. The red of the layer's color is the wavelength of the horizontal waves, a period of one more row than it, green the same of the vertical waves over the columns (0 for no waves), and blue the speed the waves move at, as a signed byte, 1/1024 of a period each 70th of a second; alpha isn't taken. How far the waves move the texture (LayerDescription::TextureFadePosition, in units of 128 pixels) and which way the vertical waves move (LayerDescription::TextureFlags) are kept apart from the color (see Formats::TexturedLayerParams). As measured in the original, the waves follow the texture, not the view, and a texel moves by the waves of where it is in the texture. A layer of another size is drawn as ordinary tiles, unless it has a texture of its own (see Sky). Readers before 4.0.0 draw such a layer as ordinary tiles.

Cylinder

Textured background — cylinder, as TEXTURE::CYLINDER of JJ2+, always drawn in its perspective (it has no other model, see LayerDescription::HasPlusPerspective()): the tiles of a layer of 8×8 tiles as the inside of a horizontal tube. They go once from the top of the view to the bottom, narrower across towards the top and the bottom, a row an angle of half a turn over the view from the horizon; the horizontal scroll moves along the tube a quarter as fast as an ordinary layer, the vertical one turns it. Near the horizon it fades into the red, green and blue of the layer's color, to 65 % of it, the alpha isn't taken. Where the center of the horizon is (LayerDescription::TextureFadePosition), whether it fades (LayerDescription::TextureFade) and whether it's drawn at half size, four times across the view and more curved (LayerDescription::TextureFlags), are kept apart from the color (see Formats::TexturedLayerParams). A layer of another size is drawn as ordinary tiles, unless it has a texture of its own (see Sky). Readers before 4.0.0 draw such a layer as an ordinary one modulated by its color.

Reflection

Reflection, as TEXTURE::REFLECTION of JJ2+ — the layer is drawn below its horizon only, where it shows what is drawn behind it above the horizon mirrored, as a plane of water stretching to the horizon would. The tiles aren't shown, the 8×8 of them at the top left of the layer — or its texture of its own (see Formats::LayerPropertiesChunk::Entry::Texture) — are laid on the plane at twice the size of the plane's own units and move what is mirrored, as ripples, up or down by how much higher the palette index of a pixel is than that of the pixel half of the texture further along the plane, and left or right by how much higher the index of the pixel a quarter of the texture back and to the left is than that of the one half of the texture to the right of it (the brightest channel of a tile in true color stands for its index), as JJ2+ does; a texture that is the same there doesn't ripple. The red of the layer's color is the opacity of the tint over the plane, green the distance of the plane (the higher, the smaller the texture), blue the distortion, how far the ripples move what is mirrored (0.6 of a pixel for each 32 palette indices times the distortion of 0 to 255, scaled to how strong the ripples of the built-in textures of JJ2+ are, the same on every row but the first 15 below the horizon, where it's halved for each time the rows halve), and non-zero alpha blurs it horizontally. The horizon and the vanishing point (LayerDescription::TextureFadePosition), the palette entry of the tint (LayerDescription::TextureFade) and whether it's drawn only where the layer is placed, as an ordinary layer would be (LayerDescription::TextureFlags), are kept apart from the color (see Formats::TexturedLayerParams). Over the whole view the texture moves with the view by the speeds of the layer and by itself by its auto speeds (by the auto speed Y twice as far as the layer, as in JJ2+); drawn only where the layer is, the speeds place the layer, and the texture moves inside it by the inner speeds and the inner auto speeds instead (LayerDescription::TextureInnerSpeed, LayerDescription::TextureInnerAutoSpeed) — a positive one moves it to the left and away towards the horizon, as in JJ2+. Where there are more rows below the horizon than above it, the top row of the view is repeated, a horizon at the top of the view reflects black. Readers before 4.0.0 draw such a layer as an ordinary one modulated by its color.

enum class Jazz2::Tiles::LayerBlend : std::uint8_t

How a layer is blended over what is behind it.

The sprite modes of JJ2+ a layer can be drawn with (see LayerDescription::Blend), stored in a level file in Formats::LayerPropertiesChunk. Screen and Multiply take a layer of any renderer type that draws its tiles through the palette (LayerRendererType::Default, LayerRendererType::PaletteShift, LayerRendererType::AlphaMap and LayerRendererType::PaletteMapping), and a textured background; tiles stored in true color are drawn as in an ordinary layer. ChromaKey and the blend modes from Darken on take an ordinary layer of tiles (LayerRendererType::Default) and a textured background, Translucent only a textured background, a layer of tiles is as opaque as the alpha of its color says. The sprite layer is always drawn as its renderer type draws it.

Translucent, ChromaKey and the blend modes from Darken on need a backend that can sample a render target in a shader, they read what is behind the layer. Elsewhere a textured background is drawn opaque, a layer of tiles of ChromaKey isn't drawn at all, and one of another blend mode is drawn as an ordinary one.

The blend modes from Darken on are those of JJ2+ (SPRITE::BLEND_DARKEN and the like), as image editors have them: the color of the layer and the color behind it make the color shown, which is mixed over what is behind it as far as LayerDescription::BlendParam is from 0 to 255 (see LayerDescription::FromSpriteMode()).

Enumerators
Normal

Drawn as the renderer type draws it.

Translucent

As opaque as LayerDescription::BlendParam is, from 0 to 255.

ChromaKey

Only over the pixels behind it of the color of the palette entry LayerDescription::BlendParam, as SPRITE::CHROMAKEY.

A part of the scene painted in that color is a window the layer shows through.

Screen

Lightens what is behind it, mixed over it as far as LayerDescription::BlendParam is from 0 to 255, as SPRITE::BLEND_SCREEN.

Multiply

Darkens what is behind it, mixed over it as far as LayerDescription::BlendParam is from 0 to 255, as SPRITE::BLEND_MULTIPLY.

Darken

The darker of each channel, as SPRITE::BLEND_DARKEN.

Lighten

The lighter of each channel, as SPRITE::BLEND_LIGHTEN.

Hue

The hue of the layer with the saturation and the luminosity behind it, as SPRITE::BLEND_HUE.

Saturation

The saturation of the layer with the hue and the luminosity behind it, as SPRITE::BLEND_SATURATION.

Color

The hue and the saturation of the layer with the luminosity behind it, as SPRITE::BLEND_COLOR.

Luminosity

The luminosity of the layer with the hue and the saturation behind it, as SPRITE::BLEND_LUMINANCE.

Dissolve

As many pixels of the layer drawn as it's opaque, the others not at all, as SPRITE::BLEND_DISSOLVE.

Overlay

Multiplied or screened by what is behind it, as SPRITE::BLEND_OVERLAY.

HardLight

Multiplied or screened by the layer, as SPRITE::BLEND_HARDLIGHT.

SoftLight

Darkened or lightened softly by the layer, as SPRITE::BLEND_SOFTLIGHT.

Difference

The difference of each channel, as SPRITE::BLEND_DIFFERENCE.

Dodge

What is behind it brightened by the layer, as SPRITE::BLEND_DODGE.

Burn

What is behind it darkened by the layer, as SPRITE::BLEND_BURN.

Exclusion

Like Difference, but of less contrast, as SPRITE::BLEND_EXCLUSION.

Last

The last blend this version knows, a layer of a later one is drawn as its renderer type draws it.

enum class Jazz2::Tiles::TileDestructType : std::uint8_t

Specifies how a tile reacts when collided with.

Assigned per tile to describe what can destroy or trigger it (a weapon hit, movement speed, a special move, collapsing or acting as a trigger) along with collision modifiers such as ignoring solid tiles or restricting movement to the vertical axis. Supports a bitwise combination of its member values.

Enumerators
None

No collision

Weapon

Destroyed by a weapon

Speed

Destroyed by movement speed

Collapse

Collapsible tile

Special

Destroyed by a special move

Trigger

Trigger tile

IgnoreSolidTiles

Solid tiles are ignored during collision

VerticalMove

Movement is vertical

SuspendTiles

Masks of tiles players hang from (vines, hooks) are solid too

enum class Jazz2::Tiles::LayerTileFlags : std::uint8_t

Per-tile state flags of a tile placed in a layer.

Stored on each LayerTile to mark horizontal/vertical flipping, one-way collision and the runtime-only state of a tile already queued in the active collapsing list. Supports a bitwise combination of its member values.

Enumerators
None

None

FlipX

Flipped horizontally

FlipY

Flipped vertically

Heat

Heat effect, as the tile type of JJ2+ — every row of pixels of the tile is drawn moved left or right by up to 2 pixels, into the tiles next to it, by a fixed table of the 32 rows of a tile that scrolls up a row every 4 game ticks of the original (70 a second), measured in the original. Drawn so only in an ordinary layer and where the shader of it is available, as an ordinary tile otherwise.

OneWay

One-way collision

Collapsing

Runtime-only: tile is already queued in the active collapsing list

enum class Jazz2::Tiles::LayerPlacement : std::uint8_t

How the layers of a tile map are placed relative to the view.

Enumerators
Gameplay

As in the game, by the view that is drawn.

ReferenceView

As in the game, by a view of TileMapViewOptions::ReferenceViewSize at the same center.

The layers sit where the game would put them for the view of a player at the center, and are extended across a view of another size — the level editor zoomed out shows more of every layer, not layers moved apart.