From ada28d8d04a9b054419972068f0f768c96dd1a51 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 17 Apr 2021 10:14:03 +0200 Subject: [PATCH] - Blood: replaced 'unsigned char' with 'uint8_t' and 'signed char' with 'int8_t'. Preparation for getting rid of all those excessively used plain chars which are a menace to code stability. --- source/games/blood/src/actor.cpp | 2 +- source/games/blood/src/actor.h | 32 +++++++++++++-------------- source/games/blood/src/db.cpp | 2 +- source/games/blood/src/dude.h | 2 +- source/games/blood/src/fire.cpp | 4 ++-- source/games/blood/src/hudsprites.cpp | 4 ++-- source/games/blood/src/levels.h | 4 ++-- source/games/blood/src/misc.h | 2 +- source/games/blood/src/player.h | 2 +- source/games/blood/src/qav.h | 8 +++---- source/games/blood/src/seq.h | 4 ++-- source/games/blood/src/tile.cpp | 2 +- 12 files changed, 34 insertions(+), 34 deletions(-) diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index 364373526..e892cc8db 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -6533,7 +6533,7 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6, int y = gHitInfo.hity-MulScale(a5, 16, 14); int z = gHitInfo.hitz-MulScale(a6, 256, 14); short nSector = gHitInfo.hitsect; - unsigned char nSurf = kSurfNone; + uint8_t nSurf = kSurfNone; if (nRange == 0 || approxDist(gHitInfo.hitx-pShooter->x, gHitInfo.hity-pShooter->y) < nRange) { switch (hit) diff --git a/source/games/blood/src/actor.h b/source/games/blood/src/actor.h index de2f2788c..590927a7b 100644 --- a/source/games/blood/src/actor.h +++ b/source/games/blood/src/actor.h @@ -70,16 +70,16 @@ struct THINGINFO { short startHealth; short mass; - unsigned char clipdist; + uint8_t clipdist; short flags; int elastic; // elasticity int dmgResist; // damage resistance short cstat; short picnum; char shade; - unsigned char pal; - unsigned char xrepeat; // xrepeat - unsigned char yrepeat; // yrepeat + uint8_t pal; + uint8_t xrepeat; // xrepeat + uint8_t yrepeat; // yrepeat int dmgControl[kDamageMax]; // damage }; @@ -89,11 +89,11 @@ struct AMMOITEMDATA short picnum; char shade; char pal; - unsigned char xrepeat; - unsigned char yrepeat; + uint8_t xrepeat; + uint8_t yrepeat; short count; - unsigned char type; - unsigned char weaponType; + uint8_t type; + uint8_t weaponType; }; struct WEAPONITEMDATA @@ -102,8 +102,8 @@ struct WEAPONITEMDATA short picnum; char shade; char pal; - unsigned char xrepeat; - unsigned char yrepeat; + uint8_t xrepeat; + uint8_t yrepeat; short type; short ammoType; short count; @@ -115,8 +115,8 @@ struct ITEMDATA short picnum; char shade; char pal; - unsigned char xrepeat; - unsigned char yrepeat; + uint8_t xrepeat; + uint8_t yrepeat; short packSlot; }; @@ -125,15 +125,15 @@ struct MissileType short picnum; int velocity; int angleOfs; - unsigned char xrepeat; - unsigned char yrepeat; + uint8_t xrepeat; + uint8_t yrepeat; char shade; - unsigned char clipDist; + uint8_t clipDist; }; struct EXPLOSION { - unsigned char repeat; + uint8_t repeat; char dmg; char dmgRng; int radius; diff --git a/source/games/blood/src/db.cpp b/source/games/blood/src/db.cpp index 07d372ab7..9b0d3b362 100644 --- a/source/games/blood/src/db.cpp +++ b/source/games/blood/src/db.cpp @@ -979,7 +979,7 @@ void dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, shor fr.Seek(0, FileReader::SeekSet); auto buffer = fr.Read(); - unsigned char md4[16]; + uint8_t md4[16]; md4once(buffer.Data(), buffer.Size(), md4); G_LoadMapHack(mapname, md4); diff --git a/source/games/blood/src/dude.h b/source/games/blood/src/dude.h index dd899dd0f..5bf74b744 100644 --- a/source/games/blood/src/dude.h +++ b/source/games/blood/src/dude.h @@ -30,7 +30,7 @@ struct DUDEINFO { short startHealth; // health unsigned short mass; // mass int at6; // unused? - unsigned char clipdist; // clipdist + uint8_t clipdist; // clipdist int eyeHeight; int aimHeight; // used by just Cerberus int hearDist; // hear radius diff --git a/source/games/blood/src/fire.cpp b/source/games/blood/src/fire.cpp index de4f759cb..9b76b20cd 100644 --- a/source/games/blood/src/fire.cpp +++ b/source/games/blood/src/fire.cpp @@ -109,10 +109,10 @@ void FireProcess(void) void CellularFrame(char *pFrame, int sizeX, int sizeY) { int nSquare = sizeX * sizeY; - unsigned char *pPtr1 = (unsigned char*)pFrame; + uint8_t *pPtr1 = (uint8_t*)pFrame; while (nSquare--) { - unsigned char *pPtr2 = pPtr1+sizeX; + uint8_t *pPtr2 = pPtr1+sizeX; int sum = *(pPtr2-1) + *pPtr2 + *(pPtr2+1) + *(pPtr2+sizeX); if (*(pPtr2+sizeX) > 96) { diff --git a/source/games/blood/src/hudsprites.cpp b/source/games/blood/src/hudsprites.cpp index c570b115d..b7324cdd4 100644 --- a/source/games/blood/src/hudsprites.cpp +++ b/source/games/blood/src/hudsprites.cpp @@ -44,8 +44,8 @@ BEGIN_BLD_NS static struct { short nTile; - unsigned char nStat; - unsigned char nPal; + uint8_t nStat; + uint8_t nPal; int nScale; short nX, nY; } burnTable[9] = { diff --git a/source/games/blood/src/levels.h b/source/games/blood/src/levels.h index ac0be6f78..27d65964d 100644 --- a/source/games/blood/src/levels.h +++ b/source/games/blood/src/levels.h @@ -47,8 +47,8 @@ enum EGameFlag }; struct GAMEOPTIONS { - unsigned char nGameType; - unsigned char nDifficulty; + uint8_t nGameType; + uint8_t nDifficulty; char nMonsterSettings; int uGameFlags; int uNetGameFlags; diff --git a/source/games/blood/src/misc.h b/source/games/blood/src/misc.h index 0a2ad62fa..ca42e1124 100644 --- a/source/games/blood/src/misc.h +++ b/source/games/blood/src/misc.h @@ -115,7 +115,7 @@ enum SurfaceType { }; extern char surfType[MAXTILES]; -extern signed char tileShade[MAXTILES]; +extern int8_t tileShade[MAXTILES]; extern short voxelIndex[MAXTILES]; extern int nPrecacheCount; diff --git a/source/games/blood/src/player.h b/source/games/blood/src/player.h index 84bd5030c..53f4dc4a3 100644 --- a/source/games/blood/src/player.h +++ b/source/games/blood/src/player.h @@ -182,7 +182,7 @@ struct PLAYER struct AMMOINFO { int max; - signed char vectorType; + int8_t vectorType; }; struct POWERUPINFO diff --git a/source/games/blood/src/qav.h b/source/games/blood/src/qav.h index 8b73ca51c..9c1cdde93 100644 --- a/source/games/blood/src/qav.h +++ b/source/games/blood/src/qav.h @@ -46,7 +46,7 @@ struct TILE_FRAME int y; int z; int stat; - signed char shade; + int8_t shade; char palnum; unsigned short angle; }; @@ -54,9 +54,9 @@ struct TILE_FRAME struct SOUNDINFO { int sound; - unsigned char priority; - unsigned char sndFlags; // (by NoOne) Various sound flags - unsigned char sndRange; // (by NoOne) Random sound range + uint8_t priority; + uint8_t sndFlags; // (by NoOne) Various sound flags + uint8_t sndRange; // (by NoOne) Random sound range char reserved[1]; }; diff --git a/source/games/blood/src/seq.h b/source/games/blood/src/seq.h index 724f5b081..7e0baed6f 100644 --- a/source/games/blood/src/seq.h +++ b/source/games/blood/src/seq.h @@ -74,7 +74,7 @@ struct Seq { struct ACTIVE { - unsigned char type; + uint8_t type; unsigned short xindex; }; @@ -86,7 +86,7 @@ struct SEQINST int nSeqID; int callback; short timeCounter; - unsigned char frameIndex; + uint8_t frameIndex; void Update(); }; diff --git a/source/games/blood/src/tile.cpp b/source/games/blood/src/tile.cpp index ac46809d1..0eff626e5 100644 --- a/source/games/blood/src/tile.cpp +++ b/source/games/blood/src/tile.cpp @@ -41,7 +41,7 @@ int tileEnd[256]; int hTileFile[256]; char surfType[kMaxTiles]; -signed char tileShade[kMaxTiles]; +int8_t tileShade[kMaxTiles]; short voxelIndex[kMaxTiles]; const char *pzBaseFileName = "TILES%03i.ART"; //"TILES%03i.ART";