Skip to content

Commit

Permalink
Remove all remaining references to BOOL
Browse files Browse the repository at this point in the history
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
  • Loading branch information
SamVanheer committed Nov 19, 2021
1 parent c147156 commit c5b1932
Show file tree
Hide file tree
Showing 26 changed files with 46 additions and 50 deletions.
1 change: 0 additions & 1 deletion common/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions dlls/aflock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion dlls/agrunt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions dlls/barnacle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
4 changes: 2 additions & 2 deletions dlls/barney.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
2 changes: 1 addition & 1 deletion dlls/bullsquid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions dlls/cbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};


Expand Down
2 changes: 1 addition & 1 deletion dlls/gamerules.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
};

Expand Down
2 changes: 1 addition & 1 deletion dlls/hassassin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class CHAssassin : public CBaseMonster

float m_flNextGrenadeCheck;
Vector m_vecTossVelocity;
BOOL m_fThrowGrenade;
bool m_fThrowGrenade;

int m_iTargetRanderamt;

Expand Down
6 changes: 3 additions & 3 deletions dlls/hgrunt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions dlls/houndeye.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion dlls/ichthyosaur.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion dlls/leech.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions dlls/monstermaker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
4 changes: 2 additions & 2 deletions dlls/plats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -2135,7 +2135,7 @@ class CGunTarget : public CBaseMonster
static TYPEDESCRIPTION m_SaveData[];

private:
BOOL m_on;
bool m_on;
};


Expand Down
12 changes: 6 additions & 6 deletions dlls/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion dlls/roach.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
// -----------------------------
};
Expand Down
2 changes: 1 addition & 1 deletion dlls/saverestore.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion dlls/scripted.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

Expand Down
2 changes: 1 addition & 1 deletion dlls/scripted.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions dlls/sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion dlls/soundent.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 ];
Expand Down
6 changes: 3 additions & 3 deletions dlls/teamplay_gamerules.h
Original file line number Diff line number Diff line change
Expand Up @@ -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];
};
6 changes: 3 additions & 3 deletions dlls/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;

Expand Down
3 changes: 0 additions & 3 deletions dlls/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions dlls/weapons.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
};


Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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;
};
Expand Down

0 comments on commit c5b1932

Please sign in to comment.