From c5b1932a8683e2b126812eca8cbe5b56a20531d9 Mon Sep 17 00:00:00 2001 From: Sam V Date: Fri, 19 Nov 2021 20:40:36 +0100 Subject: [PATCH] Remove all remaining references to BOOL Rework all uses of BOOL member variables to use bool instead Change save game system to use bool for FIELD_BOOLEAN Remove BOOL typedefs #59 --- common/Platform.h | 1 - dlls/aflock.cpp | 6 +++--- dlls/agrunt.cpp | 2 +- dlls/barnacle.cpp | 4 ++-- dlls/barney.cpp | 4 ++-- dlls/bullsquid.cpp | 2 +- dlls/cbase.h | 4 ++-- dlls/gamerules.h | 2 +- dlls/hassassin.cpp | 2 +- dlls/hgrunt.cpp | 6 +++--- dlls/houndeye.cpp | 4 ++-- dlls/ichthyosaur.cpp | 2 +- dlls/leech.cpp | 2 +- dlls/monstermaker.cpp | 4 ++-- dlls/plats.cpp | 4 ++-- dlls/player.h | 12 ++++++------ dlls/roach.cpp | 2 +- dlls/saverestore.h | 2 +- dlls/scripted.cpp | 2 +- dlls/scripted.h | 2 +- dlls/sound.cpp | 4 ++-- dlls/soundent.h | 2 +- dlls/teamplay_gamerules.h | 6 +++--- dlls/util.cpp | 6 +++--- dlls/util.h | 3 --- dlls/weapons.h | 6 +++--- 26 files changed, 46 insertions(+), 50 deletions(-) diff --git a/common/Platform.h b/common/Platform.h index 48d652194..6cd869a95 100644 --- a/common/Platform.h +++ b/common/Platform.h @@ -117,7 +117,6 @@ using qboolean = int; #define DLLEXPORT __declspec( dllexport ) #define DLLHIDDEN #else // WIN32 -typedef int BOOL; #define MAX_PATH PATH_MAX #define stricmp strcasecmp diff --git a/dlls/aflock.cpp b/dlls/aflock.cpp index 592781f0a..5e23fcc4b 100644 --- a/dlls/aflock.cpp +++ b/dlls/aflock.cpp @@ -96,9 +96,9 @@ class CFlockingFlyer : public CBaseMonster CFlockingFlyer *m_pSquadLeader; CFlockingFlyer *m_pSquadNext; - BOOL m_fTurning;// is this boid turning? - BOOL m_fCourseAdjust;// followers set this flag true to override flocking while they avoid something - BOOL m_fPathBlocked;// true if there is an obstacle ahead + bool m_fTurning;// is this boid turning? + bool m_fCourseAdjust;// followers set this flag true to override flocking while they avoid something + bool m_fPathBlocked;// true if there is an obstacle ahead Vector m_vecReferencePoint;// last place we saw leader Vector m_vecAdjustedVelocity;// adjusted velocity (used when fCourseAdjust is true) float m_flGoalSpeed; diff --git a/dlls/agrunt.cpp b/dlls/agrunt.cpp index b3d7de388..834956496 100644 --- a/dlls/agrunt.cpp +++ b/dlls/agrunt.cpp @@ -112,7 +112,7 @@ class CAGrunt : public CSquadMonster static const char *pIdleSounds[]; static const char *pAlertSounds[]; - BOOL m_fCanHornetAttack; + bool m_fCanHornetAttack; float m_flNextHornetAttackCheck; float m_flNextPainTime; diff --git a/dlls/barnacle.cpp b/dlls/barnacle.cpp index bd19dd4f8..4cb52038a 100644 --- a/dlls/barnacle.cpp +++ b/dlls/barnacle.cpp @@ -50,8 +50,8 @@ class CBarnacle : public CBaseMonster float m_flAltitude; float m_flKillVictimTime; int m_cGibs;// barnacle loads up on gibs each time it kills something. - BOOL m_fTongueExtended; - BOOL m_fLiftingPrey; + bool m_fTongueExtended; + bool m_fLiftingPrey; float m_flTongueAdj; }; LINK_ENTITY_TO_CLASS( monster_barnacle, CBarnacle ); diff --git a/dlls/barney.cpp b/dlls/barney.cpp index 75eed5b6c..1c8d89545 100644 --- a/dlls/barney.cpp +++ b/dlls/barney.cpp @@ -77,10 +77,10 @@ class CBarney : public CTalkMonster int Restore( CRestore &restore ) override; static TYPEDESCRIPTION m_SaveData[]; - BOOL m_fGunDrawn; + bool m_fGunDrawn; float m_painTime; float m_checkAttackTime; - BOOL m_lastAttackCheck; + bool m_lastAttackCheck; // UNDONE: What is this for? It isn't used? float m_flPlayerDamage;// how much pain has the player inflicted on me? diff --git a/dlls/bullsquid.cpp b/dlls/bullsquid.cpp index 09c2fe109..d9501c36b 100644 --- a/dlls/bullsquid.cpp +++ b/dlls/bullsquid.cpp @@ -220,7 +220,7 @@ class CBullsquid : public CBaseMonster CUSTOM_SCHEDULES; static TYPEDESCRIPTION m_SaveData[]; - BOOL m_fCanThreatDisplay;// this is so the squid only does the "I see a headcrab!" dance one time. + bool m_fCanThreatDisplay;// this is so the squid only does the "I see a headcrab!" dance one time. float m_flLastHurtTime;// we keep track of this, because if something hurts a squid, it will forget about its love of headcrabs for a while. float m_flNextSpitTime;// last time the bullsquid used the spit attack. diff --git a/dlls/cbase.h b/dlls/cbase.h index 6dcc871d4..a3cd254b4 100644 --- a/dlls/cbase.h +++ b/dlls/cbase.h @@ -494,8 +494,8 @@ class CBaseAnimating : public CBaseDelay float m_flFrameRate; // computed FPS for current sequence float m_flGroundSpeed; // computed linear movement rate for current sequence float m_flLastEventCheck; // last time the event list was checked - BOOL m_fSequenceFinished;// flag set when StudioAdvanceFrame moves across a frame boundry - BOOL m_fSequenceLoops; // true if the sequence loops + bool m_fSequenceFinished;// flag set when StudioAdvanceFrame moves across a frame boundry + bool m_fSequenceLoops; // true if the sequence loops }; diff --git a/dlls/gamerules.h b/dlls/gamerules.h index 89d5d6eae..d7edb9d55 100644 --- a/dlls/gamerules.h +++ b/dlls/gamerules.h @@ -356,7 +356,7 @@ class CHalfLifeMultiplay : public CGameRules virtual void ChangeLevel(); virtual void GoToIntermission(); float m_flIntermissionEndTime; - BOOL m_iEndIntermissionButtonHit; + bool m_iEndIntermissionButtonHit; void SendMOTDToClient( edict_t *client ); }; diff --git a/dlls/hassassin.cpp b/dlls/hassassin.cpp index 18a15e96a..a384ee58e 100644 --- a/dlls/hassassin.cpp +++ b/dlls/hassassin.cpp @@ -95,7 +95,7 @@ class CHAssassin : public CBaseMonster float m_flNextGrenadeCheck; Vector m_vecTossVelocity; - BOOL m_fThrowGrenade; + bool m_fThrowGrenade; int m_iTargetRanderamt; diff --git a/dlls/hgrunt.cpp b/dlls/hgrunt.cpp index 47cefe155..7ff988e2e 100644 --- a/dlls/hgrunt.cpp +++ b/dlls/hgrunt.cpp @@ -172,9 +172,9 @@ class CHGrunt : public CSquadMonster Vector m_vecTossVelocity; - BOOL m_fThrowGrenade; - BOOL m_fStanding; - BOOL m_fFirstEncounter;// only put on the handsign show in the squad's first encounter. + bool m_fThrowGrenade; + bool m_fStanding; + bool m_fFirstEncounter;// only put on the handsign show in the squad's first encounter. int m_cClipSize; int m_voicePitch; diff --git a/dlls/houndeye.cpp b/dlls/houndeye.cpp index 1e4883f36..1aabe5c26 100644 --- a/dlls/houndeye.cpp +++ b/dlls/houndeye.cpp @@ -104,8 +104,8 @@ class CHoundeye : public CSquadMonster static TYPEDESCRIPTION m_SaveData[]; int m_iSpriteTexture; - BOOL m_fAsleep;// some houndeyes sleep in idle mode if this is set, the houndeye is lying down - BOOL m_fDontBlink;// don't try to open/close eye if this bit is set! + bool m_fAsleep;// some houndeyes sleep in idle mode if this is set, the houndeye is lying down + bool m_fDontBlink;// don't try to open/close eye if this bit is set! Vector m_vecPackCenter; // the center of the pack. The leader maintains this by averaging the origins of all pack members. }; LINK_ENTITY_TO_CLASS( monster_houndeye, CHoundeye ); diff --git a/dlls/ichthyosaur.cpp b/dlls/ichthyosaur.cpp index 44d04f967..df938cca4 100644 --- a/dlls/ichthyosaur.cpp +++ b/dlls/ichthyosaur.cpp @@ -95,7 +95,7 @@ class CIchthyosaur : public CFlyingMonster float m_flBlink; float m_flEnemyTouched; - BOOL m_bOnAttack; + bool m_bOnAttack; float m_flMaxSpeed; float m_flMinSpeed; diff --git a/dlls/leech.cpp b/dlls/leech.cpp index 11e3695c8..35472312c 100644 --- a/dlls/leech.cpp +++ b/dlls/leech.cpp @@ -123,7 +123,7 @@ class CLeech : public CBaseMonster private: // UNDONE: Remove unused boid vars, do group behavior float m_flTurning;// is this boid turning? - BOOL m_fPathBlocked;// true if there is an obstacle ahead + bool m_fPathBlocked;// true if there is an obstacle ahead float m_flAccelerate; float m_obstacle; float m_top; diff --git a/dlls/monstermaker.cpp b/dlls/monstermaker.cpp index 7ae00b9b6..0e2cc4c57 100644 --- a/dlls/monstermaker.cpp +++ b/dlls/monstermaker.cpp @@ -58,8 +58,8 @@ class CMonsterMaker : public CBaseMonster float m_flGround; // z coord of the ground under me, used to make sure no monsters are under the maker when it drops a new child - BOOL m_fActive; - BOOL m_fFadeChildren;// should we make the children fadeout? + bool m_fActive; + bool m_fFadeChildren;// should we make the children fadeout? }; LINK_ENTITY_TO_CLASS( monstermaker, CMonsterMaker ); diff --git a/dlls/plats.cpp b/dlls/plats.cpp index c1fb4a69c..b4319b9ef 100644 --- a/dlls/plats.cpp +++ b/dlls/plats.cpp @@ -655,7 +655,7 @@ class CFuncTrain : public CBasePlatTrain entvars_t *m_pevCurrentTarget; int m_sounds; - BOOL m_activated; + bool m_activated; }; LINK_ENTITY_TO_CLASS( func_train, CFuncTrain ); @@ -2135,7 +2135,7 @@ class CGunTarget : public CBaseMonster static TYPEDESCRIPTION m_SaveData[]; private: - BOOL m_on; + bool m_on; }; diff --git a/dlls/player.h b/dlls/player.h index 19d049456..0ec39dd6a 100644 --- a/dlls/player.h +++ b/dlls/player.h @@ -157,18 +157,18 @@ class CBasePlayer : public CBaseMonster int m_bitsHUDDamage; // Damage bits for the current fame. These get sent to // the hude via the DAMAGE message - BOOL m_fInitHUD; // True when deferred HUD restart msg needs to be sent - BOOL m_fGameHUDInitialized; + bool m_fInitHUD; // True when deferred HUD restart msg needs to be sent + bool m_fGameHUDInitialized; int m_iTrain; // Train control position - BOOL m_fWeapon; // Set this to false to force a reset of the current weapon HUD info + bool m_fWeapon; // Set this to false to force a reset of the current weapon HUD info EHANDLE m_pTank; // the tank which the player is currently controlling, NULL if no tank EHANDLE m_hViewEntity; // The view entity being used, or null if the player is using itself as the view entity bool m_bResetViewEntity; //True if the player's view needs to be set back to the view entity float m_fDeadTime; // the time at which the player died (used in PlayerDeathThink()) - BOOL m_fNoPlayerSound; // a debugging feature. Player makes no sound if this is true. - BOOL m_fLongJump; // does this player have the longjump module? + bool m_fNoPlayerSound; // a debugging feature. Player makes no sound if this is true. + bool m_fLongJump; // does this player have the longjump module? float m_tSneaking; int m_iUpdateTime; // stores the number of frame ticks before sending HUD update messages @@ -188,7 +188,7 @@ class CBasePlayer : public CBaseMonster int m_rgAmmoLast[MAX_AMMO_SLOTS]; Vector m_vecAutoAim; - BOOL m_fOnTarget; + bool m_fOnTarget; int m_iDeaths; float m_iRespawnFrames; // used in PlayerDeathThink() to make sure players can always respawn diff --git a/dlls/roach.cpp b/dlls/roach.cpp index 31808a021..c0d3eefd1 100644 --- a/dlls/roach.cpp +++ b/dlls/roach.cpp @@ -53,7 +53,7 @@ class CRoach : public CBaseMonster int ISoundMask () override; // UNDONE: These don't necessarily need to be save/restored, but if we add more data, it may - BOOL m_fLightHacked; + bool m_fLightHacked; int m_iMode; // ----------------------------- }; diff --git a/dlls/saverestore.h b/dlls/saverestore.h index 110d703a4..bd8a3d7a3 100644 --- a/dlls/saverestore.h +++ b/dlls/saverestore.h @@ -104,7 +104,7 @@ class CRestore : public CSaveRestoreBuffer void BufferReadHeader( HEADER *pheader ); int m_global; // Restoring a global entity? - BOOL m_precache; + bool m_precache; }; #define MAX_ENTITYARRAY 64 diff --git a/dlls/scripted.cpp b/dlls/scripted.cpp index a57bcdff3..a6ecbe893 100644 --- a/dlls/scripted.cpp +++ b/dlls/scripted.cpp @@ -940,7 +940,7 @@ class CScriptedSentence : public CBaseToggle float m_flRepeat; // repeat rate float m_flAttenuation; float m_flVolume; - BOOL m_active; + bool m_active; int m_iszListener; // name of entity to look at while talking }; diff --git a/dlls/scripted.h b/dlls/scripted.h index 32dab679f..186c9e67b 100644 --- a/dlls/scripted.h +++ b/dlls/scripted.h @@ -90,7 +90,7 @@ class CCineMonster : public CBaseMonster int m_saved_solid; int m_saved_effects; // Vector m_vecOrigOrigin; - BOOL m_interruptable; + bool m_interruptable; }; class CCineAI : public CCineMonster diff --git a/dlls/sound.cpp b/dlls/sound.cpp index 0f8da876d..721a01188 100644 --- a/dlls/sound.cpp +++ b/dlls/sound.cpp @@ -131,8 +131,8 @@ class CAmbientGeneric : public CBaseEntity float m_flAttenuation; // attenuation value dynpitchvol_t m_dpv; - BOOL m_fActive; // only true when the entity is playing a looping sound - BOOL m_fLooping; // true when the sound played will loop + bool m_fActive; // only true when the entity is playing a looping sound + bool m_fLooping; // true when the sound played will loop }; LINK_ENTITY_TO_CLASS( ambient_generic, CAmbientGeneric ); diff --git a/dlls/soundent.h b/dlls/soundent.h index 15ab78670..216dc711a 100644 --- a/dlls/soundent.h +++ b/dlls/soundent.h @@ -91,7 +91,7 @@ class CSoundEnt : public CBaseEntity int m_iFreeSound; // index of the first sound in the free sound list int m_iActiveSound; // indes of the first sound in the active sound list int m_cLastActiveSounds; // keeps track of the number of active sounds at the last update. (for diagnostic work) - BOOL m_fShowReport; // if true, dump information about free/active sounds. + bool m_fShowReport; // if true, dump information about free/active sounds. private: CSound m_SoundPool[ MAX_WORLD_SOUNDS ]; diff --git a/dlls/teamplay_gamerules.h b/dlls/teamplay_gamerules.h index 93532fdee..55798bdfe 100644 --- a/dlls/teamplay_gamerules.h +++ b/dlls/teamplay_gamerules.h @@ -52,8 +52,8 @@ class CHalfLifeTeamplay : public CHalfLifeMultiplay void RecountTeams( bool bResendInfo = false ); const char *TeamWithFewestPlayers(); - BOOL m_DisableDeathMessages; - BOOL m_DisableDeathPenalty; - BOOL m_teamLimit; // This means the server set only some teams as valid + bool m_DisableDeathMessages; + bool m_DisableDeathPenalty; + bool m_teamLimit; // This means the server set only some teams as valid char m_szTeamList[TEAMPLAY_TEAMLISTLENGTH]; }; diff --git a/dlls/util.cpp b/dlls/util.cpp index ab11a7ac9..d09bbef97 100644 --- a/dlls/util.cpp +++ b/dlls/util.cpp @@ -2141,7 +2141,7 @@ int CSave :: WriteFields( const char *pname, void *pBaseData, TYPEDESCRIPTION *p //Convert booleans to bytes for (j = 0; j < pTest->fieldSize; j++) { - boolArray[j] = ((BOOL*)pOutputData)[j] ? 1 : 0; + boolArray[j] = ((bool*)pOutputData)[j] ? 1 : 0; } WriteData(pTest->fieldName, pTest->fieldSize, (char*)boolArray); @@ -2367,9 +2367,9 @@ int CRestore::ReadField( void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCou { // Input and Output sizes are different! pOutputData = (char*)pOutputData + j * (sizeof(bool) - gSizes[pTest->fieldType]); - const BOOL value = *((byte*)pInputData) != 0; + const bool value = *((byte*)pInputData) != 0; - *((BOOL*)pOutputData) = value; + *((bool*)pOutputData) = value; } break; diff --git a/dlls/util.h b/dlls/util.h index b7735f2f6..92134ab0f 100644 --- a/dlls/util.h +++ b/dlls/util.h @@ -72,9 +72,6 @@ inline edict_t *FIND_ENTITY_BY_TARGET(edict_t *entStart, const char *pszName) // More explicit than "int" typedef int EOFFSET; -// In case it's not alread defined -typedef int BOOL; - // In case this ever changes #define M_PI 3.14159265358979323846 diff --git a/dlls/weapons.h b/dlls/weapons.h index fcf63bfcd..2dff209c8 100644 --- a/dlls/weapons.h +++ b/dlls/weapons.h @@ -51,7 +51,7 @@ class CGrenade : public CBaseMonster int BloodColor() override { return DONT_BLEED; } void Killed( entvars_t *pevAttacker, int iGib ) override; - BOOL m_fRegisteredSound;// whether or not this grenade has issued its DANGER sound to the world sound list yet. + bool m_fRegisteredSound;// whether or not this grenade has issued its DANGER sound to the world sound list yet. }; @@ -885,7 +885,7 @@ class CGauss : public CBasePlayerWeapon // was this weapon just fired primary or secondary? // we need to know so we can pick the right set of effects. - BOOL m_fPrimaryFire; + bool m_fPrimaryFire; bool UseDecrement() override { @@ -992,7 +992,7 @@ class CEgon : public CBasePlayerWeapon float m_shootTime; EGON_FIREMODE m_fireMode; float m_shakeTime; - BOOL m_deployed; + bool m_deployed; unsigned short m_usEgonFire; };