1 | /* |
1 | /* |
2 | * static char *rcsid_arch_c = |
2 | * static char *rcsid_arch_c = |
3 | * "$Id: arch.C,v 1.1 2006/08/13 17:16:00 elmex Exp $"; |
3 | * "$Id: arch.C,v 1.4 2006/08/27 16:15:11 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
28 | |
28 | |
29 | #include <global.h> |
29 | #include <global.h> |
30 | #include <arch.h> |
30 | #include <arch.h> |
31 | #include <funcpoint.h> |
31 | #include <funcpoint.h> |
32 | #include <loader.h> |
32 | #include <loader.h> |
|
|
33 | |
|
|
34 | #include <cassert> |
33 | |
35 | |
34 | /* IF set, does a little timing on the archetype load. */ |
36 | /* IF set, does a little timing on the archetype load. */ |
35 | #define TIME_ARCH_LOAD 0 |
37 | #define TIME_ARCH_LOAD 0 |
36 | |
38 | |
37 | static void add_arch(archetype *at); |
39 | static void add_arch(archetype *at); |
… | |
… | |
402 | void first_arch_pass(FILE *fp) { |
404 | void first_arch_pass(FILE *fp) { |
403 | object *op; |
405 | object *op; |
404 | archetype *at,*head=NULL,*last_more=NULL; |
406 | archetype *at,*head=NULL,*last_more=NULL; |
405 | int i,first=2; |
407 | int i,first=2; |
406 | |
408 | |
|
|
409 | object_thawer thawer; |
|
|
410 | |
407 | op=get_object(); |
411 | op=get_object(); |
408 | op->arch=first_archetype=at=get_archetype_struct(); |
412 | op->arch=first_archetype=at=get_archetype_struct(); |
409 | |
413 | |
410 | while((i=load_object(fp,op,first,0))) { |
414 | while((i=load_object(fp,thawer,op,first,0))) { |
411 | first=0; |
415 | first=0; |
412 | copy_object(op,&at->clone); |
416 | copy_object(op,&at->clone); |
413 | at->clone.speed_left= (float) (-0.1); |
417 | at->clone.speed_left= (float) (-0.1); |
414 | /* copy the body_info to the body_used - this is only really |
418 | /* copy the body_info to the body_used - this is only really |
415 | * need for monsters, but doesn't hurt to do it for everything. |
419 | * need for monsters, but doesn't hurt to do it for everything. |
… | |
… | |
591 | LOG(llevError,"Couldn't find archetype.\n"); |
595 | LOG(llevError,"Couldn't find archetype.\n"); |
592 | return NULL; |
596 | return NULL; |
593 | } |
597 | } |
594 | op=get_object(); |
598 | op=get_object(); |
595 | copy_object(&at->clone,op); |
599 | copy_object(&at->clone,op); |
|
|
600 | op->instantiate (); |
596 | op->arch=at; |
601 | op->arch=at; |
597 | return op; |
602 | return op; |
598 | } |
603 | } |
599 | |
604 | |
600 | /* |
605 | /* |
… | |
… | |
729 | LOG(llevError,"Can't clone archetype %d\n",type); |
734 | LOG(llevError,"Can't clone archetype %d\n",type); |
730 | free_object(op); |
735 | free_object(op); |
731 | return NULL; |
736 | return NULL; |
732 | } |
737 | } |
733 | copy_object(&at->clone,op); |
738 | copy_object(&at->clone,op); |
|
|
739 | op->instantiate (); |
734 | return op; |
740 | return op; |
735 | } |
741 | } |
736 | |
742 | |
737 | /* |
743 | /* |
738 | * member: make instance from class |
744 | * member: make instance from class |