1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992 Frank Tore Johansen |
6 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * the terms of the Affero GNU General Public License as published by the |
9 | * the terms of the Affero GNU General Public License as published by the |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * option) any later version. |
11 | * option) any later version. |
12 | * |
12 | * |
13 | * This program is distributed in the hope that it will be useful, |
13 | * This program is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU General Public License for more details. |
16 | * GNU General Public License for more details. |
17 | * |
17 | * |
18 | * You should have received a copy of the Affero GNU General Public License |
18 | * You should have received a copy of the Affero GNU General Public License |
19 | * and the GNU General Public License along with this program. If not, see |
19 | * and the GNU General Public License along with this program. If not, see |
20 | * <http://www.gnu.org/licenses/>. |
20 | * <http://www.gnu.org/licenses/>. |
21 | * |
21 | * |
22 | * The authors can be reached via e-mail to <support@deliantra.net> |
22 | * The authors can be reached via e-mail to <support@deliantra.net> |
23 | */ |
23 | */ |
24 | |
24 | |
25 | #include <global.h> |
25 | #include <global.h> |
26 | #include <util.h> |
26 | #include <util.h> |
27 | #include <random_map.h> |
27 | #include <rmg.h> |
28 | #include <rproto.h> |
28 | #include <rproto.h> |
29 | |
29 | |
30 | /* Put in the walls and autojoin them. */ |
30 | /* Put in the walls and autojoin them. */ |
31 | |
31 | |
32 | /* given a maze and a coordinate, tell me which squares up/down/right/left |
32 | /* given a maze and a coordinate, tell me which squares up/down/right/left |
… | |
… | |
117 | /* picks the right wall type for this square, to make it look nice, |
117 | /* picks the right wall type for this square, to make it look nice, |
118 | and have everything nicely joined. It uses the maze. */ |
118 | and have everything nicely joined. It uses the maze. */ |
119 | static object * |
119 | static object * |
120 | pick_joined_wall (object *the_wall, const layout &maze, int i, int j, random_map_params *RP) |
120 | pick_joined_wall (object *the_wall, const layout &maze, int i, int j, random_map_params *RP) |
121 | { |
121 | { |
122 | /* 1 = wall to left, |
|
|
123 | 2 = wall to right, |
|
|
124 | 4 = wall above |
|
|
125 | 8 = wall below */ |
|
|
126 | int surround_index = 0; |
|
|
127 | int l; |
122 | int l; |
128 | char wall_name[1024]; |
123 | char wall_name[1024]; |
129 | archetype *wall_arch = 0; |
124 | archetype *wall_arch = 0; |
130 | |
125 | |
131 | assign (wall_name, the_wall->arch->archname); |
126 | assign (wall_name, the_wall->arch->archname); |
… | |
… | |
252 | * global, previously-set variable, "wall_name" |
247 | * global, previously-set variable, "wall_name" |
253 | */ |
248 | */ |
254 | object * |
249 | object * |
255 | retrofit_joined_wall (maptile *the_map, int i, int j, int insert_flag, random_map_params *RP) |
250 | retrofit_joined_wall (maptile *the_map, int i, int j, int insert_flag, random_map_params *RP) |
256 | { |
251 | { |
257 | /* 1 = wall to left, |
|
|
258 | * 2 = wall to right, |
|
|
259 | * 4 = wall above |
|
|
260 | * 8 = wall below |
|
|
261 | */ |
|
|
262 | int surround_index = 0; |
|
|
263 | int l; |
252 | int l; |
264 | object *the_wall = 0; |
253 | object *the_wall = 0; |
265 | object *new_wall = 0; |
254 | object *new_wall = 0; |
266 | archetype *wall_arch = 0; |
255 | archetype *wall_arch = 0; |
267 | |
256 | |
… | |
… | |
304 | { |
293 | { |
305 | new_wall = wall_arch->instance (); |
294 | new_wall = wall_arch->instance (); |
306 | new_wall->x = i; |
295 | new_wall->x = i; |
307 | new_wall->y = j; |
296 | new_wall->y = j; |
308 | |
297 | |
309 | if (the_wall && the_wall->map) |
298 | if (the_wall->map) |
310 | the_wall->destroy (); |
299 | the_wall->destroy (); |
311 | |
300 | |
312 | the_wall->move_block = MOVE_ALL; |
301 | the_wall->move_block = MOVE_ALL; |
313 | insert_ob_in_map (new_wall, the_map, new_wall, INS_NO_MERGE | INS_NO_WALK_ON); |
302 | insert_ob_in_map (new_wall, the_map, new_wall, INS_NO_MERGE | INS_NO_WALK_ON); |
314 | } |
303 | } |