From bcbedc7dc5aa38518f2acd1d1c8d110a9d357e42 Mon Sep 17 00:00:00 2001 From: sparky4 Date: Thu, 7 Apr 2016 16:35:24 -0500 Subject: [PATCH] bakapi.exe wwww --- src/.bakapi.c.kate-swp | Bin 0 -> 282 bytes src/bakapi.c | 206 ++++++++++++++++++----------------------- src/inputest.c | 6 +- src/lib/modex16.h | 3 - 4 files changed, 93 insertions(+), 122 deletions(-) create mode 100755 src/.bakapi.c.kate-swp diff --git a/src/.bakapi.c.kate-swp b/src/.bakapi.c.kate-swp new file mode 100755 index 0000000000000000000000000000000000000000..f5398a7dbd08dccb3ee387784515b91cac66e0b4 GIT binary patch literal 282 zcmZQzU=Z?7EJ;-eE>A2_aLdd|RWQ;sU|?Vn2)oZc<@evZyN> literal 0 HcmV?d00001 diff --git a/src/bakapi.c b/src/bakapi.c index 8ea80d87..6d04e547 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,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. @@ -143,6 +202,17 @@ main(int argc, char *argvar[]) //fprintf(stderr, "xx=%d yy=%d tile=%d\n", bakapee.xx, bakapee.yy, bakapee.tile); 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 +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' } diff --git a/src/inputest.c b/src/inputest.c index edd86d62..199dc90b 100755 --- a/src/inputest.c +++ b/src/inputest.c @@ -30,9 +30,9 @@ main(int argc, char *argv[]) global_game_variables_t gvar; player_t player[MaxPlayers]; //extern struct inconfig inpu; - testkeyin=0; - testcontrolnoisy=1; - testctrltype=1; + testkeyin=1; + testcontrolnoisy=0; + testctrltype=0; IN_Startup(); IN_Default(0,&player,ctrl_Joystick1); //while(!IN_KeyDown(sc_Escape)) diff --git a/src/lib/modex16.h b/src/lib/modex16.h index 8e0ff6a1..94a69ad5 100755 --- a/src/lib/modex16.h +++ b/src/lib/modex16.h @@ -42,9 +42,6 @@ #include #include -//TODO dos lib vga implementation ^^ -//#define DOSLIBVGA - static struct pcxHeader { byte id; byte version; -- 2.39.5