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"
26 void colortest(page_t *page, bakapee_t *pee)
30 cls(page, pee->coor, VGA);
32 //}else pee->coor = 0;
36 void colorz(page_t *page, bakapee_t *pee)
40 cls(page, pee->coor, VGA);
42 }else pee->coor = LGQ;
46 void ssd(page_t *page, bakapee_t *pee, word svq)
48 if(pee->sy < page->sh+1)
50 if(pee->sx < page->sw+1)
52 //mxPutPixel(sx, sy, coor);
53 //printf("%d %d %d %d\n", pee->sx, pee->sy, svq, pee->coor);
57 if(pee->sx == page->sw)
60 if(svq == 7) pee->coor++;
61 if(pee->sy == page->sh && svq == 8) pee->coor = rand()%256;
66 //plot pixel or plot tile
67 void dingpp(page_t *page, bakapee_t *pee)
71 //fill_block(pee->xx, pee->yy, pee->xx+TILEWH, pee->yy+TILEWH, pee->coor);
72 mxFillBox(pee->xx, pee->yy, TILEWH, TILEWH, pee->coor, OP_SET);
74 modexClearRegion(page, pee->xx, pee->yy, TILEWH, TILEWH, pee->coor);
77 modexputPixel(page, pee->xx, pee->yy, pee->coor);
81 void dingo(page_t *page, bakapee_t *pee)
84 if(pee->xx<0) pee->xx=(page->sw-TILEWH);
85 if(pee->yy<0) pee->yy=(page->sh-TILEWH);
86 if(pee->xx>(page->sw-TILEWH)) pee->xx=0;
87 if(pee->yy>(page->sh-TILEWH)/*+(TILEWH*BUFFMX)*/) pee->yy=0;
89 if(pee->xx<0) pee->xx=page->sw;
90 if(pee->yy<0) pee->yy=page->sh;
91 if(pee->xx>page->sw) pee->xx=0;
92 if(pee->yy>page->sh) pee->yy=0;
96 //assigning values from randomizer
97 void dingas(bakapee_t *pee)
99 if(pee->gq == BONK) dingu(pee);
108 else if(pee->bakax>1)
124 else if(pee->bakay>1)
134 void dingu(bakapee_t *pee)
136 if(pee->coor < HGQ && pee->coor < LGQ) pee->coor = LGQ;
146 void dingq(bakapee_t *pee)
157 pee->bakax = rand()%3; pee->bakay = rand()%3;
160 /*-----------ding-------------*/
161 void ding(page_t *page, bakapee_t *pee, word q)
165 //++++ if(q <= 4 && q!=2 && gq == BONK-1) coor = rand()%HGQ;
170 if(pee->xx==page->sw){pee->bakax=0;}
171 if(pee->xx==0){pee->bakax=1;}
172 if(pee->yy==page->sh){pee->bakay=0;}
173 if(pee->yy==0){pee->bakay=1;}
179 dingpp(page, pee); //plot the pixel/tile
181 modexClearRegion(page, (rand()*TILEWH)%page->width, (rand()*TILEWH)%(page->height), TILEWH, TILEWH, 0);
183 modexputPixel(page, rand()%page->width, rand()%page->height, 0);
188 if(pee->xx!=page->sw||pee->yy!=page->sh)
190 if(pee->xx==0){pee->bakax=1;pee->bakay=-1;d3y=1;}
191 if(pee->yy==0){pee->bakax=1;pee->bakay=0;d3y=1;}
192 if(pee->xx==page->sw){pee->bakax=-1;pee->bakay=-1;d3y=1;}
193 if(pee->yy==page->sh){pee->bakax=1;pee->bakay=0;d3y=1;}
194 }else if(pee->xx==page->sw&&pee->yy==page->sh) pee->xx=pee->yy=0;
216 dingpp(page, pee); //plot the pixel/tile
222 dingpp(page, pee); //plot the pixel/tile
225 colortest(page, pee);
228 pee->coor = rand()%256;
229 cls(page, pee->coor, VGA);
236 }else pee->coor = LGQ;
240 modexprint(page, page->sw/2, page->sh/2, 1, 47, 0, "bakapi", 1);
247 }else pee->coor = LGQ;
250 ssd(page, pee, q); /*printf("%d\n", pee->coor);*/
253 colorz(page, pee); delay(100);
256 case 16: //interesting effects
258 if(!pee->bakax){ pee->xx--;}
259 else if(pee->bakax>0){ pee->xx++; }
260 if(!pee->bakay){ pee->yy--;}
261 else if(pee->bakay>0){ pee->yy++; }
263 tx+=pee->xx+TILEWH+4;
264 ty+=pee->yy+TILEWH+4;
265 modexClearRegion(page, tx, ty, 4, 4, pee->coor);
267 modexClearRegion(page, (rand()*TILEWH)%page->width, (rand()*TILEWH)%(page->height), TILEWH, TILEWH, 0);
269 modexputPixel(page, rand()%page->width, rand()%(page->height), 0);
271 //printf("%d %d %d %d %d %d\n", pee->xx, pee->yy, tx, ty, TILEWH);