-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathfov.cpp
More file actions
24 lines (20 loc) · 883 Bytes
/
fov.cpp
File metadata and controls
24 lines (20 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "fov.h"
#include "../globals/globals.h"
#include "../offsets/offsets.h"
namespace features
{
void FOVManager::AdjustFOV(const Memory& memory) noexcept
{
std::uintptr_t localPlayer = memory.Read<std::uintptr_t>(globals::client + offsets::dwLocalPlayerPawn);
if (!localPlayer)
return;
std::uintptr_t cameraServices = memory.Read<std::uintptr_t>(localPlayer + offsets::m_pCameraServices);
if (!cameraServices)
return;
std::uint16_t currentFov = memory.Read<std::uint16_t>(cameraServices + offsets::m_iFOV);
bool isScoped = memory.Read<bool>(localPlayer + offsets::m_bIsScoped);
std::uint16_t desiredFov = static_cast<uint16_t>(globals::FOV);
if (!isScoped && currentFov != desiredFov)
memory.Write<uint16_t>(cameraServices + offsets::m_iFOV, desiredFov);
}
}