1 #include "../player.qh"
3 void _Movetype_Physics_Toss(entity this, float dt) // SV_Physics_Toss
7 if (this.velocity.z >= 1 / 32 && UPWARD_VELOCITY_CLEARS_ONGROUND(this))
11 else if (!this.groundentity)
15 else if (this.move_suspendedinair && wasfreed(this.groundentity))
17 this.groundentity = NULL;
22 this.move_suspendedinair = false;
24 _Movetype_CheckVelocity(this);
26 /*if (this.move_movetype == MOVETYPE_BOUNCE || this.move_movetype == MOVETYPE_TOSS)
28 this.move_didgravity = 1;
29 this.velocity_z -= (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE ? 0.5 : 1)
31 * (this.gravity ? this.gravity : 1)
35 if (this.move_movetype == MOVETYPE_BOUNCE || this.move_movetype == MOVETYPE_TOSS)
37 this.move_didgravity = true;
38 this.velocity_z -= (((this.gravity) ? this.gravity : 1) * PHYS_GRAVITY(this) * dt);
41 this.angles = this.angles + this.avelocity * dt;
44 for (int bump = 0; bump < MAX_CLIP_PLANES && movetime > 0; ++bump)
46 vector move = this.velocity * movetime;
47 _Movetype_PushEntity(this, move, true);
53 _Movetype_UnstickEntity(this);
54 _Movetype_PushEntity(this, move, false);
59 if (trace_fraction == 1)
62 movetime *= 1 - min(1, trace_fraction);
64 if (this.move_movetype == MOVETYPE_BOUNCEMISSILE)
66 this.velocity = _Movetype_ClipVelocity(this.velocity, trace_plane_normal, 2.0);
69 else if (this.move_movetype == MOVETYPE_BOUNCE)
71 float bouncefac = this.bouncefactor; if (!bouncefac) bouncefac = 0.5;
72 float bstop = this.bouncestop; if (!bstop) bstop = 60 / 800;
73 bstop *= (this.gravity ? this.gravity : 1) * PHYS_GRAVITY(this);
75 this.velocity = _Movetype_ClipVelocity(this.velocity, trace_plane_normal, 1 + bouncefac);
77 float d = trace_plane_normal * this.velocity;
78 if (trace_plane_normal.z > 0.7 && d < bstop && d > -bstop)
81 this.groundentity = trace_ent;
82 this.velocity = '0 0 0';
83 this.avelocity = '0 0 0';
92 this.velocity = _Movetype_ClipVelocity(this.velocity, trace_plane_normal, 1.0);
93 if (trace_plane_normal.z > 0.7)
96 this.groundentity = trace_ent;
97 if (trace_ent.solid == SOLID_BSP)
98 this.move_suspendedinair = true;
99 this.velocity = '0 0 0';
100 this.avelocity = '0 0 0';
104 UNSET_ONGROUND(this);
108 // DP revision 8905 (just, WHY...)
109 if (this.move_movetype == MOVETYPE_BOUNCEMISSILE)
112 // DP revision 8918 (WHY...)
113 if (IS_ONGROUND(this))
117 //if (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE && this.move_didgravity > 0 && !IS_ONGROUND(this))
118 // this.velocity_z -= 0.5 * dt * (this.gravity ? this.gravity : 1) * PHYS_GRAVITY(this);
120 _Movetype_CheckWaterTransition(this);