Nilorea Library
C utilities for networking, threading, graphics
GRAPHICS: isometric engine, maps, tiles, ...

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...
 

Detailed Description


Data Structure Documentation

◆ CELL

struct CELL

Cell of a MAP.

Definition at line 43 of file n_iso_engine.h.

+ Collaboration diagram for CELL:
Data Fields
int ability ability of the tile (walking, swimming, blocking, killing ?)
int music ident of the music on the tile
int objectnumber ident of the object in the MAP->object library
int tilenumber ident of the tile in the MAP->tile library

◆ MAP

struct MAP

MAP with objects, tiles, skins.

Definition at line 57 of file n_iso_engine.h.

+ Collaboration diagram for MAP:
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)

Macro Definition Documentation

◆ BLCK

#define BLCK   3

FLAG of a stopping tile.

Definition at line 39 of file n_iso_engine.h.

◆ N_ABILITY

#define N_ABILITY   3

FLAG of ability type.

Definition at line 29 of file n_iso_engine.h.

◆ N_MUSIC

#define N_MUSIC   4

FLAG of music type.

Definition at line 31 of file n_iso_engine.h.

◆ N_OBJECT

#define N_OBJECT   5

FLAG of object type.

Definition at line 33 of file n_iso_engine.h.

◆ N_TILE

#define N_TILE   2

FLAG of tile type.

Definition at line 27 of file n_iso_engine.h.

◆ SWIM

#define SWIM   2

FLAG of a swimmable tile.

Definition at line 37 of file n_iso_engine.h.

◆ WALK

#define WALK   1

FLAG of a walkable tile.

Definition at line 35 of file n_iso_engine.h.

Function Documentation

◆ camera_to_map()

int camera_to_map ( MAP **  map,
int  tx,
int  ty,
int  x,
int  y 
)

Center Map on given map coordinate, with x & y offset.

Parameters
mapA MAP *map to center on tx+x , ty+y
txTILEX offset in tile
tyTILEY offset in tile
xX offset in pixel
yY Offset in pixel
Returns
TRUE

Definition at line 307 of file n_iso_engine.c.

◆ camera_to_scr()

int camera_to_scr ( MAP **  map,
int  x,
int  y 
)

Center Map on given screen coordinate.

Parameters
mapA MAP *map to center on x,y
xthe X coordinate (in pixel) to center on;
ythe Y coordintae (in pixel) to center on;
Returns
TRUE

Definition at line 278 of file n_iso_engine.c.

◆ create_empty_map()

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.

Parameters
mapthe map pointer to point on the allocated one
nameName of the map (used for linking between two map )
XSIZEthe X size of the map (in tile)
YSIZEthe Y size of the map (in tile)
TILEWthe Width of a tile
TILEHthe Heigh of a tile
nbmaxobjectsthe maximum number of objects in the map
nbmaxgroupthe maximum number of active objects in the map
nbmaxanimsthe maximum number of aniations in the map
nbtilesthe maximum number of tiles in the map
nbanimsthe maximum number of animations in the map
Returns
TRUE on success FALSE on failure

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_map()

int draw_map ( MAP map,
BITMAP *  bmp,
int  destx,
int  desty,
int  mode 
)

Draw a MAP *map on the BITMAP *bmp.

Parameters
mapThe Map to draw
bmpThe screen destination
destxX offset on bmp
destyY offste on bmp
modeDrawing mode
Returns
TRUE

Definition at line 329 of file n_iso_engine.c.

References MAP::TILEH, MAP::XSIZE, and MAP::YSIZE.

◆ free_map()

int free_map ( MAP **  map)

Free the map.

Parameters
mapThe map to free. The pointer will be set to NULL
Returns
TRUE or FALSE

Definition at line 547 of file n_iso_engine.c.

References Free.

Referenced by load_map().

+ Here is the caller graph for this function:

◆ get_value()

int get_value ( MAP map,
int  type,
int  x,
int  y 
)

Get a the tilenumber of a cell item.

Parameters
mapA MAP *map to 'touch'
typeIt is the type of value to change , it can be N_TILE,N_ABILITY,N_MUSIC,N_OBJECT
xX coordinate of the cell
yY coordinate of the cell
Returns
The specified type value of the cell, or FALSE if unavailable

Definition at line 173 of file n_iso_engine.c.

References N_ABILITY, N_MUSIC, N_OBJECT, and N_TILE.

◆ load_map()

int load_map ( MAP **  map,
char *  filename 
)

Load the map from filename.

Parameters
mapA MAP *pointer to point on the loaded map
filenameThe filename of the map to load
Returns
TRUE or FALSE

Definition at line 415 of file n_iso_engine.c.

References MAP::bgcolor, create_empty_map(), free_map(), Malloc, and MAP::wirecolor.

+ Here is the call graph for this function:

◆ save_map()

int save_map ( MAP map,
char *  filename 
)

Save the map to filename.

Parameters
mapA MAP *pointer
filenameThe filename of the file where to save the map
Returns
TRUE or FALSE

Definition at line 494 of file n_iso_engine.c.

◆ ScreenToMap()

int ScreenToMap ( int  mx,
int  my,
int *  Tilex,
int *  Tiley,
BITMAP *  mousemap 
)

Convert screen coordinate to map coordinate.

Parameters
mxThe 'x' coordinate in pixel
myThe 'y' coordinate in pixel
TilexOutput for the generated Tilex
TileyOutput for the generated Tiley
mousemapA mousemap with colors for one tile
Returns
TRUE

Definition at line 207 of file n_iso_engine.c.

◆ set_value()

int set_value ( MAP map,
int  type,
int  x,
int  y,
int  value 
)

Set the value of a cell in a map.

Parameters
mapA MAP *map to 'touch'
typeIt is the type of value to change , it can be N_TILE,N_ABILITY,N_MUSIC,N_OBJECT
xX coordinate of the cell
yY coordinate of the cell
valueValue to give to the cell
Returns
TRUE or FALSE

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().

+ Here is the caller graph for this function: