Skip to content

Commit

Permalink
ChaosMod/PlayerIllegalInnocence: Fix compilation
Browse files Browse the repository at this point in the history
Tested with CMake and MinGW, not sure why this has suddenly caused problems but the pragmas are both redundant and inconsistent with the codebase anyways
  • Loading branch information
pongo1231 committed Feb 3, 2024
1 parent 12dee36 commit 9490ad5
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions ChaosMod/Effects/db/Player/PlayerIllegalInnocence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,38 @@

#include <stdafx.h>

#pragma region variable declarations
#define WAIT_TIME 5000 // ms. before police are angry at your innocence

static DWORD64 ms_TimeReserve;
static DWORD64 ms_LastTick = 0;

static int ms_LastPlayerKills;
static int ms_LastWantedLevel = 0;
#pragma endregion

static void OnStart()
{
#pragma region variable initializations
ms_LastWantedLevel = PLAYER::GET_PLAYER_WANTED_LEVEL(PLAYER_ID());
ms_LastTick = GET_GAME_TIMER();
ms_TimeReserve = WAIT_TIME;
ms_LastPlayerKills = -1;
#pragma endregion
}

static void OnTick()
{
#pragma region variable updates
DWORD64 currentTick = GET_GAME_TIMER();
DWORD64 tickDelta = currentTick - ms_LastTick;

Player player = PLAYER_ID();
int wantedLevel = PLAYER::GET_PLAYER_WANTED_LEVEL(player);

Hash playerHash = GET_ENTITY_MODEL(PLAYER_PED_ID());
#pragma endregion

#pragma region check if player ran over someone
if (GET_TIME_SINCE_PLAYER_HIT_PED(player) < 200 && GET_TIME_SINCE_PLAYER_HIT_PED(player) != -1)
{
ms_LastWantedLevel = 0;
SET_PLAYER_WANTED_LEVEL(player, ms_LastWantedLevel, false);
SET_PLAYER_WANTED_LEVEL_NOW(player, true);
ms_TimeReserve = WAIT_TIME;
}
#pragma endregion

#pragma region check if player shot someone

int allPlayerKills = 0;
int curKills = 0;
Expand All @@ -70,9 +59,7 @@ static void OnTick()
ms_TimeReserve = WAIT_TIME;
}
ms_LastPlayerKills = allPlayerKills;
#pragma endregion

#pragma region invert normal wanted level gains
// If wanted level has increased, decrease it instead

if (ms_LastWantedLevel < wantedLevel)
Expand All @@ -82,18 +69,11 @@ static void OnTick()
SET_PLAYER_WANTED_LEVEL_NOW(player, true);
ms_TimeReserve = WAIT_TIME;
}

#pragma endregion

#pragma region acknowledge wanted level decreases
else if (ms_LastWantedLevel > wantedLevel)
{
ms_LastWantedLevel = wantedLevel;
ms_TimeReserve = WAIT_TIME;
}
#pragma endregion

#pragma region police responce to prologed innocence
else if (ms_LastWantedLevel < 4)
{
// Cap the police responce for innocence at 4 stars
Expand All @@ -115,7 +95,6 @@ static void OnTick()
}

ms_LastTick = currentTick;
#pragma endregion
}

// clang-format off
Expand Down

0 comments on commit 9490ad5

Please sign in to comment.