libMicrofx/microfx_src/include/microfx/ext/gametools.h
2023-05-28 16:33:03 +02:00

58 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 padx, int pady, int w, int h, int sx, int sy, MMap *map);
Draws a map contained in a MMap struct.
dmap draw the map from sx, sy, at padx, pady on the screen with width w and
height h on screen.
The map should be the first thing to be drawn, because the map is not perfectly
drawn at (padx, pady), and vplayer and vitem use some variables that are updated
when calling vmap.
*/
void vmap(int padx, int pady, int w, int h, 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);
#endif