Skip to content

Commit

Permalink
client: render: fixed studiomodel interpolant value calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
SNMetamorph committed May 2, 2024
1 parent ed546fd commit eb27b33
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions client/render/gl_studio_draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -592,28 +592,15 @@ StudioEstimateInterpolant
float CStudioModelRenderer :: StudioEstimateInterpolant()
{
cl_entity_t *e = RI->currententity;
double interval = 0.1; // monster think interval
float dadt = 1.0f;

if (e->player)
{
float updateRate = atof(gEngfuncs.PlayerInfo_ValueForKey(e->index, "cl_updaterate"));
if (updateRate > 0.0f)
interval = 1.0f / updateRate;

if (gEngfuncs.GetMaxClients() == 1 || updateRate < 1.0f) {
interval = 1.0f; // in listen server entity state update happens every frame
}
}

double dadt = 1.0;
const double interval = 0.1; // animtime update interval is always fixed and equals 0.1 sec

if (!m_fShootDecal && (e->curstate.animtime >= e->latched.prevanimtime + 0.01f))
{
dadt = (tr.time - e->curstate.animtime) / interval;
dadt = bound(0.0f, dadt, 1.0f);
dadt = bound(0.0, dadt, 2.0); // allow value to be above 1.0 for extrapolation in case of update didn't came in time
}

return dadt;
return static_cast<float>(dadt);
}

/*
Expand Down

0 comments on commit eb27b33

Please sign in to comment.