X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fbakapee.c;h=1626fd1dc6fcd1e92d5421e7b3f576ff5d88ff24;hb=d71e4ebbd3770b48eee2b2cc18288b97aad4e1e4;hp=9b500b913ed4fbb087a97ad49342397e1a34be9f;hpb=60d62fcab6d8310dc1ab11b40906e9a59e4c9c6a;p=16.git diff --git a/src/lib/bakapee.c b/src/lib/bakapee.c index 9b500b91..1626fd1d 100755 --- a/src/lib/bakapee.c +++ b/src/lib/bakapee.c @@ -1,10 +1,10 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * * Project 16 is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as publipage->shed by + * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * @@ -13,7 +13,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You page->should have received a copy of the GNU General Public License + * You should have received a copy of the GNU General Public License * along with this program. If not, see , or * write to the Free Software Foundation, Inc., 51 Franklin Street, * Fifth Floor, Boston, MA 02110-1301 USA. @@ -22,6 +22,13 @@ #include "src/lib/bakapee.h" +/* clrstdin() clear any leftover chars tha may be in stdin stream */ +void clrstdin() +{ + int ch = 0; + while( ( ch = getchar() ) != '\n' && ch != EOF ); +} + //color ‚Ä‚·‚Æ void colortest(page_t *page, bakapee_t *pee) { @@ -63,29 +70,38 @@ void ssd(page_t *page, bakapee_t *pee, word svq) }else pee->sy = 0; } -//plot pixel +//plot pixel or plot tile void dingpp(page_t *page, bakapee_t *pee) { -#ifdef TILE - modexClearRegion(page, pee->xx, pee->yy, TILEWH, TILEWH, pee->coor); + if(pee->tile) + { +#ifndef MXLIB + //fill_block(pee->xx, pee->yy, pee->xx+TILEWH, pee->yy+TILEWH, pee->coor); + mxFillBox(pee->xx, pee->yy, TILEWH, TILEWH, pee->coor, OP_SET); #else - modexputPixel(page, pee->xx, pee->yy, pee->coor); + modexClearRegion(page, pee->xx, pee->yy, TILEWH, TILEWH, pee->coor); #endif + } + else + modexputPixel(page, pee->xx, pee->yy, pee->coor); } void dingo(page_t *page, bakapee_t *pee) { - #ifdef TILE - if(pee->xx<0) pee->xx=(page->sw-TILEWH); - if(pee->yy<0) pee->yy=(page->sh-TILEWH); - if(pee->xx>(page->sw-TILEWH)) pee->xx=0; - if(pee->yy>(page->sh-TILEWH)/*+(TILEWH*BUFFMX)*/) pee->yy=0; - #else - if(pee->xx<0) pee->xx=page->sw; - if(pee->yy<0) pee->yy=page->sh; - if(pee->xx>page->sw) pee->xx=0; - if(pee->yy>page->sh) pee->yy=0; - #endif + if(pee->tile) + { + if(pee->xx<0) pee->xx=(page->sw-TILEWH); + if(pee->yy<0) pee->yy=(page->sh-TILEWH); + if(pee->xx>(page->sw-TILEWH)) pee->xx=0; + if(pee->yy>(page->sh-TILEWH)/*+(TILEWH*BUFFMX)*/) pee->yy=0; + } + else + { + if(pee->xx<0) pee->xx=page->sw; + if(pee->yy<0) pee->yy=page->sh; + if(pee->xx>page->sw) pee->xx=0; + if(pee->yy>page->sh) pee->yy=0; + } } //assigning values from randomizer @@ -94,35 +110,27 @@ void dingas(bakapee_t *pee) if(pee->gq == BONK) dingu(pee); if(!pee->bakax) { - #ifdef TILE + if(pee->tile) pee->xx-=TILEWH; - #else - pee->xx--; - #endif + else pee->xx--; } else if(pee->bakax>1) { - #ifdef TILE + if(pee->tile) pee->xx+=TILEWH; - #else - pee->xx++; - #endif + else pee->xx++; } if(!pee->bakay) { - #ifdef TILE + if(pee->tile) pee->yy-=TILEWH; - #else - pee->yy--; - #endif + else pee->yy--; } else if(pee->bakay>1) { - #ifdef TILE + if(pee->tile) pee->yy+=TILEWH; - #else - pee->yy++; - #endif + else pee->yy++; } } @@ -172,11 +180,10 @@ void ding(page_t *page, bakapee_t *pee, word q) dingas(pee); dingo(page, pee); dingpp(page, pee); //plot the pixel/tile -#ifdef TILE + if(pee->tile) modexClearRegion(page, (rand()*TILEWH)%page->width, (rand()*TILEWH)%(page->height), TILEWH, TILEWH, 0); -#else + else modexputPixel(page, rand()%page->width, rand()%page->height, 0); -#endif break; case 3: dingq(pee); @@ -232,7 +239,7 @@ void ding(page_t *page, bakapee_t *pee, word q) break; case 8: colorz(page, pee); - modexprint(page, page->sw/2, page->sh/2, 1, 47, 0, "bakapi"); + modexprint(page, page->sw/2, page->sh/2, 1, 47, 0, "bakapi", 1); break; case 9: if(pee->coor <= HGQ) @@ -258,11 +265,10 @@ void ding(page_t *page, bakapee_t *pee, word q) tx+=pee->xx+TILEWH+4; ty+=pee->yy+TILEWH+4; modexClearRegion(page, tx, ty, 4, 4, pee->coor); -#ifdef TILE + if(pee->tile) modexClearRegion(page, (rand()*TILEWH)%page->width, (rand()*TILEWH)%(page->height), TILEWH, TILEWH, 0); -#else + else modexputPixel(page, rand()%page->width, rand()%(page->height), 0); -#endif //printf("%d %d %d %d %d %d\n", pee->xx, pee->yy, tx, ty, TILEWH); break; default: