OSDN Git Service

Merge branch 'master' of github.com:sparky4/16
authorsparky4 <sparky4@cock.li>
Sun, 17 Apr 2016 22:02:56 +0000 (17:02 -0500)
committersparky4 <sparky4@cock.li>
Sun, 17 Apr 2016 22:02:56 +0000 (17:02 -0500)
14 files changed:
makefile
src/bakapi.c
src/drawvrl5.c [deleted file]
src/lib/16_head.h
src/lib/16_in.c
src/lib/16_in.h
src/lib/bakapee.c
src/lib/doslib
src/lib/modex16.c
src/lib/modex16.h
src/lib/scroll16.c
src/lib/scroll16.h
src/palettel.c
src/scroll.c

index d8b5fd2..da98dc4 100755 (executable)
--- a/makefile
+++ b/makefile
@@ -459,7 +459,7 @@ comq: .symbolic
 
 www: .symbolic
        @ssh -p 26 sparky4@4ch.mooo.com 'rm -f /var/www/16/*exe.zip*'
-       @rm "/var/www/$(EXEC).zip*"
+       @rm -f /var/www/*.exe.zip*
        #@cp ./$(EXEC) $(DIRSEP)var$(DIRSEP)www$(DIRSEP)
        @./z.sh $(EXEC) $(EXEC)
        @scp -r -P 26 *.exe 4ch.mooo.com:/var/www/16/
index 6d04e54..3338870 100755 (executable)
@@ -200,6 +200,7 @@ main(int argc, char *argvar[])
                        VGAmodeX(0, 0, &gvar);
                        // user imput switch
                        //fprintf(stderr, "xx=%d        yy=%d   tile=%d\n", bakapee.xx, bakapee.yy, bakapee.tile);
+                       fprintf(stderr, "dx=%d  dy=%d   ", gvar.video.page[0].dx, gvar.video.page[0].dy);
                        printf("Tiled mode is ");
                        switch (bakapee.tile)
                        {
@@ -302,8 +303,8 @@ pee:
 
 //     xpos+=xdir;
 //     ypos+=ydir;
-//     if( (xpos>(VW-gvar.video.page[0].width-1))  || (xpos<1)){xdir=-xdir;}
-//     if( (ypos>(BH-gvar.video.page[0].height-1)) || (ypos<1)){ydir=-ydir;}
+//     if( (xpos>(gvar.video.page[0].sw-gvar.video.page[0].width-1))  || (xpos<1)){xdir=-xdir;}
+//     if( (ypos>(gvar.video.page[0].sh-gvar.video.page[0].height-1)) || (ypos<1)){ydir=-ydir;}
 //     ch=getch();
        if(ch==0x71)break; // 'q'
        if(ch==0x1b)break; // 'ESC'
diff --git a/src/drawvrl5.c b/src/drawvrl5.c
deleted file mode 100755 (executable)
index 3e01c14..0000000
+++ /dev/null
@@ -1,354 +0,0 @@
-
-#include <stdio.h>
-#include <conio.h> /* this is where Open Watcom hides the outp() etc. functions */
-#include <ctype.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <assert.h>
-#include <fcntl.h>
-#include <math.h>
-#include <dos.h>
-
-#include <hw/cpu/cpu.h>
-#include <hw/dos/dos.h>
-#include <hw/vga/vga.h>
-#include <hw/vga/vrl.h>
-
-static unsigned char palette[768];
-
-int main(int argc,char **argv) {
-       struct vrl1_vgax_header *vrl_header;
-       vrl1_vgax_offset_t *vrl_lineoffs;
-       unsigned char *buffer;
-       unsigned int bufsz;
-       int fd;
-
-       if (argc < 3) {
-               fprintf(stderr,"drawvrl <VRL file> <palette file>\n");
-               return 1;
-       }
-
-       fd = open(argv[1],O_RDONLY|O_BINARY);
-       if (fd < 0) {
-               fprintf(stderr,"Unable to open '%s'\n",argv[1]);
-               return 1;
-       }
-       {
-               unsigned long sz = lseek(fd,0,SEEK_END);
-               if (sz < sizeof(*vrl_header)) return 1;
-               if (sz >= 65535UL) return 1;
-
-               bufsz = (unsigned int)sz;
-               buffer = malloc(bufsz);
-               if (buffer == NULL) return 1;
-
-               lseek(fd,0,SEEK_SET);
-               if ((unsigned int)read(fd,buffer,bufsz) < bufsz) return 1;
-
-               vrl_header = (struct vrl1_vgax_header*)buffer;
-               if (memcmp(vrl_header->vrl_sig,"VRL1",4) || memcmp(vrl_header->fmt_sig,"VGAX",4)) return 1;
-               if (vrl_header->width == 0 || vrl_header->height == 0) return 1;
-       }
-       close(fd);
-
-       probe_dos();
-       if (!probe_vga()) {
-               printf("VGA probe failed\n");
-               return 1;
-       }
-       int10_setmode(19);
-       update_state_from_vga();
-       vga_enable_256color_modex(); // VGA mode X
-       vga_state.vga_width = 320; // VGA lib currently does not update this
-       vga_state.vga_height = 200; // VGA lib currently does not update this
-
-#if 1 // 320x240 test mode: this is how Project 16 is using our code, enable for test case
-       {
-               struct vga_mode_params cm;
-
-               vga_read_crtc_mode(&cm);
-
-               // 320x240 mode 60Hz
-               cm.vertical_total = 525;
-               cm.vertical_start_retrace = 0x1EA;
-               cm.vertical_end_retrace = 0x1EC;
-               cm.vertical_display_end = 480;
-               cm.vertical_blank_start = 489;
-               cm.vertical_blank_end = 517;
-
-               vga_write_crtc_mode(&cm,0);
-       }
-       vga_state.vga_height = 240; // VGA lib currently does not update this
-#endif
-
-       /* load color palette */
-       fd = open(argv[2],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);
-       }
-
-       /* preprocess the sprite to generate line offsets */
-       vrl_lineoffs = vrl1_vgax_genlineoffsets(vrl_header,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header));
-       if (vrl_lineoffs == NULL) return 1;
-
-       {
-               unsigned int i,j,o;
-
-               /* fill screen with a distinctive pattern */
-               for (i=0;i < vga_state.vga_width;i++) {
-                       o = i >> 2;
-                       vga_write_sequencer(0x02/*map mask*/,1 << (i&3));
-                       for (j=0;j < vga_state.vga_height;j++,o += vga_state.vga_stride)
-                               vga_state.vga_graphics_ram[o] = (i^j)&15; // VRL samples put all colors in first 15!
-               }
-       }
-       while (getch() != 13);
-
-       /* make distinctive pattern offscreen, render sprite, copy onscreen */
-       {
-               const unsigned int offscreen_ofs = (vga_state.vga_stride * vga_state.vga_height);
-               unsigned int i,j,o,o2,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.
-                                               // if the sprite's edge pixels are clear anyway, you can set this to 0.
-               VGA_RAM_PTR omemptr;
-               int xdir=1,ydir=1;
-
-               /* starting coords. note: this technique is limited to x coordinates of multiple of 4 */
-               x = 0;
-               y = 0;
-
-               /* 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;
-                       }
-
-                       /* render box bounds. y does not need modification, but x and width must be multiple of 4 */
-                       if (x >= overdraw) rx = (x - overdraw) & (~3);
-                       else rx = 0;
-                       if (y >= overdraw) ry = (y - overdraw);
-                       else ry = 0;
-                       h = vrl_header->height + overdraw + y - ry;
-                       w = (x + vrl_header->width + (overdraw*2) + 3/*round up*/ - rx) & (~3);
-                       if ((rx+w) > vga_state.vga_width) w = vga_state.vga_width-rx;
-                       if ((ry+h) > vga_state.vga_height) h = vga_state.vga_height-ry;
-
-                       /* 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 = (vga_state.vga_width + 3/*round up*/ - x) >> 2;
-                       vga_state.vga_draw_stride = w >> 2;
-                       vga_state.vga_graphics_ram = omemptr + offscreen_ofs;
-
-                       /* first draw pattern corresponding to that part of the screen. this COULD be optimized, obviously, but it's designed for study.
-                        * also note we don't have to use the same stride as the display! */
-                       for (i=rx;i < (rx+w);i++) {
-                               o = (i-rx) >> 2;
-                               vga_write_sequencer(0x02/*map mask*/,1 << (i&3));
-                               for (j=ry;j < (ry+h);j++,o += vga_state.vga_draw_stride)
-                                       vga_state.vga_graphics_ram[o] = (i^j)&15; // VRL samples put all colors in first 15!
-                       }
-
-                       /* 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));
-
-                       /* restore ptr */
-                       vga_state.vga_graphics_ram = omemptr;
-
-                       /* block copy to visible RAM from offscreen */
-                       vga_setup_wm1_block_copy();
-                       o = offscreen_ofs; // source offscreen
-                       o2 = (ry * vga_state.vga_stride) + (rx >> 2); // dest visible (original stride)
-                       for (i=0;i < h;i++,o += vga_state.vga_draw_stride,o2 += vga_state.vga_stride) 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();
-
-                       /* restore stride */
-                       vga_state.vga_draw_stride_limit = vga_state.vga_draw_stride = vga_state.vga_stride;
-
-                       /* step */
-                       x += xdir;
-                       y += ydir;
-                       if (x >= (vga_state.vga_width - 1) || x == 0)
-                               xdir = -xdir;
-                       if (y >= (vga_state.vga_height - 1) || y == 0)
-                               ydir = -ydir;
-               }
-       }
-
-       /* make distinctive pattern offscreen, render sprite, copy onscreen.
-        * this time, we render the distinctive pattern to another offscreen location and just copy.
-        * note this version is much faster too! */
-       {
-               const unsigned int offscreen_ofs = (vga_state.vga_stride * vga_state.vga_height);
-               const unsigned int pattern_ofs = 0x10000UL - (vga_state.vga_stride * vga_state.vga_height);
-               unsigned int i,j,o,o2,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.
-                                               // if the sprite's edge pixels are clear anyway, you can set this to 0.
-               VGA_RAM_PTR omemptr;
-               int xdir=1,ydir=1;
-
-               /* fill pattern offset with a distinctive pattern */
-               for (i=0;i < vga_state.vga_width;i++) {
-                       o = (i >> 2) + pattern_ofs;
-                       vga_write_sequencer(0x02/*map mask*/,1 << (i&3));
-                       for (j=0;j < vga_state.vga_height;j++,o += vga_state.vga_stride)
-                               vga_state.vga_graphics_ram[o] = (i^j)&15; // VRL samples put all colors in first 15!
-               }
-
-               /* starting coords. note: this technique is limited to x coordinates of multiple of 4 */
-               x = 0;
-               y = 0;
-
-               /* 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;
-                       }
-
-                       /* render box bounds. y does not need modification, but x and width must be multiple of 4 */
-                       if (x >= overdraw) rx = (x - overdraw) & (~3);
-                       else rx = 0;
-                       if (y >= overdraw) ry = (y - overdraw);
-                       else ry = 0;
-                       h = vrl_header->height + overdraw + y - ry;
-                       w = (x + vrl_header->width + (overdraw*2) + 3/*round up*/ - rx) & (~3);
-                       if ((rx+w) > vga_state.vga_width) w = vga_state.vga_width-rx;
-                       if ((ry+h) > vga_state.vga_height) h = vga_state.vga_height-ry;
-
-                       /* block copy pattern to where we will draw the sprite */
-                       vga_setup_wm1_block_copy();
-                       o2 = offscreen_ofs;
-                       o = pattern_ofs + (ry * vga_state.vga_stride) + (rx >> 2); // source offscreen
-                       for (i=0;i < h;i++,o += vga_state.vga_stride,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();
-
-                       /* 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 = (vga_state.vga_width + 3/*round up*/ - x) >> 2;
-                       vga_state.vga_draw_stride = w >> 2;
-                       vga_state.vga_graphics_ram = omemptr + offscreen_ofs;
-
-                       /* 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));
-
-                       /* restore ptr */
-                       vga_state.vga_graphics_ram = omemptr;
-
-                       /* block copy to visible RAM from offscreen */
-                       vga_setup_wm1_block_copy();
-                       o = offscreen_ofs; // source offscreen
-                       o2 = (ry * vga_state.vga_stride) + (rx >> 2); // dest visible (original stride)
-                       for (i=0;i < h;i++,o += vga_state.vga_draw_stride,o2 += vga_state.vga_stride) 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();
-
-                       /* restore stride */
-                       vga_state.vga_draw_stride_limit = vga_state.vga_draw_stride = vga_state.vga_stride;
-
-                       /* step */
-                       x += xdir;
-                       y += ydir;
-                       if (x >= (vga_state.vga_width - 1) || x == 0)
-                               xdir = -xdir;
-                       if (y >= (vga_state.vga_height - 1) || y == 0)
-                               ydir = -ydir;
-               }
-       }
-
-       /* 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. */
-       {
-               unsigned int blank_line_ofs = (vga_state.vga_stride * vga_state.vga_height * 2);
-               unsigned int copy_ofs = (vga_state.vga_stride * vga_state.vga_height);
-               unsigned int display_ofs = 0x0000;
-               unsigned int i,y,soh,doh,dstart;
-               unsigned int dh_blankfill = 8;
-               unsigned int dh_step = 8;
-               uint32_t sh,dh,yf,ystep;
-
-               /* copy active display (0) to offscreen buffer (0x4000) */
-               vga_state.vga_draw_stride_limit = vga_state.vga_draw_stride = vga_state.vga_stride;
-               vga_setup_wm1_block_copy();
-               vga_wm1_mem_block_copy(copy_ofs,display_ofs,vga_state.vga_stride * vga_state.vga_height);
-               vga_restore_rm0wm0();
-
-               /* need a blank line as well */
-               for (i=0;i < vga_state.vga_stride;i++) vga_state.vga_graphics_ram[i+blank_line_ofs] = 0;
-
-               sh = dh = vga_state.vga_height;
-               while (dh >= dh_step) {
-                       /* stop animating if the user hits ENTER */
-                       if (kbhit()) {
-                               if (getch() == 13) break;
-                       }
-
-                       /* wait for vsync end */
-                       vga_wait_for_vsync_end();
-
-                       /* what scalefactor to use for stretching? */
-                       ystep = (0x10000UL * sh) / dh;
-                       dstart = (vga_state.vga_height - dh) / 2; // center the squash effect on screen, otherwise it would squash to top of screen
-                       doh = display_ofs;
-                       soh = copy_ofs;
-                       yf = 0;
-                       y = 0;
-
-                       /* for performance, keep VGA in write mode 1 the entire render */
-                       vga_setup_wm1_block_copy();
-
-                       /* blank lines */
-                       if (dstart >= dh_blankfill) y = dstart - dh_blankfill;
-                       else y = 0;
-                       doh = vga_state.vga_stride * y;
-
-                       while (y < dstart) {
-                               vga_wm1_mem_block_copy(doh,blank_line_ofs,vga_state.vga_stride);
-                               doh += vga_state.vga_stride;
-                               y++;
-                       }
-
-                       /* draw */
-                       while (y < (dh+dstart)) {
-                               soh = copy_ofs + ((yf >> 16UL) * vga_state.vga_stride);
-                               vga_wm1_mem_block_copy(doh,soh,vga_state.vga_stride);
-                               doh += vga_state.vga_stride;
-                               yf += ystep;
-                               y++;
-                       }
-
-                       /* blank lines */
-                       while (y < vga_state.vga_height && y < (dh+dstart+dh_blankfill)) {
-                               vga_wm1_mem_block_copy(doh,blank_line_ofs,vga_state.vga_stride);
-                               doh += vga_state.vga_stride;
-                               y++;
-                       }
-
-                       /* done */
-                       vga_restore_rm0wm0();
-
-                       /* wait for vsync */
-                       vga_wait_for_vsync();
-
-                       /* make it shrink */
-                       dh -= dh_step;
-                       if (dh < 40) dh_step = 1;
-               }
-       }
-
-       int10_setmode(3);
-       free(vrl_lineoffs);
-       buffer = NULL;
-       free(buffer);
-       bufsz = 0;
-       return 0;
-}
-
index 3217ea2..4b9972f 100755 (executable)
@@ -50,6 +50,7 @@
 #include "src/lib/nyan/kitten.h"\r
 #include "src/lib/types.h"\r
 #include "src/lib/typdefst.h"\r
+#include "src/lib/16_in.h"\r
 \r
 #define VERSION __DATE__ " " __TIME__\r
 \r
index aef50c6..5bcceca 100755 (executable)
@@ -1282,3 +1282,19 @@ boolean IN_qb(byte kee)
        if(inpu.Keyboard[kee]==true) return 1;\r
        else return 0;\r
 }\r
+\r
+//init player!\r
+void IN_initplayer(player_t *player, word pn)\r
+{\r
+       player[pn].x = player[pn].tx*TILEWH;\r
+       player[pn].y = player[pn].ty*TILEWH;\r
+       player[pn].triggerx = player[pn].tx;\r
+       player[pn].triggery = player[pn].ty+1;\r
+/*     player[0].info.x = player[0].tx;\r
+       player[0].info.xaxis = player[0].tx*TILEWH;\r
+       player[0].info.y = player[0].ty;\r
+       player[0].info.yaxis = player[0].ty*TILEWH;*/\r
+       player[pn].q=1;\r
+       player[pn].d=2;\r
+       player[pn].hp=4;\r
+}\r
index 0990a55..78ebd80 100755 (executable)
@@ -303,5 +303,6 @@ extern boolean IN_UserInput(dword delay,boolean clear);
 extern boolean IN_KeyDown(byte code);\r
 extern void IN_ClearKey(byte code);\r
 extern boolean IN_qb(byte kee);\r
+void IN_initplayer(player_t *player, word pn);\r
 \r
 #endif\r
index 1626fd1..8b40f96 100755 (executable)
@@ -34,7 +34,7 @@ void colortest(page_t *page, bakapee_t *pee)
 {
        //if(pee->coor < 256)
        //{
-               cls(page, pee->coor, VGA);
+               modexcls(page, pee->coor, VGA);
                pee->coor++;
        //}else pee->coor = 0;
 }
@@ -44,7 +44,7 @@ void colorz(page_t *page, bakapee_t *pee)
 {
        if(pee->coor <= HGQ)
        {
-               cls(page, pee->coor, VGA);
+               modexcls(page, pee->coor, VGA);
                pee->coor++;
        }else pee->coor = LGQ;
 }
@@ -228,7 +228,7 @@ void ding(page_t *page, bakapee_t *pee, word q)
                break;
                case 6:
                        pee->coor = rand()%256;
-                       cls(page, pee->coor, VGA);
+                       modexcls(page, pee->coor, VGA);
                break;
                case 7:
                        if(pee->coor <= HGQ)
index 05fc315..8d9eb18 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 05fc315e3b435866873be945a61f672f62f9199d
+Subproject commit 8d9eb184986637b9bc9afa7e02c548ae5377aaff
index 42d4f6c..6f8d64f 100755 (executable)
@@ -545,7 +545,8 @@ modexPalUpdate(bitmap_t *bmp, word *i, word qp, word aqoffset)
        static word a[PAL_SIZE];        //palette array of change values!\r
        word z=0, aq=0, aa=0, pp=0;\r
 \r
-       modexWaitBorder();\r
+       //modexWaitBorder();\r
+       vga_wait_for_vsync();\r
        if((*i)==0)\r
        {\r
                memset(a, -1, sizeof(a));\r
@@ -595,7 +596,8 @@ modexPalUpdate(bitmap_t *bmp, word *i, word qp, word aqoffset)
                //if(qp>0) printf("qp=%d\n", qp);\r
                //if(qp>0) printf("                                          (*i)=%d\n", (*i)/3);\r
        }\r
-       modexWaitBorder();        /* waits one retrace -- less flicker */\r
+       //modexWaitBorder();      /* waits one retrace -- less flicker */\r
+       vga_wait_for_vsync();\r
        if((*i)>=PAL_SIZE/2 && w==0)\r
        {\r
                for(; (*i)<PAL_SIZE; (*i)++)\r
@@ -634,7 +636,7 @@ printf("\nqqqqqqqq\n\n");
                pp = q;\r
                //printf("1(*i)=%02d\n", (*i)/3);\r
                //printf("1z=%02d\n", z/3);\r
-               chkcolor(bmp, &q, &a, &aa, &z, i);\r
+               modexchkcolor(bmp, &q, &a, &aa, &z, i);\r
                //printf("2(*i)=%02d\n", (*i)/3);\r
                //printf("2z=%02d\n", z/3);\r
                aq=0;\r
@@ -706,13 +708,15 @@ void
 modexPalUpdate1(byte *p)\r
 {\r
        int i;\r
-       modexWaitBorder();\r
+       //modexWaitBorder();\r
+       vga_wait_for_vsync();\r
        outp(PAL_WRITE_REG, 0);  /* start at the beginning of palette */\r
        for(i=0; i<PAL_SIZE/2; i++)\r
        {\r
                outp(PAL_DATA_REG, p[i]);\r
        }\r
-       modexWaitBorder();        /* waits one retrace -- less flicker */\r
+       //modexWaitBorder();      /* waits one retrace -- less flicker */\r
+       vga_wait_for_vsync();\r
        for(; i<PAL_SIZE; i++)\r
        {\r
                outp(PAL_DATA_REG, p[(i)]);\r
@@ -723,13 +727,15 @@ void
 modexPalUpdate0(byte *p)\r
 {\r
        int i;\r
-       modexWaitBorder();\r
+       //modexWaitBorder();\r
+       vga_wait_for_vsync();\r
        outp(PAL_WRITE_REG, 0);  /* start at the beginning of palette */\r
        for(i=0; i<PAL_SIZE/2; i++)\r
        {\r
                outp(PAL_DATA_REG, rand());\r
        }\r
-       modexWaitBorder();        /* waits one retrace -- less flicker */\r
+       //modexWaitBorder();      /* waits one retrace -- less flicker */\r
+       vga_wait_for_vsync();\r
        for(; i<PAL_SIZE; i++)\r
        {\r
                outp(PAL_DATA_REG, rand());\r
@@ -739,14 +745,15 @@ modexPalUpdate0(byte *p)
 void\r
 modexPalOverscan(byte *p, word col)\r
 {\r
-       modexWaitBorder();\r
+       //modexWaitBorder();\r
+       vga_wait_for_vsync();\r
        outp(PAL_WRITE_REG, 0);  /* start at the beginning of palette */\r
        outp(PAL_DATA_REG, col);\r
 }\r
 \r
 //color checker~\r
 //i want to make another vesion that checks the palette when the palette is being appened~\r
-void chkcolor(bitmap_t *bmp, word *q, word *a, word *aa, word *z, word *i/*, word *offset*/)\r
+void modexchkcolor(bitmap_t *bmp, word *q, word *a, word *aa, word *z, word *i/*, word *offset*/)\r
 {\r
                byte *pal;\r
                word zz=0;\r
@@ -999,7 +1006,7 @@ void modexprintbig(page_t *page, word x, word y, word t, word col, word bgcol, c
 }\r
 \r
 /* palette dump on display! */\r
-void pdump(page_t *pee)\r
+void modexpdump(page_t *pee)\r
 {\r
        int mult=(QUADWH);\r
        int palq=(mult)*TILEWH;\r
@@ -1019,7 +1026,7 @@ void pdump(page_t *pee)
 //              the Virtual screen.                                                                                     //\r
 //                                                                                                                                              //\r
 /////////////////////////////////////////////////////////////////////////////\r
-void cls(page_t *page, byte color, byte *Where)\r
+void modexcls(page_t *page, byte color, byte *Where)\r
 {\r
        //modexClearRegion(page, 0, 0, page->width, page->height, color);\r
        /* set map mask to all 4 planes */\r
@@ -1028,13 +1035,13 @@ void cls(page_t *page, byte color, byte *Where)
        _fmemset(Where, color, page->width*(page->height)/4);\r
 }\r
 \r
-void\r
+/*void\r
 modexWaitBorder() {\r
     while(inp(INPUT_STATUS_1)  & 8)  {\r
-       /* spin */\r
+       // spin\r
     }\r
 \r
     while(!(inp(INPUT_STATUS_1)  & 8))  {\r
-       /* spin */\r
+       // spin\r
     }\r
-}\r
+}*/\r
index 3621466..acdf63e 100755 (executable)
@@ -120,15 +120,15 @@ void modexPalUpdate(bitmap_t *bmp, word *i, word qp, word aqoffset);
 void modexPalUpdate1(byte *p);
 void modexPalUpdate0(byte *p);
 void modexPalOverscan(byte *p, word col);
-void chkcolor(bitmap_t *bmp, word *q, word *a, word *aa, word *z, word *i/*, word *offset*/);
+void modexchkcolor(bitmap_t *bmp, word *q, word *a, word *aa, word *z, word *i/*, word *offset*/);
 void modexputPixel(page_t *page, int x, int y, byte color);
 byte modexgetPixel(page_t *page, int x, int y);
 void modexhlin(page_t *page, word xl, word xh, word y, word color);
 void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str, boolean q);
 void modexprintbig(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str);
-void pdump(page_t *pee);
-void cls(page_t *page, byte color, byte *Where);
-void modexWaitBorder();
+void modexpdump(page_t *pee);
+void modexcls(page_t *page, byte color, byte *Where);
+//void modexWaitBorder();
 
 /* -======================= Constants & Vars ==========================- */
 extern byte far*  VGA;  /* The VGA Memory */
index 4163495..e71079a 100755 (executable)
@@ -489,6 +489,8 @@ mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y)
                                //cannot print number value du to it being slow as bakapee
 #else
                                PBUFBFUN                (page, x, y, rx, ry, t->tileWidth, t->tileHeight, (t->data));
+                               /* 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));
                                //modexDrawBmpRegion    (page, x, y, rx, ry, t->tileWidth, t->tileHeight, (t->data));
 #endif
                        break;
@@ -613,7 +615,8 @@ void shinku(map_view_t *pip, global_game_variables_t *gv)
                break;
                case 1:
                        //turn this off if XT
-                       modexWaitBorder();
+                       //modexWaitBorder();
+                       vga_wait_for_vsync();
                        gv->kurokku.frames_per_second=60;
                break;
        }
@@ -662,6 +665,10 @@ void near animatePlayer(map_view_t *pip, player_t *player, word pn, sword scroll
        }
 
 #ifdef SPRITE
+// #define FRAME1 PBUFSFUN(pip[1].page, x, y, 48, dire, 24, 32,        PLAYERBMPDATA);
+// #define FRAME2 PBUFSFUN(pip[1].page, x, y, 24, dire, 24, 32,        PLAYERBMPDATA);
+// #define FRAME3 PBUFSFUN(pip[1].page, x, y, 0, dire, 24, 32, PLAYERBMPDATA);
+// #define FRAME4 PBUFSFUN(pip[1].page, x, y, 24, dire, 24, 32,        PLAYERBMPDATA);
 #define FRAME1 PBUFSFUN(pip[1].page, x, y, 48, dire, 24, 32,   PLAYERBMPDATA);
 #define FRAME2 PBUFSFUN(pip[1].page, x, y, 24, dire, 24, 32,   PLAYERBMPDATA);
 #define FRAME3 PBUFSFUN(pip[1].page, x, y, 0, dire, 24, 32,    PLAYERBMPDATA);
index b39e95b..d55d395 100755 (executable)
@@ -34,7 +34,7 @@
 #include "src/lib/wcpu/wcpu.h"
 
 //#define SPRITE
-#define TILERENDER
+//#define TILERENDER
 
 #define PBUFSFUN               modexDrawSpritePBufRegion
 #define PBUFBFUN               modexDrawBmpPBufRegion
index d07452b..5ce5c80 100755 (executable)
@@ -45,7 +45,7 @@ main(int argc, char *argv[])
        modexLoadPalFile(bakapee, &pal);\r
        modexPalUpdate1(pal);\r
        modexFadeOn(1, pal);\r
-       pdump(&gvar.video.page[0]);\r
+       modexpdump(&gvar.video.page[0]);\r
        getch();\r
        VGAmodeX(0, 0, &gvar);\r
        modexPalUpdate1(pal);\r
index 53b86d6..e2ca23c 100755 (executable)
@@ -34,7 +34,6 @@ static map_t map;
 player_t player[MaxPlayers];
 //page_t screen, gvar.video.page[1], gvar.video.page[2];
 map_view_t mv[3];
-map_view_t *bg, *spri, *mask;//, *tmp;
 bitmap_t p;
 word pn=0;
 static planar_buf_t huge *pp;
@@ -85,8 +84,6 @@ void main(int argc, char *argv[])
                return;
        }
 
-       testcontrolnoisy=0;
-
        player[0].persist_aniframe=0;
        player[0].speed=4;
        //player[0].data = &pp;
@@ -148,7 +145,7 @@ void main(int argc, char *argv[])
 //++++ player[0].data.offset=(paloffset/3);
 //++++ modexPalUpdate1(&player[0].data, &paloffset, 0, 0);
                //modexPalUpdate1(p.palette);
-               modexPalUpdate1(map.tiles->btdata->palette);
+//++++0000             modexPalUpdate1(map.tiles->btdata->palette);
        //printf("      %d\n", sizeof(ptmp->data));
        //printf("1:    %d\n", paloffset);
 //++++ map.tiles->data->offset=(paloffset/3);
@@ -168,7 +165,7 @@ void main(int argc, char *argv[])
        /* setup camera and screen~ */
        gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]);
        gvar.video.page[0].width += (TILEWH*2);
-       gvar.video.page[0].height += (TILEWH*2);//+QUADWH;
+       gvar.video.page[0].height += (TILEWH*2);
        mv[0].page = &gvar.video.page[0];
        gvar.video.page[1] = modexNextPage(mv[0].page);
        mv[1].page = &gvar.video.page[1];
@@ -178,51 +175,25 @@ void main(int argc, char *argv[])
        mv[2].page = &gvar.video.page[2];
 
        /* set up paging */
-       bg = &mv[0];
-       spri = &mv[1];
-       mask = &mv[2];
-//IN_Ack();
 //TODO: LOAD map data and position the map in the middle of the screen if smaller then screen
-       mapGoTo(bg, 0, 0);
-       mapGoTo(spri, 0, 0);
+       mapGoTo(&mv[0], 0, 0);
+       mapGoTo(&mv[1], 0, 0);
        //mapGoTo(mask, 0, 0);
-//IN_Ack();
        //TODO: put player in starting position of spot
        //default player position on the viewable map
-       player[0].tx = bg->tx + bg->page->tilemidposscreenx;
-       player[0].ty = bg->ty + bg->page->tilemidposscreeny;
-       player[0].x = player[0].tx*TILEWH;
-       player[0].y = player[0].ty*TILEWH;
-       player[0].triggerx = player[0].tx;
-       player[0].triggery = player[0].ty+1;
-/*     player[0].info.x = player[0].tx;
-       player[0].info.xaxis = player[0].tx*TILEWH;
-       player[0].info.y = player[0].ty;
-       player[0].info.yaxis = player[0].ty*TILEWH;*/
-       player[0].q=1;
-       player[0].d=2;
-       player[0].hp=4;
-//     player[0].persist_aniframe=0;
-       //npc
-       /*npc0.tx = bg->tx + 1;
-       npc0.ty = bg->ty + 1;
-       npc0.x = npc0.tx*TILEWH;
-       npc0.y = npc0.ty*TILEWH;
-       npc0.triggerx = npc0.tx;
-       npc0.triggery = npc0.ty+1;
-       npc0.q=1;
-       npc0.d=0;
-       modexDrawSpriteRegion(spri->page, npc0.x-4, npc0.y-TILEWH, 24, 64, 24, 32, &npctmp);*/
+       player[0].tx = mv[0].tx + mv[0].page->tilemidposscreenx;
+       player[0].ty = mv[0].ty + mv[0].page->tilemidposscreeny;
+       IN_initplayer(&player, 0);
 
        modexCopyPageRegion(mv[1].page, mv[0].page, 0, 0, 0, 0, mv[0].page->width, mv[0].page->height);
 #ifndef        SPRITE
        modexClearRegion(mv[1].page, player[0].x-4, player[0].y-TILEWH, 24, 32, 15);
 #else
-       //PBUFSFUN(spri->page, player[0].x-4, player[0].y-TILEWH, 24, 64, 24, 32,       PLAYERBMPDATA);
-       PBUFSFUN(spri->page, player[0].x-4, player[0].y-TILEWH, 24, 64, 24, 32, &pp);
+       //PBUFSFUN(mv[1].page, player[0].x-4, player[0].y-TILEWH, 24, 64, 24, 32,       PLAYERBMPDATA);
+       PBUFSFUN(mv[1].page, player[0].x-4, player[0].y-TILEWH, 24, 64, 24, 32, &pp);
 #endif
 
-       modexShowPage(spri->page);
+       modexShowPage(mv[1].page);
        //modexClearRegion(mv[2].page, 0, 0, mv[2].page->width, mv[2].page->height, 1);
 #ifdef MODEX
 #ifdef FADE
@@ -252,18 +223,18 @@ void main(int argc, char *argv[])
                                {
                                        case 0:
                                                //bg
-                                               bg->page->dx++;
-                                               modexShowPage(bg->page);
+                                               mv[0].page->dx++;
+                                               modexShowPage(mv[0].page);
                                        break;
                                        case 1:
                                                //spri
-                                               spri->page->dx++;
-                                               modexShowPage(spri->page);
+                                               mv[1].page->dx++;
+                                               modexShowPage(mv[1].page);
                                        break;
                                        case 2:
                                                //fg
-                                               mask->page->dx++;
-                                               modexShowPage(mask->page);
+                                               mv[2].page->dx++;
+                                               modexShowPage(mv[2].page);
                                        break;
                                }
                                panq++;
@@ -279,18 +250,18 @@ void main(int argc, char *argv[])
                                {
                                        case 0:
                                                //bg
-                                               bg->page->dx--;
-                                               modexShowPage(bg->page);
+                                               mv[0].page->dx--;
+                                               modexShowPage(mv[0].page);
                                        break;
                                        case 1:
                                                //spri
-                                               spri->page->dx--;
-                                               modexShowPage(spri->page);
+                                               mv[1].page->dx--;
+                                               modexShowPage(mv[1].page);
                                        break;
                                        case 2:
                                                //fg
-                                               mask->page->dx--;
-                                               modexShowPage(mask->page);
+                                               mv[2].page->dx--;
+                                               modexShowPage(mv[2].page);
                                        break;
                                }
                                panq++;
@@ -306,18 +277,18 @@ void main(int argc, char *argv[])
                                {
                                        case 0:
                                                //bg
-                                               bg->page->dy--;
-                                               modexShowPage(bg->page);
+                                               mv[0].page->dy--;
+                                               modexShowPage(mv[0].page);
                                        break;
                                        case 1:
                                                //spri
-                                               spri->page->dy--;
-                                               modexShowPage(spri->page);
+                                               mv[1].page->dy--;
+                                               modexShowPage(mv[1].page);
                                        break;
                                        case 2:
                                                //fg
-                                               mask->page->dy--;
-                                               modexShowPage(mask->page);
+                                               mv[2].page->dy--;
+                                               modexShowPage(mv[2].page);
                                        break;
                                }
                                panq++;
@@ -333,18 +304,18 @@ void main(int argc, char *argv[])
                                {
                                        case 0:
                                                //bg
-                                               bg->page->dy++;
-                                               modexShowPage(bg->page);
+                                               mv[0].page->dy++;
+                                               modexShowPage(mv[0].page);
                                        break;
                                        case 1:
                                                //spri
-                                               spri->page->dy++;
-                                               modexShowPage(spri->page);
+                                               mv[1].page->dy++;
+                                               modexShowPage(mv[1].page);
                                        break;
                                        case 2:
                                                //fg
-                                               mask->page->dy++;
-                                               modexShowPage(mask->page);
+                                               mv[2].page->dy++;
+                                               modexShowPage(mv[2].page);
                                        break;
                                }
                                panq++;
@@ -356,7 +327,7 @@ void main(int argc, char *argv[])
        //the scripting stuf....
 
        //if(((player[0].triggerx == TRIGGX && player[0].triggery == TRIGGY) && IN_KeyDown(0x1C))||(player[0].tx == 5 && player[0].ty == 5))
-       if(((bg->map->data[(player[0].triggerx-1)+(map.width*(player[0].triggery-1))] == 0) && IN_KeyDown(0x1C))||(player[0].tx == 5 && player[0].ty == 5))
+       if(((mv[0].map->data[(player[0].triggerx-1)+(map.width*(player[0].triggery-1))] == 0) && IN_KeyDown(0x1C))||(player[0].tx == 5 && player[0].ty == 5))
        {
                short i;
                for(i=800; i>=400; i--)
@@ -368,19 +339,19 @@ void main(int argc, char *argv[])
        if(player[0].q == (TILEWH/(player[0].speed))+1 && player[0].info.dir != 2 && (player[0].triggerx == 5 && player[0].triggery == 5)){ player[0].hp--; }
        //debugging binds!
        //if(IN_KeyDown(0x0E)) while(1){ if(xmsmalloc(24)) break; }
-       if(IN_KeyDown(2)){ modexShowPage(bg->page); panpagenum=0; }
-       if(IN_KeyDown(3)){ modexShowPage(spri->page); panpagenum=1; }
-       if(IN_KeyDown(4)){ modexShowPage(mask->page); panpagenum=2; }
-       if(IN_KeyDown(25)){ pdump(bg->page); pdump(spri->page); }       //p
+       if(IN_KeyDown(2)){ modexShowPage(mv[0].page); panpagenum=0; }
+       if(IN_KeyDown(3)){ modexShowPage(mv[1].page); panpagenum=1; }
+       if(IN_KeyDown(4)){ modexShowPage(mv[2].page); panpagenum=2; }
+       if(IN_KeyDown(25)){ modexpdump(mv[0].page); modexpdump(mv[1].page); }   //p
 #ifdef MODEX
 #ifdef FADE
-       if(IN_KeyDown(24)){ modexPalUpdate0(gpal); paloffset=0; pdump(bg->page); pdump(spri->page); }
+       if(IN_KeyDown(24)){ modexPalUpdate0(gpal); paloffset=0; modexpdump(mv[0].page); modexpdump(mv[1].page); }
        if(IN_KeyDown(22)){
        paloffset=0; modexPalBlack(); modexPalUpdate(&player[0].data, &paloffset, 0, 0);
        printf("1paloffset      =       %d\n", paloffset/3);
         modexPalUpdate(map.tiles->data, &paloffset, 0, 0);
        printf("2paloffset      =       %d\n", paloffset/3);
-        pdump(bg->page); pdump(spri->page); }
+        modexpdump(mv[0].page); modexpdump(mv[1].page); }
 #endif
 #endif
        //pan switch
@@ -436,8 +407,8 @@ void main(int argc, char *argv[])
        IN_Shutdown();
        printf("Project 16 scroll.exe. This is just a test file!\n");
        printf("version %s\n", VERSION);
-       printf("tx: %d\n", bg->tx);
-       printf("ty: %d\n", bg->ty);
+       printf("tx: %d\n", mv[0].tx);
+       printf("ty: %d\n", mv[0].ty);
        printf("player[0].x: %d", player[0].x); printf("                player[0].y: %d\n", player[0].y);
        //if(player[0].hp==0) printf("%d wwww\n", player[0].y+8);
        //else printf("\nplayer[0].y: %d\n", player[0].y);
@@ -445,7 +416,7 @@ void main(int argc, char *argv[])
        printf("player[0].triggx: %d", player[0].triggerx); printf("    player[0].triggy: %d\n", player[0].triggery);
        printf("player[0].hp: %d", (player[0].hp));     printf("        player[0].q: %d", player[0].q); printf("        player[0].info.dir: %d", player[0].info.dir);   printf("        player[0].d: %d\n", player[0].d);
                printf("pdir=%d\n", player[0].pdir);
-       printf("tile data value at player trigger position: %d\n", bg->map->data[(player[0].triggerx-1)+(map.width*(player[0].triggery-1))]);
+       printf("tile data value at player trigger position: %d\n", mv[0].map->data[(player[0].triggerx-1)+(map.width*(player[0].triggery-1))]);
 //     printf("palette offset: %d\n", paloffset/3);
 //++++ printf("Total used: %zu\n", oldfreemem-GetFreeSize());
 //++++ printf("Total free: %zu\n", GetFreeSize());
@@ -460,7 +431,7 @@ void main(int argc, char *argv[])
 //     printf("\n");
 //     printf("player[0].info.x: %d", player[0].info.xaxis); printf("          player[0].info.y: %d\n", player[0].info.yaxis);
 //     printf("player[0].info.tx: %d", player[0].info.x); printf("             player[0].info.ty: %d\n", player[0].info.y);
-       //printf("map.width=%d  map.height=%d   map.data[0]=%d\n", bg->map->width, bg->map->height, bg->map->data[0]);
+       //printf("map.width=%d  map.height=%d   map.data[0]=%d\n", mv[0].map->width, mv[0].map->height, mv[0].map->data[0]);
 
        switch(detectcpu())
        {