Skip to content

Commit 38cb2f7

Browse files
committed
Add notes about new holdaim
1 parent aaffe43 commit 38cb2f7

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

rehlds/engine/sv_user.cpp

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,63 @@ void SV_RunCmd(usercmd_t *ucmd, int random_seed)
10421042

10431043
if (!host_client->fakeclient)
10441044
SV_RestoreMove(host_client);
1045+
1046+
// If we have to restore the view angle then do so right now
1047+
1048+
// TODO: Implement: in `player.h` & `player.cpp`
1049+
/*
1050+
QAngle m_qangLockViewangles;
1051+
int m_iLockViewanglesTickNumber;
1052+
1053+
int GetLockViewanglesTickNumber() const { return m_iLockViewanglesTickNumber; }
1054+
QAngle GetLockViewanglesData() const { return m_qangLockViewangles; }
1055+
1056+
////////////
1057+
void CCSPlayer::NoteWeaponFired()
1058+
{
1059+
Assert( m_pCurrentCommand );
1060+
if( m_pCurrentCommand )
1061+
{
1062+
m_iLastWeaponFireUsercmd = m_pCurrentCommand->command_number;
1063+
}
1064+
1065+
// Remember the tickcount when the weapon was fired and lock viewangles here!
1066+
if ( m_iLockViewanglesTickNumber != gpGlobals->tickcount )
1067+
{
1068+
m_iLockViewanglesTickNumber = gpGlobals->tickcount;
1069+
m_qangLockViewangles = pl.v_angle;
1070+
}
1071+
}
1072+
*/
1073+
1074+
/**
1075+
Implement in CCSPlayer::FireBullet:
1076+
1077+
// Let the player remember the usercmd he fired a weapon on. Assists in making decisions about lag compensation.
1078+
if ( pPlayer )
1079+
pPlayer->NoteWeaponFired();
1080+
1081+
1082+
if ( bBulletHitPlayer && !bShotHitTeammate )
1083+
{ // Guarantee that the bullet that hit an enemy trumps the player viewangles
1084+
// that are locked in for the duration of the server simulation ticks
1085+
m_iLockViewanglesTickNumber = gpGlobals->tickcount;
1086+
m_qangLockViewangles = pl.v_angle;
1087+
}
1088+
*/
1089+
1090+
/*
1091+
Implement in SV_RunCmd():
1092+
1093+
// player->IsBot() == sv_player->fakeclient
1094+
// tickcount == m_System->GetTick()
1095+
1096+
if ( !player->IsBot() &&
1097+
( gpGlobals->tickcount - player->GetLockViewanglesTickNumber() < sv_maxusrcmdprocessticks_holdaim.value ) )
1098+
{
1099+
player->pl.v_angle = player->GetLockViewanglesData();
1100+
}
1101+
*/
10451102
}
10461103

10471104
int SV_ValidateClientCommand(char *pszCommand)

0 commit comments

Comments
 (0)