X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Fbakapi.c;h=333887021409b8452ee8047d7fe55a569ae57302;hb=0b27dec43b461090fb2b9770f031dd230a9a0f75;hp=8ea80d87ea6f3dd7cdb3730f1973dd831c95148e;hpb=2a052f3a8464a1ebdaddc6d7079541339f86e4a6;p=16.git diff --git a/src/bakapi.c b/src/bakapi.c index 8ea80d87..33388702 100755 --- a/src/bakapi.c +++ b/src/bakapi.c @@ -36,6 +36,8 @@ main(int argc, char *argvar[]) { char *a; int i; + word panq=1, pand=0; + boolean panswitch=0; // allow changing default mode from command line for (i=1;i < argc;) { @@ -123,26 +125,95 @@ main(int argc, char *argvar[]) #ifdef BOINK while(d>0) // on! { + int c; /* run screensaver routine until keyboard input */ while (key > 0) { if (kbhit()) { - getch(); // eat keyboard input - break; + if(!panswitch) + { + getch(); // eat keyboard input + break; + }else c=getch(); } - ding(&gvar.video.page[0], &bakapee, key); + if(!panswitch) ding(&gvar.video.page[0], &bakapee, key); + else ding(&gvar.video.page[0], &bakapee, 2); + if(panswitch!=0) + { + //right movement + if((c==0x4d && pand == 0) || pand == 2) + { + if(pand == 0){ pand = 2; } + if(panq<=(TILEWH/(4))) + { + gvar.video.page[0].dx++; + modexShowPage(&gvar.video.page[0]); + panq++; + } else { panq = 1; pand = 0; } + } + //left movement + if((c==0x4b && pand == 0) || pand == 4) + { + if(pand == 0){ pand = 4; } + if(panq<=(TILEWH/(4))) + { + gvar.video.page[0].dx--; + modexShowPage(&gvar.video.page[0]); + panq++; + } else { panq = 1; pand = 0; } + } + //down movement + if((c==0x50 && pand == 0) || pand == 3) + { + if(pand == 0){ pand = 3; } + if(panq<=(TILEWH/(4))) + { + gvar.video.page[0].dy++; + modexShowPage(&gvar.video.page[0]); + panq++; + } else { panq = 1; pand = 0; } + } + //up movement + if((c==0x48 && pand == 0) || pand == 1) + { + if(pand == 0){ pand = 1; } + if(panq<=(TILEWH/(4))) + { + gvar.video.page[0].dy--; + modexShowPage(&gvar.video.page[0]); + panq++; + } else { panq = 1; pand = 0; } + } + if(c==0x71 || c==0xb1 || c=='p') + { + //getch(); // eat keyboard input + panswitch=0; + break; // 'q' or 'ESC' or 'p' + } + } } { - int c; // this code is written around modex16 which so far is a better fit than using DOSLIB vga directly, so leave MXLIB code in. // we'll integrate DOSLIB vga into that part of the code instead for less disruption. -- J.C. VGAmodeX(0, 0, &gvar); // user imput switch //fprintf(stderr, "xx=%d yy=%d tile=%d\n", bakapee.xx, bakapee.yy, bakapee.tile); + fprintf(stderr, "dx=%d dy=%d ", gvar.video.page[0].dx, gvar.video.page[0].dy); printf("Tiled mode is "); switch (bakapee.tile) + { + case 0: + printf("off. "); + break; + case 1: + printf("on. "); + break; + } + //printf("\n"); + printf("Pan mode is "); + switch (panswitch) { case 0: printf("off.\n"); @@ -152,13 +223,25 @@ main(int argc, char *argvar[]) break; } printf("Enter 1, 2, 3, 4, 5, 6, 8, or 9 to run a screensaver, or enter 0 to quit.\n"); - +pee: c = getch(); switch (c) { case 27: /* Escape key */ case '0': d=0; break; + case 'p': // test pan + switch (panswitch) + { + case 0: + panswitch=1; + break; + case 1: + panswitch=0; + break; + } + goto pee; + break; case 'b': // test tile change switch (bakapee.tile) { @@ -196,8 +279,6 @@ main(int argc, char *argvar[]) } } #else // !defined(BOINK) -word panq=1, pand=0; -boolean panswitch=0; // FIXME: Does not compile. Do you want to remove this? // TODO: This is a testing sextion for textrendering and panning for project 16 --sparky4 while(1) @@ -218,119 +299,13 @@ boolean panswitch=0; ding(&gvar.video.page[0], &bakapee, key); modexPanPage(&gvar.video.page[0], xpos, ypos); - //right movement - if((IN_KeyDown(77) && !IN_KeyDown(75) && pand == 0) || pand == 2) - { - if(pand == 0){ pand = 2; } - if(panq<=(TILEWH/(4))) - { - switch(panpagenum) - { - case 0: - //bg - bg->page->dx++; - modexShowPage(bg->page); - break; - case 1: - //spri - spri->page->dx++; - modexShowPage(spri->page); - break; - case 2: - //fg - mask->page->dx++; - modexShowPage(mask->page); - break; - } - panq++; - } else { panq = 1; pand = 0; } - } - //left movement - if((IN_KeyDown(75) && !IN_KeyDown(77) && pand == 0) || pand == 4) - { - if(pand == 0){ pand = 4; } - if(panq<=(TILEWH/(4))) - { - switch(panpagenum) - { - case 0: - //bg - bg->page->dx--; - modexShowPage(bg->page); - break; - case 1: - //spri - spri->page->dx--; - modexShowPage(spri->page); - break; - case 2: - //fg - mask->page->dx--; - modexShowPage(mask->page); - break; - } - panq++; - } else { panq = 1; pand = 0; } - } - //down movement - if((IN_KeyDown(72) && !IN_KeyDown(80) && pand == 0) || pand == 3) - { - if(pand == 0){ pand = 3; } - if(panq<=(TILEWH/(4))) - { - switch(panpagenum) - { - case 0: - //bg - bg->page->dy--; - modexShowPage(bg->page); - break; - case 1: - //spri - spri->page->dy--; - modexShowPage(spri->page); - break; - case 2: - //fg - mask->page->dy--; - modexShowPage(mask->page); - break; - } - panq++; - } else { panq = 1; pand = 0; } - } - //up movement - if((IN_KeyDown(80) && !IN_KeyDown(72) && pand == 0) || pand == 1) - { - if(pand == 0){ pand = 1; } - if(panq<=(TILEWH/(4))) - { - switch(panpagenum) - { - case 0: - //bg - bg->page->dy++; - modexShowPage(bg->page); - break; - case 1: - //spri - spri->page->dy++; - modexShowPage(spri->page); - break; - case 2: - //fg - mask->page->dy++; - modexShowPage(mask->page); - break; - } - panq++; - } else { panq = 1; pand = 0; } - } + c = getch(); + // xpos+=xdir; // ypos+=ydir; -// if( (xpos>(VW-gvar.video.page[0].width-1)) || (xpos<1)){xdir=-xdir;} -// if( (ypos>(BH-gvar.video.page[0].height-1)) || (ypos<1)){ydir=-ydir;} - ch=getch(); +// if( (xpos>(gvar.video.page[0].sw-gvar.video.page[0].width-1)) || (xpos<1)){xdir=-xdir;} +// if( (ypos>(gvar.video.page[0].sh-gvar.video.page[0].height-1)) || (ypos<1)){ydir=-ydir;} +// ch=getch(); if(ch==0x71)break; // 'q' if(ch==0x1b)break; // 'ESC' }