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"
25 void pdump(page_t *pee)
28 int palq=(mult)*TILEWH;
31 for(paly=0; paly<palq; paly+=mult){
32 for(palx=0; palx<palq; palx+=mult){
33 modexClearRegion(pee, palx+TILEWH, paly+TILEWH, mult, mult, palcol);
39 /////////////////////////////////////////////////////////////////////////////
41 // cls() - This clears the screen to the specified color, on the VGA or on //
42 // the Virtual screen. //
44 /////////////////////////////////////////////////////////////////////////////
45 void cls(page_t *page, byte color, byte *Where)
47 //modexClearRegion(page, 0, 0, page->width, page->height, color);
48 _fmemset(Where, color, page->width*(page->height*2));
52 void colortest(page_t *page, bakapee_t *pee)
56 cls(page, pee->gq, VGA);
62 void colorz(page_t *page, bakapee_t *pee)
66 cls(page, pee->gq, VGA);
72 void ssd(page_t *page, bakapee_t *pee, word svq)
74 if(pee->sy < SCREEN_HEIGHT+1)
76 if(pee->sx < SCREEN_WIDTH+1)
78 //mxPutPixel(sx, sy, coor);
79 printf("%d %d %d %d\n", pee->sx, pee->sy, svq, pee->coor);
82 if(pee->sx == SCREEN_WIDTH)
85 if(svq == 7) pee->coor++;
86 if(pee->sy == SCREEN_HEIGHT && svq == 8) pee->coor = rand()%256;
91 void dingpp(page_t *page, bakapee_t *pee)
94 modexClearRegion(page, pee->xx, pee->yy, TILEWH, TILEWH, pee->coor);
96 modexputPixel(page, pee->xx, pee->yy, pee->coor);
100 void dingo(bakapee_t *pee)
103 if(pee->xx<0) pee->xx=(SCREEN_WIDTH-TILEWH);
104 if(pee->yy<0) pee->yy=(SCREEN_HEIGHT-TILEWH);
105 if(pee->xx>(SCREEN_WIDTH-TILEWH)) pee->xx=0;
106 if(pee->yy>(SCREEN_HEIGHT-TILEWH)/*+(TILEWH*BUFFMX)*/) pee->yy=0;
108 if(pee->xx<0) pee->xx=SCREEN_WIDTH;
109 if(pee->yy<0) pee->yy=SCREEN_HEIGHT;
110 if(pee->xx>SCREEN_WIDTH) pee->xx=0;
111 if(pee->yy>SCREEN_HEIGHT) pee->yy=0;
115 void dingas(bakapee_t *pee)
117 if(pee->qq == BONK) dingu(pee);
126 else if(pee->bakax>1)
142 else if(pee->bakay>1)
152 void dingu(bakapee_t *pee)
154 if(pee->coor < HGQ && pee->coor < LGQ) pee->coor = LGQ;
159 }else{ pee->coor = LGQ;
161 pee->bakax = rand()%3; pee->bakay = rand()%3;
165 /*-----------ding-------------*/
166 void ding(page_t *page, bakapee_t *pee, word q)
170 //++++ if(q <= 4 && q!=2 && gq == BONK-1) coor = rand()%HGQ;
176 if(pee->xx==SCREEN_WIDTH){pee->bakax=0;}
177 if(pee->xx==0){pee->bakax=1;}
178 if(pee->yy==SCREEN_HEIGHT){pee->bakay=0;}
179 if(pee->yy==0){pee->bakay=1;}
189 dingpp(page, pee); //plot the pixel/tile
191 modexClearRegion(page, (rand()*TILEWH)%page->width, (rand()*TILEWH)%(page->height), TILEWH, TILEWH, 0);
193 modexputPixel(page, rand()%page->width, rand()%page->height, 0);
195 pee->bakax = rand()%3; pee->bakay = rand()%3;
202 if(pee->xx!=SCREEN_WIDTH||pee->yy!=SCREEN_HEIGHT)
204 if(pee->xx==0){pee->bakax=1;pee->bakay=-1;d3y=1;}
205 if(pee->yy==0){pee->bakax=1;pee->bakay=0;d3y=1;}
206 if(pee->xx==SCREEN_WIDTH){pee->bakax=-1;pee->bakay=-1;d3y=1;}
207 if(pee->yy==SCREEN_HEIGHT){pee->bakax=1;pee->bakay=0;d3y=1;}
208 }else if(pee->xx==SCREEN_WIDTH&&pee->yy==SCREEN_HEIGHT) pee->xx=pee->yy=0;
239 dingpp(page, pee); //plot the pixel/tile
240 pee->bakax = rand()%3; pee->bakay = rand()%3;
245 colortest(page, pee);
248 pee->coor = rand()%256;
249 cls(page, pee->coor, VGA);
260 modexprint(page, SCREEN_WIDTH/2, SCREEN_HEIGHT/2, 1, 47, 0, "bakapi");
265 ssd(page, pee, q); pee->coor++;
270 ssd(page, pee, q); /*printf("%d\n", pee->coor);*/
273 colorz(page, pee); delay(100);
276 case 16: //interesting effects
279 if(!pee->bakax){ pee->xx--;}
280 else if(pee->bakax>0){ pee->xx++; }
281 if(!pee->bakay){ pee->yy--;}
282 else if(pee->bakay>0){ pee->yy++; }
285 tx+=pee->xx+TILEWH+4;
286 ty+=pee->yy+TILEWH+4;
287 modexClearRegion(page, tx, ty, 4, 4, pee->coor);
289 modexClearRegion(page, (rand()*TILEWH)%page->width, (rand()*TILEWH)%(page->height), TILEWH, TILEWH, 0);
291 modexputPixel(page, rand()%page->width, rand()%(page->height), 0);
293 pee->bakax = rand()%3; pee->bakay = rand()%3;
294 //printf("%d %d %d %d %d %d\n", pee->xx, pee->yy, tx, ty, TILEWH);