- rewrote the screenshot code to use m_png as its backend.

Mainly to finally get rid of kplib. There's really no use to keep such code around if alternatives are already present.
This commit is contained in:
Christoph Oelckers 2019-11-02 12:59:59 +01:00
parent edcfad6e11
commit 8fb54b51c3
32 changed files with 163 additions and 990 deletions

View file

@ -685,6 +685,7 @@ set( FASTMATH_SOURCES
# Another bit of cruft just to make S(hit)DL happy...
sdlappicon.cpp
gitinfo.cpp
)
@ -745,13 +746,11 @@ set (PCH_SOURCES
build/src/glsurface.cpp
build/src/hash.cpp
build/src/hightile.cpp
build/src/kplib.cpp
build/src/mdsprite.cpp
build/src/mhk.cpp
build/src/mutex.cpp
build/src/osd.cpp
build/src/palette.cpp
build/src/pngwrite.cpp
build/src/polymost.cpp
build/src/pragmas.cpp
build/src/rev.cpp
@ -872,6 +871,7 @@ endif()
target_link_libraries( demolition ${DEMOLITION_LIBS} gdtoa lzma duke3d blood rr sw )
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
build/include
mact/include
audiolib/include

View file

@ -24,9 +24,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "ns.h" // Must come before everything else!
#include "compat.h"
#ifdef WITHKPLIB
#include "kplib.h"
#endif
#include "common_game.h"
#include "resource.h"
#include "misc.h"

View file

@ -953,7 +953,7 @@ void LocalKeys(void)
case sc_F11:
break;
case sc_F12:
videoCaptureScreen("blud0000.tga", 0);
videoCaptureScreen();
break;
}
}

View file

@ -67,17 +67,4 @@ void _consoleSysMsg(const char* pzFormat, ...) {
OSD_Printf(OSDTEXT_RED "%s(%i): %s\n", _module, _line, buffer);
}
const char *GetVersionString(void)
{
if (!gVersionString)
{
gVersionString = gVersionStringBuf;
if (!gVersionString)
return NULL;
sprintf(gVersionString, "%d.%02d", EXEVERSION / 100, EXEVERSION % 100);
}
return gVersionString;
}
END_BLD_NS

View file

@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "compat.h"
#include "build.h"
#include "resource.h"
#include "version.h"
BEGIN_BLD_NS
@ -36,6 +37,5 @@ extern int gGamma;
extern bool bVanilla;
extern Resource &gSysRes;
const char *GetVersionString(void);
END_BLD_NS

View file

@ -465,11 +465,7 @@ static int osdcmd_quickload(osdcmdptr_t UNUSED(parm))
static int osdcmd_screenshot(osdcmdptr_t parm)
{
static const char *fn = "blud0000.png";
if (parm->numparms == 1 && !Bstrcasecmp(parm->parms[0], "tga"))
videoCaptureScreenTGA(fn, 0);
else videoCaptureScreen(fn, 0);
videoCaptureScreen();
return OSDCMD_OK;
}

View file

@ -1232,8 +1232,7 @@ static FORCE_INLINE int32_t spriteheightofs(int16_t i, int32_t *height, int32_t
return spriteheightofsptr((uspriteptr_t)&sprite[i], height, alsotileyofs);
}
int videoCaptureScreen(const char *filename, char inverseit) ATTRIBUTE((nonnull(1)));
int videoCaptureScreenTGA(const char *filename, char inverseit) ATTRIBUTE((nonnull(1)));
int videoCaptureScreen();
struct OutputFileCounter {
uint16_t count = 0;
@ -1285,8 +1284,6 @@ enum cutsceneflags {
CUTSCENE_TEXTUREFILTER = 4,
};
extern int32_t benchmarkScreenshot;
#ifdef USE_OPENGL
enum {

View file

@ -1,33 +0,0 @@
#ifndef compat_h_
#include "compat.h"
#endif
#include "vfs.h"
typedef struct
{
buildvfs_FILE fil; //0:no file open, !=0:open file (either stand-alone or zip)
int32_t comptyp; //0:raw data (can be ZIP or stand-alone), 8:PKZIP LZ77 *flate
int32_t seek0; //0:stand-alone file, !=0: start of zip compressed stream data
int32_t compleng;//Global variable for compression FIFO
int32_t comptell;//Global variable for compression FIFO
int32_t leng; //Uncompressed file size (bytes)
int32_t pos; //Current uncompressed relative file position (0<=pos<=leng)
int32_t endpos; //Temp global variable for kzread
int32_t jmpplc; //Store place where decompression paused
int32_t i; //For stand-alone/ZIP comptyp#0, this is like "uncomptell"
//For ZIP comptyp#8&btype==0 "<64K store", this saves i state
int32_t bfinal; //LZ77 decompression state (for later calls)
} kzfilestate;
extern kzfilestate kzfs;
extern uint8_t toupperlookup[256];
static inline int32_t filnamcmp(const char *j, const char *i)
{
// If we reach at the end of both strings, we are done
while (*i && *j && (toupperlookup[*i] == toupperlookup[*j]))
i++, j++;
return *i != '\0' || *j != '\0';
}

View file

@ -1,39 +0,0 @@
#ifndef __PNGWRITE_H__
#define __PNGWRITE_H__
#include <zlib.h>
#include "vfs.h"
#define CHUNK_COMPRESSED 1
#define CHUNK_ROW 2
enum
{
PNG_TRUECOLOR = 2,
PNG_INDEXED = 3,
};
#pragma pack(push, 1)
typedef struct
{
z_stream *zs;
buildvfs_FILE file;
uint8_t *pal_data;
uint16_t pal_entries;
uint8_t *text;
uint8_t textlen;
} pngwrite_t;
typedef struct
{
uint32_t width, height;
uint8_t depth, type, filler[3];
} png_ihdr_t;
#pragma pack(pop)
void png_set_pal(uint8_t const * data, int numentries);
void png_set_text(char const * keyword, char const * text);
void png_write(buildvfs_FILE const file, int const width, int const height, uint8_t const type, uint8_t const * const data);
#endif

View file

@ -3,7 +3,6 @@
#include "build.h"
#include "scriptfile.h"
#include "cache1d.h"
#include "kplib.h"
#include "baselayer.h"
#include "common.h"

View file

@ -11,7 +11,6 @@
#include "baselayer.h"
#include "scriptfile.h"
#include "cache1d.h"
#include "kplib.h"
#include "lz4.h"
#include "common.h"
#include "mdsprite.h" // md3model_t

View file

@ -131,8 +131,6 @@ static int32_t distrecipagecnt = 0;
static int32_t *lookups = NULL;
static int32_t beforedrawrooms = 1;
int32_t benchmarkScreenshot = 0;
static int32_t oxdimen = -1, oviewingrange = -1, oxyaspect = -1;
// r_usenewaspect is the cvar, newaspect_enable to trigger the new behaviour in the code
@ -4654,8 +4652,7 @@ static void classicDrawBunches(int32_t bunch)
yax_globalbunch, sectnum, wallnum);
printext256(8,8, whitecol,0, tmpbuf, 0);
Bsprintf(fn, "engshot%04d.png", engine_screenshot);
videoCaptureScreen(fn, 0);
videoCaptureScreen();
engine_screenshot++;
Bmemcpy((char *)frameplace, bakframe, xdim*ydim);
@ -10464,12 +10461,6 @@ void videoNextPage(void)
}
videoEndDrawing(); //}}}
if (benchmarkScreenshot)
{
videoCaptureScreen("reference0000.png", 0);
benchmarkScreenshot = 0;
}
OSD_Draw();
videoShowFrame(0);

View file

@ -6,7 +6,6 @@
#include "build.h"
#include "compat.h"
#include "kplib.h"
#include "hightile.h"
#include "baselayer.h"

View file

@ -1,548 +0,0 @@
/**************************************************************************************************
KPLIB.C: Ken's Picture LIBrary written by Ken Silverman
Copyright (c) 1998-2008 Ken Silverman
Ken Silverman's official web site: http://advsys.net/ken
Features of KPLIB.C:
* Routines for reading files out of ZIP/GRP files. All ZIP/GRP functions start with "kz".
* Multi-platform support: Dos/Windows/Linux/Mac/etc..
* Compact code, all in a single source file. Yeah, bad design on my part... but makes life
easier for everyone else - you simply add a single C file to your project, throw a few
externs in there, add the function calls, and you're done!
Brief history:
1998?: Wrote KPEG, a JPEG viewer for DOS
2000: Wrote KPNG, a PNG viewer for DOS
2001: Combined KPEG & KPNG, ported to Visual C, and made it into a library called KPLIB.C
2002: Added support for TGA,GIF,CEL,ZIP
2003: Added support for BMP
05/18/2004: Added support for 8&24 bit PCX
12/09/2005: Added support for progressive JPEG
01/05/2006: Added support for DDS
07/28/2007: Added support for GRP (Build Engine archive)
I offer this code to the community for free use - all I ask is that my name be included in the
credits.
-Ken S.
**************************************************************************************************/
#include "compat.h"
#include "baselayer.h"
#include "kplib.h"
#include "pragmas.h"
#include "vfs.h"
#if !defined(_WIN32)
static FORCE_INLINE CONSTEXPR int32_t klrotl(int32_t i, int sh) { return (i >> (-sh)) | (i << sh); }
#else
# define klrotl(i, sh) _lrotl(i, sh)
# ifdef __clang__
# include <emmintrin.h>
# else
# include <intrin.h>
# endif
#endif
//use GCC-specific extension to force symbol name to be something in particular to override underscoring.
#if defined(__GNUC__) && defined(__i386__) && !defined(NOASM)
#define ASMNAME(x) asm(x)
#else
#define ASMNAME(x)
#endif
static intptr_t kp_frameplace;
static int32_t kp_bytesperline, kp_xres, kp_yres;
static CONSTEXPR const int32_t pow2mask[32] =
{
0x00000000,0x00000001,0x00000003,0x00000007,
0x0000000f,0x0000001f,0x0000003f,0x0000007f,
0x000000ff,0x000001ff,0x000003ff,0x000007ff,
0x00000fff,0x00001fff,0x00003fff,0x00007fff,
0x0000ffff,0x0001ffff,0x0003ffff,0x0007ffff,
0x000fffff,0x001fffff,0x003fffff,0x007fffff,
0x00ffffff,0x01ffffff,0x03ffffff,0x07ffffff,
0x0fffffff,0x1fffffff,0x3fffffff,0x7fffffff,
};
static CONSTEXPR const int32_t pow2long[32] =
{
0x00000001,0x00000002,0x00000004,0x00000008,
0x00000010,0x00000020,0x00000040,0x00000080,
0x00000100,0x00000200,0x00000400,0x00000800,
0x00001000,0x00002000,0x00004000,0x00008000,
0x00010000,0x00020000,0x00040000,0x00080000,
0x00100000,0x00200000,0x00400000,0x00800000,
0x01000000,0x02000000,0x04000000,0x08000000,
0x10000000,0x20000000,0x40000000,(int32_t)0x80000000,
};
//Hack for peekbits,getbits,suckbits (to prevent lots of duplicate code)
// 0: PNG: do 12-byte chunk_header removal hack
// !=0: ZIP: use 64K buffer (olinbuf)
static int32_t zipfilmode;
kzfilestate kzfs;
// GCC 4.6 LTO build fix
#ifdef USING_LTO
# define B_KPLIB_STATIC
#else
# define B_KPLIB_STATIC static
#endif
//Initialized tables (can't be in union)
//jpg: png:
// crmul 16384 abstab10 4096
// cbmul 16384 hxbit 472
// dct 4608 pow2mask 128*
// colclip 4096
// colclipup8 4096
// colclipup16 4096
// unzig 256
// pow2mask 128*
// dcflagor 64
B_KPLIB_STATIC int32_t ATTRIBUTE((used)) palcol[256] ASMNAME("palcol");
static int32_t paleng, bakcol, numhufblocks, zlibcompflags;
static int8_t kcoltype, filtype, bitdepth;
//============================ KPNGILIB begins ===============================
//07/31/2000: KPNG.C first ported to C from READPNG.BAS
//10/11/2000: KPNG.C split into 2 files: KPNG.C and PNGINLIB.C
//11/24/2000: Finished adding support for coltypes 4&6
//03/31/2001: Added support for Adam7-type interlaced images
//Currently, there is no support for:
// * 16-bit color depth
// * Some useless ancillary chunks, like: gAMA(gamma) & pHYs(aspect ratio)
//.PNG specific variables:
static int32_t bakr = 0x80, bakg = 0x80, bakb = 0x80; //this used to be public...
static int32_t gslidew = 0, gslider = 0, xm, xmn[4], xr0, xr1, xplc, yplc;
static intptr_t nfplace;
static int32_t clen[320], cclen[19], bitpos, filt, xsiz, ysiz;
int32_t xsizbpl, ixsiz, ixoff, iyoff, ixstp, iystp, intlac, nbpl;
B_KPLIB_STATIC int32_t ATTRIBUTE((used)) trnsrgb ASMNAME("trnsrgb");
static int32_t ccind[19] = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15};
static int32_t hxbit[59][2], ibuf0[288], nbuf0[32], ibuf1[32], nbuf1[32];
static const uint8_t *filptr;
static uint8_t slidebuf[32768], opixbuf0[4], opixbuf1[4];
static uint8_t pnginited = 0;
B_KPLIB_STATIC uint8_t olinbuf[131072] ASMNAME("olinbuf"); //WARNING:max kp_xres is: 131072/bpp-1
B_KPLIB_STATIC int32_t ATTRIBUTE((used)) abstab10[1024] ASMNAME("abstab10");
//Variables to speed up dynamic Huffman decoding:
#define LOGQHUFSIZ0 9
#define LOGQHUFSIZ1 6
static int32_t qhufval0[1<<LOGQHUFSIZ0], qhufval1[1<<LOGQHUFSIZ1];
static uint8_t qhufbit0[1<<LOGQHUFSIZ0], qhufbit1[1<<LOGQHUFSIZ1];
#if defined(_MSC_VER) && !defined(NOASM)
static inline int32_t bitrev(int32_t b, int32_t c)
{
_asm
{
mov edx, b
mov ecx, c
xor eax, eax
beg: shr edx, 1
adc eax, eax
sub ecx, 1
jnz short beg
}
}
#elif defined(__GNUC__) && defined(__i386__) && !defined(NOASM)
static inline int32_t bitrev(int32_t b, int32_t c)
{
int32_t a = 0;
__asm__ __volatile__(
"xorl %%eax, %%eax\n\t0:\n\tshrl $1, %%ebx\n\tadcl %%eax, %%eax\n\tsubl $1, %%ecx\n\tjnz 0b"
: "+a"(a), "+b"(b), "+c"(c) : : "cc");
return a;
}
#else
static inline int32_t bitrev(int32_t b, int32_t c)
{
int32_t i, j;
for (i=1,j=0,c=(1<<c); i<c; i+=i) { j += j; if (b&i) j++; }
return j;
}
#endif
static uint8_t fakebuf[8];
static uint8_t const *nfilptr;
static int32_t nbitpos;
static void suckbitsnextblock()
{
if (zipfilmode)
{
//NOTE: should only read bytes inside compsize, not 64K!!! :/
B_BUF32(&olinbuf[0], B_UNBUF32(&olinbuf[sizeof(olinbuf)-4]));
uint32_t n = min<uint32_t>(kzfs.compleng-kzfs.comptell, sizeof(olinbuf)-4);
buildvfs_fread(&olinbuf[4], n, 1, kzfs.fil);
kzfs.comptell += n;
bitpos -= ((sizeof(olinbuf)-4)<<3);
return;
}
if (nfilptr)
{
filptr = nfilptr; nfilptr = 0;
bitpos -= ((nbitpos-4)<<3);
return;
}
//if (n_from_suckbits < 4) will it crash?
//|===|===|crc|lng|typ|===|===|
// \ fakebuf: /
// |===|===|
//----x O---x O--------
nbitpos = B_BIG32(B_UNBUF32(&filptr[8]));
nfilptr = &filptr[nbitpos+12];
B_BUF32(&fakebuf[0], B_UNBUF32(&filptr[0])); //Copy last dword of IDAT chunk
if (B_UNBUF32(&filptr[12]) == B_LITTLE32(0x54414449)) //Copy 1st dword of next IDAT chunk
B_BUF32(&fakebuf[4], B_UNBUF32(&filptr[16]));
filptr = &fakebuf[4]; bitpos -= 32;
}
static inline int32_t peekbits(int32_t n) { return (B_LITTLE32(B_UNBUF32(&filptr[bitpos>>3]))>>(bitpos&7))&pow2mask[n]; }
static inline void suckbits(int32_t n) { bitpos += n; if (bitpos < 0) return; suckbitsnextblock(); }
static inline int32_t getbits(int32_t n) { int32_t i = peekbits(n); suckbits(n); return i; }
static int32_t hufgetsym(int32_t *hitab, const int32_t *hbmax)
{
int32_t v, n;
v = n = 0;
do { v = (v<<1)+getbits(1)+hbmax[n]-hbmax[n+1]; n++; }
while (v >= 0);
return hitab[hbmax[n]+v];
}
//This did not result in a speed-up on P4-3.6Ghz (02/22/2005)
//static int32_t hufgetsym_skipb (int32_t *hitab, int32_t *hbmax, int32_t n, int32_t addit)
//{
// int32_t v;
//
// v = bitrev(getbits(n),n)+addit;
// do { v = (v<<1)+getbits(1)+hbmax[n]-hbmax[n+1]; n++; } while (v >= 0);
// return hitab[hbmax[n]+v];
//}
static void qhufgencode(const int32_t *hitab, const int32_t *hbmax, int32_t *qhval, uint8_t *qhbit, int32_t numbits)
{
int32_t i, j, k, n, r;
//r is the bit reverse of i. Ex: if: i = 1011100111, r = 1110011101
i = r = 0;
for (n=1; n<=numbits; n++)
for (k=hbmax[n-1]; k<hbmax[n]; k++)
for (j=i+pow2mask[numbits-n]; i<=j; i++)
{
r = bitrev(i,numbits);
qhval[r] = hitab[k];
qhbit[r] = (uint8_t)n;
}
for (j=pow2mask[numbits]; i<=j; i++)
{
r = bitrev(i,numbits);
//k = 0;
//for(n=0;n<numbits;n++)
// k = (k<<1) + ((r>>n)&1) + hbmax[n]-hbmax[n+1];
//
//n = numbits;
//k = hbmax[n]-r;
//
//j = peekbits(LOGQHUFSIZ); i = qhufval[j]; j = qhufbit[j];
//
//i = j = 0;
//do
//{
// i = (i<<1)+getbits(1)+nbuf0[j]-nbuf0[j+1]; j++;
//} while (i >= 0);
//i = ibuf0[nbuf0[j]+i];
//qhval[r] = k;
qhbit[r] = 0; //n-32;
}
// //hufgetsym_skipb related code:
//for(k=n=0;n<numbits;n++) k = (k<<1)+hbmax[n]-hbmax[n+1];
//return k;
}
//inbuf[inum] : Bit length of each symbol
//inum : Number of indices
//hitab[inum] : Indices from size-ordered list to original symbol
//hbmax[0-31] : Highest index (+1) of n-bit symbol
static void hufgencode(const int32_t *inbuf, int32_t inum, int32_t *hitab, int32_t *hbmax)
{
int32_t i, tbuf[31], *tbufptr, *hbmaxptr;
Bmemset(tbuf, 0, sizeof(tbuf));
for (i=inum-1; i>=0; i--) tbuf[inbuf[i]]++;
tbuf[0] = hbmax[0] = 0; //Hack to remove symbols of length 0?
for (i=0; i<28; i += 4)
{
tbufptr = &tbuf[i];
hbmaxptr = &hbmax[i];
*(hbmaxptr+1) = *hbmaxptr + *tbufptr;
*(hbmaxptr+2) = *(hbmaxptr+1) + *(tbufptr+1);
*(hbmaxptr+3) = *(hbmaxptr+2) + *(tbufptr+2);
*(hbmaxptr+4) = *(hbmaxptr+3) + *(tbufptr+3);
}
tbufptr = &tbuf[i];
hbmaxptr = &hbmax[i];
*(hbmaxptr+1) = *hbmaxptr + *tbufptr;
*(hbmaxptr+2) = *(hbmaxptr+1) + *(tbufptr+1);
*(hbmaxptr+3) = *(hbmaxptr+2) + *(tbufptr+2);
for (i=0; i<inum; i++) if (inbuf[i]) hitab[hbmax[inbuf[i]]++] = i;
}
static int32_t initpass() //Interlaced images have 7 "passes", non-interlaced have 1
{
int32_t i, j, k;
do
{
i = (intlac<<2);
ixoff = ((0x04020100>>i)&15);
iyoff = ((0x00402010>>i)&15);
if (((ixoff >= xsiz) || (iyoff >= ysiz)) && (intlac >= 2)) { i = -1; intlac--; }
}
while (i < 0);
j = ((0x33221100>>i)&15); ixstp = (1<<j);
k = ((0x33322110>>i)&15); iystp = (1<<k);
//xsiz=12 0123456789ab
//j=3,ixoff=0 0 1 ((12+(1<<3)-1 - 0)>>3) = 2
//j=3,ixoff=4 2 ((12+(1<<3)-1 - 4)>>3) = 1
//j=2,ixoff=2 3 4 5 ((12+(1<<2)-1 - 2)>>2) = 3
//j=1,ixoff=1 6 7 8 9 a b ((12+(1<<1)-1 - 1)>>1) = 6
ixsiz = ((xsiz+ixstp-1-ixoff)>>j); //It's confusing! See the above example.
nbpl = (kp_bytesperline<<k);
//Initialize this to make filters fast:
xsizbpl = ((0x04021301>>(kcoltype<<2))&15)*ixsiz;
switch (bitdepth)
{
case 1: xsizbpl = ((xsizbpl+7)>>3); break;
case 2: xsizbpl = ((xsizbpl+3)>>2); break;
case 4: xsizbpl = ((xsizbpl+1)>>1); break;
}
Bmemset(olinbuf,0,(xsizbpl+1)*sizeof(olinbuf[0]));
B_BUF32(&opixbuf0[0], 0);
B_BUF32(&opixbuf1[0], 0);
xplc = xsizbpl; yplc = iyoff; xm = 0; filt = -1;
i = ixoff; i = (((-(i>=0))|(ixstp-1))&i);
k = (((-(yplc>=0))|(iystp-1))&yplc);
nfplace = k*kp_bytesperline + (i<<2) + kp_frameplace;
//Precalculate x-clipping to screen borders (speeds up putbuf)
//Equation: (0 <= xr <= ixsiz) && (0 <= xr*ixstp+globxoffs+ixoff <= kp_xres)
xr0 = max((-ixoff+(1<<j)-1)>>j,0);
xr1 = min((kp_xres-ixoff+(1<<j)-1)>>j,ixsiz);
xr0 = ixsiz-xr0;
xr1 = ixsiz-xr1;
if (kcoltype == 4) { xr0 = xr0*2; xr1 = xr1*2; }
else if (kcoltype == 2) { xr0 = xr0*3-2; xr1 = xr1*3-2; }
else if (kcoltype == 6) { xr0 = xr0*4-2; xr1 = xr1*4-2; }
else
{
switch (bitdepth)
{
case 1: xr0 += ((-ixsiz)&7)+7;
xr1 += ((-ixsiz)&7)+7; break;
case 2: xr0 = ((xr0+((-ixsiz)&3)+3)<<1);
xr1 = ((xr1+((-ixsiz)&3)+3)<<1); break;
case 4: xr0 = ((xr0+((-ixsiz)&1)+1)<<2);
xr1 = ((xr1+((-ixsiz)&1)+1)<<2); break;
}
}
ixstp <<= 2;
return 0;
}
static inline int32_t Paeth686(int32_t const a, int32_t const b, int32_t c)
{
int32_t const * const ptr = &abstab10[(c - a) - (b - 512)];
int32_t const esi = *(ptr + b);
int32_t edi = *(ptr + c);
if (edi >= esi) edi = esi, c = b;
return (edi < *(ptr + a)) ? c : a;
}
static inline void rgbhlineasm(int32_t x, int32_t xr1, intptr_t p, int32_t ixstp)
{
if (!trnsrgb)
{
for (; x>xr1; p+=ixstp,x-=3) B_BUF32((void *) p, (B_UNBUF32(&olinbuf[x]))|B_LITTLE32(0xff000000));
return;
}
for (; x>xr1; p+=ixstp,x-=3)
{
int32_t i = (B_UNBUF32(&olinbuf[x]))|B_LITTLE32(0xff000000);
if (i == trnsrgb) i &= B_LITTLE32(0xffffff);
B_BUF32((void *) p, i);
}
}
static inline void pal8hlineasm(int32_t x, int32_t xr1, intptr_t p, int32_t ixstp)
{
for (; x>xr1; p+=ixstp,x--) B_BUF32((void *) p, palcol[olinbuf[x]]);
}
//Autodetect filter
// /f0: 0000000...
// /f1: 1111111...
// /f2: 2222222...
// /f3: 1333333...
// /f3: 3333333...
// /f4: 4444444...
// /f5: 0142321...
static int32_t filter1st, filterest;
static void putbuf(const uint8_t *buf, int32_t leng)
{
int32_t i;
intptr_t p;
if (filt < 0)
{
if (leng <= 0) return;
filt = buf[0];
if (filter1st < 0) filter1st = filt; else filterest |= (1<<filt);
i = 1;
}
else i = 0;
while (i < leng)
{
int32_t x = i+xplc; if (x > leng) x = leng;
switch (filt)
{
case 0:
while (i < x) { olinbuf[xplc--] = buf[i++]; }
break;
case 1:
while (i < x)
{
olinbuf[xplc--] = (uint8_t)(opixbuf1[xm] += buf[i++]);
xm = xmn[xm];
}
break;
case 2:
while (i < x) { olinbuf[xplc--] += (uint8_t)buf[i++]; }
break;
case 3:
while (i < x)
{
opixbuf1[xm] = olinbuf[xplc] = (uint8_t)(((opixbuf1[xm]+olinbuf[xplc])>>1)+buf[i++]);
xm = xmn[xm]; xplc--;
}
break;
case 4:
while (i < x)
{
opixbuf1[xm] = (uint8_t)(Paeth686(opixbuf1[xm],olinbuf[xplc],opixbuf0[xm])+buf[i++]);
opixbuf0[xm] = olinbuf[xplc];
olinbuf[xplc--] = opixbuf1[xm];
xm = xmn[xm];
}
break;
}
if (xplc > 0) return;
//Draw line!
if ((uint32_t)yplc < (uint32_t)kp_yres)
{
x = xr0; p = nfplace;
switch (kcoltype)
{
case 2: rgbhlineasm(x,xr1,p,ixstp); break;
case 4:
for (; x>xr1; p+=ixstp,x-=2)
B_BUF32((void *) p, (palcol[olinbuf[x]]&B_LITTLE32(0xffffff))|B_BIG32((int32_t)olinbuf[x-1]));
break;
case 6:
for (; x>xr1; p+=ixstp,x-=4)
{
*(char *)(p) = olinbuf[x ]; //B
*(char *)(p+1) = olinbuf[x+1]; //G
*(char *)(p+2) = olinbuf[x+2]; //R
*(char *)(p+3) = olinbuf[x-1]; //A
}
break;
default:
switch (bitdepth)
{
case 1: for (; x>xr1; p+=ixstp,x--) B_BUF32((void *) p, palcol[olinbuf[x>>3]>>(x&7)]); break;
case 2: for (; x>xr1; p+=ixstp,x-=2) B_BUF32((void *) p, palcol[olinbuf[x>>3]>>(x&6)]); break;
case 4: for (; x>xr1; p+=ixstp,x-=4) B_BUF32((void *) p, palcol[olinbuf[x>>3]>>(x&4)]); break;
case 8: pal8hlineasm(x,xr1,p,ixstp); break; //for(;x>xr1;p+=ixstp,x-- ) B_BUF32((void *) p, palcol[olinbuf[x]]); break;
}
break;
}
nfplace += nbpl;
}
B_BUF32(&opixbuf0[0], 0);
B_BUF32(&opixbuf1[0], 0);
xplc = xsizbpl; yplc += iystp;
if ((intlac) && (yplc >= ysiz)) { intlac--; initpass(); }
if (i < leng)
{
filt = buf[i++];
if (filter1st < 0) filter1st = filt; else filterest |= (1<<filt);
}
else filt = -1;
}
}
static void initpngtables()
{
int32_t i, j, k;
//hxbit[0-58][0-1] is a combination of 4 different tables:
// 1st parameter: [0-29] are distances, [30-58] are lengths
// 2nd parameter: [0]: extra bits, [1]: base number
j = 1; k = 0;
for (i=0; i<30; i++)
{
hxbit[i][1] = j; j += (1<<k);
hxbit[i][0] = k; k += ((i&1) && (i >= 2));
}
j = 3; k = 0;
for (i=257; i<285; i++)
{
hxbit[i+30-257][1] = j; j += (1<<k);
hxbit[i+30-257][0] = k; k += ((!(i&3)) && (i >= 264));
}
hxbit[285+30-257][1] = 258; hxbit[285+30-257][0] = 0;
for (i=0; i<512; i++) abstab10[512+i] = abstab10[512-i] = i;
}
//============================= KPNGILIB ends ================================
//==================== External picture interface ends =======================

View file

@ -11,7 +11,6 @@
#include "polymost.h"
#include "mdsprite.h"
#include "cache1d.h"
#include "kplib.h"
#include "common.h"
#include "palette.h"
#include "textures.h"

View file

@ -1,97 +0,0 @@
#include "compat.h"
#include "pngwrite.h"
#include "crc32_.h"
#include "vfs.h"
pngwrite_t png;
#define png_write_buf(p, size) buildvfs_fwrite(p, size, 1, png.file)
static FORCE_INLINE void png_write_uint32(uint32_t const in)
{
uint32_t const buf = B_BIG32(in);
png_write_buf(&buf, sizeof(uint32_t));
}
static void png_write_chunk(uint32_t const size, char const *const type,
uint8_t const *const data, uint32_t flags)
{
uLongf chunk_size = (flags & CHUNK_COMPRESSED) ? compressBound(size) : size;
uint8_t * const chunk = (uint8_t *) Xcalloc(1, 4 + chunk_size);
Bmemcpy(chunk, type, 4);
if (flags & CHUNK_COMPRESSED)
compress(chunk + 4, (uLongf *) &chunk_size, data, size);
else
Bmemcpy(chunk + 4, data, size);
png_write_uint32(chunk_size);
png_write_buf(chunk, chunk_size + 4);
uint32_t crc = Bcrc32(NULL, 0, 0L);
crc = Bcrc32(chunk, chunk_size + 4, crc);
png_write_uint32(crc);
Xfree(chunk);
}
void png_set_pal(uint8_t const * const data, int numentries)
{
png.pal_entries = numentries;
png.pal_data = (uint8_t *)Xmalloc(numentries * 3);
Bmemcpy(png.pal_data, data, numentries * 3);
}
void png_set_text(char const * const keyword, char const * const text)
{
unsigned const keylen = Bstrlen(keyword);
Bassert(keylen < 79);
unsigned const textlen = Bstrlen(text);
png.textlen = keylen + textlen + 1;
png.text = (uint8_t *) Xrealloc(png.text, png.textlen);
Bmemcpy(png.text, keyword, keylen);
*(png.text + keylen) = 0;
Bmemcpy(png.text + keylen + 1, text, textlen);
}
void png_write(buildvfs_FILE const file, int const width, int const height,
uint8_t const type, uint8_t const * const data)
{
png.file = file;
png_write_buf("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A", 8);
png_ihdr_t const png_header = { B_BIG32((unsigned)width), B_BIG32((unsigned)height), 8, type, 0 };
png_write_chunk(sizeof(png_ihdr_t), "IHDR", (uint8_t const *)&png_header, 0);
if (png.text)
{
png_write_chunk(png.textlen, "tEXt", png.text, 0);
DO_FREE_AND_NULL(png.text);
}
int const bytesPerPixel = (type == PNG_TRUECOLOR ? 3 : 1);
int const bytesPerLine = width * bytesPerPixel;
if (png.pal_data)
{
png_write_chunk(png.pal_entries * 3, "PLTE", png.pal_data, 0);
DO_FREE_AND_NULL(png.pal_data);
}
int const linesiz = height * bytesPerLine + height;
uint8_t *lines = (uint8_t *) Xcalloc(1, linesiz);
for (int i = 0; i < height; i++)
Bmemcpy(lines + i * bytesPerLine + i + 1, data + i * bytesPerLine, bytesPerLine);
png_write_chunk(linesiz, "IDAT", lines, CHUNK_COMPRESSED);
png_write_chunk(0, "IEND", NULL, 0);
Xfree(lines);
}

View file

@ -9,7 +9,6 @@ Ken Silverman's official web site: http://www.advsys.net/ken
#include "build.h"
#include "common.h"
#include "engine_priv.h"
#include "kplib.h"
#include "mdsprite.h"
#include "polymost.h"
#include "files.h"

View file

@ -1,12 +1,17 @@
#include "compat.h"
#include "build.h"
#include "baselayer.h"
#include "pngwrite.h"
#include "version.h"
#include "m_png.h"
#include "i_specialpaths.h"
#include "m_argv.h"
#include "cmdlib.h"
#include "gamecontrol.h"
#include "vfs.h"
#include "../../glbackend/glbackend.h"
EXTERN_CVAR(Float, png_gamma)
//
// screencapture
//
@ -44,14 +49,6 @@ buildvfs_FILE OutputFileCounter::opennextfile_withext(char *fn, const char *ext)
static OutputFileCounter capturecounter;
static void screencapture_end(char *fn, buildvfs_FILE * filptr)
{
buildvfs_fclose(*filptr);
OSD_Printf("Saved screenshot to %s\n", fn);
Xfree(fn);
capturecounter.count++;
}
# ifdef USE_OPENGL
# define HICOLOR (videoGetRenderMode() >= REND_POLYMOST && in3dmode())
# else
@ -63,16 +60,64 @@ void getScreen(uint8_t* imgBuf)
GLInterface.ReadPixels(xdim, ydim, imgBuf);
}
int videoCaptureScreen(const char *filename, char inverseit)
CVAR(String, screenshotname, "", CVAR_ARCHIVE) // not GLOBALCONFIG - allow setting this per game.
CVAR(String, screenshot_dir, "", CVAR_ARCHIVE) // same here.
//
// WritePNGfile
//
void WritePNGfile(FileWriter* file, const uint8_t* buffer, const PalEntry* palette,
ESSType color_type, int width, int height, int pitch, float gamma)
{
char *fn = Xstrdup(filename);
FStringf software("Demolition %s", GetVersionString());
if (!M_CreatePNG(file, buffer, palette, color_type, width, height, pitch, gamma) ||
!M_AppendPNGText(file, "Software", software) ||
!M_FinishPNG(file))
{
OSD_Printf("Failed writing screenshot\n");
}
}
int videoCaptureScreen()
{
PalEntry Palette[256];
size_t dirlen;
FString autoname = Args->CheckValue("-shotdir");
if (autoname.IsEmpty())
{
autoname = screenshot_dir;
}
dirlen = autoname.Len();
if (dirlen == 0)
{
autoname = M_GetScreenshotsPath();
dirlen = autoname.Len();
}
if (dirlen > 0)
{
if (autoname[dirlen - 1] != '/' && autoname[dirlen - 1] != '\\')
{
autoname += '/';
}
}
autoname = NicePath(autoname);
CreatePath(autoname);
if (**screenshotname) autoname << screenshotname;
else autoname << currentGame;
autoname << "_0000";
char* fn = autoname.LockBuffer();
buildvfs_FILE fp = capturecounter.opennextfile_withext(fn, "png");
autoname.UnlockBuffer();
if (fp == nullptr)
{
Xfree(fn);
return -1;
}
FileWriter writer(fp);
uint8_t * const imgBuf = (uint8_t *) Xmalloc(xdim * ydim * (HICOLOR ? 3 : 1));
@ -84,12 +129,6 @@ int videoCaptureScreen(const char *filename, char inverseit)
getScreen(imgBuf);
int const bytesPerLine = xdim * 3;
if (inverseit)
{
for (int i=0, j = ydim * bytesPerLine; i<j; i+=3)
swapchar(&imgBuf[i], &imgBuf[i+2]);
}
// flip rows
uint8_t* rowBuf = (uint8_t *) Xmalloc(bytesPerLine);
@ -104,27 +143,13 @@ int videoCaptureScreen(const char *filename, char inverseit)
}
else
#endif
{
struct {
uint8_t r, g, b;
} palette[256];
if (inverseit)
{
for (bssize_t i = 0; i < 256; ++i)
{
palette[i].r = 255 - curpalettefaded[i].r;
palette[i].g = 255 - curpalettefaded[i].g;
palette[i].b = 255 - curpalettefaded[i].b;
Palette[i].r = curpalettefaded[i].r;
Palette[i].g = curpalettefaded[i].g;
Palette[i].b = curpalettefaded[i].b;
}
}
else
{
for (bssize_t i = 0; i < 256; ++i)
Bmemcpy(&palette[i], &curpalettefaded[i], sizeof(palette[0]));
}
png_set_pal((uint8_t *)palette, 256);
for (int i = 0; i < ydim; ++i)
Bmemcpy(imgBuf + i * xdim, (uint8_t *)frameplace + ylookup[i], xdim);
@ -132,105 +157,13 @@ int videoCaptureScreen(const char *filename, char inverseit)
videoEndDrawing(); //}}}
png_set_text("Software", osd->version.buf);
png_write(fp, xdim, ydim, HICOLOR ? PNG_TRUECOLOR : PNG_INDEXED, imgBuf);
WritePNGfile(&writer, imgBuf, Palette, HICOLOR ? SS_RGB : SS_PAL, xdim, ydim, HICOLOR? xdim*3 : xdim, png_gamma);
Xfree(imgBuf);
screencapture_end(fn, &fp);
OSD_Printf("Saved screenshot to %s\n", fn);
capturecounter.count++;
return 0;
}
int videoCaptureScreenTGA(const char *filename, char inverseit)
{
int32_t i;
char head[18] = { 0,1,1,0,0,0,1,24,0,0,0,0,0/*wlo*/,0/*whi*/,0/*hlo*/,0/*hhi*/,8,0 };
//char palette[4*256];
char *fn = Xstrdup(filename);
buildvfs_FILE fil = capturecounter.opennextfile_withext(fn, "tga");
if (fil == nullptr)
{
Xfree(fn);
return -1;
}
#ifdef USE_OPENGL
if (HICOLOR)
{
head[1] = 0; // no colourmap
head[2] = 2; // uncompressed truecolour
head[3] = 0; // (low) first colourmap index
head[4] = 0; // (high) first colourmap index
head[5] = 0; // (low) number colourmap entries
head[6] = 0; // (high) number colourmap entries
head[7] = 0; // colourmap entry size
head[16] = 24; // 24 bits per pixel
}
#endif
head[12] = xdim & 0xff;
head[13] = (xdim >> 8) & 0xff;
head[14] = ydim & 0xff;
head[15] = (ydim >> 8) & 0xff;
buildvfs_fwrite(head, 18, 1, fil);
// palette first
#ifdef USE_OPENGL
if (!HICOLOR)
#endif
{
if (inverseit)
{
for (i=0; i<256; i++)
{
buildvfs_fputc(255 - curpalettefaded[i].b, fil);
buildvfs_fputc(255 - curpalettefaded[i].g, fil);
buildvfs_fputc(255 - curpalettefaded[i].r, fil);
}
}
else
{
for (i=0; i<256; i++)
{
buildvfs_fputc(curpalettefaded[i].b, fil);
buildvfs_fputc(curpalettefaded[i].g, fil);
buildvfs_fputc(curpalettefaded[i].r, fil);
}
}
}
videoBeginDrawing(); //{{{
# ifdef USE_OPENGL
if (HICOLOR)
{
// 24bit
int const size = xdim * ydim * 3;
uint8_t *inversebuf = (uint8_t *) Xmalloc(size);
getScreen(inversebuf);
for (i = 0; i < size; i += 3)
swapchar(&inversebuf[i], &inversebuf[i + 2]);
buildvfs_fwrite(inversebuf, xdim*ydim, 3, fil);
Xfree(inversebuf);
}
else
# endif
{
char * const ptr = (char *) frameplace;
for (i = ydim-1; i >= 0; i--)
buildvfs_fwrite(ptr + i * bytesperline, xdim, 1, fil);
}
videoEndDrawing(); //}}}
screencapture_end(fn, &fil);
return 0;
}
#undef HICOLOR

View file

@ -11,7 +11,6 @@
#include "polymost.h"
#include "mdsprite.h"
#include "cache1d.h"
#include "kplib.h"
#include "palette.h"
#include "../../glbackend/glbackend.h"

View file

@ -50,6 +50,7 @@
#include "cache1d.h"
#include "m_png.h"
#include "printf.h"
#include "filesystem.h"
#include "fontinternals.h"
@ -403,8 +404,7 @@ void V_InitFontColors ()
TranslationColors.Clear();
FScanner sc;
sc.Open("textcolors.txt");
//while ((lump = Wads.FindLump ("TEXTCOLO", &lastlump)) != -1)
while ((lump = fileSystem.Iterate("textcolors.txt", &lastlump)) != -1)
{
while (sc.GetString())
{

View file

@ -50,8 +50,8 @@
#include "control.h"
#include "osd.h"
#include "gamecontrol.h"
#include "version.h"
#define GAMENAME "Demolition"
#define LASTRUNVERSION "1"
#if !defined _MSC_VER && !defined __APPLE__
@ -184,7 +184,7 @@ FGameConfigFile::~FGameConfigFile ()
void FGameConfigFile::WriteCommentHeader (FileWriter *file) const
{
file->Printf ("# This file was generated by " GAMENAME " %s\n", ""/*GetVersionString()*/);
file->Printf ("# This file was generated by " GAMENAME " %s\n", GetVersionString());
}
void FGameConfigFile::DoAutoloadSetup (/*FIWadManager *iwad_man*/)

View file

@ -823,7 +823,7 @@ TArray<GrpInfo> ParseAllGrpInfos(TArray<FileEntry>& filelist)
TArray<GrpInfo> groups;
TMap<FString, uint32_t> CRCMap;
extern FString progdir;
// This opens the base resource only for reading the grpinfo from it.
// This opens the base resource only for reading the grpinfo from it which we need before setting up the game state.
std::unique_ptr<FResourceFile> engine_res;
FString baseres = progdir + "demolition.pk3";
engine_res.reset(FResourceFile::OpenResourceFile(baseres, true, true));

View file

@ -309,11 +309,11 @@ class FileWriter
protected:
bool OpenDirect(const char *filename);
FileWriter()
{
File = NULL;
}
public:
FileWriter(FILE *f = nullptr) // if passed, this writer will take over the file.
{
File = f;
}
virtual ~FileWriter()
{
if (File != NULL) fclose(File);

View file

@ -45,6 +45,7 @@
#include "basics.h"
#include "m_crc32.h"
#include "m_swap.h"
#include "c_cvars.h"
#include "m_png.h"

View file

@ -41,66 +41,23 @@ const char *GetVersionString();
/** Lots of different version numbers **/
#define VERSIONSTR "4.3pre"
#define VERSIONSTR "0.0.1"
// The version as seen in the Windows resource
#define RC_FILEVERSION 0,1,9999,0
#define RC_PRODUCTVERSION 0,1,9999,0
#define RC_FILEVERSION 0,0,1,0
#define RC_PRODUCTVERSION 0,0,1,0
#define RC_PRODUCTVERSION2 VERSIONSTR
// These are for content versioning.
#define VER_MAJOR 0
#define VER_MINOR 1
#define VER_REVISION 0
// This should always refer to the version a derived port is based on and not reflect the derived port's version number!
#define ENG_MAJOR 0
#define ENG_MINOR 1
#define ENG_REVISION 0
// Version identifier for network games.
// Bump it every time you do a release unless you're certain you
// didn't change anything that will affect sync.
#define NETGAMEVERSION 235
// Version stored in the ini's [LastRun] section.
// Bump it if you made some configuration change that you want to
// be able to migrate in FGameConfigFile::DoGlobalSetup().
#define LASTRUNVERSION "218"
// Protocol version used in demos.
// Bump it if you change existing DEM_ commands or add new ones.
// Otherwise, it should be safe to leave it alone.
#define DEMOGAMEVERSION 0x221
// Minimum demo version we can play.
// Bump it whenever you change or remove existing DEM_ commands.
#define MINDEMOVERSION 0x21F
// SAVEVER is the version of the information stored in level snapshots.
// Note that SAVEVER is not directly comparable to VERSION.
// SAVESIG should match SAVEVER.
// extension for savegames
#define SAVEGAME_EXT "des"
// MINSAVEVER is the minimum level snapshot version that can be loaded.
#define MINSAVEVER 1
// Use 4500 as the base git save version, since it's higher than the
// SVN revision ever got.
#define SAVEVER 1
// This is so that derivates can use the same savegame versions without worrying about engine compatibility
#define GAMESIG "DEMOLITION"
#define BASEWAD "demolition.pk3"
//#define OPTIONALWAD "game_support.pk3"
#define VER_MINOR 0
#define VER_REVISION 1
// More stuff that needs to be different for derivatives.
#define GAMENAME "Demolition"
#define WGAMENAME L"Demolition"
#define GAMENAMELOWERCASE "demolition"
#define FORUM_URL "http://forum.zdoom.org/"
#define BUGS_FORUM_URL "http://forum.zdoom.org/viewforum.php?f=2"
//#define BUGS_FORUM_URL "http://forum.zdoom.org/viewforum.php?f=2"
#if defined(__APPLE__) || defined(_WIN32)
#define GAME_DIR GAMENAME

View file

@ -7604,9 +7604,6 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
pData[8] = (((int32_t) getangle(-ksqrt(cameraDirection.x*cameraDirection.x+cameraDirection.y*cameraDirection.y), cameraDirection.z)*(400.f/1024.f)))-300;
}
}
//if we are benchmarking, take a screenshot at each waypoint (camera start point/locator)
benchmarkScreenshot = false;
}
if (pSprite->owner == -1)
{

View file

@ -212,14 +212,7 @@ void G_HandleSpecialKeys(void)
if (KB_UnBoundKeyPressed(sc_F12))
{
KB_ClearKeyDown(sc_F12);
videoCaptureScreen(
#ifndef EDUKE32_STANDALONE
"duke0000.tga"
#else
"capt0000.tga"
#endif
,
0);
videoCaptureScreen();
P_DoQuote(QUOTE_SCREEN_SAVED, &myplayer);
}

View file

@ -845,17 +845,7 @@ static int osdcmd_quickload(osdcmdptr_t UNUSED(parm))
static int osdcmd_screenshot(osdcmdptr_t parm)
{
// KB_ClearKeysDown();
#ifndef EDUKE32_STANDALONE
static const char *fn = "duke0000.png";
#else
static const char *fn = "capt0000.png";
#endif
if (parm->numparms == 1 && !Bstrcasecmp(parm->parms[0], "tga"))
videoCaptureScreenTGA(fn, 0);
else videoCaptureScreen(fn, 0);
videoCaptureScreen();
return OSDCMD_OK;
}

65
source/gitinfo.cpp Normal file
View file

@ -0,0 +1,65 @@
/*
** gitinfo.cpp
** Returns strings from gitinfo.h.
**
**---------------------------------------------------------------------------
** Copyright 2013 Randy Heit
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**---------------------------------------------------------------------------
**
** This file is just here so that when gitinfo.h changes, only one source
** file needs to be recompiled.
*/
#include "gitinfo.h"
#include "version.h"
const char *GetGitDescription()
{
return GIT_DESCRIPTION;
}
const char *GetGitHash()
{
return GIT_HASH;
}
const char *GetGitTime()
{
return GIT_TIME;
}
const char *GetVersionString()
{
if (GetGitDescription()[0] == '\0')
{
return VERSIONSTR;
}
else
{
return GIT_DESCRIPTION;
}
}

View file

@ -189,10 +189,7 @@ void G_HandleSpecialKeys(void)
if (KB_UnBoundKeyPressed(sc_F12))
{
KB_ClearKeyDown(sc_F12);
videoCaptureScreen(
"duke0000.tga"
,
0);
videoCaptureScreen();
P_DoQuote(QUOTE_SCREEN_SAVED, g_player[myconnectindex].ps);
}

View file

@ -688,12 +688,7 @@ static int osdcmd_quickload(osdcmdptr_t UNUSED(parm))
static int osdcmd_screenshot(osdcmdptr_t parm)
{
// KB_ClearKeysDown();
static const char *fn = "duke0000.png";
if (parm->numparms == 1 && !Bstrcasecmp(parm->parms[0], "tga"))
videoCaptureScreenTGA(fn, 0);
else videoCaptureScreen(fn, 0);
videoCaptureScreen();
return OSDCMD_OK;
}

View file

@ -1675,7 +1675,7 @@ void ScreenCaptureKeys(void)
{
inputState.ClearKeyStatus(KEYSC_F12);
PauseAction();
videoCaptureScreenTGA("swcpxxxx.tga", KB_KeyPressed(KEYSC_LSHIFT) | KB_KeyPressed(KEYSC_RSHIFT));
videoCaptureScreen();
ResumeAction();
PutStringInfo(Player + myconnectindex, "Screen Captured");
}