mirror of
https://github.com/rehlds/rehlds.git
synced 2024-12-27 07:05:43 +03:00
Move SV_CheckMovingGround into SV_Physics (#1045)
This commit is contained in:
parent
e83b324301
commit
4afb6e3be9
@ -1491,28 +1491,7 @@ void SV_Physics()
|
||||
if (i > 0 && i <= g_psvs.maxclients)
|
||||
continue;
|
||||
|
||||
if (ent->v.flags & FL_ONGROUND)
|
||||
{
|
||||
edict_t *groundentity = ent->v.groundentity;
|
||||
if (groundentity && (groundentity->v.flags & FL_CONVEYOR))
|
||||
{
|
||||
if (ent->v.flags & FL_BASEVELOCITY)
|
||||
VectorMA(ent->v.basevelocity, groundentity->v.speed, groundentity->v.movedir, ent->v.basevelocity);
|
||||
else
|
||||
VectorScale(groundentity->v.movedir, groundentity->v.speed, ent->v.basevelocity);
|
||||
|
||||
ent->v.flags |= FL_BASEVELOCITY;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(ent->v.flags & FL_BASEVELOCITY))
|
||||
{
|
||||
// Apply momentum (add in half of the previous frame of velocity first)
|
||||
VectorMA(ent->v.velocity, (host_frametime * 0.5f + 1.0f), ent->v.basevelocity, ent->v.velocity);
|
||||
VectorClear(ent->v.basevelocity);
|
||||
}
|
||||
|
||||
ent->v.flags &= ~FL_BASEVELOCITY;
|
||||
SV_CheckMovingGround(ent, host_frametime);
|
||||
|
||||
switch (ent->v.movetype)
|
||||
{
|
||||
|
@ -686,35 +686,33 @@ qboolean SV_PlayerRunThink(edict_t *ent, float frametime, double clienttimebase)
|
||||
return ent->free == 0;
|
||||
}
|
||||
|
||||
void SV_CheckMovingGround(edict_t *player, float frametime)
|
||||
void SV_CheckMovingGround(edict_t *ent, float frametime)
|
||||
{
|
||||
edict_t *groundentity;
|
||||
|
||||
if (player->v.flags & FL_ONGROUND)
|
||||
if (ent->v.flags & FL_ONGROUND)
|
||||
{
|
||||
groundentity = player->v.groundentity;
|
||||
groundentity = ent->v.groundentity;
|
||||
if (groundentity)
|
||||
{
|
||||
if (groundentity->v.flags & FL_CONVEYOR)
|
||||
{
|
||||
if (player->v.flags & FL_BASEVELOCITY)
|
||||
VectorMA(player->v.basevelocity, groundentity->v.speed, groundentity->v.movedir, player->v.basevelocity);
|
||||
if (ent->v.flags & FL_BASEVELOCITY)
|
||||
VectorMA(ent->v.basevelocity, groundentity->v.speed, groundentity->v.movedir, ent->v.basevelocity);
|
||||
else
|
||||
VectorScale(groundentity->v.movedir, groundentity->v.speed, player->v.basevelocity);
|
||||
player->v.flags |= FL_BASEVELOCITY;
|
||||
VectorScale(groundentity->v.movedir, groundentity->v.speed, ent->v.basevelocity);
|
||||
ent->v.flags |= FL_BASEVELOCITY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(player->v.flags & FL_BASEVELOCITY))
|
||||
if (!(ent->v.flags & FL_BASEVELOCITY))
|
||||
{
|
||||
VectorMA(player->v.velocity, frametime * 0.5f + 1.0f, player->v.basevelocity, player->v.velocity);
|
||||
player->v.basevelocity[0] = 0;
|
||||
player->v.basevelocity[1] = 0;
|
||||
player->v.basevelocity[2] = 0;
|
||||
VectorMA(ent->v.velocity, frametime * 0.5f + 1.0f, ent->v.basevelocity, ent->v.velocity);
|
||||
VectorClear(ent->v.basevelocity);
|
||||
}
|
||||
|
||||
player->v.flags &= ~FL_BASEVELOCITY;
|
||||
ent->v.flags &= ~FL_BASEVELOCITY;
|
||||
}
|
||||
|
||||
void SV_ConvertPMTrace(trace_t *dest, pmtrace_t *src, edict_t *ent)
|
||||
|
Loading…
Reference in New Issue
Block a user