mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-25 21:41:57 +00:00
Fix PCX loading on big-endian systems
This commit is contained in:
parent
778fa713a6
commit
7b82e44ca1
3 changed files with 36 additions and 16 deletions
14
source/pcx.c
14
source/pcx.c
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include "console.h"
|
||||
#include "pcx.h"
|
||||
#include "qendian.h"
|
||||
#include "qtypes.h"
|
||||
#include "quakefs.h"
|
||||
|
||||
|
@ -56,6 +57,15 @@ void LoadPCX (QFile *f)
|
|||
|
||||
pcx = &pcxbuf;
|
||||
|
||||
pcx->xmax = LittleShort (pcx->xmax);
|
||||
pcx->xmin = LittleShort (pcx->xmin);
|
||||
pcx->ymax = LittleShort (pcx->ymax);
|
||||
pcx->ymin = LittleShort (pcx->ymin);
|
||||
pcx->hres = LittleShort (pcx->hres);
|
||||
pcx->vres = LittleShort (pcx->vres);
|
||||
pcx->bytes_per_line = LittleShort (pcx->bytes_per_line);
|
||||
pcx->palette_type = LittleShort (pcx->palette_type);
|
||||
|
||||
if (pcx->manufacturer != 0x0a
|
||||
|| pcx->version != 5
|
||||
|| pcx->encoding != 1
|
||||
|
@ -83,9 +93,9 @@ void LoadPCX (QFile *f)
|
|||
if((dataByte & 0xC0) == 0xC0) {
|
||||
runLength = dataByte & 0x3F;
|
||||
dataByte = Qgetc (f);
|
||||
}
|
||||
else
|
||||
} else {
|
||||
runLength = 1;
|
||||
}
|
||||
|
||||
while (runLength-- > 0) {
|
||||
pix[0] = palette[dataByte * 3];
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "msg.h"
|
||||
#include "pcx.h"
|
||||
#include "sys.h"
|
||||
#include "qendian.h"
|
||||
#include "va.h"
|
||||
#include "skin.h"
|
||||
#include "cl_parse.h"
|
||||
|
@ -159,6 +160,15 @@ byte *Skin_Cache (skin_t *skin)
|
|||
pcx = (pcx_t *)raw;
|
||||
raw = &pcx->data;
|
||||
|
||||
pcx->xmax = LittleShort (pcx->xmax);
|
||||
pcx->xmin = LittleShort (pcx->xmin);
|
||||
pcx->ymax = LittleShort (pcx->ymax);
|
||||
pcx->ymin = LittleShort (pcx->ymin);
|
||||
pcx->hres = LittleShort (pcx->hres);
|
||||
pcx->vres = LittleShort (pcx->vres);
|
||||
pcx->bytes_per_line = LittleShort (pcx->bytes_per_line);
|
||||
pcx->palette_type = LittleShort (pcx->palette_type);
|
||||
|
||||
if (pcx->manufacturer != 0x0a
|
||||
|| pcx->version != 5
|
||||
|| pcx->encoding != 1
|
||||
|
|
Loading…
Reference in a new issue