From 96015e4e1bc64a7bfa3318cf8857a5b274f99b8c Mon Sep 17 00:00:00 2001 From: sparky4 Date: Mon, 18 Jul 2016 09:20:50 -0500 Subject: [PATCH] 0.exe now shows what the hell is going on on page 2 while the user can switch to page 1 and back ww --- src/0.c | 46 ++++++++++++++++++++++++++-------------------- src/0.h | 14 ++++++++++++++ src/scroll.c | 1 - 3 files changed, 40 insertions(+), 21 deletions(-) create mode 100755 src/0.h diff --git a/src/0.c b/src/0.c index 6e4a8d44..559d678a 100755 --- a/src/0.c +++ b/src/0.c @@ -3,13 +3,14 @@ #include #include -#include "src/tesuto.h" +#include "src/0.h" #define FILENAME_1 "data/aconita.vrl" #define FILENAME_2 "data/aconita.pal" 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"; @@ -126,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 */ @@ -173,8 +184,7 @@ 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; + 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 + vrl_header->height) >= ((gvar.video.page[0].height + gvar.video.page[0].dy) - 1) || y == -(gvar.video.page[0].dy)) @@ -183,22 +193,15 @@ int main(int argc,char **argv) { } } - 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. */ { @@ -279,10 +282,13 @@ int main(int argc,char **argv) { } } + IN_Shutdown(); VGAmodeX(0, 1, &gvar); free(vrl_lineoffs); buffer = NULL; free(buffer); bufsz = 0; + free(bakapee1); + free(bakapee2); return 0; } diff --git a/src/0.h b/src/0.h new file mode 100755 index 00000000..2fd0b919 --- /dev/null +++ b/src/0.h @@ -0,0 +1,14 @@ +#ifndef __TESUTO_0_H__ +#define __TESUTO_0_H__ + +#include "src/lib/16_head.h" +#include "src/lib/modex16.h" +#include "src/lib/16_in.h" + +#include +#include +#include +#include + +typedef unsigned char far *VGA_RAM_PTR; +#endif diff --git a/src/scroll.c b/src/scroll.c index f45b3501..b496aea7 100755 --- a/src/scroll.c +++ b/src/scroll.c @@ -115,7 +115,6 @@ void main(int argc, char *argv[]) /* data */ player[0].data = malloc(48*128); //TODO use exmm *player[0].data = bitmapLoadPcx("data/chikyuu.pcx"); // load sprite - //npctmp = bitmapLoadPcx("ptmp1.pcx"); // load sprite /* create the planar buffer */ ////++++ (player[0].data) = *planar_buf_from_bitmap(&p); -- 2.39.5