]> 4ch.mooo.com Git - 16.git/commitdiff
p16 is being worked on a bunch by me wwww [16_ca needs huge amounts of work and I...
authorsparky4 <sparky4@cock.li>
Thu, 13 Apr 2017 16:26:32 +0000 (11:26 -0500)
committersparky4 <sparky4@cock.li>
Thu, 13 Apr 2017 16:26:32 +0000 (11:26 -0500)
21 files changed:
NO_NAME.GIF [new file with mode: 0755]
data/16.pal
data/G.PAL
makefile
src/0.c
src/bakapi.c
src/bakapi.h
src/exmmtest.c
src/lib/16_tail.c
src/lib/16_tail.h
src/lib/16_tail_.c
src/lib/16_vl.c
src/lib/16_vl.h
src/lib/16_vl_1.c
src/lib/bakapee.c
src/lib/bakapee.h
src/lib/scroll16.c
src/palettel.c
src/vidtest.c
src/vrstest.c
src/xcroll.c

diff --git a/NO_NAME.GIF b/NO_NAME.GIF
new file mode 100755 (executable)
index 0000000..a2bb4e9
Binary files /dev/null and b/NO_NAME.GIF differ
index f05da004cad15f399871fc26601235b9c128263a..2fbadd3e544daa80dba9ed7d220bb2e2a46be303 100755 (executable)
Binary files a/data/16.pal and b/data/16.pal differ
index eb359e82a594533d6532f55e134770124ae84393..9e8a2ed5c97ad1b2995ab2c7b87588037e3a785a 100755 (executable)
Binary files a/data/G.PAL and b/data/G.PAL differ
index e8658adb37f4ce9ef245d523ef4df6a2bd4992c4..f8c1871ecdd71ebe3a8529514130be110a32cf5a 100755 (executable)
--- a/makefile
+++ b/makefile
@@ -250,7 +250,7 @@ testexec: $(EXEC) $(TESTEXEC2)
 # game and bakapi executables
 #
 16.exe:                16.$(OBJ) $(16LIB) gfx.lib $(DOSLIB)
-bakapi.exe:            bakapi.$(OBJ) gfx.lib $(DOSLIB) 16_wcpu.$(OBJ)
+bakapi.exe:            bakapi.$(OBJ) 16_vl.$(OBJ) 16_vl_1.$(OBJ) 16text.$(OBJ) bakapee.$(OBJ) $(DOSLIB) 16_wcpu.$(OBJ)# gfx.lib
 
 #
 # Test Executables!
diff --git a/src/0.c b/src/0.c
index fff125c455c9ac92d25f6a57cd0a58be1cc57097..b35486206887c1c214e97c0cccd90ed0c5488319 100755 (executable)
--- a/src/0.c
+++ b/src/0.c
@@ -100,7 +100,7 @@ int main(int argc,char **argv)
        VL_modexPalScramble(gvar.video.palette);\r
 \r
        /* load color palette */\r
-       VL_LoadPalFile(bakapee2, &gvar.video.palette);\r
+       VL_LoadPalFile(bakapee2, &gvar.video.palette, &gvar);\r
 \r
        /* preprocess the sprite to generate line offsets */\r
        vrl_lineoffs = vrl1_vgax_genlineoffsets(vrl_header,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header));\r
index 452bc7171b8b516e71499d07c1e161f13016659f..3a9c74698efe5decdfdcaa0ea9d2299069ffdffc 100755 (executable)
@@ -35,11 +35,14 @@ void
 main(int argc, char *argvar[])\r
 {\r
        static global_game_variables_t gvar;\r
+       struct glob_game_vars   *ggvv;\r
        char *a;\r
        int i;\r
        word panq=1, pand=0;\r
        boolean panswitch=0;\r
 \r
+       ggvv=&gvar;\r
+\r
        // allow changing default mode from command line\r
        for (i=1;i < argc;) {\r
                a = argvar[i++];\r
@@ -126,12 +129,23 @@ main(int argc, char *argvar[])
 \r
        /* setup camera and screen~ */\r
        gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]);\r
+       gvar.video.page[1] = modexNextPage(&gvar.video.page[0]);\r
 \r
        //modexPalUpdate(bmp.palette); //____\r
        //modexDrawBmp(VGA, 0, 0, &bmp, 0); //____\r
        //getch(); //____\r
 \r
        VL_ShowPage(&gvar.video.page[0], 0, 0);\r
+       {\r
+               word w;\r
+               for(w=0;w<64000;w++)\r
+               {\r
+                       ding(&gvar.video.page[1], &bakapee, 4);\r
+               }\r
+               if(!baka_FizzleFade (&gvar.video.page[1], &gvar.video.page[0], 70, true, &gvar))\r
+               modexprint(&gvar.video.page[0], gvar.video.page[0].sw/2, gvar.video.page[0].sh/2, 1, 0, 47, 0, 1, "bakapi ok");\r
+       }\r
+       while(!kbhit()){}\r
 \r
 // screen savers\r
 //#ifdef BOINK\r
@@ -148,8 +162,8 @@ main(int argc, char *argvar[])
                                }else c=getch();\r
                        }\r
 \r
-                       if(!panswitch)  ding(&gvar.video.page[0], &bakapee, key);\r
-                       else                    ding(&gvar.video.page[0], &bakapee, 2);\r
+                       if(!panswitch)  ding(&gvar.video.page[0], &bakapee, 2);\r
+                       else                    ding(&gvar.video.page[0], &bakapee, 9);\r
                        if(panswitch!=0)\r
                        {\r
                                //right movement\r
@@ -196,6 +210,24 @@ main(int argc, char *argvar[])
                                                panq++;\r
                                        } else { panq = 1; pand = 0; }\r
                                }\r
+                               if((c==0x4d && pand == 0) || pand == 2)\r
+                               {\r
+                                       if(pand == 0){ pand = 2; }\r
+                                       if(panq<=(TILEWH/(4)))\r
+                                       {\r
+                                               gvar.video.page[0].dx++;\r
+                                               VL_ShowPage(&gvar.video.page[0], 0, 0);\r
+                                               panq++;\r
+                                       } else { panq = 1; pand = 0; }\r
+                               }\r
+                               if(c==0x01+1)\r
+                               {\r
+                                       VL_ShowPage(&gvar.video.page[0], 0, 0);\r
+                               }\r
+                               if(c==0x02+1)\r
+                               {\r
+                                       VL_ShowPage(&gvar.video.page[1], 0, 0);\r
+                               }\r
                                if(c==0x71 || c==0xb1 || c=='p')\r
                                {\r
                                        //getch(); // eat keyboard input\r
@@ -279,6 +311,7 @@ pee:
                                        key = c - '0';\r
                                        VGAmodeX(vgamodex_mode, 0, &gvar);\r
                                        gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]);\r
+                                       gvar.video.page[1] = modexNextPage(&gvar.video.page[1]);\r
                // this code is written around modex16 which so far is a better fit than using DOSLIB vga directly, so leave MXLIB code in.\r
                // we'll integrate DOSLIB vga into that part of the code instead for less disruption. -- J.C.\r
                                        VL_ShowPage(&gvar.video.page[0], 0, 0);\r
@@ -294,6 +327,7 @@ pee:
                                break;\r
                                default:\r
                                        key=0;\r
+                                       clrscr();       //added to clear screen wwww\r
                                break;\r
                        }\r
                }\r
index cf9aa3fec14fdf56e648c28d72bcaa9f92b0af9d..0795f6c7fabe85f6fad2f29f6d2b96435dc38079 100755 (executable)
  * Fifth Floor, Boston, MA 02110-1301 USA.\r
  *\r
  */\r
-\r
-#ifndef __BAKAPI_H_\r
-#define __BAKAPI_H_\r
+/*\r
+ * BAKAPEE!\r
+ */\r
+#ifndef __BAKAPI_H__\r
+#define __BAKAPI_H__\r
 \r
 #include "src/lib/bakapee.h"\r
 #include "src/lib/wcpu/16_wcpu.h"\r
@@ -29,4 +31,4 @@
 //project 16 testing define switch for veiwing the contents of the video memory --sparky4\r
 #define BOINK // what does this mean? --J.C.\r
 \r
-#endif /*__BAKAPI_H_*/\r
+#endif /*__BAKAPI_H__*/\r
index 67343f1ead146b3b8ae71202aaeb93c203729b44..1a4cbe6839edbf0d1be9f232d0dc8e16ee151e2f 100755 (executable)
@@ -64,6 +64,8 @@
 \r
 ////////////////////////////////////////////////////////////////////////////\r
 //#ifdef __BORLANDC__\r
+void VL_Startup (global_game_variables_t *gvar){}\r
+void VL_Shutdown (global_game_variables_t *gvar){}\r
 void VGAmodeX(sword vq, boolean cmem, global_game_variables_t *gv)\r
 {\r
        printf("VGAmodeX dummy:\n       %Fp     %Fp     %Fp\n", &vq, &cmem, gv);\r
index 638e71102de4da83b93694a0479d6c85da9f4a25..d664b28d019a20b8790f0e11a3aaf06998b474bd 100755 (executable)
@@ -86,7 +86,7 @@ void Shutdown16(global_game_variables_t *gvar)
        MM_Shutdown(gvar);\r
 #ifdef __WATCOMC__\r
        if(gvar->video.VL_Started)\r
-               VGAmodeX(0, 1, gvar);\r
+               VL_Shutdown (gvar);//VGAmodeX(0, 1, gvar);\r
 #endif\r
 }\r
 \r
@@ -393,13 +393,13 @@ noxor:
 \r
                        if (rndval == 1)                // entire sequence has been completed\r
                        {\r
-//++++                         VGABITMASK(255);\r
-//++++                         VGAMAPMASK(15);\r
+                               VGABITMASK(255);\r
+                               VGAMAPMASK(15);\r
                                return;\r
                        }\r
                }\r
                frame++;\r
-//++++         while (TimeCount<frame){}       // don't go too fast\r
+               while (TimeCount<frame){}       // don't go too fast\r
        } while (1);\r
 \r
 \r
index 28864242f99fc9c6c863afad58b1640a414d6735..469c7a9f6ade674a6eba0d2ee217649ac9b1dffa 100755 (executable)
@@ -84,6 +84,7 @@
        if(gvar.in.inst->Keyboard[sc_P]){ modexpdump(&gvar.video.page[0]);                                      IN_UserInput(1, &gvar); } \\r
        if(gvar.in.inst->Keyboard[sc_Y]){ dbg_delayanimation=!dbg_delayanimation;                               IN_UserInput(1, &gvar); } \\r
        if(gvar.in.inst->Keyboard[sc_Q]){ VL_modexPrintTextBox(&gvar);                                          IN_UserInput(1, &gvar); } \\r
+       if(gvar.in.inst->Keyboard[sc_W]){ VL_MemToScreen((byte __far *)&gvar, 64, 64, 16, 16, &gvar.video.ofs); IN_UserInput(1, &gvar); } \\r
        RFDEBUGFUNCTIONS\r
 //FIZZLEFADEFUNCTION\r
 \r
        if(gvar.in.inst->Keyboard[sc_I]){ dbg_maptext=!dbg_maptext; IN_UserInput(1, &gvar); } \\r
        if(gvar.in.inst->Keyboard[sc_PgDn]){ \\r
                rotateR(gvar.video.palette, sizeof(gvar.video.palette)/sizeof(gvar.video.palette[0])); \\r
-               VL_UpdatePaletteWrite(&gvar.video.palette, 0);          IN_UserInput(1, &gvar); } \\r
+               VL_UpdatePaletteWrite(&gvar.video.palette, 0, &gvar);           IN_UserInput(1, &gvar); } \\r
        if(gvar.in.inst->Keyboard[sc_PgUp]){ \\r
                rotateL(gvar.video.palette, sizeof(gvar.video.palette)/sizeof(gvar.video.palette[0])); \\r
-               VL_UpdatePaletteWrite(&gvar.video.palette, 0);          IN_UserInput(1, &gvar); }\r
+               VL_UpdatePaletteWrite(&gvar.video.palette, 0, &gvar);           IN_UserInput(1, &gvar); }\r
 #ifdef __BORLANDC__\r
 #define PAL_WRITE_REG             0x03C8   /* Color register, write address */\r
 #define PAL_DATA_REG                   0x03C9   /* Color register, data port */\r
index a21780c05ca118a40b11e92062a91156ab07c945..3ab26f0b09e6e48d1e40168b8b2fc33c3e2aa89a 100755 (executable)
@@ -1,3 +1,28 @@
+/* Project 16 Source Code~\r
+ * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
+ *\r
+ * This file is part of Project 16.\r
+ *\r
+ * Project 16 is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Project 16 is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>, or\r
+ * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
+ * Fifth Floor, Boston, MA 02110-1301 USA.\r
+ *\r
+ */\r
+/*\r
+ * 16 tail library\r
+ */\r
+\r
 #include "src/lib/16_tail.h"\r
 \r
 void   TL_VidInit(global_game_variables_t *gvar)\r
@@ -38,7 +63,6 @@ void  TL_VidInit(global_game_variables_t *gvar)
        // get old video mode\r
        //in.h.ah = 0xf;\r
        //int86(0x10, &in, &out);\r
-       if(!gvar->video.old_mode) gvar->video.old_mode = vgaGetMode();//out.h.al;\r
-       VL_LoadPalFileCore(gvar->video.palette);\r
+       if(!gvar->video.old_mode) gvar->video.old_mode = VL_vgaGetMode();//out.h.al;\r
        gvar->video.VL_Initiated = 1;\r
 }\r
index 24e3342ed0fe67efbba8d6fde36f65f6df8cb2bd..be84166c458c8c7fe5cad431a4a91b037a38de12 100755 (executable)
@@ -30,10 +30,179 @@ byte far* VGA=(byte far*) 0xA0000000;   /* this points to video memory. */
 static void fadePalette(sbyte fade, sbyte start, word iter, byte *palette);\r
 static byte tmppal[PAL_SIZE];\r
 \r
+//===========================================================================\r
+\r
+/*\r
+=======================\r
+=\r
+= VL_Startup\r
+=\r
+=======================\r
+*/\r
+\r
+void   VL_Startup (global_game_variables_t *gvar)\r
+{\r
+       __asm   cld;\r
+\r
+       VGAmodeX(1/*TODO other modes*/, 1, gvar);\r
+       VL_LoadPalFileCore(gvar->video.palette, gvar);\r
+       //Quit ("Improper video card!  If you really have a VGA card that I am not\ndetecting it!", gvar);\r
+}\r
+\r
+\r
+\r
+/*\r
+=======================\r
+=\r
+= VL_Shutdown\r
+=\r
+=======================\r
+*/\r
+\r
+void   VL_Shutdown (global_game_variables_t *gvar)\r
+{\r
+       VGAmodeX(0, 1, gvar);\r
+}\r
+\r
+/*\r
+=======================\r
+=\r
+= VL_SetVGAPlaneMode\r
+=\r
+=======================\r
+*/\r
+#if 0\r
+void   VL_SetVGAPlaneMode (global_game_variables_t *gvar)\r
+{\r
+       VL_vgaSetMode(VGA_256_COLOR_MODE);\r
+       VL_DePlaneVGA ();\r
+       VGAMAPMASK(15);\r
+       VL_SetLineWidth (40, &gvar->video.ofs);\r
+}\r
+#endif\r
+\r
+//===========================================================================\r
+\r
+/*\r
+=================\r
+=\r
+= VL_ClearVideo\r
+=\r
+= Fill the entire video buffer with a given color\r
+=\r
+=================\r
+*/\r
+\r
+void VL_ClearVideo (byte color)\r
+{\r
+       __asm {\r
+               mov     dx,GC_INDEX\r
+               mov     al,GC_MODE\r
+               out     dx,al\r
+               inc     dx\r
+               in      al,dx\r
+               and     al,0xfc                         // write mode 0 to store directly to video\r
+               out     dx,al\r
+\r
+               mov     dx,SC_INDEX\r
+               mov     ax,SC_MAPMASK+15*256\r
+               out     dx,ax                           // write through all four planes\r
+\r
+               mov     ax,SCREENSEG\r
+               mov     es,ax\r
+               mov     al,[color]\r
+               mov     ah,al\r
+               mov     cx,0x8000                       // 0x8000 words, clearing 8 video bytes/word\r
+               xor     di,di\r
+               rep     stosw\r
+       }\r
+}\r
+\r
+/*\r
+=============================================================================\r
+\r
+                       VGA REGISTER MANAGEMENT ROUTINES\r
+\r
+=============================================================================\r
+*/\r
+\r
+\r
+/*\r
+=================\r
+=\r
+= VL_DePlaneVGA\r
+=\r
+=================\r
+*/\r
+#if 0\r
+void VL_DePlaneVGA (void)\r
+{\r
+\r
+//\r
+// change CPU addressing to non linear mode\r
+//\r
+\r
+//\r
+// turn off chain 4 and odd/even\r
+//\r
+       outportb (SC_INDEX,SC_MEMMODE);\r
+       outportb (SC_INDEX+1,(inportb(SC_INDEX+1)&~8)|4);\r
+\r
+       outportb (SC_INDEX,SC_MAPMASK);         // leave this set throughought\r
+\r
+//\r
+// turn off odd/even and set write mode 0\r
+//\r
+       outportb (GC_INDEX,GC_MODE);\r
+       outportb (GC_INDEX+1,inportb(GC_INDEX+1)&~0x13);\r
+\r
+//\r
+// turn off chain\r
+//\r
+       outportb (GC_INDEX,GC_MISCELLANEOUS);\r
+       outportb (GC_INDEX+1,inportb(GC_INDEX+1)&~2);\r
+\r
+//\r
+// clear the entire buffer space, because int 10h only did 16 k / plane\r
+//\r
+       VL_ClearVideo (0);\r
+\r
+//\r
+// change CRTC scanning from doubleword to byte mode, allowing >64k scans\r
+//\r
+       outportb (CRTC_INDEX,CRTC_UNDERLINE);\r
+       outportb (CRTC_INDEX+1,inportb(CRTC_INDEX+1)&~0x40);\r
+\r
+       outportb (CRTC_INDEX,CRTC_MODE);\r
+       outportb (CRTC_INDEX+1,inportb(CRTC_INDEX+1)|0x40);\r
+}\r
+#endif\r
+//===========================================================================\r
+\r
+/*\r
+====================\r
+=\r
+= VL_SetSplitScreen\r
+=\r
+====================\r
+*/\r
+\r
+void VL_SetSplitScreen (int linenum)\r
+{\r
+       VL_WaitVBL (1);\r
+       linenum=linenum*2-1;\r
+       outportb (CRTC_INDEX,CRTC_LINECOMPARE);\r
+       outportb (CRTC_INDEX+1,linenum % 256);\r
+       outportb (CRTC_INDEX,CRTC_OVERFLOW);\r
+       outportb (CRTC_INDEX+1, 1+16*(linenum/256));\r
+       outportb (CRTC_INDEX,CRTC_MAXSCANLINE);\r
+       outportb (CRTC_INDEX+1,inportb(CRTC_INDEX+1) & (255-64));\r
+}\r
+\r
 /////////////////////////////////////////////////////////////////////////////\r
-//                                                                                                                                                                                                                                             //\r
-// setvideo() - This function Manages the video modes                                                                                          //\r
-//                                                                                                                                                                                                                                             //\r
+//                                                                                                                     //\r
+// setvideo() - This function Manages the video modes                                          //\r
+//                                                                                                                     //\r
 /////////////////////////////////////////////////////////////////////////////\r
 void VGAmodeX(sword vq, boolean cmem, global_game_variables_t *gv)\r
 {\r
@@ -60,22 +229,26 @@ void VGAmodeX(sword vq, boolean cmem, global_game_variables_t *gv)
                        // get old video mode\r
                        //in.h.ah = 0xf;\r
                        //int86(0x10, &in, &out);\r
-                       gv->video.old_mode = vgaGetMode();//out.h.al;\r
+                       gv->video.old_mode = VL_vgaGetMode();//out.h.al;\r
                        // enter mode\r
                        modexEnter(vq, cmem, gv);\r
                break;\r
        }\r
 }\r
 \r
-static void\r
-vgaSetMode(byte mode)\r
+//---------------------------------------------------\r
+//\r
+// Use the bios to set the current video mode\r
+//\r
+\r
+/*static */void\r
+VL_vgaSetMode(byte mode)\r
 {\r
        union REGS regs;\r
 \r
        regs.h.ah = SET_MODE;\r
        regs.h.al = mode;\r
        int86(VIDEO_INT, &regs, &regs);\r
-  //int10_setmode(mode);\r
 }\r
 \r
 //---------------------------------------------------\r
@@ -83,8 +256,8 @@ vgaSetMode(byte mode)
 // Use the bios to get the current video mode\r
 //\r
 \r
-byte/*FIXME: why long? "long" is 32-bit datatype, VGA modes are 8-bit numbers. */\r
-vgaGetMode()\r
+byte\r
+VL_vgaGetMode(void)\r
 {\r
        return int10_getmode();\r
 }\r
@@ -92,11 +265,11 @@ vgaGetMode()
 /* -========================= Entry  Points ==========================- */\r
 void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv)\r
 {\r
-       word i;\r
+       //word i;\r
        struct vga_mode_params cm;\r
        //int CRTParmCount;\r
 \r
-       vgaSetMode(VGA_256_COLOR_MODE);\r
+       VL_vgaSetMode(VGA_256_COLOR_MODE);\r
        vga_enable_256color_modex();\r
 \r
        update_state_from_vga();\r
@@ -158,27 +331,33 @@ void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv)
        vga_state.vga_stride = cm.offset * 2;\r
        vga_write_crtc_mode(&cm,0);\r
 \r
-       /* clear video memory */\r
+       // clear video memory //\r
        switch (cmem)\r
        {\r
-               case 1: {\r
-                       /* clear video memory */\r
-                       dword far*ptr=(dword far*)vga_state.vga_graphics_ram;//VGA;       /* used for faster screen clearing */\r
+               case 1:\r
+               {\r
+#if 0\r
+                       dword far*ptr=(dword far*)vga_state.vga_graphics_ram;//VGA;       // used for faster screen clearing //\r
                        vga_write_sequencer(2/*map mask register*/,0xf/*all 4 planes*/);\r
                        for(i = 0;i < 0x4000; i++) ptr[i] = 0x0000; // 0x4000 x dword = 64KB\r
-                       /* fix up the palette and everything */\r
-                       modexPalBlack();        //reset the palette~\r
+                       // fix up the palette and everything //\r
+                       modexPalBlack();        //reset the palette~//\r
+#endif\r
+                       //\r
+                       // clear the entire buffer space, because int 10h only did 16 k / plane\r
+                       //\r
+                       VL_ClearVideo (0);\r
                }\r
                break;\r
        }\r
-//     VL_SetLineWidth (cm.offset, &gv->video.ofs);\r
+       VL_SetLineWidth (cm.offset, &gv->video.ofs);\r
        gv->video.VL_Started=1;\r
 }\r
 \r
-void\r
-modexLeave() {\r
-       /* VGAmodeX restores original mode and palette */\r
-       vgaSetMode(TEXT_MODE);\r
+void modexLeave(void)\r
+{\r
+       // VGAmodeX restores original mode and palette\r
+       VL_vgaSetMode(TEXT_MODE);\r
 }\r
 \r
 page_t\r
@@ -644,14 +823,15 @@ fadePalette(sbyte fade, sbyte start, word iter, byte *palette) {
 }\r
 \r
 \r
-/* save and load */\r
-void\r
-modexPalSave(byte *palette) {\r
+// save and load\r
+void modexPalSave(byte *palette)\r
+{\r
        int  i;\r
 \r
-       outp(PAL_READ_REG, 0);    /* start at palette entry 0 */\r
-       for(i=0; i<PAL_SIZE; i++) {\r
-       palette[i] = inp(PAL_DATA_REG); /* read the palette data */\r
+       outp(PAL_READ_REG, 0);                  // start at palette entry 0\r
+       for(i=0; i<PAL_SIZE; i++)\r
+       {\r
+               palette[i] = inp(PAL_DATA_REG); // read the palette data\r
        }\r
 }\r
 \r
@@ -696,18 +876,18 @@ modexLoadPalFile(byte *filename, byte *palette) {
        fclose(file);\r
 }\r
 \r
-void VL_LoadPalFile(const char *filename, byte *palette)\r
+void VL_LoadPalFile(const char *filename, byte *palette, global_game_variables_t *gvar)\r
 {\r
-       VL_LoadPalFilewithoffset(filename, palette, 8);\r
-       VL_LoadPalFileCore(palette);\r
+       VL_LoadPalFilewithoffset(filename, palette, 8, gvar);\r
+//     VL_LoadPalFileCore(palette);\r
 }\r
 \r
-void VL_LoadPalFileCore(byte *palette)\r
+void VL_LoadPalFileCore(byte *palette, global_game_variables_t *gvar)\r
 {\r
-       VL_LoadPalFilewithoffset("data/16.pal", palette, 0);\r
+       VL_LoadPalFilewithoffset("data/16.pal", palette, 0, gvar);\r
 }\r
 \r
-void VL_LoadPalFilewithoffset(const char *filename, byte *palette, word o)\r
+void VL_LoadPalFilewithoffset(const char *filename, byte *palette, word o, global_game_variables_t *gvar)\r
 {\r
        int fd;\r
 \r
@@ -716,15 +896,24 @@ void VL_LoadPalFilewithoffset(const char *filename, byte *palette, word o)
                read(fd,palette,        PAL_SIZE);\r
                close(fd);\r
 \r
-               VL_UpdatePaletteWrite(palette, o);\r
+               VL_UpdatePaletteWrite(palette, o, gvar);\r
        }\r
 }\r
 \r
-void VL_UpdatePaletteWrite(byte *palette, word o)\r
+void VL_UpdatePaletteWrite(byte *palette, word o, global_game_variables_t *gvar)\r
 {\r
        word i;\r
        vga_palette_lseek(/*1+*/o);\r
-       for (i=o;i < 256-o;i++) vga_palette_write(palette[(i*3)+0]>>2,palette[(i*3)+1]>>2,palette[(i*3)+2]>>2);\r
+       //for (i=o;i < 256-o;i++)\r
+       for (i=0;i < 256-o;i++)\r
+               vga_palette_write(palette[(i*3)+0]>>2,palette[(i*3)+1]>>2,palette[(i*3)+2]>>2);\r
+\r
+       VL_PaletteSync(gvar);\r
+}\r
+\r
+void VL_PaletteSync(global_game_variables_t *gvar)\r
+{\r
+       modexPalSave(&gvar->video.palette);\r
 }\r
 \r
 void\r
@@ -1035,7 +1224,7 @@ void modexpdump(page_t *pee)
                }\r
        }\r
 }\r
-\r
+#if 0\r
 /////////////////////////////////////////////////////////////////////////////\r
 //                                                                                                                                              //\r
 // cls() - This clears the screen to the specified color, on the VGA or on //\r
@@ -1050,7 +1239,7 @@ void modexcls(page_t *page, byte color, byte *Where)
        //_fmemset(VGA, color, 16000);\r
        _fmemset(Where, color, page->stridew*page->height);\r
 }\r
-\r
+#endif\r
 //\r
 // pattern filler from joncampbell123's code\r
 //\r
index 3cfa4347d22c7258589f3f1be7eb998276e5993f..a152cc35b764570791bad7c9340f06fd00d8d9d0 100755 (executable)
@@ -151,21 +151,27 @@ extern byte far*  VGA;  /* The VGA Memory */
 //\r
 // VGA hardware routines\r
 //\r
-\r
-void VGAMAPMASK(byte x);\r
-void VGAWRITEMODE(byte x);\r
-void VGAREADMAP(byte x);\r
+void   VGAWRITEMODE(byte x),\r
+       VGAMAPMASK(byte x),\r
+       VGAREADMAP(byte x),\r
+       VGABITMASK(byte x);\r
 \r
 #define VW_Hlin(x,z,y,c,q)     VL_Hlin(x,y,(z)-(x)+1,c,q)\r
 #define VW_Vlin(y,z,x,c,q)     VL_Vlin(x,y,(z)-(y)+1,c,q)\r
 \r
 /* -============================ Functions =============================- */\r
 /* mode switching, page, and plane functions */\r
-void VGAmodeX(sword vq, boolean cmem, global_game_variables_t *gv);\r
-void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv);\r
-byte vgaGetMode();\r
+void   VL_Startup (global_game_variables_t *gvar),\r
+       VL_Shutdown (global_game_variables_t *gvar),\r
+       VL_SetVGAPlaneMode (global_game_variables_t *gvar),\r
+       VL_ClearVideo (byte color),\r
+       VL_DePlaneVGA (),\r
+       VGAmodeX(sword vq, boolean cmem, global_game_variables_t *gv),\r
+       modexEnter(sword vq, boolean cmem, global_game_variables_t *gv);\r
+void VL_vgaSetMode(byte mode);\r
+byte VL_vgaGetMode(void);\r
 extern void TL_VidInit(global_game_variables_t *gvar);\r
-void modexLeave();\r
+void modexLeave(void);\r
 void modexsetBaseXMode();\r
 page_t modexDefaultPage(page_t *p);\r
 page_t modexNextPage(page_t *p);\r
@@ -192,10 +198,11 @@ void modexFlashOff(word fade, byte *palette);
 void modexPalSave(byte *palette);\r
 //byte *modexNewPal();\r
 void modexLoadPalFile(char *filename, byte *palette);\r
-void VL_LoadPalFile(const char *filename, byte *palette);\r
-void VL_LoadPalFileCore(byte *palette);\r
-void VL_LoadPalFilewithoffset(const char *filename, byte *palette, word o);\r
-void VL_UpdatePaletteWrite(byte *palette, word o);\r
+void VL_LoadPalFile(const char *filename, byte *palette, global_game_variables_t *gvar);\r
+void VL_LoadPalFileCore(byte *palette, global_game_variables_t *gvar);\r
+void VL_LoadPalFilewithoffset(const char *filename, byte *palette, word o, global_game_variables_t *gvar);\r
+void VL_UpdatePaletteWrite(byte *palette, word o, global_game_variables_t *gvar);\r
+void VL_PaletteSync(global_game_variables_t *gvar);\r
 void modexSavePalFile(char *filename, byte *palette);\r
 #define MenuFadeIn()   VL_FadeIn(0,255,&gamepal,10)\r
 \r
@@ -211,6 +218,7 @@ void VL_Plot (int x, int y, int color, ofs_t *ofs);
 void VL_Hlin (unsigned x, unsigned y, unsigned width, unsigned color, ofs_t *ofs);\r
 void VL_Vlin (int x, int y, int height, int color, ofs_t *ofs);\r
 void VL_Bar (int x, int y, int width, int height, int color, ofs_t *ofs);\r
+void VL_MemToScreen (byte far *source, int width, int height, int x, int y, ofs_t *ofs);\r
 void modexputPixel(page_t *page, int x, int y, byte color);\r
 byte modexgetPixel(page_t *page, int x, int y);\r
 \r
@@ -245,7 +253,6 @@ void modexprint(page_t *page, sword x, sword y, word t, boolean tlsw, word col,
 void modexprintbig(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str);\r
 void VL_modexPrintTextBox(global_game_variables_t *gvar);\r
 void modexpdump(page_t *pee);\r
-void modexcls(page_t *page, byte color, byte *Where);\r
 void VL_PatternDraw(video_t *video, word pn, boolean sw, boolean allsw);\r
 void modexWaitBorder();\r
 void modexWaitBorder_start();\r
index 31c9f38e73a80f50735bac2612278ec9428c3389..7332d5fb5d10795c7a7cb265d50c1036573daba3 100755 (executable)
@@ -3,19 +3,19 @@
  *\r
  * This file is part of Project 16.\r
  *\r
- * Project 16 is free software; you can redistribute it and/or modify\r
+ * Project 16 is free software; you can redistribute it and/or modify\r
  * it under the terms of the GNU General Public License as published by\r
  * the Free Software Foundation; either version 3 of the License, or\r
  * (at your option) any later version.\r
  *\r
- * Project 16 is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
+ * Project 16 is distributed in        the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without   even the implied warranty of\r
+ * MERCHANTABILITY or  FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for      more details.\r
  *\r
  * You should have received a copy of the GNU General Public License\r
  * along with this program.  If not, see <http://www.gnu.org/licenses/>, or\r
- * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
+ * write to the Free Software Foundation, Inc., 51 Franklin    Street,\r
  * Fifth Floor, Boston, MA 02110-1301 USA.\r
  *\r
  */\r
@@ -46,7 +46,7 @@ void  VL_SetScreen (unsigned int crtc, int pelpan)
 \r
                mov     dx,STATUS_REGISTER_1\r
 \r
-       // wait for a display signal to make sure the raster isn't in the middle\r
+       // wait for     a display signal to make sure the raster isn't in       the middle\r
        // of a sync\r
 \r
 #ifdef __BORLANDC__\r
@@ -121,7 +121,7 @@ SetScreen_setcrtc:
        __asm {\r
 #endif\r
        // set CRTC start\r
-       // for some reason, my XT's EGA card doesn't like word outs to the CRTC index...\r
+       // for  some reason, my XT's EGA card doesn't like word outs to the CRTC index...\r
 \r
                mov     cx,[crtc]\r
                mov     dx,CRTC_INDEX\r
@@ -141,7 +141,7 @@ SetScreen_setcrtc:
        // set horizontal panning\r
 \r
                mov     dx,ATR_INDEX\r
-//             mov     al,ATR_PELPAN or 20h\r
+//             mov     al,ATR_PELPAN or        20h\r
                out     dx,al\r
                jmp     SetScreen_done\r
                mov     al,[BYTE PTR pelpan]            //pel pan value\r
@@ -164,7 +164,7 @@ SetScreen_done:
 =\r
 = VL_SetLineWidth\r
 =\r
-= Line witdh is in WORDS, 40 words is normal width for vgaplanegr\r
+= Line witdh is in     WORDS, 40 words is normal width for     vgaplanegr\r
 =\r
 ====================\r
 */\r
@@ -185,7 +185,7 @@ void VL_SetLineWidth (unsigned width, ofs_t *ofs)
 \r
        offset = 0;\r
 \r
-       for (i=0;i<MAXSCANLINES;i++)\r
+       for     (i=0;i<MAXSCANLINES;i++)\r
        {\r
                ofs->ylookup[i]=offset;\r
                offset += ofs->linewidth;\r
@@ -216,7 +216,7 @@ void VL_FillPalette (int red, int green, int blue)
        int     i;\r
 \r
        outportb (PAL_WRITE_REG,0);\r
-       for (i=0;i<256;i++)\r
+       for     (i=0;i<256;i++)\r
        {\r
                outportb (PAL_DATA_REG,red);\r
                outportb (PAL_DATA_REG,green);\r
@@ -280,7 +280,7 @@ void VL_SetPalette (byte far *palette, video_t *v)
        fastpalette=v->fastpalette;\r
 \r
 //     outportb (PAL_WRITE_REG,0);\r
-//     for (i=0;i<768;i++)\r
+//     for     (i=0;i<768;i++)\r
 //             outportb(PAL_DATA_REG,*palette++);\r
 \r
        __asm {\r
@@ -293,14 +293,14 @@ void VL_SetPalette (byte far *palette, video_t *v)
                test    [ss:fastpalette],1\r
                jz      slowset\r
 //\r
-// set palette fast for cards that can take it\r
+// set palette fast for        cards that can take it\r
 //\r
                //mov   cx,768\r
                //rep outsb\r
                //jmp   done\r
 \r
 //\r
-// set palette slowly for some video cards\r
+// set palette slowly for      some video cards\r
 //\r
 #ifdef __BORLANDC__\r
        }\r
@@ -356,7 +356,7 @@ void VL_GetPalette (byte far *palette)
        int     i;\r
 \r
        outportb (PAL_READ_REG,0);\r
-       for (i=0;i<768;i++)\r
+       for     (i=0;i<768;i++)\r
                *palette++ = inportb(PAL_DATA_REG);\r
 }\r
 \r
@@ -368,7 +368,7 @@ void VL_GetPalette (byte far *palette)
 =\r
 = VL_FadeOut\r
 =\r
-= Fades the current palette to the given color in the given number of steps\r
+= Fades the current palette to the given color in      the given number of steps\r
 =\r
 =================\r
 */\r
@@ -385,11 +385,11 @@ void VL_FadeOut (int start, int end, int red, int green, int blue, int steps, vi
 //\r
 // fade through intermediate frames\r
 //\r
-       for (i=0;i<steps;i++)\r
+       for     (i=0;i<steps;i++)\r
        {\r
                origptr = &v->palette1[start][0];\r
                newptr = &v->palette2[start][0];\r
-               for (j=start;j<=end;j++)\r
+               for     (j=start;j<=end;j++)\r
                {\r
                        orig = *origptr++;\r
                        delta = red-orig;\r
@@ -437,9 +437,9 @@ void VL_FadeIn (int start, int end, byte far *palette, int steps, video_t *v)
 //\r
 // fade through intermediate frames\r
 //\r
-       for (i=0;i<steps;i++)\r
+       for     (i=0;i<steps;i++)\r
        {\r
-               for (j=start;j<=end;j++)\r
+               for     (j=start;j<=end;j++)\r
                {\r
                        delta = palette[j]-v->palette1[0][j];\r
                        v->palette2[0][j] = v->palette1[0][j] + delta * i / steps;\r
@@ -463,7 +463,7 @@ void VL_FadeIn (int start, int end, byte far *palette, int steps, video_t *v)
 =\r
 = VL_TestPaletteSet\r
 =\r
-= Sets the palette with outsb, then reads it in and compares\r
+= Sets the palette with outsb, then reads it in        and     compares\r
 = If it compares ok, fastpalette is set to true.\r
 =\r
 =================\r
@@ -473,7 +473,7 @@ void VL_TestPaletteSet (video_t *v)
 {\r
        int     i;\r
 \r
-       for (i=0;i<768;i++)\r
+       for     (i=0;i<768;i++)\r
                v->palette1[0][i] = i;\r
 \r
        v->fastpalette = true;\r
@@ -522,7 +522,7 @@ void VL_Plot (int x, int y, int color, ofs_t *ofs)
 =================\r
 */\r
 \r
-void VL_Hlin (unsigned x, unsigned y, unsigned width, unsigned color, ofs_t *ofs)\r
+void VL_Hlin   (unsigned x, unsigned y, unsigned width, unsigned color, ofs_t *ofs)\r
 {\r
        unsigned                xbyte;\r
        byte                    far *dest;\r
@@ -540,7 +540,7 @@ void VL_Hlin (unsigned x, unsigned y, unsigned width, unsigned color, ofs_t *ofs
 \r
        if (midbytes<0)\r
        {\r
-       // all in one byte\r
+       // all in       one byte\r
                VGAMAPMASK(leftmask&rightmask);\r
                *dest = color;\r
                VGAMAPMASK(15);\r
@@ -569,7 +569,7 @@ void VL_Hlin (unsigned x, unsigned y, unsigned width, unsigned color, ofs_t *ofs
 =================\r
 */\r
 \r
-void VL_Vlin (int x, int y, int height, int color, ofs_t *ofs)\r
+void VL_Vlin   (int x, int y, int height, int color, ofs_t *ofs)\r
 {\r
        byte    far *dest,mask;\r
        VCLIPDEF\r
@@ -614,7 +614,7 @@ void VL_Bar (int x, int y, int width, int height, int color, ofs_t *ofs)
 \r
        if (midbytes<0)\r
        {\r
-       // all in one byte\r
+       // all in       one byte\r
                VGAMAPMASK(leftmask&rightmask);\r
                while (height--)\r
                {\r
@@ -643,13 +643,48 @@ void VL_Bar (int x, int y, int width, int height, int color, ofs_t *ofs)
        VGAMAPMASK(15);\r
 }\r
 \r
+//==========================================================================\r
+\r
+/*\r
+=================\r
+=\r
+= VL_MemToScreen\r
+=\r
+= Draws a block of data to the screen.\r
+=\r
+=================\r
+*/\r
+\r
+void VL_MemToScreen (byte far *source, int width, int height, int x, int y, ofs_t *ofs)\r
+{\r
+       byte    far *screen,far *dest,mask;\r
+       int             plane;\r
+\r
+       width>>=2;\r
+       dest = MK_FP(SCREENSEG,ofs->bufferofs+ofs->ylookup[y]+(x>>2) );\r
+       mask = 1 << (x&3);\r
+\r
+       for     (plane = 0; plane<4; plane++)\r
+       {\r
+               VGAMAPMASK(mask);\r
+               mask <<= 1;\r
+               if (mask == 16)\r
+                       mask = 1;\r
+\r
+               screen = dest;\r
+               for     (y=0;y<height;y++,screen+=ofs->linewidth,source+=width)\r
+                       _fmemcpy (screen,source,width);\r
+       }\r
+}\r
+\r
+//==========================================================================\r
 \r
 /*\r
 ==============\r
 \r
  VL_WaitVBL                    ******** NEW *********\r
 \r
- Wait for the vertical retrace (returns before the actual vertical sync)\r
+ Wait for      the vertical retrace (returns before the actual vertical sync)\r
 \r
 ==============\r
 */\r
@@ -670,7 +705,7 @@ void VL_WaitVBL(word num)
 \r
                mov     cx,[num]\r
        //\r
-       // wait for a display signal to make sure the raster isn't in the middle\r
+       // wait for     a display signal to make sure the raster isn't in       the middle\r
        // of a sync\r
        //\r
 #ifdef __BORLANDC__\r
@@ -703,23 +738,49 @@ void VL_WaitVBL(word num)
 }\r
 \r
 //===========================================================================\r
+#if 0\r
+#define VGAWRITEMODE(x) asm{\r
+               cli\r
+               mov     dx,GC_INDEX\r
+               mov     al,GC_MODE\r
+               out     dx,al\r
+               inc     dx\r
+               in      al,dx\r
+               and     al,252\r
+               or      al,x\r
+               out     dx,al\r
+               sti\r
+}\r
 \r
-void VGAMAPMASK(byte x)\r
-{\r
-       __asm {\r
-//             cli\r
+#define VGAMAPMASK(x) asm{\r
+               cli\r
                mov     dx,SC_INDEX\r
                mov     al,SC_MAPMASK\r
                mov     ah,x\r
                out     dx,ax\r
-//             sti\r
-       }\r
+               sti\r
 }\r
 \r
+#define VGAREADMAP(x) asm{\r
+               cli\r
+               mov     dx,GC_INDEX\r
+               mov     al,GC_READMAP\r
+               mov     ah,x\r
+               out     dx,ax\r
+               sti\r
+}\r
+\r
+#define EGABITMASK(x) asm{\r
+               mov     dx,GC_INDEX\r
+               mov     ax,GC_BITMASK+256*x\r
+               out     dx,ax\r
+               sti\r
+}\r
+#endif\r
 void VGAWRITEMODE(byte x)\r
 {\r
        __asm {\r
-//             cli\r
+               cli\r
                mov     dx,GC_INDEX\r
                mov     al,GC_MODE\r
                out     dx,al\r
@@ -728,19 +789,42 @@ void VGAWRITEMODE(byte x)
                and     al,252\r
                or      al,x\r
                out     dx,al\r
-//             sti\r
+               sti\r
+       }\r
+}\r
+\r
+void VGAMAPMASK(byte x)\r
+{\r
+       __asm {\r
+               cli\r
+               mov     dx,SC_INDEX\r
+               mov     al,SC_MAPMASK\r
+               mov     ah,x\r
+               out     dx,ax\r
+               sti\r
        }\r
 }\r
 \r
 void VGAREADMAP(byte x)\r
 {\r
        __asm {\r
-//             cli\r
+               cli\r
                mov     dx,GC_INDEX\r
                mov     al,GC_READMAP\r
                mov     ah,x\r
                out     dx,ax\r
-//             sti\r
+               sti\r
+       }\r
+}\r
+\r
+void VGABITMASK(byte x)\r
+{\r
+       word q = 256*x;\r
+       __asm {\r
+               mov     dx,GC_INDEX\r
+               mov     ax,GC_BITMASK+q\r
+               out     dx,ax\r
+               sti\r
        }\r
 }\r
 \r
index 389a815993bc5a3760d4b5fb50b56b5547130993..cf1dd90403c0aaa74af0520248c3f184a71bc216 100755 (executable)
 \r
 #include "src/lib/bakapee.h"\r
 \r
+struct glob_game_vars  *ggvv;\r
+//static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */\r
+char global_temp_status_text[512];\r
+char global_temp_status_text2[512];\r
+\r
+//==========================================================================\r
+\r
+/*\r
+===================\r
+=\r
+= FizzleFade\r
+=\r
+= returns true if aborted\r
+=\r
+===================\r
+*/\r
+\r
+//extern       ControlInfo     c;\r
+#define PIXPOSX                        gvar->video.page[0].sw/2\r
+#define PIXPOSY                        gvar->video.page[0].sh/2\r
+\r
+boolean baka_FizzleFade (page_t *source, page_t *dest, unsigned frames, boolean abortable, global_game_variables_t *gvar)\r
+{\r
+       dword           p,pixperframe;\r
+       unsigned        drawofs,pagedelta;\r
+       byte            mask,maskb[8] = {1,2,4,8};\r
+       unsigned        x,y,frame               ,esorig;\r
+       dword           rndval;\r
+//     word TimeCount = *clockw;\r
+       word screenseg = SCREENSEG;\r
+\r
+       pagedelta = (word)dest->sw*dest->sh;//(word)(source->data - dest->data);//(dest->data - source->data)\r
+       rndval = 1;     esorig = 0;\r
+       x = y = dest->dx;\r
+       pixperframe = 76800/(dword)frames;\r
+\r
+//     IN_StartAck ();\r
+\r
+//     VL_ShowPage(dest, 1, 0);\r
+//     VL_ShowPage(source, 1, 0);\r
+\r
+//     modexClearRegion(dest, 0, 0, (dest->width), (dest->height), 12);\r
+       modexClearRegion(source, 0, 0, (source->width), (source->height), 64);\r
+\r
+       __asm {\r
+               mov     [esorig],es\r
+       }\r
+//     TimeCount=\r
+       frame=0;\r
+       do      // while (1)\r
+       {\r
+sprintf(global_temp_status_text, "%u", frame);\r
+modexprint(dest, PIXPOSX, PIXPOSY, 1, 0, 47, 0, 1, global_temp_status_text);\r
+               if (abortable && kbhit())//IN_CheckAck () )\r
+                       return true;\r
+\r
+               __asm {\r
+                       mov     es,[screenseg]\r
+               }\r
+\r
+               for (p=0;p<pixperframe;p++)\r
+               {\r
+                       __asm {\r
+                               //\r
+                               // seperate random value into x/y pair\r
+                               //\r
+                               mov     ax,[WORD PTR rndval]\r
+                               mov     dx,[WORD PTR rndval+2]\r
+                               mov     bx,ax\r
+                               dec     bl\r
+                               mov     [BYTE PTR y],bl                 // low 8 bits - 1 = y xoordinate\r
+                               mov     bx,ax\r
+                               mov     cx,dx\r
+                               mov     [BYTE PTR x],ah                 // next 9 bits = x xoordinate\r
+                               mov     [BYTE PTR x+1],dl\r
+                               //\r
+                               // advance to next random element\r
+                               //\r
+                               shr     dx,1\r
+                               rcr     ax,1\r
+                               jnc     noxor\r
+                               xor     dx,0x0001\r
+                               xor     ax,0x2000\r
+#ifdef __BORLANDC__\r
+                       }\r
+#endif\r
+noxor:\r
+#ifdef __BORLANDC__\r
+                       __asm {\r
+#endif\r
+                               mov     [WORD PTR rndval],ax\r
+                               mov     [WORD PTR rndval+2],dx\r
+                       }\r
+\r
+                       if (x>dest->sw || y>dest->sh)\r
+                               continue;\r
+                       drawofs = (word)(source->data)+gvar->video.ofs.ylookup[y] + (x>>2);\r
+sprintf(global_temp_status_text, "draw - %Fp", drawofs);\r
+modexprint(dest, PIXPOSX, 16+PIXPOSY, 1, 0, 47, 0, 1, global_temp_status_text);\r
+sprintf(global_temp_status_text, "pdet - %Fp", pagedelta);\r
+modexprint(dest, PIXPOSX, 24+PIXPOSY, 1, 0, 47, 0, 1, global_temp_status_text);\r
+sprintf(global_temp_status_text, "srce - %Fp", source->data);\r
+modexprint(dest, PIXPOSX, 32+PIXPOSY, 1, 0, 47, 0, 1, global_temp_status_text);\r
+sprintf(global_temp_status_text, "dest - %Fp", dest->data);\r
+modexprint(dest, PIXPOSX, 40+PIXPOSY, 1, 0, 47, 0, 1, global_temp_status_text);\r
+\r
+                       //\r
+                       // copy one pixel\r
+                       //\r
+                       mask = x&3;\r
+                       VGAREADMAP(mask);\r
+                       mask = maskb[mask];\r
+                       VGAMAPMASK(mask);\r
+\r
+                       __asm {\r
+                               mov     di,[drawofs]\r
+                               mov     al,[es:di]\r
+                               add     di,[pagedelta]\r
+                               mov     [es:di],al\r
+                       }\r
+\r
+                       if (rndval == 1)                // entire sequence has been completed\r
+                               return false;\r
+               }\r
+               frame++;\r
+//--           while (TimeCount<frame){}//;            // don't go too fast\r
+       } while (1);\r
+       __asm {\r
+               mov     es,[esorig]\r
+       }\r
+       return false;\r
+}\r
+#if 0\r
+boolean baka_FizzleFade (unsigned source, unsigned dest, unsigned width,unsigned height, unsigned frames, boolean abortable, global_game_variables_t *gvar)\r
+{\r
+       int                     pixperframe;\r
+       unsigned        drawofs,pagedelta;\r
+       byte            mask,maskb[8] = {1,2,4,8};\r
+       unsigned        x,y,p,frame;\r
+       dword           rndval;\r
+       word TimeCount = *clockw;\r
+       word screenseg = SCREENSEG;\r
+\r
+       pagedelta = dest-source;\r
+       rndval = 1;\r
+       x = y = 0;\r
+       pixperframe = 64000/frames;\r
+\r
+       VGAmodeX(0, 0, gvar);\r
+//     IN_StartAck ();\r
+//     VL_ShowPage((page_t *)dest, 1, 0);\r
+       VGAmodeX(1, 0, gvar);\r
+\r
+       TimeCount=frame=0;\r
+       do      // while (1)\r
+       {\r
+               if (abortable && !kbhit())//IN_CheckAck () )\r
+                       return true;\r
+\r
+               __asm {\r
+                       mov     es,[screenseg]\r
+               }\r
+\r
+               for (p=0;p<pixperframe;p++)\r
+               {\r
+                       __asm {\r
+                               //\r
+                               // seperate random value into x/y pair\r
+                               //\r
+                                       mov     ax,[WORD PTR rndval]\r
+                                       mov     dx,[WORD PTR rndval+2]\r
+                                       mov     bx,ax\r
+                                       dec     bl\r
+                                       mov     [BYTE PTR y],bl                 // low 8 bits - 1 = y xoordinate\r
+                                       mov     bx,ax\r
+                                       mov     cx,dx\r
+                                       mov     [BYTE PTR x],ah                 // next 9 bits = x xoordinate\r
+                                       mov     [BYTE PTR x+1],dl\r
+                               //\r
+                               // advance to next random element\r
+                               //\r
+                                       shr     dx,1\r
+                                       rcr     ax,1\r
+                                       jnc     noxor\r
+                                       xor     dx,0x0001\r
+                                       xor     ax,0x2000\r
+noxor:\r
+                                       mov     [WORD PTR rndval],ax\r
+                                       mov     [WORD PTR rndval+2],dx\r
+                       }\r
+\r
+                       if (x>width || y>height)\r
+                               continue;\r
+                       drawofs = source+gvar->video.ofs.ylookup[y] + (x>>2);\r
+\r
+                       //\r
+                       // copy one pixel\r
+                       //\r
+                       mask = x&3;\r
+                       VGAREADMAP(mask);\r
+                       mask = maskb[mask];\r
+                       VGAMAPMASK(mask);\r
+\r
+                       __asm {\r
+                               mov     di,[drawofs]\r
+                               mov     al,[es:di]\r
+                               add     di,[pagedelta]\r
+                               mov     [es:di],al\r
+                       }\r
+\r
+                       if (rndval == 1)                // entire sequence has been completed\r
+                               return false;\r
+               }\r
+               frame++;\r
+//             while (TimeCount<frame){}//;            // don't go too fast\r
+       } while (1);\r
+       return false;\r
+}\r
+#endif\r
 /* clrstdin() clear any leftover chars tha may be in stdin stream */\r
 void clrstdin()\r
 {\r
@@ -34,7 +253,8 @@ void colortest(page_t *page, bakapee_t *pee)
 {\r
        //if(pee->coor < 256)\r
        //{\r
-               modexcls(page, pee->coor, VGA);\r
+//             modexcls(page, pee->coor, VGA);\r
+               VL_ClearVideo (pee->coor);\r
                pee->coor++;\r
        //}else pee->coor = 0;\r
 }\r
@@ -44,7 +264,8 @@ void colorz(page_t *page, bakapee_t *pee)
 {\r
        if(pee->coor <= pee->hgq)\r
        {\r
-               modexcls(page, pee->coor, VGA);\r
+//             modexcls(page, pee->coor, VGA);\r
+               VL_ClearVideo (pee->coor);\r
                pee->coor++;\r
        }else pee->coor = pee->lgq;\r
 }\r
@@ -297,11 +518,9 @@ void ding(page_t *page, bakapee_t *pee, word q)
                        modexprint(page, page->sw/2, page->sh/2, 1, 0, 47, 0, 1, "bakapi");\r
                break;\r
                case 9:\r
-                       if(pee->coor <= pee->hgq)\r
-                       {\r
-                               ssd(page, pee, q);\r
-                               pee->coor++;\r
-                       }else pee->coor = pee->lgq;\r
+                       //baka_FizzleFade (ggvv->video.ofs.bufferofs, ggvv->video.ofs.displayofs, page->sw, page->sh, false, ggvv);\r
+//                     modexprint(page, page->sw/2, page->sh/2, 1, 0, 47, 0, 1, "bakapi start");\r
+//                     if(!baka_FizzleFade ((unsigned)page, (unsigned)page, page->width, page->height, 70, false, ggvv))\r
                break;\r
                case 10:\r
                        ssd(page, pee, q); /*printf("%d\n", pee->coor);*/\r
index 06c5e7055ebf22b50a8842d6dc48fd8c21771089..08af061bd2a63e6d963ca515bb9c5cb71a41f21c 100755 (executable)
@@ -41,6 +41,7 @@ typedef struct {
        word bonk,lgq,hgq;\r
 } bakapee_t;\r
 \r
+boolean baka_FizzleFade (page_t *source, page_t *dest, unsigned frames, boolean abortable, global_game_variables_t *gvar);\r
 void clrstdin();\r
 void colortest(page_t *page, bakapee_t *pee);\r
 void colorz(page_t *page, bakapee_t *pee);\r
index 94338ab7d872a49765a44ccfe9f9c4d8f4606653..4e9577bb5d3dfb528e11567b222adf844c79bb84 100755 (executable)
@@ -877,7 +877,7 @@ void shinku(global_game_variables_t *gv)
                                gv->video.page[/*!*/(gv->video.p)].dx,\r
                                gv->video.page[/*!*/(gv->video.p)].dy,\r
                                96, 16);\r
-                       modexprint(&(gv->video.page[/*!*/(gv->video.p)]), x, y, type, 1, col, 1, bgcol, global_temp_status_text);\r
+                       modexprint(&(gv->video.page[/*!*/(gv->video.p)]), x, y, type, 1, col, bgcol, 1, global_temp_status_text);\r
 //0000printf("dx=%u    dy=%u\n", gv->video.page[/*!*/(gv->video.p)].dx, gv->video.page[/*!*/(gv->video.p)].dy);\r
                }\r
 #endif\r
index 6b6840a707a8d92e1d3142d11b25b35ad80419e0..3fdcf5a5498ce4152483b0c101fdce453bddba80 100755 (executable)
  *\r
  */\r
 #include "src/lib/16_vl.h"\r
-void main(int argc, char *argv[]) {\r
+void main(int argc, char *argv[])\r
+{\r
        static global_game_variables_t gvar; word i;    char bakapee[64] = "data/16.pal";\r
        if(argv[1]) strcpy(bakapee, argv[1]);// modexPalSave(&gvar.video.dpal); modexFadeOff(4, &gvar.video.dpal); modexPalBlack();\r
 \r
        TL_VidInit(&gvar);      VGAmodeX(1, 0, &gvar);\r
-       VL_LoadPalFile(bakapee, &gvar.video.palette);           //modexLoadPalFile(bakapee, &(gvar.video.palette));\r
+       VL_LoadPalFile(bakapee, &gvar.video.palette, &gvar);            //modexLoadPalFile(bakapee, &(gvar.video.palette));\r
        gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]);// modexFadeOn(4, &gvar.video.palette);\r
        VL_ShowPage(&gvar.video.page[0], 1, 0);\r
        modexpdump(&gvar.video.page[0]);\r
index 94f274933ac393043c20f51b0b4f64e024aeb9a8..69d0ec3a47374ed921eaf7d67eccbcee77a93163 100755 (executable)
@@ -107,7 +107,7 @@ void main(int argc, char *argv[])
        modexPalBlack();\r
 \r
        /* load our palette */\r
-       VL_LoadPalFile("data/16.pal", &gvar.video.palette);\r
+       VL_LoadPalFile("data/16.pal", &gvar.video.palette, &gvar);\r
        bmp1.offset=(paloffset/3);\r
        VL_palette(&bmp1, &gvar.video.palette, &paloffset, 0, 0, &gvar);\r
 \r
index 3a59112d03aa66fd26b87740253e241d7f4e5c35..517d2c823abe76e710f623034950cf954648e67d 100755 (executable)
@@ -122,7 +122,7 @@ void main()
        /*modexLoadPalFile("data/spri/chikyuu.pal", &pal);\r
        modexPalUpdate(pal);*/\r
        //modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].width, gvar.video.page[0].height, 2);\r
-       VL_LoadPalFile("data/spri/chikyuu.pal", &gvar.video.palette);\r
+       VL_LoadPalFile("data/spri/chikyuu.pal", &gvar.video.palette, &gvar);\r
        for (i = 0; i < 10; i++){\r
                enti.spri.delay = 1;\r
 \r
index 1b42f8f04be1b0ec75803e496e6a3801792eb853..7b97a9af19ff771627eca2938986882903bf69a9 100755 (executable)
@@ -108,7 +108,8 @@ void main(int argc, char *argv[])
        modexPalBlack();\r
 #endif\r
 \r
-       VGAmodeX(1/*bakapee*/, 1, &gvar);\r
+       //--VGAmodeX(1/*bakapee*/, 1, &gvar);\r
+       VL_Startup(&gvar);\r
 \r
        /* load color palette */\r
        /*ptmp.offset=(paloffset/3);\r
@@ -118,7 +119,7 @@ void main(int argc, char *argv[])
        //printf("1:    %d\n", paloffset);\r
        map.tiles->data->offset=(paloffset/3);\r
        modexPalUpdate(map.tiles->data, &paloffset, 0, 0);*/\r
-       VL_LoadPalFile(bakapee1p, &gvar.video.palette);\r
+       VL_LoadPalFile(bakapee1p, &gvar.video.palette, &gvar);\r
        //VL_LoadPalFile("data/default.pal", &gvar.video.palette);\r
 \r
 #ifdef FADE\r
@@ -216,7 +217,7 @@ void main(int argc, char *argv[])
                        }\r
                        //read_vrs(&gvar, bakapee1, gvar.player[0].enti.spri->spritesheet);\r
                        VRS_ReadVRS(bakapee1, &gvar.player[0].enti, &gvar);\r
-                       VL_LoadPalFile(bakapee1p, &gvar.video.palette);\r
+                       VL_LoadPalFile(bakapee1p, &gvar.video.palette, &gvar);\r
                }//JK\r
 #ifdef FADE\r
                if(gvar.in.inst->Keyboard[10]){ modexPalOverscan(rand()%56); modexPalUpdate(gvar.video.dpal); IN_UserInput(1, &gvar); }\r