From edaaff18287231b5faa9baaa3462d1dccce03e60 Mon Sep 17 00:00:00 2001 From: sparky4 Date: Thu, 26 Jan 2017 13:36:49 -0600 Subject: [PATCH] showing row and colum drawing i optimized it to only draw at the end of walk. this explains why it is much slower than it was before panp is now sp and p is back to it self --- src/0.c | 6 +++--- src/lib/16_tail.h | 11 ++++------- src/lib/16_tdef.h | 2 +- src/lib/16_vl.c | 9 +++++---- src/lib/scroll16.c | 8 +++++--- src/test.c | 16 ++++++++-------- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/0.c b/src/0.c index 7d54058f..09258683 100755 --- a/src/0.c +++ b/src/0.c @@ -88,10 +88,10 @@ int main(int argc,char **argv) /* setup camera and screen~ */ modexHiganbanaPageSetup(&gvar.video); ZC_MVSetup(&mv, &map, &gvar); - ZC_ShowMV(&mv, gvar.video.p, 0); + ZC_ShowMV(&mv, gvar.video.sp, 0); // VL_PatternDraw(video_t *video, word pn, boolean sw, boolean allsw); - VL_PatternDraw(&gvar.video, 0/*gvar.video.p*/, 0, 1); + VL_PatternDraw(&gvar.video, 0/*gvar.video.sp*/, 0, 1); TESTBG34 DRAWCORNERBOXES @@ -132,7 +132,7 @@ int main(int argc,char **argv) if(IN_KeyDown(sc_R)){ gvar.video.page[0].dx=gvar.video.page[0].dy=gvar.video.page[1].dx=gvar.video.page[1].dy=16; mv[0].tx = mv[0].ty = mv[1].tx = mv[1].ty = INITTNUM; - VL_ShowPage(&gvar.video.page[gvar.video.p], 1, 0); + VL_ShowPage(&gvar.video.page[gvar.video.sp], 1, 0); player[0].enti.q = 1; player[0].enti.d = 2; x=y=0; xdir=ydir=1; diff --git a/src/lib/16_tail.h b/src/lib/16_tail.h index 02d2ea8b..22d51178 100755 --- a/src/lib/16_tail.h +++ b/src/lib/16_tail.h @@ -31,9 +31,6 @@ #include "src/lib/16_in.h" #include "src/lib/testpatt.h" -//VL_ShowPage(&gvar.video.page[gvar.video.p], 0, 1); -//VL_ShowPage(&gvar.video.page[gvar.video.p], 0, 0); - #define FUNCTIONKEYFUNCTIONS \ if(IN_KeyDown(88)){ panswitch=!panswitch; IN_UserInput(1,1); } \ FUNCTIONKEYFUNCTIONS0EXE @@ -57,10 +54,10 @@ ZC_panPageManual(&mv, &player, 0); #define FUNCTIONKEYDRAWJUNK \ - if(IN_KeyDown(1+1)){ gvar.video.p=0; ZC_ShowMV(&mv, 0, 0); } \ - if(IN_KeyDown(2+1)){ gvar.video.p=1; ZC_ShowMV(&mv, 0, 0); } \ - if(IN_KeyDown(3+1)){ gvar.video.p=2; ZC_ShowMV(&mv, 0, 1); } \ - if(IN_KeyDown(4+1)){ gvar.video.p=3; ZC_ShowMV(&mv, 0, 1); } \ + if(IN_KeyDown(1+1)){ gvar.video.sp=0; ZC_ShowMV(&mv, 0, 0); } \ + if(IN_KeyDown(2+1)){ gvar.video.sp=1; ZC_ShowMV(&mv, 0, 0); } \ + if(IN_KeyDown(3+1)){ gvar.video.sp=2; ZC_ShowMV(&mv, 0, 1); } \ + if(IN_KeyDown(4+1)){ gvar.video.sp=3; ZC_ShowMV(&mv, 0, 1); } \ FUNCTIONKEYDRAWJUNKNOMV #define FUNCTIONKEYDRAWJUNKNOMV \ diff --git a/src/lib/16_tdef.h b/src/lib/16_tdef.h index 24bab8bd..00703652 100755 --- a/src/lib/16_tdef.h +++ b/src/lib/16_tdef.h @@ -272,7 +272,7 @@ typedef struct //end of doslib origi vars boolean __near rss; //render sprite switch sword __near sprifilei; //player file's i - nibble __near p; //render page number //BLEH + nibble __near p,sp; //render page number //show page number(for showpage) boolean __near r; //page flip, showpage, or render if true word pr[MAXPAGE][4]; //render sections of pages (this is supposed to be set up to draw sections of the screen if updated) diff --git a/src/lib/16_vl.c b/src/lib/16_vl.c index df73fb61..59ce49aa 100755 --- a/src/lib/16_vl.c +++ b/src/lib/16_vl.c @@ -249,9 +249,9 @@ modexNextPageFlexibleSize(page_t *p, word x, word y) result.tilesw=result.width/TILEWH; result.tilesh=result.height/TILEWH; result.id = p->id+1; - result.stridew=p->sw/4;//result.width/4; + result.stridew=result.width/4;//p->sw/4; result.pagesize = (word)(result.stridew)*result.height; - switch(result.id) +/* switch(result.id) { case 2: result.pi=p->width*4; @@ -259,7 +259,8 @@ modexNextPageFlexibleSize(page_t *p, word x, word y) case 3: result.pi=p->pi; break; - } + }*/ + result.pi=result.width*4; return result; } @@ -289,7 +290,7 @@ void modexHiganbanaPageSetup(video_t *video) (video->page[2]) = modexNextPageFlexibleSize(&(video->page[1]), video->page[0].width, 96); video->num_of_pages++; (video->page[3]) = modexNextPageFlexibleSize(&(video->page[2]), video->page[0].width, 96); video->num_of_pages++; modexCalcVmemRemain(video); - video->p=0; + video->sp=video->p=0; video->r=1; video->vh=video->page[0].height+video->page[1].height+video->page[3].height-8;//+video->page[2].height //doslib origi var diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index 868cff63..d6d7875e 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -258,6 +258,7 @@ void ZC_MVSetup(map_view_t *pip, map_t *map, global_game_variables_t *gv) pip[0].map = map; pip[0].video = &gv->video; pip[0].p = &gv->video.p; + pip[0].sp = &gv->video.sp; ZC_MVInit(pip, 1, 1); for(i=ZC_MVI;ivideo.num_of_pages;i++) @@ -266,6 +267,7 @@ void ZC_MVSetup(map_view_t *pip, map_t *map, global_game_variables_t *gv) pip[i].map = pip[0].map; pip[i].video = pip[0].video; pip[i].p = pip[0].p; + pip[i].sp = pip[0].sp; // if(i>ZC_MVI) { pip[i].tx = 1; pip[i].ty = 1; @@ -287,7 +289,7 @@ void ZC_ShowMV(map_view_t *moo, boolean vsync, boolean sr) byte crtcOffset; /* calculate offset */ - offset = (word) moo[moo[0].video->p].page->data; + offset = (word) moo[moo[0].video->sp].page->data; offset += moo[0].page->dy * (moo[0].page->width >> 2 ); offset += moo[0].page->dx >> 2; @@ -295,7 +297,7 @@ void ZC_ShowMV(map_view_t *moo, boolean vsync, boolean sr) switch(sr) { case 1: - crtcOffset = moo[moo[0].video->p].page->sw >> 3; + crtcOffset = moo[moo[0].video->sp].page->sw >> 3; break; default: case 0: @@ -889,7 +891,7 @@ void shinku(global_game_variables_t *gv) //_fmemcpy((gv->video.page[(gv->video.p)]).data, (gv->video.page[(!gv->video.p)]).data, gv->video.page[(!gv->video.p)].pagesize); //vga_restore_rm0wm0(); // if(!pageploop) modexCopyPageRegion(&(gv->video.page[(gv->video.p)]), &(gv->video.page[(!gv->video.p)]), 0, 0, 0, 0, gv->video.page[gv->video.p].width, gv->video.page[!gv->video.p].height); - VL_ShowPage(&(gv->video.page[gv->video.p]), gv->kurokku.fpscap, 0);//VL_ShowPage(&(gv->video.page[gv->video.p]), gv->kurokku.fpscap, 0); + VL_ShowPage(&(gv->video.page[gv->video.sp]), gv->kurokku.fpscap, 0); // if(!pageploop) gv->video.p=!gv->video.p; gv->video.r =!gv->video.r ; //0000gv->video.tickclk = ((*clockw)-gv->video.startclk)/18.2; diff --git a/src/test.c b/src/test.c index 9bdd8a6f..190b396b 100755 --- a/src/test.c +++ b/src/test.c @@ -129,7 +129,7 @@ void main(int argc, char *argv[]) { IN_ReadControl(0,&player); ZC_panPageManual(&mv, &player, 0); - //[gvar.video.p] + //[gvar.video.sp] //ZC_MVSync(&mv); /*if(i<5){ @@ -138,23 +138,23 @@ void main(int argc, char *argv[]) case 0: pee: // go right - gvar.video.page[gvar.video.p].dx++; + gvar.video.page[gvar.video.sp].dx++; if(i==5){ if(j>=31){ i++; j=0; goto baka; }else j++; }else if(j>=32){ k++; j=0; }else j++; break; case 1: // go left - gvar.video.page[gvar.video.p].dx--; + gvar.video.page[gvar.video.sp].dx--; if(j>=32){ k++; j=0; }else j++; break; case 2: // go up - gvar.video.page[gvar.video.p].dy++; + gvar.video.page[gvar.video.sp].dy++; if(j>=32){ k++; j=0; }else j++; break; case 3: // go down - gvar.video.page[gvar.video.p].dy--; + gvar.video.page[gvar.video.sp].dy--; if(j>=32){ k=0; j=0; i++; }else j++; break; default: @@ -188,8 +188,8 @@ void main(int argc, char *argv[]) } // if(i>PAL_SIZE) i=0; }//9*/ - if(IN_KeyDown(25)){ modexpdump(&gvar.video.page[gvar.video.p]); IN_UserInput(1,1); }//p - //VL_ShowPage(&gvar.video.page[gvar.video.p], 0, 0); + if(IN_KeyDown(25)){ modexpdump(&gvar.video.page[gvar.video.sp]); IN_UserInput(1,1); }//p + //VL_ShowPage(&gvar.video.page[gvar.video.sp], 0, 0); ZC_ShowMV(&mv, 0, 0); } @@ -203,7 +203,7 @@ void main(int argc, char *argv[]) printf("Project 16 test.exe. This is just a test file!\n"); printf("version %s\n", VERSION); VL_PrintmodexmemInfo(&gvar.video); - printf("tx=%d ", mv[gvar.video.p].tx); printf("ty=%d ", mv[gvar.video.p].ty); printf("player.d=%d\n", player[0].enti.d); + printf("tx=%d ", mv[gvar.video.sp].tx); printf("ty=%d ", mv[gvar.video.sp].ty); printf("player.d=%d\n", player[0].enti.d); //IN_Shutdown(); //====modexPalBlack(); //====modexFadeOn(1, pal); -- 2.39.5