1 /* $Id: map.h,v 1.16 2006-07-30 11:44:57 stpohle Exp $ */
2 /* map.h */
3 
4 #ifndef _MAP_H_
5 #define _MAP_H_
6 
7 #define FIELDCHECK_TIMEOUT 2.0 /* timeout for the field check function */
8 #define FIELDHURRYWARN 5.0  /* hurry warning */
9 #define FIELDHURRYDROPTO 0.5 /* timeout when to put in some special items */
10 #define FIELDHURRYSIZE 0.25    /* timeout forresizeing the game */
11 #define FIELDHURRYSIZEMIN 5 /* min size for the field */
12 #define FIELDHURRYTIMEOUT 120.0	// game timeout for hurry and dropping mode (1min)
13 
14 #define ANI_STONETIMEOUT 1.0	// factor for the animation frame je seconds
15 #define ANI_POWERUPTIMEOUT 0.5  // factor for powerup animations
16 
17 /* this is the minimum distance that starting points should be set apart from each
18  * other.  If the given tolerence cannot be satisfied on the map, it will be decremented
19  * by 1 until it can be satisfied.  this is just our initial value
20  */
21 
22 #define MAP_POSITION_TOLERENCE 10
23 
24 struct __ex_field {
25 	unsigned char count;
26 	float frame;
27 	int bomb_b;			// BombID from the last know
28 	int bomb_p;			// explosion on this field
29 } typedef _ex_field;
30 
31 
32 struct __field {
33     unsigned char type;
34 	signed char mixframe;		// data for the mixed frame
35     float frame;                // frame (frame > 0 && FS_stone)
36     unsigned char special;      // to save special stones, or the tunnel number
37     _ex_field ex[4];          	// count up every explosion there is on this field for ever direction
38     Sint32 ex_nr;               // number to identify the explosion.
39 } typedef _field;
40 
41 
42 /* holds the locatition of a start point and the use count */
43 
44 struct __start_point {
45 	_point pos;
46 	int used;
47 } typedef _start_point;
48 
49 
50 struct __map {
51 	_point size;			// dimension of the field
52 
53     _field field[MAX_FIELDSIZE_X][MAX_FIELDSIZE_Y];
54 	_point tunnel[GAME_MAX_TUNNELS];  // save the destination of the tunnel
55 	unsigned char bfield[MAX_FIELDSIZE_X][MAX_FIELDSIZE_Y]; // will hold informations if ther is a bomb
56 
57 	char tileset [LEN_TILESETNAME];
58 	signed char random_tileset;
59 	char map [LEN_PATHFILENAME];
60 	signed char map_selection;
61 	signed char type;		// type of the map (MAPT_*);
62 	int bombs;
63 	int fire;
64 	int shoes;
65 	int mixed;
66 	int death;
67 	int sp_trigger;
68 	int sp_push;
69 	int sp_row;
70 	int sp_kick;
71 	unsigned char state; // state of the map
72 	_start_point start_point[MAX_PLAYERS];  // array of starting points for this map
73 } typedef _map;
74 
75 
76 extern _map map;
77 
78 // mapmenu.c
79 extern void mapmenu ();
80 extern void mapinfo ();
81 extern void mapgamesetting ();
82 
83 // map.c
84 extern void map_random ();
85 extern void map_genrandom ();
86 extern void map_genmorerandom ();
87 extern void init_map_tileset();
88 extern void map_new (char *filename);
89 extern void map_load (FILE * fmap);
90 extern void map_set_playerposition (int usermap);
91 /* new functions for player positioning */
92 
93 extern int map_ensure_corner_start_points();
94 extern int map_init_start_points();
95 extern int map_set_start_point(int idx, int x, int y);
96 extern int map_add_start_point(int x, int y);
97 extern int map_is_start_point(int x, int y);
98 extern int map_num_defined_start_points();
99 extern int map_check_start_point(int x, int y, int tol);
100 extern int map_check_and_add_start_point(int x, int y, int tol);
101 extern int map_find_and_add_start_points(int num, int tol);
102 extern int map_is_possible_start_point(int x, int y);
103 extern int map_create_and_add_start_point(int tol);
104 extern int map_is_removable_field(int x, int y);
105 extern int map_place_player(int pl);
106 extern int map_respawn_player(int pl);
107 
108 #endif
109