/* * TextFX2 Copyright (c) 1998 Jari Komppa aka Sol/Trauma * * * Textmode low-level functions * * This sourcefile is kinda long-ish, and should be split into several * sources, but I have wanted to keep it in one file since everything * here is kinda small and.. well, I wanted to keep it as a single .obj * file. * * If you make improvements, send me a copy! * If you use this for something, let me know! */ #include #include #include #include #include #include /************************************************************************* * Compilation options * */ //#define __USE_178NOT176 /* uncomment to use 75% char instead of 25% char */ #define __USE_REALIBMPAL /* comment out to use 'clean' truecolor palette for calculations */ #define COLORMAP_DEPTH 4 /* Normally, build 1<<4, ie. 16x16x16 colormap. * If you require bigger map, increase the value. * (5 will mean 32x32x32 etc). * 8 is max for dump_80x and _320x, 6 is max for _160x. * If you make your own routines, well, nothing is too much :) */ /* Don't touch the rest of the defines. */ #define COLMAPDIM (1<light. */ { 14, 32, 99, 114, 115, 120, 122, 118, 101, 110, 97, 111, 117, 119, 109 }; char charset_b8gry[]= /* 8b ibm grayscale characters */ { 5, 32, 176, 177, 178, 219 }; char charset_b7nws[]= /* 7b grayscale 'newschool' askee chars*/ { 6, ' ', '.', 'o', 'm', 'W', 'M' }; char * use_charset=charset_b7asc; /* Character set to use. Can be changed run-time. */ short int * colmap=NULL; #define COLMAP(r,g,b) *(colmap+((r)<<(COLORMAP_DEPTH*2))+((g)<>TRUCOLBITS, *(buf+1)>>TRUCOLBITS, *(buf+2)>>TRUCOLBITS); } void dump_160x(int y0, int y1, int * buffer) { int x,y,yd; unsigned long i; short int * scr; char * buf=(char*)&i; scr=(short int*)((char*)0xb8000+(y0*160)); yd=y1-y0; for (y=0;y>=2; i&=0xfcfcfcfc; *scr=COLMAP(*(buf+0)>>TRUCOLBITS, *(buf+1)>>TRUCOLBITS, *(buf+2)>>TRUCOLBITS); } } void dump_320x(int y0, int y1, int * buffer) { int x,y,yd,r,g,b,xx,yy; char * buf=(char*)buffer; short int * scr; scr=(short int*)((char*)0xb8000+(y0*160)); yd=y1-y0; for (y=0;y>(TRUCOLBITS+4), g>>(TRUCOLBITS+4), b>>(TRUCOLBITS+4)); } }