WID comments
[Lilanci.git] / map.h
blob0e6cd3f6eb9da2da273fef20459b2448b7b1143e
1 #pragma once
2 #include "geometry.h"
3 #include "gr.h"
5 typedef struct{
6 Area **FArea; //forbidden Area
7 int noFArea; //no used FArea
8 }TMapLayer;
10 typedef struct{
11 TMapLayer **Layer;
12 int noLayer;
13 Area *BoundingArea; // ALL OBJECTS MUST BE IN THIS POLY
14 double XX,YY; //margins for random placement
15 double X,Y; //left top corner
16 int noSprites;
17 Sprite **Sprites;
18 Vect *SpritePos;
19 }TMap;
21 int AreaInMap(TMap *m, Area *p, int FromLayer, int ToLayer); //returns 0 if p collides with something in m otherwise 1
22 TMap *String2Map(char *String); //returns 0 on failure
23 char *Map2String(TMap *Map, size_t *bytes); //returns 0 on failure, fills bytes
24 TMap *LoadMap(char *filename);
25 void DestroyMap(TMap **Map);
28 * Map file structure int,uint--32bit, double--64bit
29 * double XX
30 * double YY
31 * double X
32 * double Y
33 * uint noSprites
34 * uint noLayer
35 * uint Layer_seek[noLayer]
36 * uint Sprite_seek[noSprite]
38 * Layer_seek*:
39 * uint noFArea
40 * uint string_seek[noFArea]... where to find start of null-terminated string of Forbid Area
42 * Sprite_seek*:
43 * double x
44 * double y
45 * uint filename_seek... where to find start of null-terminated string of filename