mirror of
https://github.com/yquake2/xatrix.git
synced 2024-11-10 14:52:06 +00:00
Merge pull request #25 from BjossiAlfreds/checkvelocity
maxvelocity correctly enforced
This commit is contained in:
commit
9b41bb0f92
1 changed files with 3 additions and 12 deletions
15
src/g_phys.c
15
src/g_phys.c
|
@ -70,24 +70,15 @@ SV_TestEntityPosition(edict_t *ent)
|
|||
void
|
||||
SV_CheckVelocity(edict_t *ent)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!ent)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* bound velocity */
|
||||
for (i = 0; i < 3; i++)
|
||||
if (VectorLength(ent->velocity) > sv_maxvelocity->value)
|
||||
{
|
||||
if (ent->velocity[i] > sv_maxvelocity->value)
|
||||
{
|
||||
ent->velocity[i] = sv_maxvelocity->value;
|
||||
}
|
||||
else if (ent->velocity[i] < -sv_maxvelocity->value)
|
||||
{
|
||||
ent->velocity[i] = -sv_maxvelocity->value;
|
||||
}
|
||||
VectorNormalize(ent->velocity);
|
||||
VectorScale(ent->velocity, sv_maxvelocity->value, ent->velocity);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue