Skip to content

Commit 750a8a4

Browse files
committed
Reformat the project with a clang-format config file
Using the config from #318, with some additional adjustments
1 parent e4afda4 commit 750a8a4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+3639
-3575
lines changed

.clang-format

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# for more, see: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
2+
3+
Language: Cpp
4+
5+
AccessModifierOffset: -4
6+
7+
AlignAfterOpenBracket: Align
8+
9+
AlignArrayOfStructures: Left
10+
11+
AlignConsecutiveAssignments: false
12+
13+
AlignConsecutiveDeclarations: false
14+
15+
AlignEscapedNewlines: Right
16+
17+
AlignOperands: true
18+
19+
AlignTrailingComments: true
20+
21+
AllowAllParametersOfDeclarationOnNextLine: false
22+
23+
AllowShortBlocksOnASingleLine: true
24+
25+
AllowShortCaseLabelsOnASingleLine: true
26+
27+
AllowShortFunctionsOnASingleLine: InlineOnly
28+
29+
AllowShortIfStatementsOnASingleLine: true
30+
31+
AllowShortLoopsOnASingleLine: true
32+
33+
AlwaysBreakAfterReturnType: None
34+
35+
AlwaysBreakBeforeMultilineStrings: false
36+
37+
AlwaysBreakTemplateDeclarations: true
38+
39+
BinPackArguments: true
40+
41+
BinPackParameters: true
42+
43+
BraceWrapping:
44+
AfterClass: true
45+
AfterControlStatement: true
46+
AfterEnum: true
47+
AfterFunction: true
48+
AfterNamespace: true
49+
AfterStruct: true
50+
AfterUnion: true
51+
AfterExternBlock: true
52+
BeforeCatch: true
53+
BeforeElse: true
54+
AfterCaseLabel: true
55+
IndentBraces: false
56+
SplitEmptyFunction: false
57+
SplitEmptyRecord: false
58+
SplitEmptyNamespace: false
59+
60+
BreakBeforeBinaryOperators: NonAssignment
61+
62+
BreakBeforeBraces: Custom
63+
64+
BreakBeforeTernaryOperators: false
65+
66+
BreakConstructorInitializers: AfterColon
67+
68+
#BreakInheritanceList: AfterColon
69+
70+
BreakStringLiterals: false
71+
72+
ColumnLimit: 0
73+
74+
CompactNamespaces: true
75+
76+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
77+
78+
ConstructorInitializerIndentWidth: 4
79+
80+
ContinuationIndentWidth: 4
81+
82+
Cpp11BracedListStyle: true
83+
84+
DerivePointerAlignment: false
85+
86+
FixNamespaceComments: true
87+
88+
IndentCaseLabels: true
89+
90+
IndentWidth: 4
91+
92+
IndentWrappedFunctionNames: false
93+
94+
KeepEmptyLinesAtTheStartOfBlocks: false
95+
96+
MaxEmptyLinesToKeep: 1
97+
98+
NamespaceIndentation: All
99+
100+
PointerAlignment: Left
101+
102+
ReflowComments: true
103+
104+
SortUsingDeclarations: false
105+
106+
SpaceAfterCStyleCast: false
107+
108+
SpaceAfterTemplateKeyword: true
109+
110+
SpaceBeforeAssignmentOperators: true
111+
112+
# SpaceBeforeCpp11BracedList: true
113+
114+
# SpaceBeforeCtorInitializerColon: true
115+
116+
# SpaceBeforeInheritanceColon: true
117+
118+
SpaceBeforeParens: ControlStatements
119+
120+
# SpaceBeforeRangeBasedForLoopColon: true
121+
122+
SpaceInEmptyParentheses: false
123+
124+
SpacesBeforeTrailingComments: 1
125+
126+
SpacesInAngles: false
127+
128+
SpacesInCStyleCastParentheses: false
129+
130+
SpacesInContainerLiterals: true
131+
132+
SpacesInParentheses: false
133+
134+
SpacesInSquareBrackets: false
135+
136+
Standard: Auto
137+
138+
TabWidth: 4
139+
140+
UseTab: Always
141+
142+
SortIncludes: true
143+
144+
IndentPPDirectives: BeforeHash
145+
146+
PPIndentWidth: -1
147+
148+
RemoveBracesLLVM: true

clang-format.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
find src/ -iname '*.h' -o -iname '*.cpp' | xargs clang-format -i

src/addresses.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@
1818
*/
1919

2020
#include "addresses.h"
21-
#include "utils/module.h"
2221
#include "gameconfig.h"
22+
#include "utils/module.h"
2323

2424
#include "tier0/memdbgon.h"
2525

26-
extern CGameConfig *g_GameConfig;
26+
extern CGameConfig* g_GameConfig;
2727

28-
#define RESOLVE_SIG(gameConfig, name, variable) \
29-
variable = (decltype(variable))gameConfig->ResolveSignature(name); \
30-
if (!variable) \
31-
return false; \
28+
#define RESOLVE_SIG(gameConfig, name, variable) \
29+
variable = (decltype(variable))gameConfig->ResolveSignature(name); \
30+
if (!variable) \
31+
return false; \
3232
Message("Found %s at 0x%p\n", name, variable);
3333

34-
bool addresses::Initialize(CGameConfig *g_GameConfig)
34+
bool addresses::Initialize(CGameConfig* g_GameConfig)
3535
{
3636
modules::engine = new CModule(ROOTBIN, "engine2");
3737
modules::tier0 = new CModule(ROOTBIN, "tier0");

src/addresses.h

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@
2626

2727
namespace modules
2828
{
29-
inline CModule *engine;
30-
inline CModule *tier0;
31-
inline CModule *server;
32-
inline CModule *schemasystem;
33-
inline CModule *vscript;
34-
inline CModule *client;
29+
inline CModule* engine;
30+
inline CModule* tier0;
31+
inline CModule* server;
32+
inline CModule* schemasystem;
33+
inline CModule* vscript;
34+
inline CModule* client;
3535
inline CModule* networksystem;
3636
inline CModule* vphysics2;
3737
inline CModule* matchmaking;
3838
#ifdef _WIN32
39-
inline CModule *hammer;
39+
inline CModule* hammer;
4040
#endif
4141
} // namespace modules
4242

@@ -61,36 +61,36 @@ struct SndOpEventGuid_t;
6161

6262
namespace addresses
6363
{
64-
bool Initialize(CGameConfig *g_GameConfig);
64+
bool Initialize(CGameConfig* g_GameConfig);
6565

66-
inline void(FASTCALL *SetGroundEntity)(CBaseEntity *ent, CBaseEntity *ground, CBaseEntity* unk3);
67-
inline void(FASTCALL *CCSPlayerController_SwitchTeam)(CCSPlayerController *pController, uint32 team);
68-
inline void(FASTCALL *CBasePlayerController_SetPawn)(CBasePlayerController *pController, CCSPlayerPawn *pPawn, bool a3, bool a4, bool a5);
69-
inline void(FASTCALL *CBaseModelEntity_SetModel)(CBaseModelEntity *pModel, const char *szModel);
70-
inline void(FASTCALL *UTIL_Remove)(CEntityInstance*);
66+
inline void(FASTCALL* SetGroundEntity)(CBaseEntity* ent, CBaseEntity* ground, CBaseEntity* unk3);
67+
inline void(FASTCALL* CCSPlayerController_SwitchTeam)(CCSPlayerController* pController, uint32 team);
68+
inline void(FASTCALL* CBasePlayerController_SetPawn)(CBasePlayerController* pController, CCSPlayerPawn* pPawn, bool a3, bool a4, bool a5);
69+
inline void(FASTCALL* CBaseModelEntity_SetModel)(CBaseModelEntity* pModel, const char* szModel);
70+
inline void(FASTCALL* UTIL_Remove)(CEntityInstance*);
7171

72-
inline void(FASTCALL *CEntitySystem_AddEntityIOEvent)(CEntitySystem *pEntitySystem, CEntityInstance *pTarget, const char *pszInput,
73-
CEntityInstance *pActivator, CEntityInstance *pCaller, variant_t *value, float flDelay, int outputID);
72+
inline void(FASTCALL* CEntitySystem_AddEntityIOEvent)(CEntitySystem* pEntitySystem, CEntityInstance* pTarget, const char* pszInput,
73+
CEntityInstance* pActivator, CEntityInstance* pCaller, variant_t* value, float flDelay, int outputID);
7474

75-
inline void(FASTCALL *CEntityInstance_AcceptInput)(CEntityInstance *pThis, const char *pInputName,
76-
CEntityInstance *pActivator, CEntityInstance *pCaller, variant_t *value, int nOutputID);
75+
inline void(FASTCALL* CEntityInstance_AcceptInput)(CEntityInstance* pThis, const char* pInputName,
76+
CEntityInstance* pActivator, CEntityInstance* pCaller, variant_t* value, int nOutputID);
7777

78-
inline CBaseEntity *(FASTCALL *CGameEntitySystem_FindEntityByClassName)(CEntitySystem *pEntitySystem, CEntityInstance *pStartEntity, const char *szName);
78+
inline CBaseEntity*(FASTCALL* CGameEntitySystem_FindEntityByClassName)(CEntitySystem* pEntitySystem, CEntityInstance* pStartEntity, const char* szName);
7979

80-
inline CBaseEntity *(FASTCALL *CGameEntitySystem_FindEntityByName)(CEntitySystem *pEntitySystem, CEntityInstance *pStartEntity, const char *szName,
81-
CEntityInstance *pSearchingEntity, CEntityInstance *pActivator, CEntityInstance *pCaller,
82-
IEntityFindFilter *pFilter);
83-
inline void(FASTCALL *CGameRules_TerminateRound)(CGameRules* pGameRules, float delay, unsigned int reason, int64 a4, unsigned int a5);
84-
inline CBaseEntity *(FASTCALL* CreateEntityByName)(const char* className, int iForceEdictIndex);
85-
inline void(FASTCALL *DispatchSpawn)(CBaseEntity* pEntity, CEntityKeyValues *pEntityKeyValues);
86-
inline void(FASTCALL *CEntityIdentity_SetEntityName)(CEntityIdentity *pEntity, const char *pName);
87-
inline void(FASTCALL *CBaseEntity_EmitSoundParams)(CBaseEntity *pEntity, const char *pszSound, int nPitch, float flVolume, float flDelay);
88-
inline void(FASTCALL *CBaseEntity_SetParent)(CBaseEntity *pEntity, CBaseEntity *pNewParent, CUtlStringToken nBoneOrAttachName, matrix3x4a_t *pOffsetTransform);
89-
inline int(FASTCALL *DispatchParticleEffect)(const char *pszParticleName, int iAttachType, CBaseEntity *pEntity,
90-
char iAttachmentPoint, CUtlSymbolLarge iAttachmentName, bool bResetAllParticlesOnEntity, int nSplitScreenPlayerSlot, IRecipientFilter *a7, byte *a8);
91-
inline SndOpEventGuid_t(FASTCALL *CBaseEntity_EmitSoundFilter)(IRecipientFilter &filter, CEntityIndex ent, const EmitSound_t &params);
92-
inline void(FASTCALL *CBaseEntity_SetMoveType)(CBaseEntity *pThis, MoveType_t nMoveType, MoveCollide_t nMoveCollide);
93-
inline void(FASTCALL *CTakeDamageInfo_Constructor)(CTakeDamageInfo *pThis, CBaseEntity *pInflictor, CBaseEntity *pAttacker, CBaseEntity *pAbility,
94-
const Vector *vecDamageForce, const Vector *vecDamagePosition, float flDamage, int bitsDamageType, int iCustomDamage, void *a10);
95-
inline void(FASTCALL *CNetworkStringTable_DeleteAllStrings)(INetworkStringTable *pThis);
96-
}
80+
inline CBaseEntity*(FASTCALL* CGameEntitySystem_FindEntityByName)(CEntitySystem* pEntitySystem, CEntityInstance* pStartEntity, const char* szName,
81+
CEntityInstance* pSearchingEntity, CEntityInstance* pActivator, CEntityInstance* pCaller,
82+
IEntityFindFilter* pFilter);
83+
inline void(FASTCALL* CGameRules_TerminateRound)(CGameRules* pGameRules, float delay, unsigned int reason, int64 a4, unsigned int a5);
84+
inline CBaseEntity*(FASTCALL* CreateEntityByName)(const char* className, int iForceEdictIndex);
85+
inline void(FASTCALL* DispatchSpawn)(CBaseEntity* pEntity, CEntityKeyValues* pEntityKeyValues);
86+
inline void(FASTCALL* CEntityIdentity_SetEntityName)(CEntityIdentity* pEntity, const char* pName);
87+
inline void(FASTCALL* CBaseEntity_EmitSoundParams)(CBaseEntity* pEntity, const char* pszSound, int nPitch, float flVolume, float flDelay);
88+
inline void(FASTCALL* CBaseEntity_SetParent)(CBaseEntity* pEntity, CBaseEntity* pNewParent, CUtlStringToken nBoneOrAttachName, matrix3x4a_t* pOffsetTransform);
89+
inline int(FASTCALL* DispatchParticleEffect)(const char* pszParticleName, int iAttachType, CBaseEntity* pEntity,
90+
char iAttachmentPoint, CUtlSymbolLarge iAttachmentName, bool bResetAllParticlesOnEntity, int nSplitScreenPlayerSlot, IRecipientFilter* a7, byte* a8);
91+
inline SndOpEventGuid_t(FASTCALL* CBaseEntity_EmitSoundFilter)(IRecipientFilter& filter, CEntityIndex ent, const EmitSound_t& params);
92+
inline void(FASTCALL* CBaseEntity_SetMoveType)(CBaseEntity* pThis, MoveType_t nMoveType, MoveCollide_t nMoveCollide);
93+
inline void(FASTCALL* CTakeDamageInfo_Constructor)(CTakeDamageInfo* pThis, CBaseEntity* pInflictor, CBaseEntity* pAttacker, CBaseEntity* pAbility,
94+
const Vector* vecDamageForce, const Vector* vecDamagePosition, float flDamage, int bitsDamageType, int iCustomDamage, void* a10);
95+
inline void(FASTCALL* CNetworkStringTable_DeleteAllStrings)(INetworkStringTable* pThis);
96+
} // namespace addresses

0 commit comments

Comments
 (0)