- renamed FileRdr back to FileReader.
This commit is contained in:
parent
0be1ed252b
commit
b939836846
91 changed files with 479 additions and 477 deletions
|
|
@ -72,7 +72,7 @@ private:
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FTexture *AutomapTexture_TryCreate(FileRdr &data, int lumpnum)
|
||||
FTexture *AutomapTexture_TryCreate(FileReader &data, int lumpnum)
|
||||
{
|
||||
if (data.GetLength() < 320) return NULL;
|
||||
if (!Wads.CheckLumpName(lumpnum, "AUTOPAGE")) return NULL;
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ int FTextureManager::CountBuildTiles ()
|
|||
FString artpath = rffpath;
|
||||
artpath += artfile;
|
||||
|
||||
FileRdr fr;
|
||||
FileReader fr;
|
||||
|
||||
if (!fr.OpenFile(artpath))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ struct DDSFileHeader
|
|||
class FDDSTexture : public FTexture
|
||||
{
|
||||
public:
|
||||
FDDSTexture (FileRdr &lump, int lumpnum, void *surfdesc);
|
||||
FDDSTexture (FileReader &lump, int lumpnum, void *surfdesc);
|
||||
~FDDSTexture ();
|
||||
|
||||
const uint8_t *GetColumn (unsigned int column, const Span **spans_out);
|
||||
|
|
@ -181,10 +181,10 @@ protected:
|
|||
static void CalcBitShift (uint32_t mask, uint8_t *lshift, uint8_t *rshift);
|
||||
|
||||
void MakeTexture ();
|
||||
void ReadRGB (FileRdr &lump, uint8_t *tcbuf = NULL);
|
||||
void DecompressDXT1 (FileRdr &lump, uint8_t *tcbuf = NULL);
|
||||
void DecompressDXT3 (FileRdr &lump, bool premultiplied, uint8_t *tcbuf = NULL);
|
||||
void DecompressDXT5 (FileRdr &lump, bool premultiplied, uint8_t *tcbuf = NULL);
|
||||
void ReadRGB (FileReader &lump, uint8_t *tcbuf = NULL);
|
||||
void DecompressDXT1 (FileReader &lump, uint8_t *tcbuf = NULL);
|
||||
void DecompressDXT3 (FileReader &lump, bool premultiplied, uint8_t *tcbuf = NULL);
|
||||
void DecompressDXT5 (FileReader &lump, bool premultiplied, uint8_t *tcbuf = NULL);
|
||||
|
||||
int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf = NULL);
|
||||
bool UseBasePalette();
|
||||
|
|
@ -199,11 +199,11 @@ protected:
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
static bool CheckDDS (FileRdr &file)
|
||||
static bool CheckDDS (FileReader &file)
|
||||
{
|
||||
DDSFileHeader Header;
|
||||
|
||||
file.Seek(0, FileRdr::SeekSet);
|
||||
file.Seek(0, FileReader::SeekSet);
|
||||
if (file.Read (&Header, sizeof(Header)) != sizeof(Header))
|
||||
{
|
||||
return false;
|
||||
|
|
@ -222,7 +222,7 @@ static bool CheckDDS (FileRdr &file)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FTexture *DDSTexture_TryCreate (FileRdr &data, int lumpnum)
|
||||
FTexture *DDSTexture_TryCreate (FileReader &data, int lumpnum)
|
||||
{
|
||||
union
|
||||
{
|
||||
|
|
@ -232,7 +232,7 @@ FTexture *DDSTexture_TryCreate (FileRdr &data, int lumpnum)
|
|||
|
||||
if (!CheckDDS(data)) return NULL;
|
||||
|
||||
data.Seek(4, FileRdr::SeekSet);
|
||||
data.Seek(4, FileReader::SeekSet);
|
||||
data.Read (&surfdesc, sizeof(surfdesc));
|
||||
|
||||
#ifdef __BIG_ENDIAN__
|
||||
|
|
@ -286,7 +286,7 @@ FTexture *DDSTexture_TryCreate (FileRdr &data, int lumpnum)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FDDSTexture::FDDSTexture (FileRdr &lump, int lumpnum, void *vsurfdesc)
|
||||
FDDSTexture::FDDSTexture (FileReader &lump, int lumpnum, void *vsurfdesc)
|
||||
: FTexture(NULL, lumpnum), Pixels(0), Spans(0)
|
||||
{
|
||||
DDSURFACEDESC2 *surf = (DDSURFACEDESC2 *)vsurfdesc;
|
||||
|
|
@ -492,7 +492,7 @@ void FDDSTexture::MakeTexture ()
|
|||
|
||||
Pixels = new uint8_t[Width*Height];
|
||||
|
||||
lump.Seek (sizeof(DDSURFACEDESC2) + 4, FileRdr::SeekSet);
|
||||
lump.Seek (sizeof(DDSURFACEDESC2) + 4, FileReader::SeekSet);
|
||||
|
||||
if (Format >= 1 && Format <= 4) // RGB: Format is # of bytes per pixel
|
||||
{
|
||||
|
|
@ -518,7 +518,7 @@ void FDDSTexture::MakeTexture ()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void FDDSTexture::ReadRGB (FileRdr &lump, uint8_t *tcbuf)
|
||||
void FDDSTexture::ReadRGB (FileReader &lump, uint8_t *tcbuf)
|
||||
{
|
||||
uint32_t x, y;
|
||||
uint32_t amask = AMask == 0 ? 0 : 0x80000000 >> AShiftL;
|
||||
|
|
@ -587,7 +587,7 @@ void FDDSTexture::ReadRGB (FileRdr &lump, uint8_t *tcbuf)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void FDDSTexture::DecompressDXT1 (FileRdr &lump, uint8_t *tcbuf)
|
||||
void FDDSTexture::DecompressDXT1 (FileReader &lump, uint8_t *tcbuf)
|
||||
{
|
||||
const long blocklinelen = ((Width + 3) >> 2) << 3;
|
||||
uint8_t *blockbuff = new uint8_t[blocklinelen];
|
||||
|
|
@ -685,7 +685,7 @@ void FDDSTexture::DecompressDXT1 (FileRdr &lump, uint8_t *tcbuf)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void FDDSTexture::DecompressDXT3 (FileRdr &lump, bool premultiplied, uint8_t *tcbuf)
|
||||
void FDDSTexture::DecompressDXT3 (FileReader &lump, bool premultiplied, uint8_t *tcbuf)
|
||||
{
|
||||
const long blocklinelen = ((Width + 3) >> 2) << 4;
|
||||
uint8_t *blockbuff = new uint8_t[blocklinelen];
|
||||
|
|
@ -767,7 +767,7 @@ void FDDSTexture::DecompressDXT3 (FileRdr &lump, bool premultiplied, uint8_t *tc
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void FDDSTexture::DecompressDXT5 (FileRdr &lump, bool premultiplied, uint8_t *tcbuf)
|
||||
void FDDSTexture::DecompressDXT5 (FileReader &lump, bool premultiplied, uint8_t *tcbuf)
|
||||
{
|
||||
const long blocklinelen = ((Width + 3) >> 2) << 4;
|
||||
uint8_t *blockbuff = new uint8_t[blocklinelen];
|
||||
|
|
@ -885,7 +885,7 @@ int FDDSTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
|
|||
|
||||
uint8_t *TexBuffer = new uint8_t[4*Width*Height];
|
||||
|
||||
lump.Seek (sizeof(DDSURFACEDESC2) + 4, FileRdr::SeekSet);
|
||||
lump.Seek (sizeof(DDSURFACEDESC2) + 4, FileReader::SeekSet);
|
||||
|
||||
if (Format >= 1 && Format <= 4) // RGB: Format is # of bytes per pixel
|
||||
{
|
||||
|
|
|
|||
|
|
@ -68,11 +68,11 @@ protected:
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FTexture *EmptyTexture_TryCreate(FileRdr & file, int lumpnum)
|
||||
FTexture *EmptyTexture_TryCreate(FileReader & file, int lumpnum)
|
||||
{
|
||||
char check[8];
|
||||
if (file.GetLength() != 8) return NULL;
|
||||
file.Seek(0, FileRdr::SeekSet);
|
||||
file.Seek(0, FileReader::SeekSet);
|
||||
if (file.Read(check, 8) != 8) return NULL;
|
||||
if (memcmp(check, "\0\0\0\0\0\0\0\0", 8)) return NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ protected:
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FTexture *FlatTexture_TryCreate(FileRdr & file, int lumpnum)
|
||||
FTexture *FlatTexture_TryCreate(FileReader & file, int lumpnum)
|
||||
{
|
||||
return new FFlatTexture(lumpnum);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,13 +83,13 @@ protected:
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FTexture *IMGZTexture_TryCreate(FileRdr & file, int lumpnum)
|
||||
FTexture *IMGZTexture_TryCreate(FileReader & file, int lumpnum)
|
||||
{
|
||||
uint32_t magic = 0;
|
||||
uint16_t w, h;
|
||||
int16_t l, t;
|
||||
|
||||
file.Seek(0, FileRdr::SeekSet);
|
||||
file.Seek(0, FileReader::SeekSet);
|
||||
if (file.Read(&magic, 4) != 4) return NULL;
|
||||
if (magic != MAKE_ID('I','M','G','Z')) return NULL;
|
||||
w = file.ReadUInt16();
|
||||
|
|
|
|||
|
|
@ -50,11 +50,11 @@ extern "C"
|
|||
|
||||
struct FLumpSourceMgr : public jpeg_source_mgr
|
||||
{
|
||||
FileRdr *Lump;
|
||||
FileReader *Lump;
|
||||
JOCTET Buffer[4096];
|
||||
bool StartOfFile;
|
||||
|
||||
FLumpSourceMgr (FileRdr *lump, j_decompress_ptr cinfo);
|
||||
FLumpSourceMgr (FileReader *lump, j_decompress_ptr cinfo);
|
||||
static void InitSource (j_decompress_ptr cinfo);
|
||||
static boolean FillInputBuffer (j_decompress_ptr cinfo);
|
||||
static void SkipInputData (j_decompress_ptr cinfo, long num_bytes);
|
||||
|
|
@ -113,7 +113,7 @@ void FLumpSourceMgr::SkipInputData (j_decompress_ptr cinfo, long num_bytes)
|
|||
else
|
||||
{
|
||||
num_bytes -= (long)me->bytes_in_buffer;
|
||||
me->Lump->Seek (num_bytes, FileRdr::SeekCur);
|
||||
me->Lump->Seek (num_bytes, FileReader::SeekCur);
|
||||
FillInputBuffer (cinfo);
|
||||
}
|
||||
}
|
||||
|
|
@ -134,7 +134,7 @@ void FLumpSourceMgr::TermSource (j_decompress_ptr cinfo)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FLumpSourceMgr::FLumpSourceMgr (FileRdr *lump, j_decompress_ptr cinfo)
|
||||
FLumpSourceMgr::FLumpSourceMgr (FileReader *lump, j_decompress_ptr cinfo)
|
||||
: Lump (lump)
|
||||
{
|
||||
cinfo->src = this;
|
||||
|
|
@ -208,7 +208,7 @@ protected:
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FTexture *JPEGTexture_TryCreate(FileRdr & data, int lumpnum)
|
||||
FTexture *JPEGTexture_TryCreate(FileReader & data, int lumpnum)
|
||||
{
|
||||
union
|
||||
{
|
||||
|
|
@ -217,7 +217,7 @@ FTexture *JPEGTexture_TryCreate(FileRdr & data, int lumpnum)
|
|||
uint8_t b[4];
|
||||
} first4bytes;
|
||||
|
||||
data.Seek(0, FileRdr::SeekSet);
|
||||
data.Seek(0, FileReader::SeekSet);
|
||||
if (data.Read(&first4bytes, 4) < 4) return NULL;
|
||||
|
||||
if (first4bytes.b[0] != 0xFF || first4bytes.b[1] != 0xD8 || first4bytes.b[2] != 0xFF)
|
||||
|
|
@ -231,7 +231,7 @@ FTexture *JPEGTexture_TryCreate(FileRdr & data, int lumpnum)
|
|||
{
|
||||
return NULL;
|
||||
}
|
||||
data.Seek (BigShort(first4bytes.w[0]) - 2, FileRdr::SeekCur);
|
||||
data.Seek (BigShort(first4bytes.w[0]) - 2, FileReader::SeekCur);
|
||||
if (data.Read (first4bytes.b + 2, 2) != 2 || first4bytes.b[2] != 0xFF)
|
||||
{
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -81,12 +81,12 @@ protected:
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
static bool CheckIfPatch(FileRdr & file)
|
||||
static bool CheckIfPatch(FileReader & file)
|
||||
{
|
||||
if (file.GetLength() < 13) return false; // minimum length of a valid Doom patch
|
||||
|
||||
uint8_t *data = new uint8_t[file.GetLength()];
|
||||
file.Seek(0, FileRdr::SeekSet);
|
||||
file.Seek(0, FileReader::SeekSet);
|
||||
file.Read(data, file.GetLength());
|
||||
|
||||
const patch_t *foo = (const patch_t *)data;
|
||||
|
|
@ -129,12 +129,12 @@ static bool CheckIfPatch(FileRdr & file)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FTexture *PatchTexture_TryCreate(FileRdr & file, int lumpnum)
|
||||
FTexture *PatchTexture_TryCreate(FileReader & file, int lumpnum)
|
||||
{
|
||||
patch_t header;
|
||||
|
||||
if (!CheckIfPatch(file)) return NULL;
|
||||
file.Seek(0, FileRdr::SeekSet);
|
||||
file.Seek(0, FileReader::SeekSet);
|
||||
header.width = file.ReadUInt16();
|
||||
header.height = file.ReadUInt16();
|
||||
header.leftoffset = file.ReadInt16();
|
||||
|
|
|
|||
|
|
@ -99,10 +99,10 @@ protected:
|
|||
uint8_t *Pixels;
|
||||
Span DummySpans[2];
|
||||
|
||||
void ReadPCX1bit (uint8_t *dst, FileRdr & lump, PCXHeader *hdr);
|
||||
void ReadPCX4bits (uint8_t *dst, FileRdr & lump, PCXHeader *hdr);
|
||||
void ReadPCX8bits (uint8_t *dst, FileRdr & lump, PCXHeader *hdr);
|
||||
void ReadPCX24bits (uint8_t *dst, FileRdr & lump, PCXHeader *hdr, int planes);
|
||||
void ReadPCX1bit (uint8_t *dst, FileReader & lump, PCXHeader *hdr);
|
||||
void ReadPCX4bits (uint8_t *dst, FileReader & lump, PCXHeader *hdr);
|
||||
void ReadPCX8bits (uint8_t *dst, FileReader & lump, PCXHeader *hdr);
|
||||
void ReadPCX24bits (uint8_t *dst, FileReader & lump, PCXHeader *hdr, int planes);
|
||||
|
||||
virtual void MakeTexture ();
|
||||
|
||||
|
|
@ -116,11 +116,11 @@ protected:
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FTexture * PCXTexture_TryCreate(FileRdr & file, int lumpnum)
|
||||
FTexture * PCXTexture_TryCreate(FileReader & file, int lumpnum)
|
||||
{
|
||||
PCXHeader hdr;
|
||||
|
||||
file.Seek(0, FileRdr::SeekSet);
|
||||
file.Seek(0, FileReader::SeekSet);
|
||||
if (file.Read(&hdr, sizeof(hdr)) != sizeof(hdr))
|
||||
{
|
||||
return NULL;
|
||||
|
|
@ -141,7 +141,7 @@ FTexture * PCXTexture_TryCreate(FileRdr & file, int lumpnum)
|
|||
if (hdr.padding[i] != 0) return NULL;
|
||||
}
|
||||
|
||||
file.Seek(0, FileRdr::SeekSet);
|
||||
file.Seek(0, FileReader::SeekSet);
|
||||
file.Read(&hdr, sizeof(hdr));
|
||||
|
||||
return new FPCXTexture(lumpnum, hdr);
|
||||
|
|
@ -256,7 +256,7 @@ const uint8_t *FPCXTexture::GetPixels ()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void FPCXTexture::ReadPCX1bit (uint8_t *dst, FileRdr & lump, PCXHeader *hdr)
|
||||
void FPCXTexture::ReadPCX1bit (uint8_t *dst, FileReader & lump, PCXHeader *hdr)
|
||||
{
|
||||
int y, i, bytes;
|
||||
int rle_count = 0;
|
||||
|
|
@ -304,7 +304,7 @@ void FPCXTexture::ReadPCX1bit (uint8_t *dst, FileRdr & lump, PCXHeader *hdr)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void FPCXTexture::ReadPCX4bits (uint8_t *dst, FileRdr & lump, PCXHeader *hdr)
|
||||
void FPCXTexture::ReadPCX4bits (uint8_t *dst, FileReader & lump, PCXHeader *hdr)
|
||||
{
|
||||
int rle_count = 0, rle_value = 0;
|
||||
int x, y, c;
|
||||
|
|
@ -367,7 +367,7 @@ void FPCXTexture::ReadPCX4bits (uint8_t *dst, FileRdr & lump, PCXHeader *hdr)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void FPCXTexture::ReadPCX8bits (uint8_t *dst, FileRdr & lump, PCXHeader *hdr)
|
||||
void FPCXTexture::ReadPCX8bits (uint8_t *dst, FileReader & lump, PCXHeader *hdr)
|
||||
{
|
||||
int rle_count = 0, rle_value = 0;
|
||||
int y, bytes;
|
||||
|
|
@ -409,7 +409,7 @@ void FPCXTexture::ReadPCX8bits (uint8_t *dst, FileRdr & lump, PCXHeader *hdr)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void FPCXTexture::ReadPCX24bits (uint8_t *dst, FileRdr & lump, PCXHeader *hdr, int planes)
|
||||
void FPCXTexture::ReadPCX24bits (uint8_t *dst, FileReader & lump, PCXHeader *hdr, int planes)
|
||||
{
|
||||
int rle_count = 0, rle_value = 0;
|
||||
int y, c;
|
||||
|
|
@ -493,7 +493,7 @@ void FPCXTexture::MakeTexture()
|
|||
}
|
||||
else if (bitcount == 8)
|
||||
{
|
||||
lump.Seek(-769, FileRdr::SeekEnd);
|
||||
lump.Seek(-769, FileReader::SeekEnd);
|
||||
uint8_t c = lump.ReadUInt8();
|
||||
//if (c !=0x0c) memcpy(PaletteMap, GrayMap, 256); // Fallback for files without palette
|
||||
//else
|
||||
|
|
@ -504,7 +504,7 @@ void FPCXTexture::MakeTexture()
|
|||
uint8_t b = lump.ReadUInt8();
|
||||
PaletteMap[i] = ColorMatcher.Pick(r,g,b);
|
||||
}
|
||||
lump.Seek(sizeof(header), FileRdr::SeekSet);
|
||||
lump.Seek(sizeof(header), FileReader::SeekSet);
|
||||
ReadPCX8bits (Pixels, lump, &header);
|
||||
}
|
||||
if (Width == Height)
|
||||
|
|
@ -582,7 +582,7 @@ int FPCXTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
|
|||
}
|
||||
else if (bitcount == 8)
|
||||
{
|
||||
lump.Seek(-769, FileRdr::SeekEnd);
|
||||
lump.Seek(-769, FileReader::SeekEnd);
|
||||
uint8_t c = lump.ReadUInt8();
|
||||
c=0x0c; // Apparently there's many non-compliant PCXs out there...
|
||||
if (c !=0x0c)
|
||||
|
|
@ -596,7 +596,7 @@ int FPCXTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
|
|||
uint8_t b = lump.ReadUInt8();
|
||||
pe[i] = PalEntry(255, r,g,b);
|
||||
}
|
||||
lump.Seek(sizeof(header), FileRdr::SeekSet);
|
||||
lump.Seek(sizeof(header), FileReader::SeekSet);
|
||||
ReadPCX8bits (Pixels, lump, &header);
|
||||
}
|
||||
bmp->CopyPixelData(x, y, Pixels, Width, Height, 1, Width, rotate, pe, inf);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@
|
|||
class FPNGTexture : public FTexture
|
||||
{
|
||||
public:
|
||||
FPNGTexture (FileRdr &lump, int lumpnum, const FString &filename, int width, int height, uint8_t bitdepth, uint8_t colortype, uint8_t interlace);
|
||||
FPNGTexture (FileReader &lump, int lumpnum, const FString &filename, int width, int height, uint8_t bitdepth, uint8_t colortype, uint8_t interlace);
|
||||
~FPNGTexture ();
|
||||
|
||||
const uint8_t *GetColumn (unsigned int column, const Span **spans_out);
|
||||
|
|
@ -66,7 +66,7 @@ protected:
|
|||
FString SourceFile;
|
||||
uint8_t *Pixels;
|
||||
Span **Spans;
|
||||
FileRdr fr;
|
||||
FileReader fr;
|
||||
|
||||
uint8_t BitDepth;
|
||||
uint8_t ColorType;
|
||||
|
|
@ -90,7 +90,7 @@ protected:
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FTexture *PNGTexture_TryCreate(FileRdr & data, int lumpnum)
|
||||
FTexture *PNGTexture_TryCreate(FileReader & data, int lumpnum)
|
||||
{
|
||||
union
|
||||
{
|
||||
|
|
@ -104,7 +104,7 @@ FTexture *PNGTexture_TryCreate(FileRdr & data, int lumpnum)
|
|||
// first 4 bytes match, but later bytes don't, we assume it's
|
||||
// a corrupt PNG.)
|
||||
|
||||
data.Seek(0, FileRdr::SeekSet);
|
||||
data.Seek(0, FileReader::SeekSet);
|
||||
if (data.Read (first4bytes.b, 4) != 4) return NULL;
|
||||
if (first4bytes.dw != MAKE_ID(137,'P','N','G')) return NULL;
|
||||
if (data.Read (first4bytes.b, 4) != 4) return NULL;
|
||||
|
|
@ -138,7 +138,7 @@ FTexture *PNGTexture_TryCreate(FileRdr & data, int lumpnum)
|
|||
}
|
||||
|
||||
// Just for completeness, make sure the PNG has something more than an IHDR.
|
||||
data.Seek (4, FileRdr::SeekSet);
|
||||
data.Seek (4, FileReader::SeekSet);
|
||||
data.Read (first4bytes.b, 4);
|
||||
if (first4bytes.dw == 0)
|
||||
{
|
||||
|
|
@ -198,7 +198,7 @@ FTexture *PNGTexture_CreateFromFile(PNGHandle *png, const FString &filename)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FPNGTexture::FPNGTexture (FileRdr &lump, int lumpnum, const FString &filename, int width, int height,
|
||||
FPNGTexture::FPNGTexture (FileReader &lump, int lumpnum, const FString &filename, int width, int height,
|
||||
uint8_t depth, uint8_t colortype, uint8_t interlace)
|
||||
: FTexture(NULL, lumpnum), SourceFile(filename), Pixels(0), Spans(0),
|
||||
BitDepth(depth), ColorType(colortype), Interlace(interlace), HaveTrans(false),
|
||||
|
|
@ -225,7 +225,7 @@ FPNGTexture::FPNGTexture (FileRdr &lump, int lumpnum, const FString &filename, i
|
|||
memset(trans, 255, 256);
|
||||
|
||||
// Parse pre-IDAT chunks. I skip the CRCs. Is that bad?
|
||||
lump.Seek(33, FileRdr::SeekSet);
|
||||
lump.Seek(33, FileReader::SeekSet);
|
||||
|
||||
lump.Read(&len, 4);
|
||||
lump.Read(&id, 4);
|
||||
|
|
@ -235,7 +235,7 @@ FPNGTexture::FPNGTexture (FileRdr &lump, int lumpnum, const FString &filename, i
|
|||
switch (id)
|
||||
{
|
||||
default:
|
||||
lump.Seek (len, FileRdr::SeekCur);
|
||||
lump.Seek (len, FileReader::SeekCur);
|
||||
break;
|
||||
|
||||
case MAKE_ID('g','r','A','b'):
|
||||
|
|
@ -268,7 +268,7 @@ FPNGTexture::FPNGTexture (FileRdr &lump, int lumpnum, const FString &filename, i
|
|||
lump.Read (p.pngpal, PaletteSize * 3);
|
||||
if (PaletteSize * 3 != (int)len)
|
||||
{
|
||||
lump.Seek (len - PaletteSize * 3, FileRdr::SeekCur);
|
||||
lump.Seek (len - PaletteSize * 3, FileReader::SeekCur);
|
||||
}
|
||||
for (i = PaletteSize - 1; i >= 0; --i)
|
||||
{
|
||||
|
|
@ -290,7 +290,7 @@ FPNGTexture::FPNGTexture (FileRdr &lump, int lumpnum, const FString &filename, i
|
|||
bMasked = true;
|
||||
break;
|
||||
}
|
||||
lump.Seek(4, FileRdr::SeekCur); // Skip CRC
|
||||
lump.Seek(4, FileReader::SeekCur); // Skip CRC
|
||||
lump.Read(&len, 4);
|
||||
id = MAKE_ID('I','E','N','D');
|
||||
lump.Read(&id, 4);
|
||||
|
|
@ -459,8 +459,8 @@ const uint8_t *FPNGTexture::GetPixels ()
|
|||
|
||||
void FPNGTexture::MakeTexture ()
|
||||
{
|
||||
FileRdr *lump;
|
||||
FileRdr lfr;
|
||||
FileReader *lump;
|
||||
FileReader lfr;
|
||||
|
||||
if (SourceLump >= 0)
|
||||
{
|
||||
|
|
@ -480,7 +480,7 @@ void FPNGTexture::MakeTexture ()
|
|||
else
|
||||
{
|
||||
uint32_t len, id;
|
||||
lump->Seek (StartOfIDAT, FileRdr::SeekSet);
|
||||
lump->Seek (StartOfIDAT, FileReader::SeekSet);
|
||||
lump->Read(&len, 4);
|
||||
lump->Read(&id, 4);
|
||||
|
||||
|
|
@ -623,8 +623,8 @@ int FPNGTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
|
|||
int pixwidth = Width * bpp[ColorType];
|
||||
int transpal = false;
|
||||
|
||||
FileRdr *lump;
|
||||
FileRdr lfr;
|
||||
FileReader *lump;
|
||||
FileReader lfr;
|
||||
|
||||
if (SourceLump >= 0)
|
||||
{
|
||||
|
|
@ -636,7 +636,7 @@ int FPNGTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
|
|||
lump = &fr;
|
||||
}
|
||||
|
||||
lump->Seek(33, FileRdr::SeekSet);
|
||||
lump->Seek(33, FileReader::SeekSet);
|
||||
for(int i = 0; i < 256; i++) // default to a gray map
|
||||
pe[i] = PalEntry(255,i,i,i);
|
||||
|
||||
|
|
@ -648,7 +648,7 @@ int FPNGTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
|
|||
switch (id)
|
||||
{
|
||||
default:
|
||||
lump->Seek (len, FileRdr::SeekCur);
|
||||
lump->Seek (len, FileReader::SeekCur);
|
||||
break;
|
||||
|
||||
case MAKE_ID('P','L','T','E'):
|
||||
|
|
@ -672,11 +672,11 @@ int FPNGTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
|
|||
}
|
||||
else
|
||||
{
|
||||
lump->Seek(len, FileRdr::SeekCur);
|
||||
lump->Seek(len, FileReader::SeekCur);
|
||||
}
|
||||
break;
|
||||
}
|
||||
lump->Seek(4, FileRdr::SeekCur); // Skip CRC
|
||||
lump->Seek(4, FileReader::SeekCur); // Skip CRC
|
||||
lump->Read(&len, 4);
|
||||
id = MAKE_ID('I','E','N','D');
|
||||
lump->Read(&id, 4);
|
||||
|
|
@ -690,7 +690,7 @@ int FPNGTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
|
|||
|
||||
uint8_t * Pixels = new uint8_t[pixwidth * Height];
|
||||
|
||||
lump->Seek (StartOfIDAT, FileRdr::SeekSet);
|
||||
lump->Seek (StartOfIDAT, FileReader::SeekSet);
|
||||
lump->Read(&len, 4);
|
||||
lump->Read(&id, 4);
|
||||
M_ReadIDAT (*lump, Pixels, Width, Height, pixwidth, BitDepth, ColorType, Interlace, BigLong((unsigned int)len));
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ protected:
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
static bool CheckIfRaw(FileRdr & data)
|
||||
static bool CheckIfRaw(FileReader & data)
|
||||
{
|
||||
if (data.GetLength() != 64000) return false;
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ static bool CheckIfRaw(FileRdr & data)
|
|||
int width;
|
||||
|
||||
foo = (patch_t *)M_Malloc (data.GetLength());
|
||||
data.Seek (0, FileRdr::SeekSet);
|
||||
data.Seek (0, FileReader::SeekSet);
|
||||
data.Read (foo, data.GetLength());
|
||||
|
||||
height = LittleShort(foo->height);
|
||||
|
|
@ -148,7 +148,7 @@ static bool CheckIfRaw(FileRdr & data)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FTexture *RawPageTexture_TryCreate(FileRdr & file, int lumpnum)
|
||||
FTexture *RawPageTexture_TryCreate(FileReader & file, int lumpnum)
|
||||
{
|
||||
if (!CheckIfRaw(file)) return NULL;
|
||||
return new FRawPageTexture(lumpnum);
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
#include "textures/textures.h"
|
||||
#include "v_palette.h"
|
||||
|
||||
typedef FTexture * (*CreateFunc)(FileRdr & file, int lumpnum);
|
||||
typedef FTexture * (*CreateFunc)(FileReader & file, int lumpnum);
|
||||
|
||||
struct TexCreateInfo
|
||||
{
|
||||
|
|
@ -65,17 +65,17 @@ void FTexture::InitGrayMap()
|
|||
}
|
||||
}
|
||||
|
||||
FTexture *IMGZTexture_TryCreate(FileRdr &, int lumpnum);
|
||||
FTexture *PNGTexture_TryCreate(FileRdr &, int lumpnum);
|
||||
FTexture *JPEGTexture_TryCreate(FileRdr &, int lumpnum);
|
||||
FTexture *DDSTexture_TryCreate(FileRdr &, int lumpnum);
|
||||
FTexture *PCXTexture_TryCreate(FileRdr &, int lumpnum);
|
||||
FTexture *TGATexture_TryCreate(FileRdr &, int lumpnum);
|
||||
FTexture *RawPageTexture_TryCreate(FileRdr &, int lumpnum);
|
||||
FTexture *FlatTexture_TryCreate(FileRdr &, int lumpnum);
|
||||
FTexture *PatchTexture_TryCreate(FileRdr &, int lumpnum);
|
||||
FTexture *EmptyTexture_TryCreate(FileRdr &, int lumpnum);
|
||||
FTexture *AutomapTexture_TryCreate(FileRdr &, int lumpnum);
|
||||
FTexture *IMGZTexture_TryCreate(FileReader &, int lumpnum);
|
||||
FTexture *PNGTexture_TryCreate(FileReader &, int lumpnum);
|
||||
FTexture *JPEGTexture_TryCreate(FileReader &, int lumpnum);
|
||||
FTexture *DDSTexture_TryCreate(FileReader &, int lumpnum);
|
||||
FTexture *PCXTexture_TryCreate(FileReader &, int lumpnum);
|
||||
FTexture *TGATexture_TryCreate(FileReader &, int lumpnum);
|
||||
FTexture *RawPageTexture_TryCreate(FileReader &, int lumpnum);
|
||||
FTexture *FlatTexture_TryCreate(FileReader &, int lumpnum);
|
||||
FTexture *PatchTexture_TryCreate(FileReader &, int lumpnum);
|
||||
FTexture *EmptyTexture_TryCreate(FileReader &, int lumpnum);
|
||||
FTexture *AutomapTexture_TryCreate(FileReader &, int lumpnum);
|
||||
|
||||
|
||||
// Examines the lump contents to decide what type of texture to create,
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ protected:
|
|||
uint8_t *Pixels;
|
||||
Span **Spans;
|
||||
|
||||
void ReadCompressed(FileRdr &lump, uint8_t * buffer, int bytesperpixel);
|
||||
void ReadCompressed(FileReader &lump, uint8_t * buffer, int bytesperpixel);
|
||||
|
||||
virtual void MakeTexture ();
|
||||
|
||||
|
|
@ -107,13 +107,13 @@ protected:
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FTexture *TGATexture_TryCreate(FileRdr & file, int lumpnum)
|
||||
FTexture *TGATexture_TryCreate(FileReader & file, int lumpnum)
|
||||
{
|
||||
TGAHeader hdr;
|
||||
|
||||
if (file.GetLength() < (long)sizeof(hdr)) return NULL;
|
||||
|
||||
file.Seek(0, FileRdr::SeekSet);
|
||||
file.Seek(0, FileReader::SeekSet);
|
||||
file.Read(&hdr, sizeof(hdr));
|
||||
hdr.width = LittleShort(hdr.width);
|
||||
hdr.height = LittleShort(hdr.height);
|
||||
|
|
@ -127,7 +127,7 @@ FTexture *TGATexture_TryCreate(FileRdr & file, int lumpnum)
|
|||
if (hdr.img_type >=4 && hdr.img_type <= 8) return NULL;
|
||||
if ((hdr.img_desc & 16) != 0) return NULL;
|
||||
|
||||
file.Seek(0, FileRdr::SeekSet);
|
||||
file.Seek(0, FileReader::SeekSet);
|
||||
file.Read(&hdr, sizeof(hdr));
|
||||
hdr.width = LittleShort(hdr.width);
|
||||
hdr.height = LittleShort(hdr.height);
|
||||
|
|
@ -250,7 +250,7 @@ const uint8_t *FTGATexture::GetPixels ()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void FTGATexture::ReadCompressed(FileRdr &lump, uint8_t * buffer, int bytesperpixel)
|
||||
void FTGATexture::ReadCompressed(FileReader &lump, uint8_t * buffer, int bytesperpixel)
|
||||
{
|
||||
uint8_t data[4];
|
||||
int Size = Width * Height;
|
||||
|
|
@ -297,7 +297,7 @@ void FTGATexture::MakeTexture ()
|
|||
|
||||
Pixels = new uint8_t[Width*Height];
|
||||
lump.Read(&hdr, sizeof(hdr));
|
||||
lump.Seek(hdr.id_len, FileRdr::SeekCur);
|
||||
lump.Seek(hdr.id_len, FileReader::SeekCur);
|
||||
|
||||
hdr.width = LittleShort(hdr.width);
|
||||
hdr.height = LittleShort(hdr.height);
|
||||
|
|
@ -503,7 +503,7 @@ int FTGATexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
|
|||
int transval = 0;
|
||||
|
||||
lump.Read(&hdr, sizeof(hdr));
|
||||
lump.Seek(hdr.id_len, FileRdr::SeekCur);
|
||||
lump.Seek(hdr.id_len, FileReader::SeekCur);
|
||||
|
||||
hdr.width = LittleShort(hdr.width);
|
||||
hdr.height = LittleShort(hdr.height);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue