r5sdk/r5dev/game/client/input.cpp
Kawe Mazidjatari 144d5f62e1 IDetour: code refactor
Utilize the new IDetour::DetourSetup() code, IDetour::Attach and IDetour::Detach have been removed in favor of this (significantly reduces chance of user error). Since the template check happens in the idetour header, it is much more aggressive on type mismatches, such as a difference in parameter types, between the function and detour, will now raise a compile time error. As a result, some type mismatches have been fixed in this commit as well.
2024-04-05 16:41:09 +02:00

25 lines
836 B
C++

//=============================================================================//
//
// Purpose:
//
//=============================================================================//
#include "input.h"
#include "common/global.h"
#include "game/shared/weapon_types.h"
void CInput::SetCustomWeaponActivity(CInput* pInput, int weaponActivity)
{
// Server only allows other custom weapon activities if cheats are enabled,
// don't bother simulating it on the client without the cheats cvar, as
// otherwise visual glitches occur.
if (!sv_cheats->GetBool() && weaponActivity != ACT_VM_WEAPON_INSPECT)
weaponActivity = ACT_NONE;
v_CInput__SetCustomWeaponActivity(pInput, weaponActivity);
}
void VInput::Detour(const bool bAttach) const
{
DetourSetup(&v_CInput__SetCustomWeaponActivity, CInput::SetCustomWeaponActivity, bAttach);
}