mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 15:01:41 +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];
|
||||
} pcx_t;
|
||||
|
||||
void WritePCXfile (char *filename, byte * data, int width, int height,
|
||||
int rowbytes, byte * palette, qboolean upload,
|
||||
qboolean flip);
|
||||
pcx_t *EncodePCX (byte * data, int width, int height,
|
||||
int rowbytes, byte * palette, qboolean flip, int *length);
|
||||
struct tex_s *LoadPCX (QFile *f, int convert); // tex is from Hunk_TempAlloc
|
||||
|
||||
#endif // __pcx_h
|
||||
|
|
|
@ -734,6 +734,8 @@ SCR_RSShot_f (void)
|
|||
int x, y;
|
||||
unsigned char *src, *dest;
|
||||
char pcxname[80];
|
||||
pcx_t *pcx;
|
||||
int pcx_len;
|
||||
unsigned char *newbuf;
|
||||
int w, h;
|
||||
int dx, dy, dex, dey, nx;
|
||||
|
@ -825,7 +827,8 @@ SCR_RSShot_f (void)
|
|||
st[sizeof (st) - 1] = 0;
|
||||
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);
|
||||
|
||||
|
|
|
@ -45,10 +45,6 @@
|
|||
#include "QF/vid.h"
|
||||
#include "QF/zone.h"
|
||||
|
||||
#include "cl_parse.h"
|
||||
#include "host.h"
|
||||
|
||||
|
||||
tex_t *
|
||||
LoadPCX (QFile *f, int convert)
|
||||
{
|
||||
|
@ -149,17 +145,17 @@ LoadPCX (QFile *f, int convert)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
WritePCXfile (char *filename, byte * data, int width, int height,
|
||||
int rowbytes, byte * palette, qboolean upload, qboolean flip)
|
||||
pcx_t *
|
||||
EncodePCX (byte * data, int width, int height,
|
||||
int rowbytes, byte * palette, qboolean flip, int *length)
|
||||
{
|
||||
int i, j, length;
|
||||
int i, j;
|
||||
pcx_t *pcx;
|
||||
byte *pack;
|
||||
|
||||
if (!(pcx = Hunk_TempAlloc (width * height * 2 + 1000))) {
|
||||
Con_Printf ("WritePCXfile: not enough memory\n");
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
pcx->manufacturer = 0x0a; // PCX id
|
||||
|
@ -205,10 +201,6 @@ WritePCXfile (char *filename, byte * data, int width, int height,
|
|||
*pack++ = *palette++;
|
||||
|
||||
// write output file
|
||||
length = pack - (byte *) pcx;
|
||||
|
||||
if (upload)
|
||||
CL_StartUpload ((void *) pcx, length);
|
||||
else
|
||||
COM_WriteFile (filename, pcx, length);
|
||||
*length = pack - (byte *) pcx;
|
||||
return pcx;
|
||||
}
|
||||
|
|
|
@ -641,6 +641,8 @@ void
|
|||
SCR_ScreenShot_f (void)
|
||||
{
|
||||
char pcxname[MAX_OSPATH];
|
||||
pcx_t *pcx;
|
||||
int pcx_len;
|
||||
|
||||
// find a file name to save it to
|
||||
if (!COM_NextFilename (pcxname, "qf", ".pcx")) {
|
||||
|
@ -652,8 +654,10 @@ SCR_ScreenShot_f (void)
|
|||
D_EnableBackBufferAccess ();
|
||||
|
||||
// save the pcx file
|
||||
WritePCXfile (pcxname, vid.buffer, vid.width, vid.height, vid.rowbytes,
|
||||
vid_basepal, false, false);
|
||||
pcx = EncodePCX (vid.buffer, vid.width, vid.height, vid.rowbytes,
|
||||
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
|
||||
D_DisableBackBufferAccess ();
|
||||
|
@ -751,6 +755,8 @@ SCR_RSShot_f (void)
|
|||
int x, y;
|
||||
unsigned char *src, *dest;
|
||||
char pcxname[80];
|
||||
pcx_t *pcx;
|
||||
int pcx_len;
|
||||
unsigned char *newbuf;
|
||||
int w, h;
|
||||
int dx, dy, dex, dey, nx;
|
||||
|
@ -831,7 +837,9 @@ SCR_RSShot_f (void)
|
|||
st[sizeof (st) - 1] = 0;
|
||||
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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue