Skip to content

Commit

Permalink
ChaosMod: clang-format all project files
Browse files Browse the repository at this point in the history
  • Loading branch information
pongo1231 committed Oct 15, 2023
1 parent 00cbe11 commit 5dff545
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 45 deletions.
1 change: 0 additions & 1 deletion ChaosMod/Components/SplashTexts.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <cstdint>
#include <list>


class SplashTexts : public Component
{
private:
Expand Down
2 changes: 1 addition & 1 deletion ChaosMod/Effects/db/Misc/MiscMuffledAudio.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Effect By Rylxnd
Effect By Rylxnd
*/
#include <stdafx.h>

Expand Down
2 changes: 1 addition & 1 deletion ChaosMod/Effects/db/Peds/PedsGiveProps.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Effect By Rylxnd
Effect By Rylxnd
*/
#include <stdafx.h>

Expand Down
2 changes: 1 addition & 1 deletion ChaosMod/Effects/db/Peds/PedsReflectiveDamage.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Effect By Rylxnd
Effect By Rylxnd
*/
#include <stdafx.h>

Expand Down
77 changes: 39 additions & 38 deletions ChaosMod/Effects/db/Screen/ScreenRealFirstPerson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ static int state = 0;
static bool SafetyCheck()
{
Ped playerPed = PLAYER_PED_ID();
//Removes camera on player switch, death, and potential non-existence
// Removes camera on player switch, death, and potential non-existence
if (IS_PLAYER_SWITCH_IN_PROGRESS() || IS_PLAYER_DEAD(PLAYER_ID()) || !ENTITY::DOES_ENTITY_EXIST(playerPed)
|| !ENTITY::IS_ENTITY_VISIBLE(playerPed))
{
Expand All @@ -19,7 +19,7 @@ static bool SafetyCheck()
return false;
}

//OnStart and OnStop code moved to separate functions at Rylxnd's request
// OnStart and OnStop code moved to separate functions at Rylxnd's request
static void RemoveCamera()
{
RENDER_SCRIPT_CAMS(false, false, 0, true, false, 0);
Expand All @@ -35,8 +35,8 @@ static void SetupCamera()
{
Ped playerPed = PLAYER_PED_ID();
Vector3 boneCoords = GET_PED_BONE_COORDS(playerPed, 0x322c, 0, 0, 0);
eCamera = CREATE_CAM_WITH_PARAMS("DEFAULT_SCRIPTED_CAMERA", boneCoords.x, boneCoords.y, boneCoords.z, 0, 0, 0, 60,
false, 2);
eCamera = CREATE_CAM_WITH_PARAMS("DEFAULT_SCRIPTED_CAMERA", boneCoords.x, boneCoords.y, boneCoords.z, 0, 0, 0, 60,
false, 2);
ATTACH_CAM_TO_PED_BONE(eCamera, playerPed, 31086, 0, 0, 0, 0);

SET_CAM_NEAR_CLIP(eCamera, 0.2);
Expand All @@ -55,44 +55,45 @@ static void OnStop()

static void OnTick()
{
//SafetyCheck() checks for potential situations where the camera could become stuck and the switch statement below handles things if SafetyCheck is triggered.
// SafetyCheck() checks for potential situations where the camera could become stuck and the switch statement below
// handles things if SafetyCheck is triggered.
switch (state)
{
//Normal operation
case 0:
if (SafetyCheck())
{
RemoveCamera();
state = 1;
break;
}
// Normal operation
case 0:
if (SafetyCheck())
{
RemoveCamera();
state = 1;
break;
}

RENDER_SCRIPT_CAMS(true, false, 0, true, false, 0);
SET_CAM_ACTIVE(eCamera, true);
CAN_SET_EXIT_STATE_FOR_CAMERA(false);
STOP_CUTSCENE_CAM_SHAKING();
RENDER_SCRIPT_CAMS(true, false, 0, true, false, 0);
SET_CAM_ACTIVE(eCamera, true);
CAN_SET_EXIT_STATE_FOR_CAMERA(false);
STOP_CUTSCENE_CAM_SHAKING();

//Rotate camera toward aiming point, otherwise use bone rotation
if (IS_PLAYER_FREE_AIMING(PLAYER_ID()))
{
Vector3 gameCamRot = GET_GAMEPLAY_CAM_ROT(2);
SET_CAM_ROT(eCamera, gameCamRot.x, gameCamRot.y, gameCamRot.z, 2);
}
else
{
Ped playerPed = PLAYER_PED_ID();
Vector3 boneRot = _GET_ENTITY_BONE_ROTATION(playerPed, GET_PED_BONE_INDEX(playerPed, 0x796e));
SET_CAM_ROT(eCamera, boneRot.x, boneRot.y+90, boneRot.z, 2);
}
break;
//Recovery
case 1:
if (!SafetyCheck())
{
state = 0;
SetupCamera();
}
break;
// Rotate camera toward aiming point, otherwise use bone rotation
if (IS_PLAYER_FREE_AIMING(PLAYER_ID()))
{
Vector3 gameCamRot = GET_GAMEPLAY_CAM_ROT(2);
SET_CAM_ROT(eCamera, gameCamRot.x, gameCamRot.y, gameCamRot.z, 2);
}
else
{
Ped playerPed = PLAYER_PED_ID();
Vector3 boneRot = _GET_ENTITY_BONE_ROTATION(playerPed, GET_PED_BONE_INDEX(playerPed, 0x796e));
SET_CAM_ROT(eCamera, boneRot.x, boneRot.y + 90, boneRot.z, 2);
}
break;
// Recovery
case 1:
if (!SafetyCheck())
{
state = 0;
SetupCamera();
}
break;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static void OnStop()
Hooks::ResetShader();
}

//clang-format off
// clang-format off
REGISTER_EFFECT(OnStart, OnStop, nullptr, EffectInfo
{
.Name = "Hue Shift",
Expand Down
3 changes: 1 addition & 2 deletions ChaosMod/Util/Logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ inline const auto g_ModStartTime = std::time(nullptr);
slashPos = fileName.find_last_of("/"); \
fileName = fileName.substr(slashPos != fileName.npos ? slashPos + 1 : 0); \
return fileName; \
} \
(); \
}(); \
COLOR_PREFIX_LOG("(" << fileName << ")", _text); \
} while (0)

Expand Down

0 comments on commit 5dff545

Please sign in to comment.