version 1.24 | | version 1.25 |
---|
| | |
/* | | /* |
* static char *rcsid_map_c = | | * static char *rcsid_map_c = |
* "$Id: map.c,v 1.24 2001/10/07 06:45:39 mwedel Exp $"; | | * "$Id: map.c,v 1.25 2001/11/04 20:22:55 michtoen Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
object *tmp, *last = NULL; | | object *tmp, *last = NULL; |
uint8 flags = 0, oldflags, light=0, anywhere=0; | | uint8 flags = 0, oldflags, light=0, anywhere=0; |
New_Face *top,*floor, *middle; | | New_Face *top,*floor, *middle; |
| | object *top_obj, *floor_obj, *middle_obj; |
| | |
oldflags = GET_MAP_FLAGS(m,x,y); | | oldflags = GET_MAP_FLAGS(m,x,y); |
if (!(oldflags & P_NEED_UPDATE)) { | | if (!(oldflags & P_NEED_UPDATE)) { |
| | |
*/ | | */ |
if (!tmp->invisible) { | | if (!tmp->invisible) { |
if ((tmp->type==PLAYER || QUERY_FLAG(tmp, FLAG_MONSTER))) | | if ((tmp->type==PLAYER || QUERY_FLAG(tmp, FLAG_MONSTER))) |
| | { |
top = tmp->face; | | top = tmp->face; |
| | top_obj = tmp; |
| | } |
else if (QUERY_FLAG(tmp,FLAG_IS_FLOOR)) { | | else if (QUERY_FLAG(tmp,FLAG_IS_FLOOR)) { |
/* If we got a floor, that means middle and top were below it, | | /* If we got a floor, that means middle and top were below it, |
* so should not be visible, so we clear them. | | * so should not be visible, so we clear them. |
| | |
middle=blank_face; | | middle=blank_face; |
top=blank_face; | | top=blank_face; |
floor = tmp->face; | | floor = tmp->face; |
| | floor_obj = tmp; |
} | | } |
/* Flag anywhere have high priority */ | | /* Flag anywhere have high priority */ |
else if (QUERY_FLAG(tmp, FLAG_SEE_ANYWHERE)) { | | else if (QUERY_FLAG(tmp, FLAG_SEE_ANYWHERE)) { |
middle = tmp->face; | | middle = tmp->face; |
| | middle_obj = tmp; |
anywhere =1; | | anywhere =1; |
} | | } |
/* Find the highest visible face around. If equal | | /* Find the highest visible face around. If equal |
| | |
* top | | * top |
*/ | | */ |
else if (middle == blank_face || (tmp->face->visibility > middle->visibility && !anywhere)) | | else if (middle == blank_face || (tmp->face->visibility > middle->visibility && !anywhere)) |
| | { |
middle = tmp->face; | | middle = tmp->face; |
| | middle_obj = tmp; |
| | } |
} | | } |
if (tmp==tmp->above) { | | if (tmp==tmp->above) { |
LOG(llevError, "Error in structure of map\n"); | | LOG(llevError, "Error in structure of map\n"); |
| | |
* may be possible for the faces to match but be different objects. | | * may be possible for the faces to match but be different objects. |
*/ | | */ |
if (top == middle) middle=blank_face; | | if (top == middle) middle=blank_face; |
| | |
/* There are three posibilities at this point: | | /* There are three posibilities at this point: |
* 1) top face is set, need middle to be set. | | * 1) top face is set, need middle to be set. |
* 2) middle is set, need to set top. | | * 2) middle is set, need to set top. |
| | |
/* Fill in top if needed */ | | /* Fill in top if needed */ |
if (top == blank_face) { | | if (top == blank_face) { |
top = tmp->face; | | top = tmp->face; |
| | top_obj = tmp; |
if (top == middle) middle=blank_face; | | if (top == middle) middle=blank_face; |
} else { | | } else { |
/* top is already set - we should only get here if | | /* top is already set - we should only get here if |
| | |
*/ | | */ |
if (tmp->face != top ) { | | if (tmp->face != top ) { |
middle = tmp->face; | | middle = tmp->face; |
| | middle_obj = tmp; |
break; | | break; |
} | | } |
} | | } |
| | |
if (middle == floor) middle = blank_face; | | if (middle == floor) middle = blank_face; |
if (top == middle) middle = blank_face; | | if (top == middle) middle = blank_face; |
SET_MAP_FACE(m,x,y,top,0); | | SET_MAP_FACE(m,x,y,top,0); |
| | if(top != blank_face) |
| | SET_MAP_FACE_OBJ(m,x,y,top_obj,0); |
| | else |
| | SET_MAP_FACE_OBJ(m,x,y,NULL,0); |
SET_MAP_FACE(m,x,y,middle,1); | | SET_MAP_FACE(m,x,y,middle,1); |
| | if(middle != blank_face) |
| | SET_MAP_FACE_OBJ(m,x,y,middle_obj,1); |
| | else |
| | SET_MAP_FACE_OBJ(m,x,y,NULL,1); |
SET_MAP_FACE(m,x,y,floor,2); | | SET_MAP_FACE(m,x,y,floor,2); |
| | if(floor != blank_face) |
| | SET_MAP_FACE_OBJ(m,x,y,floor_obj,2); |
| | else |
| | SET_MAP_FACE_OBJ(m,x,y,NULL,2); |
SET_MAP_LIGHT(m,x,y,light); | | SET_MAP_LIGHT(m,x,y,light); |
} | | } |
| | |