1 /* Project 16 Source Code~
\r
2 * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123
\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/modex16.h"
\r
25 #include "src/lib/16_in.h"
\r
27 global_game_variables_t gvar;
\r
28 player_t player[MaxPlayers];
\r
30 void main(int argc, char *argv[])
\r
39 if(argv[1]) bakapee = atoi(argv[1]);
\r
43 // DOSLIB: check our environment
\r
46 // DOSLIB: what CPU are we using?
\r
47 // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS.
\r
48 // So this code by itself shouldn't care too much what CPU it's running on. Except that other
\r
49 // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for
\r
50 // the CPU to carry out tasks. --J.C.
\r
53 // DOSLIB: check for VGA
\r
55 printf("VGA probe failed\n");
\r
58 // hardware must be VGA or higher!
\r
59 if (!(vga_state.vga_flags & VGA_IS_VGA)) {
\r
60 printf("This program requires VGA or higher graphics hardware\n");
\r
64 /* load our palette */
\r
65 modexLoadPalFile("data/default.pal", &pal2);
\r
67 /* save the palette */
\r
68 pal = modexNewPal();
\r
70 modexFadeOff(1, pal);
\r
74 IN_Default(0,&player,ctrl_Joystick);
\r
77 VGAmodeX(bakapee, 1, &gvar);
\r
80 /* set up the page, but with 16 pixels on all borders in offscreen mem */
\r
81 modexHiganbanaPageSetup(&gvar.video);
\r
82 // gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]);
\r
83 // gvar.video.page[1] = modexNextPage(&gvar.video.page[0]);
\r
84 // gvar.video.page[0].width += 32;
\r
85 // gvar.video.page[0].height += 32;
\r
88 /* fill the page with one color, but with a black border */
\r
89 modexShowPage(&gvar.video.page[1]);
\r
90 //modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].width, gvar.video.page[0].height, 0);
\r
91 modexClearRegion(&gvar.video.page[0], 16, 16, gvar.video.page[0].sw, gvar.video.page[0].sh, 128);
\r
92 modexClearRegion(&gvar.video.page[0], 32, 32, gvar.video.page[0].sw-32, gvar.video.page[0].sh-32, 42);
\r
93 modexClearRegion(&gvar.video.page[0], 48, 48, gvar.video.page[0].sw-64, gvar.video.page[0].sh-64, 128);
\r
94 modexShowPage(&gvar.video.page[0]);
\r
95 modexCopyPageRegion(&gvar.video.page[1], &gvar.video.page[0], 0, 0, 0, 0, gvar.video.page[0].width, gvar.video.page[0].height);
\r
98 modexFadeOn(1, pal2);
\r
102 while(!IN_KeyDown(sc_Escape) && i<5)
\r
104 IN_ReadControl(0,&player);
\r
109 gvar.video.page[p].dx++;
\r
110 if(j>=32){ k++; j=0; }else j++;
\r
114 gvar.video.page[p].dx--;
\r
115 if(j>=32){ k++; j=0; }else j++;
\r
119 gvar.video.page[p].dy++;
\r
120 if(j>=32){ k++; j=0; }else j++;
\r
124 gvar.video.page[p].dy--;
\r
125 if(j>=32){ k=0; j=0; i++; }else j++;
\r
131 if(IN_KeyDown(2)) p=0;
\r
132 if(IN_KeyDown(3)) p=1;
\r
133 modexShowPage(&gvar.video.page[p]);
\r
138 /* fade back to text mode */
\r
139 modexFadeOff(1, pal2);
\r
141 VGAmodeX(0, 1, &gvar);
\r
142 printf("Project 16 test.exe. This is just a test file!\n");
\r
143 printf("version %s\n", VERSION);
\r
144 printf("video memory remaining: %ld\n", gvar.video.vmem_remain);
\r
146 for(i=0; i<gvar.video.num_of_pages;i++)
\r
148 printf(" [%u]=", i);
\r
149 printf("(%Fp)\n", (gvar.video.page[i].data));
\r
153 modexFadeOn(1, pal);
\r