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]);
98 { // conditions of screen saver
99 ding(&gvar.video.page[0], &bakapee, key);
104 # 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.
105 // we'll integrate DOSLIB vga into that part of the code instead for less disruption. -- J.C.
110 fprintf(stderr, "xx=%d yy=%d tile=%d\n", bakapee.xx, bakapee.yy, bakapee.tile);
111 printf("Enter 1, 2, 3, 4, or 6 to run a screensaver, or enter 0 to quit.\n", getch()); // prompt the user
113 if(scanf("%d", &key) != 1)
118 //if(key==3){xx=yy=0;} // crazy screen saver wwww
125 switch (bakapee.tile)
137 gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]);
138 gvar.video.page[0].width += (TILEWH*2);
139 gvar.video.page[0].height += (TILEWH*2);
142 # 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.
143 // we'll integrate DOSLIB vga into that part of the code instead for less disruption. -- J.C.
145 modexShowPage(&gvar.video.page[0]);
150 #else // !defined(BOINK)
151 // FIXME: Does not compile. Do you want to remove this?
153 { // conditions of screen saver
156 ding(&gvar.video.page[0], &bakapee, key);
158 //end of screen savers
159 /*for(int x = 0; x < gvar.video.page[0].width; ++x)
161 modexputPixel(&page, x, 0, 15);
162 mxPutPixel(x, gvar.video.page[0].height-1, 15);
164 for (int y = 0; y < VH; ++y)
166 mxPutPixel(0, y, 15);
167 mxPutPixel(gvar.video.page[0].width-1, y, 15);
169 for (int x = 0; x < VW; ++x)
171 mxPutPixel(x, 0, 15);
172 mxPutPixel(x, VH-1, 15);
174 for (int y = 240; y < VH; ++y)
176 mxPutPixel(0, y, 15);
177 mxPutPixel(VW-1, y, 15);
179 pdump(&gvar.video.page[0]);
182 /*++++mxBitBlt(xpos, ypos+(TILEWH*12), gvar.video.page[0].width, TILEWH*BUFFMX, 0, BS); //copy background
183 mxFillBox(xpos, ypos+(TILEWH*12), gvar.video.page[0].width, TILEWH*BUFFMX, 0, OP_SET); // background for text box
185 mxOutText(xpos+1, ypos+gvar.video.page[0].height-48, "========================================");
186 mxOutText(xpos+1, ypos+gvar.video.page[0].height-40, "| |Chikyuu:$line1");
187 mxOutText(xpos+1, ypos+gvar.video.page[0].height-32, "| |$line2");
188 mxOutText(xpos+1, ypos+gvar.video.page[0].height-24, "| |$line3");
189 mxOutText(xpos+1, ypos+gvar.video.page[0].height-16, "| |$line4");
190 mxOutText(xpos+1, ypos+gvar.video.page[0].height-8, "========================================");
191 mxFillBox(xpos+QUADWH, ypos+QUADWH+(TILEWH*12), TILEWH*2, TILEWH*2, 9, OP_SET); //portriat~
193 mxBitBlt(0, BS, gvar.video.page[0].width, TILEWH*BUFFMX, xpos, ypos+(TILEWH*12)); //copy background
197 //for(int i=0;i<TILEWH;i++){
198 ding(&gvar.video.page[0], &bakapee, key);
199 modexPanPage(&gvar.video.page[0], xpos, ypos);
200 //++++mxFillBox(384, 304, 384, 304, 10, OP_SET);
201 //mxBitBlt(xpos, ypos, gvar.video.page[0].width, gvar.video.page[0].height, 32, (gvar.video.page[0].height+64+32));
202 //++++mxBitBlt(TILEWH*2, TILEWH*2, gvar.video.page[0].width, gvar.video.page[0].height, 32, (gvar.video.page[0].height+64+32));
203 //for(word o = 0; o<TILEWH; o++){
206 //if(ypos==1 || (ypos==(BH-gvar.video.page[0].height-1)))delay(500);
207 //if((xpos>(VW-gvar.video.page[0].width-1)) || (xpos<1))delay(500);
209 //mxBitBlt(32, (gvar.video.page[0].height+32), gvar.video.page[0].width, gvar.video.page[0].height, xpos, ypos);
210 //++++mxBitBlt(TILEWH*2, (gvar.video.page[0].height+64+32), gvar.video.page[0].width, gvar.video.page[0].height, TILEWH*2, TILEWH*2);
211 //xpos=ypos=TILEWH*2;
212 //????modexPanPage(&gvar.video.page[0], 32, 32);
214 if( (xpos>(VW-gvar.video.page[0].width-1)) || (xpos<1)){xdir=-xdir;}
215 if( (ypos>(BH-gvar.video.page[0].height-1)) || (ypos<1)){ydir=-ydir;} // { Hit a boundry, change
217 //mxBitBlt(32, (gvar.video.page[0].height+64+32), gvar.video.page[0].width, gvar.video.page[0].height, xpos, ypos);
218 //mxBitBlt(TILEWH*2, (gvar.video.page[0].height+64+32), gvar.video.page[0].width, gvar.video.page[0].height, TILEWH*2, TILEWH*2);
221 if(ch==0x71)break; // 'q'
222 if(ch==0x1b)break; // 'ESC'
224 // VGAmodeX(0, &gvar);
225 #endif // defined(BOINK)
226 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");