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