1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
void CGameMovement::AddGravity( void )
{
float ent_gravity;
if ( player->m_flWaterJumpTime )
return;
if (player->GetGravity())
ent_gravity = player->GetGravity();
else
ent_gravity = 1.0;
// Add gravity incorrectly
mv->m_vecVelocity[2] -= (ent_gravity * GetCurrentGravity() * gpGlobals->frametime);
mv->m_vecVelocity[2] += player->GetBaseVelocity()[2] * gpGlobals->frametime;
Vector temp = player->GetBaseVelocity();
temp[2] = 0;
player->SetBaseVelocity( temp );
CheckVelocity();
}
void CGameMovement::StartGravity( void )
{
float ent_gravity;
if (player->GetGravity())
ent_gravity = player->GetGravity();
else
ent_gravity = 1.0;
// Add gravity so they'll be in the correct position during movement
// yes, this 0.5 looks wrong, but it's not.
mv->m_vecVelocity[2] -= (ent_gravity * GetCurrentGravity() * 0.5 * gpGlobals->frametime );
mv->m_vecVelocity[2] += player->GetBaseVelocity()[2] * gpGlobals->frametime;
Vector temp = player->GetBaseVelocity();
temp[ 2 ] = 0;
player->SetBaseVelocity( temp );
CheckVelocity();
}
void CGameMovement::FinishGravity( void )
{
float ent_gravity;
if ( player->m_flWaterJumpTime )
return;
if ( player->GetGravity() )
ent_gravity = player->GetGravity();
else
ent_gravity = 1.0;
// Get the correct velocity for the end of the dt
mv->m_vecVelocity[2] -= (ent_gravity * GetCurrentGravity() * gpGlobals->frametime * 0.5);
CheckVelocity();
}