mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2024-12-27 23:25:41 +03:00
Optimize conditional toggle to bitwise operation (#94)
* Optimize conditional toggle to bitwise operation
This commit is contained in:
parent
70594c4c39
commit
06d943417b
@ -65,10 +65,7 @@ void CPathTrack::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller
|
||||
|
||||
if (ShouldToggle(useType, on))
|
||||
{
|
||||
if (on)
|
||||
pev->spawnflags |= SF_PATH_ALTERNATE;
|
||||
else
|
||||
pev->spawnflags &= ~SF_PATH_ALTERNATE;
|
||||
pev->spawnflags ^= SF_PATH_ALTERNATE;
|
||||
}
|
||||
}
|
||||
else // Use toggles between enabled/disabled
|
||||
@ -77,10 +74,7 @@ void CPathTrack::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller
|
||||
|
||||
if (ShouldToggle(useType, on))
|
||||
{
|
||||
if (on)
|
||||
pev->spawnflags |= SF_PATH_DISABLED;
|
||||
else
|
||||
pev->spawnflags &= ~SF_PATH_DISABLED;
|
||||
pev->spawnflags ^= SF_PATH_DISABLED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -204,10 +204,7 @@ void CBot::__MAKE_VHOOK(ClearPrimaryAttack)()
|
||||
|
||||
void CBot::__MAKE_VHOOK(TogglePrimaryAttack)()
|
||||
{
|
||||
if (m_buttonFlags & IN_ATTACK)
|
||||
m_buttonFlags &= ~IN_ATTACK;
|
||||
else
|
||||
m_buttonFlags |= IN_ATTACK;
|
||||
m_buttonFlags ^= IN_ATTACK;
|
||||
}
|
||||
|
||||
void CBot::__MAKE_VHOOK(SecondaryAttack)()
|
||||
|
Loading…
Reference in New Issue
Block a user