Tile and Map Functions
From Archaic Pixels
Contents
Tile and Map Functions
set_tile_data
void set_tile_data(char *tile_ex); [ 3.20+ ] |
---|
void set_tile_data(char *tile_data, int nb_tile, char *pal_ref); |
Define an array of tile to be used by all the tile and map functions. 'tile_data' is the address of the tile graphics data in memory, 'nb_tile' is the number of tile (max. 255), and 'pal_ref' is the address of a palette-index array to use for tiles; each tile has its own palette index attached to it (note that palette indexes must be shifted to the left by four bits, ie. 0x40 for palette index 4). The new 1-parameter form is used together with #inctile_ex() or #incchr_ex() directives, where all other relevant data is already conveyed in the #incxxx_ex() directive. Also, this form automatically recognizes whether it is being used with 8x8 (incchr_ex) or 16x16 (inctile_ex) tiles. |
load_tile
void load_tile(int vaddr); |
---|
Load tile graphics data in video memory, at address 'vaddr'. You must first have defined a tile array with set_tile_data() before using this function. |
put_tile
void put_tile(int num, int vaddr); |
---|
void put_tile(int num, char x, char y); |
Put individual tiles on the screen, either directly at video memory location 'vaddr', or at screen coordinates 'x/y' (in tile unit). 'num' is a tile index in the tile array defined by the most recent call to set_tile_data(). |
map_put_tile
void map_put_tile(char x, char y, char tile); [ 3.20+ ] |
---|
Modifies the map data (sets a map element to a new tile ID), but works only when the map is stored in RAM - ie. a Super CDROM game which is loaded into RAM, and executes there. 'x' and 'y' are specified in the same units as map_get_tile() (ie. pixels, not tiles). |
get_tile
char get_tile(char x, char y); [ 1.5 - 3.11, RENAMED IN 3.20 ] |
---|
Return the tile index as defined in the tile array used in the most recent call to set_tile_data(). The 'x/y' argument is in pixel units, unlike the put_tile functions and thus this function is ideal for colision routines. |
map_get_tile
char map_get_tile(char x, char y); [ 3.20+ ] |
---|
Return the tile index as defined in the tile array used in the most recent call to set_tile_data(). The 'x/y' argument is in tile units, unlike the put_tile functions and thus this function is ideal for colision routines. |
set_map_data
void set_map_data(char *map, char w, char h); |
---|
Define a tile-index map to be used by load_map(). 'map' is the address of a map of width 'w' (max. 255) and of height 'h' (max. 255). |
load_map
void load_map(char sx, char sy, int mx, int my, char w, char h); |
---|
Load a part of a map on the screen. 'sx' and 'sy' are screen coordinates (in tile unit; 16 pixels), 'mx' and 'my' are position in the map, and 'w' and 'h' are respectively the number of tile-index to load horizontaly and verticaly. This function doesn't do any screen clipping, so you must not pass incorrect or too big screen coordinates to it, that would corrupt the video memory. |
scroll
void scroll(char num, int x, int y, char top, char bottom, char disp); |
---|
Define screen window 'num'. Up to four window can be defined. 'top' and 'bottom' are the screen top and bottom limits of the window (limits are included in the window area). 'disp' controls the type of the window, if bit 7 is set background graphics will be displayed in this window, and if bit 6 is set sprites will also be displayed. If none of these bits are set the window will stay blank. 'x' and 'y' are the top-left coordinates of the area in the virtual screen that will be displayed in the window. |
scroll_disable
void scroll_disable(char num); [ 1.5+ ] |
---|
Disable scrolling for the screen window 'num'. |