Skip to content

Commit

Permalink
Updated
Browse files Browse the repository at this point in the history
Updated
  • Loading branch information
SmileYzn committed Sep 17, 2024
1 parent 555422c commit dbf553b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
35 changes: 19 additions & 16 deletions AccuracyFix/AccuracyFix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,36 @@ CAccuracyFix gAccuracyFix;

void CAccuracyFix::ServerActivate()
{
/*this->m_af_accuracy_all = gAccuracyUtil.CvarRegister("af_accuracy_all", "-1.0");
this->m_af_accuracy_all = gAccuracyUtil.CvarRegister("af_accuracy_all", "-1.0");

this->m_af_distance_all = gAccuracyUtil.CvarRegister("af_distance_all", "-1.0");

this->m_af_jump_fix = gAccuracyUtil.CvarRegister("af_jump_fix", "0");

char cvarName[64] = { 0 };
for (int WeaponID = WEAPON_P228; WeaponID <= WEAPON_P90; WeaponID++)
if (g_ReGameApi)
{
auto SlotInfo = g_ReGameApi->GetWeaponSlot((WeaponIdType)WeaponID);
char cvarName[32] = { 0 };

if (SlotInfo)
for (int WeaponID = WEAPON_P228; WeaponID <= WEAPON_P90; WeaponID++)
{
if ((SlotInfo->slot == PRIMARY_WEAPON_SLOT) || (SlotInfo->slot == PISTOL_SLOT))
auto SlotInfo = g_ReGameApi->GetWeaponSlot((WeaponIdType)WeaponID);

if (SlotInfo)
{
if (SlotInfo->weaponName)
if ((SlotInfo->slot == PRIMARY_WEAPON_SLOT) || (SlotInfo->slot == PISTOL_SLOT))
{
if (SlotInfo->weaponName[0u] != '\0')
if (SlotInfo->weaponName)
{
Q_snprintf(cvarName, sizeof(cvarName), "af_distance_%s", SlotInfo->weaponName);
if (SlotInfo->weaponName[0u] != '\0')
{
Q_snprintf(cvarName, sizeof(cvarName), "af_distance_%s", SlotInfo->weaponName);

this->m_af_distance[WeaponID] = gAccuracyUtil.CvarRegister(cvarName, "8192.0");
this->m_af_distance[WeaponID] = gAccuracyUtil.CvarRegister(cvarName, "8192.0");

Q_snprintf(cvarName, sizeof(cvarName), "af_accuracy_%s", SlotInfo->weaponName);
Q_snprintf(cvarName, sizeof(cvarName), "af_accuracy_%s", SlotInfo->weaponName);

this->m_af_accuracy[WeaponID] = gAccuracyUtil.CvarRegister(cvarName, "9999.0");
this->m_af_accuracy[WeaponID] = gAccuracyUtil.CvarRegister(cvarName, "9999.0");
}
}
}
}
Expand All @@ -45,12 +48,12 @@ void CAccuracyFix::ServerActivate()
{
gAccuracyUtil.ServerCommand("exec %s/accuracyfix.cfg", Path);
}
}*/
}
}

void CAccuracyFix::TraceLine(const float* vStart, const float* vEnd, int fNoMonsters, edict_t* pentToSkip, TraceResult* ptr)
{
/*if ((fNoMonsters == dont_ignore_monsters) && (gpGlobals->trace_flags != FTRACE_FLASH))
if ((fNoMonsters == dont_ignore_monsters) && (gpGlobals->trace_flags != FTRACE_FLASH))
{
if (!FNullEnt(pentToSkip))
{
Expand Down Expand Up @@ -109,6 +112,6 @@ void CAccuracyFix::TraceLine(const float* vStart, const float* vEnd, int fNoMons
}
}
}
}*/
}
}

4 changes: 2 additions & 2 deletions AccuracyFix/AccuracyUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cvar_t* CAccuracyUtil::CvarRegister(const char* Name, const char* Value)
{
cvar_t* pCvar = g_engfuncs.pfnCVarGetPointer(Name);

if (pCvar == nullptr)
if (!pCvar)
{
this->m_CvarData[Name].name = Name;

Expand All @@ -18,7 +18,7 @@ cvar_t* CAccuracyUtil::CvarRegister(const char* Name, const char* Value)

pCvar = g_engfuncs.pfnCVarGetPointer(this->m_CvarData[Name].name);

if (pCvar != nullptr)
if (pCvar)
{
g_engfuncs.pfnCvar_DirectSet(pCvar, Value);
}
Expand Down

0 comments on commit dbf553b

Please sign in to comment.