mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-07 08:21:59 +00:00
remove pcx.c's dependence on cl_parse.h
This commit is contained in:
parent
febf62ad9d
commit
83af1368e1
4 changed files with 24 additions and 22 deletions
|
@ -47,9 +47,8 @@ typedef struct
|
||||||
char filler[58];
|
char filler[58];
|
||||||
} pcx_t;
|
} pcx_t;
|
||||||
|
|
||||||
void WritePCXfile (char *filename, byte * data, int width, int height,
|
pcx_t *EncodePCX (byte * data, int width, int height,
|
||||||
int rowbytes, byte * palette, qboolean upload,
|
int rowbytes, byte * palette, qboolean flip, int *length);
|
||||||
qboolean flip);
|
|
||||||
struct tex_s *LoadPCX (QFile *f, int convert); // tex is from Hunk_TempAlloc
|
struct tex_s *LoadPCX (QFile *f, int convert); // tex is from Hunk_TempAlloc
|
||||||
|
|
||||||
#endif // __pcx_h
|
#endif // __pcx_h
|
||||||
|
|
|
@ -734,6 +734,8 @@ SCR_RSShot_f (void)
|
||||||
int x, y;
|
int x, y;
|
||||||
unsigned char *src, *dest;
|
unsigned char *src, *dest;
|
||||||
char pcxname[80];
|
char pcxname[80];
|
||||||
|
pcx_t *pcx;
|
||||||
|
int pcx_len;
|
||||||
unsigned char *newbuf;
|
unsigned char *newbuf;
|
||||||
int w, h;
|
int w, h;
|
||||||
int dx, dy, dex, dey, nx;
|
int dx, dy, dex, dey, nx;
|
||||||
|
@ -825,7 +827,8 @@ SCR_RSShot_f (void)
|
||||||
st[sizeof (st) - 1] = 0;
|
st[sizeof (st) - 1] = 0;
|
||||||
SCR_DrawStringToSnap (st, newbuf, w - strlen (st) * 8, h - 21, w);
|
SCR_DrawStringToSnap (st, newbuf, w - strlen (st) * 8, h - 21, w);
|
||||||
|
|
||||||
WritePCXfile (pcxname, newbuf, w, h, w, vid_basepal, true, true);
|
pcx = EncodePCX (newbuf, w, h, w, vid_basepal, true, &pcx_len);
|
||||||
|
CL_StartUpload ((void *)pcx, pcx_len);
|
||||||
|
|
||||||
free (newbuf);
|
free (newbuf);
|
||||||
|
|
||||||
|
|
|
@ -45,10 +45,6 @@
|
||||||
#include "QF/vid.h"
|
#include "QF/vid.h"
|
||||||
#include "QF/zone.h"
|
#include "QF/zone.h"
|
||||||
|
|
||||||
#include "cl_parse.h"
|
|
||||||
#include "host.h"
|
|
||||||
|
|
||||||
|
|
||||||
tex_t *
|
tex_t *
|
||||||
LoadPCX (QFile *f, int convert)
|
LoadPCX (QFile *f, int convert)
|
||||||
{
|
{
|
||||||
|
@ -149,17 +145,17 @@ LoadPCX (QFile *f, int convert)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
pcx_t *
|
||||||
WritePCXfile (char *filename, byte * data, int width, int height,
|
EncodePCX (byte * data, int width, int height,
|
||||||
int rowbytes, byte * palette, qboolean upload, qboolean flip)
|
int rowbytes, byte * palette, qboolean flip, int *length)
|
||||||
{
|
{
|
||||||
int i, j, length;
|
int i, j;
|
||||||
pcx_t *pcx;
|
pcx_t *pcx;
|
||||||
byte *pack;
|
byte *pack;
|
||||||
|
|
||||||
if (!(pcx = Hunk_TempAlloc (width * height * 2 + 1000))) {
|
if (!(pcx = Hunk_TempAlloc (width * height * 2 + 1000))) {
|
||||||
Con_Printf ("WritePCXfile: not enough memory\n");
|
Con_Printf ("WritePCXfile: not enough memory\n");
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pcx->manufacturer = 0x0a; // PCX id
|
pcx->manufacturer = 0x0a; // PCX id
|
||||||
|
@ -205,10 +201,6 @@ WritePCXfile (char *filename, byte * data, int width, int height,
|
||||||
*pack++ = *palette++;
|
*pack++ = *palette++;
|
||||||
|
|
||||||
// write output file
|
// write output file
|
||||||
length = pack - (byte *) pcx;
|
*length = pack - (byte *) pcx;
|
||||||
|
return pcx;
|
||||||
if (upload)
|
|
||||||
CL_StartUpload ((void *) pcx, length);
|
|
||||||
else
|
|
||||||
COM_WriteFile (filename, pcx, length);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -641,6 +641,8 @@ void
|
||||||
SCR_ScreenShot_f (void)
|
SCR_ScreenShot_f (void)
|
||||||
{
|
{
|
||||||
char pcxname[MAX_OSPATH];
|
char pcxname[MAX_OSPATH];
|
||||||
|
pcx_t *pcx;
|
||||||
|
int pcx_len;
|
||||||
|
|
||||||
// find a file name to save it to
|
// find a file name to save it to
|
||||||
if (!COM_NextFilename (pcxname, "qf", ".pcx")) {
|
if (!COM_NextFilename (pcxname, "qf", ".pcx")) {
|
||||||
|
@ -652,8 +654,10 @@ SCR_ScreenShot_f (void)
|
||||||
D_EnableBackBufferAccess ();
|
D_EnableBackBufferAccess ();
|
||||||
|
|
||||||
// save the pcx file
|
// save the pcx file
|
||||||
WritePCXfile (pcxname, vid.buffer, vid.width, vid.height, vid.rowbytes,
|
pcx = EncodePCX (vid.buffer, vid.width, vid.height, vid.rowbytes,
|
||||||
vid_basepal, false, false);
|
vid_basepal, false, &pcx_len);
|
||||||
|
COM_WriteFile (pcxname, pcx, pcx_len);
|
||||||
|
|
||||||
|
|
||||||
// for adapters that can't stay mapped in for linear writes all the time
|
// for adapters that can't stay mapped in for linear writes all the time
|
||||||
D_DisableBackBufferAccess ();
|
D_DisableBackBufferAccess ();
|
||||||
|
@ -751,6 +755,8 @@ SCR_RSShot_f (void)
|
||||||
int x, y;
|
int x, y;
|
||||||
unsigned char *src, *dest;
|
unsigned char *src, *dest;
|
||||||
char pcxname[80];
|
char pcxname[80];
|
||||||
|
pcx_t *pcx;
|
||||||
|
int pcx_len;
|
||||||
unsigned char *newbuf;
|
unsigned char *newbuf;
|
||||||
int w, h;
|
int w, h;
|
||||||
int dx, dy, dex, dey, nx;
|
int dx, dy, dex, dey, nx;
|
||||||
|
@ -831,7 +837,9 @@ SCR_RSShot_f (void)
|
||||||
st[sizeof (st) - 1] = 0;
|
st[sizeof (st) - 1] = 0;
|
||||||
SCR_DrawStringToSnap (st, newbuf, w - strlen (st) * 8, 20, w);
|
SCR_DrawStringToSnap (st, newbuf, w - strlen (st) * 8, 20, w);
|
||||||
|
|
||||||
WritePCXfile (pcxname, newbuf, w, h, w, vid_basepal, true, false);
|
pcx = EncodePCX (newbuf, w, h, w, vid_basepal, false, &pcx_len);
|
||||||
|
CL_StartUpload ((void *)pcx, pcx_len);
|
||||||
|
|
||||||
|
|
||||||
free (newbuf);
|
free (newbuf);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue