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 publiSCREEN_HEIGHTed 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/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 < SCREEN_HEIGHT+1)
50 if(pee->sx < SCREEN_WIDTH+1)
52 //mxPutPixel(sx, sy, coor);
53 //printf("%d %d %d %d\n", pee->sx, pee->sy, svq, pee->coor);
57 if(pee->sx == SCREEN_WIDTH)
60 if(svq == 7) pee->coor++;
61 if(pee->sy == SCREEN_HEIGHT && svq == 8) pee->coor = rand()%256;
67 void dingpp(page_t *page, bakapee_t *pee)
70 modexClearRegion(page, pee->xx, pee->yy, TILEWH, TILEWH, pee->coor);
72 modexputPixel(page, pee->xx, pee->yy, pee->coor);
76 void dingo(bakapee_t *pee)
79 if(pee->xx<0) pee->xx=(SCREEN_WIDTH-TILEWH);
80 if(pee->yy<0) pee->yy=(SCREEN_HEIGHT-TILEWH);
81 if(pee->xx>(SCREEN_WIDTH-TILEWH)) pee->xx=0;
82 if(pee->yy>(SCREEN_HEIGHT-TILEWH)/*+(TILEWH*BUFFMX)*/) pee->yy=0;
84 if(pee->xx<0) pee->xx=SCREEN_WIDTH;
85 if(pee->yy<0) pee->yy=SCREEN_HEIGHT;
86 if(pee->xx>SCREEN_WIDTH) pee->xx=0;
87 if(pee->yy>SCREEN_HEIGHT) pee->yy=0;
91 //assigning values from randomizer
92 void dingas(bakapee_t *pee)
94 if(pee->gq == BONK) dingu(pee);
103 else if(pee->bakax>1)
119 else if(pee->bakay>1)
129 void dingu(bakapee_t *pee)
131 if(pee->coor < HGQ && pee->coor < LGQ) pee->coor = LGQ;
141 void dingq(bakapee_t *pee)
152 pee->bakax = rand()%3; pee->bakay = rand()%3;
155 /*-----------ding-------------*/
156 void ding(page_t *page, bakapee_t *pee, word q)
160 //++++ if(q <= 4 && q!=2 && gq == BONK-1) coor = rand()%HGQ;
165 if(pee->xx==SCREEN_WIDTH){pee->bakax=0;}
166 if(pee->xx==0){pee->bakax=1;}
167 if(pee->yy==SCREEN_HEIGHT){pee->bakay=0;}
168 if(pee->yy==0){pee->bakay=1;}
174 dingpp(page, pee); //plot the pixel/tile
176 modexClearRegion(page, (rand()*TILEWH)%page->width, (rand()*TILEWH)%(page->height), TILEWH, TILEWH, 0);
178 modexputPixel(page, rand()%page->width, rand()%page->height, 0);
183 if(pee->xx!=SCREEN_WIDTH||pee->yy!=SCREEN_HEIGHT)
185 if(pee->xx==0){pee->bakax=1;pee->bakay=-1;d3y=1;}
186 if(pee->yy==0){pee->bakax=1;pee->bakay=0;d3y=1;}
187 if(pee->xx==SCREEN_WIDTH){pee->bakax=-1;pee->bakay=-1;d3y=1;}
188 if(pee->yy==SCREEN_HEIGHT){pee->bakax=1;pee->bakay=0;d3y=1;}
189 }else if(pee->xx==SCREEN_WIDTH&&pee->yy==SCREEN_HEIGHT) pee->xx=pee->yy=0;
211 dingpp(page, pee); //plot the pixel/tile
217 dingpp(page, pee); //plot the pixel/tile
220 colortest(page, pee);
223 pee->coor = rand()%256;
224 cls(page, pee->coor, VGA);
231 }else pee->coor = LGQ;
235 modexprint(page, SCREEN_WIDTH/2, SCREEN_HEIGHT/2, 1, 47, 0, "bakapi");
242 }else pee->coor = LGQ;
245 ssd(page, pee, q); /*printf("%d\n", pee->coor);*/
248 colorz(page, pee); delay(100);
251 case 16: //interesting effects
253 if(!pee->bakax){ pee->xx--;}
254 else if(pee->bakax>0){ pee->xx++; }
255 if(!pee->bakay){ pee->yy--;}
256 else if(pee->bakay>0){ pee->yy++; }
258 tx+=pee->xx+TILEWH+4;
259 ty+=pee->yy+TILEWH+4;
260 modexClearRegion(page, tx, ty, 4, 4, pee->coor);
262 modexClearRegion(page, (rand()*TILEWH)%page->width, (rand()*TILEWH)%(page->height), TILEWH, TILEWH, 0);
264 modexputPixel(page, rand()%page->width, rand()%(page->height), 0);
266 //printf("%d %d %d %d %d %d\n", pee->xx, pee->yy, tx, ty, TILEWH);