char* get_curr_anim_name(struct sprite *spri)\r
{\r
// Retrive animation name list\r
+#ifndef VRSVRLNONPTR\r
+ struct vrs_header far *vrs = spri->spritesheet->vrs_hdr;\r
+#else\r
struct vrs_header far *vrs = spri->spritesheet.vrs_hdr;\r
+#endif\r
uint32_t far *anim_names_offsets = (uint32_t far *)\r
((byte far *)vrs +\r
vrs->offset_table[VRS_HEADER_OFFSET_ANIMATION_NAME_LIST]);\r
\r
void init_anim(struct sprite *spri, int anim_index)\r
{\r
+#ifndef VRSVRLNONPTR\r
+ struct vrs_header far *vrs = spri->spritesheet->vrs_hdr;\r
+#else\r
struct vrs_header far *vrs = spri->spritesheet.vrs_hdr;\r
+#endif\r
uint32_t far *anim_lists_offsets = (uint32_t far *)\r
((byte far *)vrs +\r
vrs->offset_table[VRS_HEADER_OFFSET_ANIMATION_LIST]);\r
{\r
int new_anim_index = 0;\r
int iter_id;\r
+#ifndef VRSVRLNONPTR\r
+ struct vrs_header far *vrs = spri->spritesheet->vrs_hdr;\r
+#else\r
struct vrs_header far *vrs = spri->spritesheet.vrs_hdr;\r
+#endif\r
// Retruve animation ids list\r
uint16_t far *anim_ids = (uint16_t far *)\r
((byte far *)vrs +\r
{\r
int new_anim_index = 0;\r
int iter_id;\r
+#ifndef VRSVRLNONPTR\r
+ struct vrs_header far *vrs = spri->spritesheet->vrs_hdr;\r
+#else\r
struct vrs_header far *vrs = spri->spritesheet.vrs_hdr;\r
+#endif\r
// Retruve animation ids list\r
uint16_t far *anim_ids = (uint16_t far *)\r
((byte far *)vrs +\r
\r
\r
// Draw sprite\r
+#ifndef VRSVRLNONPTR\r
+ j = get_vrl_by_id(enti->spri.spritesheet, enti->spri.curr_spri_id, enti->spri.sprite_vrl_cont);\r
+#else\r
j = get_vrl_by_id(&enti->spri.spritesheet, enti->spri.curr_spri_id, &enti->spri.sprite_vrl_cont);\r
+#endif\r
if(j < 0)\r
{\r
//Quit (gv, "Error retriving required sprite");\r
else rx = -(video->page[0].dx);\r
if (y >= enti->overdrawh) ry = (y - enti->overdrawh);\r
else ry = -(video->page[0].dy);\r
+#ifndef VRSVRLNONPTR\r
+ h = enti->spri.sprite_vrl_cont->vrl_header->height + enti->overdrawh + y - ry;\r
+ w = (x + enti->spri.sprite_vrl_cont->vrl_header->width + (enti->overdraww*2) + 3 - rx) & (~3) - enti->overdraww;//round up\r
+#else\r
h = enti->spri.sprite_vrl_cont.vrl_header->height + enti->overdrawh + y - ry;\r
w = (x + enti->spri.sprite_vrl_cont.vrl_header->width + (enti->overdraww*2) + 3 - rx) & (~3) - enti->overdraww;//round up\r
+#endif\r
if ((rx+w) > video->page[0].width) w = video->page[0].width-rx;\r
if ((ry+h) > video->page[0].height) h = video->page[0].height-ry;\r
\r
draw_vrl1_vgax_modex(\r
x-rx,\r
y-ry,\r
+#ifndef VRSVRLNONPTR\r
+ enti->spri.sprite_vrl_cont->vrl_header,\r
+ enti->spri.sprite_vrl_cont->line_offsets,\r
+ enti->spri.sprite_vrl_cont->buffer + sizeof(struct vrl1_vgax_header),\r
+ enti->spri.sprite_vrl_cont->data_size\r
+#else\r
enti->spri.sprite_vrl_cont.vrl_header,\r
enti->spri.sprite_vrl_cont.line_offsets,\r
enti->spri.sprite_vrl_cont.buffer + sizeof(struct vrl1_vgax_header),\r
enti->spri.sprite_vrl_cont.data_size\r
+#endif\r
);\r
#endif\r
if(!video->rss)\r
//from 16_sprit.h\r
#ifdef __WATCOMC__\r
#include <hw/vga/vrl.h>\r
+#define VRSVRLNONPTR\r
\r
typedef struct vrs_container{\r
// Size of a .vrs blob in memory\r
typedef struct sprite\r
{\r
// VRS container from which we will extract animation and image data\r
+#ifndef VRSVRLNONPTR\r
+ vrs_container_t *spritesheet;\r
+#else\r
vrs_container_t spritesheet;\r
+#endif\r
// Container for a vrl sprite\r
+#ifndef VRSVRLNONPTR\r
+ vrl_container_t *sprite_vrl_cont;\r
+#else\r
vrl_container_t sprite_vrl_cont;\r
+#endif\r
// Current sprite id\r
int curr_spri_id;\r
// Index of a current sprite in an animation sequence\r
void VRS_LoadVRS(char *filename, entity_t *enti, global_game_variables_t *gvar){ VRS_OpenVRS(filename, enti, 0, gvar); }\r
void VRS_OpenVRS(char *filename, entity_t *enti, boolean rlsw, global_game_variables_t *gvar)\r
{\r
+#ifndef VRSVRLNONPTR\r
+ static struct vrs_container vrs;\r
+#endif\r
vrl1_vgax_offset_t **vrl_line_offsets;\r
uint16_t far *vrl_id_iter;\r
uint32_t far *vrl_headers_offsets;\r
}\r
\r
// Insert sanity cheks later\r
+#ifndef VRSVRLNONPTR\r
+ vrs.buffer = gvar->ca.spribuff;\r
+ vrs.data_size = size - sizeof(struct vrl1_vgax_header);\r
+#else\r
enti->spri.spritesheet.buffer = gvar->ca.spribuff;\r
enti->spri.spritesheet.data_size = size - sizeof(struct vrl1_vgax_header);\r
+#endif\r
num_of_vrl = 0;\r
+#ifndef VRSVRLNONPTR\r
+ vrl_id_iter = (uint16_t far *)(vrs.buffer + vrs.vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST]);\r
+#else\r
vrl_id_iter = (uint16_t far *)(enti->spri.spritesheet.buffer + enti->spri.spritesheet.vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST]);\r
+#endif\r
while(vrl_id_iter[num_of_vrl]){\r
num_of_vrl++;\r
}\r
\r
// Allocate memory for vrl line offsets table\r
vrl_line_offsets = malloc(sizeof(vrl1_vgax_offset_t *)*num_of_vrl);//TODO: USE MM_ CA_ AND PM_\r
-\r
+#ifndef VRSVRLNONPTR\r
+ vrl_headers_offsets = (uint32_t far *)(vrs.buffer + vrs.vrs_hdr->offset_table[VRS_HEADER_OFFSET_VRS_LIST]);\r
+#else\r
vrl_headers_offsets = (uint32_t far *)(enti->spri.spritesheet.buffer + enti->spri.spritesheet.vrs_hdr->offset_table[VRS_HEADER_OFFSET_VRS_LIST]);\r
+#endif\r
// Calculate line offsets for each vrl\r
for(i = 0; i < num_of_vrl; i++){\r
+#ifndef VRSVRLNONPTR\r
+ curr_vrl = (struct vrl1_vgax_header far *)(vrs.buffer + vrl_headers_offsets[i]);\r
+#else\r
curr_vrl = (struct vrl1_vgax_header far *)(enti->spri.spritesheet.buffer + vrl_headers_offsets[i]);\r
+#endif\r
\r
// Calc. vrl size as (next_offset - curr_offset)\r
if (i != num_of_vrl - 1){\r
}\r
// If it's the last vrl, size is (next_vrs_struct_offset - curr_offset)\r
else{\r
+#ifndef VRSVRLNONPTR\r
+ vrl_size = vrs.vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST] - vrl_headers_offsets[i] - sizeof(struct vrl1_vgax_header);\r
+#else\r
vrl_size = enti->spri.spritesheet.vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST] - vrl_headers_offsets[i] - sizeof(struct vrl1_vgax_header);\r
+#endif\r
}\r
vrl_line_offsets[i] = vrl1_vgax_genlineoffsets(curr_vrl, (byte *)curr_vrl + sizeof(struct vrl1_vgax_header), vrl_size);\r
}\r
+#ifndef VRSVRLNONPTR\r
+ vrs.vrl_line_offsets = vrl_line_offsets;\r
+\r
+ enti->spri.spritesheet = &vrs;\r
+ enti->spri.sprite_vrl_cont = malloc(sizeof(struct vrl_container));//TODO: USE MM_ CA_ AND PM_\r
+#else\r
enti->spri.spritesheet.vrl_line_offsets = vrl_line_offsets;\r
- free(vrl_line_offsets);//TODO: USE MM_ CA_ AND PM_\r
+#endif\r
}\r
\r
// Seek and return a specified .vrl blob from .vrs blob in far memory\r
modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, 1); //currently the over scan color!\r
break;\r
default:\r
+#ifndef VRSVRLNONPTR\r
+ rx = (((i-1) % ((t->spri->sprite_vrl_cont->vrl_header->width)/t->tileWidth)) * t->tileWidth);\r
+ ry = (((i-1) / ((t->spri->sprite_vrl_cont->vrl_header->height)/t->tileHeight)) * t->tileHeight);\r
+#else\r
rx = (((i-1) % ((t->spri->sprite_vrl_cont.vrl_header->width)/t->tileWidth)) * t->tileWidth);\r
ry = (((i-1) / ((t->spri->sprite_vrl_cont.vrl_header->height)/t->tileHeight)) * t->tileHeight);\r
+#endif\r
#ifndef TILERENDER\r
if(!pagenorendermap) modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, i+1);\r
#else\r
MM_DumpData(&gvar);\r
MM_Report_(&gvar);\r
Shutdown16(&gvar);\r
+#ifndef VRSVRLNONPTR\r
+ free(enti.spri.sprite_vrl_cont);\r
+ free(enti.spri.spritesheet->vrl_line_offsets);\r
+#endif\r
MM_FreePtr(&bigbuffer, &gvar);\r
//MM_FreePtr(&((void __based(sega)*)enti.spri.spritesheet->buffer), &mm);\r
//printf("CPU to VGA: %f\n", t1);\r