misc fixes

This commit is contained in:
rei-2
2025-08-30 18:26:42 -04:00
parent fd5f641d2a
commit 5c959f021d
5 changed files with 21 additions and 4 deletions
+1
View File
@@ -991,6 +991,7 @@
<ClCompile Include="src\Hooks\CMatchInviteNotification_OnTick.cpp" />
<ClCompile Include="src\Hooks\CMaterial_Uncache.cpp" />
<ClCompile Include="src\Hooks\CTFWeaponBase_CanFireRandomCriticalShot.cpp" />
<ClCompile Include="src\Hooks\CTFPlayer_GetMinFOV.cpp" />
<ClCompile Include="src\Hooks\IEngineTrace_SetTraceEntity.cpp" />
<ClCompile Include="src\Hooks\CNetChannel_SendDatagram.cpp" />
<ClCompile Include="src\Hooks\CNetChannel_SendNetMsg.cpp" />
+1
View File
@@ -196,6 +196,7 @@
<ClCompile Include="src\Features\Visuals\Groups\Groups.cpp" />
<ClCompile Include="src\Hooks\CInput_ValidateUserCmd.cpp" />
<ClCompile Include="src\Hooks\CTFWeaponBase_CanFireRandomCriticalShot.cpp" />
<ClCompile Include="src\Hooks\CTFPlayer_GetMinFOV.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\Utils\UtlVector\UtlVector.h" />
+4 -4
View File
@@ -14,7 +14,7 @@
#define SEED_ATTEMPTS 4096
#define BUCKET_ATTEMPTS 1000
#define SERVER_CRIT_DATA
//#define SERVER_CRIT_DATA
int CCritHack::GetCritCommand(CTFWeaponBase* pWeapon, int iCommandNumber, bool bCrit, bool bSafe)
{
@@ -498,10 +498,10 @@ void CCritHack::Event(IGameEvent* pEvent, uint32_t uHash, CTFPlayer* pLocal)
void CCritHack::Store()
{
for (auto& pEntity : H::Entities.GetGroup(EGroupType::PLAYERS_ALL))
for (int n = 1; n <= I::EngineClient->GetMaxClients(); n++)
{
auto pPlayer = pEntity->As<CTFPlayer>();
if (pPlayer->IsAlive() && !pPlayer->IsAGhost())
auto pPlayer = I::ClientEntityList->GetClientEntity(n)->As<CTFPlayer>();
if (pPlayer && pPlayer->IsAlive() && !pPlayer->IsAGhost())
StoreHealthHistory(pPlayer->entindex(), pPlayer->m_iHealth());
}
}
@@ -0,0 +1,9 @@
#include "../SDK/SDK.h"
MAKE_SIGNATURE(CTFPlayer_GetMinFOV, "client.dll", "F3 0F 10 05 ? ? ? ? C3 CC CC CC CC CC CC CC 48 8B 81 ? ? ? ? 8B D2", 0x0);
MAKE_HOOK(CTFPlayer_GetMinFOV, S::CTFPlayer_GetMinFOV(), float,
/*void* rcx*/)
{
return 0.f;
}
@@ -2,6 +2,8 @@
#include "../Features/CritHack/CritHack.h"
static int s_iCurrentSeed = -1;
MAKE_HOOK(CTFWeaponBase_CalcIsAttackCritical, S::CTFWeaponBase_CalcIsAttackCritical(), void,
void* rcx)
{
@@ -15,7 +17,10 @@ MAKE_HOOK(CTFWeaponBase_CalcIsAttackCritical, S::CTFWeaponBase_CalcIsAttackCriti
const auto nPreviousWeaponMode = pWeapon->m_iWeaponMode();
pWeapon->m_iWeaponMode() = TF_WEAPON_PRIMARY_MODE;
if (I::Prediction->m_bFirstTimePredicted)
{
CALL_ORIGINAL(rcx);
s_iCurrentSeed = pWeapon->m_iCurrentSeed();
}
else // fixes minigun and flamethrower buggy crit sounds for the most part
{
float flOldCritTokenBucket = pWeapon->m_flCritTokenBucket();
@@ -29,6 +34,7 @@ MAKE_HOOK(CTFWeaponBase_CalcIsAttackCritical, S::CTFWeaponBase_CalcIsAttackCriti
pWeapon->m_nCritSeedRequests() = nOldCritSeedRequests;
pWeapon->m_flLastRapidFireCritCheckTime() = flOldLastRapidFireCritCheckTime;
pWeapon->m_flCritTime() = flOldCritTime;
pWeapon->m_iCurrentSeed() = s_iCurrentSeed; // make sure seed stays changed
}
pWeapon->m_iWeaponMode() = nPreviousWeaponMode;
}