2 #include "../player.qh"
4 void _Movetype_Physics_Toss(entity this, float dt) // SV_Physics_Toss
8 if (this.velocity.z >= 1 / 32 && UPWARD_VELOCITY_CLEARS_ONGROUND(this))
12 else if (!this.groundentity)
16 else if (this.move_suspendedinair && wasfreed(this.groundentity))
18 this.groundentity = NULL;
23 this.move_suspendedinair = false;
25 _Movetype_CheckVelocity(this);
27 /*if (this.move_movetype == MOVETYPE_BOUNCE || this.move_movetype == MOVETYPE_TOSS)
29 this.move_didgravity = 1;
30 this.velocity_z -= (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE ? 0.5 : 1)
32 * (this.gravity ? this.gravity : 1)
36 if (this.move_movetype == MOVETYPE_BOUNCE || this.move_movetype == MOVETYPE_TOSS)
38 this.move_didgravity = true;
39 this.velocity_z -= (((this.gravity) ? this.gravity : 1) * PHYS_GRAVITY(this) * dt);
42 this.angles = this.angles + this.avelocity * dt;
45 for (int bump = 0; bump < MAX_CLIP_PLANES && movetime > 0; ++bump)
47 vector move = this.velocity * movetime;
48 _Movetype_PushEntity(this, move, true);
54 _Movetype_UnstickEntity(this);
55 _Movetype_PushEntity(this, move, false);
60 if (trace_fraction == 1)
63 movetime *= 1 - min(1, trace_fraction);
65 if (this.move_movetype == MOVETYPE_BOUNCEMISSILE)
67 this.velocity = _Movetype_ClipVelocity(this.velocity, trace_plane_normal, 2.0);
70 else if (this.move_movetype == MOVETYPE_BOUNCE)
72 float bouncefac = this.bouncefactor; if (!bouncefac) bouncefac = 0.5;
73 float bstop = this.bouncestop; if (!bstop) bstop = 60 / 800;
74 bstop *= (this.gravity ? this.gravity : 1) * PHYS_GRAVITY(this);
76 this.velocity = _Movetype_ClipVelocity(this.velocity, trace_plane_normal, 1 + bouncefac);
78 float d = trace_plane_normal * this.velocity;
79 if (trace_plane_normal.z > 0.7 && d < bstop && d > -bstop)
82 this.groundentity = trace_ent;
83 this.velocity = '0 0 0';
84 this.avelocity = '0 0 0';
93 this.velocity = _Movetype_ClipVelocity(this.velocity, trace_plane_normal, 1.0);
94 if (trace_plane_normal.z > 0.7)
97 this.groundentity = trace_ent;
98 if (trace_ent.solid == SOLID_BSP)
99 this.move_suspendedinair = true;
100 this.velocity = '0 0 0';
101 this.avelocity = '0 0 0';
105 UNSET_ONGROUND(this);
109 // DP revision 8905 (just, WHY...)
110 if (this.move_movetype == MOVETYPE_BOUNCEMISSILE)
113 // DP revision 8918 (WHY...)
114 if (IS_ONGROUND(this))
118 //if (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE && this.move_didgravity > 0 && !IS_ONGROUND(this))
119 // this.velocity_z -= 0.5 * dt * (this.gravity ? this.gravity : 1) * PHYS_GRAVITY(this);
121 _Movetype_CheckWaterTransition(this);