version 1.58 | | version 1.59 |
---|
| | |
/* | | /* |
* static char *rcsid_monster_c = | | * static char *rcsid_monster_c = |
* "$Id: monster.c,v 1.58 2003/01/05 23:50:15 mwedel Exp $"; | | * "$Id: monster.c,v 1.59 2003/01/08 08:39:20 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
* this function is map tile aware. | | * this function is map tile aware. |
*/ | | */ |
object *find_nearest_living_creature(object *npc) { | | object *find_nearest_living_creature(object *npc) { |
int i; | | int i,mflags; |
int nx,ny; | | sint16 nx,ny; |
mapstruct *m; | | mapstruct *m; |
object *tmp; | | object *tmp; |
int search_arr[SIZEOFFREE]; | | int search_arr[SIZEOFFREE]; |
| | |
*/ | | */ |
nx = npc->x + freearr_x[search_arr[i]]; | | nx = npc->x + freearr_x[search_arr[i]]; |
ny = npc->y + freearr_y[search_arr[i]]; | | ny = npc->y + freearr_y[search_arr[i]]; |
if (out_of_map(npc->map,nx,ny)) continue; | | m = npc->map; |
m = get_map_from_coord(npc->map, &nx, &ny); | | |
| | mflags = get_map_flags(m, &m, nx, ny, &nx, &ny); |
| | if (mflags & P_OUT_OF_MAP) continue; |
| | |
if (GET_MAP_FLAGS(m, nx, ny) & P_IS_ALIVE) { | | if (mflags & P_IS_ALIVE) { |
tmp=get_map_ob(m,nx,ny); | | tmp=get_map_ob(m,nx,ny); |
while(tmp!=NULL && !QUERY_FLAG(tmp,FLAG_MONSTER)&& | | while(tmp!=NULL && !QUERY_FLAG(tmp,FLAG_MONSTER)&& |
!QUERY_FLAG(tmp,FLAG_GENERATOR ) && tmp->type!=PLAYER) | | !QUERY_FLAG(tmp,FLAG_GENERATOR ) && tmp->type!=PLAYER) |
| | |
} | | } |
| | |
/* in server/player.c */ | | /* in server/player.c */ |
return fire_bow(head, part, dir); | | return fire_bow(head, part, dir, 0, part->x, part->y); |
| | |
} | | } |
| | |
| | |
*/ | | */ |
| | |
int stand_in_light( object *op) { | | int stand_in_light( object *op) { |
| | sint16 nx,ny; |
| | mapstruct *m; |
| | |
| | |
if(!op) return 0; | | if(!op) return 0; |
if(op->glow_radius) return 1; | | if(op->glow_radius) return 1; |
| | |
*/ | | */ |
for (x = op->x - MAX_LIGHT_RADII; x< op->x + MAX_LIGHT_RADII; x++) { | | for (x = op->x - MAX_LIGHT_RADII; x< op->x + MAX_LIGHT_RADII; x++) { |
for (y = op->y - MAX_LIGHT_RADII; y< op->y + MAX_LIGHT_RADII; y++) { | | for (y = op->y - MAX_LIGHT_RADII; y< op->y + MAX_LIGHT_RADII; y++) { |
if (out_of_map(op->map, x, y)) continue; | | m = op->map; |
| | nx = x; |
| | ny = y; |
| | |
| | if (get_map_flags(m, &m, nx, ny, &nx, &ny) & P_OUT_OF_MAP) continue; |
| | |
if (GET_MAP_LIGHT(op->map, x, y) > MAX(abs(x - op->x), abs(y - op->y))) return 1; | | if (GET_MAP_LIGHT(m, nx, ny) > MAX(abs(x - op->x), abs(y - op->y))) return 1; |
} | | } |
} | | } |
} | | } |