]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/16_vrs.c
wwww
[16.git] / src / lib / 16_vrs.c
index d8a43bf545d906dfb2055d1a24db5807f1fdf714..f77119af4af5291b5067ed81d4ee0dd987f8dd02 100755 (executable)
 int read_vrs(global_game_variables_t *gvar, char *filename, struct vrs_container *vrs_cont){\r
        int fd;\r
        dword size;\r
-       byte huge *buffer;\r
+       byte far *buffer;\r
        vrl1_vgax_offset_t **vrl_line_offsets;\r
-       uint32_t huge *vrl_headers_offsets;\r
-       uint16_t huge *vrl_id_iter;\r
+       uint32_t far *vrl_headers_offsets;\r
+       uint16_t far *vrl_id_iter;\r
        uint32_t vrl_size;\r
        int num_of_vrl=0, i;\r
-       struct vrl1_vgax_header huge *curr_vrl;\r
+       struct vrl1_vgax_header far *curr_vrl;\r
        int success=1;\r
 \r
        // Open filename, get size of file,\r
@@ -54,17 +54,17 @@ int read_vrs(global_game_variables_t *gvar, char *filename, struct vrs_container
        // Calculate vrl offsets\r
 \r
        // Count sprites\r
-       vrl_id_iter = (uint16_t huge *)(buffer + vrs_cont->vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST]);\r
+       vrl_id_iter = (uint16_t far *)(buffer + vrs_cont->vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST]);\r
        while(vrl_id_iter[num_of_vrl]){\r
                num_of_vrl++;\r
        }\r
        // Allocate memory for vrl line offsets table\r
        vrl_line_offsets = malloc(sizeof(vrl1_vgax_offset_t *)*num_of_vrl);\r
 \r
-       vrl_headers_offsets = (uint32_t huge *)(buffer + vrs_cont->vrs_hdr->offset_table[VRS_HEADER_OFFSET_VRS_LIST]);\r
+       vrl_headers_offsets = (uint32_t far *)(buffer + vrs_cont->vrs_hdr->offset_table[VRS_HEADER_OFFSET_VRS_LIST]);\r
        // Calculate line offsets for each vrl\r
        for(i = 0; i < num_of_vrl; i++){\r
-               curr_vrl = (struct vrl1_vgax_header huge *)(buffer + vrl_headers_offsets[i]);\r
+               curr_vrl = (struct vrl1_vgax_header far *)(buffer + vrl_headers_offsets[i]);\r
 \r
                // Calc. vrl size as (next_offset - curr_offset)\r
                if (i != num_of_vrl - 1){\r
@@ -81,9 +81,9 @@ int read_vrs(global_game_variables_t *gvar, char *filename, struct vrs_container
 }\r
 \r
 // Seek and return a specified .vrl blob from .vrs blob in far memory\r
-int get_vrl_by_id(struct vrs_container /*huge*/ *vrs_cont, uint16_t id, struct vrl_container *vrl_cont){\r
-       uint16_t huge *ids;\r
-       uint32_t huge *vrl_offs_list;\r
+int get_vrl_by_id(struct vrs_container far *vrs_cont, uint16_t id, struct vrl_container *vrl_cont){\r
+       uint16_t far *ids;\r
+       uint32_t far *vrl_offs_list;\r
        int counter = 0;\r
 \r
        // If id is invalid, return -1\r
@@ -93,7 +93,7 @@ int get_vrl_by_id(struct vrs_container /*huge*/ *vrs_cont, uint16_t id, struct v
        }\r
 \r
        // Get id list from .vrs blob (base + offset)\r
-       ids = (uint16_t huge*)(vrs_cont->buffer +\r
+       ids = (uint16_t far*)(vrs_cont->buffer +\r
                vrs_cont->vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST]);\r
 \r
        // Loop through the id list until we found the right one or hit the end of the list\r
@@ -108,12 +108,12 @@ int get_vrl_by_id(struct vrs_container /*huge*/ *vrs_cont, uint16_t id, struct v
        }\r
 \r
        // Get vrl offsets list from .vrs blob (base + offset)\r
-       vrl_offs_list = (uint32_t huge *)(vrs_cont->buffer +\r
+       vrl_offs_list = (uint32_t far *)(vrs_cont->buffer +\r
                                        vrs_cont->vrs_hdr->offset_table[VRS_HEADER_OFFSET_VRS_LIST]);\r
 \r
        // Get vrl_header from .vrs (base + offset from vrl_list)\r
        // Counter is number of vrls to skip (ids and vrls are aligned according to the .vrs specification)\r
-       vrl_cont->vrl_header = (struct vrl1_vgax_header huge *)(vrs_cont->buffer + vrl_offs_list[counter]);\r
+       vrl_cont->vrl_header = (struct vrl1_vgax_header far *)(vrs_cont->buffer + vrl_offs_list[counter]);\r
 \r
        // Get .vrl size by integer arithmetics (next vrl offset - current vrl offset)\r
        if(ids[counter+1]){\r