Nilorea Library
C utilities for networking, threading, graphics
n_iso_engine.h
Go to the documentation of this file.
1
8#ifndef NILOREA_ISOMETRIC_ENGINE
9#define NILOREA_ISOMETRIC_ENGINE
10
11#ifdef __cplusplus
12extern "C"
13{
14#endif
15
21#include "n_common.h"
22#include "n_log.h"
23
24#ifndef NOALLEGRO
25
27#define N_TILE 2
29#define N_ABILITY 3
31#define N_MUSIC 4
33#define N_OBJECT 5
35#define WALK 1
37#define SWIM 2
39#define BLCK 3
40
41
43typedef struct CELL
44{
45 int
53
54} CELL;
55
57typedef struct MAP
58{
61
63 char *name;
64
66 BITMAP *mousemap,
69 /* *wiretile; */
70
71 int
92 /*OBJECT **object_lib;*/
96 /* ANIM **anim_lib; */
100 /*SOUND **sounds_lib;*/
104 /*QUEST **quests_lib;*/
107
108} MAP;
109
110/* Create an empty map */
111int 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 );
112/* Set a the tilenumber of a cell */
113int set_value( MAP *map, int type, int x, int y, int value );
114/* Get a the tilenumber of a cell */
115int get_value( MAP *map, int type, int x, int y );
116/* Convert screen coordinate to map coordinate */
117int ScreenToMap( int mx, int my, int *Tilex, int *Tiley, BITMAP *mousemap );
118/* Center Map on given screen coordinate */
119int camera_to_scr( MAP **map, int x, int y );
120/* Center Map on given map coordinate, with x & y offset */
121int camera_to_map( MAP **map, int tx, int ty, int x, int y );
122/* Draw the map using its coordinate on the specified bitmap */
123int draw_map( MAP *map, BITMAP *bmp, int destx, int desty, int mode );
124/* Load the map */
125int load_map( MAP **map, char *filename );
126/* Save the map */
127int save_map( MAP *map, char *filename );
128/* Free the map */
129int free_map( MAP **map );
130
135#endif /* NOALLEGRO */
136
137#ifdef __cplusplus
138}
139#endif
140
141#endif /* #ifndef NILOREA_ISOMETRIC_ENGINE */
142
char * quests_group_names
quest library
Definition: n_iso_engine.h:106
int X
X move in pixel for drawing.
Definition: n_iso_engine.h:84
char * sounds_group_names
sounds library
Definition: n_iso_engine.h:102
int TILEW
size X of tiles of the map (in pixel)
Definition: n_iso_engine.h:76
int ability
ability of the tile (walking, swimming, blocking, killing ?)
Definition: n_iso_engine.h:48
int tilenumber
ident of the tile in the MAP->tile library
Definition: n_iso_engine.h:46
char * name
Name of the map ( used for linking between two map )
Definition: n_iso_engine.h:63
int ptanchorY
Y starting cell for drawing.
Definition: n_iso_engine.h:82
int wirecolor
color of wire
Definition: n_iso_engine.h:90
int ptanchorX
X starting cell for drawing.
Definition: n_iso_engine.h:80
BITMAP * colortile
defaut full colored background tile
Definition: n_iso_engine.h:68
int TILEH
size Y of tiles of the map (in pixel)
Definition: n_iso_engine.h:78
char * object_group_names
active objects
Definition: n_iso_engine.h:94
CELL * grid
Grid of each cell of the map.
Definition: n_iso_engine.h:60
int YSIZE
size Y of the grid (nbYcell)
Definition: n_iso_engine.h:74
int XSIZE
size X of the grid (nbXcell)
Definition: n_iso_engine.h:72
char * anim_group_names
animation board
Definition: n_iso_engine.h:98
int music
ident of the music on the tile
Definition: n_iso_engine.h:52
int bgcolor
color of the bg
Definition: n_iso_engine.h:88
int objectnumber
ident of the object in the MAP->object library
Definition: n_iso_engine.h:50
int Y
Y move in pixel for drawing.
Definition: n_iso_engine.h:86
BITMAP * mousemap
Map for mouse collision between mouse pointer and map.
Definition: n_iso_engine.h:66
int save_map(MAP *map, char *filename)
Save the map to filename.
Definition: n_iso_engine.c:494
int get_value(MAP *map, int type, int x, int y)
Get a the tilenumber of a cell item.
Definition: n_iso_engine.c:173
int load_map(MAP **map, char *filename)
Load the map from filename.
Definition: n_iso_engine.c:415
int camera_to_map(MAP **map, int tx, int ty, int x, int y)
Center Map on given map coordinate, with x & y offset.
Definition: n_iso_engine.c:307
int camera_to_scr(MAP **map, int x, int y)
Center Map on given screen coordinate.
Definition: n_iso_engine.c:278
int set_value(MAP *map, int type, int x, int y, int value)
Set the value of a cell in a map.
Definition: n_iso_engine.c:122
int draw_map(MAP *map, BITMAP *bmp, int destx, int desty, int mode)
Draw a MAP *map on the BITMAP *bmp.
Definition: n_iso_engine.c:329
int ScreenToMap(int mx, int my, int *Tilex, int *Tiley, BITMAP *mousemap)
Convert screen coordinate to map coordinate.
Definition: n_iso_engine.c:207
int free_map(MAP **map)
Free the map.
Definition: n_iso_engine.c:547
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.
Definition: n_iso_engine.c:27
Cell of a MAP.
Definition: n_iso_engine.h:44
MAP with objects, tiles, skins.
Definition: n_iso_engine.h:58
Common headers and low-level hugly functions & define.
Generic log system.