libMicrofx/microfx_src/include/microfx/ext/gametools.h

64 lines
1.9 KiB
C

#ifndef GAMETOOLS_H
#define GAMETOOLS_H
/******* MAP *******/
/* Struct */
typedef struct {
unsigned char *map; /* Map data (size w*h)
the tile 0 contains nothing, and the other tiles are decremented and grabbed
in tileset, so 1 is the first tile in tileset. */
unsigned char **tileset; /* Tileset (Sprite Coder sprite table) */
int w, h; /* Map width and height */
int tw, th; /* Tile width and height */
int px, py; /* Contains the position of the player on the screen, after
drawing the map */
int pw, ph; /* Player height and width. */
int sx, sy; /* Where the map started to be drawn. */
int padx, pady; /* Where the map was drawn on the screen. */
int sw, sh; /* The size of the part that was drawn on screen. */
} MMap;
/* Prototypes */
/* void vmap(int sx, int sy, MMap *map);
Draws a map contained in a MMap struct.
vmap draw the map with the player at sx, sy.
*/
void vmap(int sx, int sy, MMap *map);
/* void vplayer(MMap *map, unsigned char **player_sprites, int anim_frame);
Draws the player on map map, from the sprite coder image in the image table at
anim frame.
*/
void vplayer(MMap *map, unsigned char **player_sprites, int anim_frame);
/* void vitem(MMap *map, int x, int y, int w, int h, unsigned char **item,
int anim_frame);
Draws an item at the position (x, y) on the map on the screen.
item is the sprite coder sprite table that contains the diffrent frames of the
animation of this item.
anim_frame is the frame of the animation of item that should be drawn.
*/
void vitem(MMap *map, int x, int y, int w, int h, unsigned char **item,
int anim_frame);
/******* COLLISIONS *******/
/* int vget_tile_at_point(MMap *map, int x, int y);
Get the tile located at x, y on MMap map map.
Returns the tile number or -1 if the tile is outside of the map.
*/
int vget_tile_at_point(MMap *map, int x, int y);
#endif