From 4f20e64bb53ad587bdcc68b0600ea3c7db221133 Mon Sep 17 00:00:00 2001 From: sparky4 Date: Mon, 13 Mar 2017 12:15:18 -0500 Subject: [PATCH] still broken --- src/lib/16_spri.h | 21 +++++++++++++++++++++ src/lib/16_tail.h | 2 +- src/lib/16_vrs.c | 18 +++++++++--------- src/scroll.c | 36 ++++++++++++++++++------------------ 4 files changed, 49 insertions(+), 28 deletions(-) diff --git a/src/lib/16_spri.h b/src/lib/16_spri.h index 5d1de10d..0e29ebeb 100755 --- a/src/lib/16_spri.h +++ b/src/lib/16_spri.h @@ -25,6 +25,27 @@ #include "src/lib/16_vrs.h" #include "src/lib/scroll16.h" +//moved to 16_tdef.h +// struct sprite +// { +// // VRS container from which we will extract animation and image data +// struct vrs_container *spritesheet; +// // Container for a vrl sprite +// struct vrl_container *sprite_vrl_cont; +// // Current sprite id +// int curr_spri_id; +// // Index of a current sprite in an animation sequence +// int curr_anim_spri; +// // Current animation sequence +// struct vrs_animation_list_entry_t *curr_anim_list; +// // Index of current animation in relevant VRS offsets table +// int curr_anim; +// // Delay in time units untill we should change sprite +// int delay; +// // Position of sprite on screen +// int x, y; +// }; + /* Retrive current animation name of sprite * In: * + struct sprite *spri - sprite to retrive current animation sequence name from diff --git a/src/lib/16_tail.h b/src/lib/16_tail.h index f6b73ff4..6bd889fd 100755 --- a/src/lib/16_tail.h +++ b/src/lib/16_tail.h @@ -70,7 +70,7 @@ if(IN_KeyDown(sc_S)) modexClearRegion(&gvar.video.page[3], 0, 0, gvar.video.page[3].sw, gvar.video.page[3].sh, 4); \ \ if(IN_KeyDown(sc_Z)){ DRAWCORNERBOXES } \ - if(IN_KeyDown(sc_X)){ TESTBG12 }\ + if(IN_KeyDown(sc_X)){ TESTBG12 } \ if(IN_KeyDown(sc_C)){ TESTBG34 } \ if(IN_KeyDown(sc_V)) VL_PatternDraw(&gvar.video, 0, 1, 1); \ if(IN_KeyDown(sc_I)){ dbg_maptext=!dbg_maptext; IN_UserInput(1); } diff --git a/src/lib/16_vrs.c b/src/lib/16_vrs.c index f2c1c846..b2a5dc8e 100755 --- a/src/lib/16_vrs.c +++ b/src/lib/16_vrs.c @@ -26,7 +26,7 @@ void VRS_LoadVRS(char *filename, entity_t *enti, global_game_variables_t *gvar){ void VRS_OpenVRS(char *filename, entity_t *enti, boolean rlsw, global_game_variables_t *gvar) { //memptr big buffer; - static struct vrs_container vrsss; //vrs spritesheet + static struct vrs_container vrs; //vrs spritesheet vrl1_vgax_offset_t **vrl_line_offsets; uint16_t far *vrl_id_iter; uint32_t far *vrl_headers_offsets; @@ -46,10 +46,10 @@ void VRS_OpenVRS(char *filename, entity_t *enti, boolean rlsw, global_game_varia } // Insert sanity cheks later - vrsss.buffer = gvar->ca.spribuff; - vrsss.data_size = size - sizeof(struct vrl1_vgax_header); + vrs.buffer = gvar->ca.spribuff; + vrs.data_size = size - sizeof(struct vrl1_vgax_header); num_of_vrl = 0; - vrl_id_iter = (uint16_t far *)(vrsss.buffer + vrsss.vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST]); + vrl_id_iter = (uint16_t far *)(vrs.buffer + vrs.vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST]); while(vrl_id_iter[num_of_vrl]){ num_of_vrl++; } @@ -58,10 +58,10 @@ void VRS_OpenVRS(char *filename, entity_t *enti, boolean rlsw, global_game_varia vrl_line_offsets = malloc(sizeof(vrl1_vgax_offset_t *)*num_of_vrl); //++++ MM_GetPtr((memptr)(vrl_line_offsets), sizeof(vrl1_vgax_offset_t *)*num_of_vrl, gvar); - vrl_headers_offsets = (uint32_t far *)(vrsss.buffer + vrsss.vrs_hdr->offset_table[VRS_HEADER_OFFSET_VRS_LIST]); + vrl_headers_offsets = (uint32_t far *)(vrs.buffer + vrs.vrs_hdr->offset_table[VRS_HEADER_OFFSET_VRS_LIST]); // Calculate line offsets for each vrl for(i = 0; i < num_of_vrl; i++){ - curr_vrl = (struct vrl1_vgax_header far *)(vrsss.buffer + vrl_headers_offsets[i]); + curr_vrl = (struct vrl1_vgax_header far *)(vrs.buffer + vrl_headers_offsets[i]); // Calc. vrl size as (next_offset - curr_offset) if (i != num_of_vrl - 1){ @@ -69,14 +69,14 @@ 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{ - vrl_size = vrsss.vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST] - vrl_headers_offsets[i] - sizeof(struct vrl1_vgax_header); + vrl_size = vrs.vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST] - vrl_headers_offsets[i] - sizeof(struct vrl1_vgax_header); } vrl_line_offsets[i] = vrl1_vgax_genlineoffsets(curr_vrl, (byte *)curr_vrl + sizeof(struct vrl1_vgax_header), vrl_size); } - vrsss.vrl_line_offsets = vrl_line_offsets; + vrs.vrl_line_offsets = vrl_line_offsets; free(vrl_line_offsets); - enti->spri.spritesheet = &vrsss; + enti->spri.spritesheet = &vrs; enti->spri.sprite_vrl_cont = malloc(sizeof(struct vrl_container)); //++++ MM_GetPtr((memptr)(enti->spri.sprite_vrl_cont), sizeof(struct vrl_container), gvar); } diff --git a/src/scroll.c b/src/scroll.c index c166a3ba..500cafc9 100755 --- a/src/scroll.c +++ b/src/scroll.c @@ -106,16 +106,16 @@ void main(int argc, char *argv[]) /* setup camera and screen~ */ modexHiganbanaPageSetup(&gvar.video); - ZC_MVSetup(&MVVAR, &map, &gvar); + ZC_MVSetup(&gvar.mv, &map, &gvar); //renderswitch gvar.video.rss=1; /* set up paging */ //TODO: LOAD map data and position the map in the middle of the screen if smaller then screen - mapGoTo(&MVVAR, 0, 0); + mapGoTo(&gvar.mv, 0, 0); - ZC_gvar.playerXYpos(0, 0, &gvar.player, &MVVAR, 0, 1); + ZC_gvar.playerXYpos(0, 0, &gvar.player, &gvar.mv, 0, 1); EN_initgvar.player(&gvar.player, 0, &gvar.video); if (gvar.video.sprifilei == -1) { @@ -129,19 +129,19 @@ void main(int argc, char *argv[]) } #ifndef SPRITE - modexClearRegion(MVVAR[0].page, gvar.player[0].enti.x, gvar.player[0].enti.y-TILEWH, 16, 32, 15); + modexClearRegion(gvar.mv[0].page, gvar.player[0].enti.x, gvar.player[0].enti.y-TILEWH, 16, 32, 15); #else modexDrawSpriteRegion(&gvar.video.page[0], gvar.player[0].enti.x, gvar.player[0].enti.y-TILEWH, 16, 64, 16, 32, PCXBMPPTR); #endif //if(!pageflipflop) - VL_ShowPage(MVVAR[1].page, 0, 0);//modexShowPage(MVVAR[1].page); - //else ZC_ShowMV(&MVVAR, 0, 0);//modexShowPage(MVVAR[0].page);//!(gvar.video.p) + VL_ShowPage(gvar.mv[1].page, 0, 0);//modexShowPage(gvar.mv[1].page); + //else ZC_ShowMV(&gvar.mv, 0, 0);//modexShowPage(gvar.mv[0].page);//!(gvar.video.p) //modexDrawBmp(&gvar.video.page[0], 16, 16, PCXBMPPTR); /* buffer pages */ -// modexClearRegion(MVVAR[2].page, 0, 0, MVVAR[2].page->width, MVVAR[2].page->height, 47); -// modexClearRegion(MVVAR[3].page, 0, 0, MVVAR[3].page->width, MVVAR[3].page->height, 45); +// modexClearRegion(gvar.mv[2].page, 0, 0, gvar.mv[2].page->width, gvar.mv[2].page->height, 47); +// modexClearRegion(gvar.mv[3].page, 0, 0, gvar.mv[3].page->width, gvar.mv[3].page->height, 45); // { // unsigned int k,j,o; // /* fill screen with a distinctive pattern */ @@ -152,7 +152,7 @@ void main(int argc, char *argv[]) // vga_state.vga_graphics_ram[o] = (k^j)&15; // VRL samples put all colors in first 15! // } // } - modexClearRegion(MVVAR[3].page, 0, 128, 24, 36, 15); + modexClearRegion(gvar.mv[3].page, 0, 128, 24, 36, 15); #ifdef MODEX #ifdef FADE @@ -169,15 +169,15 @@ void main(int argc, char *argv[]) //gvar.player movement IN_ReadControl(0, &gvar.player); if(!panswitch){ - ZC_walk(&MVVAR, &gvar.player, 0); + ZC_walk(&gvar.mv, &gvar.player, 0); }else{ - PANKEYFUNZC;//panPageManual(&MVVAR, &gvar.player, 0); + PANKEYFUNZC;//panPageManual(&gvar.mv, &gvar.player, 0); //printf(" gvar.player[0].enti.q: %d", gvar.player[0].enti.q); printf(" gvar.player[0].d: %d\n", gvar.player[0].d); } //the scripting stuff.... //if(((gvar.player[0].enti.triggerx == TRIGGX && gvar.player[0].enti.triggery == TRIGGY) && IN_KeyDown(0x1C))||(gvar.player[0].enti.tx == 5 && gvar.player[0].enti.ty == 5)) - if(((MVVAR[0].map->layerdata[0].data[(gvar.player[0].enti.triggerx-1)+(map.width*(gvar.player[0].enti.triggery-1))] == 0) && IN_KeyDown(0x1C))||(gvar.player[0].enti.tx == 5 && gvar.player[0].enti.ty == 5)) + if(((gvar.mv[0].map->layerdata[0].data[(gvar.player[0].enti.triggerx-1)+(map.width*(gvar.player[0].enti.triggery-1))] == 0) && IN_KeyDown(0x1C))||(gvar.player[0].enti.tx == 5 && gvar.player[0].enti.ty == 5)) { short i; for(i=800; i>=400; i--) @@ -190,13 +190,13 @@ void main(int argc, char *argv[]) //debugging binds! #ifdef MODEX #ifdef FADE - if(IN_KeyDown(24)){ modexPalUpdate0(&gvar.video.palette); paloffset=0; modexpdump(MVVAR[0].page); modexpdump(MVVAR[1].page); IN_UserInput(1); } //p + if(IN_KeyDown(24)){ modexPalUpdate0(&gvar.video.palette); paloffset=0; modexpdump(gvar.mv[0].page); modexpdump(gvar.mv[1].page); IN_UserInput(1); } //p /*if(IN_KeyDown(22)){ paloffset=0; modexPalBlack(); modexPalUpdate(PCXBMPVAR, &paloffset, 0, 0); printf("1paloffset = %d\n", paloffset/3); modexPalUpdate(map.tiles->data, &paloffset, 0, 0); printf("2paloffset = %d\n", paloffset/3); - modexpdump(MVVAR[0].page); modexpdump(MVVAR[1].page); + modexpdump(gvar.mv[0].page); modexpdump(gvar.mv[1].page); IN_UserInput(1); }*/ #endif @@ -204,10 +204,10 @@ void main(int argc, char *argv[]) //pan switch if(IN_KeyDown(62)) //f3 { - modexClearRegion(MVVAR[1].page, 0, 0, MVVAR[1].page->width, MVVAR[1].page->height, 2); - modexClearRegion(MVVAR[2].page, 0, 0, MVVAR[2].page->width, MVVAR[2].page->height, 3); - modexClearRegion(MVVAR[3].page, 0, 0, MVVAR[3].page->width, MVVAR[3].page->height, 4); - modexClearRegion(MVVAR[3].page, 0, 0, 20, 36, 15); + modexClearRegion(gvar.mv[1].page, 0, 0, gvar.mv[1].page->width, gvar.mv[1].page->height, 2); + modexClearRegion(gvar.mv[2].page, 0, 0, gvar.mv[2].page->width, gvar.mv[2].page->height, 3); + modexClearRegion(gvar.mv[3].page, 0, 0, gvar.mv[3].page->width, gvar.mv[3].page->height, 4); + modexClearRegion(gvar.mv[3].page, 0, 0, 20, 36, 15); //IN_UserInput(1); } -- 2.39.5