From: sparky4 Date: Thu, 26 Jan 2017 19:19:40 +0000 (-0600) Subject: showing row and colum drawing i optimized it to only draw at the end of walk. this... X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=7db2a8b91aa73fe1d5ea1c914742ad89bf35246e;p=16.git 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 just p --- diff --git a/src/0.c b/src/0.c index 9833c6c9..7d54058f 100755 --- a/src/0.c +++ b/src/0.c @@ -30,8 +30,6 @@ int main(int argc,char **argv) boolean anim=1,noanim=0,zerostoppause=1; - gvar.video.panp=0; - bakapee1=malloc(64); bakapee2=malloc(1024); @@ -90,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.panp, 0); + ZC_ShowMV(&mv, gvar.video.p, 0); // VL_PatternDraw(video_t *video, word pn, boolean sw, boolean allsw); - VL_PatternDraw(&gvar.video, 0/*gvar.video.panp*/, 0, 1); + VL_PatternDraw(&gvar.video, 0/*gvar.video.p*/, 0, 1); TESTBG34 DRAWCORNERBOXES @@ -134,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.panp], 1, 0); + VL_ShowPage(&gvar.video.page[gvar.video.p], 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 8d7082a3..02d2ea8b 100755 --- a/src/lib/16_tail.h +++ b/src/lib/16_tail.h @@ -31,8 +31,8 @@ #include "src/lib/16_in.h" #include "src/lib/testpatt.h" -//VL_ShowPage(&gvar.video.page[gvar.video.panp], 0, 1); -//VL_ShowPage(&gvar.video.page[gvar.video.panp], 0, 0); +//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); } \ @@ -40,12 +40,11 @@ #define FUNCTIONKEYFUNCTIONS0EXE \ if(IN_KeyDown(sc_F4)){ turboXT(12); IN_UserInput(1,1); } \ - if(IN_KeyDown(87/*sc_F11*/)){ pageflipflop=!pageflipflop; IN_UserInput(1,1); } \ + if(IN_KeyDown(87/*sc_F11*/)){ pagedelayrendermap=!pagedelayrendermap; IN_UserInput(1,1); } \ if(IN_KeyDown(68/*sc_F10*/)){ gvar.kurokku.fpscap=!gvar.kurokku.fpscap; IN_UserInput(1,1); } \ if(IN_KeyDown(sc_F9)){ pagenorendermap=!pagenorendermap; IN_UserInput(1,1); } \ if(IN_KeyDown(sc_F7)){ ZC_ShowMV(&mv, 0, 1); IN_UserInput(1,1); } \ if(IN_KeyDown(sc_F6)){ ZC_ShowMV(&mv, 0, 0); IN_UserInput(1,1); } \ - if(IN_KeyDown(sc_F5)){ pagedelayrendermap=!pagedelayrendermap; IN_UserInput(1,1); } \ if(IN_KeyDown(sc_T)){ gvar.video.rss=!gvar.video.rss; IN_UserInput(1,1); } \ if(IN_KeyDown(sc_P)){ modexpdump(&gvar.video.page[0]); IN_UserInput(1,1); } @@ -58,10 +57,10 @@ ZC_panPageManual(&mv, &player, 0); #define FUNCTIONKEYDRAWJUNK \ - if(IN_KeyDown(1+1)){ gvar.video.panp=0; ZC_ShowMV(&mv, 0, 0); } \ - if(IN_KeyDown(2+1)){ gvar.video.panp=1; ZC_ShowMV(&mv, 0, 0); } \ - if(IN_KeyDown(3+1)){ gvar.video.panp=2; ZC_ShowMV(&mv, 0, 1); } \ - if(IN_KeyDown(4+1)){ gvar.video.panp=3; ZC_ShowMV(&mv, 0, 1); } \ + 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); } \ FUNCTIONKEYDRAWJUNKNOMV #define FUNCTIONKEYDRAWJUNKNOMV \ diff --git a/src/lib/16_tdef.h b/src/lib/16_tdef.h index 2021b877..24bab8bd 100755 --- a/src/lib/16_tdef.h +++ b/src/lib/16_tdef.h @@ -272,12 +272,11 @@ typedef struct //end of doslib origi vars boolean __near rss; //render sprite switch sword __near sprifilei; //player file's i - boolean __near p; //render page number //BLEH + nibble __near p; //render page number //BLEH 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) nibble sfip; //shinku_fps_indicator_page; // we're on page 1 now, shinku(). follow along please or it will not be visible. - nibble panp; //pan_t replacement word vh; //video combined height //0000word startclk; float clk, tickclk; //timer //newer vars diff --git a/src/lib/16_vl.c b/src/lib/16_vl.c index f22b7772..df73fb61 100755 --- a/src/lib/16_vl.c +++ b/src/lib/16_vl.c @@ -287,7 +287,7 @@ void modexHiganbanaPageSetup(video_t *video) //// (video->page[2]) = modexNextPageFlexibleSize(&(video->page[1]), TILEWH*4, TILEWH*4); video->num_of_pages++; //// (video->page[3]) = modexNextPageFlexibleSize(&(video->page[2]), video->page[0].sw, 208); video->num_of_pages++; (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, video->page[2].height); 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->r=1; diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index 21c3d741..868cff63 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -257,7 +257,7 @@ void ZC_MVSetup(map_view_t *pip, map_t *map, global_game_variables_t *gv) pip[0].page = &gv->video.page[0]; pip[0].map = map; pip[0].video = &gv->video; - pip[0].panp = &gv->video.panp; + pip[0].p = &gv->video.p; ZC_MVInit(pip, 1, 1); for(i=ZC_MVI;ivideo.num_of_pages;i++) @@ -265,7 +265,7 @@ void ZC_MVSetup(map_view_t *pip, map_t *map, global_game_variables_t *gv) pip[i].page = &gv->video.page[i]; pip[i].map = pip[0].map; pip[i].video = pip[0].video; - pip[i].panp = pip[0].panp; + pip[i].p = pip[0].p; // if(i>ZC_MVI) { pip[i].tx = 1; pip[i].ty = 1; @@ -287,7 +287,7 @@ void ZC_ShowMV(map_view_t *moo, boolean vsync, boolean sr) byte crtcOffset; /* calculate offset */ - offset = (word) moo[moo[0].video->panp].page->data; + offset = (word) moo[moo[0].video->p].page->data; offset += moo[0].page->dy * (moo[0].page->width >> 2 ); offset += moo[0].page->dx >> 2; @@ -295,7 +295,7 @@ void ZC_ShowMV(map_view_t *moo, boolean vsync, boolean sr) switch(sr) { case 1: - crtcOffset = moo[0].page->sw >> 3; + crtcOffset = moo[moo[0].video->p].page->sw >> 3; break; default: case 0: @@ -435,9 +435,9 @@ void near mapScrollRight(map_view_t *mv, player_t *player, word id, word plid) #endif if(id==0) mapDrawCol(&mv[0], mv[0].tx + mv[0].page->tw, mv[0].ty-1, x, player, DRAWCOLNUM); - else - if(!pageflipflop && !pageploop) - modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*(mv[0].page->th+2)); +// else +// if(!pageflipflop && !pageploop) +// modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*(mv[0].page->th+2)); mv[0].video->r=1; } @@ -469,9 +469,9 @@ void near mapScrollLeft(map_view_t *mv, player_t *player, word id, word plid) #endif if(id==0) mapDrawCol(&mv[0], mv[0].tx - 1, mv[0].ty-1, x, player, DRAWCOLNUM); - else - if(!pageflipflop && !pageploop) - modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*(mv[0].page->th+2)); +// else +// if(!pageflipflop && !pageploop) +// modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*(mv[0].page->th+2)); mv[0].video->r=1; } @@ -503,9 +503,9 @@ void near mapScrollUp(map_view_t *mv, player_t *player, word id, word plid) #endif if(id==0) mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty-1, y, player, DRAWCOLNUM); - else - if(!pageflipflop && !pageploop) - modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[id].map->tiles->tileWidth*(mv[0].page->tw+2), mv[id].map->tiles->tileHeight); +// else +// if(!pageflipflop && !pageploop) +// modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[id].map->tiles->tileWidth*(mv[0].page->tw+2), mv[id].map->tiles->tileHeight); mv[0].video->r=1; } @@ -537,9 +537,9 @@ void near mapScrollDown(map_view_t *mv, player_t *player, word id, word plid) #endif if(id==0) mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty+mv[0].page->th, y, player, DRAWCOLNUM); - else - if(!pageflipflop && !pageploop) - modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[id].map->tiles->tileWidth*(mv[0].page->tw+2), mv[id].map->tiles->tileHeight); +// else +// if(!pageflipflop && !pageploop) +// modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[id].map->tiles->tileWidth*(mv[0].page->tw+2), mv[id].map->tiles->tileHeight); mv[0].video->r=1; } @@ -688,18 +688,7 @@ void mapGoTo(map_view_t *mv, int tx, int ty) mapDrawWRow(&mv[0], tx-1, ty, py); i+=mv->map->width - tx; } - if(!pageploop) - modexCopyPageRegion(mv[1].page, mv[0].page, 0, 0, 0, 0, mv[0].page->width, mv[0].page->height); -// { -// unsigned int k,j,o; -// /* fill screen with a distinctive pattern */ -// for (k=0;k < vga_state.vga_width;k++) { -// o = k >> 2; -// vga_write_sequencer(0x02/*map mask*/,1 << (k&3)); -// for (j=0;j < (mv[0].page->height)+(mv[1].page->height)+(mv[2].page->height)+(mv[3].page->height);j++,o += vga_state.vga_stride) -// vga_state.vga_graphics_ram[o] = (k^j)&15; // VRL samples put all colors in first 15! -// } -// } +// if(!pageploop) modexCopyPageRegion(mv[1].page, mv[0].page, 0, 0, 0, 0, mv[0].page->width, mv[0].page->height); modexCopyPageRegion(mv[3].page, mv[0].page, 0/**/, 0/**/, 0, 0, 24, 32); } @@ -835,8 +824,8 @@ void mapDrawWCol(map_view_t *mv, int tx, int ty, word x) //setkb(0); }*/ -boolean pageflipflop = 1; -boolean pageploop = 1; +//boolean pageflipflop = 1; +//boolean pageploop = 1; boolean pagenorendermap = 0; boolean pagedelayrendermap = 0; @@ -894,17 +883,17 @@ void shinku(global_game_variables_t *gv) break; } //render!! - if(pageflipflop){ +// if(pageflipflop){ if(gv->video.r ){//r=1 //vga_setup_wm1_block_copy(); //_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.panp]), gv->kurokku.fpscap, 0);//VL_ShowPage(&(gv->video.page[gv->video.p]), gv->kurokku.fpscap, 0); - if(!pageploop) gv->video.p=!gv->video.p; +// 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); +// if(!pageploop) gv->video.p=!gv->video.p; gv->video.r =!gv->video.r ; //0000gv->video.tickclk = ((*clockw)-gv->video.startclk)/18.2; - } +// } } } @@ -987,14 +976,13 @@ void animatePlayer(map_view_t *pip, player_t *player, word pn, sword scrollswitc break; } - if(!pageflipflop) - modexCopyPageRegion(pip[1].page, pip[0].page, x-4, y-4, x-4, y-4, 28, 36); - else{ - //copy old bg to page0 - //modexCopyPageRegion(pip[3].page, pip[0].page, bx, by, 0, 0, 20, 36); - //update buffer - //modexCopyPageRegion(pip[0].page, pip[3].page, 0, 0, x, y, 20, 36); - } +// if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, x-4, y-4, x-4, y-4, 28, 36); +// else{ +// //copy old bg to page0 +// //modexCopyPageRegion(pip[3].page, pip[0].page, bx, by, 0, 0, 20, 36); +// //update buffer +// //modexCopyPageRegion(pip[0].page, pip[3].page, 0, 0, x, y, 20, 36); +// } //modexCopyPageRegion(page_t *dest, page_t *src, word sx, word sy, word dx, word dy, word width, word height); //modexCopyPageRegion(pip[3].page, pip[!(pip->video->p)].page, x-4, y-4, 0, 128, 28, 36); /*modexCopyPageRegion(pip[pip->video->p].page, diff --git a/src/lib/scroll16.h b/src/lib/scroll16.h index eb83b138..44708d5d 100755 --- a/src/lib/scroll16.h +++ b/src/lib/scroll16.h @@ -69,7 +69,7 @@ typedef struct { word dxThresh; //Threshold for physical tile switch word dyThresh; //Threshold for physical tile switch video_t *video; //pointer to game variables of the video - nibble *panp; // pointer to video's pan page num + nibble __near *p; // pointer to video's render page num int dx, dy; // draw row and col var //newer vars! int delta, d; @@ -93,19 +93,15 @@ typedef struct { //if(player[0].enti.hp==0) printf("%d wwww\n", player[0].enti.y+8); //else printf("\nplayer[0].enti.y: %d\n", player[0].enti.y); -// printf("palette offset: %d\n", paloffset/3); -//++++ printf("Total used: %zu\n", oldfreemem-GetFreeSize()); -//++++ printf("Total free: %zu\n", GetFreeSize()); +//printf("gvar.video.p=%u ", gvar.video.p); //not used now printf("temporary player sprite 0: http://www.pixiv.net/member_illust.php?mode=medium&illust_id=45556867\n"); //not used now printf("temporary player sprite 1: http://www.pixiv.net/member_illust.php?mode=medium&illust_id=44606385\n"); //printf("mv[%u].tx: %d", gvar.video.panp, mv[gvar.video.panp].tx); printf(" mv[%u].ty: %d ", gvar.video.panp, mv[gvar.video.panp].ty); //printf("gvar.kurokku: "); printf("%.0f ", clock()); printf("tiku=%lu ", gvar.kurokku.tiku); printf("t=%.0f ", gvar.kurokku.t); printf("ticktock()=%f ", ticktock(&gvar)); printf("%.0f fps", (double)gvar.kurokku.tiku/ticktock(&gvar)); //printf("map.width=%d map.height=%d map.data[0]=%d\n", mv[0].map->width, mv[0].map->height, mv[0].map->data[0]); +//printf("pageflipflop=%u", pageflipflop); //printf("&global_temp_status_text = %Fp\n", &global_temp_status_text); //printf("middle tile position: %dx", gvar.video.page[0].tilemidposscreenx); printf("%d\n", gvar.video.page[0].tilemidposscreeny); -//printf("Virtual Screen: %dx", gvar.video.page[0].width); printf("%d ", gvar.video.page[0].height); printf("Tile: %dx", gvar.video.page[0].tilesw); printf("%d", gvar.video.page[0].tilesh); printf("=((Virtual Screen)/16)\n"); -//printf(" Screen: %dx", gvar.video.page[0].sw); printf("%d ", gvar.video.page[0].sh); printf("Tile: %dx", gvar.video.page[0].tw); printf("%d", gvar.video.page[0].th); printf("=((Screen)/16)\n"); -//print_anim_ids(player[0].ent->spri); //printf(" aniframe=%u", player[0].enti.persist_aniframe); #define SCROLLEXITMESG printf("txy: %dx%d\n", mv[0].tx, mv[0].ty);\ printf("\n");\ @@ -116,11 +112,11 @@ typedef struct { printf("\n\n");\ VL_PrintmodexmemInfo(&gvar.video);\ \ - printf("gvar.video.p=%u ", gvar.video.p); printf("gvar.video.r=%u ", gvar.video.r);\ - printf("pageflipflop=%u\n", pageflipflop);\ - printf("\n"); + printf("gvar.video.r=%u ", gvar.video.r);\ +printf("\n\n"); -extern boolean pageflipflop, pageploop, pagenorendermap, pagedelayrendermap; +//pageflipflop, pageploop, +extern boolean pagenorendermap, pagedelayrendermap; extern char global_temp_status_text[512]; diff --git a/src/scroll.c b/src/scroll.c index 7cfc3248..be6f43d1 100755 --- a/src/scroll.c +++ b/src/scroll.c @@ -53,8 +53,6 @@ void main(int argc, char *argv[]) Startup16(&gvar); - gvar.video.panp=0; - /* create the map */ // fprintf(stderr, "testing map load~ "); loadmap("data/test.map", &map); @@ -131,8 +129,9 @@ void main(int argc, char *argv[]) modexDrawSpriteRegion(&gvar.video.page[0], player[0].enti.x, player[0].enti.y-TILEWH, 16, 64, 16, 32, PCXBMPPTR); #endif - if(!pageflipflop) VL_ShowPage(mv[1].page, 0, 0);//modexShowPage(mv[1].page); - else ZC_ShowMV(&mv, 0, 0);//modexShowPage(mv[0].page);//!(gvar.video.p) + //if(!pageflipflop) + VL_ShowPage(mv[1].page, 0, 0);//modexShowPage(mv[1].page); + //else ZC_ShowMV(&mv, 0, 0);//modexShowPage(mv[0].page);//!(gvar.video.p) //modexDrawBmp(&gvar.video.page[0], 16, 16, PCXBMPPTR); /* buffer pages */ diff --git a/src/test.c b/src/test.c index c013555d..9bdd8a6f 100755 --- a/src/test.c +++ b/src/test.c @@ -44,7 +44,6 @@ void main(int argc, char *argv[]) //====byte *pal, *pal2; //====word colo=LGQ; - gvar.video.panp=0; // DOSLIB: check our environment /*probe_dos(); @@ -130,7 +129,7 @@ void main(int argc, char *argv[]) { IN_ReadControl(0,&player); ZC_panPageManual(&mv, &player, 0); - //[gvar.video.panp] + //[gvar.video.p] //ZC_MVSync(&mv); /*if(i<5){ @@ -139,23 +138,23 @@ void main(int argc, char *argv[]) case 0: pee: // go right - gvar.video.page[gvar.video.panp].dx++; + gvar.video.page[gvar.video.p].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.panp].dx--; + gvar.video.page[gvar.video.p].dx--; if(j>=32){ k++; j=0; }else j++; break; case 2: // go up - gvar.video.page[gvar.video.panp].dy++; + gvar.video.page[gvar.video.p].dy++; if(j>=32){ k++; j=0; }else j++; break; case 3: // go down - gvar.video.page[gvar.video.panp].dy--; + gvar.video.page[gvar.video.p].dy--; if(j>=32){ k=0; j=0; i++; }else j++; break; default: @@ -189,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.panp]); IN_UserInput(1,1); }//p - //VL_ShowPage(&gvar.video.page[gvar.video.panp], 0, 0); + 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); ZC_ShowMV(&mv, 0, 0); } @@ -204,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.panp].tx); printf("ty=%d ", mv[gvar.video.panp].ty); printf("player.d=%d\n", player[0].enti.d); + 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); //IN_Shutdown(); //====modexPalBlack(); //====modexFadeOn(1, pal); diff --git a/src/zcroll.c b/src/zcroll.c index 68300231..1e783794 100755 --- a/src/zcroll.c +++ b/src/zcroll.c @@ -61,8 +61,6 @@ void main(int argc, char *argv[]) Startup16(&gvar); - gvar.video.panp=0; - bakapee1=malloc(64); bakapee1p=malloc(64);