1 #ifndef MAPGEN_H
2 #define MAPGEN_H
3 
4 #define 	MAX_DOORS	4
5 
6 enum TILES {
7 	TILE_WALL,
8 	TILE_EMPTY,
9 	TILE_FLOOR,
10 	// Internal wall
11 	TILE_PARTITION
12 };
13 
14 struct doorinfo {
15 	int x, y;
16 	int room;
17 	int internal;
18 };
19 
20 struct roominfo {
21 	int x, y;
22 	int w, h;
23 	int theme;
24 	// Period is required to generate various periodical things,
25 	// like windows in the walls
26 	int period;
27 
28 	int *neighbors;
29 	int num_neighbors;
30 	int max_neighbors;
31 
32 	struct doorinfo doors[MAX_DOORS];
33 	int num_doors;
34 };
35 
36 struct mapgen_gamelevel {
37 	int w, h;
38 	unsigned char *m;
39 	int *r;
40 };
41 
42 enum connection_type {
43 	UP = 0,
44 	DOWN = 1,
45 	LEFT = 2,
46 	RIGHT = 3
47 };
48 
49 struct cplist_t {
50 	int x, y, r;
51 	enum connection_type t;
52 };
53 
54 struct dungeon_info {
55 	int enter;
56 	int exit;
57 	int middle_room;
58 
59 	int num_rooms;
60 	int *distance;
61 };
62 
63 extern struct roominfo *rooms;
64 extern int total_rooms;
65 
66 // Interface to the game
67 void (*dungeonmap_convert) (int, int, unsigned char *);
68 void (*dungeonmap_place_enemies) (struct roominfo *);
69 void (*dungeonmap_gift) (struct roominfo *);
70 
71 int generate_dungeon_gram(int, int);
72 
73 int mapgen_add_room(int, int, int, int);
74 void mapgen_put_tile(int, int, unsigned char, int);
75 unsigned char mapgen_get_tile(int x, int y);
76 int mapgen_get_room(int x, int y);
77 void mapgen_draw_room(int room_id);
78 int mapgen_are_connected(int, int);
79 int mapgen_is_connected(unsigned char *);
80 void mapgen_add_obstacle(double x, double y, int type);
81 void mapgen_set_floor(int x, int y, int type);
82 void mapgen_gift(struct roominfo *r);
83 void mapgen_add_door(int, int, int, int);
84 unsigned int mapgen_cycle_teleport_pair(unsigned int);
85 const char * mapgen_teleport_pair_str(int);
86 
87 int find_connection_points(int room_id, struct cplist_t cplist[100], int offset);
88 
89 void MakeConnect(int x, int y, enum connection_type type);
90 
91 
92 #endif
93