Nilorea Library
C utilities for networking, threading, graphics
|
Data Structures | |
struct | CELL |
Cell of a MAP. More... | |
struct | MAP |
MAP with objects, tiles, skins. More... | |
Macros | |
#define | BLCK 3 |
FLAG of a stopping tile. More... | |
#define | N_ABILITY 3 |
FLAG of ability type. More... | |
#define | N_MUSIC 4 |
FLAG of music type. More... | |
#define | N_OBJECT 5 |
FLAG of object type. More... | |
#define | N_TILE 2 |
FLAG of tile type. More... | |
#define | SWIM 2 |
FLAG of a swimmable tile. More... | |
#define | WALK 1 |
FLAG of a walkable tile. More... | |
Functions | |
int | camera_to_map (MAP **map, int tx, int ty, int x, int y) |
Center Map on given map coordinate, with x & y offset. More... | |
int | camera_to_scr (MAP **map, int x, int y) |
Center Map on given screen coordinate. More... | |
int | create_empty_map (MAP **map, char *name, int XSIZE, int YSIZE, int TILEW, int TILEH, int nbmaxobjects, int nbmaxgroup, int nbmaxanims, int nbtiles, int nbanims) |
Create an empty map. More... | |
int | draw_map (MAP *map, BITMAP *bmp, int destx, int desty, int mode) |
Draw a MAP *map on the BITMAP *bmp. More... | |
int | free_map (MAP **map) |
Free the map. More... | |
int | get_value (MAP *map, int type, int x, int y) |
Get a the tilenumber of a cell item. More... | |
int | load_map (MAP **map, char *filename) |
Load the map from filename. More... | |
int | save_map (MAP *map, char *filename) |
Save the map to filename. More... | |
int | ScreenToMap (int mx, int my, int *Tilex, int *Tiley, BITMAP *mousemap) |
Convert screen coordinate to map coordinate. More... | |
int | set_value (MAP *map, int type, int x, int y, int value) |
Set the value of a cell in a map. More... | |
struct CELL |
Cell of a MAP.
Definition at line 43 of file n_iso_engine.h.
struct MAP |
MAP with objects, tiles, skins.
Definition at line 57 of file n_iso_engine.h.
Data Fields | ||
---|---|---|
char * | anim_group_names |
animation board as for previous:char *object_group_names |
int | bgcolor | color of the bg |
BITMAP * | colortile | defaut full colored background tile |
CELL * | grid | Grid of each cell of the map. |
BITMAP * | mousemap | Map for mouse collision between mouse pointer and map. |
char * | name | Name of the map ( used for linking between two map ) |
char * | object_group_names |
active objects name of the main group of the (kind of) library of objects, filled by zero else, size iz limited to 512 characaters |
int | ptanchorX | X starting cell for drawing. |
int | ptanchorY | Y starting cell for drawing. |
char * | quests_group_names |
quest library as for previous:char *object_group_names |
char * | sounds_group_names |
sounds library as for previous:char *object_group_names |
int | TILEH | size Y of tiles of the map (in pixel) |
int | TILEW | size X of tiles of the map (in pixel) |
int | wirecolor | color of wire |
int | X | X move in pixel for drawing. |
int | XSIZE | size X of the grid (nbXcell) |
int | Y | Y move in pixel for drawing. |
int | YSIZE | size Y of the grid (nbYcell) |
#define BLCK 3 |
FLAG of a stopping tile.
Definition at line 39 of file n_iso_engine.h.
#define N_ABILITY 3 |
FLAG of ability type.
Definition at line 29 of file n_iso_engine.h.
#define N_MUSIC 4 |
FLAG of music type.
Definition at line 31 of file n_iso_engine.h.
#define N_OBJECT 5 |
FLAG of object type.
Definition at line 33 of file n_iso_engine.h.
#define N_TILE 2 |
FLAG of tile type.
Definition at line 27 of file n_iso_engine.h.
#define SWIM 2 |
FLAG of a swimmable tile.
Definition at line 37 of file n_iso_engine.h.
#define WALK 1 |
FLAG of a walkable tile.
Definition at line 35 of file n_iso_engine.h.
int camera_to_map | ( | MAP ** | map, |
int | tx, | ||
int | ty, | ||
int | x, | ||
int | y | ||
) |
Center Map on given map coordinate, with x & y offset.
map | A MAP *map to center on tx+x , ty+y |
tx | TILEX offset in tile |
ty | TILEY offset in tile |
x | X offset in pixel |
y | Y Offset in pixel |
Definition at line 307 of file n_iso_engine.c.
int camera_to_scr | ( | MAP ** | map, |
int | x, | ||
int | y | ||
) |
Center Map on given screen coordinate.
map | A MAP *map to center on x,y |
x | the X coordinate (in pixel) to center on; |
y | the Y coordintae (in pixel) to center on; |
Definition at line 278 of file n_iso_engine.c.
int create_empty_map | ( | MAP ** | map, |
char * | name, | ||
int | XSIZE, | ||
int | YSIZE, | ||
int | TILEW, | ||
int | TILEH, | ||
int | nbmaxobjects, | ||
int | nbmaxgroup, | ||
int | nbmaxanims, | ||
int | nbtiles, | ||
int | nbanims | ||
) |
Create an empty map.
map | the map pointer to point on the allocated one |
name | Name of the map (used for linking between two map ) |
XSIZE | the X size of the map (in tile) |
YSIZE | the Y size of the map (in tile) |
TILEW | the Width of a tile |
TILEH | the Heigh of a tile |
nbmaxobjects | the maximum number of objects in the map |
nbmaxgroup | the maximum number of active objects in the map |
nbmaxanims | the maximum number of aniations in the map |
nbtiles | the maximum number of tiles in the map |
nbanims | the maximum number of animations in the map |
Definition at line 27 of file n_iso_engine.c.
References Malloc, N_ABILITY, N_MUSIC, N_OBJECT, N_TILE, and set_value().
Referenced by load_map().
int draw_map | ( | MAP * | map, |
BITMAP * | bmp, | ||
int | destx, | ||
int | desty, | ||
int | mode | ||
) |
Draw a MAP *map on the BITMAP *bmp.
map | The Map to draw |
bmp | The screen destination |
destx | X offset on bmp |
desty | Y offste on bmp |
mode | Drawing mode |
Definition at line 329 of file n_iso_engine.c.
References MAP::TILEH, MAP::XSIZE, and MAP::YSIZE.
int free_map | ( | MAP ** | map | ) |
Free the map.
map | The map to free. The pointer will be set to NULL |
Definition at line 547 of file n_iso_engine.c.
References Free.
Referenced by load_map().
int get_value | ( | MAP * | map, |
int | type, | ||
int | x, | ||
int | y | ||
) |
Get a the tilenumber of a cell item.
map | A MAP *map to 'touch' |
type | It is the type of value to change , it can be N_TILE,N_ABILITY,N_MUSIC,N_OBJECT |
x | X coordinate of the cell |
y | Y coordinate of the cell |
Definition at line 173 of file n_iso_engine.c.
int load_map | ( | MAP ** | map, |
char * | filename | ||
) |
Load the map from filename.
map | A MAP *pointer to point on the loaded map |
filename | The filename of the map to load |
Definition at line 415 of file n_iso_engine.c.
References MAP::bgcolor, create_empty_map(), free_map(), Malloc, and MAP::wirecolor.
int save_map | ( | MAP * | map, |
char * | filename | ||
) |
Save the map to filename.
map | A MAP *pointer |
filename | The filename of the file where to save the map |
Definition at line 494 of file n_iso_engine.c.
int ScreenToMap | ( | int | mx, |
int | my, | ||
int * | Tilex, | ||
int * | Tiley, | ||
BITMAP * | mousemap | ||
) |
Convert screen coordinate to map coordinate.
mx | The 'x' coordinate in pixel |
my | The 'y' coordinate in pixel |
Tilex | Output for the generated Tilex |
Tiley | Output for the generated Tiley |
mousemap | A mousemap with colors for one tile |
Definition at line 207 of file n_iso_engine.c.
int set_value | ( | MAP * | map, |
int | type, | ||
int | x, | ||
int | y, | ||
int | value | ||
) |
Set the value of a cell in a map.
map | A MAP *map to 'touch' |
type | It is the type of value to change , it can be N_TILE,N_ABILITY,N_MUSIC,N_OBJECT |
x | X coordinate of the cell |
y | Y coordinate of the cell |
value | Value to give to the cell |
Definition at line 122 of file n_iso_engine.c.
References N_ABILITY, N_MUSIC, N_OBJECT, and N_TILE.
Referenced by create_empty_map().