X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Fbakapi.c;h=8c2b3f7392e631462d8bc3286a70275ea75b85a7;hb=d40ef7f62ff3e5bd49ffec3b06c881cfa8d02bdb;hp=b03f294a754e5b7e4e5e8fdaa665bdd4ca2e0eed;hpb=7092caf49f8feaee14bba0a140f1974bd57d3228;p=16.git diff --git a/src/bakapi.c b/src/bakapi.c index b03f294a..8c2b3f73 100755 --- a/src/bakapi.c +++ b/src/bakapi.c @@ -31,10 +31,6 @@ sword vgamodex_mode = 1; // 1 = 320x240 with buffer void TL_VidInit(global_game_variables_t *gvar){} //int ch=0x0; -#define SETUPPAGEBAKAPI \ -gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0], &gvar.video); \ -gvar.video.page[1] = modexNextPage(&gvar.video.page[0]); - void main(int argc, char *argvar[]) @@ -42,10 +38,9 @@ main(int argc, char *argvar[]) static global_game_variables_t gvar; struct glob_game_vars *ggvv; char *a; - int i; - word panq=1, pand=0; - boolean panswitch=0; - word showpage=0; + int i,c; + word panq=1, pand=0,showding=0; + boolean panswitch=0,bptest=1,runding=1; ggvv=&gvar; @@ -76,52 +71,21 @@ main(int argc, char *argvar[]) } } - // DOSLIB: check our environment - probe_dos(); - - // DOSLIB: what CPU are we using? - // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS. - // So this code by itself shouldn't care too much what CPU it's running on. Except that other - // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for - // the CPU to carry out tasks. --J.C. - cpu_probe(); - - // DOSLIB: check for VGA - if (!probe_vga()) { - printf("VGA probe failed\n"); - return; - } - // hardware must be VGA or higher! - if (!(vga_state.vga_flags & VGA_IS_VGA)) { - printf("This program requires VGA or higher graphics hardware\n"); - return; - } - textInit(); + // initiate doslib // + TL_DosLibStartup(&gvar); // main variables values d=4; // switch variable key=2; // default screensaver number - xpos=TILEWHD; - ypos=TILEWHD; - xdir=1; - ydir=1; + xpos=TILEWHD; ypos=TILEWHD; xdir=1; ydir=1; VGAmodeX(vgamodex_mode, 0, &gvar); // TODO: Suggestion: Instead of magic numbers for the first param, might I suggest defining an enum or some #define constants that are easier to remember? --J.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. - - bakapee.xx = rand()&0%gvar.video.page[0].width; - bakapee.yy = rand()&0%gvar.video.page[0].height; - bakapee.gq = 0; - bakapee.sx= bakapee.sy=0; - bakapee.bakax= bakapee.bakay=0; - bakapee.coor=0; - + bakapee.xx = rand()&0%gvar.video.page[0].width; bakapee.yy = rand()&0%gvar.video.page[0].height; + bakapee.gq = 0; bakapee.sx=bakapee.sy=0; bakapee.bakax=bakapee.bakay=0; bakapee.coor=0; //once where #defines - bakapee.tile=0; - bakapee.bonk=400; - bakapee.lgq=32; - bakapee.hgq=55; + bakapee.tile=0; bakapee.bonk=400; bakapee.lgq=32; bakapee.hgq=55; switch(WCPU_detectcpu()) { @@ -133,37 +97,85 @@ main(int argc, char *argvar[]) break; } - /* setup camera and screen~ */ + // setup camera and screen~ // SETUPPAGEBAKAPI - //modexPalUpdate(bmp.palette); //____ - //modexDrawBmp(VGA, 0, 0, &bmp, 0); //____ - //getch(); //____ - //VL_SetLineWidth (40, &gvar); + VL_ShowPage(&gvar.video.page[0], 1, 0); + BAKAPIINITFIZZTEST - VL_ShowPage(&gvar.video.page[showpage], 0, 0); + while (bptest) { - word w; - for(w=0;w<64000;w++) +/* if (key > 0) + {*/ + while (!kbhit() && runding) + { + //{ word w; for(w=0;w<(gvar.video.page[0].width*gvar.video.page[0].height);w++) {}} + ding(&gvar.video.page[showding], &bakapee, 4); + } + if (kbhit()) +// { + getch(); // eat keyboard input +// break; +// } +// }*/ + { - ding(&gvar.video.page[showpage], &bakapee, 2); - ding(&gvar.video.page[1], &bakapee, 2); + + c = getch(); + switch (c) + { + case 27: // Escape key // + case '0': + default: + bptest = false; + break; + case 'b': // test tile change // + switch (bakapee.tile) + { + case 0: + bakapee.tile=1; + break; + case 1: + bakapee.tile=0; + break; + } + break; + case 'r': + runding = false; + BAKAPIINITFIZZTEST + break; + case 'e': + runding = 1; + break; + case 'z': + runding = false; + FIZZFADEFUN +// runding = true; + break; + case '3': + case '4': + runding = 1; + showding = c - '0' - 3; + break; + case '1': + case '2': + // case '5': + // case '6': + // case '9': + key = c - '0' - 1; + VL_ShowPage(&gvar.video.page[key], 1, 0); + break; + } } -#ifdef BAKAFIZZUNSIGNED - if(!baka_FizzleFade (gvar.video.ofs.bufferofs, gvar.video.ofs.displayofs, vga_state.vga_width, vga_state.vga_height, 70, true, &gvar)) -#else - if(!baka_FizzleFade (&gvar.video.page[1], &gvar.video.page[0], vga_state.vga_width, vga_state.vga_height, 70, true, &gvar)) -#endif - //ding(&gvar.video.page[showpage], &bakapee, 9); - modexprint(&gvar.video.page[0], gvar.video.page[0].sw/2, gvar.video.page[0].sh/2, 1, 0, 47, 0, 1, "bakapi ok"); } - while(!kbhit()){} + + +//while(!kbhit()){} // screen savers //#ifdef BOINK while(d>0) // on! { - int c; /* run screensaver routine until keyboard input */ while (key > 0) { if (kbhit()) { @@ -174,7 +186,13 @@ main(int argc, char *argvar[]) }else c=getch(); } - if(!panswitch) ding(&gvar.video.page[0], &bakapee, key); + if(!panswitch){ + if(key==9) + { + ding(&gvar.video.page[1], &bakapee, 4); + ding(&gvar.video.page[0], &bakapee, 4); + FIZZFADEFUN + }else ding(&gvar.video.page[0], &bakapee, key); } else ding(&gvar.video.page[0], &bakapee, 2); if(panswitch!=0) { @@ -254,6 +272,7 @@ main(int argc, char *argvar[]) // 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); + clrscr(); //added to clear screen wwww // 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); @@ -277,7 +296,6 @@ main(int argc, char *argvar[]) printf("on."); break; } - printf(" Showing page %u", showpage); printf("\n"); printf("Incrementation of color happens at every %uth plot.\n", bakapee.bonk); printf("Enter 1, 2, 3, 4, 5, 6, 8, or 9 to run a screensaver, or enter 0 to quit.\n"); @@ -289,37 +307,26 @@ pee: 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) + switch (panswitch) { case 0: - bakapee.tile=1; + panswitch=1; break; case 1: - bakapee.tile=0; + panswitch=0; break; } key=0; + goto pee; break; - case 'q': - switch (showpage) + case 'b': // test tile change + switch (bakapee.tile) { case 0: - showpage=1; + bakapee.tile=1; break; case 1: - showpage=0; + bakapee.tile=0; break; } key=0; @@ -335,12 +342,11 @@ pee: case '9': key = c - '0'; VGAmodeX(vgamodex_mode, 0, &gvar); - VL_ShowPage(&gvar.video.page[showpage], 0, 0); SETUPPAGEBAKAPI // 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. - VL_ShowPage(&gvar.video.page[showpage], 0, 0); - break; + VL_ShowPage(&gvar.video.page[0], 0, 0); + break; case '-': if(bakapee.bonk>0) bakapee.bonk-=100; @@ -354,9 +360,9 @@ pee: key=0; break; } - clrscr(); //added to clear screen wwww } } + clrscr(); //added to clear screen wwww #if 0 //#else // !defined(BOINK) // FIXME: Does not compile. Do you want to remove this?