X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=16%2Fdos_gfx.cpp;h=836382c80d4e324ceb5dee1ae36b6458455f6a9a;hb=426483a16b69f3d14aad1d9811c74af9976eddf2;hp=c1d9f135759496947c31c43793e6b6ef5ae7deff;hpb=ce0e8d8019f8922dfa6cdf3dc2567e326edce055;p=16.git diff --git a/16/dos_gfx.cpp b/16/dos_gfx.cpp index c1d9f135..836382c8 100644 --- a/16/dos_gfx.cpp +++ b/16/dos_gfx.cpp @@ -32,7 +32,7 @@ * Thanks go out to various helpful netters who spotted the 0xE7 bug * in the set320x240x256() function! * - * modified by sparky4 so it can be compiled in open watcom ^^ + * Modified by sparky4 so it can be compiled in open watcom ^^ */ @@ -56,7 +56,8 @@ //code from old library! /*src\lib\*/ -#include "dos_gfx.h" +#include "dos_gfx.h" +#include "lib\x\modex.h" int old_mode; //color ‚Ä‚·‚Æ @@ -244,73 +245,41 @@ void set320x240x256_X(void) } +/*-----------XXXX-------------*/ /*tile*/ -// This is Bresenham's Line Drawing Algorithm -void drawline(int x1, int y1, int x2, int y2, char col) -{ - int d, x, y, ax, ay, sx, sy, dx, dy; - - dx = x2-x1; - ax = ABS(dx) << 1; - sx = SGN(dx); - dy = y2-y1; - ay = ABS(dy) << 1; - sy = SGN(dy); - - x = x1; - y = y1; - if( ax > ay ) - { - d = ay - (ax >> 1); - while( x != x2 ) - { - putPixel_X( x, y, col ); - if( d >= 0 ) - { - y += sy; - d -= ax; - } - x += sx; - d += ay; - } +void putColorBox_X(int x, int y, int w, int h, byte color) { + outp(0x3c4, 0x02); + + int curx, cury; + unsigned drawptr; + for (curx=x; curx<(x+w); curx++) { + outp(0x3c5, 0x01 << (curx & 3)); + drawptr = (unsigned)(widthBytes * y) + (curx / 4) + actStart; + for (cury=0; cury> 1); - while( y != y2 ) - { - putPixel_X( x, y, col ); - if( d >= 0 ) - { - x += sx; - d -= ay; - } - y += sy; - d += ax; - } - } - return; + } } - -void drawrect(int x1, int y1, int x2, int y2, char color) -{ - /*drawline(x1,y1,x2,y1,color); - drawline(x1,y2,x2,y2,color); - drawline(x1,y1,x1,y2,color); - drawline(x2,y1,x2,y2+1,color);*/ - //_fmemset(vga+x1+y2, color, 16*16); - byte far *p; - - p=vga+y1*width+x1; // make p point to the start of the line - while((y2-y1)) // repeat for entire line height - { - _fmemset(p, color, x2-x1); // set one line - p+=width; // move down one row - } +/*OFFSET = 0 +WHILE NOT FINISHED DO + OFFSET = OFFSET + 80 + IF OFFSET >= (200 * 80) THEN OFFSET = 0 + DRAW TO ROW 200 + SET VGA OFFSET = OFFSET + DRAW TO ROW -1 (was row 0 before scroll) +END WHILE*//* +void scrolly(){ + int OFFSET = 0 + WHILE NOT FINISHED DO + OFFSET = OFFSET + 80 + IF OFFSET >= (240 * 80) THEN OFFSET = 0 + RAW TO ROW 240 + SET VGA OFFSET = OFFSET + DRAW TO ROW -1 (was row 0 before scroll) + } } - - -/*-----------XXXX-------------*/ +*/ //--------------------------------------------------- // // Use the bios to get the address of the 8x8 font @@ -369,9 +338,9 @@ void drawText(int x, int y, int color, byte string) } ///////////////////////////////////////////////////////////////////////////// -// // +// // // setvideo() - This function Manages the video modes // -// // +// // ///////////////////////////////////////////////////////////////////////////// void setvideo(/*byte mode, */int vq){ union REGS in, out; @@ -400,7 +369,7 @@ void setvideo(/*byte mode, */int vq){ // // ///////////////////////////////////////////////////////////////////////////// void cls(byte color, byte *Where){ - _fmemset(Where, color, width*(height*17)); + _fmemset(Where, color, width*(height*17)); } //color ‚Ä‚·‚Æ @@ -452,17 +421,17 @@ int ding(int q){ ||q==16 ) && gq == BONK-1){ if(coor < HGQ && coor < LGQ) coor = LGQ; - if(coor < HGQ-1){ + if(coor < HGQ){ coor++; }else{ coor = LGQ; bakax = rand()%3; bakay = rand()%3; } } - if(q == 5){ colortest(); return gq; } - if(q == 10){ colorz(); return gq; } + if(q == 8){ colorz(); return gq; }else + if(q == 10){ ssd(q); /*printf("%d\n", coor);*/ }else + if(q == 5){ colortest(); return gq; }else if(q == 11){ colorz(); delay(100); return gq; } - if(q == 8){ ssd(q); /*printf("%d\n", coor);*/ } if(q == 6){ coor = rand()%NUM_COLORS; //---- cls(coor, vaddr); @@ -535,12 +504,12 @@ int ding(int q){ } } // fixer - if(q!=16){ + //if(q!=16){ if(xx<0) xx=width; if(yy<0) yy=height; if(xx>width) xx=0; if(yy>height) yy=0; - } + //} //interesting effects if(q==16) @@ -554,10 +523,14 @@ int ding(int q){ // plot the pixel //---- ppf(xx, yy, coor, vga); -//++++0000 putPixel_X(xx, yy, coor); - }else drawrect(xx, yy, xx+TILEWH-1, yy+TILEWH-1, coor); + }else if(xx>=0 && xx=0 && yy320||yy<0||yy>240) @@ -676,7 +649,7 @@ int main(void) doTest(); setvideo(0); puts("Where to next? It's your move! wwww"); - printf("bakapi ver. 1.04.09a\nis made by sparky4i†ƒÖ…j feel free to use it ^^\nLicence: GPL v2\n"); + printf("bakapi ver. 1.04.09.01\nis made by sparky4i†ƒÖ…j feel free to use it ^^\nLicence: GPL v2\n"); return 0; }