ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/random_map.h
(Generate patch)

Comparing deliantra/server/random_maps/random_map.h (file contents):
Revision 1.39 by root, Sat Jul 3 01:49:18 2010 UTC vs.
Revision 1.44 by root, Sun Jul 4 00:58:18 2010 UTC

34 int xsize, ysize; 34 int xsize, ysize;
35 int expand2x; 35 int expand2x;
36 int layoutoptions1; 36 int layoutoptions1;
37 int layoutoptions2; 37 int layoutoptions2;
38 int layoutoptions3; 38 int layoutoptions3;
39 int symmetry;
40 int difficulty; 39 int difficulty;
41 int difficulty_given; 40 int difficulty_given;
42 float difficulty_increase; 41 float difficulty_increase;
43 42
44 int dungeon_level; 43 int dungeon_level;
45 int dungeon_depth; 44 int dungeon_depth;
46 45
47 int orientation;
48 uint32_t random_seed; 46 uint32_t random_seed;
49 uint64_t total_map_hp; 47 uint64_t total_map_hp;
50 int map_layout_style;
51 int symmetry_used;
52 48
53 HV *hv; 49 HV *hv;
54 void hv_clone (); // replaces the hv by a clone'd copy (%new_hv = { %hv })
55 50
56 shstr_tmp as_shstr () const; 51 shstr_tmp as_shstr () const;
57 52
58 // fetch something from the options hash 53 // fetch something from the options hash
59 SV *get_sv (const char *option) const; 54 SV *get_sv (const char *option) const;
72 67
73 // "private", adjusted sizes 68 // "private", adjusted sizes
74 int Xsize; 69 int Xsize;
75 int Ysize; 70 int Ysize;
76 71
72 int map_layout_style;
73 int symmetry_used;
74
77 random_map_params (); 75 random_map_params ();
76 random_map_params (random_map_params *RP);
78 random_map_params (HV *hv); 77 random_map_params (HV *hv);
79 ~random_map_params (); 78 ~random_map_params ();
80}; 79};
81 80
82enum { 81enum {
86 LAYOUT_SPIRAL, 85 LAYOUT_SPIRAL,
87 LAYOUT_ROGUELIKE, 86 LAYOUT_ROGUELIKE,
88 LAYOUT_SNAKE, 87 LAYOUT_SNAKE,
89 LAYOUT_SQUARE_SPIRAL, 88 LAYOUT_SQUARE_SPIRAL,
90 LAYOUT_CAVE, 89 LAYOUT_CAVE,
90 LAYOUT_CASTLE,
91 LAYOUT_MULTIPLE,
91 NROFLAYOUTS, 92 NROFLAYOUTS,
92}; 93};
93 94
94/* 95/*
95 * Move these defines out of room_gen_onion.c to here, as 96 * Move these defines out of room_gen_onion.c to here, as
156 cell **data; 157 cell **data;
157 int w, h; 158 int w, h;
158 159
159 layout (int w, int h); 160 layout (int w, int h);
160 layout (layout &copy); 161 layout (layout &copy);
162
163 // reference rect in other layout - will not keep the data alive,
164 // so never swap with it's orig, or free the orig when in use.
165 layout (layout &orig, int x1, int y1, int x2, int y2);
166
161 ~layout (); 167 ~layout ();
162 168
163 operator cell **() const 169 operator cell **() const
164 { 170 {
165 return data; 171 return data;
166 } 172 }
167 173
168 void swap (layout &maze) 174 void swap (layout &maze)
169 { 175 {
170 ::swap (maze.data, data); 176 ::swap (maze.data, data);
171 ::swap (maze.w , w ); 177 ::swap (maze.w , w );
172 ::swap (maze.h , h ); 178 ::swap (maze.h , h );
179 ::swap (maze.size, size);
173 } 180 }
174 181
175 MTH void swap (layout *maze) { swap (*maze); } 182 MTH void swap (layout *maze) { swap (*maze); }
176 183
177 // for debugging, print maze to stdout 184 // for debugging, print maze to stdout
185 MTH void fill_rect (int x1, int y1, int x2, int y2, char fill); // x2, y2 exclusive 192 MTH void fill_rect (int x1, int y1, int x2, int y2, char fill); // x2, y2 exclusive
186 193
187 MTH void fill_rand (int perc); 194 MTH void fill_rand (int perc);
188 195
189 // makes sure all areas are connected 196 // makes sure all areas are connected
197 // perturb = 0 - very horz/vert tunnels
198 // perturb = 1 - straight but round
199 // perturb = 2 - snaky tunnels
190 MTH void isolation_remover (); 200 MTH void isolation_remover (int perturb = 2);
191 201
192 // generates a cave, subtype 0 is a rough cave, randomly open or closed 202 // generates a cave, subtype 0 is a rough cave, randomly open or closed
193 MTH void gen_cave (int subtype); 203 MTH void gen_cave (int subtype);
204 MTH void gen_castle (); // generates straightish structures
194 205
195 // helper functions to modify the maze 206 // helper functions to modify the maze
196 MTH void erode_1_2 (int c1, int c2 = -1, int repeat = 1); 207 MTH void erode_1_2 (int c1, int c2 = -1, int repeat = 1);
197 MTH void doorify (); 208 MTH void doorify ();
198 MTH void roomify (); // make some rooms in it, works best on onions 209 MTH void roomify (); // make some rooms in it, works best on onions
200 MTH void symmetrize (int symmetry); 211 MTH void symmetrize (int symmetry);
201 MTH void rotate (int rotation); // rotate by 1=90, 2=180, 3=270 degrees 212 MTH void rotate (int rotation); // rotate by 1=90, 2=180, 3=270 degrees
202 213
203 void generate (random_map_params *RP); 214 void generate (random_map_params *RP);
204private: 215private:
216 int size;
205 void alloc (int w, int h); 217 void alloc (int w, int h);
206}; 218};
207 219
208// utility functions, to use rmg_rndm instead of rndm. 220// utility functions, to use rmg_rndm instead of rndm.
209static inline int 221static inline int
216} 228}
217 229
218// a simple point helper struct 230// a simple point helper struct
219struct point 231struct point
220{ 232{
221 short x; 233 int x;
222 short y; 234 int y;
223 235
224 point () 236 point ()
225 { 237 {
226 } 238 }
227 239

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines