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