1 | /* |
1 | /* |
2 | * static char *rcsid_exit_c = |
2 | * static char *rcsid_exit_c = |
3 | * "$Id: exit.C,v 1.2 2006/08/29 08:01:36 root Exp $"; |
3 | * "$Id: exit.C,v 1.3 2006/09/03 00:18:41 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
167 | else the_exit_down = 0; |
167 | else the_exit_down = 0; |
168 | |
168 | |
169 | /* set up the up exit */ |
169 | /* set up the up exit */ |
170 | the_exit_up->stats.hp = RP->origin_x; |
170 | the_exit_up->stats.hp = RP->origin_x; |
171 | the_exit_up->stats.sp = RP->origin_y; |
171 | the_exit_up->stats.sp = RP->origin_y; |
172 | the_exit_up->slaying = add_string(RP->origin_map); |
172 | the_exit_up->slaying = RP->origin_map; |
173 | |
173 | |
174 | /* figure out where to put the entrance */ |
174 | /* figure out where to put the entrance */ |
175 | /* begin a logical block */ |
175 | /* begin a logical block */ |
176 | { |
176 | { |
177 | int i,j; |
177 | int i,j; |
… | |
… | |
208 | for(j=1;j<9;j++) { |
208 | for(j=1;j<9;j++) { |
209 | if(!wall_blocked(map,the_exit_up->x+freearr_x[j],the_exit_up->y+freearr_y[j])) { |
209 | if(!wall_blocked(map,the_exit_up->x+freearr_x[j],the_exit_up->y+freearr_y[j])) { |
210 | random_sign = get_archetype("sign"); |
210 | random_sign = get_archetype("sign"); |
211 | random_sign->x = the_exit_up->x+freearr_x[j]; |
211 | random_sign->x = the_exit_up->x+freearr_x[j]; |
212 | random_sign->y = the_exit_up->y+freearr_y[j]; |
212 | random_sign->y = the_exit_up->y+freearr_y[j]; |
213 | |
213 | |
214 | sprintf(buf,"This is a random map.\nLevel: %d\n", (RP->dungeon_level)-1); |
214 | sprintf(buf,"This is a random map.\nLevel: %d\n", (RP->dungeon_level)-1); |
215 | |
215 | |
216 | random_sign->msg = add_string(buf); |
216 | random_sign->msg = buf; |
217 | insert_ob_in_map(random_sign,map,NULL,0); |
217 | insert_ob_in_map(random_sign,map,NULL,0); |
218 | } |
218 | } |
219 | } |
219 | } |
220 | /* Block the exit so things don't get dumped on top of it. */ |
220 | /* Block the exit so things don't get dumped on top of it. */ |
221 | the_exit_up->move_block = MOVE_ALL; |
221 | the_exit_up->move_block = MOVE_ALL; |
… | |
… | |
257 | the_exit_down->x = downx + freearr_x[i]; |
257 | the_exit_down->x = downx + freearr_x[i]; |
258 | the_exit_down->y = downy + freearr_y[i]; |
258 | the_exit_down->y = downy + freearr_y[i]; |
259 | RP->origin_x = the_exit_down->x; |
259 | RP->origin_x = the_exit_down->x; |
260 | RP->origin_y = the_exit_down->y; |
260 | RP->origin_y = the_exit_down->y; |
261 | write_map_parameters_to_string(buf,RP); |
261 | write_map_parameters_to_string(buf,RP); |
262 | the_exit_down->msg = add_string(buf); |
262 | the_exit_down->msg = buf; |
263 | /* the identifier for making a random map. */ |
263 | /* the identifier for making a random map. */ |
264 | if(RP->dungeon_level >= RP->dungeon_depth && RP->final_map[0]!=0) { |
264 | if(RP->dungeon_level >= RP->dungeon_depth && RP->final_map[0]!=0) { |
265 | mapstruct *new_map; |
265 | mapstruct *new_map; |
266 | object *the_exit_back = arch_to_object(the_exit_up->arch), *tmp; |
266 | object *the_exit_back = arch_to_object(the_exit_up->arch), *tmp; |
267 | #if 0 |
267 | #if 0 |
… | |
… | |
278 | #endif |
278 | #endif |
279 | /* load it */ |
279 | /* load it */ |
280 | if((new_map=ready_map_name(RP->final_map,0)) == NULL) |
280 | if((new_map=ready_map_name(RP->final_map,0)) == NULL) |
281 | return; |
281 | return; |
282 | |
282 | |
283 | the_exit_down->slaying = add_string(RP->final_map); |
283 | the_exit_down->slaying = RP->final_map; |
284 | strcpy(new_map->path,RP->final_map); |
284 | strcpy(new_map->path,RP->final_map); |
285 | |
285 | |
286 | for (tmp=GET_MAP_OB(new_map, MAP_ENTER_X(new_map), MAP_ENTER_Y(new_map)); tmp; tmp=tmp->above) |
286 | for (tmp=GET_MAP_OB(new_map, MAP_ENTER_X(new_map), MAP_ENTER_Y(new_map)); tmp; tmp=tmp->above) |
287 | /* Remove exit back to previous random map. There should only be one |
287 | /* Remove exit back to previous random map. There should only be one |
288 | * which is why we break out. To try to process more than one |
288 | * which is why we break out. To try to process more than one |
… | |
… | |
296 | } |
296 | } |
297 | |
297 | |
298 | if (final_map_exit == 1) |
298 | if (final_map_exit == 1) |
299 | { |
299 | { |
300 | /* setup the exit back */ |
300 | /* setup the exit back */ |
301 | the_exit_back->slaying = add_string(map->path); |
301 | the_exit_back->slaying = map->path; |
302 | the_exit_back->stats.hp = the_exit_down->x; |
302 | the_exit_back->stats.hp = the_exit_down->x; |
303 | the_exit_back->stats.sp = the_exit_down->y; |
303 | the_exit_back->stats.sp = the_exit_down->y; |
304 | the_exit_back->x = MAP_ENTER_X(new_map); |
304 | the_exit_back->x = MAP_ENTER_X(new_map); |
305 | the_exit_back->y = MAP_ENTER_Y(new_map); |
305 | the_exit_back->y = MAP_ENTER_Y(new_map); |
306 | |
306 | |
… | |
… | |
308 | } |
308 | } |
309 | |
309 | |
310 | set_map_timeout(new_map); /* So it gets swapped out */ |
310 | set_map_timeout(new_map); /* So it gets swapped out */ |
311 | } |
311 | } |
312 | else |
312 | else |
313 | the_exit_down->slaying = add_string("/!"); |
313 | the_exit_down->slaying = "/!"; |
|
|
314 | |
314 | /* Block the exit so things don't get dumped on top of it. */ |
315 | /* Block the exit so things don't get dumped on top of it. */ |
315 | the_exit_down->move_block = MOVE_ALL; |
316 | the_exit_down->move_block = MOVE_ALL; |
316 | insert_ob_in_map(the_exit_down,map,NULL,0); |
317 | insert_ob_in_map(the_exit_down,map,NULL,0); |
317 | maze[the_exit_down->x][the_exit_down->y]='>'; |
318 | maze[the_exit_down->x][the_exit_down->y]='>'; |
318 | } |
319 | } |