Fixes from toaster, plus some other stuff

This commit is contained in:
wolfy852 2017-10-07 14:52:27 -05:00
parent 69d0e84b00
commit a3cfa8dd5c
2 changed files with 13 additions and 7 deletions

View File

@ -553,7 +553,7 @@ UINT16 W_InitFile(const char *filename)
switch(eCompression) switch(eCompression)
{ {
case 0: case 0:
lump_p->compression = CM_NONE; lump_p->compression = CM_NOCOMPRESSION;
break; break;
case 8: case 8:
lump_p->compression = CM_DEFLATE; lump_p->compression = CM_DEFLATE;
@ -584,7 +584,7 @@ UINT16 W_InitFile(const char *filename)
lumpinfo[numlumps].position = 0; lumpinfo[numlumps].position = 0;
lumpinfo[numlumps].size = 0; lumpinfo[numlumps].size = 0;
lumpinfo[numlumps].disksize = 0; lumpinfo[numlumps].disksize = 0;
lumpinfo[numlumps].compression = CM_NONE; lumpinfo[numlumps].compression = CM_NOCOMPRESSION;
numlumps++;*/ numlumps++;*/
break; break;
} }
@ -670,7 +670,7 @@ UINT16 W_InitFile(const char *filename)
else else
{ {
lump_p->size -= 4; lump_p->size -= 4;
lump_p->compression = CM_NONE; lump_p->compression = CM_NOCOMPRESSION;
} }
lump_p->position += 4; lump_p->position += 4;
@ -678,7 +678,7 @@ UINT16 W_InitFile(const char *filename)
} }
else else
{ {
lump_p->compression = CM_NONE; lump_p->compression = CM_NOCOMPRESSION;
} }
memset(lump_p->name, 0x00, 9); memset(lump_p->name, 0x00, 9);
strncpy(lump_p->name, fileinfo->name, 8); strncpy(lump_p->name, fileinfo->name, 8);
@ -1092,7 +1092,7 @@ size_t W_ReadLumpHeaderPwad(UINT16 wad, UINT16 lump, void *dest, size_t size, si
// But let's not copy it yet. We support different compression formats on lumps, so we need to take that into account. // But let's not copy it yet. We support different compression formats on lumps, so we need to take that into account.
switch(wadfiles[wad]->lumpinfo[lump].compression) switch(wadfiles[wad]->lumpinfo[lump].compression)
{ {
case CM_NONE: // If it's uncompressed, we directly write the data into our destination, and return the bytes read. case CM_NOCOMPRESSION: // If it's uncompressed, we directly write the data into our destination, and return the bytes read.
return fread(dest, 1, size, handle); return fread(dest, 1, size, handle);
case CM_LZF: // Is it LZF compressed? Used by ZWADs. case CM_LZF: // Is it LZF compressed? Used by ZWADs.
{ {

View File

@ -43,7 +43,13 @@ typedef struct
} ATTRPACK filelump_t; } ATTRPACK filelump_t;
// Available compression methods for lumps. // Available compression methods for lumps.
enum compmethod{CM_NONE, CM_DEFLATE, CM_LZF, CM_UNSUPPORTED}; typedef enum
{
CM_NOCOMPRESSION,
CM_DEFLATE,
CM_LZF,
CM_UNSUPPORTED
} compmethod;
// a memory entry of the wad directory // a memory entry of the wad directory
typedef struct typedef struct
@ -54,7 +60,7 @@ typedef struct
char *name2; // Used by PK3s. Dynamically allocated name. char *name2; // Used by PK3s. Dynamically allocated name.
size_t size; // real (uncompressed) size size_t size; // real (uncompressed) size
INT32 compressed; // i INT32 compressed; // i
enum compmethod compression; // lump compression method compmethod compression; // lump compression method
} lumpinfo_t; } lumpinfo_t;
// ========================================================================= // =========================================================================