X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2F0.c;h=8734bb659ced166932ea17c4afb735a58dc3866c;hb=c060c91a1c7e418122606fdc5cd7c9ce5a55495d;hp=d6a48249477c1a7223aadd735edc1d97fa7a01be;hpb=0ac21de11c7d70ff39af46d8bec1d50418adbe25;p=16.git
diff --git a/src/0.c b/src/0.c
index d6a48249..8734bb65 100755
--- a/src/0.c
+++ b/src/0.c
@@ -1,3 +1,25 @@
+/* Project 16 Source Code~
+ * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover
+ *
+ * This file is part of Project 16.
+ *
+ * Project 16 is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Project 16 is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see , or
+ * write to the Free Software Foundation, Inc., 51 Franklin Street,
+ * Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
#include
#include
#include
@@ -10,13 +32,12 @@
#define FILENAME_1 "data/spri/chikyuu.vrl"
#define FILENAME_2 "data/spri/chikyuu.pal"
-#define PATTERN
#define INITTNUM 1
-static unsigned char 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,15 +46,14 @@ 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=0;
-
- pan.pn=0;
+ boolean anim=1,noanim=0,zerostoppause=1;
bakapee1=malloc(64);
- bakapee2=malloc(1024);
+ bakapee2=malloc(64);
if (argc < 2) {
//fprintf(stderr,"drawvrl \n palette file optional\n");
@@ -74,20 +94,10 @@ int main(int argc,char **argv)
return 1;
}
VGAmodeX(1, 1, &gvar);
-
- modexPalUpdate0(palette);
+ modexPalUpdate0(gvar.video.palette);
/* load color palette */
- fd = open(bakapee2,O_RDONLY|O_BINARY);
- if (fd >= 0) {
- unsigned int i;
-
- read(fd,palette,768);
- close(fd);
-
- 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);
- }
+ VL_LoadPalFile(bakapee2, &gvar.video.palette);
/* preprocess the sprite to generate line offsets */
vrl_lineoffs = vrl1_vgax_genlineoffsets(vrl_header,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header));
@@ -95,42 +105,17 @@ int main(int argc,char **argv)
IN_Startup();
IN_Default(0,&player,ctrl_Keyboard1);
- IN_initplayer(&player, 0);
+ EN_initplayer(&player, 0, &gvar.video);
/* 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;
+// VL_PatternDraw(video_t *video, word pn, boolean sw, boolean allsw);
+ VL_PatternDraw(&gvar.video, 0/*gvar.video.sp*/, 0, 1);
+ TESTBG34
+ DRAWCORNERBOXES
/* make distinctive pattern offscreen, render sprite, copy onscreen.
* this time, we render the distinctive pattern to another offscreen location and just copy.
@@ -143,19 +128,10 @@ 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);
- 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;
+// VL_PatternDraw(video_t *video, word pn, boolean sw, boolean allsw);
+// VL_PatternDraw(&gvar.video, 0, 1, 1);
+// TESTBG;
+// DRAWCORNERBOXES;
/* starting coords. note: this technique is limited to x coordinates of multiple of 4 */
x = -(gvar.video.page[0].dx);
@@ -167,23 +143,21 @@ 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) || zerostoppause) //space
{
- //gvar.kurokku.fpscap=!gvar.kurokku.fpscap;
anim=!anim;
DRAWCORNERBOXES;
- IN_UserInput(1,1);
+ if(!zerostoppause) IN_UserInput(1,1); else zerostoppause=0;
}
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;
+ VL_ShowPage(&gvar.video.page[gvar.video.sp], 1, 0);
+ player[0].enti.q = 1; player[0].enti.d = 2;
x=y=0;
xdir=ydir=1;
- //TESTBG;
- DRAWCORNERBOXES;
} //R
FUNCTIONKEYFUNCTIONS0EXE;
@@ -201,8 +175,8 @@ int main(int argc,char **argv)
/* block copy pattern to where we will draw the sprite */
vga_setup_wm1_block_copy();
- o2 = gvar.video.page[0].pagesize;
- o = (0x10000UL - (uint16_t)gvar.video.page[1].data) + (ry * gvar.video.page[0].stridew) + (rx >> 2); // source offscreen
+ o2 = gvar.video.page[0].pagesize+gvar.video.page[1].pagesize;
+ o = ((uint16_t)gvar.video.page[2].data) + (ry * gvar.video.page[0].stridew) + (rx >> 2); // source offscreen 0x10000UL -
for (i=0;i < h;i++,o += gvar.video.page[0].stridew,o2 += (w >> 2)) vga_wm1_mem_block_copy(o2,o,w >> 2);
/* must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally */
vga_restore_rm0wm0();
@@ -210,17 +184,18 @@ int main(int argc,char **argv)
/* replace VGA stride with our own and mem ptr. then sprite rendering at this stage is just (0,0) */
vga_state.vga_draw_stride_limit = (gvar.video.page[0].width + 3/*round up*/ - x) >> 2;
vga_state.vga_draw_stride = w >> 2;
- vga_state.vga_graphics_ram = omemptr + gvar.video.page[0].pagesize;
+ vga_state.vga_graphics_ram = omemptr + gvar.video.page[0].pagesize + gvar.video.page[1].pagesize;
/* then the sprite. note modding ram ptr means we just draw to (x&3,0) */
draw_vrl1_vgax_modex(x-rx,y-ry,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header));
+//printf("x=%d y=%d rx=%d ry=%d\n", x, y, rx, ry);
/* restore ptr */
vga_state.vga_graphics_ram = omemptr;
/* block copy to visible RAM from offscreen */
vga_setup_wm1_block_copy();
- o = gvar.video.page[0].pagesize; // source offscreen
+ o = gvar.video.page[0].pagesize+gvar.video.page[1].pagesize; // source offscreen
o2 = (ry * gvar.video.page[0].stridew) + (rx >> 2); // dest visible (original stride)
for (i=0;i < h;i++,o += vga_state.vga_draw_stride,o2 += gvar.video.page[0].stridew) vga_wm1_mem_block_copy(o2,o,w >> 2);
/* must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally */
@@ -242,15 +217,9 @@ 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]));
+ 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. */
@@ -280,6 +249,7 @@ if(!noanim) {
}
/* wait for vsync end */
+ if(gvar.kurokku.fpscap)
vga_wait_for_vsync_end();
/* what scalefactor to use for stretching? */
@@ -324,6 +294,7 @@ if(!noanim) {
vga_restore_rm0wm0();
/* wait for vsync */
+ if(gvar.kurokku.fpscap)
vga_wait_for_vsync();
/* make it shrink */
@@ -340,7 +311,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;
}