parent
9b0e14115d
commit
a88e1c6192
42
src/client/component/fov.cpp
Normal file
42
src/client/component/fov.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
#include <std_include.hpp>
|
||||
#include "loader/component_loader.hpp"
|
||||
|
||||
#include "game/game.hpp"
|
||||
|
||||
#include <utils/hook.hpp>
|
||||
|
||||
namespace fov
|
||||
{
|
||||
namespace
|
||||
{
|
||||
void cg_calc_fov_stub(const int local_client_num, float* fov_x, float* dx_dz_at_default_aspect_ratio,
|
||||
float* dx_dz, float* dy_dz)
|
||||
{
|
||||
game::CG_CalcFOVfromLens.call_safe(local_client_num, fov_x, dx_dz_at_default_aspect_ratio, dx_dz, dy_dz);
|
||||
|
||||
const game::dvar_t* cg_fovScale = *reinterpret_cast<game::dvar_t**>(0x144A31A88_g);
|
||||
if (cg_fovScale && !game::Com_IsRunningUILevel())
|
||||
{
|
||||
const auto scale = cg_fovScale->current.value.value;
|
||||
|
||||
*fov_x *= scale;
|
||||
*dx_dz *= scale;
|
||||
*dy_dz *= scale;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct component final : client_component
|
||||
{
|
||||
void post_unpack() override
|
||||
{
|
||||
// Hook CG_CalcFOVfromLens within CG_CalcFov
|
||||
utils::hook::call(0x1404DADA7_g, cg_calc_fov_stub);
|
||||
|
||||
// Patch cg_fovScale flags
|
||||
utils::hook::set<uint32_t>(0x14090E735_g, game::DVAR_ARCHIVE);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
REGISTER_COMPONENT(fov::component)
|
@ -8,6 +8,10 @@ namespace game
|
||||
{
|
||||
#define Com_Error(code, fmt, ...) Com_Error_(__FILE__, __LINE__, code, fmt, ##__VA_ARGS__)
|
||||
|
||||
// CG
|
||||
WEAK symbol<void(int localClientNum, float* fov_x, float* dxDzAtDefaultAspectRatio, float* dxDz, float* dyDz)>
|
||||
CG_CalcFOVfromLens{0x1404D6230};
|
||||
|
||||
// CL
|
||||
WEAK symbol<void(int controllerIndex, XSESSION_INFO* hostInfo, const netadr_t* addr, int numPublicSlots,
|
||||
int numPrivateSlots, const char* mapname, const char* gametype,
|
||||
@ -157,7 +161,9 @@ namespace game
|
||||
};
|
||||
|
||||
// UI
|
||||
WEAK symbol<void(int localClientNumber, int errorcode, const char* errorMessage)> UI_OpenErrorPopupWithMessage{0x14228DEE0};
|
||||
WEAK symbol<void(int localClientNumber, int errorcode, const char* errorMessage)> UI_OpenErrorPopupWithMessage{
|
||||
0x14228DEE0
|
||||
};
|
||||
WEAK symbol<void(bool frontend)> UI_CoD_Init{0x141F29010, 0x1404A0A50};
|
||||
WEAK symbol<void()> UI_CoD_LobbyUI_Init{0x141F2BD80, 0x1404A1F50};
|
||||
WEAK symbol<void()> UI_CoD_Shutdown{0x141F32E10, 0x0};
|
||||
|
Loading…
Reference in New Issue
Block a user