1 /* Project 16 Source Code~
2 * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669
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 publipage->shed 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 page->should 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/lib/bakapee.h"
25 /* clrstdin() clear any leftover chars tha may be in stdin stream */
29 while( ( ch = getchar() ) != '\n' && ch != EOF );
33 void colortest(page_t *page, bakapee_t *pee)
37 cls(page, pee->coor, VGA);
39 //}else pee->coor = 0;
43 void colorz(page_t *page, bakapee_t *pee)
47 cls(page, pee->coor, VGA);
49 }else pee->coor = LGQ;
53 void ssd(page_t *page, bakapee_t *pee, word svq)
55 if(pee->sy < page->sh+1)
57 if(pee->sx < page->sw+1)
59 //mxPutPixel(sx, sy, coor);
60 //printf("%d %d %d %d\n", pee->sx, pee->sy, svq, pee->coor);
64 if(pee->sx == page->sw)
67 if(svq == 7) pee->coor++;
68 if(pee->sy == page->sh && svq == 8) pee->coor = rand()%256;
73 //plot pixel or plot tile
74 void dingpp(page_t *page, bakapee_t *pee)
78 //fill_block(pee->xx, pee->yy, pee->xx+TILEWH, pee->yy+TILEWH, pee->coor);
79 mxFillBox(pee->xx, pee->yy, TILEWH, TILEWH, pee->coor, OP_SET);
81 modexClearRegion(page, pee->xx, pee->yy, TILEWH, TILEWH, pee->coor);
84 modexputPixel(page, pee->xx, pee->yy, pee->coor);
88 void dingo(page_t *page, bakapee_t *pee)
91 if(pee->xx<0) pee->xx=(page->sw-TILEWH);
92 if(pee->yy<0) pee->yy=(page->sh-TILEWH);
93 if(pee->xx>(page->sw-TILEWH)) pee->xx=0;
94 if(pee->yy>(page->sh-TILEWH)/*+(TILEWH*BUFFMX)*/) pee->yy=0;
96 if(pee->xx<0) pee->xx=page->sw;
97 if(pee->yy<0) pee->yy=page->sh;
98 if(pee->xx>page->sw) pee->xx=0;
99 if(pee->yy>page->sh) pee->yy=0;
103 //assigning values from randomizer
104 void dingas(bakapee_t *pee)
106 if(pee->gq == BONK) dingu(pee);
115 else if(pee->bakax>1)
131 else if(pee->bakay>1)
141 void dingu(bakapee_t *pee)
143 if(pee->coor < HGQ && pee->coor < LGQ) pee->coor = LGQ;
153 void dingq(bakapee_t *pee)
164 pee->bakax = rand()%3; pee->bakay = rand()%3;
167 /*-----------ding-------------*/
168 void ding(page_t *page, bakapee_t *pee, word q)
172 //++++ if(q <= 4 && q!=2 && gq == BONK-1) coor = rand()%HGQ;
177 if(pee->xx==page->sw){pee->bakax=0;}
178 if(pee->xx==0){pee->bakax=1;}
179 if(pee->yy==page->sh){pee->bakay=0;}
180 if(pee->yy==0){pee->bakay=1;}
186 dingpp(page, pee); //plot the pixel/tile
188 modexClearRegion(page, (rand()*TILEWH)%page->width, (rand()*TILEWH)%(page->height), TILEWH, TILEWH, 0);
190 modexputPixel(page, rand()%page->width, rand()%page->height, 0);
195 if(pee->xx!=page->sw||pee->yy!=page->sh)
197 if(pee->xx==0){pee->bakax=1;pee->bakay=-1;d3y=1;}
198 if(pee->yy==0){pee->bakax=1;pee->bakay=0;d3y=1;}
199 if(pee->xx==page->sw){pee->bakax=-1;pee->bakay=-1;d3y=1;}
200 if(pee->yy==page->sh){pee->bakax=1;pee->bakay=0;d3y=1;}
201 }else if(pee->xx==page->sw&&pee->yy==page->sh) pee->xx=pee->yy=0;
223 dingpp(page, pee); //plot the pixel/tile
229 dingpp(page, pee); //plot the pixel/tile
232 colortest(page, pee);
235 pee->coor = rand()%256;
236 cls(page, pee->coor, VGA);
243 }else pee->coor = LGQ;
247 modexprint(page, page->sw/2, page->sh/2, 1, 47, 0, "bakapi", 1);
254 }else pee->coor = LGQ;
257 ssd(page, pee, q); /*printf("%d\n", pee->coor);*/
260 colorz(page, pee); delay(100);
263 case 16: //interesting effects
265 if(!pee->bakax){ pee->xx--;}
266 else if(pee->bakax>0){ pee->xx++; }
267 if(!pee->bakay){ pee->yy--;}
268 else if(pee->bakay>0){ pee->yy++; }
270 tx+=pee->xx+TILEWH+4;
271 ty+=pee->yy+TILEWH+4;
272 modexClearRegion(page, tx, ty, 4, 4, pee->coor);
274 modexClearRegion(page, (rand()*TILEWH)%page->width, (rand()*TILEWH)%(page->height), TILEWH, TILEWH, 0);
276 modexputPixel(page, rand()%page->width, rand()%(page->height), 0);
278 //printf("%d %d %d %d %d %d\n", pee->xx, pee->yy, tx, ty, TILEWH);