Skip to content

Commit

Permalink
ChaosMod/ScreenRealFirstPerson: Added distance check (#3656)
Browse files Browse the repository at this point in the history
Added a fix to the Real First Person effect. There was a bug where
mission fails unrelated to player death/non-existence caused the camera
to remain far away from the player. I've found the easiest fix is a
simple distance check which covers any outlier situations as well as the
affected mission fails.

Co-authored-by: Chanka0 <[email protected]>
  • Loading branch information
Chanka0 and Chanka0 authored Feb 20, 2024
1 parent 4bc9ab0 commit 46c3054
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ChaosMod/Effects/db/Screen/ScreenRealFirstPerson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ static int state = 0;

static bool SafetyCheck()
{
Ped playerPed = PLAYER_PED_ID();
Ped playerPed = PLAYER_PED_ID();
Vector3 playerCoords = GET_ENTITY_COORDS(playerPed, true);
Vector3 cameraCoords = GET_CAM_COORD(eCamera);
// Removes camera on player switch, death, and potential non-existence
// 02/19/2024 - Added distance check for resets not covered by existing checks
if (IS_PLAYER_SWITCH_IN_PROGRESS() || IS_PLAYER_DEAD(PLAYER_ID()) || !ENTITY::DOES_ENTITY_EXIST(playerPed)
|| !ENTITY::IS_ENTITY_VISIBLE(playerPed))
|| !ENTITY::IS_ENTITY_VISIBLE(playerPed)
|| VDIST2(playerCoords.x, playerCoords.y, playerCoords.z, cameraCoords.x, cameraCoords.y, cameraCoords.z) > 3.f)
{
return true;
}
Expand Down

0 comments on commit 46c3054

Please sign in to comment.