X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2F0.c;h=f635289a00c1e363d742fa92f090534781a08af9;hb=51b492de428068830f36b4ec57168f34c9477dab;hp=47a0e29ac66bbc8d195d96b5088cca2679bc2be7;hpb=4ecf82fc48a4a19ff72cd89bce7d0bda18cf2f0c;p=16.git diff --git a/src/0.c b/src/0.c index 47a0e29a..f635289a 100755 --- a/src/0.c +++ b/src/0.c @@ -10,13 +10,13 @@ #define FILENAME_1 "data/spri/chikyuu.vrl" #define FILENAME_2 "data/spri/chikyuu.pal" -//#define PATTERN #define INITTNUM 1 -static unsigned char palette[768]; +static byte palette[768]; player_t player[MaxPlayers]; map_view_t mv[4]; -pan_t pan; + +map_t map;//junk var int main(int argc,char **argv) { @@ -25,12 +25,13 @@ int main(int argc,char **argv) vrl1_vgax_offset_t *vrl_lineoffs; unsigned char *buffer; unsigned int bufsz; - int fd, i; + int fd; + //nibble i; char *bakapee1,*bakapee2; - boolean anim=1,noanim=1; + boolean anim=1,noanim=0; - pan.pn=0; + gvar.video.panp=0; bakapee1=malloc(64); bakapee2=malloc(1024); @@ -75,17 +76,10 @@ int main(int argc,char **argv) } VGAmodeX(1, 1, &gvar); - /* load color palette */ - fd = open(bakapee2,O_RDONLY|O_BINARY); - if (fd >= 0) { - unsigned int i; - - read(fd,palette,768); - close(fd); + modexPalUpdate0(palette); - vga_palette_lseek(0); - for (i=0;i < 256;i++) vga_palette_write(palette[(i*3)+0]>>2,palette[(i*3)+1]>>2,palette[(i*3)+2]>>2); - } + /* load color palette */ + VL_LoadPalFile(bakapee2, &palette); /* preprocess the sprite to generate line offsets */ vrl_lineoffs = vrl1_vgax_genlineoffsets(vrl_header,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header)); @@ -97,38 +91,11 @@ int main(int argc,char **argv) /* setup camera and screen~ */ modexHiganbanaPageSetup(&gvar.video); - modexShowPage(&(gvar.video.page[pan.pn])); - for(i=0;i> 2; - vga_write_sequencer(0x02/*map mask*/,1 << (i&3)); - 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; + //DRAWCORNERBOXES; /* make distinctive pattern offscreen, render sprite, copy onscreen. * this time, we render the distinctive pattern to another offscreen location and just copy. @@ -141,19 +108,16 @@ 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++) { - o = (i >> 2) + (0x10000UL - (uint16_t)gvar.video.page[1].data); + o = (i >> 2) + (0x10000UL - (uint16_t)gvar.video.page[0].data); vga_write_sequencer(0x02/*map mask*/,1 << (i&3)); - for (j=0;j < VMEMHEIGHT;j++,o += gvar.video.page[0].stridew) + for (j=0;j < gvar.video.page[0].height;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; + TESTBG; + //DRAWCORNERBOXES; /* starting coords. note: this technique is limited to x coordinates of multiple of 4 */ x = -(gvar.video.page[0].dx); @@ -165,10 +129,10 @@ int main(int argc,char **argv) while(!IN_KeyDown(sc_Escape)) { IN_ReadControl(0,&player); - PANKEY0EXE; - if(IN_KeyDown(68) || IN_KeyDown(sc_Space)) //f10 and space + if(IN_KeyDown(68)){ gvar.kurokku.fpscap=!gvar.kurokku.fpscap; IN_UserInput(1,1); } //f10 + PANKEYFUN; + if(IN_KeyDown(sc_Space)) //space { - //gvar.kurokku.fpscap=!gvar.kurokku.fpscap; anim=!anim; DRAWCORNERBOXES; IN_UserInput(1,1); @@ -176,14 +140,16 @@ int main(int argc,char **argv) 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])); + modexShowPage(&(gvar.video.page[gvar.video.panp])); player[0].q = 1; player[0].d = 2; x=y=0; xdir=ydir=1; + //TESTBG; + DRAWCORNERBOXES; } //R FUNCTIONKEYFUNCTIONS0EXE; - if(anim/* && !noanim*/) + if(anim && !noanim) { /* render box bounds. y does not need modification, but x and width must be multiple of 4 */ if (x >= overdraw) rx = (x - overdraw) & (~3); @@ -238,15 +204,10 @@ draw_vrl1_vgax_modex(x-rx,y-ry,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header IN_UserInput(1,1); -// while(!IN_KeyDown(sc_Escape)) -// { -// IN_ReadControl(0,&player); -// PANKEY0EXE; -// } - //===========================================================================// - modexShowPage(&(gvar.video.page[0])); + //modexShowPage(&(gvar.video.page[0])); + ZC_ShowMV(&mv, 0, 0); if(!noanim) { /* 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. */ @@ -276,6 +237,7 @@ if(!noanim) { } /* wait for vsync end */ + if(gvar.kurokku.fpscap) vga_wait_for_vsync_end(); /* what scalefactor to use for stretching? */ @@ -320,6 +282,7 @@ if(!noanim) { vga_restore_rm0wm0(); /* wait for vsync */ + if(gvar.kurokku.fpscap) vga_wait_for_vsync(); /* make it shrink */ @@ -336,7 +299,10 @@ if(!noanim) { bufsz = 0; free(bakapee1); free(bakapee2); - //printf("mv 0\n tx=%d ty=%d\n\n", mv[0].tx, mv[0].tx); - //printf("mv 1\n tx=%d ty=%d\n", mv[1].tx, mv[1].tx); + printf("\nProject 16 0.exe. This is just a test file!\n"); + printf("version %s\n", VERSION); + //SCROLLEXITMESG; + printf("mv 0\n- tx=%d ty=%d dx=%d dy=%d\n", mv[0].tx, mv[0].ty, gvar.video.page[0].dx, gvar.video.page[0].dy); + printf("mv 1\n- tx=%d ty=%d dx=%d dy=%d\n", mv[1].tx, mv[1].ty, gvar.video.page[1].dx, gvar.video.page[1].dy); return 0; }