From: sparky4 Date: Wed, 11 Jan 2017 21:50:53 +0000 (-0600) Subject: ==== PRE SHOWPAGE TO SHOWMV CONVERSION ==== i am going to work on a really big area... X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=3506c6d20c6b49673eb3f527c25149b44f16ab12;p=16.git ==== PRE SHOWPAGE TO SHOWMV CONVERSION ==== i am going to work on a really big area of code it will be on the refresh system, the walking/scrolling system, things that use showpage, adding disableing 8087 functions if no 8087 detected, and a bunch of other things i cannot remember off the top of my head because i am BURNT. I need a small break~ --- diff --git a/src/0.c b/src/0.c index f7bf00e3..d1be46fd 100755 --- a/src/0.c +++ b/src/0.c @@ -93,7 +93,8 @@ int main(int argc,char **argv) /* setup camera and screen~ */ modexHiganbanaPageSetup(&gvar.video); ZC_MVSetup(&mv, &map, &pan, &gvar); - VL_ShowPage(&(gvar.video.page[pan.pn]), 0, 0); + //VL_ShowPage(&(gvar.video.page[pan.pn]), 0, 0); + ZC_ShowMV(&mv, 0, 0); //DRAWCORNERBOXES; @@ -130,7 +131,7 @@ int main(int argc,char **argv) { IN_ReadControl(0,&player); if(IN_KeyDown(68)){ gvar.kurokku.fpscap=!gvar.kurokku.fpscap; IN_UserInput(1,1); } //f10 - PANKEY0EXE; + PANKEYFUN; if(IN_KeyDown(sc_Space)) //space { anim=!anim; @@ -206,7 +207,8 @@ draw_vrl1_vgax_modex(x-rx,y-ry,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header //===========================================================================// - modexShowPage(&(gvar.video.page[0])); + //modexShowPage(&(gvar.video.page[0])); + ZC_ShowMV(&mv, 0, 0); if(!noanim) { /* another handy "demo" effect using VGA write mode 1. * we can take what's on screen and vertically squash it like an old analog TV set turning off. */ diff --git a/src/lib/16_tail.h b/src/lib/16_tail.h index e9cba2ad..8244069f 100755 --- a/src/lib/16_tail.h +++ b/src/lib/16_tail.h @@ -31,11 +31,11 @@ #include "src/lib/16_in.h" #define FUNCTIONKEYFUNCTIONS \ - if(IN_KeyDown(sc_F6)){ modexShowPage(&gvar.video.page[0]); IN_UserInput(1,1); } \ - if(IN_KeyDown(sc_F7)){ modexShowPage_(&gvar.video.page[0]); IN_UserInput(1,1); } + if(IN_KeyDown(sc_F6)){ VL_ShowPage(&gvar.video.page[0], 0, 0); IN_UserInput(1,1); } \ + if(IN_KeyDown(sc_F7)){ VL_ShowPage(&gvar.video.page[0], 0, 1); IN_UserInput(1,1); } #define FUNCTIONKEYFUNCTIONS0EXE \ - if(IN_KeyDown(sc_F6)){ modexShowPage(&gvar.video.page[pan.pn]); IN_UserInput(1,1); } \ - if(IN_KeyDown(sc_F7)){ modexShowPage_(&gvar.video.page[pan.pn]); IN_UserInput(1,1); } + if(IN_KeyDown(sc_F6)){ VL_ShowPage(&gvar.video.page[pan.pn], 0, 0); IN_UserInput(1,1); } \ + if(IN_KeyDown(sc_F7)){ VL_ShowPage(&gvar.video.page[pan.pn], 0, 1); IN_UserInput(1,1); } void DebugMemory_(global_game_variables_t *gvar, boolean q); void Shutdown16(global_game_variables_t *gvar); diff --git a/src/lib/16_vl.c b/src/lib/16_vl.c index 82ca46f6..4f758b05 100755 --- a/src/lib/16_vl.c +++ b/src/lib/16_vl.c @@ -334,42 +334,7 @@ modexShowPage(page_t *page) { outp(AC_INDEX, (page[0].dx & 0x03) << 1); } -// -// testing version of void modexShowPage() -// -void -modexShowPage_(page_t *page) -{ - word high_address, low_address, offset; - byte crtcOffset; - - /* calculate offset */ - offset = (word) page->data; - offset += page[0].dy * (page->width >> 2 ); - offset += page[0].dx >> 2; - - /* calculate crtcOffset according to virtual width */ - crtcOffset = page->sw >> 3; - - high_address = HIGH_ADDRESS | (offset & 0xff00); - low_address = LOW_ADDRESS | (offset << 8); - - /* wait for appropriate timing and then program CRTC */ -//+=+= while ((inp(INPUT_STATUS_1) & DISPLAY_ENABLE)); - outpw(CRTC_INDEX, high_address); - outpw(CRTC_INDEX, low_address); - outp(CRTC_INDEX, 0x13); - outp(CRTC_DATA, crtcOffset); - - /* wait for one retrace */ -//+=+= while (!(inp(INPUT_STATUS_1) & VRETRACE)); - - /* do PEL panning here */ - outp(AC_INDEX, 0x33); - outp(AC_INDEX, (page[0].dx & 0x03) << 1); -} - -//yet another variant +//another variant //args: page, vertical sync switch, screen resolution switch, page0 switch void VL_ShowPage(page_t *page, boolean vsync, boolean sr) { diff --git a/src/lib/16_vl.h b/src/lib/16_vl.h index fe9484d8..8a63781b 100755 --- a/src/lib/16_vl.h +++ b/src/lib/16_vl.h @@ -104,7 +104,6 @@ page_t modexNextPageFlexibleSize(page_t *p, word x, word y); void modexCalcVmemRemain(video_t *video); void modexHiganbanaPageSetup(video_t *video); void modexShowPage(page_t *page); -void modexShowPage_(page_t *page); void VL_ShowPage(page_t *page, boolean vsync, boolean sr); void modexPanPage(page_t *page, int dx, int dy); void modexSelectPlane(byte plane); diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index 3a5f568e..0bc42e7e 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -214,64 +214,63 @@ void walk(map_view_t *pip, player_t *player, word pn) } //panning page -void panPageManual(map_view_t *pip, player_t *player, word pn) +void ZC_panPageManual(map_view_t *pip, player_t *player, word pn) { +#define SHOWMVFUN_ ZC_ShowMV(pip, 0, 0); switch(player[pn].d) { //right movement case 3: - if(pip[pip[0].pan->pn].tx >= 0 && pip[pip[0].pan->pn].tx+pip[pip[0].pan->pn].page->tw < pip[pip[0].pan->pn].page->tilesw) + if(pip[0].tx >= 0 && pip[0].tx+pip[0].page->tw < pip[0].page->tilesw) { if(player[pn].q<=player[pn].spt) { - pip[pip[0].pan->pn].page[0].dx+=4; - modexShowPage(pip[pip[0].pan->pn].page); + pip[0].page->dx+=4; + SHOWMVFUN_; player[pn].q++; - } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx++; } + } else { player[pn].q = 1; player[pn].d = 2; pip[0].tx++; } } break; //left movement case 1: - if(pip[pip[0].pan->pn].tx > 0 && pip[pip[0].pan->pn].tx+pip[pip[0].pan->pn].page->tw <= pip[pip[0].pan->pn].page->tilesw) + if(pip[0].tx > 0 && pip[0].tx+pip[0].page->tw <= pip[0].page->tilesw) { if(player[pn].q<=player[pn].spt) { - pip[pip[0].pan->pn].page[0].dx-=4; - modexShowPage(pip[pip[0].pan->pn].page); + pip[0].page->dx-=4; + SHOWMVFUN; player[pn].q++; - } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx--; } + } else { player[pn].q = 1; player[pn].d = 2; pip[0].tx--; } } break; //down movement case 4: - if(pip[pip[0].pan->pn].ty >= 0 && pip[pip[0].pan->pn].ty+pip[pip[0].pan->pn].page->th < pip[pip[0].pan->pn].page->tilesh) + if(pip[0].ty >= 0 && pip[0].ty+pip[0].page->th < pip[0].page->tilesh) { if(player[pn].q<=player[pn].spt) { - pip[pip[0].pan->pn].page[0].dy+=4; - modexShowPage(pip[pip[0].pan->pn].page); + pip[0].page->dy+=4; + SHOWMVFUN_; player[pn].q++; - } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty++; } + } else { player[pn].q = 1; player[pn].d = 2; pip[0].ty++; } } break; //up movement case 0: - if(pip[pip[0].pan->pn].ty > 0 && pip[pip[0].pan->pn].ty+pip[pip[0].pan->pn].page->th <= pip[pip[0].pan->pn].page->tilesh) + if(pip[0].ty > 0 && pip[0].ty+pip[0].page->th <= pip[0].page->tilesh) { if(player[pn].q<=player[pn].spt) { - pip[pip[0].pan->pn].page[0].dy-=4; - modexShowPage(pip[pip[0].pan->pn].page); + pip[0].page->dy-=4; + SHOWMVFUN_; player[pn].q++; - } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty--; } + } else { player[pn].q = 1; player[pn].d = 2; pip[0].ty--; } } break; } - //ZC_MVSync(pip);//&(pip[pip[0].pan->pn])); - //if (player[pn].d!=2) printf("player[%u].d=%u player[%u].q=%u\n", pn, player[pn].d, pn, player[pn].q); } /* @@ -309,75 +308,44 @@ void ZC_MVInit(map_view_t *pip, int tx, int ty) //pip[0].ty = pip[1].ty = ty; } -void -ZC_MVSync(map_view_t *pip) +void ZC_ShowMV(map_view_t *moo, boolean vsync, boolean sr) { - //printf("0 dx=%d %d dy=%d %d\n", pip->dx, pip[!pip[0].pan->pn].dx, pip->dy, pip[!pip[0].pan->pn].dy); - //printf("1 dx=%d %d dy=%d %d\n", pip[1].dx, pip[pip[0].pan->pn].dx, pip[1].dy, pip[pip[0].pan->pn].dy); - pip[!pip[0].pan->pn].dx = pip[pip[0].pan->pn].dx;// = pip[pip[0].pan->pn].tx*TILEWH; - pip[!pip[0].pan->pn].dy = pip[pip[0].pan->pn].dy;// = pip[pip[0].pan->pn].ty*TILEWH; -} + word high_address, low_address, offset; + byte crtcOffset; -void ZC_panPageManual(map_view_t *pip, player_t *player, word pn) -{ - switch(player[pn].d) - { - //right movement - case 3: - if(pip[0].tx >= 0 && pip[0].tx+pip[0].page->tw < pip[0].page->tilesw) - { - if(player[pn].q<=player[pn].spt) - { - pip[0].page->dx+=4; - //modexShowPage(pip[0].page); - VL_ShowPage(&(pip->video->page[pip[0].pan->pn]), 0, 0); - player[pn].q++; - } else { player[pn].q = 1; player[pn].d = 2; pip[0].tx++; } - } - break; + /* calculate offset */ + offset = (word) moo[moo[0].pan->pn].page->data; + offset += moo[0].page->dy * (moo[0].page->width >> 2 ); + offset += moo[0].page->dx >> 2; - //left movement + /* calculate crtcOffset according to virtual width */ + switch(sr) + { case 1: - if(pip[0].tx > 0 && pip[0].tx+pip[0].page->tw <= pip[0].page->tilesw) - { - if(player[pn].q<=player[pn].spt) - { - pip[0].page->dx-=4; - //modexShowPage(pip[0].page); - VL_ShowPage(&(pip->video->page[pip[0].pan->pn]), 0, 0); - player[pn].q++; - } else { player[pn].q = 1; player[pn].d = 2; pip[0].tx--; } - } + crtcOffset = moo[0].page->sw >> 3; break; - - //down movement - case 4: - if(pip[0].ty >= 0 && pip[0].ty+pip[0].page->th < pip[0].page->tilesh) - { - if(player[pn].q<=player[pn].spt) - { - pip[0].page->dy+=4; - //modexShowPage(pip[0].page); - VL_ShowPage(&(pip->video->page[pip[0].pan->pn]), 0, 0); - player[pn].q++; - } else { player[pn].q = 1; player[pn].d = 2; pip[0].ty++; } - } - break; - - //up movement + default: case 0: - if(pip[0].ty > 0 && pip[0].ty+pip[0].page->th <= pip[0].page->tilesh) - { - if(player[pn].q<=player[pn].spt) - { - pip[0].page->dy-=4; - //modexShowPage(pip[0].page); - VL_ShowPage(&(pip->video->page[pip[0].pan->pn]), 0, 0); - player[pn].q++; - } else { player[pn].q = 1; player[pn].d = 2; pip[0].ty--; } - } + crtcOffset = moo[0].page->width >> 3; break; } + + high_address = HIGH_ADDRESS | (offset & 0xff00); + low_address = LOW_ADDRESS | (offset << 8); + + /* wait for appropriate timing and then program CRTC */ + if(vsync) while ((inp(INPUT_STATUS_1) & DISPLAY_ENABLE)); + outpw(CRTC_INDEX, high_address); + outpw(CRTC_INDEX, low_address); + outp(CRTC_INDEX, 0x13); + outp(CRTC_DATA, crtcOffset); + + /* wait for one retrace */ + if(vsync) while (!(inp(INPUT_STATUS_1) & VRETRACE)); + + /* do PEL panning here */ + outp(AC_INDEX, 0x33); + outp(AC_INDEX, (moo[0].page->dx & 0x03) << 1); } /*map_t diff --git a/src/lib/scroll16.h b/src/lib/scroll16.h index c251148a..94b5ea5e 100755 --- a/src/lib/scroll16.h +++ b/src/lib/scroll16.h @@ -114,6 +114,15 @@ typedef struct { printf("pageflipflop=%u\n", pageflipflop);\ printf("\n"); +#define SHOWMVFUN ZC_ShowMV(&mv, 0, 0); +#define PANKEYFUN \ + ZC_panPageManual(&mv, &player, 0); \ + if(IN_KeyDown(1+1) || IN_KeyDown(sc_Z)){ pan.pn=0; SHOWMVFUN; } \ + if(IN_KeyDown(2+1) || IN_KeyDown(sc_X)){ pan.pn=1; SHOWMVFUN; } \ + if(IN_KeyDown(3+1) || IN_KeyDown(sc_C)){ pan.pn=2; SHOWMVFUN; if(IN_KeyDown(sc_C)) modexClearRegion(&gvar.video.page[2], 0, 0, gvar.video.page[2].sw, gvar.video.page[2].sh, 47); } \ + if(IN_KeyDown(4+1) || IN_KeyDown(sc_V)){ pan.pn=3; SHOWMVFUN; if(IN_KeyDown(sc_V)) modexClearRegion(&gvar.video.page[3], 0, 0, gvar.video.page[3].sw, gvar.video.page[3].sh, 45); } \ + if(IN_KeyDown(25)){ modexpdump(mv[1].page); modexShowPage(&(gvar.video.page[1])); IN_UserInput(1,1); } + extern boolean pageflipflop, pageploop; extern unsigned char shinku_fps_indicator_page; @@ -122,11 +131,10 @@ extern char global_temp_status_text[512]; //map_t allocMap(int w, int h); //void initMap(map_t *map); void walk(map_view_t *pip, player_t *player, word pn); -void panPageManual(map_view_t *pip, player_t *player, word pn); +void ZC_panPageManual(map_view_t *pip, player_t *player, word pn); void ZC_MVSetup(map_view_t *pip, map_t *map, pan_t *pan, global_game_variables_t *gv); void ZC_MVInit(map_view_t *pip, int tx, int ty); -void ZC_MVSync(map_view_t *pip); -void ZC_panPageManual(map_view_t *pip, player_t *player, word pn); +void ZC_ShowMV(map_view_t *moo, boolean vsync, boolean sr); void near mapScrollRight(map_view_t *mv, player_t *player, word id, word plid); void near mapScrollLeft(map_view_t *mv, player_t *player, word id, word plid); void near mapScrollUp(map_view_t *mv, player_t *player, word id, word plid); diff --git a/src/scroll.c b/src/scroll.c index 6c65ced0..c230981b 100755 --- a/src/scroll.c +++ b/src/scroll.c @@ -129,7 +129,7 @@ void main(int argc, char *argv[]) /* set up paging */ //TODO: LOAD map data and position the map in the middle of the screen if smaller then screen - mapGoTo(mv, 0, 0); + mapGoTo(&mv, 0, 0); //_fmemcpy(mv[1].page->data, mv[0].page->data, mv[0].page->pagesize); playerXYpos(0, 0, &player, &mv, 0); @@ -144,7 +144,7 @@ void main(int argc, char *argv[]) #endif if(!pageflipflop) VL_ShowPage(mv[1].page, 0, 0);//modexShowPage(mv[1].page); - else VL_ShowPage(mv[0].page, 0, 0);//modexShowPage(mv[0].page);//!(gvar.video.p) + else ZC_ShowMV(&mv, 0, 0);//modexShowPage(mv[0].page);//!(gvar.video.p) shinku_fps_indicator_page = 0; // we're on page 1 now, shinku(). follow along please or it will not be visible. /* buffer pages */ @@ -177,9 +177,9 @@ void main(int argc, char *argv[]) //player movement IN_ReadControl(0, &player); if(!panswitch){ - walk(mv, &player, 0); + walk(&mv, &player, 0); }else{ - panPageManual(mv, &player, 0); + PANKEYFUN;//panPageManual(&mv, &player, 0); //printf(" player[0].q: %d", player[0].q); printf(" player[0].d: %d\n", player[0].d); } @@ -196,13 +196,6 @@ void main(int argc, char *argv[]) } if(player[0].q == (TILEWH/(player[0].speed))+1 && player[0].info.dir != 2 && (player[0].triggerx == 5 && player[0].triggery == 5)){ player[0].hp--; } //debugging binds! - if(IN_KeyDown(2)){ VL_ShowPage(mv[0].page, 0, 0); pan.pn=0; } - if(IN_KeyDown(3)){ VL_ShowPage(mv[1].page, 0, 0); pan.pn=1; } - if(IN_KeyDown(4)){ VL_ShowPage(mv[2].page, 0, 0); pan.pn=2; } - if(IN_KeyDown(4+1)){ VL_ShowPage(mv[3].page, 0, 0); pan.pn=3; } - if(IN_KeyDown(25)){ modexpdump(mv[0].page); modexpdump(mv[1].page); - IN_UserInput(1,1); - } //p #ifdef MODEX #ifdef FADE if(IN_KeyDown(24)){ modexPalUpdate0(gpal); paloffset=0; modexpdump(mv[0].page); modexpdump(mv[1].page); IN_UserInput(1,1); } //p diff --git a/src/test.c b/src/test.c index 6339d96d..28e537ab 100755 --- a/src/test.c +++ b/src/test.c @@ -137,7 +137,8 @@ void main(int argc, char *argv[]) while(!IN_KeyDown(sc_Escape)) { IN_ReadControl(0,&player); - ZC_panPageManual(&mv[pan.pn], &player, 0); + ZC_panPageManual(&mv, &player, 0); + //[pan.pn] //ZC_MVSync(&mv); /*if(i<5){ @@ -183,10 +184,7 @@ void main(int argc, char *argv[]) // modexClearRegion(&gvar.video.page[1], 48, 48, gvar.video.page[1].sw-64, gvar.video.page[1].sh-64, 128); // } //} - if(IN_KeyDown(1+1)){ pan.pn=0; } - if(IN_KeyDown(2+1)){ pan.pn=1; } - if(IN_KeyDown(3+1)){ pan.pn=2; } - if(IN_KeyDown(4+1)){ pan.pn=3; } + PANKEYFUN; if(IN_KeyDown(12)) modexClearRegion(&gvar.video.page[0], (gvar.video.page[0].width/2)-4, (gvar.video.page[0].height/2)-16, 24, 32, 15); if(IN_KeyDown(13)) modexClearRegion(&gvar.video.page[1], (gvar.video.page[1].width/2)-4, (gvar.video.page[1].height/2)-16, 24, 32, 15); /*==== if(IN_KeyDown(7)){ @@ -200,7 +198,8 @@ void main(int argc, char *argv[]) // if(i>PAL_SIZE) i=0; }//9*/ if(IN_KeyDown(25)){ modexpdump(&gvar.video.page[pan.pn]); IN_UserInput(1,1); }//p - VL_ShowPage(&gvar.video.page[pan.pn], 0, 0); + //VL_ShowPage(&gvar.video.page[pan.pn], 0, 0); + ZC_ShowMV(&mv, 0, 0); } endclk = *clockw; diff --git a/src/tesuto.h b/src/tesuto.h index 32e6a134..bcd211bc 100755 --- a/src/tesuto.h +++ b/src/tesuto.h @@ -10,19 +10,6 @@ #include #include -//panVmemManual(mv, player, 0); - -#define SHOWPAGEFUN VL_ShowPage(&(gvar.video.page[pan.pn]), 0, 0) -//modexShowPage(&(gvar.video.page[pan.pn])) - -#define PANKEY0EXE \ - panPageManual(&mv, &player, 0); \ - if(IN_KeyDown(1+1) || IN_KeyDown(sc_Z)){ pan.pn=0; SHOWPAGEFUN; } \ - if(IN_KeyDown(2+1) || IN_KeyDown(sc_X)){ pan.pn=1; SHOWPAGEFUN; } \ - if(IN_KeyDown(3+1) || IN_KeyDown(sc_C)){ pan.pn=2; SHOWPAGEFUN; if(IN_KeyDown(sc_C)) modexClearRegion(&gvar.video.page[2], 0, 0, gvar.video.page[2].sw, gvar.video.page[2].sh, 47); } \ - if(IN_KeyDown(4+1) || IN_KeyDown(sc_V)){ pan.pn=3; SHOWPAGEFUN; if(IN_KeyDown(sc_V)) modexClearRegion(&gvar.video.page[3], 0, 0, gvar.video.page[3].sw, gvar.video.page[3].sh, 45); } \ - if(IN_KeyDown(25)){ modexpdump(mv[1].page); modexShowPage(&(gvar.video.page[1])); IN_UserInput(1,1); } - ////corner markers #define GVPO gvar.video.page[0] #define GVPI gvar.video.page[1] diff --git a/src/vrstest.c b/src/vrstest.c index 16da3b13..bd3e1da1 100755 --- a/src/vrstest.c +++ b/src/vrstest.c @@ -109,7 +109,7 @@ void main() VGAmodeX(1, 1, &gvar); modexHiganbanaPageSetup(&gvar.video); - modexShowPage_(&gvar.video.page[0]); + VL_ShowPage(&gvar.video.page[0], 0, 1); /* non sprite comparison */ start = *clockw; diff --git a/src/zcroll.c b/src/zcroll.c index 16567094..679da8f4 100755 --- a/src/zcroll.c +++ b/src/zcroll.c @@ -175,7 +175,7 @@ void main(int argc, char *argv[]) if(IN_KeyDown(22)){ modexPalUpdate0(gpal); } //u //pan switch - if(IN_KeyDown(88)){panswitch=!panswitch; IN_UserInput(1,1);} //f12 + //if(IN_KeyDown(88)){panswitch=!panswitch; IN_UserInput(1,1);} //f12 if(IN_KeyDown(87)) //f11 { pageflipflop=!pageflipflop;