version 1.16 | | version 1.17 |
---|
| | |
/* | | /* |
* static char *rcsid_treasure_c = | | * static char *rcsid_treasure_c = |
* "$Id: treasure.c,v 1.16 2001/05/31 22:46:37 mardahl Exp $"; | | * "$Id: treasure.c,v 1.17 2001/07/14 04:08:06 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
| | Copyright (C) 2001 Mark Wedel |
Copyright (C) 1992 Frank Tore Johansen | | Copyright (C) 1992 Frank Tore Johansen |
| | |
This program is free software; you can redistribute it and/or modify | | This program is free software; you can redistribute it and/or modify |
| | |
along with this program; if not, write to the Free Software | | along with this program; if not, write to the Free Software |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| | |
The author can be reached via e-mail to mark@pyramid.com | | The author can be reached via e-mail to mwedel@scruz.net |
*/ | | */ |
| | |
/* placing treasure in maps, where appropriate. */ | | /* placing treasure in maps, where appropriate. */ |
| | |
| | |
int wall_blocked(mapstruct *m, int x, int y) { | | int wall_blocked(mapstruct *m, int x, int y) { |
int r; | | int r; |
MapLook *f; | | |
if(out_of_map(m,x,y)) | | if(out_of_map(m,x,y)) |
return 1; | | return 1; |
f = get_map(m,x,y); | | r = GET_MAP_FLAGS(m,x,y) & (P_NO_PASS ); |
r = f->flags & (P_NO_PASS ); | | |
return r; | | return r; |
} | | } |
| | |
| | |
| | |
/* actually place the chest. */ | | /* actually place the chest. */ |
the_chest->x = xl; the_chest->y = yl; | | the_chest->x = xl; the_chest->y = yl; |
insert_ob_in_map(the_chest,map,NULL); | | insert_ob_in_map(the_chest,map,NULL,0); |
return the_chest; | | return the_chest; |
} | | } |
| | |
| | |
/* boundscheck */ | | /* boundscheck */ |
if(lx > 0 && ly > 0 && lx < RP->Xsize && ly < RP->Ysize) | | if(lx > 0 && ly > 0 && lx < RP->Xsize && ly < RP->Ysize) |
/* don't bother searching this square unless the map says life exists.*/ | | /* don't bother searching this square unless the map says life exists.*/ |
if(get_map(map,lx,ly)->flags & P_IS_ALIVE) { | | if(GET_MAP_FLAGS(map,lx,ly) & P_IS_ALIVE) { |
object *the_monster=get_map_ob(map,lx,ly); | | object *the_monster=get_map_ob(map,lx,ly); |
for(;the_monster!=NULL&&(!QUERY_FLAG(the_monster,FLAG_MONSTER));the_monster=the_monster->above); | | for(;the_monster!=NULL&&(!QUERY_FLAG(the_monster,FLAG_MONSTER));the_monster=the_monster->above); |
if(the_monster && QUERY_FLAG(the_monster,FLAG_MONSTER)) | | if(the_monster && QUERY_FLAG(the_monster,FLAG_MONSTER)) |
| | |
if(the_keymaster==NULL) { | | if(the_keymaster==NULL) { |
the_key->x = kx; | | the_key->x = kx; |
the_key->y = ky; | | the_key->y = ky; |
insert_ob_in_map(the_key,map,NULL); | | insert_ob_in_map(the_key,map,NULL,0); |
return 1; | | return 1; |
} | | } |
| | |
| | |
/* check the current square for a monster. If there is one, | | /* check the current square for a monster. If there is one, |
set theMonsterToFind and return it. */ | | set theMonsterToFind and return it. */ |
layout[x][y]=1; | | layout[x][y]=1; |
if(get_map(map,x,y)->flags & P_IS_ALIVE) { | | if(GET_MAP_FLAGS(map,x,y) & P_IS_ALIVE) { |
object *the_monster = get_map_ob(map,x,y); | | object *the_monster = get_map_ob(map,x,y); |
/* check off this point */ | | /* check off this point */ |
for(;the_monster!=NULL&&(!QUERY_FLAG(the_monster,FLAG_ALIVE));the_monster=the_monster->above); | | for(;the_monster!=NULL&&(!QUERY_FLAG(the_monster,FLAG_ALIVE));the_monster=the_monster->above); |
| | |
new_door->x = x + freearr_x[i]; | | new_door->x = x + freearr_x[i]; |
new_door->y = y + freearr_y[i]; | | new_door->y = y + freearr_y[i]; |
remove_monsters(new_door->x,new_door->y,map); | | remove_monsters(new_door->x,new_door->y,map); |
insert_ob_in_map(new_door,map,NULL); | | insert_ob_in_map(new_door,map,NULL,0); |
doorlist[ndoors_made]=new_door; | | doorlist[ndoors_made]=new_door; |
ndoors_made++; | | ndoors_made++; |
} | | } |
| | |
remove_ob(door); | | remove_ob(door); |
free_object(door); | | free_object(door); |
doorlist[i]=new_door; | | doorlist[i]=new_door; |
insert_ob_in_map(new_door,map,NULL); | | insert_ob_in_map(new_door,map,NULL,0); |
sprintf(keybuf,"%d",RANDOM()); | | sprintf(keybuf,"%d",RANDOM()); |
new_door->slaying = add_string(keybuf); | | new_door->slaying = add_string(keybuf); |
keyplace(map,new_door->x,new_door->y,keybuf,NO_PASS_DOORS,2,RP); | | keyplace(map,new_door->x,new_door->y,keybuf,NO_PASS_DOORS,2,RP); |