Skip to content

Commit

Permalink
Removed bxt_show_player_in_hltv, now it always render a local player …
Browse files Browse the repository at this point in the history
…model when watching a POV demo with dem_forcehltv 1
  • Loading branch information
SmileyAG committed May 22, 2022
1 parent 4a9c010 commit e0a628c
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 42 deletions.
2 changes: 0 additions & 2 deletions BunnymodXT/cvars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ namespace CVars
CVarWrapper bxt_collision_depth_map_pixel_scale("bxt_collision_depth_map_pixel_scale", "8");
CVarWrapper bxt_collision_depth_map_remove_distance_limit("bxt_collision_depth_map_remove_distance_limit", "1");
CVarWrapper bxt_unlock_camera_during_pause("bxt_unlock_camera_during_pause", "0");
CVarWrapper bxt_show_player_in_hltv("bxt_show_player_in_hltv", "0");
CVarWrapper bxt_hud("bxt_hud", "1");
CVarWrapper bxt_hud_color("bxt_hud_color", "");
CVarWrapper bxt_hud_precision("bxt_hud_precision", "6");
Expand Down Expand Up @@ -249,7 +248,6 @@ namespace CVars
&bxt_collision_depth_map_pixel_scale,
&bxt_collision_depth_map_remove_distance_limit,
&bxt_unlock_camera_during_pause,
&bxt_show_player_in_hltv,
&bxt_hud,
&bxt_hud_color,
&bxt_hud_precision,
Expand Down
1 change: 0 additions & 1 deletion BunnymodXT/cvars.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ namespace CVars
extern CVarWrapper bxt_collision_depth_map_pixel_scale;
extern CVarWrapper bxt_collision_depth_map_remove_distance_limit;
extern CVarWrapper bxt_unlock_camera_during_pause;
extern CVarWrapper bxt_show_player_in_hltv;
extern CVarWrapper bxt_hud;
extern CVarWrapper bxt_hud_color;
extern CVarWrapper bxt_hud_precision;
Expand Down
8 changes: 1 addition & 7 deletions BunnymodXT/modules/ClientDLL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -776,10 +776,6 @@ void ClientDLL::RegisterCVarsAndCommands()
REG(bxt_show_hidden_entities_clientside);
}

if (ORIG_CL_IsThirdPerson) {
REG(bxt_show_player_in_hltv);
}

if (ORIG_CHudFlashlight__drawNightVision_Linux || ORIG_CHudFlashlight__drawNightVision || ORIG_CHud__DrawHudNightVision_Linux || ORIG_CHud__DrawHudNightVision ) {
REG(bxt_disable_nightvision_sprite);
}
Expand Down Expand Up @@ -1277,9 +1273,7 @@ HOOK_DEF_3(ClientDLL, int, __cdecl, HUD_AddEntity, int, type, cl_entity_s*, ent,

HOOK_DEF_0(ClientDLL, int, __cdecl, CL_IsThirdPerson)
{
const auto& hw = HwDLL::GetInstance();

if (hw.insideCLEmitEntities && CVars::bxt_show_player_in_hltv.GetBool() && CVars::sv_cheats.GetBool())
if (pEngfuncs->pDemoAPI->IsPlayingback() && pEngfuncs->IsSpectateOnly())
return 1;

return ORIG_CL_IsThirdPerson();
Expand Down
25 changes: 1 addition & 24 deletions BunnymodXT/modules/HwDLL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,6 @@ extern "C" void __cdecl _ZN7CBaseUI10HideGameUIEv(void* thisptr)
return HwDLL::HOOKED_CBaseUI__HideGameUI_Linux(thisptr);
}

extern "C" void __cdecl CL_EmitEntities()
{
HwDLL::HOOKED_CL_EmitEntities();
}

extern "C" void __cdecl R_DrawWorld()
{
HwDLL::HOOKED_R_DrawWorld();
Expand Down Expand Up @@ -411,7 +406,6 @@ void HwDLL::Hook(const std::wstring& moduleName, void* moduleHandle, void* modul
MemUtils::MarkAsExecutable(ORIG_VGuiWrap2_NotifyOfServerConnect);
MemUtils::MarkAsExecutable(ORIG_R_StudioSetupBones);
MemUtils::MarkAsExecutable(ORIG_CBaseUI__HideGameUI);
MemUtils::MarkAsExecutable(ORIG_CL_EmitEntities);
MemUtils::MarkAsExecutable(ORIG_R_DrawWorld);
MemUtils::MarkAsExecutable(ORIG_R_DrawEntitiesOnList);
MemUtils::MarkAsExecutable(ORIG_R_DrawParticles);
Expand Down Expand Up @@ -465,7 +459,6 @@ void HwDLL::Hook(const std::wstring& moduleName, void* moduleHandle, void* modul
ORIG_VGuiWrap2_NotifyOfServerConnect, HOOKED_VGuiWrap2_NotifyOfServerConnect,
ORIG_R_StudioSetupBones, HOOKED_R_StudioSetupBones,
ORIG_CBaseUI__HideGameUI, HOOKED_CBaseUI__HideGameUI,
ORIG_CL_EmitEntities, HOOKED_CL_EmitEntities,
ORIG_R_DrawWorld, HOOKED_R_DrawWorld,
ORIG_R_DrawEntitiesOnList, HOOKED_R_DrawEntitiesOnList,
ORIG_R_DrawParticles, HOOKED_R_DrawParticles,
Expand Down Expand Up @@ -524,7 +517,6 @@ void HwDLL::Unhook()
ORIG_VGuiWrap2_NotifyOfServerConnect,
ORIG_R_StudioSetupBones,
ORIG_CBaseUI__HideGameUI,
ORIG_CL_EmitEntities,
ORIG_R_DrawWorld,
ORIG_R_DrawEntitiesOnList,
ORIG_R_DrawParticles,
Expand Down Expand Up @@ -1122,12 +1114,6 @@ void HwDLL::FindStuff()
else
EngineDevWarning("[hw dll] Could not find VGuiWrap2_NotifyOfServerConnect.\n");

ORIG_CL_EmitEntities = reinterpret_cast<_CL_EmitEntities>(MemUtils::GetSymbolAddress(m_Handle, "CL_EmitEntities"));
if (ORIG_CL_EmitEntities)
EngineDevMsg("[hw dll] Found CL_EmitEntities at %p.\n", ORIG_CL_EmitEntities);
else
EngineDevWarning("[hw dll] Could not find CL_EmitEntities.\n");

ORIG_R_DrawWorld = reinterpret_cast<_R_DrawWorld>(MemUtils::GetSymbolAddress(m_Handle, "R_DrawWorld"));
if (ORIG_R_DrawWorld)
EngineDevMsg("[hw dll] Found R_DrawWorld at %p.\n", ORIG_R_DrawWorld);
Expand Down Expand Up @@ -1206,7 +1192,6 @@ void HwDLL::FindStuff()
DEF_FUTURE(S_StartDynamicSound)
DEF_FUTURE(VGuiWrap2_NotifyOfServerConnect)
DEF_FUTURE(CBaseUI__HideGameUI)
DEF_FUTURE(CL_EmitEntities)
DEF_FUTURE(R_DrawWorld)
DEF_FUTURE(R_DrawEntitiesOnList)
DEF_FUTURE(R_DrawParticles)
Expand Down Expand Up @@ -1925,7 +1910,6 @@ void HwDLL::FindStuff()
GET_FUTURE(S_StartDynamicSound);
GET_FUTURE(VGuiWrap2_NotifyOfServerConnect);
GET_FUTURE(CBaseUI__HideGameUI);
GET_FUTURE(CL_EmitEntities);
GET_FUTURE(R_DrawWorld);
GET_FUTURE(R_DrawEntitiesOnList);
GET_FUTURE(R_DrawParticles);
Expand Down Expand Up @@ -5194,7 +5178,7 @@ HOOK_DEF_1(HwDLL, int, __cdecl, Host_FilterTime, float, passedTime)
{
int playerhealth = static_cast<int>((*hw.sv_player)->v.health);

if (playerhealth != ServerDLL::GetInstance().m_afHealthLast)
if (playerhealth != ServerDLL::GetInstance().m_afHealthLast)
RuntimeData::Add(RuntimeData::PlayerHealth{playerhealth});
}

Expand Down Expand Up @@ -5700,13 +5684,6 @@ HOOK_DEF_1(HwDLL, void, __cdecl, CBaseUI__HideGameUI_Linux, void*, thisptr)
insideHideGameUI = false;
}

HOOK_DEF_0(HwDLL, void, __cdecl, CL_EmitEntities)
{
insideCLEmitEntities = true;
ORIG_CL_EmitEntities();
insideCLEmitEntities = false;
}

HOOK_DEF_0(HwDLL, void, __cdecl, R_DrawWorld)
{
if (CVars::sv_cheats.GetBool() && CVars::bxt_show_only_viewmodel.GetBool())
Expand Down
2 changes: 0 additions & 2 deletions BunnymodXT/modules/HwDLL.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ class HwDLL : public IHookableNameFilterOrdered
HOOK_DECL(char*, __cdecl, MD5_Print, unsigned char hash[16])
HOOK_DECL(void, __fastcall, CBaseUI__HideGameUI, void *thisptr)
HOOK_DECL(void, __cdecl, CBaseUI__HideGameUI_Linux, void *thisptr)
HOOK_DECL(void, __cdecl, CL_EmitEntities)
HOOK_DECL(void, __cdecl, R_DrawWorld)
HOOK_DECL(void, __cdecl, R_DrawEntitiesOnList)
HOOK_DECL(void, __cdecl, R_DrawParticles)
Expand Down Expand Up @@ -319,7 +318,6 @@ class HwDLL : public IHookableNameFilterOrdered

float currentRenderFOV = 0;

bool insideCLEmitEntities = false;
bool insideDrawCrosshair = false;

globalvars_t *ppGlobals;
Expand Down
2 changes: 1 addition & 1 deletion BunnymodXT/modules/ServerDLL.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ServerDLL : public IHookableDirFilter
HOOK_DECL(void, __cdecl, CTriggerSave__SaveTouch_Linux, void* thisptr, void* pOther)
HOOK_DECL(void, __fastcall, CChangeLevel__UseChangeLevel, void* thisptr, int edx, void* pActivator, void* pCaller, int useType, float value)
HOOK_DECL(void, __fastcall, CChangeLevel__TouchChangeLevel, void* thisptr, int edx, void* pOther)
HOOK_DECL(void, __cdecl, PlayerPostThink, edict_t *pEntity)
HOOK_DECL(void, __cdecl, PlayerPostThink, edict_t* pEntity)

public:
static ServerDLL& GetInstance()
Expand Down
5 changes: 0 additions & 5 deletions BunnymodXT/patterns.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,11 +427,6 @@ namespace patterns
"56 8B F1 8B 0D ?? ?? ?? ?? 8B 01 FF 50 ?? 8B 0D ?? ?? ?? ?? 8B 11 FF 52 ?? FF 15"
);

PATTERNS(CL_EmitEntities,
"HL-SteamPipe",
"A1 ?? ?? ?? ?? C7 05 ?? ?? ?? ?? 00 00 00 00 83 F8 05"
);

PATTERNS(R_DrawWorld,
"HL-SteamPipe",
"55 8B EC 81 EC B8 0B 00 00",
Expand Down

0 comments on commit e0a628c

Please # to comment.