void v_gen_geometry_cmd_def(void) { unsigned int order[] = { 0, 2 }; v_cg_new_cmd(V_NT_GEOMETRY, "g_layer_create", 48, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_LAYER_ID, "layer_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_NAME, "name"); v_cg_add_param(VCGP_ENUM_NAME, "VNGLayerType"); v_cg_add_param(VCGP_ENUM, "type"); v_cg_add_param(VCGP_UINT32, "def_uint"); v_cg_add_param(VCGP_REAL64, "def_real"); v_cg_alias(FALSE, "g_layer_destroy", "if(name[0] == 0)", 2, NULL); v_cg_end_cmd(); v_cg_new_cmd(V_NT_GEOMETRY, "g_layer_subscribe", 49, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_LAYER_ID, "layer_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_ENUM_NAME, "VNRealFormat"); v_cg_add_param(VCGP_ENUM, "type"); v_cg_alias(FALSE, "g_layer_unsubscribe", "if(type > VN_FORMAT_REAL64)", 2, NULL); v_cg_end_cmd(); v_cg_new_cmd(V_NT_GEOMETRY, "g_vertex_set_xyz_real32", 50, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_LAYER_ID, "layer_id"); v_cg_add_param(VCGP_UINT32, "vertex_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_REAL32, "x"); v_cg_add_param(VCGP_REAL32, "y"); v_cg_add_param(VCGP_REAL32, "z"); v_cg_alias(FALSE, "g_vertex_delete_real32", "if(x == V_REAL32_MAX || y == V_REAL32_MAX || z == V_REAL32_MAX)", 2, order); v_cg_end_cmd(); v_cg_new_cmd(V_NT_GEOMETRY, "g_vertex_set_xyz_real64", 51, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_LAYER_ID, "layer_id"); v_cg_add_param(VCGP_UINT32, "vertex_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_REAL64, "x"); v_cg_add_param(VCGP_REAL64, "y"); v_cg_add_param(VCGP_REAL64, "z"); v_cg_alias(FALSE, "g_vertex_delete_real64", "if(x == V_REAL64_MAX || y == V_REAL64_MAX || z == V_REAL64_MAX)", 2, order); v_cg_end_cmd(); v_cg_new_cmd(V_NT_GEOMETRY, "g_vertex_set_uint32", 52, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_LAYER_ID, "layer_id"); v_cg_add_param(VCGP_UINT32, "vertex_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_UINT32, "value"); v_cg_end_cmd(); v_cg_new_cmd(V_NT_GEOMETRY, "g_vertex_set_real64", 53, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_LAYER_ID, "layer_id"); v_cg_add_param(VCGP_UINT32, "vertex_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_REAL64, "value"); v_cg_end_cmd(); v_cg_new_cmd(V_NT_GEOMETRY, "g_vertex_set_real32", 54, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_LAYER_ID, "layer_id"); v_cg_add_param(VCGP_UINT32, "vertex_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_REAL32, "value"); v_cg_end_cmd(); /* v_cg_new_cmd(V_NT_GEOMETRY, "g_vertex_delete", VCGCT_NORMAL); v_cg_add_param(VCGP_UINT32, "vertex_id"); v_cg_end_cmd(); */ v_cg_new_cmd(V_NT_GEOMETRY, "g_polygon_set_corner_uint32", 55, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_LAYER_ID, "layer_id"); v_cg_add_param(VCGP_UINT32, "polygon_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_UINT32, "v0"); v_cg_add_param(VCGP_UINT32, "v1"); v_cg_add_param(VCGP_UINT32, "v2"); v_cg_add_param(VCGP_UINT32, "v3"); v_cg_alias(FALSE, "g_polygon_delete", "if(layer_id == 1 && v0 == ~0u)", 2, order); v_cg_end_cmd(); v_cg_new_cmd(V_NT_GEOMETRY, "g_polygon_set_corner_real64", 56, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_LAYER_ID, "layer_id"); v_cg_add_param(VCGP_UINT32, "polygon_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_REAL64, "v0"); v_cg_add_param(VCGP_REAL64, "v1"); v_cg_add_param(VCGP_REAL64, "v2"); v_cg_add_param(VCGP_REAL64, "v3"); v_cg_end_cmd(); v_cg_new_cmd(V_NT_GEOMETRY, "g_polygon_set_corner_real32", 57, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_LAYER_ID, "layer_id"); v_cg_add_param(VCGP_UINT32, "polygon_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_REAL32, "v0"); v_cg_add_param(VCGP_REAL32, "v1"); v_cg_add_param(VCGP_REAL32, "v2"); v_cg_add_param(VCGP_REAL32, "v3"); v_cg_end_cmd(); v_cg_new_cmd(V_NT_GEOMETRY, "g_polygon_set_face_uint8", 58, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_LAYER_ID, "layer_id"); v_cg_add_param(VCGP_UINT32, "polygon_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_UINT8, "value"); v_cg_end_cmd(); v_cg_new_cmd(V_NT_GEOMETRY, "g_polygon_set_face_uint32", 59, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_LAYER_ID, "layer_id"); v_cg_add_param(VCGP_UINT32, "polygon_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_UINT32, "value"); v_cg_end_cmd(); v_cg_new_cmd(V_NT_GEOMETRY, "g_polygon_set_face_real64", 60, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_LAYER_ID, "layer_id"); v_cg_add_param(VCGP_UINT32, "polygon_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_REAL64, "value"); v_cg_end_cmd(); v_cg_new_cmd(V_NT_GEOMETRY, "g_polygon_set_face_real32", 61, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_LAYER_ID, "layer_id"); v_cg_add_param(VCGP_UINT32, "polygon_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_REAL32, "value"); v_cg_end_cmd(); v_cg_new_cmd(V_NT_GEOMETRY, "g_crease_set_vertex", 62, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_NAME, "layer"); v_cg_add_param(VCGP_UINT32, "def_crease"); v_cg_end_cmd(); v_cg_new_cmd(V_NT_GEOMETRY, "g_crease_set_edge", 63, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_NAME, "layer"); v_cg_add_param(VCGP_UINT32, "def_crease"); v_cg_end_cmd(); v_cg_new_cmd(V_NT_GEOMETRY, "g_bone_create", 64, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_UINT16, "bone_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_NAME, "weight"); v_cg_add_param(VCGP_NAME, "reference"); v_cg_add_param(VCGP_UINT16, "parent"); v_cg_add_param(VCGP_REAL64, "pos_x"); v_cg_add_param(VCGP_REAL64, "pos_y"); v_cg_add_param(VCGP_REAL64, "pos_z"); v_cg_add_param(VCGP_NAME, "position_label"); v_cg_add_param(VCGP_NAME, "rotation_label"); v_cg_add_param(VCGP_NAME, "scale_label"); v_cg_alias(FALSE, "g_bone_destroy", "if(weight[0] == 0)", 2, NULL); v_cg_end_cmd(); }
void v_gen_object_cmd_def(void) { v_cg_new_cmd(V_NT_OBJECT, "o_transform_pos_real32", 32, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_UINT32, "time_s"); v_cg_add_param(VCGP_UINT32, "time_f"); v_cg_add_param(VCGP_POINTER_TYPE,"real32"); v_cg_add_param(VCGP_POINTER, "pos"); v_cg_add_param(VCGP_POINTER_TYPE,"real32"); v_cg_add_param(VCGP_POINTER, "speed"); v_cg_add_param(VCGP_POINTER_TYPE,"real32"); v_cg_add_param(VCGP_POINTER, "accelerate"); v_cg_add_param(VCGP_POINTER_TYPE,"real32"); v_cg_add_param(VCGP_POINTER, "drag_normal"); v_cg_add_param(VCGP_PACK_INLINE, "\t{\n" "\t\tunsigned char mask = 0;\n" "\t\tunsigned int cmd;\n" "\t\tcmd = buffer_pos++;\n" "\t\tbuffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], pos[0]);\n" "\t\tbuffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], pos[1]);\n" "\t\tbuffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], pos[2]);\n" "\t\tif(speed != NULL && (speed[0] > 0.0000001 || speed[0] < -0.0000001 || speed[1] > 0.0000001 || speed[1] < -0.0000001 || speed[2] > 0.0000001 || speed[2] < -0.0000001))\n" "\t\t{\n" "\t\t\tmask |= 1;\n" "\t\t\tbuffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], speed[0]);\n" "\t\t\tbuffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], speed[1]);\n" "\t\t\tbuffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], speed[2]);\n" "\t\t}\n" "\t\tif(accelerate != NULL && (accelerate[0] > 0.0000001 || accelerate[0] < -0.0000001 || accelerate[1] > 0.0000001 || accelerate[1] < -0.0000001 || accelerate[2] > 0.0000001 || accelerate[2] < -0.0000001))\n" "\t\t{\n" "\t\t\tmask |= 2;\n" "\t\t\tbuffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], accelerate[0]);\n" "\t\t\tbuffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], accelerate[1]);\n" "\t\t\tbuffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], accelerate[2]);\n" "\t\t}\n" "\t\tif(drag_normal != NULL && (drag > 0.0000001 || drag < -0.0000001) && (drag_normal[0] > 0.0000001 || drag_normal[0] < -0.0000001 || drag_normal[1] > 0.0000001 || drag_normal[1] < -0.0000001 || drag_normal[2] > 0.0000001 || drag_normal[2] < -0.0000001))\n" "\t\t{\n" "\t\t\tmask |= 4;\n" "\t\t\tbuffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], drag_normal[0]);\n" "\t\t\tbuffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], drag_normal[1]);\n" "\t\t\tbuffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], drag_normal[2]);\n" "\t\t}\n" "\t\tif(drag > 0.0000001 || drag < -0.0000001)\n" "\t\t{\n" "\t\t\tmask |= 8;\n" "\t\t\tbuffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], drag);\n" "\t\t}\n" "\t\tvnp_raw_pack_uint8(&buf[cmd], mask);\n" "\t}if(FALSE)\n"); v_cg_add_param(VCGP_UNPACK_INLINE, "\t{\n" "\t\tfloat output[4][3];\n" "\t\tunsigned int i, j;\n" "\t\tchar mask, pow = 1;\n" "\t\tbuffer_pos += vnp_raw_unpack_uint8(&buf[buffer_pos], &mask);\n" "\t\tfor(j = 0; j < 3; j++)\n" "\t\t\tbuffer_pos += vnp_raw_unpack_real32(&buf[buffer_pos], &output[0][j]);\n" "\t\tfor(i = 1; i < 4; i++)\n" "\t\t{\n" "\t\t\tif((mask & pow) != 0)\n" "\t\t\t\tfor(j = 0; j < 3; j++)\n" "\t\t\t\t\tbuffer_pos += vnp_raw_unpack_real32(&buf[buffer_pos], &output[i][j]);\n" "\t\t\telse\n" "\t\t\t\tfor(j = 0; j < 3; j++)\n" "\t\t\t\t\toutput[i][j] = 0;\n" "\t\t\tpow *= 2;\n" "\t\t}\n" "\t\tif((mask & pow) != 0)\n" "\t\t\tbuffer_pos += vnp_raw_unpack_real32(&buf[buffer_pos], &drag);\n" "\t\telse\n" "\t\t\tdrag = 0.0f;\n" "\t\tif(func_o_transform_pos_real32 != NULL)\n" "\t\t\tfunc_o_transform_pos_real32(v_fs_get_user_data(32), node_id, time_s, time_f, &output[0][0], &output[1][0], &output[2][0], &output[3][0], drag);\n" "\t\treturn buffer_pos;\n" "\t}\n"); v_cg_add_param(VCGP_REAL32, "drag"); v_cg_end_cmd(); v_cg_new_cmd(V_NT_OBJECT, "o_transform_rot_real32", 33, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_UINT32, "time_s"); v_cg_add_param(VCGP_UINT32, "time_f"); v_cg_add_param(VCGP_POINTER_TYPE, "VNQuat32"); v_cg_add_param(VCGP_POINTER, "rot"); v_cg_add_param(VCGP_POINTER_TYPE, "VNQuat32"); v_cg_add_param(VCGP_POINTER, "speed"); v_cg_add_param(VCGP_POINTER_TYPE, "VNQuat32"); v_cg_add_param(VCGP_POINTER, "accelerate"); v_cg_add_param(VCGP_POINTER_TYPE, "VNQuat32"); v_cg_add_param(VCGP_POINTER, "drag_normal"); v_cg_add_param(VCGP_PACK_INLINE, "\t{\n" "\t\tuint8 mask = 0;\n" "\t\tunsigned int maskpos;\n" "\t\tmaskpos = buffer_pos++;\t\t/* Remember location, and reserve a byte for the mask. */\n" "\t\tbuffer_pos += vnp_pack_quat32(&buf[buffer_pos], rot);\n" "\t\tif(v_quat32_valid(speed))\n" "\t\t{\n" "\t\t\tmask |= 1;\n" "\t\t\tbuffer_pos += vnp_pack_quat32(&buf[buffer_pos], speed);\n" "\t\t}\n" "\t\tif(v_quat32_valid(accelerate))\n" "\t\t{\n" "\t\t\tmask |= 2;\n" "\t\t\tbuffer_pos += vnp_pack_quat32(&buf[buffer_pos], accelerate);\n" "\t\t}\n" "\t\tif(v_quat32_valid(drag_normal))\n" "\t\t{\n" "\t\t\tmask |= 4;\n" "\t\t\tbuffer_pos += vnp_pack_quat32(&buf[buffer_pos], drag_normal);\n" "\t\t}\n" "\t\tif(drag > 0.0000001 || drag < -0.0000001)\n" "\t\t{\n" "\t\t\tmask |= 8;\n" "\t\t\tbuffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], drag);\n" "\t\t}\n" "\t\tvnp_raw_pack_uint8(&buf[maskpos], mask);\t/* Write the mask into start of command. */\n" "\t}\n" "\tif(FALSE)\n"); v_cg_add_param(VCGP_UNPACK_INLINE, "\t{\n" "\t\tVNQuat32 trot, temp[3], *q[3];\n" "\t\tunsigned int i;\n" "\t\tuint8 mask, test;\n" "\t\tbuffer_pos += vnp_raw_unpack_uint8(&buf[buffer_pos], &mask);\n" "\t\tbuffer_pos += vnp_unpack_quat32(&buf[buffer_pos], &trot);\n" "\t\tfor(i = 0, test = 1; i < sizeof temp / sizeof *temp; i++, test <<= 1)\n" "\t\t{\n" "\t\t\tif(mask & test)\t\t/* Field present? */\n" "\t\t\t{\n" "\t\t\t\tbuffer_pos += vnp_unpack_quat32(&buf[buffer_pos], &temp[i]);\n" "\t\t\t\tq[i] = &temp[i];\n" "\t\t\t}\n" "\t\t\telse\n" "\t\t\t\tq[i] = NULL;\n" "\t\t}\n" "\t\tif(mask & test)\n" "\t\t\tbuffer_pos += vnp_raw_unpack_real32(&buf[buffer_pos], &drag);\n" "\t\telse\n" "\t\t\tdrag = 0.0;\n" "\t\tif(func_o_transform_rot_real32 != NULL)\n" "\t\t\tfunc_o_transform_rot_real32(v_fs_get_user_data(33), node_id, time_s, time_f, &trot, q[0], q[1], q[2], drag);\n" "\t\treturn buffer_pos;\n" "\t}\n"); v_cg_add_param(VCGP_REAL32, "drag"); v_cg_end_cmd(); v_cg_new_cmd(V_NT_OBJECT, "o_transform_scale_real32", 34, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_REAL32, "scale_x"); v_cg_add_param(VCGP_REAL32, "scale_y"); v_cg_add_param(VCGP_REAL32, "scale_z"); v_cg_end_cmd(); v_cg_new_cmd(V_NT_OBJECT, "o_transform_pos_real64", 35, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_UINT32, "time_s"); v_cg_add_param(VCGP_UINT32, "time_f"); v_cg_add_param(VCGP_POINTER_TYPE,"real64"); v_cg_add_param(VCGP_POINTER, "pos"); v_cg_add_param(VCGP_POINTER_TYPE,"real64"); v_cg_add_param(VCGP_POINTER, "speed"); v_cg_add_param(VCGP_POINTER_TYPE,"real64"); v_cg_add_param(VCGP_POINTER, "accelerate"); v_cg_add_param(VCGP_POINTER_TYPE,"real64"); v_cg_add_param(VCGP_POINTER, "drag_normal"); v_cg_add_param(VCGP_PACK_INLINE, "\t{\n" "\t\tunsigned char mask = 0;\n" "\t\tunsigned int cmd;\n" "\t\tcmd = buffer_pos++;\n" "\t\tbuffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], pos[0]);\n" "\t\tbuffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], pos[1]);\n" "\t\tbuffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], pos[2]);\n" "\t\tif(speed != NULL && (speed[0] > 0.0000001 || speed[0] < -0.0000001 || speed[1] > 0.0000001 || speed[1] < -0.0000001 || speed[2] > 0.0000001 || speed[2] < -0.0000001))\n" "\t\t{\n" "\t\t\tmask |= 1;\n" "\t\t\tbuffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], speed[0]);\n" "\t\t\tbuffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], speed[1]);\n" "\t\t\tbuffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], speed[2]);\n" "\t\t}\n" "\t\tif(accelerate != NULL && (accelerate[0] > 0.0000001 || accelerate[0] < -0.0000001 || accelerate[1] > 0.0000001 || accelerate[1] < -0.0000001 || accelerate[2] > 0.0000001 || accelerate[2] < -0.0000001))\n" "\t\t{\n" "\t\t\tmask |= 2;\n" "\t\t\tbuffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], accelerate[0]);\n" "\t\t\tbuffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], accelerate[1]);\n" "\t\t\tbuffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], accelerate[2]);\n" "\t\t}\n" "\t\tif(drag_normal != NULL && (drag > 0.0000001 || drag < -0.0000001) && (drag_normal[0] > 0.0000001 || drag_normal[0] < -0.0000001 || drag_normal[1] > 0.0000001 || drag_normal[1] < -0.0000001 || drag_normal[2] > 0.0000001 || drag_normal[2] < -0.0000001))\n" "\t\t{\n" "\t\t\tmask |= 4;\n" "\t\t\tbuffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], drag_normal[0]);\n" "\t\t\tbuffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], drag_normal[1]);\n" "\t\t\tbuffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], drag_normal[2]);\n" "\t\t}\n" "\t\tif(drag > 0.0000001 || drag < -0.0000001)\n" "\t\t{\n" "\t\t\tmask |= 8;\n" "\t\t\tbuffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], drag);\n" "\t\t}\n" "\t\tvnp_raw_pack_uint8(&buf[cmd], mask);\n" "\t}if(FALSE)\n"); v_cg_add_param(VCGP_UNPACK_INLINE, "\t{\n" "\t\tdouble output[4][3];\n" "\t\tunsigned int i, j;\n" "\t\tchar mask, pow = 1;\n" "\t\tbuffer_pos += vnp_raw_unpack_uint8(&buf[buffer_pos], &mask);\n" "\t\tfor(j = 0; j < 3; j++)\n" "\t\t\tbuffer_pos += vnp_raw_unpack_real64(&buf[buffer_pos], &output[0][j]);\n" "\t\tfor(i = 1; i < 4; i++)\n" "\t\t{\n" "\t\t\tif((mask & pow) != 0)\n" "\t\t\t\tfor(j = 0; j < 3; j++)\n" "\t\t\t\t\tbuffer_pos += vnp_raw_unpack_real64(&buf[buffer_pos], &output[i][j]);\n" "\t\t\telse\n" "\t\t\t\tfor(j = 0; j < 3; j++)\n" "\t\t\t\t\toutput[i][j] = 0;\n" "\t\t\tpow *= 2;\n" "\t\t}\n" "\t\tif((mask & pow) != 0)\n" "\t\t\tbuffer_pos += vnp_raw_unpack_real64(&buf[buffer_pos], &drag);\n" "\t\telse\n" "\t\t\tdrag = 0.0;\n" "\t\tif(func_o_transform_pos_real64 != NULL)\n" "\t\t\tfunc_o_transform_pos_real64(v_fs_get_user_data(35), node_id, time_s, time_f, &output[0][0], &output[1][0], &output[2][0], &output[3][0], drag);\n" "\t\treturn buffer_pos;\n" "\t}\n"); v_cg_add_param(VCGP_REAL64, "drag"); v_cg_end_cmd(); v_cg_new_cmd(V_NT_OBJECT, "o_transform_rot_real64", 36, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_UINT32, "time_s"); v_cg_add_param(VCGP_UINT32, "time_f"); v_cg_add_param(VCGP_POINTER_TYPE,"VNQuat64"); v_cg_add_param(VCGP_POINTER, "rot"); v_cg_add_param(VCGP_POINTER_TYPE,"VNQuat64"); v_cg_add_param(VCGP_POINTER, "speed"); v_cg_add_param(VCGP_POINTER_TYPE,"VNQuat64"); v_cg_add_param(VCGP_POINTER, "accelerate"); v_cg_add_param(VCGP_POINTER_TYPE,"VNQuat64"); v_cg_add_param(VCGP_POINTER, "drag_normal"); v_cg_add_param(VCGP_PACK_INLINE, "\t{\n" "\t\tuint8 mask = 0;\n" "\t\tunsigned int maskpos;\n" "\t\tmaskpos = buffer_pos++;\t\t/* Remember location, and reserve a byte for the mask. */\n" "\t\tbuffer_pos += vnp_pack_quat64(&buf[buffer_pos], rot);\n" "\t\tif(v_quat64_valid(speed))\n" "\t\t{\n" "\t\t\tmask |= 1;\n" "\t\t\tbuffer_pos += vnp_pack_quat64(&buf[buffer_pos], speed);\n" "\t\t}\n" "\t\tif(v_quat64_valid(accelerate))\n" "\t\t{\n" "\t\t\tmask |= 2;\n" "\t\t\tbuffer_pos += vnp_pack_quat64(&buf[buffer_pos], accelerate);\n" "\t\t}\n" "\t\tif(v_quat64_valid(drag_normal))\n" "\t\t{\n" "\t\t\tmask |= 4;\n" "\t\t\tbuffer_pos += vnp_pack_quat64(&buf[buffer_pos], drag_normal);\n" "\t\t}\n" "\t\tif(drag > 0.0000001 || drag < -0.0000001)\n" "\t\t{\n" "\t\t\tmask |= 8;\n" "\t\t\tbuffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], drag);\n" "\t\t}\n" "\t\tvnp_raw_pack_uint8(&buf[maskpos], mask);\t/* Write the mask into start of command. */\n" "\t}\n" "\tif(FALSE)\n"); v_cg_add_param(VCGP_UNPACK_INLINE, "\t{\n" "\t\tVNQuat64 trot, temp[3], *q[3];\n" "\t\tunsigned int i;\n" "\t\tuint8 mask, test;\n" "\t\tbuffer_pos += vnp_raw_unpack_uint8(&buf[buffer_pos], &mask);\n" "\t\tbuffer_pos += vnp_unpack_quat64(&buf[buffer_pos], &trot);\n" "\t\tfor(i = 0, test = 1; i < sizeof temp / sizeof *temp; i++, test <<= 1)\n" "\t\t{\n" "\t\t\tif(mask & test)\t\t/* Field present? */\n" "\t\t\t{\n" "\t\t\t\tbuffer_pos += vnp_unpack_quat64(&buf[buffer_pos], &temp[i]);\n" "\t\t\t\tq[i] = &temp[i];\n" "\t\t\t}\n" "\t\t\telse\n" "\t\t\t\tq[i] = NULL;\n" "\t\t}\n" "\t\tif(mask & test)\n" "\t\t\tbuffer_pos += vnp_raw_unpack_real64(&buf[buffer_pos], &drag);\n" "\t\telse\n" "\t\t\tdrag = 0.0;\n" "\t\tif(func_o_transform_rot_real64 != NULL)\n" "\t\t\tfunc_o_transform_rot_real64(v_fs_get_user_data(36), node_id, time_s, time_f, &trot, q[0], q[1], q[2], drag);\n" "\t\treturn buffer_pos;\n" "\t}\n"); v_cg_add_param(VCGP_REAL64, "drag"); v_cg_end_cmd(); v_cg_new_cmd(V_NT_OBJECT, "o_transform_scale_real64", 37, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_REAL64, "scale_x"); v_cg_add_param(VCGP_REAL64, "scale_y"); v_cg_add_param(VCGP_REAL64, "scale_z"); v_cg_end_cmd(); v_cg_new_cmd(V_NT_OBJECT, "o_transform_subscribe", 38, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_ENUM_NAME, "VNRealFormat"); v_cg_add_param(VCGP_ENUM, "type"); v_cg_alias(TRUE, "o_transform_unsubscribe", NULL, 4, NULL); v_cg_end_cmd(); v_cg_new_cmd(V_NT_OBJECT, "o_light_set", 39, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_REAL64, "light_r"); v_cg_add_param(VCGP_REAL64, "light_g"); v_cg_add_param(VCGP_REAL64, "light_b"); v_cg_end_cmd(); v_cg_new_cmd(V_NT_OBJECT, "o_link_set", 40, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_UINT16, "link_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_NODE_ID, "link"); v_cg_add_param(VCGP_NAME, "label"); v_cg_add_param(VCGP_UINT32, "target_id"); v_cg_alias(TRUE, "o_link_destroy", NULL, 2, NULL); v_cg_end_cmd(); v_cg_new_cmd(V_NT_OBJECT, "o_method_group_create", 41, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_UINT16, "group_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_NAME, "name"); v_cg_alias(FALSE, "o_method_group_destroy", "if(name[0] == 0)", 2, NULL); v_cg_end_cmd(); v_cg_new_cmd(V_NT_OBJECT, "o_method_group_subscribe", 42, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_UINT16, "group_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_alias(TRUE, "o_method_group_unsubscribe", NULL, 2, NULL); v_cg_end_cmd(); v_cg_new_cmd(V_NT_OBJECT, "o_method_create", 43, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_UINT16, "group_id"); v_cg_add_param(VCGP_UINT16, "method_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_LONG_NAME, "name"); v_cg_add_param(VCGP_UINT8, "param_count"); v_cg_add_param(VCGP_POINTER_TYPE,"VNOParamType"); v_cg_add_param(VCGP_POINTER, "param_types"); v_cg_add_param(VCGP_POINTER_TYPE,"char *"); v_cg_add_param(VCGP_POINTER, "param_names"); v_cg_add_param(VCGP_PACK_INLINE, "\t{\n" "\t\tunsigned int i, j, sum = 1;\n" "\t\tfor(i = 0; i < param_count; i++)\n" "\t\t{\n" "\t\t\tsum += 3;\n" "\t\t\tfor(j = 0; param_names[i][j] != 0; j++);\n" "\t\t}\n" "\t\tif(sum + buffer_pos > 1500)\n" "\t\t\treturn;\n" "\t\tfor(i = 0; i < param_count; i++)\n" "\t\t{\n" "\t\t\tbuffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], param_types[i]);\n" "\t\t\tbuffer_pos += vnp_raw_pack_string(&buf[buffer_pos], param_names[i], 1500 - buffer_pos);\n" "\t\t}\n" "\t}\n"); v_cg_add_param(VCGP_UNPACK_INLINE, "\tif(param_count != 255)\n" "\t{\n" "\t\tunsigned int i, size, text = 0;\n" "\t\tVNOParamType types[256];\n" "\t\tuint8 t;\n" "\t\tchar name_buf[1500], *names[256];\n" "\t\tfor(i = 0; i < param_count; i++)\n" "\t\t{\n" "\t\t\tbuffer_pos += vnp_raw_unpack_uint8(&buf[buffer_pos], &t);\n" "\t\t\ttypes[i] = t;\n" "\t\t\tnames[i] = &name_buf[text];\n" "\t\t\tsize = vnp_raw_unpack_string(&buf[buffer_pos], names[i], 1500 - buffer_pos, buffer_length - buffer_pos);\n" "\t\t\tbuffer_pos += size;\n" "\t\t\ttext += size;\n" "\t\t}\n" "\t\tif(func_o_method_create != NULL)\n" "\t\t\tfunc_o_method_create(v_fs_get_user_data(43), node_id, group_id, method_id, name, param_count, types, (const char **) names);\n" "\t\treturn buffer_pos;\n" "\t}\n"); v_cg_alias(FALSE, "o_method_destroy", "if(name[0] == 0)", 3, NULL); v_cg_end_cmd(); v_cg_new_cmd(V_NT_OBJECT, "o_method_call", 44, VCGCT_UNIQUE); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_UINT16, "group_id"); v_cg_add_param(VCGP_UINT16, "method_id"); v_cg_add_param(VCGP_NODE_ID, "sender"); v_cg_add_param(VCGP_POINTER_TYPE, "VNOPackedParams"); v_cg_add_param(VCGP_POINTER, "params"); v_cg_add_param(VCGP_PACK_INLINE, "\t{\n" "\t\tunsigned int i;\n" "\t\tuint16 size;\n" "\t\tvnp_raw_unpack_uint16(params, &size);\n" "\t\tfor(i = 0; i < size; i++)\n" "\t\t\tbuffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], ((uint8 *)params)[i]);\n" "\t\tfree((void *) params);\t/* Drop the const. */\n" "\t}\n"); v_cg_add_param(VCGP_UNPACK_INLINE, "\t{\n" "\t\tunsigned int i;\n" "\t\tuint8 par[1500];\n" "\t\tuint16 size;\n" "\t\tvnp_raw_unpack_uint16(&buf[buffer_pos], &size);\n" "\t\tfor(i = 0; i < size; i++)\n" "\t\t\tbuffer_pos += vnp_raw_unpack_uint8(&buf[buffer_pos], &par[i]);\n" "\t\tif(func_o_method_call != NULL)\n" "\t\t\tfunc_o_method_call(v_fs_get_user_data(44), node_id, group_id, method_id, sender, par);\n" "\t\treturn buffer_pos;\n" "\t}\n"); v_cg_end_cmd(); v_cg_new_cmd(V_NT_OBJECT, "o_anim_run", 45, VCGCT_UNIQUE); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_UINT16, "link_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_UINT32, "time_s"); v_cg_add_param(VCGP_UINT32, "time_f"); v_cg_add_param(VCGP_UINT8, "dimensions"); v_cg_add_param(VCGP_POINTER_TYPE, "real64"); v_cg_add_param(VCGP_POINTER, "pos"); v_cg_add_param(VCGP_POINTER_TYPE, "real64"); v_cg_add_param(VCGP_POINTER, "speed"); v_cg_add_param(VCGP_POINTER_TYPE, "real64"); v_cg_add_param(VCGP_POINTER, "accel"); v_cg_add_param(VCGP_POINTER_TYPE, "real64"); v_cg_add_param(VCGP_POINTER, "scale"); v_cg_add_param(VCGP_POINTER_TYPE, "real64"); v_cg_add_param(VCGP_POINTER, "scale_speed"); v_cg_add_param(VCGP_PACK_INLINE, "\t{\n" "\t\tunsigned char mask = 0;\n" "\t\tunsigned int cmd, i;\n" "\t\tcmd = buffer_pos++;\n" "\t\tif(dimensions > 4)\n" "\t\t\tdimensions = 4;\n" "\t\tfor(i = 0; i < dimensions; i++)\n" "\t\t\tbuffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], pos[i]);\n" "\t\tif(speed != NULL)\n" "\t\t{\n" "\t\t\tmask |= 1;\n" "\t\t\tfor(i = 0; i < dimensions; i++)\n" "\t\t\t\tbuffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], speed[i]);\n" "\t\t}\n" "\t\tif(accel != NULL)\n" "\t\t{\n" "\t\t\tmask |= 2;\n" "\t\t\tfor(i = 0; i < dimensions; i++)\n" "\t\t\t\tbuffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], accel[i]);\n" "\t\t}\n" "\t\tif(scale != NULL)\n" "\t\t{\n" "\t\t\tmask |= 3;\n" "\t\t\tfor(i = 0; i < dimensions; i++)\n" "\t\t\t\tbuffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], scale[i]);\n" "\t\t}\n" "\t\tif(scale_speed != NULL)\n" "\t\t{\n" "\t\t\tmask |= 4;\n" "\t\t\tfor(i = 0; i < dimensions; i++)\n" "\t\t\t\tbuffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], scale_speed[i]);\n" "\t\t}\n" "\t\tvnp_raw_pack_uint8(&buf[cmd], mask);\n" "\t}\n"); v_cg_add_param(VCGP_UNPACK_INLINE, "\t{\n" "\t\tdouble output[5][4];\n" "\t\tunsigned int i, j;\n" "\t\tchar mask, pow = 1;\n" "\t\tbuffer_pos += vnp_raw_unpack_uint8(&buf[buffer_pos], &mask);\n" "\t\tif(dimensions > 4)\n" "\t\t\tdimensions = 4;\n" "\t\tfor(j = 0; j < dimensions; j++)\n" "\t\t\tbuffer_pos += vnp_raw_unpack_real64(&buf[buffer_pos], &output[0][j]);\n" "\t\tfor(i = 1; i < 5; i++)\n" "\t\t{\n" "\t\t\tif((mask & pow) != 0)\n" "\t\t\t\tfor(j = 0; j < dimensions; j++)\n" "\t\t\t\t\tbuffer_pos += vnp_raw_unpack_real64(&buf[buffer_pos], &output[i][j]);\n" "\t\t\telse\n" "\t\t\t\tfor(j = 0; j < dimensions; j++)\n" "\t\t\t\t\toutput[i][j] = 0;\n" "\t\t\tpow *= 2;\n" "\t\t}\n" "\t\tif(func_o_anim_run != NULL)\n" "\t\t\tfunc_o_anim_run(v_fs_get_user_data(45), node_id, link_id, time_s, time_f, dimensions, &output[0][0], &output[1][0], &output[2][0], &output[3][0], &output[4][0]);\n" "\t\treturn buffer_pos;\n" "\t}\n"); v_cg_end_cmd(); v_cg_new_cmd(V_NT_OBJECT, "o_hide", 46, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_UINT8, "hidden"); v_cg_end_cmd(); }
void v_gen_system_cmd_def(void) { v_cg_new_manual_cmd(0, "connect", "VSession verse_send_connect(const char *name, const char *pass, const char *address, const uint8 *expected_host_id)", NULL, NULL); v_cg_new_manual_cmd(1, "connect_accept", "VSession verse_send_connect_accept(VNodeID avatar, const char *address, uint8 *host_id)", NULL, NULL); v_cg_new_manual_cmd(2, "connect_terminate", "void verse_send_connect_terminate(const char *address, const char *bye)", NULL, NULL); v_cg_new_manual_cmd(5, "ping", "void verse_send_ping(const char *address, const char *message)", NULL, NULL); v_cg_new_cmd(V_NT_SYSTEM, "error_message", 6, VCGCT_UNIQUE); v_cg_add_param(VCGP_LONG_NAME, "message"); v_cg_new_cmd(V_NT_SYSTEM, "packet_ack", 7, VCGCT_INVISIBLE_SYSTEM); v_cg_add_param(VCGP_UINT32, "packet_id"); v_cg_add_param(VCGP_PACK_INLINE, "\tv_cmd_buf_set_unique_address_size(head, buffer_pos);\n" "\tv_cmd_buf_set_size(head, buffer_pos);\n" "\tv_noq_send_ack_nak_buf(v_con_get_network_queue(), head);\n" "\treturn;\n"); v_cg_end_cmd(); v_cg_new_cmd(V_NT_SYSTEM, "packet_nak", 8, VCGCT_INVISIBLE_SYSTEM); v_cg_add_param(VCGP_UINT32, "packet_id"); v_cg_add_param(VCGP_PACK_INLINE, "\tv_cmd_buf_set_unique_address_size(head, buffer_pos);\n" "\tv_cmd_buf_set_size(head, buffer_pos);\n" "\tv_noq_send_ack_nak_buf(v_con_get_network_queue(), head);\n" "\treturn;\n"); v_cg_end_cmd(); v_cg_new_cmd(V_NT_SYSTEM, "node_index_subscribe", 9, VCGCT_NORMAL); v_cg_add_param(VCGP_UINT32, "mask"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_end_cmd(); v_cg_new_cmd(V_NT_SYSTEM, "node_create", 10, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_ENUM_NAME, "VNodeType"); v_cg_add_param(VCGP_ENUM, "type"); v_cg_add_param(VCGP_ENUM_NAME, "VNodeOwner"); v_cg_add_param(VCGP_ENUM, "owner"); v_cg_alias(FALSE, "node_destroy", "if(owner == (uint8) ~0u || type >= V_NT_NUM_TYPES)", 1, NULL); v_cg_end_cmd(); v_cg_new_cmd(V_NT_SYSTEM, "node_subscribe", 11, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_alias(TRUE, "node_unsubscribe", NULL, 1, NULL); v_cg_end_cmd(); v_cg_new_cmd(V_NT_SYSTEM, "tag_group_create", 16, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_UINT16, "group_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_NAME, "name"); v_cg_alias(FALSE, "tag_group_destroy", "if(name[0] == 0)", 2, NULL); v_cg_end_cmd(); v_cg_new_cmd(V_NT_SYSTEM, "tag_group_subscribe", 17, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_UINT16, "group_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_alias(TRUE, "tag_group_unsubscribe", NULL, 2, NULL); v_cg_end_cmd(); v_cg_new_cmd(V_NT_SYSTEM, "tag_create", 18, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_UINT16, "group_id"); v_cg_add_param(VCGP_UINT16, "tag_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_NAME, "name"); v_cg_add_param(VCGP_ENUM_NAME, "VNTagType"); v_cg_add_param(VCGP_ENUM, "type"); v_cg_add_param(VCGP_POINTER_TYPE, "VNTag"); v_cg_add_param(VCGP_POINTER, "tag"); v_cg_add_param(VCGP_PACK_INLINE, "\tif(type > VN_TAG_BLOB)\n" "\t{\n" "\t\tv_cmd_buf_free(head);\n" "\t\treturn;\n" "\t}\n" "\tswitch(type)\n" "\t{\n" "\t\tcase VN_TAG_BOOLEAN :\n" "\t\t\tbuffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], ((VNTag *)tag)->vboolean);\n" "\t\tbreak;\n" "\t\tcase VN_TAG_UINT32 :\n" "\t\t\tbuffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], ((VNTag *)tag)->vuint32);\n" "\t\tbreak;\n" "\t\tcase VN_TAG_REAL64 :\n" "\t\t\tbuffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], ((VNTag *)tag)->vreal64);\n" "\t\tbreak;\n" "\t\tcase VN_TAG_STRING :\n" "\t\t{\n" "\t\t\tunsigned int i;\n" "\t\t\tfor(i = 0; ((VNTag *)tag)->vstring[i] != 0 && i < VN_TAG_MAX_BLOB_SIZE; i++)\n" "\t\t\t\tbuffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], ((VNTag *)tag)->vstring[i]);\n" "\t\t\tbuffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], 0);\n" "\t\t}\n" "\t\tbreak;\n" "\t\tcase VN_TAG_REAL64_VEC3 :\n" "\t\t{\n" "\t\t\tbuffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], ((VNTag *)tag)->vreal64_vec3[0]);\n" "\t\t\tbuffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], ((VNTag *)tag)->vreal64_vec3[1]);\n" "\t\t\tbuffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], ((VNTag *)tag)->vreal64_vec3[2]);\n" "\t\t}\n" "\t\tbreak;\n" "\t\tcase VN_TAG_LINK :\n" "\t\t{\n" "\t\t\tbuffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], ((VNTag *)tag)->vlink);\n" "\t\t}\n" "\t\tbreak;\n" "\t\tcase VN_TAG_ANIMATION :\n" "\t\t{\n" "\t\t\tbuffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], ((VNTag *)tag)->vanimation.curve);\n" "\t\t\tbuffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], ((VNTag *)tag)->vanimation.start);\n" "\t\t\tbuffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], ((VNTag *)tag)->vanimation.end);\n" "\t\t}\n" "\t\tbreak;\n" "\t\tcase VN_TAG_BLOB :\n" "\t\t{\n" "\t\t\tunsigned int i;\n" "\t\t\tif(((VNTag *)tag)->vblob.size > VN_TAG_MAX_BLOB_SIZE)\n" "\t\t\t\t((VNTag *)tag)->vblob.size = VN_TAG_MAX_BLOB_SIZE;\n" "\t\t\tbuffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], ((VNTag *)tag)->vblob.size);\n" "\t\t\tfor(i = 0; i < ((VNTag *)tag)->vblob.size; i++)\n" "\t\t\t\tbuffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], ((uint8 *)((VNTag *)tag)->vblob.blob)[i]);\n" "\t\t}\n" "\t\tbreak;\n" "\t\tdefault :\n" "\t\t\t;\n" "\t}\n"); v_cg_add_param(VCGP_UNPACK_INLINE, "\tif(type < VN_TAG_TYPE_COUNT)\n" "\t{\n" "\t\tVNTag tag;\n" "\t\tunsigned int i;\n" "\t\tchar string[VN_TAG_MAX_BLOB_SIZE];\n" "\t\tswitch(type)\n" "\t\t{\n" "\t\t\tcase VN_TAG_BOOLEAN :\n" "\t\t\t\tbuffer_pos += vnp_raw_unpack_uint8(&buf[buffer_pos], &tag.vboolean);\n" "\t\t\tbreak;\n" "\t\t\tcase VN_TAG_UINT32 :\n" "\t\t\t\tbuffer_pos += vnp_raw_unpack_uint32(&buf[buffer_pos], &tag.vuint32);\n" "\t\t\tbreak;\n" "\t\t\tcase VN_TAG_REAL64 :\n" "\t\t\t\tbuffer_pos += vnp_raw_unpack_real64(&buf[buffer_pos], &tag.vreal64);\n" "\t\t\tbreak;\n" "\t\t\tcase VN_TAG_STRING :\n" "\t\t\t{\n" "\t\t\t\ttag.vstring = string;\n" "\t\t\t\tbuffer_pos += vnp_raw_unpack_string(&buf[buffer_pos], string, VN_TAG_MAX_BLOB_SIZE, buffer_length - buffer_pos);\n" "\t\t\t}\n" "\t\t\tbreak;\n" "\t\t\tcase VN_TAG_REAL64_VEC3 :\n" "\t\t\t{\n" "\t\t\t\tbuffer_pos += vnp_raw_unpack_real64(&buf[buffer_pos], &tag.vreal64_vec3[0]);\n" "\t\t\t\tbuffer_pos += vnp_raw_unpack_real64(&buf[buffer_pos], &tag.vreal64_vec3[1]);\n" "\t\t\t\tbuffer_pos += vnp_raw_unpack_real64(&buf[buffer_pos], &tag.vreal64_vec3[2]);\n" "\t\t\t}\n" "\t\t\tbreak;\n" "\t\t\tcase VN_TAG_LINK :\n" "\t\t\t{\n" "\t\t\t\tbuffer_pos += vnp_raw_unpack_uint32(&buf[buffer_pos], &tag.vlink);\n" "\t\t\t}\n" "\t\t\tbreak;\n" "\t\t\tcase VN_TAG_ANIMATION :\n" "\t\t\t{\n" "\t\t\t\tbuffer_pos += vnp_raw_unpack_uint32(&buf[buffer_pos], &tag.vanimation.curve);\n" "\t\t\t\tbuffer_pos += vnp_raw_unpack_uint32(&buf[buffer_pos], &tag.vanimation.start);\n" "\t\t\t\tbuffer_pos += vnp_raw_unpack_uint32(&buf[buffer_pos], &tag.vanimation.end);\n" "\t\t\t}\n" "\t\t\tbreak;\n" "\t\t\tcase VN_TAG_BLOB :\n" "\t\t\t{\n" "\t\t\t\tbuffer_pos += vnp_raw_unpack_uint16(&buf[buffer_pos], &tag.vblob.size);\n" "\t\t\t\tif(tag.vblob.size > VN_TAG_MAX_BLOB_SIZE)\n" "\t\t\t\t\ttag.vblob.size = VN_TAG_MAX_BLOB_SIZE;\n" "\t\t\t\ttag.vblob.blob = string;\n" "\t\t\t\tfor(i = 0; i < tag.vblob.size; i++)\n" "\t\t\t\t\tbuffer_pos += vnp_raw_unpack_uint8(&buf[buffer_pos], &string[i]);\n" "\t\t\t}\n" "\t\t\tbreak;\n" "\t\tdefault :\n" "\t\t\t;\n" "\t\t}\n" "\t\tif(func_tag_create != NULL)\n" "\t\tfunc_tag_create(v_fs_get_user_data(18), node_id, group_id, tag_id, name, type, &tag);\n" "\t\treturn buffer_pos;\n" "\t}\n"); v_cg_alias(FALSE, "tag_destroy", "if(type >= VN_TAG_TYPE_COUNT)", 3, NULL); v_cg_end_cmd(); v_cg_new_cmd(V_NT_SYSTEM, "node_name_set", 19, VCGCT_NORMAL); v_cg_add_param(VCGP_NODE_ID, "node_id"); v_cg_add_param(VCGP_END_ADDRESS, NULL); v_cg_add_param(VCGP_LONG_NAME, "name"); v_cg_end_cmd(); }