merged
[henge/webcc.git] / src / apc / ir.h
index 3b1d75c..8076514 100755 (executable)
 \r
 \r
 #include <stdint.h>\r
+#include <unitypes.h>\r
+#include <limits.h>\r
 \r
 #define BUF_SIZE 256\r
 #define MAX_SETS 256\r
 #define MAX_ELES 256\r
 #define MAX_QUADS 256\r
 #define MAX_MODELS 256\r
+#define MAX_MODEL_LEN 256\r
+#define MAX_MAPS 8\r
 #define MAX_POSTS 256\r
 #define MAX_CLASS_DEPTH 256\r
 #define MAX_CLASSES 256\r
@@ -32,8 +36,8 @@
     elements are populated, due to the nature of bottom up parsing.          */\r
 \r
 struct set {\r
-  char name[32];\r
-  uint64_t ref_id;\r
+  uint8_t name[32];\r
+  int ref_id;\r
   int cdat_idx;\r
 };\r
 \r
@@ -49,7 +53,7 @@ struct set {
 /*  TODO: Should classes point to their parent class?                         */\r
 \r
 struct cdat {\r
-  char name[32];\r
+  uint8_t name[32];\r
   int idx;\r
   int num_classes;\r
   int num_sets;\r
@@ -80,7 +84,7 @@ struct ref {
   struct ref* nextref;\r
   struct ref* lastref;\r
   struct odat* odatp;\r
-  uint64_t ref_id; //0xFFFFFF->digit\r
+  int ref_id; //0xFFFFFF->digit\r
 };\r
 \r
 \r
@@ -100,13 +104,13 @@ struct ref {
    differ from vlinks because they do not have a name */\r
 \r
 struct svlink {\r
-  uint64_t ref_id;\r
+  int ref_id;\r
 };\r
 \r
 /* A vlink is what it sounds like, a link to a vdat */\r
 struct vlink {\r
-  uint64_t ref_id;\r
-  char anim_name[32];\r
+  int ref_id;\r
+  uint8_t anim_name[32];\r
 };\r
 \r
 union link_t {\r
@@ -124,6 +128,24 @@ struct link {
   int ele_idx;\r
 };\r
 \r
+struct root {\r
+  int x, y, z;\r
+};\r
+\r
+struct quad {\r
+  int x;\r
+  int y;\r
+  int z;\r
+  int ref_id;\r
+};\r
+\r
+/* maps: maps store the different map data for each archetype. */\r
+struct map {\r
+  uint8_t name[NAME_MAX];//TODO:Rename\r
+  uint8_t filepath[PATH_MAX];//TODO: Rename\r
+  int height;\r
+  int width;\r
+ };\r
 \r
 /* Odats: Odats consist of the object data necessary for\r
    each object. Odats are sometimes referred to as archetypes\r
@@ -131,21 +153,18 @@ struct link {
    a runtime object and a compile-time object.\r
    TODO: Need more info about objects at runtime, to described\r
          the reasoning behind odat structure at compile-time*/\r
-\r
-struct root {\r
-  int x, y, z;\r
-};\r
-\r
 struct odat {\r
-  char name[32];\r
+  uint8_t name[32];\r
   struct vdat* vdatp;\r
   int vdat_id; //\r
   int cdat_idx;\r
   int hitbox;\r
-  uint64_t ref_id;\r
+  int ref_id;\r
+  struct odat* parent_odatp; // odat == set ? null : set ref_id\r
   struct root root;\r
   struct ref* refp; /* pointer to it's ref on ref_list */\r
-  void* quad_filep;\r
+  struct map map;\r
+  //int mli; //map list index\r
 };\r
 \r
 struct odat* curr_set_odatp; //when a set has elements, insert_set() can no longer\r
@@ -164,18 +183,23 @@ struct framesheet {
    direction (N,W,S,E,NW,NE,SW,SE)*/\r
 /* NAMED spritesheet */\r
 struct model {\r
-  char name[32];\r
+  uint8_t name[MAX_MODEL_LEN];\r
+  uint8_t filepath[PATH_MAX];\r
   struct framesheet spritesheet[8]; //one for each\r
 };\r
 \r
 /* Vdat: Vdats are the video data of each object. They can not be\r
    created as a stand alone object (because they consist solely\r
-   of animation information and not the skeleton on which the\r
+   of animation information and not the map which the\r
    animation manipulates). Vdats have a list of models for every\r
    animation that the vdats odat can do for that vdat*/\r
 struct vdat {\r
   struct odat* creator; //pointer to odat that made this vdat\r
   int num_models;\r
+  uint8_t filename[NAME_MAX/sizeof(ucs4_t)];\r
+  int height;\r
+  int width;\r
+  uint8_t filepath[PATH_MAX/sizeof(ucs4_t)];\r
   struct model model_list[MAX_MODELS];\r
 };\r
 \r
@@ -183,7 +207,7 @@ struct vdat {
    the space for a cdat on the cdat_buf, pushes that pointer onto\r
    the cdat_stack */\r
 void\r
-push_cdat(char*);\r
+push_cdat(uint8_t*);\r
 \r
 /* Called after a cdat end operator has been recognized in grammar. Sets\r
    top stack cdat ** to null and decrements stack pointer */\r
@@ -194,20 +218,20 @@ pop_cdat(void);
    the next odat. */\r
 \r
 void\r
-insert_set_label(char*, uint64_t);\r
+insert_set_label(uint8_t*, int);\r
 \r
 /* Populate the sets representation in CURR_CDAT with a ref_id and insert a link\r
    into the link_buf that will resolve the ref_id to an actual odat after parse time. */\r
 void\r
-insert_set_olink(uint64_t);\r
+insert_set_olink(int);\r
 \r
 /* Put the vlink in the link_buf to be processed after parsetime */\r
 void\r
-insert_set_vlink(uint64_t, char*);\r
+insert_set_vlink(int, uint8_t*);\r
 \r
 /* Put svlink in the link_buf to be processed after parsetime */\r
 void\r
-insert_set_svlink(uint64_t);\r
+insert_set_svlink(int);\r
 \r
 /* Called for every set reduction except for sets with olinks. Populates the\r
    set data structures in the CDAT and in the ODAT. Uses the name and ref_id\r
@@ -225,19 +249,19 @@ void
 insert_set_vdatid(void);\r
 \r
 void\r
-insert_ele_label(char*, uint64_t);\r
+insert_ele_label(uint8_t*, int);\r
 \r
 /* Insert an ele olink into the CURR_ODAT */\r
 void\r
-insert_ele_olink(uint64_t);\r
+insert_ele_olink(int);\r
 \r
 /* Insert a ele vlink  into CURR_ODAT*/\r
 void\r
-insert_ele_vlink(uint64_t, char*);\r
+insert_ele_vlink(int, uint8_t*);\r
 \r
 /* Inserts an ele short vlink into CURR_ODAT*/\r
 void\r
-insert_ele_svlink(uint64_t);\r
+insert_ele_svlink(int);\r
 \r
 /* inserts ele into CURR_CLASS and CURR_ODAT */\r
 void\r
@@ -246,6 +270,8 @@ insert_ele(void);
 void\r
 insert_ele_vdatid(void);\r
 \r
+void\r
+insert_vdat(uint8_t*, int, int, uint8_t*);\r
 /* Inserts the hitbox into the CURR_ODAT */\r
 void\r
 insert_hitbox(int);\r
@@ -256,16 +282,18 @@ insert_root(int, int, int);
 \r
 /* Inserts a quad into the CURR_ODAT */\r
 void\r
-insert_quad(void*);\r
+insert_quad(int, int, int, int);\r
 \r
 void\r
-insert_model(void);\r
+insert_map(uint8_t*, int, int, uint8_t*);\r
 \r
 void\r
-insert_framesheet(char, char*, uint64_t, int, int, int);\r
+insert_model(void);\r
 \r
 void\r
-insert_frame_pointer(char, void*);\r
+insert_framesheet(uint8_t, uint8_t*, int, int, int, int);\r
 \r
 void\r
-alloc_vdat(void);\r
+insert_frame_pointer(uint8_t, void*);\r
+\r
+\r