1 /* Project 16 Source Code~
\r
2 * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover
\r
4 * This file is part of Project 16.
\r
6 * Project 16 is free software; you can redistribute it and/or modify
\r
7 * it under the terms of the GNU General Public License as published by
\r
8 * the Free Software Foundation; either version 3 of the License, or
\r
9 * (at your option) any later version.
\r
11 * Project 16 is distributed in the hope that it will be useful,
\r
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 * GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License
\r
17 * along with this program. If not, see <http://www.gnu.org/licenses/>, or
\r
18 * write to the Free Software Foundation, Inc., 51 Franklin Street,
\r
19 * Fifth Floor, Boston, MA 02110-1301 USA.
\r
24 #include "src/lib/16_vl.h"
\r
25 #include "src/lib/16_in.h"
\r
26 #include "src/lib/scroll16.h"
\r
31 static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */
\r
33 void main(int argc, char *argv[])
\r
35 static global_game_variables_t gvar;
\r
36 static player_t player[MaxPlayers];
\r
42 word startclk, endclk;
\r
44 //====byte *pal, *pal2;
\r
46 //====word colo=LGQ;
\r
48 // DOSLIB: check our environment
\r
51 // DOSLIB: what CPU are we using?
\r
52 // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS.
\r
53 // So this code by itself shouldn't care too much what CPU it's running on. Except that other
\r
54 // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for
\r
55 // the CPU to carry out tasks. --J.C.
\r
58 // DOSLIB: check for VGA
\r
60 printf("VGA probe failed\n");
\r
63 // hardware must be VGA or higher!
\r
64 if (!(vga_state.vga_flags & VGA_IS_VGA)) {
\r
65 printf("This program requires VGA or higher graphics hardware\n");
\r
69 if (_DEBUG_INIT() == 0) {
\r
71 printf("WARNING: Failed to initialize DEBUG output\n");
\r
74 _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
75 _DEBUGF("Serial debug output printf test %u %u %u\n",1U,2U,3U);*/
\r
78 /* save the palette */
\r
79 //====pal = modexNewPal();
\r
80 //====modexPalSave(pal);
\r
81 //====modexFadeOff(1, pal);
\r
82 //====modexPalBlack();
\r
85 IN_Default(0,&player,ctrl_Keyboard1);
\r
86 EN_initplayer(&player, 0);
\r
88 VGAmodeX(1, 1, &gvar);
\r
89 //====modexPalBlack();
\r
91 /* load our palette */
\r
92 //====modexLoadPalFile("data/default.pal", &pal2);
\r
95 //modexPalOverscan(44+1);
\r
97 /* set up the page, but with 16 pixels on all borders in offscreen mem */
\r
98 modexHiganbanaPageSetup(&gvar.video);
\r
99 ZC_MVSetup(&mv, &map, &gvar);
\r
101 /* fill the page with one color, but with a black border */
\r
102 /*modexClearRegion(&gvar.video.page[1], 0, 0, gvar.video.page[1].width, gvar.video.page[1].height, 15);
\r
103 modexClearRegion(&gvar.video.page[1], 16, 16, gvar.video.page[1].sw, gvar.video.page[1].sh, 128);
\r
104 modexClearRegion(&gvar.video.page[1], 32, 32, gvar.video.page[1].sw-32, gvar.video.page[1].sh-32, 42);
\r
105 modexClearRegion(&gvar.video.page[1], 48, 48, gvar.video.page[1].sw-64, gvar.video.page[1].sh-64, 128);
\r
106 modexShowPage(&gvar.video.page[1]);
\r
107 modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].width, gvar.video.page[0].height, 15);
\r
108 modexClearRegion(&gvar.video.page[0], 16, 16, gvar.video.page[0].sw, gvar.video.page[0].sh, 128);
\r
109 modexClearRegion(&gvar.video.page[0], 32, 32, gvar.video.page[0].sw-32, gvar.video.page[0].sh-32, 42);
\r
110 modexClearRegion(&gvar.video.page[0], 48, 48, gvar.video.page[0].sw-64, gvar.video.page[0].sh-64, 128);
\r
111 modexShowPage(&gvar.video.page[0]);*/
\r
114 modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].width, gvar.video.page[0].height, 15);
\r
115 modexClearRegion(&gvar.video.page[0], 16, 16, gvar.video.page[0].sw, gvar.video.page[0].sh, 128);
\r
116 modexClearRegion(&gvar.video.page[0], 32, 32, gvar.video.page[0].sw-32, gvar.video.page[0].sh-32, 42);
\r
117 modexClearRegion(&gvar.video.page[0], 48, 48, gvar.video.page[0].sw-64, gvar.video.page[0].sh-64, 128);
\r
118 modexCopyPageRegion(&gvar.video.page[1], &gvar.video.page[0], 0, 0, 0, 0, gvar.video.page[0].width, gvar.video.page[0].height);
\r
119 modexClearRegion(&gvar.video.page[2], 0, 0, gvar.video.page[2].sw, gvar.video.page[2].sh, 47);
\r
120 modexClearRegion(&gvar.video.page[3], 0, 0, gvar.video.page[3].sw, gvar.video.page[3].sh, 45);
\r
124 //====modexFadeOn(1, pal2);
\r
127 startclk = *clockw;
\r
128 while(!IN_KeyDown(sc_Escape))
\r
130 IN_ReadControl(0,&player);
\r
131 ZC_panPageManual(&mv, &player, 0);
\r
141 gvar.video.page[gvar.video.sp].dx++;
\r
142 if(i==5){ if(j>=31){ i++; j=0; goto baka; }else j++; }else
\r
143 if(j>=32){ k++; j=0; }else j++;
\r
147 gvar.video.page[gvar.video.sp].dx--;
\r
148 if(j>=32){ k++; j=0; }else j++;
\r
152 gvar.video.page[gvar.video.sp].dy++;
\r
153 if(j>=32){ k++; j=0; }else j++;
\r
157 gvar.video.page[gvar.video.sp].dy--;
\r
158 if(j>=32){ k=0; j=0; i++; }else j++;
\r
167 modexClearRegion(&gvar.video.page[1], 0, gvar.video.page[0].height/2, gvar.video.page[0].width-32, 16, 45);*/
\r
168 // if(IN_KeyDown(6))
\r
170 // modexClearRegion(&gvar.video.page[1], gvar.video.page[1].sw, 16, 8, 4, 45);
\r
172 // if(IN_KeyDown(4+1)){
\r
173 // modexClearRegion(&gvar.video.page[1], 16, 16, gvar.video.page[1].sw, gvar.video.page[1].sh, 128);
\r
174 // modexClearRegion(&gvar.video.page[1], 32, 32, gvar.video.page[1].sw-32, gvar.video.page[1].sh-32, 42);
\r
175 // modexClearRegion(&gvar.video.page[1], 48, 48, gvar.video.page[1].sw-64, gvar.video.page[1].sh-64, 128);
\r
179 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
180 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
181 /*==== if(IN_KeyDown(7)){
\r
184 pal2[i] = rand()%64;
\r
185 modexPalUpdate1(pal2);
\r
187 if(colo>HGQ) colo=LGQ;
\r
189 // if(i>PAL_SIZE) i=0;
\r
191 if(IN_KeyDown(25)){ modexpdump(&gvar.video.page[gvar.video.sp]); IN_UserInput(1,1); }//p
\r
192 //VL_ShowPage(&gvar.video.page[gvar.video.sp], 0, 0);
\r
193 ZC_ShowMV(&mv, 0, 0);
\r
198 /* fade back to text mode */
\r
199 //====modexFadeOff(1, pal2);
\r
200 //====modexPalBlack();
\r
201 VGAmodeX(0, 1, &gvar);
\r
203 printf("Project 16 test.exe. This is just a test file!\n");
\r
204 printf("version %s\n", VERSION);
\r
205 VL_PrintmodexmemInfo(&gvar.video);
\r
206 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
208 //====modexPalBlack();
\r
209 //====modexFadeOn(1, pal);
\r