OSDN Git Service

bakapi.exe wwww
[proj16/16.git] / src / bakapi.c
index 8ea80d8..6d04e54 100755 (executable)
@@ -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,18 +125,75 @@ 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.
@@ -145,6 +204,17 @@ main(int argc, char *argvar[])
                        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");
                                break;
                                case 1:
@@ -152,13 +222,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 +278,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 +298,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();
+//     ch=getch();
        if(ch==0x71)break; // 'q'
        if(ch==0x1b)break; // 'ESC'
        }