Skip to content

Commit

Permalink
Reformat the project with a clang-format config file
Browse files Browse the repository at this point in the history
Using the config from #318, with some additional adjustments
  • Loading branch information
Vauff committed Dec 16, 2024
1 parent e4afda4 commit 750a8a4
Show file tree
Hide file tree
Showing 90 changed files with 3,639 additions and 3,575 deletions.
148 changes: 148 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# for more, see: https://clang.llvm.org/docs/ClangFormatStyleOptions.html

Language: Cpp

AccessModifierOffset: -4

AlignAfterOpenBracket: Align

AlignArrayOfStructures: Left

AlignConsecutiveAssignments: false

AlignConsecutiveDeclarations: false

AlignEscapedNewlines: Right

AlignOperands: true

AlignTrailingComments: true

AllowAllParametersOfDeclarationOnNextLine: false

AllowShortBlocksOnASingleLine: true

AllowShortCaseLabelsOnASingleLine: true

AllowShortFunctionsOnASingleLine: InlineOnly

AllowShortIfStatementsOnASingleLine: true

AllowShortLoopsOnASingleLine: true

AlwaysBreakAfterReturnType: None

AlwaysBreakBeforeMultilineStrings: false

AlwaysBreakTemplateDeclarations: true

BinPackArguments: true

BinPackParameters: true

BraceWrapping:
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
AfterCaseLabel: true
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false

BreakBeforeBinaryOperators: NonAssignment

BreakBeforeBraces: Custom

BreakBeforeTernaryOperators: false

BreakConstructorInitializers: AfterColon

#BreakInheritanceList: AfterColon

BreakStringLiterals: false

ColumnLimit: 0

CompactNamespaces: true

ConstructorInitializerAllOnOneLineOrOnePerLine: false

ConstructorInitializerIndentWidth: 4

ContinuationIndentWidth: 4

Cpp11BracedListStyle: true

DerivePointerAlignment: false

FixNamespaceComments: true

IndentCaseLabels: true

IndentWidth: 4

IndentWrappedFunctionNames: false

KeepEmptyLinesAtTheStartOfBlocks: false

MaxEmptyLinesToKeep: 1

NamespaceIndentation: All

PointerAlignment: Left

ReflowComments: true

SortUsingDeclarations: false

SpaceAfterCStyleCast: false

SpaceAfterTemplateKeyword: true

SpaceBeforeAssignmentOperators: true

# SpaceBeforeCpp11BracedList: true

# SpaceBeforeCtorInitializerColon: true

# SpaceBeforeInheritanceColon: true

SpaceBeforeParens: ControlStatements

# SpaceBeforeRangeBasedForLoopColon: true

SpaceInEmptyParentheses: false

SpacesBeforeTrailingComments: 1

SpacesInAngles: false

SpacesInCStyleCastParentheses: false

SpacesInContainerLiterals: true

SpacesInParentheses: false

SpacesInSquareBrackets: false

Standard: Auto

TabWidth: 4

UseTab: Always

SortIncludes: true

IndentPPDirectives: BeforeHash

PPIndentWidth: -1

RemoveBracesLLVM: true
1 change: 1 addition & 0 deletions clang-format.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
find src/ -iname '*.h' -o -iname '*.cpp' | xargs clang-format -i
14 changes: 7 additions & 7 deletions src/addresses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@
*/

#include "addresses.h"
#include "utils/module.h"
#include "gameconfig.h"
#include "utils/module.h"

#include "tier0/memdbgon.h"

extern CGameConfig *g_GameConfig;
extern CGameConfig* g_GameConfig;

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

bool addresses::Initialize(CGameConfig *g_GameConfig)
bool addresses::Initialize(CGameConfig* g_GameConfig)
{
modules::engine = new CModule(ROOTBIN, "engine2");
modules::tier0 = new CModule(ROOTBIN, "tier0");
Expand Down
70 changes: 35 additions & 35 deletions src/addresses.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@

namespace modules
{
inline CModule *engine;
inline CModule *tier0;
inline CModule *server;
inline CModule *schemasystem;
inline CModule *vscript;
inline CModule *client;
inline CModule* engine;
inline CModule* tier0;
inline CModule* server;
inline CModule* schemasystem;
inline CModule* vscript;
inline CModule* client;
inline CModule* networksystem;
inline CModule* vphysics2;
inline CModule* matchmaking;
#ifdef _WIN32
inline CModule *hammer;
inline CModule* hammer;
#endif
} // namespace modules

Expand All @@ -61,36 +61,36 @@ struct SndOpEventGuid_t;

namespace addresses
{
bool Initialize(CGameConfig *g_GameConfig);
bool Initialize(CGameConfig* g_GameConfig);

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

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

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

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

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

0 comments on commit 750a8a4

Please sign in to comment.