From 9e1399ec144b3d235e4278d40a2c09b91c499a88 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Wed, 28 Dec 2011 20:34:26 +0000 Subject: [PATCH] screenshots: remove the old inversion and PCX code from the source git-svn-id: https://svn.eduke32.com/eduke32@2220 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/engine.c | 227 +++-------------------------- 1 file changed, 18 insertions(+), 209 deletions(-) diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index bc2ca559a..87d93773f 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -15599,8 +15599,8 @@ static int32_t screencapture_tga(const char *filename, char inverseit) // palette first # ifdef USE_OPENGL if (rendmode < 3 || (rendmode >= 3 && qsetmode != 200)) - { # endif + { //getpalette(0,256,palette); for (i=0; i<256; i++) { @@ -15608,236 +15608,45 @@ static int32_t screencapture_tga(const char *filename, char inverseit) Bfputc(inverseit ? 255-curpalettefaded[i].g : curpalettefaded[i].g, fil); // g Bfputc(inverseit ? 255-curpalettefaded[i].r : curpalettefaded[i].r, fil); // r } + } + # ifdef USE_OPENGL - } -# endif - -# if 0 - // targa renders bottom to top, from left to right - if (inverseit && qsetmode != 200) - { - inversebuf = Bmalloc(bytesperline); - if (inversebuf) - { - for (i=ydim-1; i>=0; i--) - { - Bmemcpy(inversebuf, ptr+i*bytesperline, xdim); - for (j=0; j= 3 && qsetmode == 200) - { - char c; - // 24bit - inversebuf = (char *)Bmalloc(xdim*ydim*3); - if (inversebuf) - { - bglReadPixels(0,0,xdim,ydim,GL_RGB,GL_UNSIGNED_BYTE,inversebuf); - j = xdim*ydim*3; - for (i=0; i=0; i--) - Bfwrite(ptr+i*bytesperline, xdim, 1, fil); - } - } - - enddrawing(); //}}} - - Bfclose(fil); - OSD_Printf("Saved screenshot to %s\n", fn); - Bfree(fn); - capturecount++; - return(0); -} -# endif - - -#if 0 -// PCX is nasty, which is why I've lifted these functions from the PCX spec by ZSoft -static int32_t writepcxbyte(char colour, char count, BFILE *fp) -{ - if (!count) return 0; - if (count == 1 && (colour & 0xc0) != 0xc0) - { - Bfputc(colour, fp); - return 1; - } - else - { - Bfputc(0xc0 | count, fp); - Bfputc(colour, fp); - return 2; - } -} - -static void writepcxline(char *buf, int32_t bytes, int32_t step, BFILE *fp) -{ - char ths, last; - int32_t srcIndex; - char runCount; - - runCount = 1; - last = *buf; - - for (srcIndex=1; srcIndex= 3 && qsetmode == 200) { - head[65] = 3; // 24-bit - } -#endif - - head[8] = (xdim-1) & 0xff; - head[9] = ((xdim-1) >> 8) & 0xff; - head[10] = (ydim-1) & 0xff; - head[11] = ((ydim-1) >> 8) & 0xff; - - bpl = xdim + (xdim&1); - - head[66] = bpl & 0xff; - head[67] = (bpl >> 8) & 0xff; - - Bfwrite(head, 128, 1, fil); - - begindrawing(); //{{{ - ptr = (char *)frameplace; - - // targa renders bottom to top, from left to right - if (inverseit && qsetmode != 200) - { - inversebuf = (char *)Bmalloc(bytesperline); + char c; + // 24bit + inversebuf = (char *)Bmalloc(xdim*ydim*3); if (inversebuf) { - for (i=0; i> 2); - for (j=0; j < (bytesperline>>2); j++)((int32_t *)inversebuf)[j] ^= 0x0f0f0f0fL; - writepcxline(inversebuf, xdim, 1, fil); + c = inversebuf[i]; + inversebuf[i] = inversebuf[i+2]; + inversebuf[i+2] = c; } + Bfwrite(inversebuf, xdim*ydim, 3, fil); Bfree(inversebuf); } } else +# endif { -#ifdef USE_OPENGL - if (rendmode >= 3 && qsetmode == 200) - { - // 24bit - inversebuf = (char *)Bmalloc(xdim*ydim*3); - if (inversebuf) - { - bglReadPixels(0,0,xdim,ydim,GL_RGB,GL_UNSIGNED_BYTE,inversebuf); - for (i=ydim-1; i>=0; i--) - { - writepcxline(inversebuf+i*xdim*3, xdim, 3, fil); - writepcxline(inversebuf+i*xdim*3+1, xdim, 3, fil); - writepcxline(inversebuf+i*xdim*3+2, xdim, 3, fil); - } - Bfree(inversebuf); - } - } - else - { -#endif - for (i=0; i=0; i--) + Bfwrite(ptr+i*bytesperline, xdim, 1, fil); } enddrawing(); //}}} - // palette last -#ifdef USE_OPENGL - if (rendmode < 3 || (rendmode >= 3 && qsetmode != 200)) - { -#endif - //getpalette(0,256,palette); - Bfputc(12,fil); - for (i=0; i<256; i++) - { - Bfputc(curpalettefaded[i].r, fil); // b - Bfputc(curpalettefaded[i].g, fil); // g - Bfputc(curpalettefaded[i].b, fil); // r - } -#ifdef USE_OPENGL - } -#endif - Bfclose(fil); OSD_Printf("Saved screenshot to %s\n", fn); Bfree(fn); capturecount++; return(0); } -#endif +# endif + int32_t screencapture(const char *filename, char inverseit, const char *versionstr) {