paldata#

Represents a set of palette colors. 256 rgb colors divided into 16 csets.

Variables#

rgb[]

Color

int[]

R

int[]

G

int[]

B

Constructors#

Functions#

void

LoadLevelPalette(int pal)

void

LoadSpritePalette(int pal)

void

LoadMainPalette()

void

LoadCyclePalette(int pal)

void

LoadBitmapPalette(int pal)

void

WriteLevelPalette(int pal)

void

WriteLevelCSet(int pal, int cset)

void

WriteSpritePalette(int pal)

void

WriteSpriteCSet(int pal, int cset)

void

WriteMainPalette()

void

WriteMainCSet(int cset)

void

WriteCyclePalette(int pal)

void

WriteCycleCSet(int pal, int cset)

bool

ColorValid(int index)

void

ClearColor(int index)

void

ClearCSet(int cset)

void

Mix(paldata start, paldata end, int percent = 5000L, int color_space = 0)

void

MixCSet(paldata start, paldata end, int cset, int percent = 5000L, int color_space = 0)

void

Copy(paldata target)

void

CopyCSet(paldata target, int src_cset, int dest_cset)

void

Free() deprecated

void

Own()

Variable descriptions#

rgb[] Color πŸ”— Source

Access colors of the paldata as rgb. Reading an invalid color will return INVALID_COLOR (-1). To write a color as invalid, use ClearColor() instead.


int[] R πŸ”— Source

Access the Red values of the paldata, ranging from 0-255. Reading an invalid color will return -1. To write a color as invalid, use ClearColor() instead.


int[] G πŸ”— Source

Access the Green values of the paldata, ranging from 0-255. Reading an invalid color will return -1. To write a color as invalid, use ClearColor() instead.


int[] B πŸ”— Source

Access the Blue values of the paldata, ranging from 0-255. Reading an invalid color will return -1. To write a color as invalid, use ClearColor() instead.


Constructor descriptions#

paldata paldata() πŸ”— Source


paldata paldata(rgb color) πŸ”— Source


Function descriptions#

void LoadLevelPalette(int pal) πŸ”— Source

Loads a level’s palette to the paldata.

CSets will be arranged as they appear on the main palette, so CSet 2 starts at index 0x20, ect.


void LoadSpritePalette(int pal) πŸ”— Source

Loads a page of sprite palettes to the paldata.

Currently only values of 0 and 1 are valid.


void LoadMainPalette() πŸ”— Source

Loads the main palette to the paldata.


void LoadCyclePalette(int pal) πŸ”— Source

Loads the cycle/dark room csets from a level palette to the paldata.


void LoadBitmapPalette(int pal) πŸ”— Source

Loads the palette from an image. Currently only BMP, PCX, and TGA are supported.


void WriteLevelPalette(int pal) πŸ”— Source

Writes the paldata to a level palette. Empty color indices will be skipped.


void WriteLevelCSet(int pal, int cset) πŸ”— Source

Writes a cset of the paldata to a level palette. Empty color indices will be skipped.


void WriteSpritePalette(int pal) πŸ”— Source

Writes the paldata to a sprite palette page. Empty color indices will be skipped.


void WriteSpriteCSet(int pal, int cset) πŸ”— Source

Writes a cset of the paldata to a sprite palette page. Empty color indices will be skipped.


void WriteMainPalette() πŸ”— Source

Writes the paldata to the main palette. Empty color indices will be skipped.


void WriteMainCSet(int cset) πŸ”— Source

Writes a cset of the paldata to the main palette. Empty color indices will be skipped.


void WriteCyclePalette(int pal) πŸ”— Source

Writes the paldata to a level palette’s cycle/dark room csets. Empty color indices will be skipped.


void WriteCycleCSet(int pal, int cset) πŸ”— Source

Writes a cset of the paldata to a level’s cycle/dark room palette.

Empty color indices will be skipped.


bool ColorValid(int index) πŸ”— Source

Returns true if the color at index is valid.


void ClearColor(int index) πŸ”— Source

Clears the color at index on the paldata. Cleared colors will be skipped when writing to a palette.


void ClearCSet(int cset) πŸ”— Source

Clears an cset on the paldata. Cleared colors will be skipped when writing to a palette.


void Mix(paldata start, paldata end, int percent = 5000L, int color_space = 0) πŸ”— Source

Interpolates all the colors on a paldata between start and end.


void MixCSet(paldata start, paldata end, int cset, int percent = 5000L, int color_space = 0) πŸ”— Source

Interpolates all the colors on a cset of a paldata between start and end.


void Copy(paldata target) πŸ”— Source

Copies all the colors from this paldata to the target.


void CopyCSet(paldata target, int src_cset, int dest_cset) πŸ”— Source

Copies all the colors from one cset on this paldata to another on the target.


void Free() πŸ”— Source

De-allocates this paldata pointer, so that its’ pointer ID may be re-used. You may only have a limited number of paldata pointers active at a time; freeing them when you are done with them helps not reach the limit.

Warning

Deprecated! Free() no longer does anything as of ZC 3.0. Objects are now freed automatically.


void Own() πŸ”— Source

Grants β€˜Ownership’ of the paldata pointer to the script that calls this function. When the script with β€˜Ownership’ terminates (at the same time its’ local arrays are deallocated), this paldata pointer will automatically be β€˜Free()’d.