Skip to Content
The Alchemy Project

src/field/field_decompress.c

Resource metadata records and LZ decompression. More…

Included by field.c.

Macros

NameDescription
#defineSPRITE_COUNT (SPRITE_STATUS_GRIM_REAPER_7 + 1)The sprite table's rows, one for each sprite id up to the last status sprite.

Enumerations

NameDescription
enumanonymous enum { LZ_FLAGS_MARKER, LZ_LENGTH_SHIFT, LZ_DISTANCE_MASK, LZ_LONG_ … }An LZ stream's commands: a byte of eight flags, read from its low bit, each taking one literal byte (1) or one run (0).

Functions

NameDescription
ANIMATION_METADATA *fdResourceGetMetadataRecordStub (Uint32 id)Returns the animation metadata of the sprite id in id's low twelve bits; an id past the last sprite reads the first's.
Uint8 *fdDecompressLZ (const Uint8 *src, Uint8 *dest)Decompresses an LZ stream from source into destination and returns destination.

Description

Resource metadata records and LZ decompression. Part of field.c.

Macros in detail

SPRITE_COUNT

#define SPRITE_COUNT (SPRITE_STATUS_GRIM_REAPER_7 + 1)

The sprite table's rows, one for each sprite id up to the last status sprite.

Referenced by fdResourceGetMetadataRecordStub().

Definition at line 6 of file field_decompress.c.

Enumerations in detail

anonymous enum

enum { LZ_FLAGS_MARKER, LZ_LENGTH_SHIFT, LZ_DISTANCE_MASK, LZ_LONG_LENGTH_BASE }

An LZ stream's commands: a byte of eight flags, read from its low bit, each taking one literal byte (1) or one run (0). A run's token is two bytes, high first: the run's length in its top four bits, how far back it copies from in its low twelve.

EnumeratorValueDescription
LZ_FLAGS_MARKER1 << 8set above a flag byte's eight flags
LZ_LENGTH_SHIFT12
LZ_DISTANCE_MASK(1 << LZ_LENGTH_SHIFT) - 1
LZ_LONG_LENGTH_BASE16A run whose length nibble is 0 takes its length from the next byte, plus the lengths the nibble holds.

Definition at line 22 of file field_decompress.c.

Functions in detail

fdResourceGetMetadataRecordStub

ANIMATION_METADATA *fdResourceGetMetadataRecordStub(Uint32 id)

Returns the animation metadata of the sprite id in id's low twelve bits; an id past the last sprite reads the first's.

References SpriteAnimationMetadata.

Referenced by fdActorCreate(), fdSpriteAddAnimation(), fdSpriteAnimationAllocate(), fdSpriteAnimationReset(), fdSpriteAnimationStart(), fdSpriteAnimationSumCommandLengths(), fdSpriteCreate(), fdSpritePictureCacheLoad(), fdSpriteResetAnimations(), fdSpriteStartAnimation(), fdSpriteViewerRun(), fdSpriteViewerSetLayerSprite() and fdSpriteViewerStartStaggeredAnimations().

Definition at line 10 of file field_decompress.c.

fdDecompressLZ

Uint8 *fdDecompressLZ(const Uint8 *src, Uint8 *dest)

Decompresses an LZ stream from source into destination and returns destination.

References Sint32.

Referenced by fdSpriteComposePicture().

Definition at line 34 of file field_decompress.c.