--- /dev/null
+/* 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
+#include <stdio.h>\r
+#include "src/lib/16_vl.h"\r
+#include "src/lib/16_vlpal.h"\r
+#include "src/lib/16_in.h"\r
+#include "src/lib/scroll16.h"\r
+\r
+#define LGQ 32\r
+#define HGQ 55\r
+\r
+static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */\r
+\r
+void drawboxesmodex(page_t *pg)\r
+{\r
+ modexClearRegion(pg, 0, 0, pg->width, pg->height, 1);\r
+ modexClearRegion(pg, 16, 16, pg->sw, pg->sh, 2);\r
+ modexClearRegion(pg, 32, 32, pg->sw-32, pg->sh-32, 3);\r
+ modexClearRegion(pg, 48, 48, pg->sw-64, pg->sh-64, 2);\r
+}\r
+\r
+void copyboxesmodex(page_t *page, boolean pn)\r
+{\r
+ modexCopyPageRegion(&page[pn], &page[!pn], 0, 0, 0, 0, page[pn].width, page[pn].height);\r
+}\r
+\r
+void main(int argc, char *argv[])\r
+{\r
+ static word paloffset=0;\r
+ static global_game_variables_t gvar;\r
+\r
+// map_view_t mv[4];\r
+ map_t map;\r
+\r
+ int i, j;\r
+ word startclk, endclk;\r
+ word k;\r
+\r
+ imgtestpal_t bmp1, bmp2;\r
+\r
+\r
+ bmp1.width=bmp2.width= 40;\r
+ bmp1.width=bmp2.height= 30;\r
+\r
+ //====word colo=LGQ;\r
+\r
+ // DOSLIB: check our environment\r
+ /*probe_dos();\r
+\r
+ // DOSLIB: what CPU are we using?\r
+ // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS.\r
+ // So this code by itself shouldn't care too much what CPU it's running on. Except that other\r
+ // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for\r
+ // the CPU to carry out tasks. --J.C.\r
+ cpu_probe();\r
+\r
+ // DOSLIB: check for VGA\r
+ if (!probe_vga()) {\r
+ printf("VGA probe failed\n");\r
+ return;\r
+ }\r
+ // hardware must be VGA or higher!\r
+ if (!(vga_state.vga_flags & VGA_IS_VGA)) {\r
+ printf("This program requires VGA or higher graphics hardware\n");\r
+ return;\r
+ }\r
+\r
+ if (_DEBUG_INIT() == 0) {\r
+#ifdef DEBUGSERIAL\r
+ printf("WARNING: Failed to initialize DEBUG output\n");\r
+#endif\r
+ }\r
+ _DEBUG("Serial debug output started\n"); // NTS: All serial output must end messages with newline, or DOSBox-X will not emit text to log\r
+ _DEBUGF("Serial debug output printf test %u %u %u\n",1U,2U,3U);*/\r
+ Startup16(&gvar);\r
+\r
+ /* save the palette */\r
+ //====modexPalSave(pal);\r
+ //====modexFadeOff(1, pal);\r
+ //====modexPalBlack();\r
+\r
+ //IN_Startup();\r
+ IN_Default(0,&gvar.player[0],ctrl_Keyboard1, &gvar);\r
+ EN_initPlayer(&gvar.player[0], &gvar.video);\r
+\r
+ VGAmodeX(1, 1, &gvar);\r
+ modexPalBlack();\r
+\r
+ /* load our 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
+ //VL_LoadPalFilewithoffset("data/default.pal", &palette, paloffset);\r
+ modexLoadPalFile("data/16t.pal", &gvar.video.dpal);\r
+ bmp2.offset=(paloffset/3);\r
+ VL_palette(&bmp2, &gvar.video.dpal, &paloffset, 0, 0, &gvar);\r
+ //====modexLoadPalFile("data/default.pal", &pal2);\r
+\r
+ /* overscan show */\r
+ //modexPalOverscan(44+1);\r
+\r
+ /* set up the page, but with 16 pixels on all borders in offscreen mem */\r
+ modexHiganbanaPageSetup(&gvar);\r
+ ZC_MVSetup(&gvar.mv, &map, &gvar);\r
+\r
+ /* fill the page with one color, but with a black border */\r
+ /*modexClearRegion(&gvar.video.page[1], 0, 0, gvar.video.page[1].width, gvar.video.page[1].height, 15);\r
+ modexClearRegion(&gvar.video.page[1], 16, 16, gvar.video.page[1].sw, gvar.video.page[1].sh, 128);\r
+ modexClearRegion(&gvar.video.page[1], 32, 32, gvar.video.page[1].sw-32, gvar.video.page[1].sh-32, 42);\r
+ modexClearRegion(&gvar.video.page[1], 48, 48, gvar.video.page[1].sw-64, gvar.video.page[1].sh-64, 128);\r
+ modexShowPage(&gvar.video.page[1]);\r
+ modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].width, gvar.video.page[0].height, 15);\r
+ modexClearRegion(&gvar.video.page[0], 16, 16, gvar.video.page[0].sw, gvar.video.page[0].sh, 128);\r
+ modexClearRegion(&gvar.video.page[0], 32, 32, gvar.video.page[0].sw-32, gvar.video.page[0].sh-32, 42);\r
+ modexClearRegion(&gvar.video.page[0], 48, 48, gvar.video.page[0].sw-64, gvar.video.page[0].sh-64, 128);\r
+ modexShowPage(&gvar.video.page[0]);*/\r
+\r
+ drawboxesmodex(&gvar.video.page[0]);\r
+ copyboxesmodex(&gvar.video.page, 1);\r
+ modexClearRegion(&gvar.video.page[2], 0, 0, gvar.video.page[2].sw, gvar.video.page[2].sh, 4);\r
+ modexClearRegion(&gvar.video.page[3], 0, 0, gvar.video.page[3].sw, gvar.video.page[3].sh, 6);\r
+\r
+\r
+ /* fade in */\r
+ //====modexFadeOn(1, pal2);\r
+\r
+ i=0,k=0,j=0;\r
+ startclk = *clockw;\r
+ while(!gvar.in.inst->Keyboard[sc_Escape])\r
+ {\r
+ IN_ReadControl(&gvar.player[0], &gvar);\r
+ ZC_panPageManual(&gvar.mv, &gvar.player, 0);\r
+// if(gvar.in.inst->Keyboard[sc_5)){ modexClearRegion(&gvar.video.page[1], gvar.video.page[1].sw, 16, 8, 4, 45); }\r
+// if(gvar.in.inst->Keyboard[sc_4)){\r
+// modexClearRegion(&gvar.video.page[1], 16, 16, gvar.video.page[1].sw, gvar.video.page[1].sh, 128);\r
+// modexClearRegion(&gvar.video.page[1], 32, 32, gvar.video.page[1].sw-32, gvar.video.page[1].sh-32, 42);\r
+// modexClearRegion(&gvar.video.page[1], 48, 48, gvar.video.page[1].sw-64, gvar.video.page[1].sh-64, 128);\r
+// }\r
+ TAIL_PANKEYFUN;\r
+ if(gvar.in.inst->Keyboard[12]) modexClearRegion(&gvar.video.page[0], (gvar.video.page[0].width/2)-4, (gvar.video.page[0].height/2)-16, 24, 32, 15);\r
+ if(gvar.in.inst->Keyboard[13]) modexClearRegion(&gvar.video.page[1], (gvar.video.page[1].width/2)-4, (gvar.video.page[1].height/2)-16, 24, 32, 15);\r
+/*==== if(gvar.in.inst->Keyboard[7)){\r
+ for(i=0;i<3;i++)\r
+ {\r
+ pal2[i] = rand()%64;\r
+ modexPalUpdate(pal2);\r
+ colo++;\r
+ if(colo>HGQ) colo=LGQ;\r
+ }\r
+// if(i>PAL_SIZE) i=0;\r
+ }//9*/\r
+ if(gvar.in.inst->Keyboard[25]){ modexpdump(gvar.video.sp, &gvar); IN_UserInput(1, &gvar); }//p\r
+ if(gvar.in.inst->Keyboard[sc_I]){ drawboxesmodex(&gvar.video.page[gvar.video.sp]); IN_UserInput(1, &gvar); }//i\r
+ if(gvar.in.inst->Keyboard[sc_O]){ copyboxesmodex(&gvar.video.page, !gvar.video.sp); IN_UserInput(1, &gvar); }//o\r
+ VL_ShowPage(&gvar.video.page[gvar.video.sp], 0, 0);\r
+ //ZC_ShowMV(&gvar.mv, 0, 0);\r
+ }\r
+\r
+ endclk = *clockw;\r
+\r
+ /* fade back to text mode */\r
+ //====modexFadeOff(1, pal2);\r
+ //====modexPalBlack();\r
+ VGAmodeX(0, 1, &gvar);\r
+ Shutdown16(&gvar);\r
+ printf("Project 16 vidtest.exe. This is just a test file!\n");\r
+ printf("version %s\n", VERSION);\r
+ VL_PrintmodexmemInfo(&gvar.video);\r
+ printf("tx=%d ", gvar.mv[gvar.video.sp].tx); printf("ty=%d ", gvar.mv[gvar.video.sp].ty); printf("gvar.player.d=%d\n", gvar.player[0].enti.d);\r
+ printf("\n====\n");\r
+ printf("0 paloffset= %d\n", paloffset/3);\r
+ printf("====\n\n");\r
+ //IN_Shutdown();\r
+ //====modexPalBlack();\r
+ //====modexFadeOn(1, pal);\r
+}\r
\r
void main(int argc, char *argv[])\r
{\r
- static word paloffset=0;\r
static global_game_variables_t gvar;\r
-\r
-// map_view_t mv[4];\r
map_t map;\r
\r
int i, j;\r
word startclk, endclk;\r
word k;\r
\r
- imgtestpal_t bmp1, bmp2;\r
-\r
-\r
- bmp1.width=bmp2.width= 40;\r
- bmp1.width=bmp2.height= 30;\r
-\r
- //====word colo=LGQ;\r
-\r
- // DOSLIB: check our environment\r
- /*probe_dos();\r
-\r
- // DOSLIB: what CPU are we using?\r
- // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS.\r
- // So this code by itself shouldn't care too much what CPU it's running on. Except that other\r
- // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for\r
- // the CPU to carry out tasks. --J.C.\r
- cpu_probe();\r
-\r
- // DOSLIB: check for VGA\r
- if (!probe_vga()) {\r
- printf("VGA probe failed\n");\r
- return;\r
- }\r
- // hardware must be VGA or higher!\r
- if (!(vga_state.vga_flags & VGA_IS_VGA)) {\r
- printf("This program requires VGA or higher graphics hardware\n");\r
- return;\r
- }\r
-\r
- if (_DEBUG_INIT() == 0) {\r
-#ifdef DEBUGSERIAL\r
- printf("WARNING: Failed to initialize DEBUG output\n");\r
-#endif\r
- }\r
- _DEBUG("Serial debug output started\n"); // NTS: All serial output must end messages with newline, or DOSBox-X will not emit text to log\r
- _DEBUGF("Serial debug output printf test %u %u %u\n",1U,2U,3U);*/\r
Startup16(&gvar);\r
\r
/* save the palette */\r
\r
/* load our 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
- //VL_LoadPalFilewithoffset("data/default.pal", &palette, paloffset);\r
- modexLoadPalFile("data/16t.pal", &gvar.video.dpal);\r
- bmp2.offset=(paloffset/3);\r
- VL_palette(&bmp2, &gvar.video.dpal, &paloffset, 0, 0, &gvar);\r
- //====modexLoadPalFile("data/default.pal", &pal2);\r
\r
/* overscan show */\r
//modexPalOverscan(44+1);\r
ZC_MVSetup(&gvar.mv, &map, &gvar);\r
\r
/* fill the page with one color, but with a black border */\r
- /*modexClearRegion(&gvar.video.page[1], 0, 0, gvar.video.page[1].width, gvar.video.page[1].height, 15);\r
- modexClearRegion(&gvar.video.page[1], 16, 16, gvar.video.page[1].sw, gvar.video.page[1].sh, 128);\r
- modexClearRegion(&gvar.video.page[1], 32, 32, gvar.video.page[1].sw-32, gvar.video.page[1].sh-32, 42);\r
- modexClearRegion(&gvar.video.page[1], 48, 48, gvar.video.page[1].sw-64, gvar.video.page[1].sh-64, 128);\r
- modexShowPage(&gvar.video.page[1]);\r
- modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].width, gvar.video.page[0].height, 15);\r
- modexClearRegion(&gvar.video.page[0], 16, 16, gvar.video.page[0].sw, gvar.video.page[0].sh, 128);\r
- modexClearRegion(&gvar.video.page[0], 32, 32, gvar.video.page[0].sw-32, gvar.video.page[0].sh-32, 42);\r
- modexClearRegion(&gvar.video.page[0], 48, 48, gvar.video.page[0].sw-64, gvar.video.page[0].sh-64, 128);\r
- modexShowPage(&gvar.video.page[0]);*/\r
-\r
drawboxesmodex(&gvar.video.page[0]);\r
copyboxesmodex(&gvar.video.page, 1);\r
modexClearRegion(&gvar.video.page[2], 0, 0, gvar.video.page[2].sw, gvar.video.page[2].sh, 4);\r
TAIL_PANKEYFUN;\r
if(gvar.in.inst->Keyboard[12]) modexClearRegion(&gvar.video.page[0], (gvar.video.page[0].width/2)-4, (gvar.video.page[0].height/2)-16, 24, 32, 15);\r
if(gvar.in.inst->Keyboard[13]) modexClearRegion(&gvar.video.page[1], (gvar.video.page[1].width/2)-4, (gvar.video.page[1].height/2)-16, 24, 32, 15);\r
-/*==== if(gvar.in.inst->Keyboard[7)){\r
- for(i=0;i<3;i++)\r
- {\r
- pal2[i] = rand()%64;\r
- modexPalUpdate(pal2);\r
- colo++;\r
- if(colo>HGQ) colo=LGQ;\r
- }\r
-// if(i>PAL_SIZE) i=0;\r
- }//9*/\r
+\r
if(gvar.in.inst->Keyboard[25]){ modexpdump(gvar.video.sp, &gvar); IN_UserInput(1, &gvar); }//p\r
if(gvar.in.inst->Keyboard[sc_I]){ drawboxesmodex(&gvar.video.page[gvar.video.sp]); IN_UserInput(1, &gvar); }//i\r
if(gvar.in.inst->Keyboard[sc_O]){ copyboxesmodex(&gvar.video.page, !gvar.video.sp); IN_UserInput(1, &gvar); }//o\r
printf("version %s\n", VERSION);\r
VL_PrintmodexmemInfo(&gvar.video);\r
printf("tx=%d ", gvar.mv[gvar.video.sp].tx); printf("ty=%d ", gvar.mv[gvar.video.sp].ty); printf("gvar.player.d=%d\n", gvar.player[0].enti.d);\r
- printf("\n====\n");\r
- printf("0 paloffset= %d\n", paloffset/3);\r
- printf("====\n\n");\r
//IN_Shutdown();\r
//====modexPalBlack();\r
//====modexFadeOn(1, pal);\r