Skip to content

Commit 12ed774

Browse files
committed
speedometer stuff
1 parent 573694d commit 12ed774

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

src/rtech/rui.cpp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ static ConVar* Cvar_ion_crosshair_thickness_r;
7373
static ConVar* Cvar_ion_crosshair_gap_h;
7474
static ConVar* Cvar_ion_crosshair_length_h;
7575
static ConVar* Cvar_ion_chroma_gameinfo;
76+
static ConVar* Cvar_ion_speedometer_always_show;
7677

7778
static inline __m128 MakeColor(float r, float g, float b, float a)
7879
{
@@ -832,9 +833,23 @@ DECLARE_HOOK(hcog_lower, ui(11).dll + 0x0529B0, [](auto& hook, RuiFunctions_t* a
832833
});
833834

834835

835-
ON_DLL_LOAD("ui(11).dll", RuiStuff, [](CModule module)
836+
DECLARE_HOOK(pilot_speedometer, ui(11).dll + 0x6AA50, [](auto& hook, RuiFunctions_t* a1, RuiGlobals* a2, RuiInstance* a3, hcog_lower_struct* a4)
836837
{
838+
static CMemory module = GetModuleHandleA("ui(11).dll");
839+
if (Cvar_ion_speedometer_always_show->GetBool())
840+
{
841+
module.Offset(0x6AB7F).Patch({0x90, 0x90});
842+
}
843+
else
844+
{
845+
module.Offset(0x6AB7F).Patch({0x72,0x2C});
846+
}
847+
hook.Original(a1, a2, a3, a4);
848+
});
849+
837850

851+
ON_DLL_LOAD("ui(11).dll", RuiStuff, [](CModule module)
852+
{
838853
pGamestate_info_ffa = module.Offset(0x3E8E0).RCast<gamestate_info_ffa_t>();
839854
v_hk_gamestate_info_ffa.Dispatch(reinterpret_cast<void*>(pGamestate_info_ffa));
840855

@@ -855,4 +870,9 @@ ON_DLL_LOAD_CLIENT_RELIESON("engine.dll", ClientAuthHooks, ConVar, [](CModule mo
855870
Cvar_ion_crosshair_length_h = new ConVar("ion_crosshair_length_h", "0.00700", FCVAR_ARCHIVE_PLAYERPROFILE, "Horizontal arm segment length.");
856871
Cvar_ion_chroma_gameinfo =
857872
new ConVar("ion_chroma_gameinfo", "0", FCVAR_ARCHIVE_PLAYERPROFILE, "Rainbow colors for game info. 1 = enabled, 0 = disabled.");
873+
874+
Cvar_ion_speedometer_always_show =
875+
new ConVar("ion_speedometer_always_show", "0", FCVAR_ARCHIVE_PLAYERPROFILE, "Always show speedometer. 1 = enabled, 0 = disabled.");
876+
858877
});
878+

0 commit comments

Comments
 (0)