version 1.17 | | version 1.18 |
---|
| | |
/* | | /* |
* static char *rcsid_arch_c = | | * static char *rcsid_arch_c = |
* "$Id: arch.c,v 1.17 2001/12/03 07:51:39 mwedel Exp $"; | | * "$Id: arch.c,v 1.18 2002/05/19 03:55:48 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
*/ | | */ |
void first_arch_pass(FILE *fp) { | | void first_arch_pass(FILE *fp) { |
object *op; | | object *op; |
archetype *at,*prev=NULL,*last_more=NULL; | | archetype *at,*head=NULL,*last_more=NULL; |
int i,first=2; | | int i,first=2; |
int xo,yo; | | |
| | |
op=get_object(); | | op=get_object(); |
op->arch=first_archetype=at=get_archetype_struct(); | | op->arch=first_archetype=at=get_archetype_struct(); |
| | |
while((i=load_object(fp,op,first,0))) { | | while((i=load_object(fp,op,first,0))) { |
first=0; | | first=0; |
copy_object(op,&at->clone); | | copy_object(op,&at->clone); |
at->clone.speed_left= (float) (-0.1); | | at->clone.speed_left= (float) (-0.1); |
| | |
switch(i) { | | switch(i) { |
case LL_NORMAL: /* A new archetype, just link it with the previous */ | | case LL_NORMAL: /* A new archetype, just link it with the previous */ |
if(last_more!=NULL) | | if(last_more!=NULL) |
last_more->next=at; | | last_more->next=at; |
if(prev!=NULL) | | if(head!=NULL) |
prev->next=at; | | head->next=at; |
prev=last_more=at; | | head=last_more=at; |
#if 0 | | #if 0 |
if(!op->type) | | if(!op->type) |
LOG(llevDebug," WARNING: Archetype %s has no type info!\n", op->arch->name); | | LOG(llevDebug," WARNING: Archetype %s has no type info!\n", op->arch->name); |
#endif | | #endif |
| | at->tail_x = 0; |
op->quick_pos = 0; /* assume as base a single arch */ | | at->tail_y = 0; |
at->clone.quick_pos = 0; /* sic */ | | |
break; | | break; |
#if 0 | | |
case 2: | | |
LOG(llevError,"Error: Archetype with inventory is illegal!\n"); | | |
exit(-1); | | |
#endif | | |
case LL_MORE: /* Another part of the previous archetype, link it correctly */ | | case LL_MORE: /* Another part of the previous archetype, link it correctly */ |
at->head=prev; | | |
at->clone.head = &prev->clone; | | at->head=head; |
| | at->clone.head = &head->clone; |
if(last_more!=NULL) { | | if(last_more!=NULL) { |
last_more->more=at; | | last_more->more=at; |
last_more->clone.more = &at->clone; | | last_more->clone.more = &at->clone; |
} | | } |
last_more=at; | | last_more=at; |
| | |
xo = at->clone.x; | | /* If this multipart image is still composed of individual small |
if(xo <0) | | * images, don't set the tail_.. values. We can't use them anyways, |
xo=(xo*-1)|8; | | * and setting these to zero makes the map sending to the client much |
yo = at->clone.y; | | * easier as just looking at the head, we know what to do. |
if(yo <0) | | */ |
yo=(yo*-1)|8; | | if (at->clone.face != head->clone.face) { |
at->clone.quick_pos = 0|(xo<<4)|yo; | | head->tail_x = 0; |
prev->clone.quick_pos = 255; /* mark head tile */ | | head->tail_y = 0; |
| | } else { |
| | if (at->clone.x > head->tail_x) head->tail_x = at->clone.x; |
| | if (at->clone.y > head->tail_y) head->tail_y = at->clone.y; |
| | } |
break; | | break; |
| | |
} | | } |
at=get_archetype_struct(); | | at=get_archetype_struct(); |
clear_object(op); | | clear_object(op); |