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