Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply Opposing Force weapon prediction timing fix to Half-Life #3252

Open
SamVanheer opened this issue Mar 2, 2022 · 0 comments
Open

Apply Opposing Force weapon prediction timing fix to Half-Life #3252

SamVanheer opened this issue Mar 2, 2022 · 0 comments

Comments

@SamVanheer
Copy link

Opposing Force changes which time value the weapon prediction code uses.

The original code use the time value provided by the engine, which is set here:

gpGlobals->time = time;

This value is tied to the data used to run the prediction code for this frame. When re-running an older frame this value will be earlier in time than the actual time the engine is on at that point.

This causes problems with weapon prediction. Any time values that still use absolute time values will interact poorly with this, for example the Opposing Force M249 and Sniper Rifle will restart the second part of their full reload animation when used with this code.

Strictly speaking the time values should use relative values but this isn't always feasible to implement.

Opposing Force changes the time value used to always use the value returned by gEngfuncs.GetClientTime(). This fixes the animation issues caused by older time values.

This value is overridden here in Opposing Force:

void CBasePlayerWeapon::ItemPostFrame( void )
{
if ((m_fInReload) && (m_pPlayer->m_flNextAttack <= 0.0))

But setting the value at the start of HUD_WeaponsPostThink will work fine as well.

This change doesn't break existing weapons code in Half-Life and Blue Shift since all of the original weapons are running with this value in Opposing Force.

I wouldn't recommend using this in other games since it hasn't been tested there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants