diff --git a/src/basictypes.h b/src/basictypes.h index 262ec9f2b8..3a9018b795 100644 --- a/src/basictypes.h +++ b/src/basictypes.h @@ -3,10 +3,6 @@ #include -typedef uint8_t BYTE; -typedef uint16_t WORD; -typedef uint64_t QWORD; - // windef.h, included by windows.h, has its own incompatible definition // of DWORD as a long. In files that mix Doom and Windows code, you // must define USE_WINDOWS_DWORD before including doomtype.h so that @@ -32,7 +28,7 @@ typedef struct _GUID union QWORD_UNION { - QWORD AsOne; + uint64_t AsOne; struct { #ifdef __BIG_ENDIAN__ diff --git a/src/c_dispatch.h b/src/c_dispatch.h index 68d6233514..24a7c42ecf 100644 --- a/src/c_dispatch.h +++ b/src/c_dispatch.h @@ -153,10 +153,10 @@ struct FButtonStatus enum { MAX_KEYS = 6 }; // Maximum number of keys that can press this button uint16_t Keys[MAX_KEYS]; - BYTE bDown; // Button is down right now - BYTE bWentDown; // Button went down this tic - BYTE bWentUp; // Button went up this tic - BYTE padTo16Bytes; + uint8_t bDown; // Button is down right now + uint8_t bWentDown; // Button went down this tic + uint8_t bWentUp; // Button went up this tic + uint8_t padTo16Bytes; bool PressKey (int keynum); // Returns true if this key caused the button to be pressed. bool ReleaseKey (int keynum); // Returns true if this key is no longer pressed. diff --git a/src/colormatcher.cpp b/src/colormatcher.cpp index b15e617a61..a93192fe23 100644 --- a/src/colormatcher.cpp +++ b/src/colormatcher.cpp @@ -71,10 +71,10 @@ void FColorMatcher::SetPalette (const uint32_t *palette) Pal = (const PalEntry *)palette; } -BYTE FColorMatcher::Pick (int r, int g, int b) +uint8_t FColorMatcher::Pick (int r, int g, int b) { if (Pal == NULL) return 1; - return (BYTE)BestColor ((uint32_t *)Pal, r, g, b); + return (uint8_t)BestColor ((uint32_t *)Pal, r, g, b); } diff --git a/src/compatibility.h b/src/compatibility.h index 2c33e962eb..125f83f34c 100644 --- a/src/compatibility.h +++ b/src/compatibility.h @@ -7,7 +7,7 @@ union FMD5Holder { - BYTE Bytes[16]; + uint8_t Bytes[16]; uint32_t DWords[4]; hash_t Hash; }; diff --git a/src/configfile.cpp b/src/configfile.cpp index 146fefdfce..2319f28226 100644 --- a/src/configfile.cpp +++ b/src/configfile.cpp @@ -863,7 +863,7 @@ const char *FConfigFile::GenerateEndTag(const char *value) // isn't in the value. We create the sequences by generating two // 64-bit random numbers and Base64 encoding the first 15 bytes // from them. - union { QWORD rand_num[2]; BYTE rand_bytes[16]; }; + union { uint64_t rand_num[2]; uint8_t rand_bytes[16]; }; do { rand_num[0] = pr_endtag.GenRand64(); diff --git a/src/d_netinf.h b/src/d_netinf.h index 80d64bbb67..4f0f6e4032 100644 --- a/src/d_netinf.h +++ b/src/d_netinf.h @@ -49,10 +49,10 @@ void D_UserInfoChanged (FBaseCVar *info); void D_SendServerInfoChange (const FBaseCVar *cvar, UCVarValue value, ECVarType type); void D_SendServerFlagChange (const FBaseCVar *cvar, int bitnum, bool set); -void D_DoServerInfoChange (BYTE **stream, bool singlebit); +void D_DoServerInfoChange (uint8_t **stream, bool singlebit); -void D_WriteUserInfoStrings (int player, BYTE **stream, bool compact=false); -void D_ReadUserInfoStrings (int player, BYTE **stream, bool update); +void D_WriteUserInfoStrings (int player, uint8_t **stream, bool compact=false); +void D_ReadUserInfoStrings (int player, uint8_t **stream, bool update); struct FPlayerColorSet; void D_GetPlayerColor (int player, float *h, float *s, float *v, FPlayerColorSet **colorset); diff --git a/src/dobjtype.cpp b/src/dobjtype.cpp index 668daafda8..818543e89f 100644 --- a/src/dobjtype.cpp +++ b/src/dobjtype.cpp @@ -645,7 +645,7 @@ void PInt::SetValue(void *addr, int val) } else if (Size == 8) { - *(QWORD *)addr = val; + *(uint64_t *)addr = val; } else { @@ -681,7 +681,7 @@ int PInt::GetValueInt(void *addr) const } else if (Size == 8) { // truncated output - return (int)*(QWORD *)addr; + return (int)*(uint64_t *)addr; } else { diff --git a/src/f_wipe.cpp b/src/f_wipe.cpp index 1fb7c982b5..e2a4f68402 100644 --- a/src/f_wipe.cpp +++ b/src/f_wipe.cpp @@ -45,7 +45,7 @@ static int *y; // [RH] Fire Wipe #define FIREWIDTH 64 #define FIREHEIGHT 64 -static BYTE *burnarray; +static uint8_t *burnarray; static int density; static int burntime; @@ -81,7 +81,7 @@ bool wipe_initMelt (int ticks) int i, r; // copy start screen to main screen - screen->DrawBlock (0, 0, SCREENWIDTH, SCREENHEIGHT, (BYTE *)wipe_scr_start); + screen->DrawBlock (0, 0, SCREENWIDTH, SCREENHEIGHT, (uint8_t *)wipe_scr_start); // makes this wipe faster (in theory) // to have stuff in column-major format @@ -165,21 +165,21 @@ bool wipe_exitMelt (int ticks) bool wipe_initBurn (int ticks) { - burnarray = new BYTE[FIREWIDTH * (FIREHEIGHT+5)]; + burnarray = new uint8_t[FIREWIDTH * (FIREHEIGHT+5)]; memset (burnarray, 0, FIREWIDTH * (FIREHEIGHT+5)); density = 4; burntime = 0; return 0; } -int wipe_CalcBurn (BYTE *burnarray, int width, int height, int density) +int wipe_CalcBurn (uint8_t *burnarray, int width, int height, int density) { // This is a modified version of the fire that was once used // on the player setup menu. static int voop; int a, b; - BYTE *from; + uint8_t *from; // generator from = &burnarray[width * height]; @@ -198,10 +198,10 @@ int wipe_CalcBurn (BYTE *burnarray, int width, int height, int density) from = burnarray; for (b = 0; b <= height; b += 2) { - BYTE *pixel = from; + uint8_t *pixel = from; // special case: first pixel on line - BYTE *p = pixel + (width << 1); + uint8_t *p = pixel + (width << 1); unsigned int top = *p + *(p + width - 1) + *(p + 1); unsigned int bottom = *(pixel + (width << 2)); unsigned int c1 = (top + bottom) >> 2; @@ -274,14 +274,14 @@ bool wipe_doBurn (int ticks) // Draw the screen int xstep, ystep, firex, firey; int x, y; - BYTE *to, *fromold, *fromnew; + uint8_t *to, *fromold, *fromnew; const int SHIFT = 16; xstep = (FIREWIDTH << SHIFT) / SCREENWIDTH; ystep = (FIREHEIGHT << SHIFT) / SCREENHEIGHT; to = screen->GetBuffer(); - fromold = (BYTE *)wipe_scr_start; - fromnew = (BYTE *)wipe_scr_end; + fromold = (uint8_t *)wipe_scr_start; + fromnew = (uint8_t *)wipe_scr_end; if (!r_blendmethod) { @@ -379,7 +379,7 @@ bool wipe_doFade (int ticks) fade += ticks * 2; if (fade > 64) { - screen->DrawBlock (0, 0, SCREENWIDTH, SCREENHEIGHT, (BYTE *)wipe_scr_end); + screen->DrawBlock (0, 0, SCREENWIDTH, SCREENHEIGHT, (uint8_t *)wipe_scr_end); return true; } else @@ -388,9 +388,9 @@ bool wipe_doFade (int ticks) int bglevel = 64 - fade; DWORD *fg2rgb = Col2RGB8[fade]; DWORD *bg2rgb = Col2RGB8[bglevel]; - BYTE *fromnew = (BYTE *)wipe_scr_end; - BYTE *fromold = (BYTE *)wipe_scr_start; - BYTE *to = screen->GetBuffer(); + uint8_t *fromnew = (uint8_t *)wipe_scr_end; + uint8_t *fromold = (uint8_t *)wipe_scr_start; + uint8_t *to = screen->GetBuffer(); const PalEntry *pal = GPalette.BaseColors; if (!r_blendmethod) @@ -456,7 +456,7 @@ bool wipe_StartScreen (int type) if (CurrentWipeType) { wipe_scr_start = new short[SCREENWIDTH * SCREENHEIGHT / 2]; - screen->GetBlock (0, 0, SCREENWIDTH, SCREENHEIGHT, (BYTE *)wipe_scr_start); + screen->GetBlock (0, 0, SCREENWIDTH, SCREENHEIGHT, (uint8_t *)wipe_scr_start); return true; } return false; @@ -470,8 +470,8 @@ void wipe_EndScreen (void) if (CurrentWipeType) { wipe_scr_end = new short[SCREENWIDTH * SCREENHEIGHT / 2]; - screen->GetBlock (0, 0, SCREENWIDTH, SCREENHEIGHT, (BYTE *)wipe_scr_end); - screen->DrawBlock (0, 0, SCREENWIDTH, SCREENHEIGHT, (BYTE *)wipe_scr_start); // restore start scr. + screen->GetBlock (0, 0, SCREENWIDTH, SCREENHEIGHT, (uint8_t *)wipe_scr_end); + screen->DrawBlock (0, 0, SCREENWIDTH, SCREENHEIGHT, (uint8_t *)wipe_scr_start); // restore start scr. // Initialize the wipe (*wipes[(CurrentWipeType-1)*3])(0); diff --git a/src/f_wipe.h b/src/f_wipe.h index 8f8bed7fef..0f94e6a065 100644 --- a/src/f_wipe.h +++ b/src/f_wipe.h @@ -34,7 +34,7 @@ void wipe_Cleanup (); // The buffer must have an additional 5 rows not included in height // to use for a seeding area. -int wipe_CalcBurn (BYTE *buffer, int width, int height, int density); +int wipe_CalcBurn (uint8_t *buffer, int width, int height, int density); enum { diff --git a/src/files.cpp b/src/files.cpp index 527fa47495..03bab9b458 100644 --- a/src/files.cpp +++ b/src/files.cpp @@ -392,7 +392,7 @@ ISzAlloc g_Alloc = { SzAlloc, SzFree }; FileReaderLZMA::FileReaderLZMA (FileReader &file, size_t uncompressed_size, bool zip) : File(file), SawEOF(false) { - BYTE header[4 + LZMA_PROPS_SIZE]; + uint8_t header[4 + LZMA_PROPS_SIZE]; int err; assert(zip == true); diff --git a/src/g_level.h b/src/g_level.h index 0f8906b6a1..ccb00b0ee7 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -175,7 +175,7 @@ enum ELevelFlags : unsigned int LEVEL_CHANGEMAPCHEAT = 0x40000000, // Don't display cluster messages LEVEL_VISITED = 0x80000000, // Used for intermission map - // The flags QWORD is now split into 2 DWORDs + // The flags uint64_t is now split into 2 DWORDs LEVEL2_RANDOMPLAYERSTARTS = 0x00000001, // Select single player starts randomnly (no voodoo dolls) LEVEL2_ALLMAP = 0x00000002, // The player picked up a map on this level diff --git a/src/g_statusbar/strife_sbar.cpp b/src/g_statusbar/strife_sbar.cpp index a09ac43016..e0bf96dcea 100644 --- a/src/g_statusbar/strife_sbar.cpp +++ b/src/g_statusbar/strife_sbar.cpp @@ -33,22 +33,22 @@ class FHealthBar : public FTexture public: FHealthBar (); - 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 (); bool CheckModified (); void SetVial (int level); protected: - BYTE Pixels[200*2]; - BYTE Colors[8]; + uint8_t Pixels[200*2]; + uint8_t Colors[8]; static const Span DummySpan[2]; int VialLevel; bool NeedRefresh; void MakeTexture (); - void FillBar (int min, int max, BYTE light, BYTE dark); + void FillBar (int min, int max, uint8_t light, uint8_t dark); }; const FTexture::Span FHealthBar::DummySpan[2] = { { 0, 2 }, { 0, 0 } }; @@ -58,7 +58,7 @@ FHealthBar::FHealthBar () { int i; - static const BYTE rgbs[8*3] = + static const uint8_t rgbs[8*3] = { 180, 228, 128, // light green 128, 180, 80, // dark green @@ -90,7 +90,7 @@ bool FHealthBar::CheckModified () return NeedRefresh; } -const BYTE *FHealthBar::GetColumn (unsigned int column, const Span **spans_out) +const uint8_t *FHealthBar::GetColumn (unsigned int column, const Span **spans_out) { if (NeedRefresh) { @@ -107,7 +107,7 @@ const BYTE *FHealthBar::GetColumn (unsigned int column, const Span **spans_out) return Pixels + column*2; } -const BYTE *FHealthBar::GetPixels () +const uint8_t *FHealthBar::GetPixels () { if (NeedRefresh) { @@ -166,7 +166,7 @@ void FHealthBar::MakeTexture () } } -void FHealthBar::FillBar (int min, int max, BYTE light, BYTE dark) +void FHealthBar::FillBar (int min, int max, uint8_t light, uint8_t dark) { for (int i = min*2; i < max*2; i++) { diff --git a/src/gl/data/gl_data.h b/src/gl/data/gl_data.h index 70fdc7a250..5173e56c11 100644 --- a/src/gl/data/gl_data.h +++ b/src/gl/data/gl_data.h @@ -69,7 +69,7 @@ struct FGLLinePortal extern TArray portals; extern TArray linePortalToGL; -extern TArray currentmapsection; +extern TArray currentmapsection; void gl_InitPortals(); void gl_BuildPortalCoverage(FPortalCoverage *coverage, subsector_t *subsector, const DVector2 &displacement); diff --git a/src/gl/data/gl_portaldata.cpp b/src/gl/data/gl_portaldata.cpp index c705da5891..725eebbef5 100644 --- a/src/gl/data/gl_portaldata.cpp +++ b/src/gl/data/gl_portaldata.cpp @@ -296,7 +296,7 @@ struct FCoverageBuilder else { // we reached a subsector so we can link the node with this subsector - subsector_t *sub = (subsector_t *)((BYTE *)node - 1); + subsector_t *sub = (subsector_t *)((uint8_t *)node - 1); collect.Push(int(sub-subsectors)); } } diff --git a/src/gl/dynlights/gl_dynlight.h b/src/gl/dynlights/gl_dynlight.h index 4733d853f4..15d9ba6103 100644 --- a/src/gl/dynlights/gl_dynlight.h +++ b/src/gl/dynlights/gl_dynlight.h @@ -97,9 +97,9 @@ public: virtual void Tick(); void Serialize(FSerializer &arc); void PostSerialize(); - BYTE GetRed() const { return args[LIGHT_RED]; } - BYTE GetGreen() const { return args[LIGHT_GREEN]; } - BYTE GetBlue() const { return args[LIGHT_BLUE]; } + uint8_t GetRed() const { return args[LIGHT_RED]; } + uint8_t GetGreen() const { return args[LIGHT_GREEN]; } + uint8_t GetBlue() const { return args[LIGHT_BLUE]; } float GetRadius() const { return (IsActive() ? m_currentRadius * 2.f : 0.f); } void LinkLight(); void UnlinkLight(); @@ -135,11 +135,11 @@ protected: public: int m_tickCount; - BYTE lightflags; - BYTE lighttype; + uint8_t lightflags; + uint8_t lighttype; bool owned; bool halo; - BYTE color2[3]; + uint8_t color2[3]; bool visibletoplayer; bool swapped; int bufferindex; diff --git a/src/gl/models/gl_models.h b/src/gl/models/gl_models.h index c37b69b5ee..a1ed4014d6 100644 --- a/src/gl/models/gl_models.h +++ b/src/gl/models/gl_models.h @@ -59,7 +59,7 @@ public: virtual int FindFrame(const char * name) = 0; virtual void RenderFrame(FTexture * skin, int frame, int frame2, double inter, int translation=0) = 0; virtual void BuildVertexBuffer() = 0; - virtual void AddSkins(BYTE *hitlist) = 0; + virtual void AddSkins(uint8_t *hitlist) = 0; void DestroyVertexBuffer() { delete mVBuf; @@ -185,7 +185,7 @@ public: virtual int FindFrame(const char * name); virtual void RenderFrame(FTexture * skin, int frame, int frame2, double inter, int translation=0); virtual void LoadGeometry(); - virtual void AddSkins(BYTE *hitlist); + virtual void AddSkins(uint8_t *hitlist); void UnloadGeometry(); void BuildVertexBuffer(); @@ -292,7 +292,7 @@ public: virtual void RenderFrame(FTexture * skin, int frame, int frame2, double inter, int translation=0); void LoadGeometry(); void BuildVertexBuffer(); - virtual void AddSkins(BYTE *hitlist); + virtual void AddSkins(uint8_t *hitlist); }; struct FVoxelVertexHash @@ -335,7 +335,7 @@ protected: TArray mIndices; void MakeSlabPolys(int x, int y, kvxslab_t *voxptr, FVoxelMap &check); - void AddFace(int x1, int y1, int z1, int x2, int y2, int z2, int x3, int y3, int z3, int x4, int y4, int z4, BYTE color, FVoxelMap &check); + void AddFace(int x1, int y1, int z1, int x2, int y2, int z2, int x3, int y3, int z3, int x4, int y4, int z4, uint8_t color, FVoxelMap &check); unsigned int AddVertex(FModelVertex &vert, FVoxelMap &check); public: @@ -345,7 +345,7 @@ public: void Initialize(); virtual int FindFrame(const char * name); virtual void RenderFrame(FTexture * skin, int frame, int frame2, double inter, int translation=0); - virtual void AddSkins(BYTE *hitlist); + virtual void AddSkins(uint8_t *hitlist); FTextureID GetPaletteTexture() const { return mPalette; } void BuildVertexBuffer(); float getAspectFactor(); diff --git a/src/gl/models/gl_models_md3.cpp b/src/gl/models/gl_models_md3.cpp index b914737141..6336ce2772 100644 --- a/src/gl/models/gl_models_md3.cpp +++ b/src/gl/models/gl_models_md3.cpp @@ -300,7 +300,7 @@ void FMD3Model::BuildVertexBuffer() // //=========================================================================== -void FMD3Model::AddSkins(BYTE *hitlist) +void FMD3Model::AddSkins(uint8_t *hitlist) { for (int i = 0; i < numSurfaces; i++) { diff --git a/src/gl/models/gl_voxels.cpp b/src/gl/models/gl_voxels.cpp index 6e84bd7abf..360ef4434a 100644 --- a/src/gl/models/gl_voxels.cpp +++ b/src/gl/models/gl_voxels.cpp @@ -65,8 +65,8 @@ public: FVoxelTexture(FVoxel *voxel); ~FVoxelTexture(); - 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 (); int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf); @@ -74,7 +74,7 @@ public: protected: FVoxel *SourceVox; - BYTE *Pixels; + uint8_t *Pixels; }; @@ -107,20 +107,20 @@ FVoxelTexture::~FVoxelTexture() { } -const BYTE *FVoxelTexture::GetColumn (unsigned int column, const Span **spans_out) +const uint8_t *FVoxelTexture::GetColumn (unsigned int column, const Span **spans_out) { // not needed return NULL; } -const BYTE *FVoxelTexture::GetPixels () +const uint8_t *FVoxelTexture::GetPixels () { // GetPixels gets called when a translated palette is used so we still need to implement it here. if (Pixels == NULL) { - Pixels = new BYTE[256]; + Pixels = new uint8_t[256]; - BYTE *pp = SourceVox->Palette; + uint8_t *pp = SourceVox->Palette; if(pp != NULL) { @@ -137,7 +137,7 @@ const BYTE *FVoxelTexture::GetPixels () { for(int i=0;i<256;i++, pp+=3) { - Pixels[i] = (BYTE)i; + Pixels[i] = (uint8_t)i; } } } @@ -165,14 +165,14 @@ void FVoxelTexture::Unload () int FVoxelTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf) { PalEntry pe[256]; - BYTE bitmap[256]; - BYTE *pp = SourceVox->Palette; + uint8_t bitmap[256]; + uint8_t *pp = SourceVox->Palette; if(pp != NULL) { for(int i=0;i<256;i++, pp+=3) { - bitmap[i] = (BYTE)i; + bitmap[i] = (uint8_t)i; pe[i].r = (pp[0] << 2) | (pp[0] >> 4); pe[i].g = (pp[1] << 2) | (pp[1] >> 4); pe[i].b = (pp[2] << 2) | (pp[2] >> 4); @@ -183,7 +183,7 @@ int FVoxelTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, F { for(int i=0;i<256;i++, pp+=3) { - bitmap[i] = (BYTE)i; + bitmap[i] = (uint8_t)i; pe[i] = GPalette.BaseColors[i]; pe[i].a = 255; } @@ -239,7 +239,7 @@ unsigned int FVoxelModel::AddVertex(FModelVertex &vert, FVoxelMap &check) // //=========================================================================== -void FVoxelModel::AddFace(int x1, int y1, int z1, int x2, int y2, int z2, int x3, int y3, int z3, int x4, int y4, int z4, BYTE col, FVoxelMap &check) +void FVoxelModel::AddFace(int x1, int y1, int z1, int x2, int y2, int z2, int x3, int y3, int z3, int x4, int y4, int z4, uint8_t col, FVoxelMap &check) { float PivotX = mVoxel->Mips[0].Pivot.X; float PivotY = mVoxel->Mips[0].Pivot.Y; @@ -289,7 +289,7 @@ void FVoxelModel::AddFace(int x1, int y1, int z1, int x2, int y2, int z2, int x3 void FVoxelModel::MakeSlabPolys(int x, int y, kvxslab_t *voxptr, FVoxelMap &check) { - const BYTE *col = voxptr->col; + const uint8_t *col = voxptr->col; int zleng = voxptr->zleng; int ztop = voxptr->ztop; int cull = voxptr->backfacecull; @@ -342,13 +342,13 @@ void FVoxelModel::Initialize() FVoxelMipLevel *mip = &mVoxel->Mips[0]; for (int x = 0; x < mip->SizeX; x++) { - BYTE *slabxoffs = &mip->SlabData[mip->OffsetX[x]]; + uint8_t *slabxoffs = &mip->SlabData[mip->OffsetX[x]]; short *xyoffs = &mip->OffsetXY[x * (mip->SizeY + 1)]; for (int y = 0; y < mip->SizeY; y++) { kvxslab_t *voxptr = (kvxslab_t *)(slabxoffs + xyoffs[y]); kvxslab_t *voxend = (kvxslab_t *)(slabxoffs + xyoffs[y+1]); - for (; voxptr < voxend; voxptr = (kvxslab_t *)((BYTE *)voxptr + voxptr->zleng + 3)) + for (; voxptr < voxend; voxptr = (kvxslab_t *)((uint8_t *)voxptr + voxptr->zleng + 3)) { MakeSlabPolys(x, y, voxptr, check); } @@ -394,7 +394,7 @@ void FVoxelModel::BuildVertexBuffer() // //=========================================================================== -void FVoxelModel::AddSkins(BYTE *hitlist) +void FVoxelModel::AddSkins(uint8_t *hitlist) { hitlist[mPalette.GetIndex()] |= FTexture::TEX_Flat; } diff --git a/src/gl/renderer/gl_2ddrawer.cpp b/src/gl/renderer/gl_2ddrawer.cpp index cad83885f2..9d2449cbd9 100644 --- a/src/gl/renderer/gl_2ddrawer.cpp +++ b/src/gl/renderer/gl_2ddrawer.cpp @@ -139,7 +139,7 @@ void F2DDrawer::AddTexture(FTexture *img, DrawParms &parms) { color = PalEntry(light, light, light); } - color.a = (BYTE)(parms.Alpha * 255); + color.a = (uint8_t)(parms.Alpha * 255); // scissor test doesn't use the current viewport for the coordinates, so use real screen coordinates dg.mScissor[0] = GLRenderer->ScreenToWindowX(parms.lclip); diff --git a/src/gl/renderer/gl_lightdata.cpp b/src/gl/renderer/gl_lightdata.cpp index c017453bda..f258c427b6 100644 --- a/src/gl/renderer/gl_lightdata.cpp +++ b/src/gl/renderer/gl_lightdata.cpp @@ -253,7 +253,7 @@ static PalEntry gl_CalcLightColor(int light, PalEntry pe, int blendfactor) g = (mixlight + pe.g * blendfactor) / 255; b = (mixlight + pe.b * blendfactor) / 255; } - return PalEntry(255, BYTE(r), BYTE(g), BYTE(b)); + return PalEntry(255, uint8_t(r), uint8_t(g), uint8_t(b)); } //========================================================================== diff --git a/src/gl/renderer/gl_postprocess.cpp b/src/gl/renderer/gl_postprocess.cpp index 73edd69750..00478e3406 100644 --- a/src/gl/renderer/gl_postprocess.cpp +++ b/src/gl/renderer/gl_postprocess.cpp @@ -529,7 +529,7 @@ void FGLRenderer::CreateTonemapPalette() { for (int b = 0; b < 64; b++) { - PalEntry color = GPalette.BaseColors[(BYTE)PTM_BestColor((uint32_t *)GPalette.BaseColors, (r << 2) | (r >> 4), (g << 2) | (g >> 4), (b << 2) | (b >> 4), 0, 256)]; + PalEntry color = GPalette.BaseColors[(uint8_t)PTM_BestColor((uint32_t *)GPalette.BaseColors, (r << 2) | (r >> 4), (g << 2) | (g >> 4), (b << 2) | (b >> 4), 0, 256)]; int index = ((r * 64 + g) * 64 + b) * 4; lut[index] = color.r; lut[index + 1] = color.g; diff --git a/src/gl/scene/gl_bsp.cpp b/src/gl/scene/gl_bsp.cpp index 9b78850a90..213c5eea1a 100644 --- a/src/gl/scene/gl_bsp.cpp +++ b/src/gl/scene/gl_bsp.cpp @@ -131,7 +131,7 @@ static void AddLine (seg_t *seg, bool portalclip) } currentsubsector->flags |= SSECF_DRAWN; - BYTE ispoly = BYTE(seg->sidedef->Flags & WALLF_POLYOBJ); + uint8_t ispoly = uint8_t(seg->sidedef->Flags & WALLF_POLYOBJ); if (!seg->backsector) { @@ -248,7 +248,7 @@ static void RenderPolyBSPNode (void *node) node = bsp->children[side]; } - PolySubsector ((subsector_t *)((BYTE *)node - 1)); + PolySubsector ((subsector_t *)((uint8_t *)node - 1)); } //========================================================================== @@ -512,7 +512,7 @@ static void DoSubsector(subsector_t * sub) fakesector = gl_FakeFlat(sector, &fake, false); } - BYTE &srf = gl_drawinfo->sectorrenderflags[sub->render_sector->sectornum]; + uint8_t &srf = gl_drawinfo->sectorrenderflags[sub->render_sector->sectornum]; if (!(srf & SSRF_PROCESSED)) { srf |= SSRF_PROCESSED; @@ -587,7 +587,7 @@ void gl_RenderBSPNode (void *node) node = bsp->children[side]; } - DoSubsector ((subsector_t *)((BYTE *)node - 1)); + DoSubsector ((subsector_t *)((uint8_t *)node - 1)); } diff --git a/src/gl/scene/gl_clipper.cpp b/src/gl/scene/gl_clipper.cpp index cd076d58aa..f1d79c7274 100644 --- a/src/gl/scene/gl_clipper.cpp +++ b/src/gl/scene/gl_clipper.cpp @@ -427,7 +427,7 @@ angle_t R_PointToPseudoAngle(double x, double y) // if some part of the bbox might be visible. // //----------------------------------------------------------------------------- - static const BYTE checkcoord[12][4] = // killough -- static const + static const uint8_t checkcoord[12][4] = // killough -- static const { {3,0,2,1}, {3,0,2,0}, @@ -447,7 +447,7 @@ bool Clipper::CheckBox(const float *bspcoord) angle_t angle1, angle2; int boxpos; - const BYTE* check; + const uint8_t* check; // Find the corners of the box // that define the edges from current viewpoint. diff --git a/src/gl/scene/gl_drawinfo.h b/src/gl/scene/gl_drawinfo.h index 0e7296ee36..4c09dbce7d 100644 --- a/src/gl/scene/gl_drawinfo.h +++ b/src/gl/scene/gl_drawinfo.h @@ -203,12 +203,12 @@ struct FDrawInfo struct SubsectorHackInfo { subsector_t * sub; - BYTE flags; + uint8_t flags; }; - TArray sectorrenderflags; - TArray ss_renderflags; - TArray no_renderflags; + TArray sectorrenderflags; + TArray ss_renderflags; + TArray no_renderflags; TArray MissingUpperTextures; TArray MissingLowerTextures; diff --git a/src/gl/scene/gl_portal.cpp b/src/gl/scene/gl_portal.cpp index 4cf8b9e7ba..5fb087f96c 100644 --- a/src/gl/scene/gl_portal.cpp +++ b/src/gl/scene/gl_portal.cpp @@ -690,7 +690,7 @@ GLSectorStackPortal::~GLSectorStackPortal() // //----------------------------------------------------------------------------- -static BYTE SetCoverage(void *node) +static uint8_t SetCoverage(void *node) { if (numnodes == 0) { @@ -699,13 +699,13 @@ static BYTE SetCoverage(void *node) if (!((size_t)node & 1)) // Keep going until found a subsector { node_t *bsp = (node_t *)node; - BYTE coverage = SetCoverage(bsp->children[0]) | SetCoverage(bsp->children[1]); + uint8_t coverage = SetCoverage(bsp->children[0]) | SetCoverage(bsp->children[1]); gl_drawinfo->no_renderflags[bsp-nodes] = coverage; return coverage; } else { - subsector_t *sub = (subsector_t *)((BYTE *)node - 1); + subsector_t *sub = (subsector_t *)((uint8_t *)node - 1); return gl_drawinfo->ss_renderflags[sub-subsectors] & SSRF_SEEN; } } diff --git a/src/gl/scene/gl_portal.h b/src/gl/scene/gl_portal.h index 3adaa4aa48..a49f03563c 100644 --- a/src/gl/scene/gl_portal.h +++ b/src/gl/scene/gl_portal.h @@ -108,7 +108,7 @@ private: ActorRenderFlags savedvisibility; GLPortal *PrevPortal; GLPortal *PrevClipPortal; - TArray savedmapsection; + TArray savedmapsection; TArray mPrimIndices; protected: diff --git a/src/gl/scene/gl_scene.cpp b/src/gl/scene/gl_scene.cpp index 9d063d6adb..d5c1838609 100644 --- a/src/gl/scene/gl_scene.cpp +++ b/src/gl/scene/gl_scene.cpp @@ -92,7 +92,7 @@ extern bool r_showviewer; int gl_fixedcolormap; area_t in_area; -TArray currentmapsection; +TArray currentmapsection; int camtexcount; void gl_ParseDefs(); @@ -1010,7 +1010,7 @@ struct FGLInterface : public FRenderer bool UsesColormap() const override; void PrecacheTexture(FTexture *tex, int cache); void PrecacheSprite(FTexture *tex, SpriteHits &hits); - void Precache(BYTE *texhitlist, TMap &actorhitlist) override; + void Precache(uint8_t *texhitlist, TMap &actorhitlist) override; void RenderView(player_t *player) override; void WriteSavePic (player_t *player, FileWriter *file, int width, int height) override; void StateChanged(AActor *actor) override; @@ -1078,13 +1078,13 @@ void FGLInterface::PrecacheSprite(FTexture *tex, SpriteHits &hits) // //========================================================================== -void FGLInterface::Precache(BYTE *texhitlist, TMap &actorhitlist) +void FGLInterface::Precache(uint8_t *texhitlist, TMap &actorhitlist) { SpriteHits *spritelist = new SpriteHits[sprites.Size()]; SpriteHits **spritehitlist = new SpriteHits*[TexMan.NumTextures()]; TMap::Iterator it(actorhitlist); TMap::Pair *pair; - BYTE *modellist = new BYTE[Models.Size()]; + uint8_t *modellist = new uint8_t[Models.Size()]; memset(modellist, 0, Models.Size()); memset(spritehitlist, 0, sizeof(SpriteHits**) * TexMan.NumTextures()); diff --git a/src/gl/scene/gl_sprite.cpp b/src/gl/scene/gl_sprite.cpp index 030daf91c8..30b7344b0e 100644 --- a/src/gl/scene/gl_sprite.cpp +++ b/src/gl/scene/gl_sprite.cpp @@ -892,7 +892,7 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal) lightlevel=fullbright? 255 : gl_ClampLight(rendersector->GetTexture(sector_t::ceiling) == skyflatnum ? rendersector->GetCeilingLight() : rendersector->GetFloorLight()); - foglevel = (BYTE)clamp(rendersector->lightlevel, 0, 255); + foglevel = (uint8_t)clamp(rendersector->lightlevel, 0, 255); lightlevel = gl_CheckSpriteGlow(rendersector, lightlevel, thingpos); @@ -1093,7 +1093,7 @@ void GLSprite::ProcessParticle (particle_t *particle, sector_t *sector)//, int s lightlevel = gl_ClampLight(sector->GetTexture(sector_t::ceiling) == skyflatnum ? sector->GetCeilingLight() : sector->GetFloorLight()); - foglevel = (BYTE)clamp(sector->lightlevel, 0, 255); + foglevel = (uint8_t)clamp(sector->lightlevel, 0, 255); if (gl_fixedcolormap) { diff --git a/src/gl/scene/gl_wall.h b/src/gl/scene/gl_wall.h index 7337c4d3f4..5750747ddd 100644 --- a/src/gl/scene/gl_wall.h +++ b/src/gl/scene/gl_wall.h @@ -153,8 +153,8 @@ public: TArray *lightlist; int lightlevel; - BYTE type; - BYTE flags; + uint8_t type; + uint8_t flags; short rellight; float topglowcolor[4]; @@ -309,7 +309,7 @@ public: int lightlevel; bool stack; bool ceiling; - BYTE renderflags; + uint8_t renderflags; int vboindex; //int vboheight; @@ -348,8 +348,8 @@ public: friend void Mod_RenderModel(GLSprite * spr, model_t * mdl, int framenumber); int lightlevel; - BYTE foglevel; - BYTE hw_styleflags; + uint8_t foglevel; + uint8_t hw_styleflags; bool fullbright; PalEntry ThingColor; // thing's own color FColormap Colormap; diff --git a/src/gl/scene/gl_walls.cpp b/src/gl/scene/gl_walls.cpp index fc5606b47f..6267ac82bc 100644 --- a/src/gl/scene/gl_walls.cpp +++ b/src/gl/scene/gl_walls.cpp @@ -711,7 +711,7 @@ void GLWall::DoTexture(int _type,seg_t * seg, int peg, GLSeg glsave=glseg; float flh=ceilingrefheight-floorrefheight; int texpos; - BYTE savedflags = flags; + uint8_t savedflags = flags; switch (_type) { diff --git a/src/gl/system/gl_framebuffer.cpp b/src/gl/system/gl_framebuffer.cpp index c6aad4abe4..c940e8b0d2 100644 --- a/src/gl/system/gl_framebuffer.cpp +++ b/src/gl/system/gl_framebuffer.cpp @@ -506,7 +506,7 @@ void OpenGLFrameBuffer::FillSimplePoly(FTexture *texture, FVector2 *points, int // //=========================================================================== -void OpenGLFrameBuffer::GetScreenshotBuffer(const BYTE *&buffer, int &pitch, ESSType &color_type) +void OpenGLFrameBuffer::GetScreenshotBuffer(const uint8_t *&buffer, int &pitch, ESSType &color_type) { const auto &viewport = GLRenderer->mOutputLetterbox; @@ -523,7 +523,7 @@ void OpenGLFrameBuffer::GetScreenshotBuffer(const BYTE *&buffer, int &pitch, ESS int h = SCREENHEIGHT; ReleaseScreenshotBuffer(); - ScreenshotBuffer = new BYTE[w * h * 3]; + ScreenshotBuffer = new uint8_t[w * h * 3]; float rcpWidth = 1.0f / w; float rcpHeight = 1.0f / h; diff --git a/src/gl/system/gl_framebuffer.h b/src/gl/system/gl_framebuffer.h index 7d6ce08000..8819b80698 100644 --- a/src/gl/system/gl_framebuffer.h +++ b/src/gl/system/gl_framebuffer.h @@ -55,7 +55,7 @@ public: // Retrieves a buffer containing image data for a screenshot. // Hint: Pitch can be negative for upside-down images, in which case buffer // points to the last row in the buffer, which will be the first row output. - virtual void GetScreenshotBuffer(const BYTE *&buffer, int &pitch, ESSType &color_type); + virtual void GetScreenshotBuffer(const uint8_t *&buffer, int &pitch, ESSType &color_type); // Releases the screenshot buffer. virtual void ReleaseScreenshotBuffer(); @@ -96,7 +96,7 @@ private: bool swapped; PalEntry SourcePalette[256]; - BYTE *ScreenshotBuffer; + uint8_t *ScreenshotBuffer; class Wiper { diff --git a/src/gl/system/gl_swwipe.cpp b/src/gl/system/gl_swwipe.cpp index 7f8e44a669..03577773f2 100644 --- a/src/gl/system/gl_swwipe.cpp +++ b/src/gl/system/gl_swwipe.cpp @@ -397,7 +397,7 @@ bool OpenGLSWFrameBuffer::Wiper_Melt::Run(int ticks, OpenGLSWFrameBuffer *fb) BufferedTris *quad = &fb->QuadExtra[fb->QuadBatchPos]; FBVERTEX *vert = &fb->VertexData[fb->VertexPos]; - WORD *index = &fb->IndexData[fb->IndexPos]; + uint16_t *index = &fb->IndexData[fb->IndexPos]; quad->ClearSetup(); quad->Flags = BQF_DisableAlphaTest; diff --git a/src/gl/system/gl_wipe.cpp b/src/gl/system/gl_wipe.cpp index 38a06c0872..33d8a8ddf7 100644 --- a/src/gl/system/gl_wipe.cpp +++ b/src/gl/system/gl_wipe.cpp @@ -87,7 +87,7 @@ public: private: static const int WIDTH = 64, HEIGHT = 64; - BYTE BurnArray[WIDTH * (HEIGHT + 5)]; + uint8_t BurnArray[WIDTH * (HEIGHT + 5)]; FHardwareTexture *BurnTexture; int Density; int BurnTime; @@ -524,15 +524,15 @@ bool OpenGLFrameBuffer::Wiper_Burn::Run(int ticks, OpenGLFrameBuffer *fb) BurnTexture = new FHardwareTexture(WIDTH, HEIGHT, true); // Update the burn texture with the new burn data - BYTE rgb_buffer[WIDTH*HEIGHT*4]; + uint8_t rgb_buffer[WIDTH*HEIGHT*4]; - const BYTE *src = BurnArray; + const uint8_t *src = BurnArray; DWORD *dest = (DWORD *)rgb_buffer; for (int y = HEIGHT; y != 0; --y) { for (int x = WIDTH; x != 0; --x) { - BYTE s = clamp((*src++)*2, 0, 255); + uint8_t s = clamp((*src++)*2, 0, 255); *dest++ = MAKEARGB(s,255,255,255); } } diff --git a/src/gl/textures/gl_bitmap.cpp b/src/gl/textures/gl_bitmap.cpp index f5156c7a5d..f6909c9520 100644 --- a/src/gl/textures/gl_bitmap.cpp +++ b/src/gl/textures/gl_bitmap.cpp @@ -39,7 +39,7 @@ // //=========================================================================== template -void iCopyColors(unsigned char * pout, const unsigned char * pin, int count, int step, BYTE tr, BYTE tg, BYTE tb) +void iCopyColors(unsigned char * pout, const unsigned char * pin, int count, int step, uint8_t tr, uint8_t tg, uint8_t tb) { int i; unsigned char a; @@ -58,7 +58,7 @@ void iCopyColors(unsigned char * pout, const unsigned char * pin, int count, int } } -typedef void (*CopyFunc)(unsigned char * pout, const unsigned char * pin, int count, int step, BYTE tr, BYTE tg, BYTE tb); +typedef void (*CopyFunc)(unsigned char * pout, const unsigned char * pin, int count, int step, uint8_t tr, uint8_t tg, uint8_t tb); static CopyFunc copyfuncs[]={ iCopyColors, @@ -81,15 +81,15 @@ static CopyFunc copyfuncs[]={ // //=========================================================================== void FGLBitmap::CopyPixelDataRGB(int originx, int originy, - const BYTE * patch, int srcwidth, int srcheight, int step_x, int step_y, + const uint8_t * patch, int srcwidth, int srcheight, int step_x, int step_y, int rotate, int ct, FCopyInfo *inf, int r, int g, int b) { if (ClipCopyPixelRect(&ClipRect, originx, originy, patch, srcwidth, srcheight, step_x, step_y, rotate)) { - BYTE *buffer = GetPixels() + 4*originx + Pitch*originy; + uint8_t *buffer = GetPixels() + 4*originx + Pitch*originy; for (int y=0;y 0) { diff --git a/src/gl/textures/gl_bitmap.h b/src/gl/textures/gl_bitmap.h index 3c045e5ad7..0ac0f5c670 100644 --- a/src/gl/textures/gl_bitmap.h +++ b/src/gl/textures/gl_bitmap.h @@ -14,7 +14,7 @@ public: FGLBitmap() { } - FGLBitmap(BYTE *buffer, int pitch, int width, int height) + FGLBitmap(uint8_t *buffer, int pitch, int width, int height) : FBitmap(buffer, pitch, width, height) { } @@ -25,11 +25,11 @@ public: alphatrans = _alphatrans; } - virtual void CopyPixelDataRGB(int originx, int originy, const BYTE *patch, int srcwidth, + virtual void CopyPixelDataRGB(int originx, int originy, const uint8_t *patch, int srcwidth, int srcheight, int step_x, int step_y, int rotate, int ct, FCopyInfo *inf = NULL, /* for PNG tRNS */ int r=0, int g=0, int b=0); - virtual void CopyPixelData(int originx, int originy, const BYTE * patch, int srcwidth, int srcheight, + virtual void CopyPixelData(int originx, int originy, const uint8_t * patch, int srcwidth, int srcheight, int step_x, int step_y, int rotate, PalEntry * palette, FCopyInfo *inf = NULL); }; diff --git a/src/gl/textures/gl_hirestex.cpp b/src/gl/textures/gl_hirestex.cpp index b00e550a1a..67287ced0e 100644 --- a/src/gl/textures/gl_hirestex.cpp +++ b/src/gl/textures/gl_hirestex.cpp @@ -110,7 +110,7 @@ int CheckDDPK3(FTexture *tex) FString checkName; const char ** checklist; - BYTE useType=tex->UseType; + uint8_t useType=tex->UseType; if (useType==FTexture::TEX_SkinSprite || useType==FTexture::TEX_Decal || useType==FTexture::TEX_FontChar) { @@ -291,7 +291,7 @@ int CheckExternalFile(FTexture *tex, bool & hascolorkey) FString checkName; const char ** checklist; - BYTE useType=tex->UseType; + uint8_t useType=tex->UseType; if (useType==FTexture::TEX_SkinSprite || useType==FTexture::TEX_Decal || useType==FTexture::TEX_FontChar) { diff --git a/src/gl/textures/gl_material.h b/src/gl/textures/gl_material.h index 671d8c694b..f93e784f4d 100644 --- a/src/gl/textures/gl_material.h +++ b/src/gl/textures/gl_material.h @@ -65,7 +65,7 @@ private: bool bHasColorkey; // only for hires bool bExpandFlag; - BYTE lastSampler; + uint8_t lastSampler; int lastTranslation; unsigned char * LoadHiresTexture(FTexture *hirescheck, int *width, int *height); diff --git a/src/gl/textures/gl_samplers.cpp b/src/gl/textures/gl_samplers.cpp index d9d2d07005..df1d105397 100644 --- a/src/gl/textures/gl_samplers.cpp +++ b/src/gl/textures/gl_samplers.cpp @@ -84,7 +84,7 @@ void FSamplerManager::UnbindAll() } } -BYTE FSamplerManager::Bind(int texunit, int num, int lastval) +uint8_t FSamplerManager::Bind(int texunit, int num, int lastval) { if (gl.flags & RFL_SAMPLER_OBJECTS) { diff --git a/src/gl/textures/gl_samplers.h b/src/gl/textures/gl_samplers.h index b74d49a337..0783e5aefe 100644 --- a/src/gl/textures/gl_samplers.h +++ b/src/gl/textures/gl_samplers.h @@ -16,7 +16,7 @@ public: FSamplerManager(); ~FSamplerManager(); - BYTE Bind(int texunit, int num, int lastval); + uint8_t Bind(int texunit, int num, int lastval); void SetTextureFilterMode(); diff --git a/src/gl/textures/gl_skyboxtexture.cpp b/src/gl/textures/gl_skyboxtexture.cpp index 2f7328e281..acf74da4b0 100644 --- a/src/gl/textures/gl_skyboxtexture.cpp +++ b/src/gl/textures/gl_skyboxtexture.cpp @@ -59,7 +59,7 @@ FSkyBox::~FSkyBox() // //----------------------------------------------------------------------------- -const BYTE *FSkyBox::GetColumn (unsigned int column, const Span **spans_out) +const uint8_t *FSkyBox::GetColumn (unsigned int column, const Span **spans_out) { if (faces[0]) return faces[0]->GetColumn(column, spans_out); return NULL; @@ -71,7 +71,7 @@ const BYTE *FSkyBox::GetColumn (unsigned int column, const Span **spans_out) // //----------------------------------------------------------------------------- -const BYTE *FSkyBox::GetPixels () +const uint8_t *FSkyBox::GetPixels () { if (faces[0]) return faces[0]->GetPixels(); return NULL; diff --git a/src/gl/textures/gl_skyboxtexture.h b/src/gl/textures/gl_skyboxtexture.h index 28a052be94..deca1496df 100644 --- a/src/gl/textures/gl_skyboxtexture.h +++ b/src/gl/textures/gl_skyboxtexture.h @@ -16,8 +16,8 @@ public: FSkyBox(); ~FSkyBox(); - 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 (); int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf); bool UseBasePalette(); void Unload (); diff --git a/src/gl/textures/gl_texture.cpp b/src/gl/textures/gl_texture.cpp index 2b338513a5..c87db7e3d3 100644 --- a/src/gl/textures/gl_texture.cpp +++ b/src/gl/textures/gl_texture.cpp @@ -267,7 +267,7 @@ void FTexture::CreateDefaultBrightmap() ) { // May have one - let's check when we use this texture - const BYTE *texbuf = GetPixels(); + const uint8_t *texbuf = GetPixels(); const int white = ColorMatcher.Pick(255,255,255); int size = GetWidth() * GetHeight(); @@ -556,13 +556,13 @@ FBrightmapTexture::~FBrightmapTexture () { } -const BYTE *FBrightmapTexture::GetColumn (unsigned int column, const Span **spans_out) +const uint8_t *FBrightmapTexture::GetColumn (unsigned int column, const Span **spans_out) { // not needed return NULL; } -const BYTE *FBrightmapTexture::GetPixels () +const uint8_t *FBrightmapTexture::GetPixels () { // not needed return NULL; diff --git a/src/gl/textures/gl_texture.h b/src/gl/textures/gl_texture.h index 455678f859..ebdaa16b85 100644 --- a/src/gl/textures/gl_texture.h +++ b/src/gl/textures/gl_texture.h @@ -9,8 +9,8 @@ public: FBrightmapTexture (FTexture *source); ~FBrightmapTexture (); - 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 (); int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf); @@ -18,7 +18,7 @@ public: protected: FTexture *SourcePic; - //BYTE *Pixels; + //uint8_t *Pixels; //Span **Spans; }; diff --git a/src/gl/textures/gl_translate.cpp b/src/gl/textures/gl_translate.cpp index 5a6ecbea2c..20a58e22cf 100644 --- a/src/gl/textures/gl_translate.cpp +++ b/src/gl/textures/gl_translate.cpp @@ -46,7 +46,7 @@ bool GLTranslationPalette::Update() memset(pd.pe, 0, sizeof(pd.pe)); memcpy(pd.pe, remap->Palette, remap->NumEntries * sizeof(*remap->Palette)); - pd.crc32 = CalcCRC32((BYTE*)pd.pe, sizeof(pd.pe)); + pd.crc32 = CalcCRC32((uint8_t*)pd.pe, sizeof(pd.pe)); for(unsigned int i=0;i< AllPalettes.Size(); i++) { if (pd.crc32 == AllPalettes[i].crc32) diff --git a/src/gl/unused/gl_sections.cpp b/src/gl/unused/gl_sections.cpp index 34858bd3a6..08a68be8e8 100644 --- a/src/gl/unused/gl_sections.cpp +++ b/src/gl/unused/gl_sections.cpp @@ -79,8 +79,8 @@ class FSectionCreator { static FSectionCreator *creator; - BYTE *processed_segs; - BYTE *processed_subsectors; + uint8_t *processed_segs; + uint8_t *processed_subsectors; int *section_for_segs; vertex_t *v1_l1, *v2_l1; @@ -97,8 +97,8 @@ public: FSectionCreator() { - processed_segs = new BYTE[(numsegs+7)/8]; - processed_subsectors = new BYTE[(numsubsectors+7)/8]; + processed_segs = new uint8_t[(numsegs+7)/8]; + processed_subsectors = new uint8_t[(numsubsectors+7)/8]; memset(processed_segs, 0, (numsegs+7)/8); memset(processed_subsectors, 0, (numsubsectors+7)/8); diff --git a/src/m_random.h b/src/m_random.h index c82c77a62d..250d88d133 100644 --- a/src/m_random.h +++ b/src/m_random.h @@ -90,9 +90,9 @@ public: // SFMT interface unsigned int GenRand32(); - QWORD GenRand64(); + uint64_t GenRand64(); void FillArray32(uint32_t *array, int size); - void FillArray64(QWORD *array, int size); + void FillArray64(uint64_t *array, int size); void InitGenRand(uint32_t seed); void InitByArray(uint32_t *init_key, int key_length); int GetMinArraySize32(); @@ -140,7 +140,7 @@ public: /** These real versions are due to Isaku Wada */ /** generates a random number on [0,1) with 53-bit resolution*/ - static inline double ToRes53(QWORD v) + static inline double ToRes53(uint64_t v) { return v * (1.0/18446744073709551616.0L); } @@ -149,7 +149,7 @@ public: * 32 bit integers */ static inline double ToRes53Mix(uint32_t x, uint32_t y) { - return ToRes53(x | ((QWORD)y << 32)); + return ToRes53(x | ((uint64_t)y << 32)); } /** generates a random number on [0,1) with 53-bit resolution @@ -204,7 +204,7 @@ private: { w128_t w128[SFMT::N]; unsigned int u[SFMT::N32]; - QWORD u64[SFMT::N64]; + uint64_t u64[SFMT::N64]; } sfmt; /** index counter to the 32-bit internal state array */ int idx; diff --git a/src/oplsynth/OPL3.cpp b/src/oplsynth/OPL3.cpp index a71f12f2b0..a6db55a0f4 100644 --- a/src/oplsynth/OPL3.cpp +++ b/src/oplsynth/OPL3.cpp @@ -523,7 +523,7 @@ namespace EnvelopeGeneratorData class OPL3 : public OPLEmul { public: - BYTE registers[0x200]; + uint8_t registers[0x200]; Operator *operators[2][0x20]; Channel2op *channels2op[2][9]; diff --git a/src/p_setup.cpp b/src/p_setup.cpp index edab7add78..c464a13862 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -3276,7 +3276,7 @@ void P_LoadReject (MapData * map, bool junk) if (qwords > 0) { - const QWORD *qreject = (const QWORD *)rejectmatrix; + const uint64_t *qreject = (const uint64_t *)rejectmatrix; i = 0; do diff --git a/src/polyrenderer/scene/poly_cull.cpp b/src/polyrenderer/scene/poly_cull.cpp index 38f1502225..e46e897931 100644 --- a/src/polyrenderer/scene/poly_cull.cpp +++ b/src/polyrenderer/scene/poly_cull.cpp @@ -64,7 +64,7 @@ void PolyCull::CullNode(void *node) node = bsp->children[side]; } - subsector_t *sub = (subsector_t *)((BYTE *)node - 1); + subsector_t *sub = (subsector_t *)((uint8_t *)node - 1); CullSubsector(sub); } diff --git a/src/polyrenderer/scene/poly_playersprite.cpp b/src/polyrenderer/scene/poly_playersprite.cpp index 6ec53f325f..0288725a93 100644 --- a/src/polyrenderer/scene/poly_playersprite.cpp +++ b/src/polyrenderer/scene/poly_playersprite.cpp @@ -411,7 +411,7 @@ void PolyScreenSprite::Render() Colormap->Desaturate == 0) { overlay = Colormap->Fade; - overlay.a = BYTE(ColormapNum * 255 / NUMCOLORMAPS); + overlay.a = uint8_t(ColormapNum * 255 / NUMCOLORMAPS); } else { diff --git a/src/polyrenderer/scene/poly_scene.cpp b/src/polyrenderer/scene/poly_scene.cpp index 1255376786..95e866bc29 100644 --- a/src/polyrenderer/scene/poly_scene.cpp +++ b/src/polyrenderer/scene/poly_scene.cpp @@ -177,7 +177,7 @@ void RenderPolyScene::RenderSprite(AActor *thing, double sortDistance, DVector2 node = bsp->children[sideLeft]; } - subsector_t *sub = (subsector_t *)((BYTE *)node - 1); + subsector_t *sub = (subsector_t *)((uint8_t *)node - 1); auto it = SubsectorDepths.find(sub); if (it != SubsectorDepths.end()) diff --git a/src/posix/cocoa/st_console.mm b/src/posix/cocoa/st_console.mm index b037fe6dd5..e1d405f59f 100644 --- a/src/posix/cocoa/st_console.mm +++ b/src/posix/cocoa/st_console.mm @@ -40,7 +40,7 @@ #include "version.h" -static NSColor* RGB(const BYTE red, const BYTE green, const BYTE blue) +static NSColor* RGB(const uint8_t red, const uint8_t green, const uint8_t blue) { return [NSColor colorWithCalibratedRed:red / 255.0f green:green / 255.0f @@ -250,7 +250,7 @@ void FConsoleWindow::AddText(const char* message) if (TEXTCOLOR_ESCAPE == *message) { - const BYTE* colorID = reinterpret_cast(message) + 1; + const uint8_t* colorID = reinterpret_cast(message) + 1; if ('\0' == *colorID) { break; diff --git a/src/posix/sdl/i_gui.cpp b/src/posix/sdl/i_gui.cpp index 37a3b1062f..b757ef2538 100644 --- a/src/posix/sdl/i_gui.cpp +++ b/src/posix/sdl/i_gui.cpp @@ -26,7 +26,7 @@ bool I_SetCursor(FTexture *cursorpic) cursorSurface = SDL_CreateRGBSurface (0, 32, 32, 32, MAKEARGB(0,255,0,0), MAKEARGB(0,0,255,0), MAKEARGB(0,0,0,255), MAKEARGB(255,0,0,0)); SDL_LockSurface(cursorSurface); - BYTE buffer[32*32*4]; + uint8_t buffer[32*32*4]; memset(buffer, 0, 32*32*4); FBitmap bmp(buffer, 32*4, 32, 32); cursorpic->CopyTrueColorPixels(&bmp, 0, 0); diff --git a/src/posix/sdl/i_joystick.cpp b/src/posix/sdl/i_joystick.cpp index d99caeca9d..0f1b62ac49 100644 --- a/src/posix/sdl/i_joystick.cpp +++ b/src/posix/sdl/i_joystick.cpp @@ -139,7 +139,7 @@ public: void ProcessInput() { - BYTE buttonstate; + uint8_t buttonstate; for (int i = 0; i < NumAxes; ++i) { @@ -206,7 +206,7 @@ protected: float Multiplier; EJoyAxis GameAxis; double Value; - BYTE ButtonValue; + uint8_t ButtonValue; }; static const EJoyAxis DefaultAxes[5]; diff --git a/src/posix/sdl/sdlglvideo.h b/src/posix/sdl/sdlglvideo.h index 6d60e1c0be..de37abbf4b 100644 --- a/src/posix/sdl/sdlglvideo.h +++ b/src/posix/sdl/sdlglvideo.h @@ -81,7 +81,7 @@ protected: void InitializeState(); SDLGLFB () {} - BYTE GammaTable[3][256]; + uint8_t GammaTable[3][256]; bool UpdatePending; SDL_Window *Screen; diff --git a/src/posix/sdl/sdlvideo.h b/src/posix/sdl/sdlvideo.h index 86241538de..001d6c0880 100644 --- a/src/posix/sdl/sdlvideo.h +++ b/src/posix/sdl/sdlvideo.h @@ -34,7 +34,7 @@ public: private: PalEntry SourcePalette[256]; - BYTE GammaTable[3][256]; + uint8_t GammaTable[3][256]; PalEntry Flash; int FlashAmount; float Gamma; diff --git a/src/r_data/colormaps.cpp b/src/r_data/colormaps.cpp index 659470a234..209221d934 100644 --- a/src/r_data/colormaps.cpp +++ b/src/r_data/colormaps.cpp @@ -54,7 +54,7 @@ #include "r_utility.h" #include "r_renderer.h" -static bool R_CheckForFixedLights(const BYTE *colormaps); +static bool R_CheckForFixedLights(const uint8_t *colormaps); extern "C" { @@ -79,7 +79,7 @@ size_t numfakecmaps; TArray SpecialColormaps; -BYTE DesaturateColormap[31][256]; +uint8_t DesaturateColormap[31][256]; struct FSpecialColormapParameters { @@ -210,7 +210,7 @@ FDynamicColormap *GetSpecialLights (PalEntry color, PalEntry fade, int desaturat if (Renderer->UsesColormap()) { - colormap->Maps = new BYTE[NUMCOLORMAPS*256]; + colormap->Maps = new uint8_t[NUMCOLORMAPS*256]; colormap->BuildLights (); } else colormap->Maps = NULL; @@ -248,7 +248,7 @@ void FDynamicColormap::BuildLights () int l, c; int lr, lg, lb, ld, ild; PalEntry colors[256], basecolors[256]; - BYTE *shade; + uint8_t *shade; if (Maps == NULL) return; @@ -376,7 +376,7 @@ void FDynamicColormap::RebuildAllLights() { if (cm->Maps == NULL) { - cm->Maps = new BYTE[NUMCOLORMAPS*256]; + cm->Maps = new uint8_t[NUMCOLORMAPS*256]; cm->BuildLights (); } } @@ -394,9 +394,9 @@ void R_SetDefaultColormap (const char *name) if (strnicmp (fakecmaps[0].name, name, 8) != 0) { int lump, i, j; - BYTE map[256]; - BYTE unremap[256]; - BYTE remap[256]; + uint8_t map[256]; + uint8_t unremap[256]; + uint8_t remap[256]; lump = Wads.CheckNumForFullName (name, true, ns_colormaps); if (lump == -1) @@ -432,7 +432,7 @@ void R_SetDefaultColormap (const char *name) remap[0] = 0; for (i = 0; i < NUMCOLORMAPS; ++i) { - BYTE *map2 = &realcolormaps.Maps[i*256]; + uint8_t *map2 = &realcolormaps.Maps[i*256]; lumpr.Read (map, 256); for (j = 0; j < 256; ++j) { @@ -504,12 +504,12 @@ void R_InitColormaps () } } } - realcolormaps.Maps = new BYTE[256*NUMCOLORMAPS*fakecmaps.Size()]; + realcolormaps.Maps = new uint8_t[256*NUMCOLORMAPS*fakecmaps.Size()]; R_SetDefaultColormap ("COLORMAP"); if (fakecmaps.Size() > 1) { - BYTE unremap[256], remap[256], mapin[256]; + uint8_t unremap[256], remap[256], mapin[256]; int i; unsigned j; @@ -526,11 +526,11 @@ void R_InitColormaps () { int k, r, g, b; FWadLump lump = Wads.OpenLumpNum (fakecmaps[j].lump); - BYTE *const map = realcolormaps.Maps + NUMCOLORMAPS*256*j; + uint8_t *const map = realcolormaps.Maps + NUMCOLORMAPS*256*j; for (k = 0; k < NUMCOLORMAPS; ++k) { - BYTE *map2 = &map[k*256]; + uint8_t *map2 = &map[k*256]; lump.Read (mapin, 256); map2[0] = 0; for (r = 1; r < 256; ++r) @@ -555,7 +555,7 @@ void R_InitColormaps () // [SP] Create a copy of the colormap if (!realfbcolormaps.Maps) { - realfbcolormaps.Maps = new BYTE[256*NUMCOLORMAPS*fakecmaps.Size()]; + realfbcolormaps.Maps = new uint8_t[256*NUMCOLORMAPS*fakecmaps.Size()]; memcpy(realfbcolormaps.Maps, realcolormaps.Maps, 256*NUMCOLORMAPS*fakecmaps.Size()); } @@ -579,7 +579,7 @@ void R_InitColormaps () // desaturated colormaps. These are used for texture composition for(int m = 0; m < 31; m++) { - BYTE *shade = DesaturateColormap[m]; + uint8_t *shade = DesaturateColormap[m]; for (int c = 0; c < 256; c++) { int intensity = (GPalette.BaseColors[c].r * 77 + @@ -603,10 +603,10 @@ void R_InitColormaps () // //========================================================================== -static bool R_CheckForFixedLights(const BYTE *colormaps) +static bool R_CheckForFixedLights(const uint8_t *colormaps) { - const BYTE *lastcolormap = colormaps + (NUMCOLORMAPS - 1) * 256; - BYTE freq[256]; + const uint8_t *lastcolormap = colormaps + (NUMCOLORMAPS - 1) * 256; + uint8_t freq[256]; int i, j; // Count the frequencies of different colors in the final colormap. @@ -623,7 +623,7 @@ static bool R_CheckForFixedLights(const BYTE *colormaps) // final coloramp. for (i = 255; i >= 0; --i) { - BYTE color = lastcolormap[i]; + uint8_t color = lastcolormap[i]; if (freq[color] > 10) // arbitrary number to decide "common" colors { continue; diff --git a/src/r_data/colormaps.h b/src/r_data/colormaps.h index 9f50fb3081..4154a4189f 100644 --- a/src/r_data/colormaps.h +++ b/src/r_data/colormaps.h @@ -14,7 +14,7 @@ extern size_t numfakecmaps; struct FSWColormap { - BYTE *Maps = nullptr; + uint8_t *Maps = nullptr; PalEntry Color = 0xffffffff; PalEntry Fade = 0xff000000; int Desaturate = 0; @@ -57,7 +57,7 @@ struct FSpecialColormap : FSWColormap float ColorizeStart[3]; float ColorizeEnd[3]; - BYTE Colormap[256]; + uint8_t Colormap[256]; PalEntry GrayscaleToColor[256]; }; @@ -76,7 +76,7 @@ int AddSpecialColormap(float r1, float g1, float b1, float r2, float g2, float b -extern BYTE DesaturateColormap[31][256]; +extern uint8_t DesaturateColormap[31][256]; extern "C" { extern FDynamicColormap NormalLight; diff --git a/src/r_data/voxels.cpp b/src/r_data/voxels.cpp index 3f2f093ecc..70fcc9a3b1 100644 --- a/src/r_data/voxels.cpp +++ b/src/r_data/voxels.cpp @@ -91,10 +91,10 @@ struct VoxelOptions // //========================================================================== -static BYTE *GetVoxelRemap(const BYTE *pal) +static uint8_t *GetVoxelRemap(const uint8_t *pal) { - static BYTE remap[256]; - static BYTE oldpal[768]; + static uint8_t remap[256]; + static uint8_t oldpal[768]; static bool firsttime = true; if (firsttime || memcmp(oldpal, pal, 768) != 0) @@ -142,8 +142,8 @@ static bool CopyVoxelSlabs(kvxslab_t *dest, const kvxslab_t *src, int size) dest->col[j] = src->col[j]; } slabzleng += 3; - src = (kvxslab_t *)((BYTE *)src + slabzleng); - dest = (kvxslab_t *)((BYTE *)dest + slabzleng); + src = (kvxslab_t *)((uint8_t *)src + slabzleng); + dest = (kvxslab_t *)((uint8_t *)dest + slabzleng); size -= slabzleng; } return true; @@ -157,7 +157,7 @@ static bool CopyVoxelSlabs(kvxslab_t *dest, const kvxslab_t *src, int size) // //========================================================================== -static void RemapVoxelSlabs(kvxslab_t *dest, int size, const BYTE *remap) +static void RemapVoxelSlabs(kvxslab_t *dest, int size, const uint8_t *remap) { while (size >= 3) { @@ -168,7 +168,7 @@ static void RemapVoxelSlabs(kvxslab_t *dest, int size, const BYTE *remap) dest->col[j] = remap[dest->col[j]]; } slabzleng += 3; - dest = (kvxslab_t *)((BYTE *)dest + slabzleng); + dest = (kvxslab_t *)((uint8_t *)dest + slabzleng); size -= slabzleng; } } @@ -183,12 +183,12 @@ FVoxel *R_LoadKVX(int lumpnum) { const kvxslab_t *slabs[MAXVOXMIPS]; FVoxel *voxel = new FVoxel; - const BYTE *rawmip; + const uint8_t *rawmip; int mip, maxmipsize; int i, j, n; FMemLump lump = Wads.ReadLump(lumpnum); // FMemLump adds an extra 0 byte to the end. - BYTE *rawvoxel = (BYTE *)lump.GetMem(); + uint8_t *rawvoxel = (uint8_t *)lump.GetMem(); int voxelsize = (int)(lump.GetSize()-1); // Oh, KVX, why couldn't you have a proper header? We'll just go through @@ -229,7 +229,7 @@ FVoxel *R_LoadKVX(int lumpnum) // Allocate slab data space. mipl->OffsetX = new int[(numbytes - 24 + 3) / 4]; mipl->OffsetXY = (short *)(mipl->OffsetX + mipl->SizeX + 1); - mipl->SlabData = (BYTE *)(mipl->OffsetXY + mipl->SizeX * (mipl->SizeY + 1)); + mipl->SlabData = (uint8_t *)(mipl->OffsetXY + mipl->SizeX * (mipl->SizeY + 1)); // Load x offsets. for (i = 0, n = mipl->SizeX; i <= n; ++i) @@ -313,7 +313,7 @@ FVoxel *R_LoadKVX(int lumpnum) } voxel->LumpNum = lumpnum; - voxel->Palette = new BYTE[768]; + voxel->Palette = new uint8_t[768]; memcpy(voxel->Palette, rawvoxel + voxelsize - 768, 768); return voxel; @@ -432,7 +432,7 @@ void FVoxel::CreateBgraSlabData() slabzleng += 3; dest = (kvxslab_bgra_t *)((uint32_t *)dest + slabzleng); - src = (kvxslab_t *)((BYTE *)src + slabzleng); + src = (kvxslab_t *)((uint8_t *)src + slabzleng); size -= slabzleng; } } @@ -448,7 +448,7 @@ void FVoxel::Remap() { if (Palette != NULL) { - BYTE *remap = GetVoxelRemap(Palette); + uint8_t *remap = GetVoxelRemap(Palette); for (int i = 0; i < NumMips; ++i) { RemapVoxelSlabs((kvxslab_t *)Mips[i].SlabData, Mips[i].OffsetX[Mips[i].SizeX], remap); diff --git a/src/r_data/voxels.h b/src/r_data/voxels.h index df5839836a..57ae41a1f6 100644 --- a/src/r_data/voxels.h +++ b/src/r_data/voxels.h @@ -9,10 +9,10 @@ struct kvxslab_t { - BYTE ztop; // starting z coordinate of top of slab - BYTE zleng; // # of bytes in the color array - slab height - BYTE backfacecull; // low 6 bits tell which of 6 faces are exposed - BYTE col[1/*zleng*/];// color data from top to bottom + uint8_t ztop; // starting z coordinate of top of slab + uint8_t zleng; // # of bytes in the color array - slab height + uint8_t backfacecull; // low 6 bits tell which of 6 faces are exposed + uint8_t col[1/*zleng*/];// color data from top to bottom }; struct kvxslab_bgra_t @@ -34,7 +34,7 @@ struct FVoxelMipLevel DVector3 Pivot; int *OffsetX; short *OffsetXY; - BYTE *SlabData; + uint8_t *SlabData; TArray SlabDataBgra; }; @@ -43,7 +43,7 @@ struct FVoxel int LumpNum; int NumMips; int VoxelIndex; // Needed by GZDoom - BYTE *Palette; + uint8_t *Palette; FVoxelMipLevel Mips[MAXVOXMIPS]; FVoxel(); diff --git a/src/r_renderer.h b/src/r_renderer.h index 9f1e94428e..922ccabec7 100644 --- a/src/r_renderer.h +++ b/src/r_renderer.h @@ -29,7 +29,7 @@ struct FRenderer virtual bool UsesColormap() const = 0; // precache one texture - virtual void Precache(BYTE *texhitlist, TMap &actorhitlist) = 0; + virtual void Precache(uint8_t *texhitlist, TMap &actorhitlist) = 0; // render 3D view virtual void RenderView(player_t *player) = 0; diff --git a/src/resourcefiles/resourcefile.h b/src/resourcefiles/resourcefile.h index a36d6ad490..dbcc1dceee 100644 --- a/src/resourcefiles/resourcefile.h +++ b/src/resourcefiles/resourcefile.h @@ -41,7 +41,7 @@ struct FResourceLump char Name[9]; uint32_t dwName; // These are for accessing the first 4 or 8 chars of - QWORD qwName; // Name as a unit without breaking strict aliasing rules + uint64_t qwName; // Name as a unit without breaking strict aliasing rules }; uint8_t Flags; int8_t RefCount; diff --git a/src/s_sound.cpp b/src/s_sound.cpp index 544149ca3a..22f81a5292 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -2353,7 +2353,7 @@ void S_SerializeSounds(FSerializer &arc) for (unsigned int i = chans.Size(); i-- != 0; ) { // Replace start time with sample position. - QWORD start = chans[i]->StartTime.AsOne; + uint64_t start = chans[i]->StartTime.AsOne; chans[i]->StartTime.AsOne = GSnd ? GSnd->GetPosition(chans[i]) : 0; arc(nullptr, *chans[i]); chans[i]->StartTime.AsOne = start; diff --git a/src/sfmt/SFMT.cpp b/src/sfmt/SFMT.cpp index aaece85754..102497a8c0 100644 --- a/src/sfmt/SFMT.cpp +++ b/src/sfmt/SFMT.cpp @@ -81,10 +81,10 @@ inline static int idxof(int i) { */ #ifdef ONLY64 inline static void rshift128(w128_t *out, w128_t const *in, int shift) { - QWORD th, tl, oh, ol; + uint64_t th, tl, oh, ol; - th = ((QWORD)in->u[2] << 32) | ((QWORD)in->u[3]); - tl = ((QWORD)in->u[0] << 32) | ((QWORD)in->u[1]); + th = ((uint64_t)in->u[2] << 32) | ((uint64_t)in->u[3]); + tl = ((uint64_t)in->u[0] << 32) | ((uint64_t)in->u[1]); oh = th >> (shift * 8); ol = tl >> (shift * 8); @@ -96,10 +96,10 @@ inline static void rshift128(w128_t *out, w128_t const *in, int shift) { } #else inline static void rshift128(w128_t *out, w128_t const *in, int shift) { - QWORD th, tl, oh, ol; + uint64_t th, tl, oh, ol; - th = ((QWORD)in->u[3] << 32) | ((QWORD)in->u[2]); - tl = ((QWORD)in->u[1] << 32) | ((QWORD)in->u[0]); + th = ((uint64_t)in->u[3] << 32) | ((uint64_t)in->u[2]); + tl = ((uint64_t)in->u[1] << 32) | ((uint64_t)in->u[0]); oh = th >> (shift * 8); ol = tl >> (shift * 8); @@ -120,10 +120,10 @@ inline static void rshift128(w128_t *out, w128_t const *in, int shift) { */ #ifdef ONLY64 inline static void lshift128(w128_t *out, w128_t const *in, int shift) { - QWORD th, tl, oh, ol; + uint64_t th, tl, oh, ol; - th = ((QWORD)in->u[2] << 32) | ((QWORD)in->u[3]); - tl = ((QWORD)in->u[0] << 32) | ((QWORD)in->u[1]); + th = ((uint64_t)in->u[2] << 32) | ((uint64_t)in->u[3]); + tl = ((uint64_t)in->u[0] << 32) | ((uint64_t)in->u[1]); oh = th << (shift * 8); ol = tl << (shift * 8); @@ -135,10 +135,10 @@ inline static void lshift128(w128_t *out, w128_t const *in, int shift) { } #else inline static void lshift128(w128_t *out, w128_t const *in, int shift) { - QWORD th, tl, oh, ol; + uint64_t th, tl, oh, ol; - th = ((QWORD)in->u[3] << 32) | ((QWORD)in->u[2]); - tl = ((QWORD)in->u[1] << 32) | ((QWORD)in->u[0]); + th = ((uint64_t)in->u[3] << 32) | ((uint64_t)in->u[2]); + tl = ((uint64_t)in->u[1] << 32) | ((uint64_t)in->u[0]); oh = th << (shift * 8); ol = tl << (shift * 8); @@ -379,12 +379,12 @@ unsigned int FRandom::GenRand32() * unless an initialization is again executed. * @return 64-bit pseudorandom number */ -QWORD FRandom::GenRand64() +uint64_t FRandom::GenRand64() { #if defined(BIG_ENDIAN64) && !defined(ONLY64) uint32_t r1, r2; #else - QWORD r; + uint64_t r; #endif assert(initialized); @@ -399,7 +399,7 @@ QWORD FRandom::GenRand64() r1 = sfmt.u[idx]; r2 = sfmt.u[idx + 1]; idx += 2; - return ((QWORD)r2 << 32) | r1; + return ((uint64_t)r2 << 32) | r1; #else r = sfmt.u64[idx / 2]; idx += 2; @@ -470,7 +470,7 @@ void FRandom::FillArray32(uint32_t *array, int size) * memory. Mac OSX doesn't have these functions, but \b malloc of OSX * returns the pointer to the aligned memory block. */ -void FRandom::FillArray64(QWORD *array, int size) +void FRandom::FillArray64(uint64_t *array, int size) { assert(initialized); assert(idx == SFMT::N32); diff --git a/src/sfmt/SFMT.h b/src/sfmt/SFMT.h index 72c9901867..ddaabf2461 100644 --- a/src/sfmt/SFMT.h +++ b/src/sfmt/SFMT.h @@ -68,7 +68,7 @@ union w128_t { vector unsigned int s; uint32_t u[4]; - QWORD u64[2]; + uint64_t u64[2]; }; #elif defined(HAVE_SSE2) @@ -78,7 +78,7 @@ union w128_t { union w128_t { __m128i si; uint32_t u[4]; - QWORD u64[2]; + uint64_t u64[2]; }; #else @@ -86,7 +86,7 @@ union w128_t { /** 128-bit data structure */ union w128_t { uint32_t u[4]; - QWORD u64[2]; + uint64_t u64[2]; }; #endif diff --git a/src/sound/fmodsound.cpp b/src/sound/fmodsound.cpp index db9f888877..82d518984d 100644 --- a/src/sound/fmodsound.cpp +++ b/src/sound/fmodsound.cpp @@ -2203,11 +2203,11 @@ bool FMODSoundRenderer::HandleChannelDelay(FMOD::Channel *chan, FISoundChannel * { chan->setPosition(seekpos, FMOD_TIMEUNIT_PCM); } - reuse_chan->StartTime.AsOne = QWORD(nowtime.AsOne - seekpos * OutputRate / freq); + reuse_chan->StartTime.AsOne = uint64_t(nowtime.AsOne - seekpos * OutputRate / freq); } else if (reuse_chan->StartTime.AsOne != 0) { - QWORD difftime = nowtime.AsOne - reuse_chan->StartTime.AsOne; + uint64_t difftime = nowtime.AsOne - reuse_chan->StartTime.AsOne; if (difftime > 0) { // Clamp the position of looping sounds to be within the sound. @@ -2743,7 +2743,7 @@ void FMODSoundRenderer::UpdateSounds() // //========================================================================== -std::pair FMODSoundRenderer::LoadSoundRaw(BYTE *sfxdata, int length, int frequency, int channels, int bits, int loopstart, int loopend, bool monoize) +std::pair FMODSoundRenderer::LoadSoundRaw(uint8_t *sfxdata, int length, int frequency, int channels, int bits, int loopstart, int loopend, bool monoize) { FMOD_CREATESOUNDEXINFO exinfo; SoundHandle retval = { NULL }; @@ -2825,7 +2825,7 @@ std::pair FMODSoundRenderer::LoadSoundRaw(BYTE *sfxdata, int l // //========================================================================== -std::pair FMODSoundRenderer::LoadSound(BYTE *sfxdata, int length, bool monoize) +std::pair FMODSoundRenderer::LoadSound(uint8_t *sfxdata, int length, bool monoize) { FMOD_CREATESOUNDEXINFO exinfo; SoundHandle retval = { NULL }; @@ -3382,7 +3382,7 @@ short *FMODSoundRenderer::DecodeSample(int outlen, const void *coded, int sizeby sound->release(); if (result == FMOD_ERR_FILE_EOF) { - memset((BYTE *)outbuf + amt_read, 0, len - amt_read); + memset((uint8_t *)outbuf + amt_read, 0, len - amt_read); } else if (result != FMOD_OK || amt_read != len) { diff --git a/src/sound/fmodsound.h b/src/sound/fmodsound.h index 34fdeb7ad7..de35258f64 100644 --- a/src/sound/fmodsound.h +++ b/src/sound/fmodsound.h @@ -15,8 +15,8 @@ public: void SetSfxVolume (float volume); void SetMusicVolume (float volume); - std::pair LoadSound(BYTE *sfxdata, int length, bool monoize); - std::pair LoadSoundRaw(BYTE *sfxdata, int length, int frequency, int channels, int bits, int loopstart, int loopend = -1, bool monoize = false); + std::pair LoadSound(uint8_t *sfxdata, int length, bool monoize); + std::pair LoadSoundRaw(uint8_t *sfxdata, int length, int frequency, int channels, int bits, int loopstart, int loopend = -1, bool monoize = false); void UnloadSound (SoundHandle sfx); unsigned int GetMSLength(SoundHandle sfx); unsigned int GetSampleLength(SoundHandle sfx); diff --git a/src/sound/i_music.cpp b/src/sound/i_music.cpp index 69a27a55c0..54a78189be 100644 --- a/src/sound/i_music.cpp +++ b/src/sound/i_music.cpp @@ -92,14 +92,14 @@ enum EMIDIType MIDI_MUS }; -extern int MUSHeaderSearch(const BYTE *head, int len); +extern int MUSHeaderSearch(const uint8_t *head, int len); EXTERN_CVAR (Int, snd_samplerate) EXTERN_CVAR (Int, snd_mididevice) static bool MusicDown = true; -static bool ungzip(BYTE *data, int size, TArray &newdata); +static bool ungzip(uint8_t *data, int size, TArray &newdata); MusInfo *currSong; int nomusic = 0; @@ -351,7 +351,7 @@ static EMIDIType IdentifyMIDIType(DWORD *id, int size) { // Check for MUS format // Tolerate sloppy wads by searching up to 32 bytes for the header - if (MUSHeaderSearch((BYTE*)id, size) >= 0) + if (MUSHeaderSearch((uint8_t*)id, size) >= 0) { return MIDI_MUS; } @@ -420,7 +420,7 @@ MusInfo *I_RegisterSong (FileReader *reader, MidiDeviceSetting *device) if ((id[0] & MAKE_ID(255, 255, 255, 0)) == GZIP_ID) { int len = reader->GetLength(); - BYTE *gzipped = new BYTE[len]; + uint8_t *gzipped = new uint8_t[len]; if (reader->Read(gzipped, len) != len) { delete[] gzipped; @@ -481,7 +481,7 @@ retry_as_sndsys: else if ( (id[0] == MAKE_ID('R','A','W','A') && id[1] == MAKE_ID('D','A','T','A')) || // Rdos Raw OPL (id[0] == MAKE_ID('D','B','R','A') && id[1] == MAKE_ID('W','O','P','L')) || // DosBox Raw OPL - (id[0] == MAKE_ID('A','D','L','I') && *((BYTE *)id + 4) == 'B')) // Martin Fernandez's modified IMF + (id[0] == MAKE_ID('A','D','L','I') && *((uint8_t *)id + 4) == 'B')) // Martin Fernandez's modified IMF { info = new OPLMUSSong (*reader, device != NULL? device->args.GetChars() : ""); } @@ -590,11 +590,11 @@ MusInfo *I_RegisterURLSong (const char *url) // //========================================================================== -static bool ungzip(BYTE *data, int complen, TArray &newdata) +static bool ungzip(uint8_t *data, int complen, TArray &newdata) { - const BYTE *max = data + complen - 8; - const BYTE *compstart = data + 10; - BYTE flags = data[3]; + const uint8_t *max = data + complen - 8; + const uint8_t *compstart = data + 10; + uint8_t flags = data[3]; unsigned isize; z_stream stream; int err; @@ -827,7 +827,7 @@ CCMD (writemidi) return; } - TArray midi; + TArray midi; FILE *f; bool success; diff --git a/src/sound/i_musicinterns.h b/src/sound/i_musicinterns.h index 833bdea83e..060e72e495 100644 --- a/src/sound/i_musicinterns.h +++ b/src/sound/i_musicinterns.h @@ -42,7 +42,7 @@ EXTERN_CVAR (Float, timidity_mastervolume) #ifndef _WIN32 struct MIDIHDR { - BYTE *lpData; + uint8_t *lpData; DWORD dwBufferLength; DWORD dwBytesRecorded; MIDIHDR *lpNext; @@ -59,13 +59,13 @@ enum MOD_SWSYNTH }; -typedef BYTE *LPSTR; +typedef uint8_t *LPSTR; -#define MEVT_TEMPO ((BYTE)1) -#define MEVT_NOP ((BYTE)2) -#define MEVT_LONGMSG ((BYTE)128) +#define MEVT_TEMPO ((uint8_t)1) +#define MEVT_NOP ((uint8_t)2) +#define MEVT_LONGMSG ((uint8_t)128) -#define MEVT_EVENTTYPE(x) ((BYTE)((x) >> 24)) +#define MEVT_EVENTTYPE(x) ((uint8_t)((x) >> 24)) #define MEVT_EVENTPARM(x) ((x) & 0xffffff) #define MOM_DONE 969 @@ -302,7 +302,7 @@ protected: virtual bool ServiceStream (void *buff, int numbytes); virtual void HandleEvent(int status, int parm1, int parm2) = 0; - virtual void HandleLongEvent(const BYTE *data, int len) = 0; + virtual void HandleLongEvent(const uint8_t *data, int len) = 0; virtual void ComputeOutput(float *buffer, int len) = 0; }; @@ -321,7 +321,7 @@ protected: void CalcTickRate(); int PlayTick(); void HandleEvent(int status, int parm1, int parm2); - void HandleLongEvent(const BYTE *data, int len); + void HandleLongEvent(const uint8_t *data, int len); void ComputeOutput(float *buffer, int len); bool ServiceStream(void *buff, int numbytes); }; @@ -355,7 +355,7 @@ protected: Timidity::Renderer *Renderer; void HandleEvent(int status, int parm1, int parm2); - void HandleLongEvent(const BYTE *data, int len); + void HandleLongEvent(const uint8_t *data, int len); void ComputeOutput(float *buffer, int len); }; @@ -389,7 +389,7 @@ protected: WildMidi_Renderer *Renderer; void HandleEvent(int status, int parm1, int parm2); - void HandleLongEvent(const BYTE *data, int len); + void HandleLongEvent(const uint8_t *data, int len); void ComputeOutput(float *buffer, int len); void WildMidiSetOption(int opt, int set); }; @@ -421,7 +421,7 @@ public: protected: void HandleEvent(int status, int parm1, int parm2); - void HandleLongEvent(const BYTE *data, int len); + void HandleLongEvent(const uint8_t *data, int len); void ComputeOutput(float *buffer, int len); int LoadPatchSets(const char *patches); @@ -489,7 +489,7 @@ public: void FluidSettingNum(const char *setting, double value); void FluidSettingStr(const char *setting, const char *value); void WildMidiSetOption(int opt, int set); - void CreateSMF(TArray &file, int looplimit=0); + void CreateSMF(TArray &file, int looplimit=0); protected: MIDIStreamer(const char *dumpname, EMidiDevice type); @@ -550,7 +550,7 @@ protected: int Division; int Tempo; int InitialTempo; - BYTE ChannelVolumes[16]; + uint8_t ChannelVolumes[16]; DWORD Volume; EMidiDevice DeviceType; bool CallbackIsThreaded; @@ -580,8 +580,8 @@ protected: DWORD *MakeEvents(DWORD *events, DWORD *max_events_p, DWORD max_time); MUSHeader *MusHeader; - BYTE *MusBuffer; - BYTE LastVelocity[16]; + uint8_t *MusBuffer; + uint8_t LastVelocity[16]; size_t MusP, MaxMusP; }; @@ -612,7 +612,7 @@ protected: DWORD *SendCommand (DWORD *event, TrackInfo *track, DWORD delay, ptrdiff_t room, bool &sysex_noroom); TrackInfo *FindNextDue (); - BYTE *MusHeader; + uint8_t *MusHeader; int SongLen; TrackInfo *Tracks; TrackInfo *TrackDue; @@ -626,13 +626,13 @@ protected: struct AutoNoteOff { DWORD Delay; - BYTE Channel, Key; + uint8_t Channel, Key; }; // Sorry, std::priority_queue, but I want to be able to modify the contents of the heap. class NoteOffQueue : public TArray { public: - void AddNoteOff(DWORD delay, BYTE channel, BYTE key); + void AddNoteOff(DWORD delay, uint8_t channel, uint8_t key); void AdvanceTime(DWORD time); bool Pop(AutoNoteOff &item); @@ -675,7 +675,7 @@ protected: static DWORD ReadVarLenHMI(TrackInfo *); static DWORD ReadVarLenHMP(TrackInfo *); - BYTE *MusHeader; + uint8_t *MusHeader; int SongLen; int NumTracks; TrackInfo *Tracks; @@ -702,8 +702,8 @@ protected: XMISong(const XMISong *original, const char *filename, EMidiDevice type); // file dump constructor - int FindXMIDforms(const BYTE *chunk, int len, TrackInfo *songs) const; - void FoundXMID(const BYTE *chunk, int len, TrackInfo *song) const; + int FindXMIDforms(const uint8_t *chunk, int len, TrackInfo *songs) const; + void FoundXMID(const uint8_t *chunk, int len, TrackInfo *song) const; bool SetMIDISubsong(int subsong); void DoInitialSetup(); void DoRestart(); @@ -715,7 +715,7 @@ protected: DWORD *SendCommand (DWORD *event, EventSource track, DWORD delay, ptrdiff_t room, bool &sysex_noroom); EventSource FindNextDue(); - BYTE *MusHeader; + uint8_t *MusHeader; int SongLen; // length of the entire file int NumSongs; TrackInfo *Songs; diff --git a/src/sound/i_sound.cpp b/src/sound/i_sound.cpp index ecca194e68..bd43f4f192 100644 --- a/src/sound/i_sound.cpp +++ b/src/sound/i_sound.cpp @@ -135,12 +135,12 @@ public: void SetMusicVolume (float volume) { } - std::pair LoadSound(BYTE *sfxdata, int length, bool monoize) + std::pair LoadSound(uint8_t *sfxdata, int length, bool monoize) { SoundHandle retval = { NULL }; return std::make_pair(retval, true); } - std::pair LoadSoundRaw(BYTE *sfxdata, int length, int frequency, int channels, int bits, int loopstart, int loopend, bool monoize) + std::pair LoadSoundRaw(uint8_t *sfxdata, int length, int frequency, int channels, int bits, int loopstart, int loopend, bool monoize) { SoundHandle retval = { NULL }; return std::make_pair(retval, true); @@ -461,9 +461,9 @@ FString SoundStream::GetStats() // //========================================================================== -std::pair SoundRenderer::LoadSoundVoc(BYTE *sfxdata, int length, bool monoize) +std::pair SoundRenderer::LoadSoundVoc(uint8_t *sfxdata, int length, bool monoize) { - BYTE * data = NULL; + uint8_t * data = NULL; int len, frequency, channels, bits, loopstart, loopend; len = frequency = channels = bits = 0; loopstart = loopend = -1; @@ -568,7 +568,7 @@ std::pair SoundRenderer::LoadSoundVoc(BYTE *sfxdata, int lengt // Second pass to write the data if (okay) { - data = new BYTE[len]; + data = new uint8_t[len]; i = 26; int j = 0; while (i < length) diff --git a/src/sound/i_sound.h b/src/sound/i_sound.h index db97c3555f..cd58c6f645 100644 --- a/src/sound/i_sound.h +++ b/src/sound/i_sound.h @@ -97,9 +97,9 @@ public: virtual void SetSfxVolume (float volume) = 0; virtual void SetMusicVolume (float volume) = 0; // Returns a pair containing a sound handle and a boolean indicating the sound can be used in 3D. - virtual std::pair LoadSound(BYTE *sfxdata, int length, bool monoize=false) = 0; - std::pair LoadSoundVoc(BYTE *sfxdata, int length, bool monoize=false); - virtual std::pair LoadSoundRaw(BYTE *sfxdata, int length, int frequency, int channels, int bits, int loopstart, int loopend = -1, bool monoize = false) = 0; + virtual std::pair LoadSound(uint8_t *sfxdata, int length, bool monoize=false) = 0; + std::pair LoadSoundVoc(uint8_t *sfxdata, int length, bool monoize=false); + virtual std::pair LoadSoundRaw(uint8_t *sfxdata, int length, int frequency, int channels, int bits, int loopstart, int loopend = -1, bool monoize = false) = 0; virtual void UnloadSound (SoundHandle sfx) = 0; // unloads a sound from memory virtual unsigned int GetMSLength(SoundHandle sfx) = 0; // Gets the length of a sound at its default frequency virtual unsigned int GetSampleLength(SoundHandle sfx) = 0; // Gets the length of a sound at its default frequency diff --git a/src/sound/music_audiotoolbox_mididevice.cpp b/src/sound/music_audiotoolbox_mididevice.cpp index 3dc57fdb06..8ff54e1415 100644 --- a/src/sound/music_audiotoolbox_mididevice.cpp +++ b/src/sound/music_audiotoolbox_mididevice.cpp @@ -250,7 +250,7 @@ bool AudioToolboxMIDIDevice::Preprocess(MIDIStreamer* song, bool looping) { assert(nullptr != song); - TArray midi; + TArray midi; song->CreateSMF(midi, looping ? 0 : 1); CFDataRef data = CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, &midi[0], midi.Size(), kCFAllocatorNull); diff --git a/src/sound/music_dumb.cpp b/src/sound/music_dumb.cpp index 3c48dac7be..eccd5f7ff0 100644 --- a/src/sound/music_dumb.cpp +++ b/src/sound/music_dumb.cpp @@ -145,9 +145,9 @@ CUSTOM_CVAR(Float, mod_dumb_mastervolume, 1.f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) // //========================================================================== -static inline QWORD time_to_samples(double p_time,int p_sample_rate) +static inline uint64_t time_to_samples(double p_time,int p_sample_rate) { - return (QWORD)floor((double)p_sample_rate * p_time + 0.5); + return (uint64_t)floor((double)p_sample_rate * p_time + 0.5); } //========================================================================== diff --git a/src/sound/music_fluidsynth_mididevice.cpp b/src/sound/music_fluidsynth_mididevice.cpp index bbd6536bc8..793fce0b1c 100644 --- a/src/sound/music_fluidsynth_mididevice.cpp +++ b/src/sound/music_fluidsynth_mididevice.cpp @@ -438,7 +438,7 @@ void FluidSynthMIDIDevice::HandleEvent(int status, int parm1, int parm2) // //========================================================================== -void FluidSynthMIDIDevice::HandleLongEvent(const BYTE *data, int len) +void FluidSynthMIDIDevice::HandleLongEvent(const uint8_t *data, int len) { if (len > 1 && (data[0] == 0xF0 || data[0] == 0xF7)) { diff --git a/src/sound/music_gme.cpp b/src/sound/music_gme.cpp index e5ee6975fc..88aeabcaba 100644 --- a/src/sound/music_gme.cpp +++ b/src/sound/music_gme.cpp @@ -117,7 +117,7 @@ MusInfo *GME_OpenSong(FileReader &reader, const char *fmt) { gme_type_t type; gme_err_t err; - BYTE *song; + uint8_t *song; Music_Emu *emu; int sample_rate; @@ -135,7 +135,7 @@ MusInfo *GME_OpenSong(FileReader &reader, const char *fmt) int fpos = reader.Tell(); int len = reader.GetLength(); - song = new BYTE[len]; + song = new uint8_t[len]; if (reader.Read(song, len) != len) { delete[] song; diff --git a/src/sound/music_hmi_midiout.cpp b/src/sound/music_hmi_midiout.cpp index 5197cd3082..0391739d80 100644 --- a/src/sound/music_hmi_midiout.cpp +++ b/src/sound/music_hmi_midiout.cpp @@ -89,7 +89,7 @@ struct HMISong::TrackInfo { - const BYTE *TrackBegin; + const uint8_t *TrackBegin; size_t TrackP; size_t MaxTrackP; DWORD Delay; @@ -97,7 +97,7 @@ struct HMISong::TrackInfo uint16_t Designation[NUM_HMI_DESIGNATIONS]; bool Enabled; bool Finished; - BYTE RunningStatus; + uint8_t RunningStatus; DWORD ReadVarLenHMI(); DWORD ReadVarLenHMP(); @@ -142,7 +142,7 @@ HMISong::HMISong (FileReader &reader, EMidiDevice type, const char *args) { // Way too small to be HMI. return; } - MusHeader = new BYTE[len]; + MusHeader = new uint8_t[len]; SongLen = len; NumTracks = 0; if (reader.Read(MusHeader, len) != len) @@ -576,7 +576,7 @@ void HMISong::AdvanceTracks(DWORD time) DWORD *HMISong::SendCommand (DWORD *events, TrackInfo *track, DWORD delay, ptrdiff_t room, bool &sysex_noroom) { DWORD len; - BYTE event, data1 = 0, data2 = 0; + uint8_t event, data1 = 0, data2 = 0; // If the next event comes from the fake track, pop an entry off the note-off queue. if (track == FakeTrack) @@ -669,7 +669,7 @@ DWORD *HMISong::SendCommand (DWORD *events, TrackInfo *track, DWORD delay, ptrdi } else { - BYTE *msg = (BYTE *)&events[3]; + uint8_t *msg = (uint8_t *)&events[3]; if (event == MIDI_SYSEX) { // Need to add the SysEx marker to the message. events[2] = (MEVT_LONGMSG << 24) | (len + 1); @@ -782,7 +782,7 @@ void HMISong::ProcessInitialMetaEvents () { TrackInfo *track; int i; - BYTE event; + uint8_t event; DWORD len; for (i = 0; i < NumTracks; ++i) @@ -877,7 +877,7 @@ DWORD HMISong::TrackInfo::ReadVarLenHMI() DWORD HMISong::TrackInfo::ReadVarLenHMP() { DWORD time = 0; - BYTE t = 0; + uint8_t t = 0; int off = 0; while (!(t & 0x80) && TrackP < MaxTrackP) @@ -895,7 +895,7 @@ DWORD HMISong::TrackInfo::ReadVarLenHMP() // //========================================================================== -void NoteOffQueue::AddNoteOff(DWORD delay, BYTE channel, BYTE key) +void NoteOffQueue::AddNoteOff(DWORD delay, uint8_t channel, uint8_t key) { unsigned int i = Reserve(1); while (i > 0 && (*this)[Parent(i)].Delay > delay) @@ -1052,7 +1052,7 @@ HMISong::HMISong(const HMISong *original, const char *filename, EMidiDevice type : MIDIStreamer(filename, type) { SongLen = original->SongLen; - MusHeader = new BYTE[original->SongLen]; + MusHeader = new uint8_t[original->SongLen]; memcpy(MusHeader, original->MusHeader, original->SongLen); NumTracks = original->NumTracks; Division = original->Division; diff --git a/src/sound/music_midi_timidity.cpp b/src/sound/music_midi_timidity.cpp index ee9d322a40..2f4025ca6d 100644 --- a/src/sound/music_midi_timidity.cpp +++ b/src/sound/music_midi_timidity.cpp @@ -140,7 +140,7 @@ TimidityPPMIDIDevice::~TimidityPPMIDIDevice () bool TimidityPPMIDIDevice::Preprocess(MIDIStreamer *song, bool looping) { - TArray midi; + TArray midi; bool success; FILE *f; @@ -287,9 +287,9 @@ bool TimidityPPMIDIDevice::ValidateTimidity() DWORD fileLen; HANDLE diskFile; HANDLE mapping; - const BYTE *exeBase; - const BYTE *exeEnd; - const BYTE *exe; + const uint8_t *exeBase; + const uint8_t *exeEnd; + const uint8_t *exe; bool good; pathLen = SearchPath (NULL, timidity_exe, NULL, MAX_PATH, foundPath, &filePart); @@ -319,7 +319,7 @@ bool TimidityPPMIDIDevice::ValidateTimidity() CloseHandle (diskFile); return false; } - exeBase = (const BYTE *)MapViewOfFile (mapping, FILE_MAP_READ, 0, 0, 0); + exeBase = (const uint8_t *)MapViewOfFile (mapping, FILE_MAP_READ, 0, 0, 0); if (exeBase == NULL) { Printf(PRINT_BOLD, "Could not map %s\n", foundPath); @@ -343,7 +343,7 @@ bool TimidityPPMIDIDevice::ValidateTimidity() good = true; break; } - exe = (const BYTE *)tSpot + 1; + exe = (const uint8_t *)tSpot + 1; } } catch (...) @@ -509,7 +509,7 @@ bool TimidityPPMIDIDevice::FillStream(SoundStream *stream, void *buff, int len, didget = 0; for (;;) { - ReadFile(song->ReadWavePipe, (BYTE *)buff+didget, len-didget, &got, NULL); + ReadFile(song->ReadWavePipe, (uint8_t *)buff+didget, len-didget, &got, NULL); didget += got; if (didget >= (DWORD)len) break; @@ -518,7 +518,7 @@ bool TimidityPPMIDIDevice::FillStream(SoundStream *stream, void *buff, int len, Sleep (10); if (!PeekNamedPipe(song->ReadWavePipe, NULL, 0, NULL, &avail, NULL) || avail == 0) { - memset ((BYTE *)buff+didget, 0, len-didget); + memset ((uint8_t *)buff+didget, 0, len-didget); break; } } @@ -549,10 +549,10 @@ bool TimidityPPMIDIDevice::FillStream(SoundStream *stream, void *buff, int len, } // fprintf(stderr,"something\n"); - got = read(song->WavePipe[0], (BYTE *)buff, len); + got = read(song->WavePipe[0], (uint8_t *)buff, len); if (got < len) { - memset((BYTE *)buff+got, 0, len-got); + memset((uint8_t *)buff+got, 0, len-got); } #endif return true; diff --git a/src/sound/music_midistream.cpp b/src/sound/music_midistream.cpp index 0f7501f791..83bdf6db75 100644 --- a/src/sound/music_midistream.cpp +++ b/src/sound/music_midistream.cpp @@ -53,7 +53,7 @@ // PRIVATE FUNCTION PROTOTYPES --------------------------------------------- -static void WriteVarLen (TArray &file, DWORD value); +static void WriteVarLen (TArray &file, DWORD value); // EXTERNAL DATA DECLARATIONS ---------------------------------------------- @@ -68,7 +68,7 @@ extern char MIDI_EventLengths[7]; // PRIVATE DATA DEFINITIONS ------------------------------------------------ -static const BYTE StaticMIDIhead[] = +static const uint8_t StaticMIDIhead[] = { 'M','T','h','d', 0, 0, 0, 6, 0, 0, // format 0: only one track @@ -955,7 +955,7 @@ int MIDIStreamer::FillBuffer(int buffer_num, int max_events, DWORD max_time) VolumeChanged = false; for (i = 0; i < 16; ++i) { - BYTE courseVol = (BYTE)(((ChannelVolumes[i]+1) * NewVolume) >> 16); + uint8_t courseVol = (uint8_t)(((ChannelVolumes[i]+1) * NewVolume) >> 16); events[0] = 0; // dwDeltaTime events[1] = 0; // dwStreamID events[2] = MIDI_CTRLCHANGE | i | (7<<8) | (courseVol<<16); @@ -1069,8 +1069,8 @@ DWORD *MIDIStreamer::WriteStopNotes(DWORD *events) void MIDIStreamer::Precache() { - BYTE found_instruments[256] = { 0, }; - BYTE found_banks[256] = { 0, }; + uint8_t found_instruments[256] = { 0, }; + uint8_t found_banks[256] = { 0, }; bool multiple_banks = false; LoopLimit = 1; @@ -1167,10 +1167,10 @@ void MIDIStreamer::Precache() // //========================================================================== -void MIDIStreamer::CreateSMF(TArray &file, int looplimit) +void MIDIStreamer::CreateSMF(TArray &file, int looplimit) { DWORD delay = 0; - BYTE running_status = 255; + uint8_t running_status = 255; // Always create songs aimed at GM devices. CheckCaps(MOD_MIDIPORT); @@ -1200,9 +1200,9 @@ void MIDIStreamer::CreateSMF(TArray &file, int looplimit) file.Push(MIDI_META); file.Push(MIDI_META_TEMPO); file.Push(3); - file.Push(BYTE(tempo >> 16)); - file.Push(BYTE(tempo >> 8)); - file.Push(BYTE(tempo)); + file.Push(uint8_t(tempo >> 16)); + file.Push(uint8_t(tempo >> 8)); + file.Push(uint8_t(tempo)); running_status = 255; } else if (MEVT_EVENTTYPE(event[2]) == MEVT_LONGMSG) @@ -1210,7 +1210,7 @@ void MIDIStreamer::CreateSMF(TArray &file, int looplimit) WriteVarLen(file, delay); delay = 0; DWORD len = MEVT_EVENTPARM(event[2]); - BYTE *bytes = (BYTE *)&event[3]; + uint8_t *bytes = (uint8_t *)&event[3]; if (bytes[0] == MIDI_SYSEX) { len--; @@ -1230,16 +1230,16 @@ void MIDIStreamer::CreateSMF(TArray &file, int looplimit) { WriteVarLen(file, delay); delay = 0; - BYTE status = BYTE(event[2]); + uint8_t status = uint8_t(event[2]); if (status != running_status) { running_status = status; file.Push(status); } - file.Push(BYTE((event[2] >> 8) & 0x7F)); + file.Push(uint8_t((event[2] >> 8) & 0x7F)); if (MIDI_EventLengths[(status >> 4) & 7] == 2) { - file.Push(BYTE((event[2] >> 16) & 0x7F)); + file.Push(uint8_t((event[2] >> 16) & 0x7F)); } } // Advance to next event @@ -1262,10 +1262,10 @@ void MIDIStreamer::CreateSMF(TArray &file, int looplimit) // Fill in track length DWORD len = file.Size() - 22; - file[18] = BYTE(len >> 24); - file[19] = BYTE(len >> 16); - file[20] = BYTE(len >> 8); - file[21] = BYTE(len & 255); + file[18] = uint8_t(len >> 24); + file[19] = uint8_t(len >> 16); + file[20] = uint8_t(len >> 8); + file[21] = uint8_t(len & 255); LoopLimit = 0; } @@ -1276,7 +1276,7 @@ void MIDIStreamer::CreateSMF(TArray &file, int looplimit) // //========================================================================== -static void WriteVarLen (TArray &file, DWORD value) +static void WriteVarLen (TArray &file, DWORD value) { DWORD buffer = value & 0x7F; @@ -1288,7 +1288,7 @@ static void WriteVarLen (TArray &file, DWORD value) for (;;) { - file.Push(BYTE(buffer)); + file.Push(uint8_t(buffer)); if (buffer & 0x80) { buffer >>= 8; diff --git a/src/sound/music_mus_midiout.cpp b/src/sound/music_mus_midiout.cpp index 420c1dfcdc..78f21e533d 100644 --- a/src/sound/music_mus_midiout.cpp +++ b/src/sound/music_mus_midiout.cpp @@ -53,7 +53,7 @@ // PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- -int MUSHeaderSearch(const BYTE *head, int len); +int MUSHeaderSearch(const uint8_t *head, int len); // PRIVATE FUNCTION PROTOTYPES --------------------------------------------- @@ -61,7 +61,7 @@ int MUSHeaderSearch(const BYTE *head, int len); // PRIVATE DATA DEFINITIONS ------------------------------------------------ -static const BYTE CtrlTranslate[15] = +static const uint8_t CtrlTranslate[15] = { 0, // program change 0, // bank select @@ -103,7 +103,7 @@ MUSSong2::MUSSong2 (FileReader &reader, EMidiDevice type, const char *args) } #endif - BYTE front[32]; + uint8_t front[32]; int start; if (reader.Read(front, sizeof(front)) != sizeof(front)) @@ -127,9 +127,9 @@ MUSSong2::MUSSong2 (FileReader &reader, EMidiDevice type, const char *args) { // It's too short. return; } - MusHeader = (MUSHeader *)new BYTE[len]; + MusHeader = (MUSHeader *)new uint8_t[len]; memcpy(MusHeader, front + start, sizeof(front) - start); - if (reader.Read((BYTE *)MusHeader + sizeof(front) - start, len - (sizeof(front) - start)) != (len - (32 - start))) + if (reader.Read((uint8_t *)MusHeader + sizeof(front) - start, len - (sizeof(front) - start)) != (len - (32 - start))) { return; } @@ -140,7 +140,7 @@ MUSSong2::MUSSong2 (FileReader &reader, EMidiDevice type, const char *args) return; } - MusBuffer = (BYTE *)MusHeader + LittleShort(MusHeader->SongStart); + MusBuffer = (uint8_t *)MusHeader + LittleShort(MusHeader->SongStart); MaxMusP = MIN(LittleShort(MusHeader->SongLen), len - LittleShort(MusHeader->SongStart)); Division = 140; InitialTempo = 1000000; @@ -156,7 +156,7 @@ MUSSong2::~MUSSong2 () { if (MusHeader != NULL) { - delete[] (BYTE *)MusHeader; + delete[] (uint8_t *)MusHeader; } } @@ -212,12 +212,12 @@ bool MUSSong2::CheckDone() void MUSSong2::Precache() { TArray work(LittleShort(MusHeader->NumInstruments)); - const BYTE *used = (BYTE *)MusHeader + sizeof(MUSHeader) / sizeof(BYTE); + const uint8_t *used = (uint8_t *)MusHeader + sizeof(MUSHeader) / sizeof(uint8_t); int i, k; for (i = k = 0; i < LittleShort(MusHeader->NumInstruments); ++i) { - BYTE instr = used[k++]; + uint8_t instr = used[k++]; uint16_t val; if (instr < 128) { @@ -269,10 +269,10 @@ DWORD *MUSSong2::MakeEvents(DWORD *events, DWORD *max_event_p, DWORD max_time) while (events < max_event_p && tot_time <= max_time) { - BYTE mid1, mid2; - BYTE channel; - BYTE t = 0, status; - BYTE event = MusBuffer[MusP++]; + uint8_t mid1, mid2; + uint8_t channel; + uint8_t t = 0, status; + uint8_t event = MusBuffer[MusP++]; if ((event & 0x70) != MUS_SCOREEND) { @@ -409,9 +409,9 @@ MUSSong2::MUSSong2(const MUSSong2 *original, const char *filename, EMidiDevice t { int songstart = LittleShort(original->MusHeader->SongStart); MaxMusP = original->MaxMusP; - MusHeader = (MUSHeader *)new BYTE[songstart + MaxMusP]; + MusHeader = (MUSHeader *)new uint8_t[songstart + MaxMusP]; memcpy(MusHeader, original->MusHeader, songstart + MaxMusP); - MusBuffer = (BYTE *)MusHeader + songstart; + MusBuffer = (uint8_t *)MusHeader + songstart; Division = 140; InitialTempo = 1000000; } @@ -425,7 +425,7 @@ MUSSong2::MUSSong2(const MUSSong2 *original, const char *filename, EMidiDevice t // //========================================================================== -int MUSHeaderSearch(const BYTE *head, int len) +int MUSHeaderSearch(const uint8_t *head, int len) { len -= 4; for (int i = 0; i <= len; ++i) diff --git a/src/sound/music_smf_midiout.cpp b/src/sound/music_smf_midiout.cpp index 623cef53ed..1a806ac69b 100644 --- a/src/sound/music_smf_midiout.cpp +++ b/src/sound/music_smf_midiout.cpp @@ -57,13 +57,13 @@ struct MIDISong2::TrackInfo { - const BYTE *TrackBegin; + const uint8_t *TrackBegin; size_t TrackP; size_t MaxTrackP; DWORD Delay; DWORD PlayedTime; bool Finished; - BYTE RunningStatus; + uint8_t RunningStatus; bool Designated; bool EProgramChange; bool EVolume; @@ -115,7 +115,7 @@ MIDISong2::MIDISong2 (FileReader &reader, EMidiDevice type, const char *args) } #endif SongLen = reader.GetLength(); - MusHeader = new BYTE[SongLen]; + MusHeader = new uint8_t[SongLen]; if (reader.Read(MusHeader, SongLen) != SongLen) return; @@ -374,7 +374,7 @@ void MIDISong2::AdvanceTracks(DWORD time) DWORD *MIDISong2::SendCommand (DWORD *events, TrackInfo *track, DWORD delay, ptrdiff_t room, bool &sysex_noroom) { DWORD len; - BYTE event, data1 = 0, data2 = 0; + uint8_t event, data1 = 0, data2 = 0; int i; sysex_noroom = false; @@ -610,7 +610,7 @@ DWORD *MIDISong2::SendCommand (DWORD *events, TrackInfo *track, DWORD delay, ptr } else { - BYTE *msg = (BYTE *)&events[3]; + uint8_t *msg = (uint8_t *)&events[3]; if (event == MIDI_SYSEX) { // Need to add the SysEx marker to the message. events[2] = (MEVT_LONGMSG << 24) | (len + 1); @@ -699,7 +699,7 @@ void MIDISong2::ProcessInitialMetaEvents () { TrackInfo *track; int i; - BYTE event; + uint8_t event; DWORD len; for (i = 0; i < NumTracks; ++i) @@ -845,7 +845,7 @@ MIDISong2::MIDISong2(const MIDISong2 *original, const char *filename, EMidiDevic : MIDIStreamer(filename, type) { SongLen = original->SongLen; - MusHeader = new BYTE[original->SongLen]; + MusHeader = new uint8_t[original->SongLen]; memcpy(MusHeader, original->MusHeader, original->SongLen); Format = original->Format; NumTracks = original->NumTracks; diff --git a/src/sound/music_softsynth_mididevice.cpp b/src/sound/music_softsynth_mididevice.cpp index 6bde3edf68..1d4086e02b 100644 --- a/src/sound/music_softsynth_mididevice.cpp +++ b/src/sound/music_softsynth_mididevice.cpp @@ -313,7 +313,7 @@ int SoftSynthMIDIDevice::PlayTick() } else if (MEVT_EVENTTYPE(event[2]) == MEVT_LONGMSG) { - HandleLongEvent((BYTE *)&event[3], MEVT_EVENTPARM(event[2])); + HandleLongEvent((uint8_t *)&event[3], MEVT_EVENTPARM(event[2])); } else if (MEVT_EVENTTYPE(event[2]) == 0) { // Short MIDI event diff --git a/src/sound/music_timidity_mididevice.cpp b/src/sound/music_timidity_mididevice.cpp index 401c34af79..443d2f6bda 100644 --- a/src/sound/music_timidity_mididevice.cpp +++ b/src/sound/music_timidity_mididevice.cpp @@ -63,7 +63,7 @@ struct FmtChunk DWORD SubFormatA; uint16_t SubFormatB; uint16_t SubFormatC; - BYTE SubFormatD[8]; + uint8_t SubFormatD[8]; }; // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- @@ -162,7 +162,7 @@ void TimidityMIDIDevice::HandleEvent(int status, int parm1, int parm2) // //========================================================================== -void TimidityMIDIDevice::HandleLongEvent(const BYTE *data, int len) +void TimidityMIDIDevice::HandleLongEvent(const uint8_t *data, int len) { Renderer->HandleLongMessage(data, len); } diff --git a/src/sound/music_wildmidi_mididevice.cpp b/src/sound/music_wildmidi_mididevice.cpp index c664dc6235..db14a873bf 100644 --- a/src/sound/music_wildmidi_mididevice.cpp +++ b/src/sound/music_wildmidi_mididevice.cpp @@ -193,7 +193,7 @@ void WildMIDIDevice::HandleEvent(int status, int parm1, int parm2) // //========================================================================== -void WildMIDIDevice::HandleLongEvent(const BYTE *data, int len) +void WildMIDIDevice::HandleLongEvent(const uint8_t *data, int len) { Renderer->LongEvent(data, len); } diff --git a/src/sound/music_win_mididevice.cpp b/src/sound/music_win_mididevice.cpp index b025d70f06..0da1297d22 100644 --- a/src/sound/music_win_mididevice.cpp +++ b/src/sound/music_win_mididevice.cpp @@ -247,7 +247,7 @@ void WinMIDIDevice::PrecacheInstruments(const uint16_t *instruments, int count) { return; } - BYTE bank[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + uint8_t bank[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; int i, chan; for (i = 0, chan = 0; i < count; ++i) diff --git a/src/sound/music_xmi_midiout.cpp b/src/sound/music_xmi_midiout.cpp index c9a2e9c467..ca171efbf1 100644 --- a/src/sound/music_xmi_midiout.cpp +++ b/src/sound/music_xmi_midiout.cpp @@ -65,11 +65,11 @@ struct LoopInfo struct XMISong::TrackInfo { - const BYTE *EventChunk; + const uint8_t *EventChunk; size_t EventLen; size_t EventP; - const BYTE *TimbreChunk; + const uint8_t *TimbreChunk; size_t TimbreLen; DWORD Delay; @@ -118,7 +118,7 @@ XMISong::XMISong (FileReader &reader, EMidiDevice type, const char *args) } #endif SongLen = reader.GetLength(); - MusHeader = new BYTE[SongLen]; + MusHeader = new uint8_t[SongLen]; if (reader.Read(MusHeader, SongLen) != SongLen) return; @@ -172,7 +172,7 @@ XMISong::~XMISong () // //========================================================================== -int XMISong::FindXMIDforms(const BYTE *chunk, int len, TrackInfo *songs) const +int XMISong::FindXMIDforms(const uint8_t *chunk, int len, TrackInfo *songs) const { int count = 0; @@ -214,7 +214,7 @@ int XMISong::FindXMIDforms(const BYTE *chunk, int len, TrackInfo *songs) const // //========================================================================== -void XMISong::FoundXMID(const BYTE *chunk, int len, TrackInfo *song) const +void XMISong::FoundXMID(const uint8_t *chunk, int len, TrackInfo *song) const { for (int p = 0; p <= len - 8; ) { @@ -390,7 +390,7 @@ void XMISong::AdvanceSong(DWORD time) DWORD *XMISong::SendCommand (DWORD *events, EventSource due, DWORD delay, ptrdiff_t room, bool &sysex_noroom) { DWORD len; - BYTE event, data1 = 0, data2 = 0; + uint8_t event, data1 = 0, data2 = 0; if (due == EVENT_Fake) { @@ -540,7 +540,7 @@ DWORD *XMISong::SendCommand (DWORD *events, EventSource due, DWORD delay, ptrdif } else { - BYTE *msg = (BYTE *)&events[3]; + uint8_t *msg = (uint8_t *)&events[3]; if (event == MIDI_SYSEX) { // Need to add the SysEx marker to the message. events[2] = (MEVT_LONGMSG << 24) | (len + 1); @@ -616,7 +616,7 @@ DWORD *XMISong::SendCommand (DWORD *events, EventSource due, DWORD delay, ptrdif void XMISong::ProcessInitialMetaEvents () { TrackInfo *track = CurrSong; - BYTE event; + uint8_t event; DWORD len; while (!track->Finished && @@ -736,7 +736,7 @@ XMISong::XMISong(const XMISong *original, const char *filename, EMidiDevice type : MIDIStreamer(filename, type) { SongLen = original->SongLen; - MusHeader = new BYTE[original->SongLen]; + MusHeader = new uint8_t[original->SongLen]; memcpy(MusHeader, original->MusHeader, original->SongLen); NumSongs = original->NumSongs; Tempo = InitialTempo = original->InitialTempo; diff --git a/src/sound/oalsound.cpp b/src/sound/oalsound.cpp index bfeb0b317c..27c0435e42 100644 --- a/src/sound/oalsound.cpp +++ b/src/sound/oalsound.cpp @@ -1099,7 +1099,7 @@ float OpenALSoundRenderer::GetOutputRate() } -std::pair OpenALSoundRenderer::LoadSoundRaw(BYTE *sfxdata, int length, int frequency, int channels, int bits, int loopstart, int loopend, bool monoize) +std::pair OpenALSoundRenderer::LoadSoundRaw(uint8_t *sfxdata, int length, int frequency, int channels, int bits, int loopstart, int loopend, bool monoize) { SoundHandle retval = { NULL }; @@ -1195,7 +1195,7 @@ std::pair OpenALSoundRenderer::LoadSoundRaw(BYTE *sfxdata, int return std::make_pair(retval, channels==1); } -std::pair OpenALSoundRenderer::LoadSound(BYTE *sfxdata, int length, bool monoize) +std::pair OpenALSoundRenderer::LoadSound(uint8_t *sfxdata, int length, bool monoize) { SoundHandle retval = { NULL }; MemoryReader reader((const char*)sfxdata, length); @@ -1245,13 +1245,13 @@ std::pair OpenALSoundRenderer::LoadSound(BYTE *sfxdata, int le } else if(type == SampleType_UInt8) { - BYTE *sfxdata = (BYTE*)&data[0]; + uint8_t *sfxdata = (uint8_t*)&data[0]; for(size_t i = 0;i < frames;i++) { int sum = 0; for(size_t c = 0;c < chancount;c++) sum += sfxdata[i*chancount + c] - 128; - sfxdata[i] = BYTE((sum / chancount) + 128); + sfxdata[i] = uint8_t((sum / chancount) + 128); } } data.Resize(unsigned(data.Size()/chancount)); diff --git a/src/sound/oalsound.h b/src/sound/oalsound.h index 3e110bde04..0c54f5ab3c 100644 --- a/src/sound/oalsound.h +++ b/src/sound/oalsound.h @@ -83,8 +83,8 @@ public: virtual void SetSfxVolume(float volume); virtual void SetMusicVolume(float volume); - virtual std::pair LoadSound(BYTE *sfxdata, int length, bool monoize); - virtual std::pair LoadSoundRaw(BYTE *sfxdata, int length, int frequency, int channels, int bits, int loopstart, int loopend = -1, bool monoize = false); + virtual std::pair LoadSound(uint8_t *sfxdata, int length, bool monoize); + virtual std::pair LoadSoundRaw(uint8_t *sfxdata, int length, int frequency, int channels, int bits, int loopstart, int loopend = -1, bool monoize = false); virtual void UnloadSound(SoundHandle sfx); virtual unsigned int GetMSLength(SoundHandle sfx); virtual unsigned int GetSampleLength(SoundHandle sfx); diff --git a/src/swrenderer/line/r_walldraw.cpp b/src/swrenderer/line/r_walldraw.cpp index d35890653f..6864ff9874 100644 --- a/src/swrenderer/line/r_walldraw.cpp +++ b/src/swrenderer/line/r_walldraw.cpp @@ -150,7 +150,7 @@ namespace swrenderer int tx = (xoffset >> FRACBITS) % mip_width; if (tx < 0) tx += mip_width; - source = (BYTE*)(pixels + tx * mip_height); + source = (uint8_t*)(pixels + tx * mip_height); source2 = nullptr; height = mip_height; texturefracx = 0; @@ -162,8 +162,8 @@ namespace swrenderer if (tx0 < 0) tx0 += mip_width; int tx1 = (tx0 + 1) % mip_width; - source = (BYTE*)(pixels + tx0 * mip_height); - source2 = (BYTE*)(pixels + tx1 * mip_height); + source = (uint8_t*)(pixels + tx0 * mip_height); + source2 = (uint8_t*)(pixels + tx1 * mip_height); height = mip_height; texturefracx = (xoffset >> (FRACBITS - 4)) & 15; } diff --git a/src/swrenderer/line/r_walldraw.h b/src/swrenderer/line/r_walldraw.h index 79d7ffc918..97be825d21 100644 --- a/src/swrenderer/line/r_walldraw.h +++ b/src/swrenderer/line/r_walldraw.h @@ -100,8 +100,8 @@ namespace swrenderer uint32_t uv_step; uint32_t uv_max; - const BYTE *source; - const BYTE *source2; + const uint8_t *source; + const uint8_t *source2; uint32_t texturefracx; uint32_t height; }; diff --git a/src/swrenderer/r_swcanvas.cpp b/src/swrenderer/r_swcanvas.cpp index 1301c29706..a105bbc2fb 100644 --- a/src/swrenderer/r_swcanvas.cpp +++ b/src/swrenderer/r_swcanvas.cpp @@ -451,7 +451,7 @@ void SWCanvas::DrawLine(DCanvas *canvas, int x0, int y0, int x1, int y1, int pal } else { - BYTE *spot = canvas->GetBuffer() + y0*canvas->GetPitch() + x0; + uint8_t *spot = canvas->GetBuffer() + y0*canvas->GetPitch() + x0; int pitch = canvas->GetPitch(); do { @@ -475,7 +475,7 @@ void SWCanvas::DrawLine(DCanvas *canvas, int x0, int y0, int x1, int y1, int pal } else { - BYTE *spot = canvas->GetBuffer() + y0*canvas->GetPitch() + x0; + uint8_t *spot = canvas->GetBuffer() + y0*canvas->GetPitch() + x0; int advance = canvas->GetPitch() + xDir; do { @@ -588,7 +588,7 @@ void SWCanvas::DrawPixel(DCanvas *canvas, int x, int y, int palColor, uint32_t r palColor = PalFromRGB(realcolor); } - canvas->GetBuffer()[canvas->GetPitch() * y + x] = (BYTE)palColor; + canvas->GetBuffer()[canvas->GetPitch() * y + x] = (uint8_t)palColor; } void SWCanvas::PUTTRANSDOT(DCanvas *canvas, int xx, int yy, int basecolor, int level) @@ -633,7 +633,7 @@ void SWCanvas::PUTTRANSDOT(DCanvas *canvas, int xx, int yy, int basecolor, int l } else if (!r_blendmethod) { - BYTE *spot = canvas->GetBuffer() + oldyyshifted + xx; + uint8_t *spot = canvas->GetBuffer() + oldyyshifted + xx; DWORD *bg2rgb = Col2RGB8[1 + level]; DWORD *fg2rgb = Col2RGB8[63 - level]; DWORD fg = fg2rgb[basecolor]; @@ -643,13 +643,13 @@ void SWCanvas::PUTTRANSDOT(DCanvas *canvas, int xx, int yy, int basecolor, int l } else { - BYTE *spot = canvas->GetBuffer() + oldyyshifted + xx; + uint8_t *spot = canvas->GetBuffer() + oldyyshifted + xx; uint32_t r = (GPalette.BaseColors[*spot].r * (64 - level) + GPalette.BaseColors[basecolor].r * level) / 256; uint32_t g = (GPalette.BaseColors[*spot].g * (64 - level) + GPalette.BaseColors[basecolor].g * level) / 256; uint32_t b = (GPalette.BaseColors[*spot].b * (64 - level) + GPalette.BaseColors[basecolor].b * level) / 256; - *spot = (BYTE)RGB256k.RGB[r][g][b]; + *spot = (uint8_t)RGB256k.RGB[r][g][b]; } } @@ -698,7 +698,7 @@ void SWCanvas::Clear(DCanvas *canvas, int left, int top, int right, int bottom, } else { - BYTE *dest = canvas->GetBuffer() + top * Pitch + left; + uint8_t *dest = canvas->GetBuffer() + top * Pitch + left; x = right - left; for (y = top; y < bottom; y++) { @@ -774,7 +774,7 @@ void SWCanvas::Dim(DCanvas *canvas, PalEntry color, float damount, int x1, int y DWORD *bg2rgb; DWORD fg; - BYTE *spot = canvas->GetBuffer() + x1 + y1*Pitch; + uint8_t *spot = canvas->GetBuffer() + x1 + y1*Pitch; int gap = Pitch - w; int alpha = (int)((float)64 * damount); @@ -819,7 +819,7 @@ void SWCanvas::Dim(DCanvas *canvas, PalEntry color, float damount, int x1, int y uint32_t r = (dimmedcolor_r + GPalette.BaseColors[*spot].r * ialpha) >> 8; uint32_t g = (dimmedcolor_g + GPalette.BaseColors[*spot].g * ialpha) >> 8; uint32_t b = (dimmedcolor_b + GPalette.BaseColors[*spot].b * ialpha) >> 8; - *spot = (BYTE)RGB256k.RGB[r][g][b]; + *spot = (uint8_t)RGB256k.RGB[r][g][b]; spot++; } spot += gap; diff --git a/src/swrenderer/r_swrenderer.cpp b/src/swrenderer/r_swrenderer.cpp index 75a53102bb..2034520043 100644 --- a/src/swrenderer/r_swrenderer.cpp +++ b/src/swrenderer/r_swrenderer.cpp @@ -123,9 +123,9 @@ void FSoftwareRenderer::PrecacheTexture(FTexture *tex, int cache) } } -void FSoftwareRenderer::Precache(BYTE *texhitlist, TMap &actorhitlist) +void FSoftwareRenderer::Precache(uint8_t *texhitlist, TMap &actorhitlist) { - BYTE *spritelist = new BYTE[sprites.Size()]; + uint8_t *spritelist = new uint8_t[sprites.Size()]; TMap::Iterator it(actorhitlist); TMap::Pair *pair; @@ -249,7 +249,7 @@ void FSoftwareRenderer::RenderTextureView (FCanvasTexture *tex, AActor *viewpoin { auto viewport = RenderViewport::Instance(); - BYTE *Pixels = viewport->RenderTarget->IsBgra() ? (BYTE*)tex->GetPixelsBgra() : (BYTE*)tex->GetPixels(); + uint8_t *Pixels = viewport->RenderTarget->IsBgra() ? (uint8_t*)tex->GetPixelsBgra() : (uint8_t*)tex->GetPixels(); DSimpleCanvas *Canvas = viewport->RenderTarget->IsBgra() ? tex->GetCanvasBgra() : tex->GetCanvas(); // curse Doom's overuse of global variables in the renderer. @@ -295,7 +295,7 @@ void FSoftwareRenderer::RenderTextureView (FCanvasTexture *tex, AActor *viewpoin // We need to make sure that both pixel buffers contain data: int width = tex->GetWidth(); int height = tex->GetHeight(); - BYTE *palbuffer = (BYTE *)tex->GetPixels(); + uint8_t *palbuffer = (uint8_t *)tex->GetPixels(); uint32_t *bgrabuffer = (uint32_t*)tex->GetPixelsBgra(); for (int x = 0; x < width; x++) { diff --git a/src/swrenderer/r_swrenderer.h b/src/swrenderer/r_swrenderer.h index 6d93738793..e37bb0b870 100644 --- a/src/swrenderer/r_swrenderer.h +++ b/src/swrenderer/r_swrenderer.h @@ -13,7 +13,7 @@ struct FSoftwareRenderer : public FRenderer bool UsesColormap() const override; // precache textures - void Precache(BYTE *texhitlist, TMap &actorhitlist) override; + void Precache(uint8_t *texhitlist, TMap &actorhitlist) override; // render 3D view void RenderView(player_t *player) override; diff --git a/src/swrenderer/scene/r_opaque_pass.cpp b/src/swrenderer/scene/r_opaque_pass.cpp index 7ad2c3a016..9a359896f0 100644 --- a/src/swrenderer/scene/r_opaque_pass.cpp +++ b/src/swrenderer/scene/r_opaque_pass.cpp @@ -718,7 +718,7 @@ namespace swrenderer if ((unsigned int)(sub - subsectors) < (unsigned int)numsubsectors) { // Only do it for the main BSP. int shade = LightVisibility::LightLevelToShade((floorlightlevel + ceilinglightlevel) / 2 + LightVisibility::ActualExtraLight(foggy), foggy); - for (WORD i = ParticlesInSubsec[(unsigned int)(sub - subsectors)]; i != NO_PARTICLE; i = Particles[i].snext) + for (int i = ParticlesInSubsec[(unsigned int)(sub - subsectors)]; i != NO_PARTICLE; i = Particles[i].snext) { RenderParticle::Project(Thread, Particles + i, subsectors[sub - subsectors].sector, shade, FakeSide, foggy); } @@ -810,7 +810,7 @@ namespace swrenderer node = bsp->children[side]; } - RenderSubsector((subsector_t *)((BYTE *)node - 1)); + RenderSubsector((subsector_t *)((uint8_t *)node - 1)); } void RenderOpaquePass::ClearClip() diff --git a/src/swrenderer/scene/r_portal.cpp b/src/swrenderer/scene/r_portal.cpp index 4139e7fe36..7e571635a3 100644 --- a/src/swrenderer/scene/r_portal.cpp +++ b/src/swrenderer/scene/r_portal.cpp @@ -279,7 +279,7 @@ namespace swrenderer // [ZZ] check depth. fill portal with black if it's exceeding the visual recursion limit, and continue like nothing happened. if (depth >= r_portal_recursions) { - BYTE color = (BYTE)BestColor((DWORD *)GPalette.BaseColors, 0, 0, 0, 0, 255); + uint8_t color = (uint8_t)BestColor((DWORD *)GPalette.BaseColors, 0, 0, 0, 0, 255); int spacing = viewport->RenderTarget->GetPitch(); for (int x = pds->x1; x < pds->x2; x++) { @@ -302,7 +302,7 @@ namespace swrenderer } else { - BYTE *dest = viewport->RenderTarget->GetBuffer() + x + Ytop * spacing; + uint8_t *dest = viewport->RenderTarget->GetBuffer() + x + Ytop * spacing; for (int y = Ytop; y <= Ybottom; y++) { @@ -479,9 +479,9 @@ namespace swrenderer if (viewport->RenderTarget->IsBgra()) // Assuming this is just a debug function return; - BYTE color = (BYTE)BestColor((DWORD *)GPalette.BaseColors, 255, 0, 0, 0, 255); + uint8_t color = (uint8_t)BestColor((DWORD *)GPalette.BaseColors, 255, 0, 0, 0, 255); - BYTE* pixels = viewport->RenderTarget->GetBuffer(); + uint8_t* pixels = viewport->RenderTarget->GetBuffer(); // top edge for (int x = pds->x1; x < pds->x2; x++) { diff --git a/src/swrenderer/things/r_decal.cpp b/src/swrenderer/things/r_decal.cpp index 52e4337049..498d95e0f6 100644 --- a/src/swrenderer/things/r_decal.cpp +++ b/src/swrenderer/things/r_decal.cpp @@ -66,7 +66,7 @@ namespace swrenderer DVector2 decal_left, decal_right, decal_pos; int x1, x2; double yscale; - BYTE flipx; + uint8_t flipx; double zpos; int needrepeat = 0; sector_t *front, *back; @@ -121,7 +121,7 @@ namespace swrenderer } FTexture *WallSpriteTile = TexMan(decal->PicNum, true); - flipx = (BYTE)(decal->RenderFlags & RF_XFLIP); + flipx = (uint8_t)(decal->RenderFlags & RF_XFLIP); if (WallSpriteTile == NULL || WallSpriteTile->UseType == FTexture::TEX_Null) { diff --git a/src/swrenderer/things/r_particle.cpp b/src/swrenderer/things/r_particle.cpp index 17656d69cd..c121936158 100644 --- a/src/swrenderer/things/r_particle.cpp +++ b/src/swrenderer/things/r_particle.cpp @@ -214,7 +214,7 @@ namespace swrenderer auto vis = this; int spacing; - BYTE color = vis->Light.BaseColormap->Maps[vis->startfrac]; + uint8_t color = vis->Light.BaseColormap->Maps[vis->startfrac]; int yl = vis->y1; int ycount = vis->y2 - yl + 1; int x1 = vis->x1; diff --git a/src/swrenderer/things/r_playersprite.cpp b/src/swrenderer/things/r_playersprite.cpp index 4b8bb074bc..6fda2ab9a9 100644 --- a/src/swrenderer/things/r_playersprite.cpp +++ b/src/swrenderer/things/r_playersprite.cpp @@ -195,7 +195,7 @@ namespace swrenderer spritedef_t* sprdef; spriteframe_t* sprframe; FTextureID picnum; - WORD flip; + uint16_t flip; FTexture* tex; bool noaccel; double alpha = owner->Alpha; @@ -537,7 +537,7 @@ namespace swrenderer colormap_to_use->Desaturate == 0) { accelSprite.overlay = colormap_to_use->Fade; - accelSprite.overlay.a = BYTE(vis.Light.ColormapNum * 255 / NUMCOLORMAPS); + accelSprite.overlay.a = uint8_t(vis.Light.ColormapNum * 255 / NUMCOLORMAPS); } else { diff --git a/src/swrenderer/things/r_voxel.cpp b/src/swrenderer/things/r_voxel.cpp index b9102e0bd8..aeca11b21f 100644 --- a/src/swrenderer/things/r_voxel.cpp +++ b/src/swrenderer/things/r_voxel.cpp @@ -412,9 +412,9 @@ namespace swrenderer case 8: case 7: x2 = gyinc; y2 = -gxinc; break; case 6: case 3: x2 = gxinc+gyinc; y2 = gyinc-gxinc; break; } - BYTE oand = (1 << int(xs 0) { dagxinc = gxinc; dagyinc = FixedMul(gyinc, viewport->viewingrangerecip); } else { dagxinc = -gxinc; dagyinc = -FixedMul(gyinc, viewport->viewingrangerecip); } @@ -428,7 +428,7 @@ namespace swrenderer for (x = xs; x != xe; x += xi) { - BYTE *slabxoffs = &mip->SlabData[mip->OffsetX[x]]; + uint8_t *slabxoffs = &mip->SlabData[mip->OffsetX[x]]; short *xyoffs = &mip->OffsetXY[x * (mip->SizeY + 1)]; nx = FixedMul(ggxstart + ggxinc[x], viewport->viewingrangerecip) + x1; @@ -455,9 +455,9 @@ namespace swrenderer fixed_t l1 = xs_RoundToInt(centerxwidebig_f / (ny - yoff)); fixed_t l2 = xs_RoundToInt(centerxwidebig_f / (ny + yoff)); - for (; voxptr < voxend; voxptr = (kvxslab_t *)((BYTE *)voxptr + voxptr->zleng + 3)) + for (; voxptr < voxend; voxptr = (kvxslab_t *)((uint8_t *)voxptr + voxptr->zleng + 3)) { - const BYTE *col = voxptr->col; + const uint8_t *col = voxptr->col; int zleng = voxptr->zleng; int ztop = voxptr->ztop; fixed_t z1, z2; diff --git a/src/swrenderer/viewport/r_spritedrawer.cpp b/src/swrenderer/viewport/r_spritedrawer.cpp index d30f3d58bd..f4cc0a17e4 100644 --- a/src/swrenderer/viewport/r_spritedrawer.cpp +++ b/src/swrenderer/viewport/r_spritedrawer.cpp @@ -62,9 +62,9 @@ namespace swrenderer dc_textureheight = tex->GetHeight(); const FTexture::Span *span; - const BYTE *column; + const uint8_t *column; if (viewport->RenderTarget->IsBgra() && !drawer_needs_pal_input) - column = (const BYTE *)tex->GetColumnBgra(col >> FRACBITS, &span); + column = (const uint8_t *)tex->GetColumnBgra(col >> FRACBITS, &span); else column = tex->GetColumn(col >> FRACBITS, &span); @@ -172,7 +172,7 @@ namespace swrenderer xoffset = MAX(MIN(xoffset, (mip_width << FRACBITS) - 1), 0); int tx = xoffset >> FRACBITS; - dc_source = (BYTE*)(pixels + tx * mip_height); + dc_source = (uint8_t*)(pixels + tx * mip_height); dc_source2 = nullptr; dc_textureheight = mip_height; dc_texturefracx = 0; @@ -183,8 +183,8 @@ namespace swrenderer int tx0 = xoffset >> FRACBITS; int tx1 = MIN(tx0 + 1, mip_width - 1); - dc_source = (BYTE*)(pixels + tx0 * mip_height); - dc_source2 = (BYTE*)(pixels + tx1 * mip_height); + dc_source = (uint8_t*)(pixels + tx0 * mip_height); + dc_source2 = (uint8_t*)(pixels + tx1 * mip_height); dc_textureheight = mip_height; dc_texturefracx = (xoffset >> (FRACBITS - 4)) & 15; } diff --git a/src/textures/buildtexture.cpp b/src/textures/buildtexture.cpp index 3b9f036abc..c561600246 100644 --- a/src/textures/buildtexture.cpp +++ b/src/textures/buildtexture.cpp @@ -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) diff --git a/src/textures/canvastexture.cpp b/src/textures/canvastexture.cpp index 109d927ab2..ed72b0eee3 100644 --- a/src/textures/canvastexture.cpp +++ b/src/textures/canvastexture.cpp @@ -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; } diff --git a/src/textures/texture.cpp b/src/textures/texture.cpp index 01906ac7b9..fa7d9fec64 100644 --- a/src/textures/texture.cpp +++ b/src/textures/texture.cpp @@ -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 (corner[count], corner[count*x]); + swapvalues (corner[count], corner[count*x]); } for (j = 0; j < count; j += 2) { - swapvalues (corner[j], corner[j*x]); - swapvalues (corner[j+1], corner[(j+1)*x]); + swapvalues (corner[j], corner[j*x]); + swapvalues (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; } diff --git a/src/textures/textures.h b/src/textures/textures.h index 3460169043..0982f9a8e9 100644 --- a/src/textures/textures.h +++ b/src/textures/textures.h @@ -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 - 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 mAnimations; TArray mSwitchDefs; TArray mAnimatedDoors; - TArray BuildTileFiles; + TArray 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; diff --git a/src/textures/warptexture.cpp b/src/textures/warptexture.cpp index 3f1c40e683..704effc5c2 100644 --- a/src/textures/warptexture.cpp +++ b/src/textures/warptexture.cpp @@ -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) { diff --git a/src/timidity/dls1.h b/src/timidity/dls1.h index abc2075a51..86eccffc92 100644 --- a/src/timidity/dls1.h +++ b/src/timidity/dls1.h @@ -133,7 +133,7 @@ typedef struct _DLSID { ULONG ulData1; USHORT usData2; USHORT usData3; - BYTE abData4[8]; + uint8_t abData4[8]; } DLSID, FAR *LPDLSID; typedef struct _DLSVERSION { diff --git a/src/timidity/gf1patch.h b/src/timidity/gf1patch.h index b030bb6e09..c8a6ebe90f 100644 --- a/src/timidity/gf1patch.h +++ b/src/timidity/gf1patch.h @@ -26,13 +26,13 @@ struct GF1PatchHeader char Header[HEADER_SIZE]; char GravisID[ID_SIZE]; /* Id = "ID#000002" */ char Description[DESC_SIZE]; - BYTE Instruments; - BYTE Voices; - BYTE Channels; + uint8_t Instruments; + uint8_t Voices; + uint8_t Channels; uint16_t WaveForms; uint16_t MasterVolume; DWORD DataSize; - BYTE Reserved[PATCH_HEADER_RESERVED_SIZE]; + uint8_t Reserved[PATCH_HEADER_RESERVED_SIZE]; } GCC_PACKED; struct GF1InstrumentData @@ -40,23 +40,23 @@ struct GF1InstrumentData uint16_t Instrument; char InstrumentName[INST_NAME_SIZE]; int InstrumentSize; - BYTE Layers; - BYTE Reserved[RESERVED_SIZE]; + uint8_t Layers; + uint8_t Reserved[RESERVED_SIZE]; } GCC_PACKED; struct GF1LayerData { - BYTE LayerDuplicate; - BYTE Layer; + uint8_t LayerDuplicate; + uint8_t Layer; int LayerSize; - BYTE Samples; - BYTE Reserved[LAYER_RESERVED_SIZE]; + uint8_t Samples; + uint8_t Reserved[LAYER_RESERVED_SIZE]; } GCC_PACKED; struct GF1PatchData { char WaveName[7]; - BYTE Fractions; + uint8_t Fractions; int WaveSize; int StartLoop; int EndLoop; @@ -65,19 +65,19 @@ struct GF1PatchData int HighFrequency; int RootFrequency; int16_t Tune; - BYTE Balance; - BYTE EnvelopeRate[ENVELOPES]; - BYTE EnvelopeOffset[ENVELOPES]; - BYTE TremoloSweep; - BYTE TremoloRate; - BYTE TremoloDepth; - BYTE VibratoSweep; - BYTE VibratoRate; - BYTE VibratoDepth; - BYTE Modes; + uint8_t Balance; + uint8_t EnvelopeRate[ENVELOPES]; + uint8_t EnvelopeOffset[ENVELOPES]; + uint8_t TremoloSweep; + uint8_t TremoloRate; + uint8_t TremoloDepth; + uint8_t VibratoSweep; + uint8_t VibratoRate; + uint8_t VibratoDepth; + uint8_t Modes; int16_t ScaleFrequency; uint16_t ScaleFactor; /* From 0 to 2048 or 0 to 2 */ - BYTE Reserved[PATCH_DATA_RESERVED_SIZE]; + uint8_t Reserved[PATCH_DATA_RESERVED_SIZE]; } GCC_PACKED; #ifdef _MSC_VER #pragma pack(pop) diff --git a/src/timidity/instrum.cpp b/src/timidity/instrum.cpp index 642f6af7bb..0b88f39bc0 100644 --- a/src/timidity/instrum.cpp +++ b/src/timidity/instrum.cpp @@ -81,7 +81,7 @@ ToneBank::~ToneBank() } } -int convert_tremolo_sweep(Renderer *song, BYTE sweep) +int convert_tremolo_sweep(Renderer *song, uint8_t sweep) { if (sweep == 0) return 0; @@ -90,7 +90,7 @@ int convert_tremolo_sweep(Renderer *song, BYTE sweep) int(((song->control_ratio * SWEEP_TUNING) << SWEEP_SHIFT) / (song->rate * sweep)); } -int convert_vibrato_sweep(Renderer *song, BYTE sweep, int vib_control_ratio) +int convert_vibrato_sweep(Renderer *song, uint8_t sweep, int vib_control_ratio) { if (sweep == 0) return 0; @@ -104,13 +104,13 @@ int convert_vibrato_sweep(Renderer *song, BYTE sweep, int vib_control_ratio) */ } -int convert_tremolo_rate(Renderer *song, BYTE rate) +int convert_tremolo_rate(Renderer *song, uint8_t rate) { return int(((song->control_ratio * rate) << RATE_SHIFT) / (TREMOLO_RATE_TUNING * song->rate)); } -int convert_vibrato_rate(Renderer *song, BYTE rate) +int convert_vibrato_rate(Renderer *song, uint8_t rate) { /* Return a suitable vibrato_control_ratio value */ return @@ -403,7 +403,7 @@ fail: { sp->envelope.gf1.rate[j] = patch_data.EnvelopeRate[j]; /* [RH] GF1NEW clamps the offsets to the range [5,251], so we do too. */ - sp->envelope.gf1.offset[j] = clamp(patch_data.EnvelopeOffset[j], 5, 251); + sp->envelope.gf1.offset[j] = clamp(patch_data.EnvelopeOffset[j], 5, 251); } /* Then read the sample data */ @@ -492,7 +492,7 @@ void convert_sample_data(Sample *sp, const void *data) case PATCH_UNSIGNED: { /* 8-bit, unsigned */ - BYTE *cp = (BYTE *)data; + uint8_t *cp = (uint8_t *)data; newdata = (sample_t *)safe_malloc((sp->data_length + 1) * sizeof(sample_t)); for (int i = 0; i < sp->data_length; ++i) { diff --git a/src/timidity/instrum_dls.cpp b/src/timidity/instrum_dls.cpp index def075d037..bdff876e96 100644 --- a/src/timidity/instrum_dls.cpp +++ b/src/timidity/instrum_dls.cpp @@ -59,7 +59,7 @@ struct RIFF_Chunk uint32_t magic; uint32_t length; uint32_t subtype; - BYTE *data; + uint8_t *data; RIFF_Chunk *child; RIFF_Chunk *next; }; @@ -85,9 +85,9 @@ static int ChunkHasSubChunks(uint32_t magic) return (magic == RIFF || magic == LIST); } -static void LoadSubChunks(RIFF_Chunk *chunk, BYTE *data, uint32_t left) +static void LoadSubChunks(RIFF_Chunk *chunk, uint8_t *data, uint32_t left) { - BYTE *subchunkData; + uint8_t *subchunkData; uint32_t subchunkDataLen; while ( left > 8 ) { @@ -133,7 +133,7 @@ static void LoadSubChunks(RIFF_Chunk *chunk, BYTE *data, uint32_t left) RIFF_Chunk *LoadRIFF(FILE *src) { RIFF_Chunk *chunk; - BYTE *subchunkData; + uint8_t *subchunkData; uint32_t subchunkDataLen; /* Allocate the chunk structure */ @@ -148,7 +148,7 @@ RIFF_Chunk *LoadRIFF(FILE *src) delete chunk; return NULL; } - chunk->data = (BYTE *)malloc(chunk->length); + chunk->data = (uint8_t *)malloc(chunk->length); if ( chunk->data == NULL ) { __Sound_SetError(ERR_OUT_OF_MEMORY); delete chunk; @@ -274,7 +274,7 @@ struct WaveFMT struct DLS_Wave { WaveFMT *format; - BYTE *data; + uint8_t *data; uint32_t length; WSMPL *wsmp; WLOOP *wsmp_loop; @@ -451,7 +451,7 @@ static void Parse_wsmp(DLS_Data *data, RIFF_Chunk *chunk, WSMPL **wsmp_ptr, WLOO wsmp->lAttenuation = LittleLong(wsmp->lAttenuation); wsmp->fulOptions = LittleLong(wsmp->fulOptions); wsmp->cSampleLoops = LittleLong(wsmp->cSampleLoops); - loop = (WLOOP *)((BYTE *)chunk->data + wsmp->cbSize); + loop = (WLOOP *)((uint8_t *)chunk->data + wsmp->cbSize); *wsmp_ptr = wsmp; *wsmp_loop_ptr = loop; for ( i = 0; i < wsmp->cSampleLoops; ++i ) { @@ -470,7 +470,7 @@ static void Parse_art(DLS_Data *data, RIFF_Chunk *chunk, CONNECTIONLIST **art_pt CONNECTION *artList; art->cbSize = LittleLong(art->cbSize); art->cConnections = LittleLong(art->cConnections); - artList = (CONNECTION *)((BYTE *)chunk->data + art->cbSize); + artList = (CONNECTION *)((uint8_t *)chunk->data + art->cbSize); *art_ptr = art; *artList_ptr = artList; for ( i = 0; i < art->cConnections; ++i ) { @@ -591,7 +591,7 @@ static void Parse_ptbl(DLS_Data *data, RIFF_Chunk *chunk) ptbl->cbSize = LittleLong(ptbl->cbSize); ptbl->cCues = LittleLong(ptbl->cCues); data->ptbl = ptbl; - data->ptblList = (POOLCUE *)((BYTE *)chunk->data + ptbl->cbSize); + data->ptblList = (POOLCUE *)((uint8_t *)chunk->data + ptbl->cbSize); for ( i = 0; i < ptbl->cCues; ++i ) { data->ptblList[i].ulOffset = LittleLong(data->ptblList[i].ulOffset); } @@ -1127,8 +1127,8 @@ static void load_region_dls(Renderer *song, Sample *sample, DLS_Instrument *ins, sample->low_freq = note_to_freq(rgn->header->RangeKey.usLow); sample->high_freq = note_to_freq(rgn->header->RangeKey.usHigh); sample->root_freq = note_to_freq(rgn->wsmp->usUnityNote + rgn->wsmp->sFineTune * .01f); - sample->low_vel = (BYTE)rgn->header->RangeVelocity.usLow; - sample->high_vel = (BYTE)rgn->header->RangeVelocity.usHigh; + sample->low_vel = (uint8_t)rgn->header->RangeVelocity.usLow; + sample->high_vel = (uint8_t)rgn->header->RangeVelocity.usHigh; sample->modes = wave->format->wBitsPerSample == 8 ? PATCH_UNSIGNED : PATCH_16; sample->sample_rate = wave->format->dwSamplesPerSec; diff --git a/src/timidity/instrum_sf2.cpp b/src/timidity/instrum_sf2.cpp index aa9df7a0c3..e64bfa3e4e 100644 --- a/src/timidity/instrum_sf2.cpp +++ b/src/timidity/instrum_sf2.cpp @@ -12,7 +12,7 @@ using namespace Timidity; -#define cindex(identifier) (BYTE)(((size_t)&((SFGenComposite *)1)->identifier - 1) / 2) +#define cindex(identifier) (uint8_t)(((size_t)&((SFGenComposite *)1)->identifier - 1) / 2) class CIOErr {}; class CBadForm {}; @@ -36,8 +36,8 @@ struct GenDef { short Min; short Max; - BYTE StructIndex; - BYTE Flags; + uint8_t StructIndex; + uint8_t Flags; }; static const GenDef GenDefs[] = @@ -230,7 +230,7 @@ static inline DWORD read_id(FileReader *f) static inline int read_byte(FileReader *f) { - BYTE x; + uint8_t x; if (f->Read(&x, 1) != 1) { throw CIOErr(); @@ -1140,7 +1140,7 @@ void SFFile::TranslatePercussionPresetZone(SFPreset *preset, SFBag *pzone) } SetInstrumentGenerators(&perc.Generators, InstrBags[i].GenIndex, InstrBags[i + 1].GenIndex); AddPresetGenerators(&perc.Generators, pzone->GenIndex, (pzone + 1)->GenIndex, preset); - perc.Generators.drumset = (BYTE)preset->Program; + perc.Generators.drumset = (uint8_t)preset->Program; perc.Generators.key = key; perc.Generators.velRange.Lo = MAX(pzone->VelRange.Lo, InstrBags[i].VelRange.Lo); perc.Generators.velRange.Hi = MIN(pzone->VelRange.Hi, InstrBags[i].VelRange.Hi); @@ -1522,7 +1522,7 @@ void SFFile::LoadSample(SFSample *sample) fp->Seek(SampleDataLSBOffset + sample->Start, SEEK_SET); for (i = 0; i < sample->End - sample->Start; ++i) { - BYTE samp; + uint8_t samp; *fp >> samp; sample->InMemoryData[i] = ((((int32_t(sample->InMemoryData[i] * 32768) << 8) | samp) << 8) >> 8) / 8388608.f; } diff --git a/src/timidity/mix.cpp b/src/timidity/mix.cpp index 037226c2c2..e09a15ba0e 100644 --- a/src/timidity/mix.cpp +++ b/src/timidity/mix.cpp @@ -32,7 +32,7 @@ namespace Timidity { -static int convert_envelope_rate(Renderer *song, BYTE rate) +static int convert_envelope_rate(Renderer *song, uint8_t rate) { int r; diff --git a/src/timidity/playmidi.cpp b/src/timidity/playmidi.cpp index f1426206ec..f8df539fa0 100644 --- a/src/timidity/playmidi.cpp +++ b/src/timidity/playmidi.cpp @@ -116,7 +116,7 @@ void Renderer::recompute_freq(int v) voice[v].sample_increment = (int)(a); } -static const BYTE vol_table[] = { +static const uint8_t vol_table[] = { 000 /* 000 */, 129 /* 001 */, 145 /* 002 */, 155 /* 003 */, 161 /* 004 */, 166 /* 005 */, 171 /* 006 */, 174 /* 007 */, 177 /* 008 */, 180 /* 009 */, 182 /* 010 */, 185 /* 011 */, @@ -872,7 +872,7 @@ void Renderer::DataEntryFineNRPN(int chan, int nrpn, int val) { } -void Renderer::HandleLongMessage(const BYTE *data, int len) +void Renderer::HandleLongMessage(const uint8_t *data, int len) { // SysEx handling goes here. } diff --git a/src/timidity/sf2.h b/src/timidity/sf2.h index 13049fa7fc..be611df9fe 100644 --- a/src/timidity/sf2.h +++ b/src/timidity/sf2.h @@ -2,15 +2,15 @@ typedef uint16_t SFGenerator; struct SFRange { - BYTE Lo; - BYTE Hi; + uint8_t Lo; + uint8_t Hi; }; struct SFPreset { char Name[21]; - BYTE LoadOrder:7; - BYTE bHasGlobalZone:1; + uint8_t LoadOrder:7; + uint8_t bHasGlobalZone:1; uint16_t Program; uint16_t Bank; uint16_t BagIndex; @@ -29,8 +29,8 @@ struct SFBag struct SFInst { char Name[21]; - BYTE Pad:7; - BYTE bHasGlobalZone:1; + uint8_t Pad:7; + uint8_t bHasGlobalZone:1; uint16_t BagIndex; }; @@ -42,7 +42,7 @@ struct SFSample DWORD StartLoop; DWORD EndLoop; DWORD SampleRate; - BYTE OriginalPitch; + uint8_t OriginalPitch; int8_t PitchCorrection; uint16_t SampleLink; uint16_t SampleType; @@ -199,8 +199,8 @@ struct SFGenComposite SFRange keyRange; // For normal use struct // For intermediate percussion use { - BYTE drumset; - BYTE key; + uint8_t drumset; + uint8_t key; }; }; SFRange velRange; @@ -263,7 +263,7 @@ struct SFPerc { SFPreset *Preset; SFGenComposite Generators; - BYTE LoadOrder; + uint8_t LoadOrder; }; // Container for all parameters from a SoundFont file diff --git a/src/timidity/timidity.cpp b/src/timidity/timidity.cpp index 4ca2b872e3..86fe9d11d8 100644 --- a/src/timidity/timidity.cpp +++ b/src/timidity/timidity.cpp @@ -579,7 +579,7 @@ int LoadDMXGUS() char readbuffer[1024]; long size = data.GetLength(); long read = 0; - BYTE remap[256]; + uint8_t remap[256]; FString patches[256]; memset(remap, 255, sizeof(remap)); diff --git a/src/timidity/timidity.h b/src/timidity/timidity.h index dc1b1526f4..1c73b3dc68 100644 --- a/src/timidity/timidity.h +++ b/src/timidity/timidity.h @@ -220,7 +220,7 @@ struct Sample { struct { - BYTE rate[6], offset[6]; + uint8_t rate[6], offset[6]; } gf1; struct { @@ -236,7 +236,7 @@ struct Sample int32_t tremolo_sweep_increment, tremolo_phase_increment, vibrato_sweep_increment, vibrato_control_ratio; - BYTE + uint8_t tremolo_depth, vibrato_depth, low_vel, high_vel, type; @@ -428,7 +428,7 @@ struct Channel bank, program, sustain, pitchbend, mono, /* one note only on this channel */ pitchsens; - BYTE + uint8_t volume, expression; int8_t panning; @@ -445,8 +445,8 @@ struct Channel struct MinEnvelope { - BYTE stage; - BYTE bUpdating; + uint8_t stage; + uint8_t bUpdating; }; struct GF1Envelope : public MinEnvelope @@ -490,7 +490,7 @@ struct Envelope SF2Envelope sf2; }; - BYTE Type; + uint8_t Type; void Init(struct Renderer *song, struct Voice *v); bool Update(struct Voice *v) @@ -515,7 +515,7 @@ struct Envelope struct Voice { - BYTE + uint8_t status, channel, note, velocity; Sample *sample; float @@ -633,7 +633,7 @@ struct Renderer ~Renderer(); void HandleEvent(int status, int parm1, int parm2); - void HandleLongMessage(const BYTE *data, int len); + void HandleLongMessage(const uint8_t *data, int len); void HandleController(int chan, int ctrl, int val); void ComputeOutput(float *buffer, int num_samples); void MarkInstrument(int bank, int percussion, int instr); @@ -641,10 +641,10 @@ struct Renderer int load_missing_instruments(); int set_default_instrument(const char *name); - int convert_tremolo_sweep(BYTE sweep); - int convert_vibrato_sweep(BYTE sweep, int vib_control_ratio); - int convert_tremolo_rate(BYTE rate); - int convert_vibrato_rate(BYTE rate); + int convert_tremolo_sweep(uint8_t sweep); + int convert_vibrato_sweep(uint8_t sweep, int vib_control_ratio); + int convert_tremolo_rate(uint8_t rate); + int convert_vibrato_rate(uint8_t rate); void recompute_freq(int voice); void recompute_amp(Voice *v); diff --git a/src/v_draw.cpp b/src/v_draw.cpp index cc91255f3f..3ab22f471c 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -973,14 +973,14 @@ void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints, // V_DrawBlock // Draw a linear block of pixels into the view buffer. // -void DCanvas::DrawBlock (int x, int y, int _width, int _height, const BYTE *src) const +void DCanvas::DrawBlock (int x, int y, int _width, int _height, const uint8_t *src) const { if (IsBgra()) return; int srcpitch = _width; int destpitch; - BYTE *dest; + uint8_t *dest; if (ClipBox (x, y, _width, _height, src, srcpitch)) { @@ -1002,12 +1002,12 @@ void DCanvas::DrawBlock (int x, int y, int _width, int _height, const BYTE *src) // V_GetBlock // Gets a linear block of pixels from the view buffer. // -void DCanvas::GetBlock (int x, int y, int _width, int _height, BYTE *dest) const +void DCanvas::GetBlock (int x, int y, int _width, int _height, uint8_t *dest) const { if (IsBgra()) return; - const BYTE *src; + const uint8_t *src; #ifdef RANGECHECK if (x<0 @@ -1030,7 +1030,7 @@ void DCanvas::GetBlock (int x, int y, int _width, int _height, BYTE *dest) const } // Returns true if the box was completely clipped. False otherwise. -bool DCanvas::ClipBox (int &x, int &y, int &w, int &h, const BYTE *&src, const int srcpitch) const +bool DCanvas::ClipBox (int &x, int &y, int &w, int &h, const uint8_t *&src, const int srcpitch) const { if (x >= Width || y >= Height || x+w <= 0 || y+h <= 0) { // Completely clipped off screen diff --git a/src/v_video.cpp b/src/v_video.cpp index 7fcb0f9a5c..8fc745ddbe 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -122,13 +122,13 @@ class FPaletteTester : public FTexture public: FPaletteTester (); - 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(); bool CheckModified(); void SetTranslation(int num); protected: - BYTE Pixels[16*16]; + uint8_t Pixels[16*16]; int CurTranslation; int WantTranslation; static const Span DummySpan[2]; @@ -332,7 +332,7 @@ void DCanvas::Dim (PalEntry color) { float dim[4] = { color.r/255.f, color.g/255.f, color.b/255.f, color.a/255.f }; V_AddBlend (dimmer.r/255.f, dimmer.g/255.f, dimmer.b/255.f, amount, dim); - dimmer = PalEntry (BYTE(dim[0]*255), BYTE(dim[1]*255), BYTE(dim[2]*255)); + dimmer = PalEntry (uint8_t(dim[0]*255), uint8_t(dim[1]*255), uint8_t(dim[2]*255)); amount = dim[3]; } Dim (dimmer, amount, 0, 0, Width, Height); @@ -361,7 +361,7 @@ DEFINE_ACTION_FUNCTION(_Screen, Dim) // //========================================================================== -void DCanvas::GetScreenshotBuffer(const BYTE *&buffer, int &pitch, ESSType &color_type) +void DCanvas::GetScreenshotBuffer(const uint8_t *&buffer, int &pitch, ESSType &color_type) { Lock(true); buffer = GetBuffer(); @@ -669,7 +669,7 @@ static void BuildTransTable (const PalEntry *palette) // //========================================================================== -void DCanvas::CalcGamma (float gamma, BYTE gammalookup[256]) +void DCanvas::CalcGamma (float gamma, uint8_t gammalookup[256]) { // I found this formula on the web at // , @@ -679,7 +679,7 @@ void DCanvas::CalcGamma (float gamma, BYTE gammalookup[256]) for (i = 0; i < 256; i++) { - gammalookup[i] = (BYTE)(255.0 * pow (i / 255.0, invgamma) + 0.5); + gammalookup[i] = (uint8_t)(255.0 * pow (i / 255.0, invgamma) + 0.5); } } @@ -745,7 +745,7 @@ void DSimpleCanvas::Resize(int width, int height) } } int bytes_per_pixel = Bgra ? 4 : 1; - MemBuffer = new BYTE[Pitch * height * bytes_per_pixel]; + MemBuffer = new uint8_t[Pitch * height * bytes_per_pixel]; memset (MemBuffer, 0, Pitch * height * bytes_per_pixel); } @@ -834,9 +834,9 @@ DFrameBuffer::DFrameBuffer (int width, int height, bool bgra) // //========================================================================== -void DFrameBuffer::CopyWithGammaBgra(void *output, int pitch, const BYTE *gammared, const BYTE *gammagreen, const BYTE *gammablue, PalEntry flash, int flash_amount) +void DFrameBuffer::CopyWithGammaBgra(void *output, int pitch, const uint8_t *gammared, const uint8_t *gammagreen, const uint8_t *gammablue, PalEntry flash, int flash_amount) { - const BYTE *gammatables[3] = { gammared, gammagreen, gammablue }; + const uint8_t *gammatables[3] = { gammared, gammagreen, gammablue }; if (flash_amount > 0) { @@ -847,8 +847,8 @@ void DFrameBuffer::CopyWithGammaBgra(void *output, int pitch, const BYTE *gammar for (int y = 0; y < Height; y++) { - BYTE *dest = (BYTE*)output + y * pitch; - BYTE *src = MemBuffer + y * Pitch * 4; + uint8_t *dest = (uint8_t*)output + y * pitch; + uint8_t *src = MemBuffer + y * Pitch * 4; for (int x = 0; x < Width; x++) { uint16_t fg_red = src[2]; @@ -872,8 +872,8 @@ void DFrameBuffer::CopyWithGammaBgra(void *output, int pitch, const BYTE *gammar { for (int y = 0; y < Height; y++) { - BYTE *dest = (BYTE*)output + y * pitch; - BYTE *src = MemBuffer + y * Pitch * 4; + uint8_t *dest = (uint8_t*)output + y * pitch; + uint8_t *src = MemBuffer + y * Pitch * 4; for (int x = 0; x < Width; x++) { dest[0] = gammatables[2][src[0]]; @@ -940,7 +940,7 @@ void DFrameBuffer::DrawRateStuff () { int i = I_GetTime(false); int tics = i - LastTic; - BYTE *buffer = GetBuffer(); + uint8_t *buffer = GetBuffer(); LastTic = i; if (tics > 20) tics = 20; @@ -1041,7 +1041,7 @@ void FPaletteTester::SetTranslation(int num) // //========================================================================== -const BYTE *FPaletteTester::GetColumn (unsigned int column, const Span **spans_out) +const uint8_t *FPaletteTester::GetColumn (unsigned int column, const Span **spans_out) { if (CurTranslation != WantTranslation) { @@ -1061,7 +1061,7 @@ const BYTE *FPaletteTester::GetColumn (unsigned int column, const Span **spans_o // //========================================================================== -const BYTE *FPaletteTester::GetPixels () +const uint8_t *FPaletteTester::GetPixels () { if (CurTranslation != WantTranslation) { @@ -1079,7 +1079,7 @@ const BYTE *FPaletteTester::GetPixels () void FPaletteTester::MakeTexture() { int i, j, k, t; - BYTE *p; + uint8_t *p; t = WantTranslation; p = Pixels; @@ -1105,7 +1105,7 @@ void FPaletteTester::MakeTexture() // //========================================================================== -void DFrameBuffer::CopyFromBuff (BYTE *src, int srcPitch, int width, int height, BYTE *dest) +void DFrameBuffer::CopyFromBuff (uint8_t *src, int srcPitch, int width, int height, uint8_t *dest) { if (Pitch == width && Pitch == Width && srcPitch == width) { diff --git a/src/v_video.h b/src/v_video.h index 1b7074ebe6..aa21480b3d 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -201,7 +201,7 @@ public: virtual ~DCanvas (); // Member variable access - inline BYTE *GetBuffer () const { return Buffer; } + inline uint8_t *GetBuffer () const { return Buffer; } inline int GetWidth () const { return Width; } inline int GetHeight () const { return Height; } inline int GetPitch () const { return Pitch; } @@ -215,10 +215,10 @@ public: virtual bool IsLocked () { return Buffer != NULL; } // Returns true if the surface is locked // Draw a linear block of pixels into the canvas - virtual void DrawBlock (int x, int y, int width, int height, const BYTE *src) const; + virtual void DrawBlock (int x, int y, int width, int height, const uint8_t *src) const; // Reads a linear block of pixels into the view buffer. - virtual void GetBlock (int x, int y, int width, int height, BYTE *dest) const; + virtual void GetBlock (int x, int y, int width, int height, uint8_t *dest) const; // Dim the entire canvas for the menus virtual void Dim (PalEntry color = 0); @@ -244,13 +244,13 @@ public: virtual void DrawPixel(int x, int y, int palcolor, uint32_t rgbcolor); // Calculate gamma table - void CalcGamma (float gamma, BYTE gammalookup[256]); + void CalcGamma (float gamma, uint8_t gammalookup[256]); // Retrieves a buffer containing image data for a screenshot. // Hint: Pitch can be negative for upside-down images, in which case buffer // points to the last row in the buffer, which will be the first row output. - virtual void GetScreenshotBuffer(const BYTE *&buffer, int &pitch, ESSType &color_type); + virtual void GetScreenshotBuffer(const uint8_t *&buffer, int &pitch, ESSType &color_type); // Releases the screenshot buffer. virtual void ReleaseScreenshotBuffer(); @@ -278,7 +278,7 @@ public: void DrawChar(FFont *font, int normalcolor, double x, double y, int character, VMVa_List &args); protected: - BYTE *Buffer; + uint8_t *Buffer; int Width; int Height; int Pitch; @@ -287,7 +287,7 @@ protected: void DrawTextCommon(FFont *font, int normalcolor, double x, double y, const char *string, DrawParms &parms); - bool ClipBox (int &left, int &top, int &width, int &height, const BYTE *&src, const int srcpitch) const; + bool ClipBox (int &left, int &top, int &width, int &height, const uint8_t *&src, const int srcpitch) const; void DrawTextureV(FTexture *img, double x, double y, uint32_t tag, va_list tags) = delete; virtual void DrawTextureParms(FTexture *img, DrawParms &parms); @@ -318,7 +318,7 @@ public: protected: void Resize(int width, int height); - BYTE *MemBuffer; + uint8_t *MemBuffer; DSimpleCanvas() {} }; @@ -442,8 +442,8 @@ public: protected: void DrawRateStuff (); - void CopyFromBuff (BYTE *src, int srcPitch, int width, int height, BYTE *dest); - void CopyWithGammaBgra(void *output, int pitch, const BYTE *gammared, const BYTE *gammagreen, const BYTE *gammablue, PalEntry flash, int flash_amount); + void CopyFromBuff (uint8_t *src, int srcPitch, int width, int height, uint8_t *dest); + void CopyWithGammaBgra(void *output, int pitch, const uint8_t *gammared, const uint8_t *gammagreen, const uint8_t *gammablue, PalEntry flash, int flash_amount); DFrameBuffer () {} @@ -468,20 +468,20 @@ EXTERN_CVAR (Float, Gamma) // Use a union so we can "overflow" without warnings. // Otherwise, we get stuff like this from Clang (when compiled // with -fsanitize=bounds) while running: -// src/v_video.cpp:390:12: runtime error: index 1068 out of bounds for type 'BYTE [32]' -// src/r_draw.cpp:273:11: runtime error: index 1057 out of bounds for type 'BYTE [32]' +// src/v_video.cpp:390:12: runtime error: index 1068 out of bounds for type 'uint8_t [32]' +// src/r_draw.cpp:273:11: runtime error: index 1057 out of bounds for type 'uint8_t [32]' union ColorTable32k { - BYTE RGB[32][32][32]; - BYTE All[32 *32 *32]; + uint8_t RGB[32][32][32]; + uint8_t All[32 *32 *32]; }; extern "C" ColorTable32k RGB32k; // [SP] RGB666 support union ColorTable256k { - BYTE RGB[64][64][64]; - BYTE All[64 *64 *64]; + uint8_t RGB[64][64][64]; + uint8_t All[64 *64 *64]; }; extern "C" ColorTable256k RGB256k; diff --git a/src/w_wad.cpp b/src/w_wad.cpp index c9230f5842..1f62b15c58 100644 --- a/src/w_wad.cpp +++ b/src/w_wad.cpp @@ -429,7 +429,7 @@ int FWadCollection::CheckNumForName (const char *name, int space) union { char uname[8]; - QWORD qname; + uint64_t qname; }; uint32_t i; @@ -475,7 +475,7 @@ int FWadCollection::CheckNumForName (const char *name, int space, int wadnum, bo union { char uname[8]; - QWORD qname; + uint64_t qname; }; uint32_t i; @@ -1060,7 +1060,7 @@ int FWadCollection::FindLump (const char *name, int *lastlump, bool anyns) union { char name8[8]; - QWORD qname; + uint64_t qname; }; LumpRecord *lump_p; diff --git a/src/weightedlist.h b/src/weightedlist.h index 55bcc95a88..4582f6e0f7 100644 --- a/src/weightedlist.h +++ b/src/weightedlist.h @@ -48,7 +48,7 @@ class TWeightedList Choice *Next; uint16_t Weight; - BYTE RandomVal; // 0 (never) - 255 (always) + uint8_t RandomVal; // 0 (never) - 255 (always) T Value; }; @@ -104,7 +104,7 @@ void TWeightedList::AddEntry (T value, uint16_t weight) template T TWeightedList::PickEntry () const { - BYTE randomnum = RandomClass(); + uint8_t randomnum = RandomClass(); Choice *choice = Choices; while (choice != NULL && randomnum > choice->RandomVal) @@ -147,7 +147,7 @@ void TWeightedList::RecalcRandomVals () for (choice = Choices; choice->Next != NULL; choice = choice->Next) { randVal += (double)choice->Weight * weightDenom; - choice->RandomVal = (BYTE)(randVal * 255.0); + choice->RandomVal = (uint8_t)(randVal * 255.0); } } diff --git a/src/win32/fb_d3d9.cpp b/src/win32/fb_d3d9.cpp index 1a391a3d77..e8cedef9dc 100644 --- a/src/win32/fb_d3d9.cpp +++ b/src/win32/fb_d3d9.cpp @@ -1349,12 +1349,12 @@ void D3DFB::Draw3DPart(bool copy3d) } else { - BYTE *dest = (BYTE *)lockrect.pBits; - BYTE *src = (BYTE *)MemBuffer; + uint8_t *dest = (uint8_t *)lockrect.pBits; + uint8_t *src = (uint8_t *)MemBuffer; for (int y = 0; y < Height; y++) { memcpy(dest, src, Width); - dest = reinterpret_cast(reinterpret_cast(dest) + lockrect.Pitch); + dest = reinterpret_cast(reinterpret_cast(dest) + lockrect.Pitch); src += Pitch; } } @@ -1507,10 +1507,10 @@ void D3DFB::UpdateGammaTexture(float igamma) if (GammaTexture != NULL && SUCCEEDED(GammaTexture->LockRect(0, &lockrect, NULL, 0))) { - BYTE *pix = (BYTE *)lockrect.pBits; + uint8_t *pix = (uint8_t *)lockrect.pBits; for (int i = 0; i <= 128; ++i) { - pix[i*4+2] = pix[i*4+1] = pix[i*4] = BYTE(255.f * powf(i / 128.f, igamma)); + pix[i*4+2] = pix[i*4+1] = pix[i*4] = uint8_t(255.f * powf(i / 128.f, igamma)); pix[i*4+3] = 255; } GammaTexture->UnlockRect(0); @@ -1554,7 +1554,7 @@ void D3DFB::DoOffByOneCheck () // Create an easily recognizable R3G3B2 palette. if (SUCCEEDED(PaletteTexture->LockRect(0, &lockrect, NULL, 0))) { - BYTE *pal = (BYTE *)(lockrect.pBits); + uint8_t *pal = (uint8_t *)(lockrect.pBits); for (i = 0; i < 256; ++i) { pal[i*4+0] = (i & 0x03) << 6; // blue @@ -1573,7 +1573,7 @@ void D3DFB::DoOffByOneCheck () { for (i = 0; i < 256; ++i) { - ((BYTE *)lockrect.pBits)[i] = i; + ((uint8_t *)lockrect.pBits)[i] = i; } FBTexture->UnlockRect(0); } @@ -1616,7 +1616,7 @@ void D3DFB::DoOffByOneCheck () if (SUCCEEDED(D3DDevice->GetRenderTargetData(testsurf, readsurf)) && SUCCEEDED(readsurf->LockRect(&lockrect, &testrect, D3DLOCK_READONLY))) { - const BYTE *pix = (const BYTE *)lockrect.pBits; + const uint8_t *pix = (const uint8_t *)lockrect.pBits; for (i = 0; i < 256; ++i, pix += 4) { c = (pix[0] >> 6) | // blue @@ -1651,7 +1651,7 @@ void D3DFB::UploadPalette () } if (SUCCEEDED(PaletteTexture->LockRect(0, &lockrect, NULL, 0))) { - BYTE *pix = (BYTE *)lockrect.pBits; + uint8_t *pix = (uint8_t *)lockrect.pBits; int i; for (i = 0; i < SkipAt; ++i, pix += 4) @@ -1758,7 +1758,7 @@ void D3DFB::SetBlendingRect(int x1, int y1, int x2, int y2) // //========================================================================== -void D3DFB::GetScreenshotBuffer(const BYTE *&buffer, int &pitch, ESSType &color_type) +void D3DFB::GetScreenshotBuffer(const uint8_t *&buffer, int &pitch, ESSType &color_type) { D3DLOCKED_RECT lrect; @@ -1784,7 +1784,7 @@ void D3DFB::GetScreenshotBuffer(const BYTE *&buffer, int &pitch, ESSType &color_ } else { - buffer = (const BYTE *)lrect.pBits; + buffer = (const uint8_t *)lrect.pBits; pitch = lrect.Pitch; color_type = SS_BGRA; } @@ -2319,7 +2319,7 @@ bool D3DTex::Update() D3DSURFACE_DESC desc; D3DLOCKED_RECT lrect; RECT rect; - BYTE *dest; + uint8_t *dest; assert(Box != NULL); assert(Box->Owner != NULL); @@ -2335,7 +2335,7 @@ bool D3DTex::Update() { return false; } - dest = (BYTE *)lrect.pBits; + dest = (uint8_t *)lrect.pBits; if (Box->Padded) { dest += lrect.Pitch + (desc.Format == D3DFMT_L8 ? 1 : 4); @@ -2344,7 +2344,7 @@ bool D3DTex::Update() if (Box->Padded) { // Clear top padding row. - dest = (BYTE *)lrect.pBits; + dest = (uint8_t *)lrect.pBits; int numbytes = GameTex->GetWidth() + 2; if (desc.Format != D3DFMT_L8) { diff --git a/src/win32/fb_d3d9_wipe.cpp b/src/win32/fb_d3d9_wipe.cpp index f8fd50273c..7e5880d471 100644 --- a/src/win32/fb_d3d9_wipe.cpp +++ b/src/win32/fb_d3d9_wipe.cpp @@ -87,7 +87,7 @@ public: private: static const int WIDTH = 64, HEIGHT = 64; - BYTE BurnArray[WIDTH * (HEIGHT + 5)]; + uint8_t BurnArray[WIDTH * (HEIGHT + 5)]; IDirect3DTexture9 *BurnTexture; int Density; int BurnTime; @@ -602,8 +602,8 @@ bool D3DFB::Wiper_Burn::Run(int ticks, D3DFB *fb) D3DLOCKED_RECT lrect; if (SUCCEEDED(BurnTexture->LockRect(0, &lrect, NULL, D3DLOCK_DISCARD))) { - const BYTE *src = BurnArray; - BYTE *dest = (BYTE *)lrect.pBits; + const uint8_t *src = BurnArray; + uint8_t *dest = (uint8_t *)lrect.pBits; for (int y = HEIGHT; y != 0; --y) { for (int x = WIDTH; x != 0; --x) diff --git a/src/win32/fb_ddraw.cpp b/src/win32/fb_ddraw.cpp index 6425e0b1f4..a921487350 100644 --- a/src/win32/fb_ddraw.cpp +++ b/src/win32/fb_ddraw.cpp @@ -163,7 +163,7 @@ DDrawFB::DDrawFB (int width, int height, bool fullscreen) PalEntries[i].peRed = GPalette.BaseColors[i].r; PalEntries[i].peGreen = GPalette.BaseColors[i].g; PalEntries[i].peBlue = GPalette.BaseColors[i].b; - GammaTable[0][i] = GammaTable[1][i] = GammaTable[2][i] = (BYTE)i; + GammaTable[0][i] = GammaTable[1][i] = GammaTable[2][i] = (uint8_t)i; } memcpy (SourcePalette, GPalette.BaseColors, sizeof(PalEntry)*256); @@ -781,7 +781,7 @@ void DDrawFB::RebuildColorTable () } for (i = 0; i < 256; i++) { - GPfxPal.Pal8[i] = (BYTE)BestColor ((uint32_t *)syspal, PalEntries[i].peRed, + GPfxPal.Pal8[i] = (uint8_t)BestColor ((uint32_t *)syspal, PalEntries[i].peRed, PalEntries[i].peGreen, PalEntries[i].peBlue); } } @@ -996,7 +996,7 @@ DDrawFB::LockSurfRes DDrawFB::LockSurf (LPRECT lockrect, LPDIRECTDRAWSURFACE toL LOG1 ("Final result after restoration attempts: %08lx\n", hr); return NoGood; } - Buffer = (BYTE *)desc.lpSurface; + Buffer = (uint8_t *)desc.lpSurface; Pitch = desc.lPitch; BufferingNow = false; return wasLost ? GoodWasLost : Good; @@ -1132,7 +1132,7 @@ void DDrawFB::Update () { if (LockSurf (NULL, NULL) != NoGood) { - BYTE *writept = Buffer + (TrueHeight - Height)/2*Pitch; + uint8_t *writept = Buffer + (TrueHeight - Height)/2*Pitch; LOG3 ("Copy %dx%d (%d)\n", Width, Height, BufferPitch); if (UsePfx) { diff --git a/src/win32/i_crash.cpp b/src/win32/i_crash.cpp index e338eded53..1352e6f68b 100644 --- a/src/win32/i_crash.cpp +++ b/src/win32/i_crash.cpp @@ -168,7 +168,7 @@ namespace zip struct LocalFileHeader { DWORD Magic; // 0 - BYTE VersionToExtract[2]; // 4 + uint8_t VersionToExtract[2]; // 4 uint16_t Flags; // 6 uint16_t Method; // 8 uint16_t ModTime; // 10 @@ -183,8 +183,8 @@ namespace zip struct CentralDirectoryEntry { DWORD Magic; - BYTE VersionMadeBy[2]; - BYTE VersionToExtract[2]; + uint8_t VersionMadeBy[2]; + uint8_t VersionToExtract[2]; uint16_t Flags; uint16_t Method; uint16_t ModTime; @@ -246,7 +246,7 @@ static HANDLE MakeZip (); static void AddZipFile (HANDLE ziphandle, TarFile *whichfile, short dosdate, short dostime); static HANDLE CreateTempFile (); -static void DumpBytes (HANDLE file, BYTE *address); +static void DumpBytes (HANDLE file, uint8_t *address); static void AddStackInfo (HANDLE file, void *dumpaddress, DWORD code, CONTEXT *ctxt); static void StackWalk (HANDLE file, void *dumpaddress, DWORD *topOfStack, DWORD *jump, CONTEXT *ctxt); static void AddToolHelp (HANDLE file); @@ -388,7 +388,7 @@ DWORD *GetTopOfStack (void *top) if (VirtualQuery (top, &memInfo, sizeof(memInfo))) { - return (DWORD *)((BYTE *)memInfo.BaseAddress + memInfo.RegionSize); + return (DWORD *)((uint8_t *)memInfo.BaseAddress + memInfo.RegionSize); } else { @@ -607,7 +607,7 @@ void CreateCrashLog (char *custominfo, DWORD customsize, HWND richlog) if (file != INVALID_HANDLE_VALUE) { - BYTE buffer[512]; + uint8_t buffer[512]; DWORD left; for (;; customsize -= left, custominfo += left) @@ -835,7 +835,7 @@ HANDLE WriteTextReport () #else Writef (file, "\r\nBytes near RIP:"); #endif - DumpBytes (file, (BYTE *)CrashPointers.ExceptionRecord->ExceptionAddress-16); + DumpBytes (file, (uint8_t *)CrashPointers.ExceptionRecord->ExceptionAddress-16); if (ctxt->ContextFlags & CONTEXT_CONTROL) { @@ -946,11 +946,11 @@ static void AddStackInfo (HANDLE file, void *dumpaddress, DWORD code, CONTEXT *c { DWORD *addr = (DWORD *)dumpaddress, *jump; DWORD *topOfStack = GetTopOfStack (dumpaddress); - BYTE peekb; + uint8_t peekb; #ifdef _M_IX86 DWORD peekd; #else - QWORD peekq; + uint64_t peekq; #endif jump = topOfStack; @@ -1002,9 +1002,9 @@ static void AddStackInfo (HANDLE file, void *dumpaddress, DWORD code, CONTEXT *c Writef (file, " "); } #else - if ((QWORD *)topOfStack - (QWORD *)scan < 2) + if ((uint64_t *)topOfStack - (uint64_t *)scan < 2) { - max = (QWORD *)topOfStack - (QWORD *)scan; + max = (uint64_t *)topOfStack - (uint64_t *)scan; } else { @@ -1027,7 +1027,7 @@ static void AddStackInfo (HANDLE file, void *dumpaddress, DWORD code, CONTEXT *c Writef (file, " "); for (i = 0; i < int(max*sizeof(void*)); ++i) { - if (!SafeReadMemory ((BYTE *)scan + i, &peekb, 1)) + if (!SafeReadMemory ((uint8_t *)scan + i, &peekb, 1)) { break; } @@ -1054,7 +1054,7 @@ static void StackWalk (HANDLE file, void *dumpaddress, DWORD *topOfStack, DWORD { DWORD *addr = (DWORD *)dumpaddress; - BYTE *pBaseOfImage = (BYTE *)GetModuleHandle (0); + uint8_t *pBaseOfImage = (uint8_t *)GetModuleHandle (0); IMAGE_OPTIONAL_HEADER *pHeader = (IMAGE_OPTIONAL_HEADER *)(pBaseOfImage + ((IMAGE_DOS_HEADER*)pBaseOfImage)->e_lfanew + sizeof(IMAGE_NT_SIGNATURE) + sizeof(IMAGE_FILE_HEADER)); @@ -1082,8 +1082,8 @@ static void StackWalk (HANDLE file, void *dumpaddress, DWORD *topOfStack, DWORD }; // Check if address is after a call statement. Print what was called if it is. - const BYTE *bytep = (BYTE *)code; - BYTE peekb; + const uint8_t *bytep = (uint8_t *)code; + uint8_t peekb; #define chkbyte(x,m,v) (SafeReadMemory(x, &peekb, 1) && ((peekb & m) == v)) @@ -1364,11 +1364,11 @@ static void StackWalk (HANDLE file, void *dumpaddress, DWORD *topOfStack, DWORD // //========================================================================== -static void DumpBytes (HANDLE file, BYTE *address) +static void DumpBytes (HANDLE file, uint8_t *address) { char line[68*3], *line_p = line; DWORD len; - BYTE peek; + uint8_t peek; for (int i = 0; i < 16*3; ++i) { @@ -2157,7 +2157,7 @@ struct BinStreamInfo static DWORD CALLBACK StreamEditBinary (DWORD_PTR cookie, LPBYTE buffer, LONG cb, LONG *pcb) { BinStreamInfo *info = (BinStreamInfo *)cookie; - BYTE buf16[16]; + uint8_t buf16[16]; DWORD read, i; char *buff_p = (char *)buffer; char *buff_end = (char *)buffer + cb; @@ -2207,7 +2207,7 @@ repeat: buff_p += mysnprintf (buff_p, buff_end - buff_p, "\\cf3 "); for (i = 0; i < read; ++i) { - BYTE code = buf16[i]; + uint8_t code = buf16[i]; if (code < 0x20 || code > 0x7f) code = 0xB7; if (code == '\\' || code == '{' || code == '}') *buff_p++ = '\\'; *buff_p++ = code; diff --git a/src/win32/i_dijoy.cpp b/src/win32/i_dijoy.cpp index 7fdd907eee..fa4f16e3e2 100644 --- a/src/win32/i_dijoy.cpp +++ b/src/win32/i_dijoy.cpp @@ -168,7 +168,7 @@ protected: float DeadZone, DefaultDeadZone; float Multiplier, DefaultMultiplier; EJoyAxis GameAxis, DefaultGameAxis; - BYTE ButtonValue; + uint8_t ButtonValue; }; struct ButtonInfo { @@ -176,7 +176,7 @@ protected: GUID Guid; DWORD Type; DWORD Ofs; - BYTE Value; + uint8_t Value; }; LPDIRECTINPUTDEVICE8 Device; @@ -259,7 +259,7 @@ CUSTOM_CVAR(Bool, joy_dinput, true, CVAR_GLOBALCONFIG|CVAR_ARCHIVE|CVAR_NOINITCA // PRIVATE DATA DEFINITIONS ------------------------------------------------ -static const BYTE POVButtons[9] = { 0x01, 0x03, 0x02, 0x06, 0x04, 0x0C, 0x08, 0x09, 0x00 }; +static const uint8_t POVButtons[9] = { 0x01, 0x03, 0x02, 0x06, 0x04, 0x0C, 0x08, 0x09, 0x00 }; //("dc12a687-737f-11cf-884d-00aa004b2e24") static const IID IID_IWbemLocator = { 0xdc12a687, 0x737f, 0x11cf, @@ -383,7 +383,7 @@ bool FDInputJoystick::GetDevice() void FDInputJoystick::ProcessInput() { HRESULT hr; - BYTE *state; + uint8_t *state; unsigned i; event_t ev; @@ -402,7 +402,7 @@ void FDInputJoystick::ProcessInput() return; } - state = (BYTE *)alloca(DataFormat.dwDataSize); + state = (uint8_t *)alloca(DataFormat.dwDataSize); hr = Device->GetDeviceState(DataFormat.dwDataSize, state); if (FAILED(hr)) return; @@ -424,7 +424,7 @@ void FDInputJoystick::ProcessInput() AxisInfo *info = &Axes[i]; LONG value = *(LONG *)(state + info->Ofs); double axisval; - BYTE buttonstate = 0; + uint8_t buttonstate = 0; // Scale to [-1.0, 1.0] axisval = (value - info->Min) * 2.0 / (info->Max - info->Min) - 1.0; @@ -450,7 +450,7 @@ void FDInputJoystick::ProcessInput() for (i = 0; i < Buttons.Size(); ++i) { ButtonInfo *info = &Buttons[i]; - BYTE newstate = *(BYTE *)(state + info->Ofs) & 0x80; + uint8_t newstate = *(uint8_t *)(state + info->Ofs) & 0x80; if (newstate != info->Value) { info->Value = newstate; @@ -696,7 +696,7 @@ HRESULT FDInputJoystick::SetDataFormat() objects[numobjs + i].dwOfs = Buttons[i].Ofs = nextofs; objects[numobjs + i].dwType = Buttons[i].Type; objects[numobjs + i].dwFlags = 0; - nextofs += sizeof(BYTE); + nextofs += sizeof(uint8_t); } numobjs += i; diff --git a/src/win32/i_input.cpp b/src/win32/i_input.cpp index 8e1f623067..c2d4fddbb4 100644 --- a/src/win32/i_input.cpp +++ b/src/win32/i_input.cpp @@ -400,7 +400,7 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) if (!MyGetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &size, sizeof(RAWINPUTHEADER)) && size != 0) { - BYTE *buffer = (BYTE *)alloca(size); + uint8_t *buffer = (uint8_t *)alloca(size); if (MyGetRawInputData((HRAWINPUT)lParam, RID_INPUT, buffer, &size, sizeof(RAWINPUTHEADER)) == size) { int code = GET_RAWINPUT_CODE_WPARAM(wParam); diff --git a/src/win32/i_input.h b/src/win32/i_input.h index f941d9e8e0..705b4d9861 100644 --- a/src/win32/i_input.h +++ b/src/win32/i_input.h @@ -101,7 +101,7 @@ public: void AllKeysUp(); protected: - BYTE KeyStates[256/8]; + uint8_t KeyStates[256/8]; int CheckKey(int keynum) const { diff --git a/src/win32/i_keyboard.cpp b/src/win32/i_keyboard.cpp index e62942e8d3..a5d223589e 100644 --- a/src/win32/i_keyboard.cpp +++ b/src/win32/i_keyboard.cpp @@ -70,7 +70,7 @@ extern bool GUICapture; // PRIVATE DATA DEFINITIONS ------------------------------------------------ // Convert DIK_* code to ASCII using Qwerty keymap -static const BYTE Convert[256] = +static const uint8_t Convert[256] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 8, 9, // 0 @@ -133,8 +133,8 @@ FKeyboard::~FKeyboard() bool FKeyboard::CheckAndSetKey(int keynum, INTBOOL down) { - BYTE *statebyte = &KeyStates[keynum >> 3]; - BYTE mask = 1 << (keynum & 7); + uint8_t *statebyte = &KeyStates[keynum >> 3]; + uint8_t mask = 1 << (keynum & 7); if (down) { if (*statebyte & mask) @@ -172,7 +172,7 @@ void FKeyboard::AllKeysUp() { if (KeyStates[i] != 0) { - BYTE states = KeyStates[i]; + uint8_t states = KeyStates[i]; int j = 0; KeyStates[i] = 0; do @@ -469,7 +469,7 @@ bool FRawKeyboard::ProcessRawInput(RAWINPUT *raw, int code) // useful key from the message. if (raw->data.keyboard.VKey >= VK_BROWSER_BACK && raw->data.keyboard.VKey <= VK_LAUNCH_APP2) { - static const BYTE MediaKeys[VK_LAUNCH_APP2 - VK_BROWSER_BACK + 1] = + static const uint8_t MediaKeys[VK_LAUNCH_APP2 - VK_BROWSER_BACK + 1] = { DIK_WEBBACK, DIK_WEBFORWARD, DIK_WEBREFRESH, DIK_WEBSTOP, DIK_WEBSEARCH, DIK_WEBFAVORITES, DIK_WEBHOME, diff --git a/src/win32/i_main.cpp b/src/win32/i_main.cpp index 14c4791c60..406c5d8dbf 100644 --- a/src/win32/i_main.cpp +++ b/src/win32/i_main.cpp @@ -109,7 +109,7 @@ LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM); void CreateCrashLog (char *custominfo, DWORD customsize, HWND richedit); void DisplayCrashLog (); -extern BYTE *ST_Util_BitsForBitmap (BITMAPINFO *bitmap_info); +extern uint8_t *ST_Util_BitsForBitmap (BITMAPINFO *bitmap_info); void I_FlushBufferedConsoleStuff(); // PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- diff --git a/src/win32/i_rawps2.cpp b/src/win32/i_rawps2.cpp index 3a1dbce949..498fffbc2e 100644 --- a/src/win32/i_rawps2.cpp +++ b/src/win32/i_rawps2.cpp @@ -101,7 +101,7 @@ protected: float DeadZone; float Multiplier; EJoyAxis GameAxis; - BYTE ButtonValue; + uint8_t ButtonValue; }; struct DefaultAxisConfig { @@ -167,22 +167,22 @@ protected: struct PS2Descriptor { const char *AdapterName; - BYTE PacketSize; + uint8_t PacketSize; int8_t ControllerNumber; int8_t ControllerStatus; - BYTE LeftX; - BYTE LeftY; - BYTE RightX; - BYTE RightY; + uint8_t LeftX; + uint8_t LeftY; + uint8_t RightX; + uint8_t RightY; int8_t DPadHat; - BYTE DPadButtonsNibble:1; + uint8_t DPadButtonsNibble:1; int8_t DPadButtons:7; // up, right, down, left - BYTE ButtonSet1:7; // triangle, circle, cross, square - BYTE ButtonSet1Nibble:1; - BYTE ButtonSet2:7; // L2, R2, L1, R1 - BYTE ButtonSet2Nibble:1; - BYTE ButtonSet3:7; // select, start, lthumb, rthumb - BYTE ButtonSet3Nibble:1; + uint8_t ButtonSet1:7; // triangle, circle, cross, square + uint8_t ButtonSet1Nibble:1; + uint8_t ButtonSet2:7; // L2, R2, L1, R1 + uint8_t ButtonSet2Nibble:1; + uint8_t ButtonSet3:7; // select, start, lthumb, rthumb + uint8_t ButtonSet3Nibble:1; }; // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- @@ -229,7 +229,7 @@ static const int ButtonKeys[16] = KEY_PAD_RTHUMB }; -static const BYTE HatButtons[16] = +static const uint8_t HatButtons[16] = { 1, 1+2, 2, 2+4, 4, 4+8, 8, 8+1, 0, 0, 0, 0, 0, 0, 0, 0 @@ -390,9 +390,9 @@ bool FRawPS2Controller::ProcessInput(RAWHID *raw, int code) // w32api has an incompatible definition of bRawData. // (But the version that comes with MinGW64 is fine.) #if defined(__GNUC__) && !defined(__MINGW64_VERSION_MAJOR) - BYTE *rawdata = &raw->bRawData; + uint8_t *rawdata = &raw->bRawData; #else - BYTE *rawdata = raw->bRawData; + uint8_t *rawdata = raw->bRawData; #endif const PS2Descriptor *desc = &Descriptors[Type]; bool digital; @@ -515,7 +515,7 @@ bool FRawPS2Controller::ProcessInput(RAWHID *raw, int code) void FRawPS2Controller::ProcessThumbstick(int value1, AxisInfo *axis1, int value2, AxisInfo *axis2, int base) { - BYTE buttonstate; + uint8_t buttonstate; double axisval1, axisval2; axisval1 = value1 * (2.0 / 255) - 1.0; diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index 39b7624097..3d37d1ef82 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -680,11 +680,11 @@ void SetLanguageIDs() } else { - DWORD lang = 0; + uint32_t lang = 0; - ((BYTE *)&lang)[0] = (language)[0]; - ((BYTE *)&lang)[1] = (language)[1]; - ((BYTE *)&lang)[2] = (language)[2]; + ((uint8_t *)&lang)[0] = (language)[0]; + ((uint8_t *)&lang)[1] = (language)[1]; + ((uint8_t *)&lang)[2] = (language)[2]; LanguageIDs[0] = lang; LanguageIDs[1] = lang; LanguageIDs[2] = lang; @@ -910,7 +910,7 @@ void ToEditControl(HWND edit, const char *buf, wchar_t *wbuf, int bpos) }; for (int i = 0; i <= bpos; ++i) { - wchar_t code = (BYTE)buf[i]; + wchar_t code = (uint8_t)buf[i]; if (code >= 0x1D && code <= 0x1F) { // The bar characters, most commonly used to indicate map changes code = 0x2550; // Box Drawings Double Horizontal @@ -985,7 +985,7 @@ static void DoPrintStr(const char *cp, HWND edit, HANDLE StdOut) } else { - const BYTE *color_id = (const BYTE *)cp + 1; + const uint8_t *color_id = (const uint8_t *)cp + 1; EColorRange range = V_ParseFontColor(color_id, CR_UNTRANSLATED, CR_YELLOW); cp = (const char *)color_id; @@ -999,7 +999,7 @@ static void DoPrintStr(const char *cp, HWND edit, HANDLE StdOut) // eight basic colors, and each comes in a dark and a bright // variety. float h, s, v, r, g, b; - WORD attrib = 0; + int attrib = 0; RGBtoHSV(color.r / 255.f, color.g / 255.f, color.b / 255.f, &h, &s, &v); if (s != 0) @@ -1016,7 +1016,7 @@ static void DoPrintStr(const char *cp, HWND edit, HANDLE StdOut) else if (v < 0.90) attrib = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; else attrib = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY; } - SetConsoleTextAttribute(StdOut, attrib); + SetConsoleTextAttribute(StdOut, (WORD)attrib); } if (edit != NULL) { @@ -1376,7 +1376,7 @@ static HCURSOR CreateCompatibleCursor(FTexture *cursorpic) Rectangle(xor_mask_dc, 0, 0, 32, 32); FBitmap bmp; - const BYTE *pixels; + const uint8_t *pixels; bmp.Create(picwidth, picheight); cursorpic->CopyTrueColorPixels(&bmp, 0, 0); @@ -1387,7 +1387,7 @@ static HCURSOR CreateCompatibleCursor(FTexture *cursorpic) { for (int x = 0; x < picwidth; ++x) { - const BYTE *bgra = &pixels[x*4 + y*bmp.GetPitch()]; + const uint8_t *bgra = &pixels[x*4 + y*bmp.GetPitch()]; if (bgra[3] != 0) { SetPixelV(and_mask_dc, x, y, RGB(0,0,0)); @@ -1463,7 +1463,7 @@ static HCURSOR CreateAlphaCursor(FTexture *cursorpic) // a negative pitch so that CopyTrueColorPixels will use GDI's orientation. if (scale == 1) { - FBitmap bmp((BYTE *)bits + 31 * 32 * 4, -32 * 4, 32, 32); + FBitmap bmp((uint8_t *)bits + 31 * 32 * 4, -32 * 4, 32, 32); cursorpic->CopyTrueColorPixels(&bmp, 0, 0); } else @@ -1471,7 +1471,7 @@ static HCURSOR CreateAlphaCursor(FTexture *cursorpic) TArray unscaled; unscaled.Resize(32 * 32); for (int i = 0; i < 32 * 32; i++) unscaled[i] = 0; - FBitmap bmp((BYTE *)&unscaled[0] + 31 * 32 * 4, -32 * 4, 32, 32); + FBitmap bmp((uint8_t *)&unscaled[0] + 31 * 32 * 4, -32 * 4, 32, 32); cursorpic->CopyTrueColorPixels(&bmp, 0, 0); uint32_t *scaled = (uint32_t*)bits; for (int y = 0; y < 32 * scale; y++) @@ -1766,7 +1766,7 @@ unsigned int I_MakeRNGSeed() { return (unsigned int)time(NULL); } - if (!CryptGenRandom(prov, sizeof(seed), (BYTE *)&seed)) + if (!CryptGenRandom(prov, sizeof(seed), (uint8_t *)&seed)) { seed = (unsigned int)time(NULL); } @@ -1834,9 +1834,9 @@ int VS14Stat(const char *path, struct _stat64i32 *buffer) buffer->st_uid = 0; buffer->st_gid = 0; buffer->st_size = data.nFileSizeLow; - buffer->st_atime = (*(QWORD*)&data.ftLastAccessTime) / 10000000 - 11644473600LL; - buffer->st_mtime = (*(QWORD*)&data.ftLastWriteTime) / 10000000 - 11644473600LL; - buffer->st_ctime = (*(QWORD*)&data.ftCreationTime) / 10000000 - 11644473600LL; + buffer->st_atime = (*(uint64_t*)&data.ftLastAccessTime) / 10000000 - 11644473600LL; + buffer->st_mtime = (*(uint64_t*)&data.ftLastWriteTime) / 10000000 - 11644473600LL; + buffer->st_ctime = (*(uint64_t*)&data.ftCreationTime) / 10000000 - 11644473600LL; return 0; } #endif diff --git a/src/win32/i_xinput.cpp b/src/win32/i_xinput.cpp index 7286a9d8f2..58dcfe0c89 100644 --- a/src/win32/i_xinput.cpp +++ b/src/win32/i_xinput.cpp @@ -91,7 +91,7 @@ protected: float DeadZone; float Multiplier; EJoyAxis GameAxis; - BYTE ButtonValue; + uint8_t ButtonValue; }; struct DefaultAxisConfig { @@ -287,7 +287,7 @@ void FXInputController::ProcessInput() void FXInputController::ProcessThumbstick(int value1, AxisInfo *axis1, int value2, AxisInfo *axis2, int base) { - BYTE buttonstate; + uint8_t buttonstate; double axisval1, axisval2; axisval1 = (value1 - SHRT_MIN) * 2.0 / 65536 - 1.0; @@ -314,7 +314,7 @@ void FXInputController::ProcessThumbstick(int value1, AxisInfo *axis1, void FXInputController::ProcessTrigger(int value, AxisInfo *axis, int base) { - BYTE buttonstate; + uint8_t buttonstate; double axisval; axisval = Joy_RemoveDeadZone(value / 256.0, axis->DeadZone, &buttonstate); diff --git a/src/win32/st_start.cpp b/src/win32/st_start.cpp index 4c322b90e9..391277caf6 100644 --- a/src/win32/st_start.cpp +++ b/src/win32/st_start.cpp @@ -161,8 +161,8 @@ public: void NetDone(); // Hexen's notch graphics, converted to chunky pixels. - BYTE * NotchBits; - BYTE * NetNotchBits; + uint8_t * NotchBits; + uint8_t * NetNotchBits; }; class FStrifeStartupScreen : public FGraphicalStartupScreen @@ -175,7 +175,7 @@ public: protected: void DrawStuff(int old_laser, int new_laser); - BYTE *StartupPics[4+2+1]; + uint8_t *StartupPics[4+2+1]; }; // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- @@ -187,19 +187,19 @@ int LayoutNetStartPane (HWND pane, int w); bool ST_Util_CreateStartupWindow (); void ST_Util_SizeWindowForBitmap (int scale); BITMAPINFO *ST_Util_CreateBitmap (int width, int height, int color_bits); -BYTE *ST_Util_BitsForBitmap (BITMAPINFO *bitmap_info); +uint8_t *ST_Util_BitsForBitmap (BITMAPINFO *bitmap_info); void ST_Util_FreeBitmap (BITMAPINFO *bitmap_info); void ST_Util_BitmapColorsFromPlaypal (BITMAPINFO *bitmap_info); -void ST_Util_PlanarToChunky4 (BYTE *dest, const BYTE *src, int width, int height); -void ST_Util_DrawBlock (BITMAPINFO *bitmap_info, const BYTE *src, int x, int y, int bytewidth, int height); -void ST_Util_ClearBlock (BITMAPINFO *bitmap_info, BYTE fill, int x, int y, int bytewidth, int height); +void ST_Util_PlanarToChunky4 (uint8_t *dest, const uint8_t *src, int width, int height); +void ST_Util_DrawBlock (BITMAPINFO *bitmap_info, const uint8_t *src, int x, int y, int bytewidth, int height); +void ST_Util_ClearBlock (BITMAPINFO *bitmap_info, uint8_t fill, int x, int y, int bytewidth, int height); void ST_Util_InvalidateRect (HWND hwnd, BITMAPINFO *bitmap_info, int left, int top, int right, int bottom); -BYTE *ST_Util_LoadFont (const char *filename); -void ST_Util_FreeFont (BYTE *font); -BITMAPINFO *ST_Util_AllocTextBitmap (const BYTE *font); -void ST_Util_DrawTextScreen (BITMAPINFO *bitmap_info, const BYTE *text_screen, const BYTE *font); -void ST_Util_UpdateTextBlink (BITMAPINFO *bitmap_info, const BYTE *text_screen, const BYTE *font, bool blink_on); -void ST_Util_DrawChar (BITMAPINFO *screen, const BYTE *font, int x, int y, BYTE charnum, BYTE attrib); +uint8_t *ST_Util_LoadFont (const char *filename); +void ST_Util_FreeFont (uint8_t *font); +BITMAPINFO *ST_Util_AllocTextBitmap (const uint8_t *font); +void ST_Util_DrawTextScreen (BITMAPINFO *bitmap_info, const uint8_t *text_screen, const uint8_t *font); +void ST_Util_UpdateTextBlink (BITMAPINFO *bitmap_info, const uint8_t *text_screen, const uint8_t *font, bool blink_on); +void ST_Util_DrawChar (BITMAPINFO *screen, const uint8_t *font, int x, int y, uint8_t charnum, uint8_t attrib); // PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- @@ -650,12 +650,12 @@ FHexenStartupScreen::FHexenStartupScreen(int max_progress, HRESULT &hr) return; } - NetNotchBits = new BYTE[ST_NETNOTCH_WIDTH / 2 * ST_NETNOTCH_HEIGHT]; + NetNotchBits = new uint8_t[ST_NETNOTCH_WIDTH / 2 * ST_NETNOTCH_HEIGHT]; Wads.ReadLump (netnotch_lump, NetNotchBits); - NotchBits = new BYTE[ST_NOTCH_WIDTH / 2 * ST_NOTCH_HEIGHT]; + NotchBits = new uint8_t[ST_NOTCH_WIDTH / 2 * ST_NOTCH_HEIGHT]; Wads.ReadLump (notch_lump, NotchBits); - BYTE startup_screen[153648]; + uint8_t startup_screen[153648]; union { RGBQUAD color; @@ -805,8 +805,8 @@ FHereticStartupScreen::FHereticStartupScreen(int max_progress, HRESULT &hr) : FGraphicalStartupScreen(max_progress) { int loading_lump = Wads.CheckNumForName ("LOADING"); - BYTE loading_screen[4000]; - BYTE *font; + uint8_t loading_screen[4000]; + uint8_t *font; hr = E_FAIL; if (loading_lump < 0 || Wads.LumpLength (loading_lump) != 4000 || !ST_Util_CreateStartupWindow()) @@ -886,7 +886,7 @@ void FHereticStartupScreen::Progress() void FHereticStartupScreen::LoadingStatus(const char *message, int colors) { - BYTE *font = ST_Util_LoadFont (TEXT_FONT_NAME); + uint8_t *font = ST_Util_LoadFont (TEXT_FONT_NAME); if (font != NULL) { int x; @@ -912,7 +912,7 @@ void FHereticStartupScreen::LoadingStatus(const char *message, int colors) void FHereticStartupScreen::AppendStatusLine(const char *status) { - BYTE *font = ST_Util_LoadFont (TEXT_FONT_NAME); + uint8_t *font = ST_Util_LoadFont (TEXT_FONT_NAME); if (font != NULL) { int x; @@ -979,7 +979,7 @@ FStrifeStartupScreen::FStrifeStartupScreen(int max_progress, HRESULT &hr) if (lumpnum >= 0 && (lumplen = Wads.LumpLength (lumpnum)) == StrifeStartupPicSizes[i]) { FWadLump lumpr = Wads.OpenLumpNum (lumpnum); - StartupPics[i] = new BYTE[lumplen]; + StartupPics[i] = new uint8_t[lumplen]; lumpr.Read (StartupPics[i], lumplen); } } @@ -1096,8 +1096,8 @@ void ST_Endoom() int endoom_lump = Wads.CheckNumForFullName (gameinfo.Endoom, true); - BYTE endoom_screen[4000]; - BYTE *font; + uint8_t endoom_screen[4000]; + uint8_t *font; MSG mess; BOOL bRet; bool blinking = false, blinkstate = false; @@ -1273,10 +1273,10 @@ void ST_Util_SizeWindowForBitmap (int scale) // //========================================================================== -void ST_Util_PlanarToChunky4 (BYTE *dest, const BYTE *src, int width, int height) +void ST_Util_PlanarToChunky4 (uint8_t *dest, const uint8_t *src, int width, int height) { int y, x; - const BYTE *src1, *src2, *src3, *src4; + const uint8_t *src1, *src2, *src3, *src4; size_t plane_size = width / 8 * height; src1 = src; @@ -1315,7 +1315,7 @@ void ST_Util_PlanarToChunky4 (BYTE *dest, const BYTE *src, int width, int height // //========================================================================== -void ST_Util_DrawBlock (BITMAPINFO *bitmap_info, const BYTE *src, int x, int y, int bytewidth, int height) +void ST_Util_DrawBlock (BITMAPINFO *bitmap_info, const uint8_t *src, int x, int y, int bytewidth, int height) { if (src == NULL) { @@ -1324,7 +1324,7 @@ void ST_Util_DrawBlock (BITMAPINFO *bitmap_info, const BYTE *src, int x, int y, int pitchshift = int(bitmap_info->bmiHeader.biBitCount == 4); int destpitch = bitmap_info->bmiHeader.biWidth >> pitchshift; - BYTE *dest = ST_Util_BitsForBitmap(bitmap_info) + (x >> pitchshift) + y * destpitch; + uint8_t *dest = ST_Util_BitsForBitmap(bitmap_info) + (x >> pitchshift) + y * destpitch; ST_Util_InvalidateRect (StartupScreen, bitmap_info, x, y, x + (bytewidth << pitchshift), y + height); @@ -1364,11 +1364,11 @@ void ST_Util_DrawBlock (BITMAPINFO *bitmap_info, const BYTE *src, int x, int y, // //========================================================================== -void ST_Util_ClearBlock (BITMAPINFO *bitmap_info, BYTE fill, int x, int y, int bytewidth, int height) +void ST_Util_ClearBlock (BITMAPINFO *bitmap_info, uint8_t fill, int x, int y, int bytewidth, int height) { int pitchshift = int(bitmap_info->bmiHeader.biBitCount == 4); int destpitch = bitmap_info->bmiHeader.biWidth >> pitchshift; - BYTE *dest = ST_Util_BitsForBitmap(bitmap_info) + (x >> pitchshift) + y * destpitch; + uint8_t *dest = ST_Util_BitsForBitmap(bitmap_info) + (x >> pitchshift) + y * destpitch; ST_Util_InvalidateRect (StartupScreen, bitmap_info, x, y, x + (bytewidth << pitchshift), y + height); @@ -1424,9 +1424,9 @@ BITMAPINFO *ST_Util_CreateBitmap (int width, int height, int color_bits) // //========================================================================== -BYTE *ST_Util_BitsForBitmap (BITMAPINFO *bitmap_info) +uint8_t *ST_Util_BitsForBitmap (BITMAPINFO *bitmap_info) { - return (BYTE *)bitmap_info + sizeof(BITMAPINFOHEADER) + (sizeof(RGBQUAD) << bitmap_info->bmiHeader.biBitCount); + return (uint8_t *)bitmap_info + sizeof(BITMAPINFOHEADER) + (sizeof(RGBQUAD) << bitmap_info->bmiHeader.biBitCount); } //========================================================================== @@ -1452,7 +1452,7 @@ void ST_Util_FreeBitmap (BITMAPINFO *bitmap_info) void ST_Util_BitmapColorsFromPlaypal (BITMAPINFO *bitmap_info) { - BYTE playpal[768]; + uint8_t playpal[768]; int i; { @@ -1499,10 +1499,10 @@ void ST_Util_InvalidateRect (HWND hwnd, BITMAPINFO *bitmap_info, int left, int t // //========================================================================== -BYTE *ST_Util_LoadFont (const char *filename) +uint8_t *ST_Util_LoadFont (const char *filename) { int lumpnum, lumplen, height; - BYTE *font; + uint8_t *font; lumpnum = Wads.CheckNumForFullName (filename); if (lumpnum < 0) @@ -1519,13 +1519,13 @@ BYTE *ST_Util_LoadFont (const char *filename) { // let's be reasonable here return NULL; } - font = new BYTE[lumplen + 1]; + font = new uint8_t[lumplen + 1]; font[0] = height; // Store font height in the first byte. Wads.ReadLump (lumpnum, font + 1); return font; } -void ST_Util_FreeFont (BYTE *font) +void ST_Util_FreeFont (uint8_t *font) { delete[] font; } @@ -1539,7 +1539,7 @@ void ST_Util_FreeFont (BYTE *font) // //========================================================================== -BITMAPINFO *ST_Util_AllocTextBitmap (const BYTE *font) +BITMAPINFO *ST_Util_AllocTextBitmap (const uint8_t *font) { BITMAPINFO *bitmap = ST_Util_CreateBitmap (80 * 8, 25 * font[0], 4); memcpy (bitmap->bmiColors, TextModePalette, sizeof(TextModePalette)); @@ -1555,7 +1555,7 @@ BITMAPINFO *ST_Util_AllocTextBitmap (const BYTE *font) // //========================================================================== -void ST_Util_DrawTextScreen (BITMAPINFO *bitmap_info, const BYTE *text_screen, const BYTE *font) +void ST_Util_DrawTextScreen (BITMAPINFO *bitmap_info, const uint8_t *text_screen, const uint8_t *font) { int x, y; @@ -1578,20 +1578,20 @@ void ST_Util_DrawTextScreen (BITMAPINFO *bitmap_info, const BYTE *text_screen, c // //========================================================================== -void ST_Util_DrawChar (BITMAPINFO *screen, const BYTE *font, int x, int y, BYTE charnum, BYTE attrib) +void ST_Util_DrawChar (BITMAPINFO *screen, const uint8_t *font, int x, int y, uint8_t charnum, uint8_t attrib) { - const BYTE bg_left = attrib & 0x70; - const BYTE fg = attrib & 0x0F; - const BYTE fg_left = fg << 4; - const BYTE bg = bg_left >> 4; - const BYTE color_array[4] = { (BYTE)(bg_left | bg), (BYTE)(attrib & 0x7F), (BYTE)(fg_left | bg), (BYTE)(fg_left | fg) }; - const BYTE *src = font + 1 + charnum * font[0]; + const uint8_t bg_left = attrib & 0x70; + const uint8_t fg = attrib & 0x0F; + const uint8_t fg_left = fg << 4; + const uint8_t bg = bg_left >> 4; + const uint8_t color_array[4] = { (uint8_t)(bg_left | bg), (uint8_t)(attrib & 0x7F), (uint8_t)(fg_left | bg), (uint8_t)(fg_left | fg) }; + const uint8_t *src = font + 1 + charnum * font[0]; int pitch = screen->bmiHeader.biWidth >> 1; - BYTE *dest = ST_Util_BitsForBitmap(screen) + x*4 + y * font[0] * pitch; + uint8_t *dest = ST_Util_BitsForBitmap(screen) + x*4 + y * font[0] * pitch; for (y = font[0]; y > 0; --y) { - BYTE srcbyte = *src++; + uint8_t srcbyte = *src++; // Pixels 0 and 1 dest[0] = color_array[(srcbyte >> 6) & 3]; @@ -1614,7 +1614,7 @@ void ST_Util_DrawChar (BITMAPINFO *screen, const BYTE *font, int x, int y, BYTE // //========================================================================== -void ST_Util_UpdateTextBlink (BITMAPINFO *bitmap_info, const BYTE *text_screen, const BYTE *font, bool on) +void ST_Util_UpdateTextBlink (BITMAPINFO *bitmap_info, const uint8_t *text_screen, const uint8_t *font, bool on) { int x, y; diff --git a/src/win32/win32swiface.h b/src/win32/win32swiface.h index 7e2d85b2d8..65cb4583d3 100644 --- a/src/win32/win32swiface.h +++ b/src/win32/win32swiface.h @@ -61,7 +61,7 @@ private: HRESULT AttemptRestore (); HRESULT LastHR; - BYTE GammaTable[3][256]; + uint8_t GammaTable[3][256]; PalEntry SourcePalette[256]; PALETTEENTRY PalEntries[256]; DWORD FlipFlags; @@ -124,7 +124,7 @@ public: bool PaintToWindow (); void SetVSync (bool vsync); void NewRefreshRate(); - void GetScreenshotBuffer(const BYTE *&buffer, int &pitch, ESSType &color_type); + void GetScreenshotBuffer(const uint8_t *&buffer, int &pitch, ESSType &color_type); void ReleaseScreenshotBuffer(); void SetBlendingRect (int x1, int y1, int x2, int y2); bool Begin2D (bool copy3d); @@ -169,14 +169,14 @@ private: { struct { - BYTE Flags; - BYTE ShaderNum:4; - BYTE BlendOp:4; - BYTE SrcBlend, DestBlend; + uint8_t Flags; + uint8_t ShaderNum:4; + uint8_t BlendOp:4; + uint8_t SrcBlend, DestBlend; }; DWORD Group1; }; - BYTE Desat; + uint8_t Desat; D3DPal *Palette; IDirect3DTexture9 *Texture; int NumVerts; // Number of _unique_ vertices used by this set. @@ -304,7 +304,7 @@ private: bool SM14; bool GatheringWipeScreen; bool AALines; - BYTE BlockNum; + uint8_t BlockNum; D3DPal *Palettes; D3DTex *Textures; Atlas *Atlases; diff --git a/src/x86.h b/src/x86.h index 39ea9b6b63..c821d18024 100644 --- a/src/x86.h +++ b/src/x86.h @@ -16,19 +16,19 @@ struct CPUInfo // 92 bytes uint32_t dwCPUString[12]; }; - BYTE Stepping; - BYTE Model; - BYTE Family; - BYTE Type; + uint8_t Stepping; + uint8_t Model; + uint8_t Family; + uint8_t Type; union { struct { - BYTE BrandIndex; - BYTE CLFlush; - BYTE CPUCount; - BYTE APICID; + uint8_t BrandIndex; + uint8_t CLFlush; + uint8_t CPUCount; + uint8_t APICID; uint32_t bSSE3:1; uint32_t DontCare1:8; @@ -81,19 +81,19 @@ struct CPUInfo // 92 bytes uint32_t FeatureFlags[4]; }; - BYTE AMDStepping; - BYTE AMDModel; - BYTE AMDFamily; - BYTE bIsAMD; + uint8_t AMDStepping; + uint8_t AMDModel; + uint8_t AMDFamily; + uint8_t bIsAMD; union { struct { - BYTE DataL1LineSize; - BYTE DataL1LinesPerTag; - BYTE DataL1Associativity; - BYTE DataL1SizeKB; + uint8_t DataL1LineSize; + uint8_t DataL1LinesPerTag; + uint8_t DataL1Associativity; + uint8_t DataL1SizeKB; }; uint32_t AMD_DataL1Info; }; diff --git a/src/xlat/xlat.h b/src/xlat/xlat.h index 770f69bcae..cf5fc70895 100644 --- a/src/xlat/xlat.h +++ b/src/xlat/xlat.h @@ -66,19 +66,19 @@ struct FBoomArg { bool bOrExisting; bool bUseConstant; - BYTE ListSize; - BYTE ArgNum; - BYTE ConstantValue; + uint8_t ListSize; + uint8_t ArgNum; + uint8_t ConstantValue; uint16_t AndValue; uint16_t ResultFilter[15]; - BYTE ResultValue[15]; + uint8_t ResultValue[15]; }; struct FBoomTranslator { uint16_t FirstLinetype; uint16_t LastLinetype; - BYTE NewSpecial; + uint8_t NewSpecial; TArray Args; } ;