-
Notifications
You must be signed in to change notification settings - Fork 644
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
[Half-Life] Gargantua's Stomp attack is broken at higher framerates #2876
Comments
That doesn't really fix the problem. The attack speed will still be dependent on the framerate, just in a different way. Depending on the framerate the think method will execute more often since it can't execute exactly at the time set in The proper way to fix this is to use the same solution as the turn rate fix (#2458). After this line: Line 84 in c7240b9
Add this: int Save(CSave& save) override;
int Restore(CRestore& restore) override;
static TYPEDESCRIPTION m_SaveData[];
float m_flLastThinkTime; After this line: Line 91 in c7240b9
Add this: TYPEDESCRIPTION CStomp::m_SaveData[] =
{
DEFINE_FIELD(CStomp, m_flLastThinkTime, FIELD_TIME),
};
IMPLEMENT_SAVERESTORE(CStomp, CBaseEntity); Rework this code: Lines 124 to 148 in c7240b9
To this: if (m_flLastThinkTime == 0)
{
m_flLastThinkTime = gpGlobals->time - gpGlobals->frametime;
}
//Use 1/4th the delta time to match the original behavior more closely
const float deltaTime = (gpGlobals->time - m_flLastThinkTime) / 4;
m_flLastThinkTime = gpGlobals->time;
TraceResult tr;
pev->nextthink = gpGlobals->time + 0.1;
// Do damage for this frame
Vector vecStart = pev->origin;
vecStart.z += 30;
Vector vecEnd = vecStart + (pev->movedir * pev->speed * deltaTime);
UTIL_TraceHull( vecStart, vecEnd, dont_ignore_monsters, head_hull, ENT(pev), &tr );
if ( tr.pHit && tr.pHit != pev->owner )
{
CBaseEntity *pEntity = CBaseEntity::Instance( tr.pHit );
entvars_t *pevOwner = pev;
if ( pev->owner )
pevOwner = VARS(pev->owner);
if ( pEntity )
pEntity->TakeDamage( pev, pevOwner, gSkillData.gargantuaDmgStomp, DMG_SONIC );
}
// Accelerate the effect
pev->speed = pev->speed + deltaTime * pev->framerate;
pev->framerate = pev->framerate + deltaTime * 1500; Instead of |
Gargantua's stomp attack is broken at higher framerates because his attack movement/velocity based on framerate.
As it can be seen here: https://streamable.com/uajuq
To fix this:
halflife/dlls/gargantua.cpp
Lines 146 to 148 in c7240b9
Change:
To:
The text was updated successfully, but these errors were encountered: