From 17fb0f3bf365b695992193e6a354acc37f04b3ff Mon Sep 17 00:00:00 2001 From: sparky4 Date: Mon, 9 Jan 2017 11:48:47 -0600 Subject: [PATCH] added stuff to help me study 0.exe it is a complex program wwww --- src/0.c | 35 ++++++++++++++++++++++++--------- src/tesuto.h | 55 +++++++++++++++++++++++++++++++++++++++------------- 2 files changed, 67 insertions(+), 23 deletions(-) diff --git a/src/0.c b/src/0.c index ee5f5c44..24a2ef75 100755 --- a/src/0.c +++ b/src/0.c @@ -5,17 +5,13 @@ #include "src/tesuto.h" -#define FILENAME_1 "data/aconita.vrl" -#define FILENAME_2 "data/aconita.pal" -//#define FILENAME_2 "data/default.pal" +//#define FILENAME_1 "data/aconita.vrl" +//#define FILENAME_2 "data/aconita.pal" +#define FILENAME_1 "data/spri/chikyuu.vrl" +#define FILENAME_2 "data/spri/chikyuu.pal" //#define PATTERN #define INITTNUM 1 -#define DRAWCORNERBOXES \ -DRAWOTHERCORNERBOX_TOPLEFT; \ -DRAWOTHERCORNERBOX_TOPRIGHT; \ -DRAWOTHERCORNERBOX_BOTTOMLEFT; \ -DRAWOTHERCORNERBOX_BOTTOMRIGHT; \ static unsigned char palette[768]; player_t player[MaxPlayers]; @@ -31,7 +27,9 @@ int main(int argc,char **argv) unsigned int bufsz; int fd, i; char *bakapee1,*bakapee2; + boolean anim=1,noanim=0; + pan.pn=0; bakapee1=malloc(64); @@ -115,6 +113,7 @@ int main(int argc,char **argv) #define VMEMHEIGHT gvar.video.page[0].height+gvar.video.page[1].height //4 this draws that pattern on the screen +#ifdef PATTERN { unsigned int i,j,o; /* fill screen with a distinctive pattern */ @@ -125,6 +124,9 @@ int main(int argc,char **argv) vga_state.vga_graphics_ram[o] = (i^j)&15; // VRL samples put all colors in first 15! } } +#else + TESTBG; +#endif DRAWCORNERBOXES; @@ -139,6 +141,7 @@ int main(int argc,char **argv) VGA_RAM_PTR omemptr; int xdir=1,ydir=1; +#ifdef PATTERN int j; /* fill pattern offset with a distinctive pattern */ for (i=0;i < gvar.video.page[0].width;i++) { @@ -147,7 +150,9 @@ int main(int argc,char **argv) for (j=0;j < VMEMHEIGHT;j++,o += gvar.video.page[0].stridew) vga_state.vga_graphics_ram[o] = (i^j)&15; // VRL samples put all colors in first 15! } - +#else + TESTBG; +#endif DRAWCORNERBOXES; /* starting coords. note: this technique is limited to x coordinates of multiple of 4 */ @@ -165,13 +170,25 @@ int main(int argc,char **argv) { //gvar.kurokku.fpscap=!gvar.kurokku.fpscap; anim=!anim; + DRAWCORNERBOXES; + IN_UserInput(1,1); + } + if(IN_KeyDown(sc_A)) //a + { + //gvar.kurokku.fpscap=!gvar.kurokku.fpscap; + noanim=!noanim; + DRAWCORNERBOXES; IN_UserInput(1,1); } + FUNCTIONKEYFUNCTIONS0EXE; if(IN_KeyDown(sc_R)){ gvar.video.page[0].dx=gvar.video.page[0].dy=gvar.video.page[1].dx=gvar.video.page[1].dy=16; + mv[0].tx = mv[0].ty = mv[1].tx = mv[1].ty = INITTNUM; modexShowPage(&(gvar.video.page[pan.pn])); player[0].q = 1; player[0].d = 2; + x=y=0; + xdir=ydir=1; } //R if(anim && !noanim) diff --git a/src/tesuto.h b/src/tesuto.h index df07c5bf..6ada8a7b 100755 --- a/src/tesuto.h +++ b/src/tesuto.h @@ -19,30 +19,57 @@ if(IN_KeyDown(25)){ modexpdump(mv[1].page); modexShowPage(&(gvar.video.page[1])); IN_UserInput(1,1); } ////corner markers -#define GVP gvar.video.page[0] -#define GW GVP.width-16 -#define GH GVP.height-16 -#define GE GVP.sw -#define GJ GVP.sh -#define DCBF modexClearRegion(&GVP +#define GVPO gvar.video.page[0] +#define GVPI gvar.video.page[1] +#define OW GVPO.width-16 +#define OH GVPO.height-16 +#define OE GVPO.sw +#define OJ GVPO.sh +#define IW GVPI.width-16 +#define IH GVPI.height-16 +#define IE GVPI.sw +#define IJ GVPI.sh +#define DCBO modexClearRegion(&GVPO +#define DCBI modexClearRegion(&GVPI #define DRAWOTHERCORNERBOX_TOPLEFT \ -DCBF, 0, 0, 16, 16, 0); \ -DCBF, 16, 16, 16, 16, 2); +DCBO, 0, 0, 16, 16, 0); \ +DCBO, 16, 16, 16, 16, 2); \ +DCBI, 0, 0, 16, 16, 0); \ +DCBI, 16, 16, 16, 16, 2); #define DRAWOTHERCORNERBOX_TOPRIGHT \ -DCBF, GW, 0, 16, 16, 0); \ -DCBF, GE, 16, 16, 16, 2); +DCBO, OW, 0, 16, 16, 0); \ +DCBO, OE, 16, 16, 16, 2); \ +DCBI, IW, 0, 16, 16, 0); \ +DCBI, IE, 16, 16, 16, 2); #define DRAWOTHERCORNERBOX_BOTTOMLEFT \ -DCBF, 0, GH, 16, 16, 0); \ -DCBF, 16, GJ, 16, 16, 2); +DCBO, 0, OH, 16, 16, 0); \ +DCBO, 16, OJ, 16, 16, 2); \ +DCBI, 0, IH, 16, 16, 0); \ +DCBI, 16, IJ, 16, 16, 2); #define DRAWOTHERCORNERBOX_BOTTOMRIGHT \ -DCBF, GE, GJ, 16, 16, 2);\ -DCBF, GW, GH, 16, 16, 0); +DCBO, OE, OJ, 16, 16, 2); \ +DCBO, OW, OH, 16, 16, 0); \ +DCBI, IE, IJ, 16, 16, 2);\ +DCBI, IW, IH, 16, 16, 0); +#define DRAWCORNERBOXES \ +DRAWOTHERCORNERBOX_TOPLEFT; \ +DRAWOTHERCORNERBOX_TOPRIGHT; \ +DRAWOTHERCORNERBOX_BOTTOMLEFT; \ +DRAWOTHERCORNERBOX_BOTTOMRIGHT; \ +#define TESTBG \ + modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].width, gvar.video.page[0].height, 15); \ + modexClearRegion(&gvar.video.page[0], 16, 16, gvar.video.page[0].sw, gvar.video.page[0].sh, 128); \ + modexClearRegion(&gvar.video.page[0], 32, 32, gvar.video.page[0].sw-32, gvar.video.page[0].sh-32, 42); \ + modexClearRegion(&gvar.video.page[0], 48, 48, gvar.video.page[0].sw-64, gvar.video.page[0].sh-64, 128); \ + modexCopyPageRegion(&gvar.video.page[1], &gvar.video.page[0], 0, 0, 0, 0, gvar.video.page[0].width, gvar.video.page[0].height); \ + modexClearRegion(&gvar.video.page[2], 0, 0, gvar.video.page[2].sw, gvar.video.page[2].sh, 47); \ + modexClearRegion(&gvar.video.page[3], 0, 0, gvar.video.page[3].sw, gvar.video.page[3].sh, 45); typedef unsigned char far *VGA_RAM_PTR; //VGA_RAM_PTR vga_graphics_ram = (VGA_RAM_PTR)MK_FP(0xA000,0x0000); -- 2.39.5