version 1.77 | | version 1.78 |
---|
| | |
/* | | /* |
* static char *rcsid_map_c = | | * static char *rcsid_map_c = |
* "$Id: map.c,v 1.77 2005/08/27 21:42:06 akirschbaum Exp $"; | | * "$Id: map.c,v 1.78 2005/08/31 20:07:22 tchize Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
*/ | | */ |
| | |
void load_objects (mapstruct *m, FILE *fp, int mapflags) { | | void load_objects (mapstruct *m, FILE *fp, int mapflags) { |
int i,bufstate=LO_NEWFILE; | | int i,j,bufstate=LO_NEWFILE; |
int unique; | | int unique; |
object *op, *prev=NULL,*last_more=NULL, *otmp, *ootmp;; | | object *op, *prev=NULL,*last_more=NULL, *otmp, *ootmp;; |
| | |
| | |
} | | } |
| | |
/* check for unique items, or unique squares */ | | /* check for unique items, or unique squares */ |
unique = 0; | | /* TODO DISPLACE unique = 0; |
for (otmp = get_map_ob(m, op->x, op->y); otmp; otmp = ootmp) { | | for (otmp = get_map_ob(m, op->x, op->y); otmp; otmp = ootmp) { |
ootmp = otmp->above; | | ootmp = otmp->above; |
if (QUERY_FLAG(otmp, FLAG_UNIQUE)) | | if (QUERY_FLAG(otmp, FLAG_UNIQUE)) |
| | |
if (QUERY_FLAG(op, FLAG_UNIQUE) || QUERY_FLAG(op, FLAG_OBJ_SAVE_ON_OVL)) | | if (QUERY_FLAG(op, FLAG_UNIQUE) || QUERY_FLAG(op, FLAG_OBJ_SAVE_ON_OVL)) |
unique = 1; | | unique = 1; |
if (!(mapflags & (MAP_OVERLAY|MAP_PLAYER_UNIQUE) || unique)) | | if (!(mapflags & (MAP_OVERLAY|MAP_PLAYER_UNIQUE) || unique)) |
SET_FLAG(op, FLAG_OBJ_ORIGINAL); | | SET_FLAG(op, FLAG_OBJ_ORIGINAL);*/ |
| | |
switch(i) { | | switch(i) { |
case LL_NORMAL: | | case LL_NORMAL: |
/* if we are loading an overlay, put the floors on the bottom */ | | /* if we are loading an overlay, put the floors on the bottom */ |
if ((QUERY_FLAG(op, FLAG_IS_FLOOR) || | | if ((QUERY_FLAG(op, FLAG_IS_FLOOR) || |
QUERY_FLAG(op, FLAG_OVERLAY_FLOOR)) && mapflags & MAP_OVERLAY) | | QUERY_FLAG(op, FLAG_OVERLAY_FLOOR)) && mapflags & MAP_OVERLAY) |
insert_ob_in_map(op,m,op,INS_NO_MERGE | INS_NO_WALK_ON | INS_ABOVE_FLOOR_ONLY); | | insert_ob_in_map(op,m,op,INS_NO_MERGE | INS_NO_WALK_ON | INS_ABOVE_FLOOR_ONLY | INS_MAP_LOAD); |
else | | else |
insert_ob_in_map(op,m,op,INS_NO_MERGE | INS_NO_WALK_ON | INS_ON_TOP); | | insert_ob_in_map(op,m,op,INS_NO_MERGE | INS_NO_WALK_ON | INS_ON_TOP | INS_MAP_LOAD); |
| | |
if (op->inv) | | if (op->inv) |
sum_weight(op); | | sum_weight(op); |
| | |
op=get_object(); | | op=get_object(); |
op->map = m; | | op->map = m; |
} | | } |
| | for (i=0;i<m->width;i++){ |
| | for (j=0;j<m->height;j++){ |
| | /* check for unique items, or unique squares */ |
| | for (otmp = get_map_ob(m, i, j); otmp; otmp = otmp->above) { |
| | if (QUERY_FLAG(otmp, FLAG_UNIQUE) || QUERY_FLAG(otmp, FLAG_OBJ_SAVE_ON_OVL)) |
| | unique = 1; |
| | if (!(mapflags & (MAP_OVERLAY|MAP_PLAYER_UNIQUE) || unique)) |
| | SET_FLAG(otmp, FLAG_OBJ_ORIGINAL); |
| | } |
| | } |
| | } |
free_object(op); | | free_object(op); |
link_multipart_objects(m); | | link_multipart_objects(m); |
} | | } |