1 /* Project 16 Source Code~
2 * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123
4 * This file is part of Project 16.
6 * Project 16 is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * Project 16 is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You screen.heightould have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>, or
18 * write to the Free Software Foundation, Inc., 51 Franklin Street,
19 * Fifth Floor, Boston, MA 02110-1301 USA.
23 #include "src/bakapi.h"
28 global_game_variables_t gvar;
29 static bakapee_t bakapee;
30 word key,d,xpos,ypos,xdir,ydir;
34 main(int argc, char *argvar[])
36 // DOSLIB: check our environment
39 // DOSLIB: what CPU are we using?
40 // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS.
41 // So this code by itself shouldn't care too much what CPU it's running on. Except that other
42 // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for
43 // the CPU to carry out tasks. --J.C.
46 // DOSLIB: check for VGA
48 printf("VGA probe failed\n");
51 // hardware must be VGA or higher!
52 if (!(vga_state.vga_flags & VGA_IS_VGA)) {
53 printf("This program requires VGA or higher graphics hardware\n");
57 // main variables values
58 d=4; // switch variable
59 key=2; // default screensaver number
66 VGAmodeX(1, &gvar); // TODO: Suggestion: Instead of magic numbers for the first param, might I suggest defining an enum or some #define constants that are easier to remember? --J.C.
68 # error REMOVED // this code is written around modex16 which so far is a better fit than using DOSLIB vga directly, so leave MXLIB code in.
69 // we'll integrate DOSLIB vga into that part of the code instead for less disruption. -- J.C.
71 bakapee.xx = rand()&0%gvar.video.page[0].width;
72 bakapee.yy = rand()&0%gvar.video.page[0].height;
81 /* setup camera and screen~ */
82 gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]);
83 gvar.video.page[0].width += (TILEWH*2);
84 gvar.video.page[0].height += (TILEWH*2);
87 //modexPalUpdate(bmp.palette); //____
88 //modexDrawBmp(VGA, 0, 0, &bmp, 0); //____
91 modexShowPage(&gvar.video.page[0]);
97 /* run screensaver routine until keyboard input */
100 getch(); // eat keyboard input
104 ding(&gvar.video.page[0], &bakapee, key);
111 # error REMOVED // this code is written around modex16 which so far is a better fit than using DOSLIB vga directly, so leave MXLIB code in.
112 // we'll integrate DOSLIB vga into that part of the code instead for less disruption. -- J.C.
117 fprintf(stderr, "xx=%d yy=%d tile=%d\n", bakapee.xx, bakapee.yy, bakapee.tile);
118 printf("Enter 1, 2, 3, 4, or 6 to run a screensaver, or enter 0 to quit.\n");
122 case 27: /* Escape key */
126 case 'b': // test tile change
127 switch (bakapee.tile)
146 gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]);
147 gvar.video.page[0].width += (TILEWH*2);
148 gvar.video.page[0].height += (TILEWH*2);
151 # error REMOVED // this code is written around modex16 which so far is a better fit than using DOSLIB vga directly, so leave MXLIB code in.
152 // we'll integrate DOSLIB vga into that part of the code instead for less disruption. -- J.C.
154 modexShowPage(&gvar.video.page[0]);
162 #else // !defined(BOINK)
163 // FIXME: Does not compile. Do you want to remove this?
165 { // conditions of screen saver
168 ding(&gvar.video.page[0], &bakapee, key);
170 //end of screen savers
171 /*for(int x = 0; x < gvar.video.page[0].width; ++x)
173 modexputPixel(&page, x, 0, 15);
174 mxPutPixel(x, gvar.video.page[0].height-1, 15);
176 for (int y = 0; y < VH; ++y)
178 mxPutPixel(0, y, 15);
179 mxPutPixel(gvar.video.page[0].width-1, y, 15);
181 for (int x = 0; x < VW; ++x)
183 mxPutPixel(x, 0, 15);
184 mxPutPixel(x, VH-1, 15);
186 for (int y = 240; y < VH; ++y)
188 mxPutPixel(0, y, 15);
189 mxPutPixel(VW-1, y, 15);
191 pdump(&gvar.video.page[0]);
194 /*++++mxBitBlt(xpos, ypos+(TILEWH*12), gvar.video.page[0].width, TILEWH*BUFFMX, 0, BS); //copy background
195 mxFillBox(xpos, ypos+(TILEWH*12), gvar.video.page[0].width, TILEWH*BUFFMX, 0, OP_SET); // background for text box
197 mxOutText(xpos+1, ypos+gvar.video.page[0].height-48, "========================================");
198 mxOutText(xpos+1, ypos+gvar.video.page[0].height-40, "| |Chikyuu:$line1");
199 mxOutText(xpos+1, ypos+gvar.video.page[0].height-32, "| |$line2");
200 mxOutText(xpos+1, ypos+gvar.video.page[0].height-24, "| |$line3");
201 mxOutText(xpos+1, ypos+gvar.video.page[0].height-16, "| |$line4");
202 mxOutText(xpos+1, ypos+gvar.video.page[0].height-8, "========================================");
203 mxFillBox(xpos+QUADWH, ypos+QUADWH+(TILEWH*12), TILEWH*2, TILEWH*2, 9, OP_SET); //portriat~
205 mxBitBlt(0, BS, gvar.video.page[0].width, TILEWH*BUFFMX, xpos, ypos+(TILEWH*12)); //copy background
209 //for(int i=0;i<TILEWH;i++){
210 ding(&gvar.video.page[0], &bakapee, key);
211 modexPanPage(&gvar.video.page[0], xpos, ypos);
212 //++++mxFillBox(384, 304, 384, 304, 10, OP_SET);
213 //mxBitBlt(xpos, ypos, gvar.video.page[0].width, gvar.video.page[0].height, 32, (gvar.video.page[0].height+64+32));
214 //++++mxBitBlt(TILEWH*2, TILEWH*2, gvar.video.page[0].width, gvar.video.page[0].height, 32, (gvar.video.page[0].height+64+32));
215 //for(word o = 0; o<TILEWH; o++){
218 //if(ypos==1 || (ypos==(BH-gvar.video.page[0].height-1)))delay(500);
219 //if((xpos>(VW-gvar.video.page[0].width-1)) || (xpos<1))delay(500);
221 //mxBitBlt(32, (gvar.video.page[0].height+32), gvar.video.page[0].width, gvar.video.page[0].height, xpos, ypos);
222 //++++mxBitBlt(TILEWH*2, (gvar.video.page[0].height+64+32), gvar.video.page[0].width, gvar.video.page[0].height, TILEWH*2, TILEWH*2);
223 //xpos=ypos=TILEWH*2;
224 //????modexPanPage(&gvar.video.page[0], 32, 32);
226 if( (xpos>(VW-gvar.video.page[0].width-1)) || (xpos<1)){xdir=-xdir;}
227 if( (ypos>(BH-gvar.video.page[0].height-1)) || (ypos<1)){ydir=-ydir;} // { Hit a boundry, change
229 //mxBitBlt(32, (gvar.video.page[0].height+64+32), gvar.video.page[0].width, gvar.video.page[0].height, xpos, ypos);
230 //mxBitBlt(TILEWH*2, (gvar.video.page[0].height+64+32), gvar.video.page[0].width, gvar.video.page[0].height, TILEWH*2, TILEWH*2);
233 if(ch==0x71)break; // 'q'
234 if(ch==0x1b)break; // 'ESC'
236 // VGAmodeX(0, &gvar);
237 #endif // defined(BOINK)
238 printf("bakapi ver. 1.04.13.04\nis made by sparky4
\81i
\81\86\83Ö
\81\85\81j feel free to use it ^^\nLicence: GPL v3\n");