version 1.40 | | version 1.41 |
---|
| | |
/* | | /* |
* static char *rcsid_map_c = | | * static char *rcsid_map_c = |
* "$Id: map.c,v 1.40 2002/09/01 06:32:30 mwedel Exp $"; | | * "$Id: map.c,v 1.41 2002/09/07 05:55:18 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
else m = ob->map; | | else m = ob->map; |
| | |
/* If space is currently not blocked by anything, no need to | | /* If space is currently not blocked by anything, no need to |
* go further. Same logic as blocked_above. | | * go further. Not true for players - all sorts of special |
| | * things we need to do for players. |
*/ | | */ |
if (! (GET_MAP_FLAGS(m, x,y) & (P_NO_PASS | P_IS_ALIVE))) return 0; | | if (ob->type != PLAYER && ! (GET_MAP_FLAGS(m, x,y) & (P_NO_PASS | P_IS_ALIVE))) return 0; |
| | |
| | |
if(ob->head != NULL) | | if(ob->head != NULL) |
| | |
* true. If we get through the entire stack, that must mean | | * true. If we get through the entire stack, that must mean |
* ob is blocking it, so return 0. | | * ob is blocking it, so return 0. |
*/ | | */ |
for(tmp = GET_MAP_OB(m,x,y); tmp!= NULL; tmp = tmp->above) | | for(tmp = GET_MAP_OB(m,x,y); tmp!= NULL; tmp = tmp->above) { |
| | |
if (QUERY_FLAG(tmp,FLAG_NO_PASS) || (QUERY_FLAG(tmp,FLAG_ALIVE) && | | if (QUERY_FLAG(tmp,FLAG_NO_PASS) || (QUERY_FLAG(tmp,FLAG_ALIVE) && |
tmp->head != ob && tmp != ob)) | | tmp->head != ob && tmp != ob && tmp->type != DOOR)) |
return 1; | | return 1; |
| | |
| | /* This must be before the checks below. Code for inventory checkers. */ |
| | if (tmp->type==CHECK_INV && QUERY_FLAG(tmp,FLAG_NO_PASS)) { |
| | /* If last_sp is set, the player/monster needs an object, |
| | * so we check for it. If they don't have it, they can't |
| | * pass through this space. |
| | */ |
| | if (tmp->last_sp) { |
| | if (check_inv_recursive(ob,tmp)==NULL) |
| | return 1; |
| | else |
| | continue; |
| | } else { |
| | /* In this case, the player must not have the object - |
| | * if they do, they can't pass through. |
| | */ |
| | if (check_inv_recursive(ob,tmp)!=NULL) /* player has object */ |
| | return 1; |
| | else |
| | continue; |
| | } |
| | } /* if check_inv */ |
| | } |
return 0; | | return 0; |
} | | } |
| | |
| | #if 0 |
/* | | /* |
* Eneq(@csd.uu.se): This is a new version of blocked, this one handles objects | | * Eneq(@csd.uu.se): This is a new version of blocked, this one handles objects |
* that can be passed through by monsters with the CAN_PASS_THRU defined. | | * that can be passed through by monsters with the CAN_PASS_THRU defined. |
| | |
/* Can not pass through doors */ | | /* Can not pass through doors */ |
if (QUERY_FLAG(tmp,FLAG_ALIVE) && tmp->type!=DOOR) return 1; | | if (QUERY_FLAG(tmp,FLAG_ALIVE) && tmp->type!=DOOR) return 1; |
| | |
/* This must be before the checks below. Code for inventory checkers. */ | | |
if (tmp->type==CHECK_INV && QUERY_FLAG(tmp,FLAG_NO_PASS)) { | | |
/* If last_sp is set, the player/monster needs an object, | | |
* so we check for it. If they don't have it, they can't | | |
* pass through this space. | | |
*/ | | |
if (tmp->last_sp) { | | |
if (check_inv_recursive(op,tmp)==NULL) | | |
return 1; | | |
else | | |
continue; | | |
} else { | | |
/* In this case, the player must not have the object - | | |
* if they do, they can't pass through. | | |
*/ | | |
if (check_inv_recursive(op,tmp)!=NULL) /* player has object */ | | |
return 1; | | |
else | | |
continue; | | |
} | | |
} /* if check_inv */ | | |
| | |
/* Can't get through this space */ | | /* Can't get through this space */ |
if (QUERY_FLAG(tmp,FLAG_NO_PASS) && !QUERY_FLAG(tmp,FLAG_PASS_THRU)) | | if (QUERY_FLAG(tmp,FLAG_NO_PASS) && !QUERY_FLAG(tmp,FLAG_PASS_THRU)) |
| | |
} | | } |
return 0; | | return 0; |
} | | } |
| | #endif |
| | |
/* | | /* |
* Returns true if the given archetype can't fit in the given spot. | | * Returns true if the given archetype can't fit in the given spot. |
| | |
op->head=prev,last_more->more=op,last_more=op; | | op->head=prev,last_more->more=op,last_more=op; |
break; | | break; |
} | | } |
| | if (mapflags & MAP_STYLE) { |
| | remove_from_active_list(op); |
| | } |
op=get_object(); | | op=get_object(); |
op->map = m; | | op->map = m; |
} | | } |
| | |
strcpy(pathname, create_overlay_pathname(filename)); | | strcpy(pathname, create_overlay_pathname(filename)); |
| | |
if((fp=open_and_uncompress(pathname, 0, &comp))==NULL) { | | if((fp=open_and_uncompress(pathname, 0, &comp))==NULL) { |
LOG(llevDebug,"Can't open overlay %s\n", pathname); | | /* LOG(llevDebug,"Can't open overlay %s\n", pathname);*/ |
return m; | | return m; |
} | | } |
| | |