Skip to content

Commit 2ba0a1b

Browse files
committed
add: Implemented CBasePlayer class
1 parent 0d3857a commit 2ba0a1b

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

src/commands.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,18 @@ ConVar p2sm_developer("p2sm_developer", "0", FCVAR_NONE, "Enable for developer m
2121
//---------------------------------------------------------------------------------
2222
ConVar p2sm_multiplayer_instantrespawn("p2sm_multiplayer_instantrespawn", "0", FCVAR_NONE, "Whether respawning should be instant or not in multiplayer.");
2323

24+
static void ChangePtexVolumetricState(IConVar* var, const char* pOldValue, float flOldValue)
25+
{
26+
if (!dynamic_cast<ConVar*>(var)->GetBool())
27+
{
28+
Log(INFO, false, "Disabled volumetrics for projected textures...");
29+
Memory::ReplacePattern("engine", "0F 84 47 0C 00 00 80 BF 10 02 00 00 00 0F 85 3A 0C 00 00", "0F 85 47 0C 00 00 80 BF 10 02 00 00 00 0F 84 3A 0C 00 00");
30+
}
31+
else
32+
{
33+
Log(INFO, false, "Enabled volumetrics for projected textures...");
34+
Memory::ReplacePattern("engine", "0F 85 47 0C 00 00 80 BF 10 02 00 00 00 0F 84 3A 0C 00 00", "0F 84 47 0C 00 00 80 BF 10 02 00 00 00 0F 85 3A 0C 00 00");
35+
}
36+
}
37+
ConVar p2sm_ptex_volumetrics("p2sm_ptex_volumetrics", "0", FCVAR_NONE, "Enable or disable volumetrics for projected textures.", ChangePtexVolumetricState);
38+

src/modules/cbaseplayer.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,25 @@
1+
/*******************************************************************
2+
* @file cbaseplayer.h
3+
* @brief CBasePlayer class recreation.
4+
* @author Orsell
5+
* @date 06 2025
6+
*********************************************************************/
7+
18
#include "stdafx.hpp"
29
#include "cbaseplayer.h"
10+
11+
#include <KeyValues.h>
12+
13+
#include "utils/loggingsystem.hpp"
14+
15+
void CBasePlayer::ShowViewPortPanel(const int playerIndex, const char* name, const bool bShow, KeyValues* data)
16+
{
17+
CBasePlayer* pPlayer = UTIL_PlayerByIndex(playerIndex);
18+
if (!pPlayer)
19+
{
20+
Log(WARNING, false, "Couldn't get player to display view port panel to! playerIndex: %i", playerIndex);
21+
return;
22+
}
23+
static auto ShowViewPortPanel_ = reinterpret_cast<void(__thiscall*)(CBasePlayer*, const char*, bool, KeyValues*)>(Memory::Scan<void*>(SERVER, "55 8B EC 83 EC 20 53 56 8B F1 57 8D 4D ? E8 ? ? ? ? 56"));
24+
ShowViewPortPanel_(pPlayer, name, bShow, data);
25+
}

src/modules/cbaseplayer.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ class CBasePlayer
1111
{
1212
public: // MARK: CBasePlayer Public Members
1313
#pragma region Public Members
14+
15+
void CBasePlayer::ShowViewPortPanel(const int playerIndex, const char* name, const bool bShow, KeyValues* data);
16+
1417
#pragma endregion
1518

1619
private: // MARK: CBasePlayer Private Members

0 commit comments

Comments
 (0)