+++ /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 main(int argc, char *argv[])\r
-{\r
- static word paloffset=0;\r
- static global_game_variables_t gvar;\r
- static player_t player[MaxPlayers];\r
-\r
- map_t map;\r
- map_view_t mv[4];\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,&player,ctrl_Keyboard1);\r
- EN_initplayer(&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);\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.video);\r
- ZC_MVSetup(&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
-\r
- modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].width, gvar.video.page[0].height, 1);\r
- modexClearRegion(&gvar.video.page[0], 16, 16, gvar.video.page[0].sw, gvar.video.page[0].sh, 2);\r
- modexClearRegion(&gvar.video.page[0], 32, 32, gvar.video.page[0].sw-32, gvar.video.page[0].sh-32, 3);\r
- modexClearRegion(&gvar.video.page[0], 48, 48, gvar.video.page[0].sw-64, gvar.video.page[0].sh-64, 2);\r
- modexCopyPageRegion(&gvar.video.page[1], &gvar.video.page[0], 0, 0, 0, 0, gvar.video.page[0].width, gvar.video.page[0].height);\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(!IN_KeyDown(sc_Escape))\r
- {\r
- IN_ReadControl(0,&player);\r
- ZC_panPageManual(&mv, &player, 0);\r
- //[gvar.video.sp]\r
- //ZC_MVSync(&mv);\r
-\r
- /*if(i<5){\r
- switch (k)\r
- {\r
- case 0:\r
- pee:\r
- // go right\r
- gvar.video.page[gvar.video.sp].dx++;\r
- if(i==5){ if(j>=31){ i++; j=0; goto baka; }else j++; }else\r
- if(j>=32){ k++; j=0; }else j++;\r
- break;\r
- case 1:\r
- // go left\r
- gvar.video.page[gvar.video.sp].dx--;\r
- if(j>=32){ k++; j=0; }else j++;\r
- break;\r
- case 2:\r
- // go up\r
- gvar.video.page[gvar.video.sp].dy++;\r
- if(j>=32){ k++; j=0; }else j++;\r
- break;\r
- case 3:\r
- // go down\r
- gvar.video.page[gvar.video.sp].dy--;\r
- if(j>=32){ k=0; j=0; i++; }else j++;\r
- break;\r
- default:\r
-\r
- break;\r
- }}else{\r
- if(i==5) goto pee;\r
- baka:\r
- i++;\r
- modexClearRegion(&gvar.video.page[1], 0, gvar.video.page[0].height/2, gvar.video.page[0].width-32, 16, 45);*/\r
-// if(IN_KeyDown(6))\r
-// {\r
-// modexClearRegion(&gvar.video.page[1], gvar.video.page[1].sw, 16, 8, 4, 45);\r
-// }\r
-// if(IN_KeyDown(4+1)){\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
- //}\r
- PANKEYFUN;\r
- if(IN_KeyDown(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(IN_KeyDown(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(IN_KeyDown(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(IN_KeyDown(25)){ modexpdump(&gvar.video.page[gvar.video.sp]); IN_UserInput(1,1); }//p\r
- //VL_ShowPage(&gvar.video.page[gvar.video.sp], 0, 0);\r
- ZC_ShowMV(&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 test.exe. This is just a test file!\n");\r
- printf("version %s\n", VERSION);\r
- VL_PrintmodexmemInfo(&gvar.video);\r
- printf("tx=%d ", mv[gvar.video.sp].tx); printf("ty=%d ", mv[gvar.video.sp].ty); printf("player.d=%d\n", 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