X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2F0.c;h=ae51d0582567000e69f387bae1740df8d9378c8c;hb=888e2c276b5ee54772919b0590c3865bedc42dc9;hp=31da3feb56a836f197bed0750fafa7db5f9c2c49;hpb=7a3b6f331f36735ef30027236eb447439583d43d;p=16.git diff --git a/src/0.c b/src/0.c index 31da3feb..ae51d058 100755 --- a/src/0.c +++ b/src/0.c @@ -10,6 +10,7 @@ static unsigned char palette[768]; global_game_variables_t gvar; +player_t player[1]; int main(int argc,char **argv) { struct vrl1_vgax_header *vrl_header; @@ -22,6 +23,10 @@ int main(int argc,char **argv) { bakapee1=malloc(64); bakapee2=malloc(1024); + IN_Startup(); + IN_Default(0,&player,ctrl_Joystick); + IN_initplayer(&player, 0); + if (argc < 3) { fprintf(stderr,"drawvrl \n"); bakapee1 = FILENAME_1;//"data/aconita.vrl"; @@ -104,7 +109,6 @@ int main(int argc,char **argv) { * this time, we render the distinctive pattern to another offscreen location and just copy. * note this version is much faster too! */ { - //const unsigned int pattern_ofs = 0x10000UL - gvar.video.page[0].pagesize;//(gvar.video.page[0].stridew * gvar.video.page[0].height); unsigned int i,j,o,o2; int x,y,rx,ry,w,h; unsigned int overdraw = 1; // how many pixels to "overdraw" so that moving sprites with edge pixels don't leave streaks. @@ -127,10 +131,16 @@ int main(int argc,char **argv) { /* do it */ omemptr = vga_state.vga_graphics_ram; // save original mem ptr - while (1) { - /* stop animating if the user hits ENTER */ - if (kbhit()) { - if (getch() == 13) break; + + while(!IN_KeyDown(sc_Escape)) + { + IN_ReadControl(0,&player); + if(IN_KeyDown(2)) modexShowPage(&(gvar.video.page[0])); + if(IN_KeyDown(3)) modexShowPage(&(gvar.video.page[1])); + if(IN_KeyDown(68)) //f10 + { + //gvar.kurokku.fpscap=!gvar.kurokku.fpscap; + IN_UserInput(1,1); } /* render box bounds. y does not need modification, but x and width must be multiple of 4 */ @@ -174,31 +184,24 @@ int main(int argc,char **argv) { vga_state.vga_draw_stride_limit = vga_state.vga_draw_stride = gvar.video.page[0].stridew; /* step */ - x += xdir; - y += ydir; - if (x >= (gvar.video.page[0].width - 1) || x == -(gvar.video.page[0].dx)) + x += xdir; y += ydir; + if ((x + vrl_header->width) >= ((gvar.video.page[0].width + gvar.video.page[0].dx) - 1) || x == -(gvar.video.page[0].dx)) xdir = -xdir; - if (y >= (gvar.video.page[0].height - 1) || y == -(gvar.video.page[0].dy)) + if ((y + vrl_header->height) >= ((gvar.video.page[0].height + gvar.video.page[0].dy) - 1) || y == -(gvar.video.page[0].dy)) ydir = -ydir; + //printf("[x%u y%u] [rx%u ry%u] [w%u h%u]\n", x, y, rx, ry, w, h); } } - while (1) { - /* stop animating if the user hits ENTER */ - if (kbhit()) { - if (getch() == 13) break; - } - modexShowPage(&(gvar.video.page[1])); - } + IN_UserInput(1,1); - while (1) { - /* stop animating if the user hits ENTER */ - if (kbhit()) { - if (getch() == 13) break; - } - modexShowPage(&(gvar.video.page[0])); + while(!IN_KeyDown(sc_Escape)) + { + if(IN_KeyDown(2)) modexShowPage(&(gvar.video.page[0])); + if(IN_KeyDown(3)) modexShowPage(&(gvar.video.page[1])); } + modexShowPage(&(gvar.video.page[0])); /* another handy "demo" effect using VGA write mode 1. * we can take what's on screen and vertically squash it like an old analog TV set turning off. */ { @@ -278,12 +281,14 @@ int main(int argc,char **argv) { if (dh < 40) dh_step = 1; } } -//uint16_t - printf("%u\n", (0x10000UL - (uint16_t)(gvar.video.page[1].data))); + + IN_Shutdown(); VGAmodeX(0, 1, &gvar); free(vrl_lineoffs); buffer = NULL; free(buffer); bufsz = 0; + free(bakapee1); + free(bakapee2); return 0; }