]> 4ch.mooo.com Git - 16.git/blob - src/bakapi.c
5022f0dafb17e64a3435783a0496e7366261f3d4
[16.git] / src / bakapi.c
1 /* Project 16 Source Code~
2  * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669
3  *
4  * This file is part of Project 16.
5  *
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.
10  *
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.
15  *
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.
20  *
21  */
22
23 #include "src/bakapi.h"
24
25 /*
26  * BAKAPEE!
27  */
28 global_game_variables_t gvar;
29 static bakapee_t bakapee;
30 word key,d,xpos,ypos,xdir,ydir;
31 int ch=0x0;
32
33 void
34 main(int argc, char *argvar[])
35 {
36         // main variables values
37         d=4; // switch variable
38         key=2; // default screensaver number
39         xpos=TILEWH*2;
40         ypos=TILEWH*2;
41         xdir=1;
42         ydir=1;
43
44         VGAmodeX(1, &gvar);
45         bakapee.xx = rand()&0%gvar.video.page[0].width;
46         bakapee.yy = rand()&0%gvar.video.page[0].height;
47         bakapee.gq = 0;
48         bakapee.sx=0;
49         bakapee.sy=0;
50         bakapee.bakax=0;
51         bakapee.bakay=0;
52         bakapee.coor=0;
53
54         /* setup camera and screen~ */
55         gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]);
56         gvar.video.page[0].width += (TILEWH*2);
57         gvar.video.page[0].height += (TILEWH*2);
58         textInit();
59
60         //modexPalUpdate(bmp.palette); //____
61         //modexDrawBmp(VGA, 0, 0, &bmp, 0); //____
62         //getch(); //____
63
64         modexShowPage(&gvar.video.page[0]);
65
66 // screen savers
67 #ifdef BOINK
68         while(d>0)      // on!
69         {
70                 if(!kbhit())
71                 { // conditions of screen saver
72                         ding(&gvar.video.page[0], &bakapee, key);
73                 }
74                 else
75                 {
76                         VGAmodeX(0, &gvar);
77                         //modexLeave();
78                         // user imput switch
79                         printf("Enter 1, 2, 3, 4, or 6 to run a screensaver, or enter 0 to quit.\n", getch());  // prompt the user
80                         scanf("%d", &key);
81                         //if(key==3){xx=yy=0;} // crazy screen saver wwww
82                         if(key==0){ d=0; }else{
83                                 gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]);
84                                 gvar.video.page[0].width += (TILEWH*2);
85                                 gvar.video.page[0].height += (TILEWH*2);
86                                 VGAmodeX(1, &gvar);
87                                 modexShowPage(&gvar.video.page[0]);
88                         }
89                 }
90         }
91 #else
92         while(1)
93         { // conditions of screen saver
94                 while(!kbhit())
95                 {
96                         ding(&gvar.video.page[0], &bakapee, key);
97                 }
98                 //end of screen savers
99                 /*for(int x = 0; x < gvar.video.page[0].width; ++x)
100                 {
101                         modexputPixel(&page, x, 0, 15);
102                         mxPutPixel(x, gvar.video.page[0].height-1, 15);
103                         }
104                 for (int y = 0; y < VH; ++y)
105                         {
106                                 mxPutPixel(0, y, 15);
107                                 mxPutPixel(gvar.video.page[0].width-1, y, 15);
108                         }
109                 for (int x = 0; x < VW; ++x)
110                         {
111                                 mxPutPixel(x, 0, 15);
112                                 mxPutPixel(x, VH-1, 15);
113                         }
114                 for (int y = 240; y < VH; ++y)
115                         {
116                                 mxPutPixel(0, y, 15);
117                                 mxPutPixel(VW-1, y, 15);
118                         }*/
119                 pdump(&gvar.video.page[0]);
120                 getch();
121                 //text box
122                 /*++++mxBitBlt(xpos, ypos+(TILEWH*12), gvar.video.page[0].width, TILEWH*BUFFMX, 0, BS); //copy background
123                 mxFillBox(xpos, ypos+(TILEWH*12), gvar.video.page[0].width, TILEWH*BUFFMX, 0, OP_SET); // background for text box
124                 //+(QUADWH*6)
125                 mxOutText(xpos+1, ypos+gvar.video.page[0].height-48, "========================================");
126                 mxOutText(xpos+1, ypos+gvar.video.page[0].height-40, "|    |Chikyuu:$line1");
127                 mxOutText(xpos+1, ypos+gvar.video.page[0].height-32, "|    |$line2");
128                 mxOutText(xpos+1, ypos+gvar.video.page[0].height-24, "|    |$line3");
129                 mxOutText(xpos+1, ypos+gvar.video.page[0].height-16, "|    |$line4");
130                 mxOutText(xpos+1, ypos+gvar.video.page[0].height-8,  "========================================");
131                 mxFillBox(xpos+QUADWH, ypos+QUADWH+(TILEWH*12), TILEWH*2, TILEWH*2, 9, OP_SET); //portriat~
132                 getch();
133                 mxBitBlt(0, BS, gvar.video.page[0].width, TILEWH*BUFFMX, xpos, ypos+(TILEWH*12)); //copy background
134                 getch();++++*/
135                 while(!kbhit())
136                 {
137                         //for(int i=0;i<TILEWH;i++){
138                                 ding(&gvar.video.page[0], &bakapee, key);
139                                 modexPanPage(&gvar.video.page[0], xpos, ypos);
140 //++++mxFillBox(384, 304, 384, 304, 10, OP_SET);
141 //mxBitBlt(xpos, ypos, gvar.video.page[0].width, gvar.video.page[0].height, 32, (gvar.video.page[0].height+64+32));
142 //++++mxBitBlt(TILEWH*2, TILEWH*2, gvar.video.page[0].width, gvar.video.page[0].height, 32, (gvar.video.page[0].height+64+32));
143                                 //for(word o = 0; o<TILEWH; o++){
144                                         xpos+=xdir;
145                                         ypos+=ydir;
146                                         //if(ypos==1 || (ypos==(BH-gvar.video.page[0].height-1)))delay(500);
147                                         //if((xpos>(VW-gvar.video.page[0].width-1)) || (xpos<1))delay(500);
148                                         //mxWaitRetrace();
149 //mxBitBlt(32, (gvar.video.page[0].height+32), gvar.video.page[0].width, gvar.video.page[0].height, xpos, ypos);
150 //++++mxBitBlt(TILEWH*2, (gvar.video.page[0].height+64+32), gvar.video.page[0].width, gvar.video.page[0].height, TILEWH*2, TILEWH*2);
151 //xpos=ypos=TILEWH*2;
152                                         //????modexPanPage(&gvar.video.page[0], 32, 32);
153                                 //}
154                                 if( (xpos>(VW-gvar.video.page[0].width-1))  || (xpos<1)){xdir=-xdir;}
155                                 if( (ypos>(BH-gvar.video.page[0].height-1)) || (ypos<1)){ydir=-ydir;} // { Hit a boundry, change
156                         //}//    direction!
157 //mxBitBlt(32, (gvar.video.page[0].height+64+32), gvar.video.page[0].width, gvar.video.page[0].height, xpos, ypos);
158 //mxBitBlt(TILEWH*2, (gvar.video.page[0].height+64+32), gvar.video.page[0].width, gvar.video.page[0].height, TILEWH*2, TILEWH*2);
159                 }
160         ch=getch();
161         if(ch==0x71)break; // 'q'
162         if(ch==0x1b)break; // 'ESC'
163         }
164 //      VGAmodeX(0, &gvar);
165 #endif
166         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");
167 }
168 //pee!