X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fbakapee.c;h=a69a97e85adb8081f468b6ddf5a4142517af0e73;hb=f552f51c74cb11b9e17c8a644ad1ed86528cae43;hp=8dbca62beddf2a8969dc55ed9edcd385eb6dfbf8;hpb=fbe03063d70bda97992c9927f44e2ced8cee4dab;p=16.git diff --git a/src/lib/bakapee.c b/src/lib/bakapee.c old mode 100644 new mode 100755 index 8dbca62b..a69a97e8 --- a/src/lib/bakapee.c +++ b/src/lib/bakapee.c @@ -22,33 +22,6 @@ #include "src/lib/bakapee.h" -///////////////////////////////////////////////////////////////////////////// -// // -// setvideo() - This function Manages the video modes // -// // -///////////////////////////////////////////////////////////////////////////// -void setVGAmodeX(global_game_variables_t *vid, boolean vq) -{ - union REGS in, out; - - if(!vq) - { // deinit the video - // change to the video mode we were in before we switched to mode 13h - modexLeave(); - in.h.ah = 0x00; - in.h.al = vid->old_mode; - int86(0x10, &in, &out); - - }else if(vq==1){ // init the video - // get old video mode - in.h.ah = 0xf; - int86(0x10, &in, &out); - vid->old_mode = out.h.al; - // enter mode - modexEnter(); - } -} - void pdump(page_t *pee) { int mult=(QUADWH); @@ -63,36 +36,24 @@ void pdump(page_t *pee) } } -///////////////////////////////////////////////////////////////////////////// -// // -// cls() - This clears the screen to the specified color, on the VGA or on // -// the Virtual screen. // -// // -///////////////////////////////////////////////////////////////////////////// -void cls(page_t *page, byte color, byte *Where) -{ - //modexClearRegion(page, 0, 0, page->width, page->height, color); - _fmemset(Where, color, page->width*(page->height*2)); -} - //color ‚Ä‚·‚Æ void colortest(page_t *page, bakapee_t *pee) { - if(pee->gq < 256) - { - cls(page, pee->gq, VGA); - pee->gq++; - }else pee->gq = 0; + //if(pee->coor < 256) + //{ + cls(page, pee->coor, VGA); + pee->coor++; + //}else pee->coor = 0; } //color ‚Ä‚·‚Æ void colorz(page_t *page, bakapee_t *pee) { - if(pee->gq <= HGQ) + if(pee->coor <= HGQ) { - cls(page, pee->gq, VGA); - pee->gq++; - }else pee->gq = LGQ; + cls(page, pee->coor, VGA); + pee->coor++; + }else pee->coor = LGQ; } //slow spectrum down @@ -103,7 +64,8 @@ void ssd(page_t *page, bakapee_t *pee, word svq) if(pee->sx < SCREEN_WIDTH+1) { //mxPutPixel(sx, sy, coor); - printf("%d %d %d %d\n", pee->sx, pee->sy, svq, pee->coor); + //printf("%d %d %d %d\n", pee->sx, pee->sy, svq, pee->coor); + dingpp(page, pee); pee->sx++; }else pee->sx = 0; if(pee->sx == SCREEN_WIDTH) @@ -115,6 +77,7 @@ void ssd(page_t *page, bakapee_t *pee, word svq) }else pee->sy = 0; } +//plot pixel void dingpp(page_t *page, bakapee_t *pee) { #ifdef TILE @@ -139,6 +102,7 @@ void dingo(bakapee_t *pee) #endif } +//assigning values from randomizer void dingas(bakapee_t *pee) { if(pee->gq == BONK) dingu(pee); @@ -182,9 +146,24 @@ void dingu(bakapee_t *pee) if(pee->coor < HGQ) { pee->coor++; - }else{ pee->coor = LGQ; - pee->bakax = rand()%3; pee->bakay = rand()%3; + }else{ + pee->coor = LGQ; + } +} + +//randomizer +void dingq(bakapee_t *pee) +{ + if(pee->gqgq++; + } + else + { + dingu(pee); + pee->gq = 0; } + pee->bakax = rand()%3; pee->bakay = rand()%3; } /*-----------ding-------------*/ @@ -196,73 +175,60 @@ void ding(page_t *page, bakapee_t *pee, word q) switch(q) { case 1: - if(pee->gqxx==SCREEN_WIDTH){pee->bakax=0;} - if(pee->xx==0){pee->bakax=1;} - if(pee->yy==SCREEN_HEIGHT){pee->bakay=0;} - if(pee->yy==0){pee->bakay=1;} - pee->gq++; - }else pee->gq = LGQ; + dingq(pee); + if(pee->xx==SCREEN_WIDTH){pee->bakax=0;} + if(pee->xx==0){pee->bakax=1;} + if(pee->yy==SCREEN_HEIGHT){pee->bakay=0;} + if(pee->yy==0){pee->bakay=1;} break; case 2: - if(pee->gqwidth, (rand()*TILEWH)%(page->height), TILEWH, TILEWH, 0); #else - modexputPixel(page, rand()%SCREEN_WIDTH, rand()%(SCREEN_HEIGHT), 0); + modexputPixel(page, rand()%page->width, rand()%page->height, 0); #endif - pee->bakax = rand()%3; pee->bakay = rand()%3; - pee->gq++; - }else pee->gq = LGQ; break; case 3: - if(pee->gqxx!=SCREEN_WIDTH||pee->yy!=SCREEN_HEIGHT) { - if(pee->xx!=SCREEN_WIDTH||pee->yy!=SCREEN_HEIGHT) - { - if(pee->xx==0){pee->bakax=1;pee->bakay=-1;d3y=1;} - if(pee->yy==0){pee->bakax=1;pee->bakay=0;d3y=1;} - if(pee->xx==SCREEN_WIDTH){pee->bakax=-1;pee->bakay=-1;d3y=1;} - if(pee->yy==SCREEN_HEIGHT){pee->bakax=1;pee->bakay=0;d3y=1;} - }else if(pee->xx==SCREEN_WIDTH&&pee->yy==SCREEN_HEIGHT) pee->xx=pee->yy=0; - if(d3y) - { - if(pee->bakay<0) - { - pee->yy--; - d3y--; - }else - if(pee->bakay>0) - { - pee->yy++; - d3y--; - } - } - if(pee->bakax<0) + if(pee->xx==0){pee->bakax=1;pee->bakay=-1;d3y=1;} + if(pee->yy==0){pee->bakax=1;pee->bakay=0;d3y=1;} + if(pee->xx==SCREEN_WIDTH){pee->bakax=-1;pee->bakay=-1;d3y=1;} + if(pee->yy==SCREEN_HEIGHT){pee->bakax=1;pee->bakay=0;d3y=1;} + }else if(pee->xx==SCREEN_WIDTH&&pee->yy==SCREEN_HEIGHT) pee->xx=pee->yy=0; + if(d3y) + { + if(pee->bakay<0) { - pee->xx--; + pee->yy--; + d3y--; }else - if(pee->bakax>0) + if(pee->bakay>0) { - pee->xx++; + pee->yy++; + d3y--; } - pee->gq++; - }else pee->gq = LGQ; + } + if(pee->bakax<0) + { + pee->xx--; + }else + if(pee->bakax>0) + { + pee->xx++; + } + dingpp(page, pee); //plot the pixel/tile break; case 4: - if(pee->gqbakax = rand()%3; pee->bakay = rand()%3; - pee->gq++; - }else pee->gq = LGQ; + dingq(pee); + dingas(pee); + dingo(pee); + dingpp(page, pee); //plot the pixel/tile break; case 5: colortest(page, pee); @@ -272,22 +238,22 @@ void ding(page_t *page, bakapee_t *pee, word q) cls(page, pee->coor, VGA); break; case 7: - if(pee->gq <= HGQ) + if(pee->coor <= HGQ) { ssd(page, pee, q); - pee->gq++; - }else pee->gq = LGQ; + pee->coor++; + }else pee->coor = LGQ; break; case 8: colorz(page, pee); modexprint(page, SCREEN_WIDTH/2, SCREEN_HEIGHT/2, 1, 47, 0, "bakapi"); break; case 9: - if(pee->gq <= HGQ) + if(pee->coor <= HGQ) { - ssd(page, pee, q); pee->coor++; - pee->gq++; - }else pee->gq = LGQ; + ssd(page, pee, q); + pee->coor++; + }else pee->coor = LGQ; break; case 10: ssd(page, pee, q); /*printf("%d\n", pee->coor);*/ @@ -297,31 +263,24 @@ void ding(page_t *page, bakapee_t *pee, word q) break; case 16: //interesting effects - if(pee->gqbakax){ pee->xx--;} - else if(pee->bakax>0){ pee->xx++; } - if(!pee->bakay){ pee->yy--;} - else if(pee->bakay>0){ pee->yy++; } - dingas(pee); - tx+=pee->xx+TILEWH+4; - ty+=pee->yy+TILEWH+4; - modexClearRegion(page, tx, ty, 4, 4, pee->coor); + dingq(pee); + if(!pee->bakax){ pee->xx--;} + else if(pee->bakax>0){ pee->xx++; } + if(!pee->bakay){ pee->yy--;} + else if(pee->bakay>0){ pee->yy++; } + dingas(pee); + tx+=pee->xx+TILEWH+4; + ty+=pee->yy+TILEWH+4; + modexClearRegion(page, tx, ty, 4, 4, pee->coor); #ifdef TILE - modexClearRegion(page, (rand()*TILEWH)%SCREEN_WIDTH, (rand()*TILEWH)%(SCREEN_HEIGHT), TILEWH, TILEWH, 0); + modexClearRegion(page, (rand()*TILEWH)%page->width, (rand()*TILEWH)%(page->height), TILEWH, TILEWH, 0); #else - modexputPixel(page, rand()%SCREEN_WIDTH, rand()%(SCREEN_HEIGHT), 0); + modexputPixel(page, rand()%page->width, rand()%(page->height), 0); #endif - pee->bakax = rand()%3; pee->bakay = rand()%3; - //printf("%d %d %d %d %d %d\n", pee->xx, pee->yy, tx, ty, TILEWH); - pee->gq++; - }else pee->gq = LGQ; - break; - case 0: - return; + //printf("%d %d %d %d %d %d\n", pee->xx, pee->yy, tx, ty, TILEWH); break; default: - return; break; } + //pee->coor++; }