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 // main variables values
37 d=4; // switch variable
38 key=2; // default screensaver number
49 printf("VGA probe failed\n");
53 update_state_from_vga();
54 vga_enable_256color_modex(); // VGA mode X
55 vga_state.vga_width = 320; // VGA lib currently does not update this
56 vga_state.vga_height = 240; // VGA lib currently does not update this
58 //#if 1 // 320x240 test mode: this is how Project 16 is using our code, enable for test case
60 struct vga_mode_params cm;
62 vga_read_crtc_mode(&cm);
65 cm.vertical_total = 525;
66 cm.vertical_start_retrace = 0x1EA;
67 cm.vertical_end_retrace = 0x1EC;
68 cm.vertical_display_end = 480;
69 cm.vertical_blank_start = 489;
70 cm.vertical_blank_end = 517;
72 vga_write_crtc_mode(&cm,0);
74 vga_state.vga_height = 240; // VGA lib currently does not update this
77 bakapee.xx = rand()&0%gvar.video.page[0].width;
78 bakapee.yy = rand()&0%gvar.video.page[0].height;
87 /* setup camera and screen~ */
88 gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]);
89 gvar.video.page[0].width += (TILEWH*2);
90 gvar.video.page[0].height += (TILEWH*2);
93 //modexPalUpdate(bmp.palette); //____
94 //modexDrawBmp(VGA, 0, 0, &bmp, 0); //____
97 modexShowPage(&gvar.video.page[0]);
104 { // conditions of screen saver
105 ding(&gvar.video.page[0], &bakapee, key);
115 fprintf(stderr, "xx=%d yy=%d tile=%d\n", bakapee.xx, bakapee.yy, bakapee.tile);
116 printf("Enter 1, 2, 3, 4, or 6 to run a screensaver, or enter 0 to quit.\n", getch()); // prompt the user
118 if(scanf("%d", &key) != 1)
123 //if(key==3){xx=yy=0;} // crazy screen saver wwww
130 switch (bakapee.tile)
142 gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]);
143 gvar.video.page[0].width += (TILEWH*2);
144 gvar.video.page[0].height += (TILEWH*2);
149 printf("VGA probe failed\n");
153 update_state_from_vga();
154 vga_enable_256color_modex(); // VGA mode X
155 vga_state.vga_width = 320; // VGA lib currently does not update this
156 vga_state.vga_height = 240; // VGA lib currently does not update this
158 //#if 1 // 320x240 test mode: this is how Project 16 is using our code, enable for test case
160 struct vga_mode_params cm;
162 vga_read_crtc_mode(&cm);
165 cm.vertical_total = 525;
166 cm.vertical_start_retrace = 0x1EA;
167 cm.vertical_end_retrace = 0x1EC;
168 cm.vertical_display_end = 480;
169 cm.vertical_blank_start = 489;
170 cm.vertical_blank_end = 517;
172 vga_write_crtc_mode(&cm,0);
174 vga_state.vga_height = 240; // VGA lib currently does not update this
177 modexShowPage(&gvar.video.page[0]);
184 { // conditions of screen saver
187 ding(&gvar.video.page[0], &bakapee, key);
189 //end of screen savers
190 /*for(int x = 0; x < gvar.video.page[0].width; ++x)
192 modexputPixel(&page, x, 0, 15);
193 mxPutPixel(x, gvar.video.page[0].height-1, 15);
195 for (int y = 0; y < VH; ++y)
197 mxPutPixel(0, y, 15);
198 mxPutPixel(gvar.video.page[0].width-1, y, 15);
200 for (int x = 0; x < VW; ++x)
202 mxPutPixel(x, 0, 15);
203 mxPutPixel(x, VH-1, 15);
205 for (int y = 240; y < VH; ++y)
207 mxPutPixel(0, y, 15);
208 mxPutPixel(VW-1, y, 15);
210 pdump(&gvar.video.page[0]);
213 /*++++mxBitBlt(xpos, ypos+(TILEWH*12), gvar.video.page[0].width, TILEWH*BUFFMX, 0, BS); //copy background
214 mxFillBox(xpos, ypos+(TILEWH*12), gvar.video.page[0].width, TILEWH*BUFFMX, 0, OP_SET); // background for text box
216 mxOutText(xpos+1, ypos+gvar.video.page[0].height-48, "========================================");
217 mxOutText(xpos+1, ypos+gvar.video.page[0].height-40, "| |Chikyuu:$line1");
218 mxOutText(xpos+1, ypos+gvar.video.page[0].height-32, "| |$line2");
219 mxOutText(xpos+1, ypos+gvar.video.page[0].height-24, "| |$line3");
220 mxOutText(xpos+1, ypos+gvar.video.page[0].height-16, "| |$line4");
221 mxOutText(xpos+1, ypos+gvar.video.page[0].height-8, "========================================");
222 mxFillBox(xpos+QUADWH, ypos+QUADWH+(TILEWH*12), TILEWH*2, TILEWH*2, 9, OP_SET); //portriat~
224 mxBitBlt(0, BS, gvar.video.page[0].width, TILEWH*BUFFMX, xpos, ypos+(TILEWH*12)); //copy background
228 //for(int i=0;i<TILEWH;i++){
229 ding(&gvar.video.page[0], &bakapee, key);
230 modexPanPage(&gvar.video.page[0], xpos, ypos);
231 //++++mxFillBox(384, 304, 384, 304, 10, OP_SET);
232 //mxBitBlt(xpos, ypos, gvar.video.page[0].width, gvar.video.page[0].height, 32, (gvar.video.page[0].height+64+32));
233 //++++mxBitBlt(TILEWH*2, TILEWH*2, gvar.video.page[0].width, gvar.video.page[0].height, 32, (gvar.video.page[0].height+64+32));
234 //for(word o = 0; o<TILEWH; o++){
237 //if(ypos==1 || (ypos==(BH-gvar.video.page[0].height-1)))delay(500);
238 //if((xpos>(VW-gvar.video.page[0].width-1)) || (xpos<1))delay(500);
240 //mxBitBlt(32, (gvar.video.page[0].height+32), gvar.video.page[0].width, gvar.video.page[0].height, xpos, ypos);
241 //++++mxBitBlt(TILEWH*2, (gvar.video.page[0].height+64+32), gvar.video.page[0].width, gvar.video.page[0].height, TILEWH*2, TILEWH*2);
242 //xpos=ypos=TILEWH*2;
243 //????modexPanPage(&gvar.video.page[0], 32, 32);
245 if( (xpos>(VW-gvar.video.page[0].width-1)) || (xpos<1)){xdir=-xdir;}
246 if( (ypos>(BH-gvar.video.page[0].height-1)) || (ypos<1)){ydir=-ydir;} // { Hit a boundry, change
248 //mxBitBlt(32, (gvar.video.page[0].height+64+32), gvar.video.page[0].width, gvar.video.page[0].height, xpos, ypos);
249 //mxBitBlt(TILEWH*2, (gvar.video.page[0].height+64+32), gvar.video.page[0].width, gvar.video.page[0].height, TILEWH*2, TILEWH*2);
252 if(ch==0x71)break; // 'q'
253 if(ch==0x1b)break; // 'ESC'
255 // VGAmodeX(0, &gvar);
257 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");