X-Git-Url: https://www.kengrimes.com/gitweb/?p=henge%2Fwebcc.git;a=blobdiff_plain;f=src%2Fapc%2Fir.c;fp=src%2Fapc%2Fir.c;h=4e23d161ed9edb26a11c287975cf06b7763bba02;hp=421f6e5d4f8f0ef0ec0b7fc2e86006b6ffcbbb59;hb=0f505368fa8abbc2e9ab0296b9a5e6bd4869345f;hpb=df52756177b6e4fd9465cbb1b17a35eb48bb67c9 diff --git a/src/apc/ir.c b/src/apc/ir.c index 421f6e5..4e23d16 100755 --- a/src/apc/ir.c +++ b/src/apc/ir.c @@ -6,12 +6,14 @@ ----------------------------------------------------------------------------*/ #include #include +#include //uint8_t as a char +#include //u32_cpy #include //uint64_t -#include //memmove #include //malloc #include - +//extern +//scanner_scanpixels(int*, int); /* functions needed from irmem.c */ extern @@ -27,9 +29,13 @@ struct odat* alloc_odat(void); extern -void +struct vdat* alloc_vdat(void); +extern +void +alloc_mdat(void); + extern struct link* alloc_link(void); @@ -46,6 +52,14 @@ extern struct odat* curr_odat(void); +extern +struct variant* +curr_variant(void); + +extern +struct variant* +alloc_variant(void); + extern struct vdat* curr_vdat(void); @@ -66,11 +80,15 @@ extern struct model* curr_model(void); +extern +struct quad* +curr_quad(void); + /* struct definitions needed from irmem.c */ extern int num_cdats; extern struct cdat** cdat_stackp; extern struct odat* curr_set_odatp; -extern uint64_t ss_ref_id; +extern int ss_ref_id; extern int num_vdats; /* Dynamically allocate memory for a class data structure, @@ -83,14 +101,14 @@ extern int num_vdats; which is a list of all allocated cdats*/ void push_cdat -( char* name +( uint8_t* name ) { struct cdat* curr_cdatp; curr_cdatp = alloc_cdat(); - memmove(curr_cdatp->name, name, 32); + u8_cpy(curr_cdatp->name, name, 32); curr_cdatp->idx = num_cdats; /* Set the cdat as a subclass of the previous cdat */ @@ -120,8 +138,8 @@ pop_cdat void insert_set_label -( char* name, - uint64_t ref_id +( uint8_t* name, + int ref_id ) { @@ -130,8 +148,9 @@ insert_set_label curr_setp = curr_set(); curr_set_odatp = alloc_odat(); - memmove(curr_set_odatp->name, name, 32); - memmove(curr_setp->name, name, 32); + u8_cpy(curr_set_odatp->name, name, 32); + u8_cpy(curr_setp->name, name, 32); + curr_set_odatp->parent_odatp = NULL; if(ref_id != -1) { curr_set_odatp->ref_id = ref_id; @@ -148,7 +167,7 @@ insert_set_label for another set. Allocate the memory for the set so taht it can be populated*/ void insert_set_olink -( uint64_t ref_id +( int ref_id ) { struct set* curr_setp; @@ -161,8 +180,8 @@ insert_set_olink void insert_set_vlink -( uint64_t ref_id, - char* anim_name +( int ref_id, + uint8_t* anim_name ) { struct cdat* curr_cdatp; @@ -179,7 +198,7 @@ insert_set_vlink curr_linkp->type = 2; /* Store the target odat information*/ curr_linkp->link_t.vlink.ref_id = ref_id; - memmove(curr_linkp->link_t.vlink.anim_name, anim_name, 32); + u8_cpy(curr_linkp->link_t.vlink.anim_name, anim_name, 32); /* Store the linking odat/cdat information */ curr_linkp->classp = curr_cdatp; curr_linkp->odatp = curr_odatp; @@ -191,7 +210,7 @@ insert_set_vlink /* Svlinks dont have animation names */ void insert_set_svlink -( uint64_t ref_id +( int ref_id ) { struct cdat* curr_cdatp; @@ -217,7 +236,7 @@ insert_set_svlink void insert_set () -{ uint64_t ref_id; +{ int ref_id; struct odat* curr_odatp; struct cdat* curr_cdatp; struct set* curr_setp; @@ -235,7 +254,7 @@ insert_set curr_vdatp->creator = curr_set_odatp; curr_setp->cdat_idx = curr_cdatp->idx; //does a set need its class idx? - memmove(curr_setp->name, curr_odatp->name, 32); + u8_cpy(curr_setp->name, curr_odatp->name, 32); curr_cdatp->num_sets++; curr_odatp->cdat_idx = curr_cdatp->idx; @@ -271,15 +290,15 @@ insert_set_vdatid the functions to use via curr_odat(). */ void insert_ele_label -( char* name, - uint64_t ref_id +( uint8_t* name, + int ref_id ) { struct odat* curr_odatp; curr_odatp = alloc_odat(); - memmove(curr_odatp->name, name, 32); + u8_cpy(curr_odatp->name, name, 32); if(ref_id != -1) curr_odatp->ref_id = ref_id; @@ -292,7 +311,7 @@ insert_ele_label the ref_id to the corresponding odat. */ void insert_ele_olink -( uint64_t ref_id +( int ref_id ) { /* Do nothing because we already know the ref_id that @@ -301,8 +320,8 @@ insert_ele_olink void insert_ele_vlink -( uint64_t ref_id, - char* anim_name +( int ref_id, + uint8_t* anim_name ) { struct cdat* curr_cdatp; @@ -320,13 +339,13 @@ insert_ele_vlink curr_linkp->set_idx = curr_cdatp->num_sets; //curr_linkp->ele_idx = curr_setp->num_ele; curr_linkp->link_t.vlink.ref_id = ref_id; - memmove(curr_linkp->link_t.vlink.anim_name, anim_name, 32); + u8_cpy(curr_linkp->link_t.vlink.anim_name, anim_name, 32); } void insert_ele_svlink -( uint64_t ref_id +( int ref_id ) { struct cdat* curr_cdatp; @@ -350,7 +369,7 @@ insert_ele_svlink void insert_ele() { - uint64_t ref_id; + int ref_id; struct cdat* curr_cdatp; struct odat* curr_odatp; struct vdat* curr_vdatp; @@ -371,6 +390,7 @@ insert_ele() /* Populate odat for ele */ curr_odatp->cdat_idx = curr_cdatp->idx; curr_odatp->refp = curr_refp; + curr_odatp->parent_odatp = curr_set_odatp; ref_id = curr_odatp->ref_id; @@ -390,76 +410,125 @@ insert_ele_vdatid } void -insert_quad -( void* quad_filep -) +insert_vdat +(uint8_t* filename, int height, int width, uint8_t* filepath) { - struct odat* curr_odatp; - - curr_odatp->quad_filep = quad_filep; -} - -/* Inserting the hitbox into the set - odat. Elements that don't have - a hitbox will use the sets root. */ -void -insert_hitbox -( int hitbox -) -{ struct odat* curr_odatp; - - curr_odatp = curr_odat(); - curr_odatp->hitbox = hitbox; -} + struct vdat* curr_vdatp; + int filename_len, filepath_len; -/* Inserting the root into the set - odat. Elements that don't have - a root will use the sets root. */ -void -insert_root -( int x, - int y, - int z -) -{ struct odat* curr_odatp; + curr_vdatp = alloc_vdat(); - curr_odatp = curr_odat(); - curr_odatp->root.x = x; - curr_odatp->root.y = y; - curr_odatp->root.z = z; + u8_strcpy(curr_vdatp->filename, filename); + u8_strcpy(curr_vdatp->filepath, filepath); + curr_vdatp->height = height; + curr_vdatp->width = width; + curr_vdatp->creator = curr_odat(); + } void -insert_framesheet -( char direction, - char* name, - uint64_t ref_id, - int height , - int width, - int num_frames -) -{ struct vdat* curr_vdatp; - struct model* curr_modelp; +insert_variant +(uint8_t* filename, int height, int width, uint8_t* filepath) +{ struct variant* curr_variantp; + int x, y, pixel, num_frames, n; + int* pixel_buf; + + /* Allocate the mdat */ + curr_variantp = alloc_variant(); - curr_vdatp = curr_vdat(); - curr_modelp = curr_model(); + u8_strcpy(curr_variantp->filename, filename); + u8_strcpy(curr_variantp->filepath, filepath); + curr_variantp->height = height; + curr_variantp->width = width; - curr_modelp->spritesheet[(int)direction].height = height; - curr_modelp->spritesheet[(int)direction].width = width; - curr_modelp->spritesheet[(int)direction].num_frames = num_frames; - curr_vdatp->num_models++; -} - -void -insert_frame_pointer -( char direction, - void* frame -) -{ struct model* curr_modelp; + //curr_mdatp->quad_list[num_quads].x/.y/.z/ref_id */ - curr_modelp = curr_model(); - curr_modelp->spritesheet[(int)direction].frames[curr_modelp->spritesheet[(int)direction].num_frames++] = frame; + curr_set_odatp->variant_list[curr_set_odatp->vli++] = curr_variantp; } + + +/* void */ +/* insert_quad */ +/* ( int x, int y, int z, int ref_id */ +/* ) */ +/* { */ +/* struct quad* curr_quadp; */ + +/* curr_quadp = curr_quad(); */ + +/* curr_quadp->x = x; */ +/* curr_quadp->y = y; */ +/* curr_quadp->z = z; */ +/* curr_quadp->ref_id = ref_id; */ + + + +/* } */ + +/* /\* serting the hitbox into the set */ +/* odat. Elements that don't have */ +/* a hitbox will use the sets root. *\/ */ +/* void */ +/* insert_hitbox */ +/* ( int hitbox */ +/* ) */ +/* { struct odat* curr_odatp; */ + +/* curr_odatp = curr_odat(); */ +/* curr_odatp->hitbox = hitbox; */ +/* } */ + +/* /\* Inserting the root into the set */ +/* odat. Elements that don't have */ +/* a root will use the sets root. *\/ */ +/* void */ +/* insert_root */ +/* ( int x, */ +/* int y, */ +/* int z */ +/* ) */ +/* { struct odat* curr_odatp; */ + +/* curr_odatp = curr_odat(); */ +/* curr_odatp->root.x = x; */ +/* curr_odatp->root.y = y; */ +/* curr_odatp->root.z = z; */ +/* } */ + + + +/* void */ +/* insert_framesheet */ +/* ( uint8_t direction, */ +/* uint8_t* name, */ +/* int ref_id, */ +/* int height , */ +/* int width, */ +/* int num_frames */ +/* ) */ +/* { struct vdat* curr_vdatp; */ +/* struct model* curr_modelp; */ + +/* curr_vdatp = curr_vdat(); */ +/* curr_modelp = curr_model(); */ + +/* curr_modelp->spritesheet[(int)direction].height = height; */ +/* curr_modelp->spritesheet[(int)direction].width = width; */ +/* curr_modelp->spritesheet[(int)direction].num_frames = num_frames; */ +/* curr_vdatp->num_models++; */ +/* } */ + +/* void */ +/* insert_frame_pointer */ +/* ( uint8_t direction, */ +/* void* frame */ +/* ) */ +/* { struct model* curr_modelp; */ + +/* curr_modelp = curr_model(); */ + +/* curr_modelp->spritesheet[(int)direction].frames[curr_modelp->spritesheet[(int)direction].num_frames++] = frame; */ +/* } */