mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Made PCX use cv_screenshot_colorprofile.
Also, optimised gif headwrite's palette writing.
(cherry picked from commit 3cce495675)
This commit is contained in:
parent
7a14bbba82
commit
e8c37067ed
2 changed files with 22 additions and 8 deletions
|
|
@ -439,11 +439,9 @@ static void GIF_headwrite(void)
|
|||
else
|
||||
{
|
||||
const UINT8 *pal = (UINT8 *)W_CacheLumpName(GetPalette(), PU_CACHE);
|
||||
for (i = 0; i < 256; i++)
|
||||
for (i = 0; i < 256*3; i++)
|
||||
{
|
||||
WRITEUINT8(p, *pal); pal++;
|
||||
WRITEUINT8(p, *pal); pal++;
|
||||
WRITEUINT8(p, *pal); pal++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
26
src/m_misc.c
26
src/m_misc.c
|
|
@ -1368,7 +1368,7 @@ typedef struct
|
|||
* \param palette Palette of image data
|
||||
*/
|
||||
#if NUMSCREENS > 2
|
||||
static boolean WritePCXfile(const char *filename, const UINT8 *data, int width, int height, const UINT8 *palette)
|
||||
static boolean WritePCXfile(const char *filename, const UINT8 *data, int width, int height)
|
||||
{
|
||||
int i;
|
||||
size_t length;
|
||||
|
|
@ -1409,8 +1409,25 @@ static boolean WritePCXfile(const char *filename, const UINT8 *data, int width,
|
|||
|
||||
// write the palette
|
||||
*pack++ = 0x0c; // palette ID byte
|
||||
for (i = 0; i < 768; i++)
|
||||
*pack++ = *palette++;
|
||||
|
||||
// write color table
|
||||
if (cv_screenshot_colorprofile.value)
|
||||
{
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
*pack++ = pLocalPalette[i].s.red;
|
||||
*pack++ = pLocalPalette[i].s.green;
|
||||
*pack++ = pLocalPalette[i].s.blue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const UINT8 *pal = (UINT8 *)W_CacheLumpName(GetPalette(), PU_CACHE);
|
||||
for (i = 0; i < 256*3; i++)
|
||||
{
|
||||
*pack++ = *pal++;
|
||||
}
|
||||
}
|
||||
|
||||
// write output file
|
||||
length = pack - (UINT8 *)pcx;
|
||||
|
|
@ -1486,8 +1503,7 @@ void M_DoScreenShot(void)
|
|||
#ifdef USE_PNG
|
||||
ret = M_SavePNG(va(pandf,pathname,freename), linear, vid.width, vid.height, true);
|
||||
#else
|
||||
ret = WritePCXfile(va(pandf,pathname,freename), linear, vid.width, vid.height,
|
||||
W_CacheLumpName(GetPalette(), PU_CACHE));
|
||||
ret = WritePCXfile(va(pandf,pathname,freename), linear, vid.width, vid.height);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue