- except for DWORD, all homegrown integer types are gone - a handful were left where they represent genuine Windows types.

This commit is contained in:
Christoph Oelckers 2017-03-09 19:54:41 +01:00
commit d2beacfc5f
136 changed files with 770 additions and 774 deletions

View file

@ -51,14 +51,14 @@
class FBuildTexture : public FTexture
{
public:
FBuildTexture (int tilenum, const BYTE *pixels, int width, int height, int left, int top);
FBuildTexture (int tilenum, const uint8_t *pixels, int width, int height, int left, int top);
~FBuildTexture ();
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 ();
protected:
const BYTE *Pixels;
const uint8_t *Pixels;
Span **Spans;
};
@ -69,7 +69,7 @@ protected:
//
//==========================================================================
FBuildTexture::FBuildTexture (int tilenum, const BYTE *pixels, int width, int height, int left, int top)
FBuildTexture::FBuildTexture (int tilenum, const uint8_t *pixels, int width, int height, int left, int top)
: Pixels (pixels), Spans (NULL)
{
Width = width;
@ -102,7 +102,7 @@ FBuildTexture::~FBuildTexture ()
//
//==========================================================================
const BYTE *FBuildTexture::GetPixels ()
const uint8_t *FBuildTexture::GetPixels ()
{
return Pixels;
}
@ -113,7 +113,7 @@ const BYTE *FBuildTexture::GetPixels ()
//
//==========================================================================
const BYTE *FBuildTexture::GetColumn (unsigned int column, const Span **spans_out)
const uint8_t *FBuildTexture::GetColumn (unsigned int column, const Span **spans_out)
{
if (column >= Width)
{
@ -150,10 +150,10 @@ void FTextureManager::AddTiles (void *tiles)
// int numtiles = LittleLong(((DWORD *)tiles)[1]); // This value is not reliable
int tilestart = LittleLong(((DWORD *)tiles)[2]);
int tileend = LittleLong(((DWORD *)tiles)[3]);
const WORD *tilesizx = &((const WORD *)tiles)[8];
const WORD *tilesizy = &tilesizx[tileend - tilestart + 1];
const uint16_t *tilesizx = &((const uint16_t *)tiles)[8];
const uint16_t *tilesizy = &tilesizx[tileend - tilestart + 1];
const DWORD *picanm = (const DWORD *)&tilesizy[tileend - tilestart + 1];
BYTE *tiledata = (BYTE *)&picanm[tileend - tilestart + 1];
uint8_t *tiledata = (uint8_t *)&picanm[tileend - tilestart + 1];
for (int i = tilestart; i <= tileend; ++i)
{
@ -313,7 +313,7 @@ int FTextureManager::CountBuildTiles ()
}
size_t len = Q_filelength (f);
BYTE *art = new BYTE[len];
uint8_t *art = new uint8_t[len];
if (fread (art, 1, len, f) != len || (numtiles = CountTiles(art)) == 0)
{
delete[] art;
@ -338,7 +338,7 @@ int FTextureManager::CountBuildTiles ()
break;
}
BYTE *art = new BYTE[Wads.LumpLength (lumpnum)];
uint8_t *art = new uint8_t[Wads.LumpLength (lumpnum)];
Wads.ReadLump (lumpnum, art);
if ((numtiles = CountTiles(art)) == 0)

View file

@ -65,7 +65,7 @@ FCanvasTexture::~FCanvasTexture ()
Unload ();
}
const BYTE *FCanvasTexture::GetColumn (unsigned int column, const Span **spans_out)
const uint8_t *FCanvasTexture::GetColumn (unsigned int column, const Span **spans_out)
{
bNeedsUpdate = true;
if (Canvas == NULL)
@ -90,7 +90,7 @@ const BYTE *FCanvasTexture::GetColumn (unsigned int column, const Span **spans_o
return Pixels + column*Height;
}
const BYTE *FCanvasTexture::GetPixels ()
const uint8_t *FCanvasTexture::GetPixels ()
{
bNeedsUpdate = true;
if (Canvas == NULL)
@ -118,12 +118,12 @@ void FCanvasTexture::MakeTexture ()
if (Width != Height || Width != Canvas->GetPitch())
{
Pixels = new BYTE[Width*Height];
Pixels = new uint8_t[Width*Height];
bPixelsAllocated = true;
}
else
{
Pixels = (BYTE*)Canvas->GetBuffer();
Pixels = (uint8_t*)Canvas->GetBuffer();
bPixelsAllocated = false;
}

View file

@ -56,7 +56,7 @@ struct TexCreateInfo
int usetype;
};
BYTE FTexture::GrayMap[256];
uint8_t FTexture::GrayMap[256];
void FTexture::InitGrayMap()
{
@ -253,7 +253,7 @@ void FTexture::HackHack (int newheight)
{
}
FTexture::Span **FTexture::CreateSpans (const BYTE *pixels) const
FTexture::Span **FTexture::CreateSpans (const uint8_t *pixels) const
{
Span **spans, *span;
@ -275,7 +275,7 @@ FTexture::Span **FTexture::CreateSpans (const BYTE *pixels) const
int numcols = Width;
int numrows = Height;
int numspans = numcols; // One span to terminate each column
const BYTE *data_p;
const uint8_t *data_p;
bool newspan;
int x, y;
@ -555,9 +555,9 @@ void FTexture::GenerateBgraMipmapsFast()
}
}
void FTexture::CopyToBlock (BYTE *dest, int dwidth, int dheight, int xpos, int ypos, int rotate, const BYTE *translation)
void FTexture::CopyToBlock (uint8_t *dest, int dwidth, int dheight, int xpos, int ypos, int rotate, const uint8_t *translation)
{
const BYTE *pixels = GetPixels();
const uint8_t *pixels = GetPixels();
int srcwidth = Width;
int srcheight = Height;
int step_x = Height;
@ -575,7 +575,7 @@ void FTexture::CopyToBlock (BYTE *dest, int dwidth, int dheight, int xpos, int y
for (int y = 0; y < srcheight; y++, pos++)
{
// the optimizer is doing a good enough job here so there's no need to optimize this by hand
BYTE v = pixels[y * step_y + x * step_x];
uint8_t v = pixels[y * step_y + x * step_x];
if (v != 0) dest[pos] = v;
}
}
@ -587,7 +587,7 @@ void FTexture::CopyToBlock (BYTE *dest, int dwidth, int dheight, int xpos, int y
int pos = x * dheight;
for (int y = 0; y < srcheight; y++, pos++)
{
BYTE v = pixels[y * step_y + x * step_x];
uint8_t v = pixels[y * step_y + x * step_x];
if (v != 0) dest[pos] = translation[v];
}
}
@ -598,7 +598,7 @@ void FTexture::CopyToBlock (BYTE *dest, int dwidth, int dheight, int xpos, int y
// Converts a texture between row-major and column-major format
// by flipping it about the X=Y axis.
void FTexture::FlipSquareBlock (BYTE *block, int x, int y)
void FTexture::FlipSquareBlock (uint8_t *block, int x, int y)
{
int i, j;
@ -606,17 +606,17 @@ void FTexture::FlipSquareBlock (BYTE *block, int x, int y)
for (i = 0; i < x; ++i)
{
BYTE *corner = block + x*i + i;
uint8_t *corner = block + x*i + i;
int count = x - i;
if (count & 1)
{
count--;
swapvalues<BYTE> (corner[count], corner[count*x]);
swapvalues<uint8_t> (corner[count], corner[count*x]);
}
for (j = 0; j < count; j += 2)
{
swapvalues<BYTE> (corner[j], corner[j*x]);
swapvalues<BYTE> (corner[j+1], corner[(j+1)*x]);
swapvalues<uint8_t> (corner[j], corner[j*x]);
swapvalues<uint8_t> (corner[j+1], corner[(j+1)*x]);
}
}
}
@ -644,16 +644,16 @@ void FTexture::FlipSquareBlockBgra(uint32_t *block, int x, int y)
}
}
void FTexture::FlipSquareBlockRemap (BYTE *block, int x, int y, const BYTE *remap)
void FTexture::FlipSquareBlockRemap (uint8_t *block, int x, int y, const uint8_t *remap)
{
int i, j;
BYTE t;
uint8_t t;
if (x != y) return;
for (i = 0; i < x; ++i)
{
BYTE *corner = block + x*i + i;
uint8_t *corner = block + x*i + i;
int count = x - i;
if (count & 1)
{
@ -674,7 +674,7 @@ void FTexture::FlipSquareBlockRemap (BYTE *block, int x, int y, const BYTE *rema
}
}
void FTexture::FlipNonSquareBlock (BYTE *dst, const BYTE *src, int x, int y, int srcpitch)
void FTexture::FlipNonSquareBlock (uint8_t *dst, const uint8_t *src, int x, int y, int srcpitch)
{
int i, j;
@ -700,7 +700,7 @@ void FTexture::FlipNonSquareBlockBgra(uint32_t *dst, const uint32_t *src, int x,
}
}
void FTexture::FlipNonSquareBlockRemap (BYTE *dst, const BYTE *src, int x, int y, int srcpitch, const BYTE *remap)
void FTexture::FlipNonSquareBlockRemap (uint8_t *dst, const uint8_t *src, int x, int y, int srcpitch, const uint8_t *remap)
{
int i, j;
@ -750,9 +750,9 @@ void FTexture::KillNative()
// color data. Note that the buffer expects row-major data, since that's
// generally more convenient for any non-Doom image formats, and it doesn't
// need to be used by any of Doom's column drawing routines.
void FTexture::FillBuffer(BYTE *buff, int pitch, int height, FTextureFormat fmt)
void FTexture::FillBuffer(uint8_t *buff, int pitch, int height, FTextureFormat fmt)
{
const BYTE *pix;
const uint8_t *pix;
int x, y, w, h, stride;
w = GetWidth();
@ -766,7 +766,7 @@ void FTexture::FillBuffer(BYTE *buff, int pitch, int height, FTextureFormat fmt)
stride = pitch - w;
for (y = 0; y < h; ++y)
{
const BYTE *pix2 = pix;
const uint8_t *pix2 = pix;
for (x = 0; x < w; ++x)
{
*buff++ = *pix2;
@ -931,13 +931,13 @@ void FDummyTexture::SetSize (int width, int height)
}
// This must never be called
const BYTE *FDummyTexture::GetColumn (unsigned int column, const Span **spans_out)
const uint8_t *FDummyTexture::GetColumn (unsigned int column, const Span **spans_out)
{
return NULL;
}
// And this also must never be called
const BYTE *FDummyTexture::GetPixels ()
const uint8_t *FDummyTexture::GetPixels ()
{
return NULL;
}

View file

@ -53,9 +53,9 @@ public:
struct FAnimDef
{
FTextureID BasePic;
WORD NumFrames;
WORD CurFrame;
BYTE AnimType;
uint16_t NumFrames;
uint16_t CurFrame;
uint8_t AnimType;
bool bDiscrete; // taken out of AnimType to have better control
DWORD SwitchTime; // Time to advance to next frame
struct FAnimFrame
@ -80,13 +80,13 @@ struct FSwitchDef
{
FTextureID PreTexture; // texture to switch from
FSwitchDef *PairDef; // switch def to use to return to PreTexture
WORD NumFrames; // # of animation frames
uint16_t NumFrames; // # of animation frames
bool QuestPanel; // Special texture for Strife mission
int Sound; // sound to play at start of animation. Changed to int to avoiud having to include s_sound here.
struct frame // Array of times followed by array of textures
{ // actual length of each array is <NumFrames>
WORD TimeMin;
WORD TimeRnd;
uint16_t TimeMin;
uint16_t TimeRnd;
FTextureID Texture;
} frames[1];
};
@ -142,7 +142,7 @@ public:
int16_t LeftOffset, TopOffset;
BYTE WidthBits, HeightBits;
uint8_t WidthBits, HeightBits;
DVector2 Scale;
@ -150,22 +150,22 @@ public:
FTextureID id;
FString Name;
BYTE UseType; // This texture's primary purpose
uint8_t UseType; // This texture's primary purpose
BYTE bNoDecals:1; // Decals should not stick to texture
BYTE bNoRemap0:1; // Do not remap color 0 (used by front layer of parallax skies)
BYTE bWorldPanning:1; // Texture is panned in world units rather than texels
BYTE bMasked:1; // Texture (might) have holes
BYTE bAlphaTexture:1; // Texture is an alpha channel without color information
BYTE bHasCanvas:1; // Texture is based off FCanvasTexture
BYTE bWarped:2; // This is a warped texture. Used to avoid multiple warps on one texture
BYTE bComplex:1; // Will be used to mark extended MultipatchTextures that have to be
uint8_t bNoDecals:1; // Decals should not stick to texture
uint8_t bNoRemap0:1; // Do not remap color 0 (used by front layer of parallax skies)
uint8_t bWorldPanning:1; // Texture is panned in world units rather than texels
uint8_t bMasked:1; // Texture (might) have holes
uint8_t bAlphaTexture:1; // Texture is an alpha channel without color information
uint8_t bHasCanvas:1; // Texture is based off FCanvasTexture
uint8_t bWarped:2; // This is a warped texture. Used to avoid multiple warps on one texture
uint8_t bComplex:1; // Will be used to mark extended MultipatchTextures that have to be
// fully composited before subjected to any kind of postprocessing instead of
// doing it per patch.
BYTE bMultiPatch:1; // This is a multipatch texture (we really could use real type info for textures...)
BYTE bKeepAround:1; // This texture was used as part of a multi-patch texture. Do not free it.
uint8_t bMultiPatch:1; // This is a multipatch texture (we really could use real type info for textures...)
uint8_t bKeepAround:1; // This texture was used as part of a multi-patch texture. Do not free it.
WORD Rotations;
uint16_t Rotations;
int16_t SkyOffset;
enum // UseTypes
@ -189,18 +189,18 @@ public:
struct Span
{
WORD TopOffset;
WORD Length; // A length of 0 terminates this column
uint16_t TopOffset;
uint16_t Length; // A length of 0 terminates this column
};
// Returns a single column of the texture
virtual const BYTE *GetColumn (unsigned int column, const Span **spans_out) = 0;
virtual const uint8_t *GetColumn (unsigned int column, const Span **spans_out) = 0;
// Returns a single column of the texture, in BGRA8 format
virtual const uint32_t *GetColumnBgra(unsigned int column, const Span **spans_out);
// Returns the whole texture, stored in column-major order
virtual const BYTE *GetPixels () = 0;
virtual const uint8_t *GetPixels () = 0;
// Returns the whole texture, stored in column-major order, in BGRA8 format
virtual const uint32_t *GetPixelsBgra();
@ -227,7 +227,7 @@ public:
void KillNative();
// Fill the native texture buffer with pixel data for this image
virtual void FillBuffer(BYTE *buff, int pitch, int height, FTextureFormat fmt);
virtual void FillBuffer(uint8_t *buff, int pitch, int height, FTextureFormat fmt);
int GetWidth () { return Width; }
int GetHeight () { return Height; }
@ -246,12 +246,12 @@ public:
virtual void SetFrontSkyLayer();
void CopyToBlock (BYTE *dest, int dwidth, int dheight, int x, int y, const BYTE *translation=NULL)
void CopyToBlock (uint8_t *dest, int dwidth, int dheight, int x, int y, const uint8_t *translation=NULL)
{
CopyToBlock(dest, dwidth, dheight, x, y, 0, translation);
}
void CopyToBlock (BYTE *dest, int dwidth, int dheight, int x, int y, int rotate, const BYTE *translation=NULL);
void CopyToBlock (uint8_t *dest, int dwidth, int dheight, int x, int y, int rotate, const uint8_t *translation=NULL);
// Returns true if the next call to GetPixels() will return an image different from the
// last call to GetPixels(). This should be considered valid only if a call to CheckModified()
@ -278,13 +278,13 @@ public:
virtual void HackHack (int newheight); // called by FMultipatchTexture to discover corrupt patches.
protected:
WORD Width, Height, WidthMask;
static BYTE GrayMap[256];
uint16_t Width, Height, WidthMask;
static uint8_t GrayMap[256];
FNativeTexture *Native;
FTexture (const char *name = NULL, int lumpnum = -1);
Span **CreateSpans (const BYTE *pixels) const;
Span **CreateSpans (const uint8_t *pixels) const;
void FreeSpans (Span **spans) const;
void CalcBitSize ();
void CopyInfo(FTexture *other)
@ -311,12 +311,12 @@ private:
PalEntry CeilingSkyColor;
public:
static void FlipSquareBlock (BYTE *block, int x, int y);
static void FlipSquareBlock (uint8_t *block, int x, int y);
static void FlipSquareBlockBgra (uint32_t *block, int x, int y);
static void FlipSquareBlockRemap (BYTE *block, int x, int y, const BYTE *remap);
static void FlipNonSquareBlock (BYTE *blockto, const BYTE *blockfrom, int x, int y, int srcpitch);
static void FlipSquareBlockRemap (uint8_t *block, int x, int y, const uint8_t *remap);
static void FlipNonSquareBlock (uint8_t *blockto, const uint8_t *blockfrom, int x, int y, int srcpitch);
static void FlipNonSquareBlockBgra (uint32_t *blockto, const uint32_t *blockfrom, int x, int y, int srcpitch);
static void FlipNonSquareBlockRemap (BYTE *blockto, const BYTE *blockfrom, int x, int y, int srcpitch, const BYTE *remap);
static void FlipNonSquareBlockRemap (uint8_t *blockto, const uint8_t *blockfrom, int x, int y, int srcpitch, const uint8_t *remap);
friend class D3DTex;
friend class OpenGLSWFrameBuffer;
@ -531,7 +531,7 @@ private:
TArray<FAnimDef *> mAnimations;
TArray<FSwitchDef *> mSwitchDefs;
TArray<FDoorAnimation> mAnimatedDoors;
TArray<BYTE *> BuildTileFiles;
TArray<uint8_t *> BuildTileFiles;
public:
short sintable[2048]; // for texture warping
enum
@ -545,8 +545,8 @@ class FDummyTexture : public FTexture
{
public:
FDummyTexture ();
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 SetSize (int width, int height);
};
@ -558,8 +558,8 @@ public:
~FWarpTexture ();
virtual int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate=0, FCopyInfo *inf = NULL);
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 ();
const uint32_t *GetPixelsBgra() override;
void Unload ();
bool CheckModified ();
@ -574,7 +574,7 @@ public:
int WidthOffsetMultiplier, HeightOffsetMultiplier; // [mxd]
protected:
FTexture *SourcePic;
BYTE *Pixels;
uint8_t *Pixels;
Span **Spans;
virtual void MakeTexture (DWORD time);
@ -592,8 +592,8 @@ public:
FCanvasTexture (const char *name, int width, int height);
~FCanvasTexture ();
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 ();
const uint32_t *GetPixelsBgra() override;
void Unload ();
bool CheckModified ();
@ -609,7 +609,7 @@ protected:
DSimpleCanvas *Canvas = nullptr;
DSimpleCanvas *CanvasBgra = nullptr;
BYTE *Pixels = nullptr;
uint8_t *Pixels = nullptr;
uint32_t *PixelsBgra = nullptr;
Span DummySpans[2];
bool bNeedsUpdate = true;

View file

@ -83,7 +83,7 @@ bool FWarpTexture::CheckModified ()
return r_FrameTime != GenTime;
}
const BYTE *FWarpTexture::GetPixels ()
const uint8_t *FWarpTexture::GetPixels ()
{
DWORD time = r_FrameTime;
@ -113,7 +113,7 @@ const uint32_t *FWarpTexture::GetPixelsBgra()
return PixelsBgra.data();
}
const BYTE *FWarpTexture::GetColumn (unsigned int column, const Span **spans_out)
const uint8_t *FWarpTexture::GetColumn (unsigned int column, const Span **spans_out)
{
DWORD time = r_FrameTime;
@ -146,11 +146,11 @@ const BYTE *FWarpTexture::GetColumn (unsigned int column, const Span **spans_out
void FWarpTexture::MakeTexture(DWORD time)
{
const BYTE *otherpix = SourcePic->GetPixels();
const uint8_t *otherpix = SourcePic->GetPixels();
if (Pixels == NULL)
{
Pixels = new BYTE[Width * Height];
Pixels = new uint8_t[Width * Height];
}
if (Spans != NULL)
{