/* Project 16 Source Code~\r
- * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
+ * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
*\r
* This file is part of Project 16.\r
*\r
*/\r
\r
#include <stdio.h>\r
-#include "src/lib/modex16.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
-#include "src/lib/bakapee.h"\r
\r
-global_game_variables_t gvar;\r
-player_t player[MaxPlayers];\r
-map_view_t mv[4];\r
-pan_t pan;\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
- byte *pal, *pal2;\r
- sword bakapee;\r
\r
- word colo=LGQ;\r
+ imgtestpal_t bmp1, bmp2;\r
+ bmp1.width=bmp2.width= 40;\r
+ bmp1.width=bmp2.height= 30;\r
+ //====byte *pal, *pal2;\r
\r
- //argument\r
- if(argv[1]) bakapee = atoi(argv[1]);\r
- else bakapee = 1;\r
+ //====word colo=LGQ;\r
\r
// DOSLIB: check our environment\r
- probe_dos();\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
#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
+ _DEBUGF("Serial debug output printf test %u %u %u\n",1U,2U,3U);*/\r
+ Startup16(&gvar);\r
\r
/* save the palette */\r
- pal = modexNewPal();\r
- modexPalSave(pal);\r
- modexFadeOff(1, pal);\r
- modexPalBlack();\r
+ //====pal = modexNewPal();\r
+ //====modexPalSave(pal);\r
+ //====modexFadeOff(1, pal);\r
+ //====modexPalBlack();\r
\r
- IN_Startup();\r
+ //IN_Startup();\r
IN_Default(0,&player,ctrl_Keyboard1);\r
- IN_initplayer(&player, 0);\r
+ EN_initplayer(&player, 0, &gvar.video);\r
\r
- textInit();\r
- VGAmodeX(bakapee, 1, &gvar);\r
- modexPalBlack();\r
+ VGAmodeX(1, 1, &gvar);\r
+ //====modexPalBlack();\r
\r
/* load our palette */\r
- modexLoadPalFile("data/default.pal", &pal2);\r
+ VL_LoadPalFile("data/16.pal", &gvar.video.palette);\r
+ bmp1.offset=(paloffset/3);\r
+ VL_palette(&bmp1, &gvar.video.palette, &paloffset, 0, 0);\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
- for(i=0;i<gvar.video.num_of_pages;i++)\r
- {\r
- mv[i].page = &gvar.video.page[i];\r
- mv[i].video = &gvar.video;\r
- mv[i].pan = &pan;\r
- mv[i].tx = 0;\r
- mv[i].ty = 0;\r
- }\r
-// gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]);\r
-// gvar.video.page[1] = modexNextPage(&gvar.video.page[0]);\r
-\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[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
- 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
+\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, 47);\r
- modexClearRegion(&gvar.video.page[3], 0, 0, gvar.video.page[3].sw, gvar.video.page[3].sh, 45);\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
+ //====modexFadeOn(1, pal2);\r
\r
- i=0,k=0,j=0,pan.pn=1;\r
+ i=0,k=0,j=0;\r
startclk = *clockw;\r
while(!IN_KeyDown(sc_Escape))\r
{\r
IN_ReadControl(0,&player);\r
- panpagemanual(mv, player, 0);\r
+ ZC_panPageManual(&mv, &player, 0);\r
+ //[gvar.video.sp]\r
+ //ZC_MVSync(&mv);\r
\r
/*if(i<5){\r
switch (k)\r
case 0:\r
pee:\r
// go right\r
- gvar.video.page[pan.pn].dx++;\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[pan.pn].dx--;\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[pan.pn].dy++;\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[pan.pn].dy--;\r
+ gvar.video.page[gvar.video.sp].dy--;\r
if(j>=32){ k=0; j=0; i++; }else j++;\r
break;\r
default:\r
// modexClearRegion(&gvar.video.page[1], 48, 48, gvar.video.page[1].sw-64, gvar.video.page[1].sh-64, 128);\r
// }\r
//}\r
- if(IN_KeyDown(1+1)){ pan.pn=0; }\r
- if(IN_KeyDown(2+1)){ pan.pn=1; }\r
- if(IN_KeyDown(3+1)){ pan.pn=2; }\r
- if(IN_KeyDown(4+1)){ pan.pn=3; }\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
+/*==== if(IN_KeyDown(7)){\r
for(i=0;i<3;i++)\r
{\r
pal2[i] = rand()%64;\r
- modexPalUpdate1(pal2);\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)){\r
- modexpdump(&gvar.video.page[pan.pn]);\r
- IN_UserInput(1,1);\r
- }//p\r
- modexShowPage(&gvar.video.page[pan.pn]);\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
+ //====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
- modexprintmeminfo(&gvar.video);\r
- printf("tx=%d ", mv[pan.pn].tx); printf("ty=%d ", mv[pan.pn].ty); printf("player.d=%d\n", player[0].d);\r
- IN_Shutdown();\r
- modexPalBlack();\r
- modexFadeOn(1, pal);\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