Skip to content

Commit

Permalink
GLideNHQ: remove unsupported dds code
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosalie241 authored and gonetz committed Sep 7, 2021
1 parent 32312e0 commit e2ae3a3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 133 deletions.
19 changes: 4 additions & 15 deletions src/GLideNHQ/TxHiResLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,12 @@ uint32_t TxHiResLoader::checkFileName(char* ident, char* filename,
bool hasWildcard = false;
const char supported_ends[][20] = {
"all.png",
"all.dds",
#ifdef OS_WINDOWS
"allcibyrgba.png",
"allcibyrgba.dds",
"cibyrgba.png",
"cibyrgba.dds",
#else
"allciByRGBA.png",
"allciByRGBA.dds",
"ciByRGBA.png",
"ciByRGBA.dds",
#endif
"rgb.png",
"rgb.bmp",
Expand All @@ -65,13 +60,12 @@ uint32_t TxHiResLoader::checkFileName(char* ident, char* filename,
pfilename = filename + strlen(filename) - 4;

if (strcmp(pfilename, ".png") &&
strcmp(pfilename, ".bmp") &&
strcmp(pfilename, ".dds")) {
strcmp(pfilename, ".bmp")) {
#if !DEBUG
INFO(80, wst("-----\n"));
INFO(80, wst("file: %s\n"), filename);
#endif
INFO(80, wst("Error: not png or bmp or dds!\n"));
INFO(80, wst("Error: not png or bmp!\n"));
return 0;
}

Expand Down Expand Up @@ -308,21 +302,16 @@ uint8_t* TxHiResLoader::loadFileInfoTex(char* fname,
}
else
/*
* read in _all.png, _all.dds, _allciByRGBA.png, _allciByRGBA.dds
* _ciByRGBA.png, _ciByRGBA.dds, _ci.bmp
* read in _all.png, _allciByRGBA.png,
* _ciByRGBA.png, _ci.bmp
*/
if (strstr(fname, "_all.png") ||
strstr(fname, "_all.dds") ||
#ifdef OS_WINDOWS
strstr(fname, "_allcibyrgba.png") ||
strstr(fname, "_allcibyrgba.dds") ||
strstr(fname, "_cibyrgba.png") ||
strstr(fname, "_cibyrgba.dds") ||
#else
strstr(fname, "_allciByRGBA.png") ||
strstr(fname, "_allciByRGBA.dds") ||
strstr(fname, "_ciByRGBA.png") ||
strstr(fname, "_ciByRGBA.dds") ||
#endif
strstr(fname, "_ci.bmp")) {

Expand Down
74 changes: 0 additions & 74 deletions src/GLideNHQ/TxImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,77 +561,3 @@ TxImage::readBMP(FILE* fp, int* width, int* height, ColorFormat *format)

return image;
}

boolean
TxImage::getDDSInfo(FILE *fp, DDSFILEHEADER *dds_fhdr)
{
/*
* read in DDSFILEHEADER
*/

/* is this a DDS file? */
if (fread(&dds_fhdr->dwMagic, 4, 1, fp) != 1)
return 0;

if (memcmp(&dds_fhdr->dwMagic, "DDS ", 4) != 0)
return 0;

if (fread(&dds_fhdr->dwSize, 4, 1, fp) != 1)
return 0;

/* get file flags */
if (fread(&dds_fhdr->dwFlags, 4, 1, fp) != 1)
return 0;

/* height of dds in pixels */
if (fread(&dds_fhdr->dwHeight, 4, 1, fp) != 1)
return 0;

/* width of dds in pixels */
if (fread(&dds_fhdr->dwWidth, 4, 1, fp) != 1)
return 0;

if (fread(&dds_fhdr->dwLinearSize, 4, 1, fp) != 1)
return 0;

if (fread(&dds_fhdr->dwDepth, 4, 1, fp) != 1)
return 0;

if (fread(&dds_fhdr->dwMipMapCount, 4, 1, fp) != 1)
return 0;

if (fread(&dds_fhdr->dwReserved1, 4 * 11, 1, fp) != 1)
return 0;

if (fread(&dds_fhdr->ddpf.dwSize, 4, 1, fp) != 1)
return 0;

if (fread(&dds_fhdr->ddpf.dwFlags, 4, 1, fp) != 1)
return 0;

if (fread(&dds_fhdr->ddpf.dwFourCC, 4, 1, fp) != 1)
return 0;

if (fread(&dds_fhdr->ddpf.dwRGBBitCount, 4, 1, fp) != 1)
return 0;

if (fread(&dds_fhdr->ddpf.dwRBitMask, 4, 1, fp) != 1)
return 0;

if (fread(&dds_fhdr->ddpf.dwGBitMask, 4, 1, fp) != 1)
return 0;

if (fread(&dds_fhdr->ddpf.dwBBitMask, 4, 1, fp) != 1)
return 0;

if (fread(&dds_fhdr->ddpf.dwRGBAlphaBitMask, 4, 1, fp) != 1)
return 0;

if (fread(&dds_fhdr->dwCaps1, 4, 1, fp) != 1)
return 0;

if (fread(&dds_fhdr->dwCaps2, 4, 1, fp) != 1)
return 0;

return 1;
}
44 changes: 0 additions & 44 deletions src/GLideNHQ/TxImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,55 +55,11 @@ typedef struct tagBITMAPFILEHEADER BITMAPFILEHEADER;
typedef struct tagBITMAPINFOHEADER BITMAPINFOHEADER;
#endif

#define DDSD_CAPS 0x00000001
#define DDSD_HEIGHT 0x00000002
#define DDSD_WIDTH 0x00000004
#define DDSD_PITCH 0x00000008
#define DDSD_PIXELFORMAT 0x00001000
#define DDSD_MIPMAPCOUNT 0x00020000
#define DDSD_LINEARSIZE 0x00080000
#define DDSD_DEPTH 0x00800000

#define DDPF_ALPHAPIXELS 0x00000001
#define DDPF_FOURCC 0x00000004
#define DDPF_RGB 0x00000040

#define DDSCAPS_COMPLEX 0x00000008
#define DDSCAPS_TEXTURE 0x00001000
#define DDSCAPS_MIPMAP 0x00400000

typedef struct tagDDSPIXELFORMAT {
unsigned long dwSize;
unsigned long dwFlags;
unsigned long dwFourCC;
unsigned long dwRGBBitCount;
unsigned long dwRBitMask;
unsigned long dwGBitMask;
unsigned long dwBBitMask;
unsigned long dwRGBAlphaBitMask;
} DDSPIXELFORMAT;

typedef struct tagDDSFILEHEADER {
unsigned long dwMagic;
unsigned long dwSize;
unsigned long dwFlags;
unsigned long dwHeight;
unsigned long dwWidth;
unsigned long dwLinearSize;
unsigned long dwDepth;
unsigned long dwMipMapCount;
unsigned long dwReserved1[11];
DDSPIXELFORMAT ddpf;
unsigned long dwCaps1;
unsigned long dwCaps2;
} DDSFILEHEADER;

class TxImage
{
private:
boolean getPNGInfo(FILE *fp, png_structp *png_ptr, png_infop *info_ptr);
boolean getBMPInfo(FILE *fp, BITMAPFILEHEADER *bmp_fhdr, BITMAPINFOHEADER *bmp_ihdr);
boolean getDDSInfo(FILE *fp, DDSFILEHEADER *dds_fhdr);
public:
TxImage() {}
~TxImage() {}
Expand Down

0 comments on commit e2ae3a3

Please sign in to comment.