1 /* Project 16 Source Code~
\r
2 * Copyright (C) 2012-2016 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/16_scr.h"
\r
27 #include "src/lib/bakapee.h"
\r
29 static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */
\r
30 global_game_variables_t gvar;
\r
31 player_t player[MaxPlayers];
\r
35 void main(int argc, char *argv[])
\r
38 word startclk, endclk;
\r
46 if(argv[1]) bakapee = atoi(argv[1]);
\r
49 // DOSLIB: check our environment
\r
52 // DOSLIB: what CPU are we using?
\r
53 // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS.
\r
54 // So this code by itself shouldn't care too much what CPU it's running on. Except that other
\r
55 // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for
\r
56 // the CPU to carry out tasks. --J.C.
\r
59 // DOSLIB: check for VGA
\r
61 printf("VGA probe failed\n");
\r
64 // hardware must be VGA or higher!
\r
65 if (!(vga_state.vga_flags & VGA_IS_VGA)) {
\r
66 printf("This program requires VGA or higher graphics hardware\n");
\r
70 if (_DEBUG_INIT() == 0) {
\r
72 printf("WARNING: Failed to initialize DEBUG output\n");
\r
75 _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
76 _DEBUGF("Serial debug output printf test %u %u %u\n",1U,2U,3U);
\r
78 /* save the palette */
\r
79 pal = modexNewPal();
\r
81 modexFadeOff(1, pal);
\r
85 IN_Default(0,&player,ctrl_Keyboard1);
\r
86 IN_initplayer(&player, 0);
\r
89 VGAmodeX(bakapee, 1, &gvar);
\r
92 /* load our palette */
\r
93 modexLoadPalFile("data/default.pal", &pal2);
\r
96 //modexPalOverscan(44+1);
\r
98 /* set up the page, but with 16 pixels on all borders in offscreen mem */
\r
99 modexHiganbanaPageSetup(&gvar.video);
\r
100 for(i=0;i<gvar.video.num_of_pages;i++)
\r
102 mv[i].page = &gvar.video.page[i];
\r
103 mv[i].video = &gvar.video;
\r
108 // gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]);
\r
109 // gvar.video.page[1] = modexNextPage(&gvar.video.page[0]);
\r
112 /* fill the page with one color, but with a black border */
\r
113 /*modexClearRegion(&gvar.video.page[1], 0, 0, gvar.video.page[1].width, gvar.video.page[1].height, 15);
\r
114 modexClearRegion(&gvar.video.page[1], 16, 16, gvar.video.page[1].sw, gvar.video.page[1].sh, 128);
\r
115 modexClearRegion(&gvar.video.page[1], 32, 32, gvar.video.page[1].sw-32, gvar.video.page[1].sh-32, 42);
\r
116 modexClearRegion(&gvar.video.page[1], 48, 48, gvar.video.page[1].sw-64, gvar.video.page[1].sh-64, 128);
\r
117 modexShowPage(&gvar.video.page[1]);
\r
118 modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].width, gvar.video.page[0].height, 15);
\r
119 modexClearRegion(&gvar.video.page[0], 16, 16, gvar.video.page[0].sw, gvar.video.page[0].sh, 128);
\r
120 modexClearRegion(&gvar.video.page[0], 32, 32, gvar.video.page[0].sw-32, gvar.video.page[0].sh-32, 42);
\r
121 modexClearRegion(&gvar.video.page[0], 48, 48, gvar.video.page[0].sw-64, gvar.video.page[0].sh-64, 128);
\r
122 modexShowPage(&gvar.video.page[0]);*/
\r
123 modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].width, gvar.video.page[0].height, 15);
\r
124 modexClearRegion(&gvar.video.page[0], 16, 16, gvar.video.page[0].sw, gvar.video.page[0].sh, 128);
\r
125 modexClearRegion(&gvar.video.page[0], 32, 32, gvar.video.page[0].sw-32, gvar.video.page[0].sh-32, 42);
\r
126 modexClearRegion(&gvar.video.page[0], 48, 48, gvar.video.page[0].sw-64, gvar.video.page[0].sh-64, 128);
\r
127 modexCopyPageRegion(&gvar.video.page[1], &gvar.video.page[0], 0, 0, 0, 0, gvar.video.page[0].width, gvar.video.page[0].height);
\r
128 modexClearRegion(&gvar.video.page[2], 0, 0, gvar.video.page[2].sw, gvar.video.page[2].sh, 47);
\r
129 modexClearRegion(&gvar.video.page[3], 0, 0, gvar.video.page[3].sw, gvar.video.page[3].sh, 45);
\r
132 modexFadeOn(1, pal2);
\r
134 i=0,k=0,j=0,pan.pn=1;
\r
135 startclk = *clockw;
\r
136 while(!IN_KeyDown(sc_Escape))
\r
138 IN_ReadControl(0,&player);
\r
139 panpagemanual(mv, player, 0);
\r
147 gvar.video.page[pan.pn].dx++;
\r
148 if(i==5){ if(j>=31){ i++; j=0; goto baka; }else j++; }else
\r
149 if(j>=32){ k++; j=0; }else j++;
\r
153 gvar.video.page[pan.pn].dx--;
\r
154 if(j>=32){ k++; j=0; }else j++;
\r
158 gvar.video.page[pan.pn].dy++;
\r
159 if(j>=32){ k++; j=0; }else j++;
\r
163 gvar.video.page[pan.pn].dy--;
\r
164 if(j>=32){ k=0; j=0; i++; }else j++;
\r
173 modexClearRegion(&gvar.video.page[1], 0, gvar.video.page[0].height/2, gvar.video.page[0].width-32, 16, 45);*/
\r
174 // if(IN_KeyDown(6))
\r
176 // modexClearRegion(&gvar.video.page[1], gvar.video.page[1].sw, 16, 8, 4, 45);
\r
178 // if(IN_KeyDown(4+1)){
\r
179 // modexClearRegion(&gvar.video.page[1], 16, 16, gvar.video.page[1].sw, gvar.video.page[1].sh, 128);
\r
180 // modexClearRegion(&gvar.video.page[1], 32, 32, gvar.video.page[1].sw-32, gvar.video.page[1].sh-32, 42);
\r
181 // modexClearRegion(&gvar.video.page[1], 48, 48, gvar.video.page[1].sw-64, gvar.video.page[1].sh-64, 128);
\r
184 if(IN_KeyDown(1+1)){ pan.pn=0; }
\r
185 if(IN_KeyDown(2+1)){ pan.pn=1; }
\r
186 if(IN_KeyDown(3+1)){ pan.pn=2; }
\r
187 if(IN_KeyDown(4+1)){ pan.pn=3; }
\r
188 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
189 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
193 pal2[i] = rand()%64;
\r
194 modexPalUpdate1(pal2);
\r
196 if(colo>HGQ) colo=LGQ;
\r
198 // if(i>PAL_SIZE) i=0;
\r
200 if(IN_KeyDown(25)){
\r
201 modexpdump(&gvar.video.page[pan.pn]);
\r
204 modexShowPage(&gvar.video.page[pan.pn]);
\r
209 /* fade back to text mode */
\r
210 modexFadeOff(1, pal2);
\r
212 VGAmodeX(0, 1, &gvar);
\r
213 printf("Project 16 test.exe. This is just a test file!\n");
\r
214 printf("version %s\n", VERSION);
\r
215 modexprintmeminfo(&gvar.video);
\r
216 printf("tx=%d ", mv[pan.pn].tx); printf("ty=%d ", mv[pan.pn].ty); printf("player.d=%d\n", player[0].d);
\r
219 modexFadeOn(1, pal);
\r