global_game_variables_t gvar;
static bakapee_t bakapee;
word key,d,xpos,ypos,xdir,ydir;
+sword vgamodex_mode = 1; // 320x240 default
int ch=0x0;
void
main(int argc, char *argvar[])
{
+ char *a;
+ int i;
+
+ // allow changing default mode from command line
+ for (i=1;i < argc;) {
+ a = argvar[i++];
+
+ if (*a == '-') {
+ do { a++; } while (*a == '-');
+
+ if (!strcmp(a,"mx")) {
+ // (based on src/lib/modex16.c)
+ // 1 = 320x240
+ // 2 = 160x120
+ // 3 = 320x200
+ // 4 = 192x144
+ // 5 = 256x192
+ vgamodex_mode = (sword)strtoul(argvar[i++],NULL,0);
+ }
+ else {
+ fprintf(stderr,"Unknown switch %s\n",a);
+ return;
+ }
+ }
+ else {
+ fprintf(stderr,"Unknown command arg %s\n",a);
+ return;
+ }
+ }
+
// DOSLIB: check our environment
probe_dos();
xdir=1;
ydir=1;
-#ifdef MXLIB
- VGAmodeX(1, &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.
-#else
-# error REMOVED // this code is written around modex16 which so far is a better fit than using DOSLIB vga directly, so leave MXLIB code in.
+ VGAmodeX(vgamodex_mode, 1, &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.
-#endif
+
bakapee.xx = rand()&0%gvar.video.page[0].width;
bakapee.yy = rand()&0%gvar.video.page[0].height;
bakapee.gq = 0;
#ifdef BOINK
while(d>0) // on!
{
- if(!kbhit())
- { // conditions of screen saver
+ /* run screensaver routine until keyboard input */
+ while (key > 0) {
+ if (kbhit()) {
+ getch(); // eat keyboard input
+ break;
+ }
+
ding(&gvar.video.page[0], &bakapee, key);
}
- else
+
{
-# ifndef MXLIB
-# error REMOVED // this code is written around modex16 which so far is a better fit than using DOSLIB vga directly, so leave MXLIB code in.
+ 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.
-# else
- VGAmodeX(0, &gvar);
-# endif
+ VGAmodeX(0, 0, &gvar);
// user imput switch
- fprintf(stderr, "xx=%d yy=%d tile=%d\n", bakapee.xx, bakapee.yy, bakapee.tile);
- printf("Enter 1, 2, 3, 4, or 6 to run a screensaver, or enter 0 to quit.\n", getch()); // prompt the user
- //scanf("%d", &key);
- if(scanf("%d", &key) != 1)
- {
- printf("%d\n", key);
- }
- getch();
- //if(key==3){xx=yy=0;} // crazy screen saver wwww
- switch (key)
+ //fprintf(stderr, "xx=%d yy=%d tile=%d\n", bakapee.xx, bakapee.yy, bakapee.tile);
+ printf("Tiled mode is ");
+ switch (bakapee.tile)
{
case 0:
- d=0;
+ printf("off.\n");
+ break;
+ case 1:
+ printf("on.\n");
break;
- case 65536:
+ }
+ printf("Enter 1, 2, 3, 4, 5, 6, 8, or 9 to run a screensaver, or enter 0 to quit.\n");
+
+ c = getch();
+ switch (c) {
+ case 27: /* Escape key */
+ case '0':
+ d=0;
+ break;
+ case 'b': // test tile change
switch (bakapee.tile)
{
case 0:
bakapee.tile=0;
break;
}
- d=2;
- default:
-# ifdef MXLIB
+ key=0;
+ break;
+ case '8':
+ c+=8;
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '9':
+ key = c - '0';
gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]);
gvar.video.page[0].width += (TILEWH*2);
gvar.video.page[0].height += (TILEWH*2);
- VGAmodeX(1, &gvar);
-# else
-# error REMOVED // this code is written around modex16 which so far is a better fit than using DOSLIB vga directly, so leave MXLIB code in.
+ VGAmodeX(vgamodex_mode, 0, &gvar);
+ // 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.
-# endif
modexShowPage(&gvar.video.page[0]);
- break;
+ break;
+ default:
+ key=0;
+ break;
}
}
}
#else // !defined(BOINK)
// 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)
{ // conditions of screen saver
while(!kbhit())
}
// VGAmodeX(0, &gvar);
#endif // defined(BOINK)
- printf("bakapi ver. 1.04.13.04\nis made by sparky4\81i\81\86\83Ö\81\85\81j feel free to use it ^^\nLicence: GPL v3\n");
+ printf("bakapi ver. 1.04.16.04\nis made by sparky4\81i\81\86\83Ö\81\85\81j feel free to use it ^^\nLicence: GPL v3\n");
+ printf("compiled on 2016/04/04\n");
}
//pee!