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 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2001,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2001 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 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. |
… | |
… | |
27 | #include <sproto.h> |
27 | #include <sproto.h> |
28 | #include <rproto.h> |
28 | #include <rproto.h> |
29 | |
29 | |
30 | /* find a character in the layout. fx and fy are pointers to |
30 | /* find a character in the layout. fx and fy are pointers to |
31 | where to find the char. fx,fy = -1 if not found. */ |
31 | where to find the char. fx,fy = -1 if not found. */ |
32 | void |
32 | static void |
33 | find_in_layout (int mode, char target, int *fx, int *fy, char **layout, random_map_params *RP) |
33 | find_in_layout (int mode, char target, int *fx, int *fy, char **layout, random_map_params *RP) |
34 | { |
34 | { |
35 | int M; |
35 | int M; |
36 | int i, j; |
36 | int i, j; |
37 | |
37 | |
… | |
… | |
117 | 6 means southward |
117 | 6 means southward |
118 | */ |
118 | */ |
119 | void |
119 | void |
120 | place_exits (maptile *map, char **maze, char *exitstyle, int orientation, random_map_params *RP) |
120 | place_exits (maptile *map, char **maze, char *exitstyle, int orientation, random_map_params *RP) |
121 | { |
121 | { |
122 | char styledirname[1024]; |
|
|
123 | maptile *style_map_down = 0; /* harder maze */ |
122 | maptile *style_map_down = 0; /* harder maze */ |
124 | maptile *style_map_up = 0; /* easier maze */ |
123 | maptile *style_map_up = 0; /* easier maze */ |
125 | object *the_exit_down; /* harder maze */ |
124 | object *the_exit_down; /* harder maze */ |
126 | object *the_exit_up; /* easier maze */ |
125 | object *the_exit_up; /* easier maze */ |
127 | int cx = -1, cy = -1; /* location of a map center */ |
126 | int cx = -1, cy = -1; /* location of a map center */ |
… | |
… | |
138 | |
137 | |
139 | switch (orientation) |
138 | switch (orientation) |
140 | { |
139 | { |
141 | case 1: |
140 | case 1: |
142 | { |
141 | { |
143 | sprintf (styledirname, "/styles/exitstyles/up"); |
|
|
144 | style_map_up = find_style (styledirname, exitstyle, -1); |
142 | style_map_up = find_style ("/styles/exitstyles/up" , exitstyle, RP->difficulty); |
145 | sprintf (styledirname, "/styles/exitstyles/down"); |
|
|
146 | style_map_down = find_style (styledirname, exitstyle, -1); |
143 | style_map_down = find_style ("/styles/exitstyles/down", exitstyle, RP->difficulty); |
147 | break; |
144 | break; |
148 | } |
145 | } |
149 | |
146 | |
150 | case 2: |
147 | case 2: |
151 | { |
148 | { |
152 | sprintf (styledirname, "/styles/exitstyles/down"); |
|
|
153 | style_map_up = find_style (styledirname, exitstyle, -1); |
149 | style_map_up = find_style ("/styles/exitstyles/down", exitstyle, RP->difficulty); |
154 | sprintf (styledirname, "/styles/exitstyles/up"); |
|
|
155 | style_map_down = find_style (styledirname, exitstyle, -1); |
150 | style_map_down = find_style ("/styles/exitstyles/up" , exitstyle, RP->difficulty); |
156 | break; |
151 | break; |
157 | } |
152 | } |
158 | |
153 | |
159 | default: |
154 | default: |
160 | { |
155 | { |
161 | sprintf (styledirname, "/styles/exitstyles/generic"); |
156 | style_map_up = |
162 | style_map_up = find_style (styledirname, exitstyle, -1); |
157 | style_map_down = find_style ("/styles/exitstyles/generic", exitstyle, RP->difficulty); |
163 | style_map_down = style_map_up; |
|
|
164 | break; |
158 | break; |
165 | } |
159 | } |
166 | } |
160 | } |
167 | |
161 | |
168 | the_exit_up = style_map_up |
162 | the_exit_up = style_map_up |
… | |
… | |
296 | |
290 | |
297 | /* the identifier for making a random map. */ |
291 | /* the identifier for making a random map. */ |
298 | if (RP->dungeon_level >= RP->dungeon_depth && *RP->final_map) |
292 | if (RP->dungeon_level >= RP->dungeon_depth && *RP->final_map) |
299 | { |
293 | { |
300 | maptile *new_map; |
294 | maptile *new_map; |
301 | object *the_exit_back = arch_to_object (the_exit_up->arch); |
295 | object *the_exit_back = the_exit_up->arch->instance (); |
302 | |
296 | |
303 | /* load it */ |
297 | /* load it */ |
304 | if (!(new_map = maptile::find_sync (RP->final_map))) |
298 | if (!(new_map = maptile::find_sync (RP->final_map))) |
305 | return; |
299 | return; |
306 | |
300 | |
… | |
… | |
331 | |
325 | |
332 | insert_ob_in_map (the_exit_back, new_map, NULL, 0); |
326 | insert_ob_in_map (the_exit_back, new_map, NULL, 0); |
333 | } |
327 | } |
334 | } |
328 | } |
335 | else |
329 | else |
336 | the_exit_down->slaying = "/!"; |
330 | the_exit_down->slaying = shstr_random_map_exit; |
337 | |
331 | |
338 | /* Block the exit so things don't get dumped on top of it. */ |
332 | /* Block the exit so things don't get dumped on top of it. */ |
339 | the_exit_down->move_block = MOVE_ALL; |
333 | the_exit_down->move_block = MOVE_ALL; |
340 | insert_ob_in_map (the_exit_down, map, NULL, 0); |
334 | insert_ob_in_map (the_exit_down, map, NULL, 0); |
341 | maze[the_exit_down->x][the_exit_down->y] = '>'; |
335 | maze[the_exit_down->x][the_exit_down->y] = '>'; |