From: sparky4 Date: Tue, 14 Mar 2017 22:29:50 +0000 (-0500) Subject: __seguse.txt added to show _seg usage also OpenVGMFile needs to be ported to 16_snd... X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=f0c58f5a02b7b815d1e3c8b010ae98e0aa89579e;p=16.git __seguse.txt added to show _seg usage also OpenVGMFile needs to be ported to 16_snd.c ][ ca needs huge amounts of work and i should remember what needs to be done soon also i should reverify 16_in.c to make sure it can work with other code of id engine ] i hope you rest in pepperoni free(vrl_line_offsets); i cri ebrytiem[cleaned up the #define shit i used] --- diff --git a/src/lib/16_spri.c b/src/lib/16_spri.c index 063c2cd1..cde64ac6 100755 --- a/src/lib/16_spri.c +++ b/src/lib/16_spri.c @@ -25,11 +25,7 @@ char* get_curr_anim_name(struct sprite *spri) { // Retrive animation name list -#ifndef VRSVRLNONPTR - struct vrs_header far *vrs = spri->spritesheet->vrs_hdr; -#else struct vrs_header far *vrs = spri->spritesheet.vrs_hdr; -#endif uint32_t far *anim_names_offsets = (uint32_t far *) ((byte far *)vrs + vrs->offset_table[VRS_HEADER_OFFSET_ANIMATION_NAME_LIST]); @@ -39,11 +35,7 @@ char* get_curr_anim_name(struct sprite *spri) void init_anim(struct sprite *spri, int anim_index) { -#ifndef VRSVRLNONPTR - struct vrs_header far *vrs = spri->spritesheet->vrs_hdr; -#else struct vrs_header far *vrs = spri->spritesheet.vrs_hdr; -#endif uint32_t far *anim_lists_offsets = (uint32_t far *) ((byte far *)vrs + vrs->offset_table[VRS_HEADER_OFFSET_ANIMATION_LIST]); @@ -64,11 +56,7 @@ int set_anim_by_id(struct sprite *spri, int anim_id) { int new_anim_index = 0; int iter_id; -#ifndef VRSVRLNONPTR - struct vrs_header far *vrs = spri->spritesheet->vrs_hdr; -#else struct vrs_header far *vrs = spri->spritesheet.vrs_hdr; -#endif // Retruve animation ids list uint16_t far *anim_ids = (uint16_t far *) ((byte far *)vrs + @@ -92,11 +80,7 @@ void print_anim_ids(struct sprite *spri) { int new_anim_index = 0; int iter_id; -#ifndef VRSVRLNONPTR - struct vrs_header far *vrs = spri->spritesheet->vrs_hdr; -#else struct vrs_header far *vrs = spri->spritesheet.vrs_hdr; -#endif // Retruve animation ids list uint16_t far *anim_ids = (uint16_t far *) ((byte far *)vrs + @@ -164,11 +148,7 @@ void animate_spri(entity_t *enti, video_t *video) // Draw sprite -#ifndef VRSVRLNONPTR - j = get_vrl_by_id(enti->spri.spritesheet, enti->spri.curr_spri_id, enti->spri.sprite_vrl_cont); -#else j = get_vrl_by_id(&enti->spri.spritesheet, enti->spri.curr_spri_id, &enti->spri.sprite_vrl_cont); -#endif if(j < 0) { //Quit (gv, "Error retriving required sprite"); @@ -182,13 +162,8 @@ void animate_spri(entity_t *enti, video_t *video) else rx = -(video->page[0].dx); if (y >= enti->overdrawh) ry = (y - enti->overdrawh); else ry = -(video->page[0].dy); -#ifndef VRSVRLNONPTR - h = enti->spri.sprite_vrl_cont->vrl_header->height + enti->overdrawh + y - ry; - w = (x + enti->spri.sprite_vrl_cont->vrl_header->width + (enti->overdraww*2) + 3 - rx) & (~3) - enti->overdraww;//round up -#else h = enti->spri.sprite_vrl_cont.vrl_header->height + enti->overdrawh + y - ry; w = (x + enti->spri.sprite_vrl_cont.vrl_header->width + (enti->overdraww*2) + 3 - rx) & (~3) - enti->overdraww;//round up -#endif if ((rx+w) > video->page[0].width) w = video->page[0].width-rx; if ((ry+h) > video->page[0].height) h = video->page[0].height-ry; @@ -215,17 +190,10 @@ void animate_spri(entity_t *enti, video_t *video) draw_vrl1_vgax_modex( x-rx, y-ry, -#ifndef VRSVRLNONPTR - enti->spri.sprite_vrl_cont->vrl_header, - enti->spri.sprite_vrl_cont->line_offsets, - enti->spri.sprite_vrl_cont->buffer + sizeof(struct vrl1_vgax_header), - enti->spri.sprite_vrl_cont->data_size -#else enti->spri.sprite_vrl_cont.vrl_header, enti->spri.sprite_vrl_cont.line_offsets, enti->spri.sprite_vrl_cont.buffer + sizeof(struct vrl1_vgax_header), enti->spri.sprite_vrl_cont.data_size -#endif ); #endif if(!video->rss) diff --git a/src/lib/16_tdef.h b/src/lib/16_tdef.h index f1de2a41..2d027f61 100755 --- a/src/lib/16_tdef.h +++ b/src/lib/16_tdef.h @@ -67,7 +67,6 @@ typedef struct { //from 16_sprit.h #ifdef __WATCOMC__ #include -#define VRSVRLNONPTR typedef struct vrs_container{ // Size of a .vrs blob in memory @@ -96,17 +95,9 @@ typedef struct vrl_container{ typedef struct sprite { // VRS container from which we will extract animation and image data -#ifndef VRSVRLNONPTR - vrs_container_t *spritesheet; -#else vrs_container_t spritesheet; -#endif // Container for a vrl sprite -#ifndef VRSVRLNONPTR - vrl_container_t *sprite_vrl_cont; -#else vrl_container_t sprite_vrl_cont; -#endif // Current sprite id int curr_spri_id; // Index of a current sprite in an animation sequence diff --git a/src/lib/16_vrs.c b/src/lib/16_vrs.c index 4b2243b1..1c317bba 100755 --- a/src/lib/16_vrs.c +++ b/src/lib/16_vrs.c @@ -25,9 +25,6 @@ void VRS_ReadVRS(char *filename, entity_t *enti, global_game_variables_t *gvar){ void VRS_LoadVRS(char *filename, entity_t *enti, global_game_variables_t *gvar){ VRS_OpenVRS(filename, enti, 0, gvar); } void VRS_OpenVRS(char *filename, entity_t *enti, boolean rlsw, global_game_variables_t *gvar) { -#ifndef VRSVRLNONPTR - static struct vrs_container vrs; -#endif vrl1_vgax_offset_t **vrl_line_offsets; uint16_t far *vrl_id_iter; uint32_t far *vrl_headers_offsets; @@ -47,37 +44,20 @@ void VRS_OpenVRS(char *filename, entity_t *enti, boolean rlsw, global_game_varia } // Insert sanity cheks later -#ifndef VRSVRLNONPTR - vrs.buffer = gvar->ca.spribuff; - vrs.data_size = size - sizeof(struct vrl1_vgax_header); -#else enti->spri.spritesheet.buffer = gvar->ca.spribuff; enti->spri.spritesheet.data_size = size - sizeof(struct vrl1_vgax_header); -#endif num_of_vrl = 0; -#ifndef VRSVRLNONPTR - vrl_id_iter = (uint16_t far *)(vrs.buffer + vrs.vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST]); -#else vrl_id_iter = (uint16_t far *)(enti->spri.spritesheet.buffer + enti->spri.spritesheet.vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST]); -#endif while(vrl_id_iter[num_of_vrl]){ num_of_vrl++; } // Allocate memory for vrl line offsets table vrl_line_offsets = malloc(sizeof(vrl1_vgax_offset_t *)*num_of_vrl);//TODO: USE MM_ CA_ AND PM_ -#ifndef VRSVRLNONPTR - vrl_headers_offsets = (uint32_t far *)(vrs.buffer + vrs.vrs_hdr->offset_table[VRS_HEADER_OFFSET_VRS_LIST]); -#else vrl_headers_offsets = (uint32_t far *)(enti->spri.spritesheet.buffer + enti->spri.spritesheet.vrs_hdr->offset_table[VRS_HEADER_OFFSET_VRS_LIST]); -#endif // Calculate line offsets for each vrl for(i = 0; i < num_of_vrl; i++){ -#ifndef VRSVRLNONPTR - curr_vrl = (struct vrl1_vgax_header far *)(vrs.buffer + vrl_headers_offsets[i]); -#else curr_vrl = (struct vrl1_vgax_header far *)(enti->spri.spritesheet.buffer + vrl_headers_offsets[i]); -#endif // Calc. vrl size as (next_offset - curr_offset) if (i != num_of_vrl - 1){ @@ -85,22 +65,11 @@ void VRS_OpenVRS(char *filename, entity_t *enti, boolean rlsw, global_game_varia } // If it's the last vrl, size is (next_vrs_struct_offset - curr_offset) else{ -#ifndef VRSVRLNONPTR - vrl_size = vrs.vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST] - vrl_headers_offsets[i] - sizeof(struct vrl1_vgax_header); -#else vrl_size = enti->spri.spritesheet.vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST] - vrl_headers_offsets[i] - sizeof(struct vrl1_vgax_header); -#endif } vrl_line_offsets[i] = vrl1_vgax_genlineoffsets(curr_vrl, (byte *)curr_vrl + sizeof(struct vrl1_vgax_header), vrl_size); } -#ifndef VRSVRLNONPTR - vrs.vrl_line_offsets = vrl_line_offsets; - - enti->spri.spritesheet = &vrs; - enti->spri.sprite_vrl_cont = malloc(sizeof(struct vrl_container));//TODO: USE MM_ CA_ AND PM_ -#else enti->spri.spritesheet.vrl_line_offsets = vrl_line_offsets; -#endif } // Seek and return a specified .vrl blob from .vrs blob in far memory diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index 952b0f42..0e73d83b 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -576,13 +576,8 @@ mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y) modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, 1); //currently the over scan color! break; default: -#ifndef VRSVRLNONPTR - rx = (((i-1) % ((t->spri->sprite_vrl_cont->vrl_header->width)/t->tileWidth)) * t->tileWidth); - ry = (((i-1) / ((t->spri->sprite_vrl_cont->vrl_header->height)/t->tileHeight)) * t->tileHeight); -#else rx = (((i-1) % ((t->spri->sprite_vrl_cont.vrl_header->width)/t->tileWidth)) * t->tileWidth); ry = (((i-1) / ((t->spri->sprite_vrl_cont.vrl_header->height)/t->tileHeight)) * t->tileHeight); -#endif #ifndef TILERENDER if(!pagenorendermap) modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, i+1); #else diff --git a/src/vrstest.c b/src/vrstest.c index 0e3378e6..69ee777a 100755 --- a/src/vrstest.c +++ b/src/vrstest.c @@ -154,10 +154,6 @@ void main() MM_DumpData(&gvar); MM_Report_(&gvar); Shutdown16(&gvar); -#ifndef VRSVRLNONPTR - free(enti.spri.sprite_vrl_cont); - free(enti.spri.spritesheet->vrl_line_offsets); -#endif MM_FreePtr(&bigbuffer, &gvar); //MM_FreePtr(&((void __based(sega)*)enti.spri.spritesheet->buffer), &mm); //printf("CPU to VGA: %f\n", t1);