This commit is contained in:
Rachael Alexanderson 2017-03-08 21:25:24 -05:00
commit cc9a2e5121
283 changed files with 3308 additions and 2963 deletions

View file

@ -53,19 +53,19 @@
struct TGAHeader
{
BYTE id_len;
BYTE has_cm;
BYTE img_type;
SWORD cm_first;
SWORD cm_length;
BYTE cm_size;
uint8_t id_len;
uint8_t has_cm;
uint8_t img_type;
int16_t cm_first;
int16_t cm_length;
uint8_t cm_size;
SWORD x_origin;
SWORD y_origin;
SWORD width;
SWORD height;
BYTE bpp;
BYTE img_desc;
int16_t x_origin;
int16_t y_origin;
int16_t width;
int16_t height;
uint8_t bpp;
uint8_t img_desc;
};
#pragma pack()
@ -82,8 +82,8 @@ public:
FTGATexture (int lumpnum, TGAHeader *);
~FTGATexture ();
const BYTE *GetColumn (unsigned int column, const Span **spans_out);
const BYTE *GetPixels ();
const uint8_t *GetColumn (unsigned int column, const Span **spans_out);
const uint8_t *GetPixels ();
void Unload ();
FTextureFormat GetFormat ();
@ -91,10 +91,10 @@ public:
bool UseBasePalette();
protected:
BYTE *Pixels;
uint8_t *Pixels;
Span **Spans;
void ReadCompressed(FileReader &lump, BYTE * buffer, int bytesperpixel);
void ReadCompressed(FileReader &lump, uint8_t * buffer, int bytesperpixel);
virtual void MakeTexture ();
@ -201,7 +201,7 @@ FTextureFormat FTGATexture::GetFormat()
//
//==========================================================================
const BYTE *FTGATexture::GetColumn (unsigned int column, const Span **spans_out)
const uint8_t *FTGATexture::GetColumn (unsigned int column, const Span **spans_out)
{
if (Pixels == NULL)
{
@ -235,7 +235,7 @@ const BYTE *FTGATexture::GetColumn (unsigned int column, const Span **spans_out)
//
//==========================================================================
const BYTE *FTGATexture::GetPixels ()
const uint8_t *FTGATexture::GetPixels ()
{
if (Pixels == NULL)
{
@ -250,10 +250,10 @@ const BYTE *FTGATexture::GetPixels ()
//
//==========================================================================
void FTGATexture::ReadCompressed(FileReader &lump, BYTE * buffer, int bytesperpixel)
void FTGATexture::ReadCompressed(FileReader &lump, uint8_t * buffer, int bytesperpixel)
{
BYTE b;
BYTE data[4];
uint8_t b;
uint8_t data[4];
int Size = Width * Height;
while (Size > 0)
@ -289,14 +289,14 @@ void FTGATexture::ReadCompressed(FileReader &lump, BYTE * buffer, int bytesperpi
void FTGATexture::MakeTexture ()
{
BYTE PaletteMap[256];
uint8_t PaletteMap[256];
FWadLump lump = Wads.OpenLumpNum (SourceLump);
TGAHeader hdr;
WORD w;
BYTE r,g,b,a;
BYTE * buffer;
uint16_t w;
uint8_t r,g,b,a;
uint8_t * buffer;
Pixels = new BYTE[Width*Height];
Pixels = new uint8_t[Width*Height];
lump.Read(&hdr, sizeof(hdr));
lump.Seek(hdr.id_len, SEEK_CUR);
@ -340,7 +340,7 @@ void FTGATexture::MakeTexture ()
}
int Size = Width * Height * (hdr.bpp>>3);
buffer = new BYTE[Size];
buffer = new uint8_t[Size];
if (hdr.img_type < 4) // uncompressed
{
@ -351,7 +351,7 @@ void FTGATexture::MakeTexture ()
ReadCompressed(lump, buffer, hdr.bpp>>3);
}
BYTE * ptr = buffer;
uint8_t * ptr = buffer;
int step_x = (hdr.bpp>>3);
int Pitch = Width * step_x;
@ -373,7 +373,7 @@ void FTGATexture::MakeTexture ()
case 1: // paletted
for(int y=0;y<Height;y++)
{
BYTE * p = ptr + y * Pitch;
uint8_t * p = ptr + y * Pitch;
for(int x=0;x<Width;x++)
{
Pixels[x*Height+y] = PaletteMap[*p];
@ -390,7 +390,7 @@ void FTGATexture::MakeTexture ()
step_x>>=1;
for(int y=0;y<Height;y++)
{
WORD * p = (WORD*)(ptr + y * Pitch);
uint16_t * p = (uint16_t*)(ptr + y * Pitch);
for(int x=0;x<Width;x++)
{
int v = LittleLong(*p);
@ -403,7 +403,7 @@ void FTGATexture::MakeTexture ()
case 24:
for(int y=0;y<Height;y++)
{
BYTE * p = ptr + y * Pitch;
uint8_t * p = ptr + y * Pitch;
for(int x=0;x<Width;x++)
{
Pixels[x*Height+y] = RGB256k.RGB[p[2]>>2][p[1]>>2][p[0]>>2];
@ -417,7 +417,7 @@ void FTGATexture::MakeTexture ()
{
for(int y=0;y<Height;y++)
{
BYTE * p = ptr + y * Pitch;
uint8_t * p = ptr + y * Pitch;
for(int x=0;x<Width;x++)
{
Pixels[x*Height+y] = RGB256k.RGB[p[2]>>2][p[1]>>2][p[0]>>2];
@ -429,7 +429,7 @@ void FTGATexture::MakeTexture ()
{
for(int y=0;y<Height;y++)
{
BYTE * p = ptr + y * Pitch;
uint8_t * p = ptr + y * Pitch;
for(int x=0;x<Width;x++)
{
Pixels[x*Height+y] = p[3] >= 128? RGB256k.RGB[p[2]>>2][p[1]>>2][p[0]>>2] : 0;
@ -450,7 +450,7 @@ void FTGATexture::MakeTexture ()
case 8:
for(int y=0;y<Height;y++)
{
BYTE * p = ptr + y * Pitch;
uint8_t * p = ptr + y * Pitch;
for(int x=0;x<Width;x++)
{
Pixels[x*Height+y] = GrayMap[*p];
@ -462,7 +462,7 @@ void FTGATexture::MakeTexture ()
case 16:
for(int y=0;y<Height;y++)
{
BYTE * p = ptr + y * Pitch;
uint8_t * p = ptr + y * Pitch;
for(int x=0;x<Width;x++)
{
Pixels[x*Height+y] = GrayMap[p[1]]; // only use the high byte
@ -493,9 +493,9 @@ int FTGATexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
PalEntry pe[256];
FWadLump lump = Wads.OpenLumpNum (SourceLump);
TGAHeader hdr;
WORD w;
BYTE r,g,b,a;
BYTE * sbuffer;
uint16_t w;
uint8_t r,g,b,a;
uint8_t * sbuffer;
int transval = 0;
lump.Read(&hdr, sizeof(hdr));
@ -542,7 +542,7 @@ int FTGATexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
}
int Size = Width * Height * (hdr.bpp>>3);
sbuffer = new BYTE[Size];
sbuffer = new uint8_t[Size];
if (hdr.img_type < 4) // uncompressed
{
@ -553,7 +553,7 @@ int FTGATexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCo
ReadCompressed(lump, sbuffer, hdr.bpp>>3);
}
BYTE * ptr = sbuffer;
uint8_t * ptr = sbuffer;
int step_x = (hdr.bpp>>3);
int Pitch = Width * step_x;