3 void _Movetype_Physics_Toss(entity this, float dt) // SV_Physics_Toss
7 if(this.velocity.z >= (1 / 32) && UPWARD_VELOCITY_CLEARS_ONGROUND(this))
9 // don't stick to ground if onground and moving upward
12 else if(!this.groundentity || !GAMEPLAYFIX_NOAIRBORNCORPSE(this))
16 else if(this.move_suspendedinair && wasfreed(this.groundentity))
18 this.groundentity = NULL;
19 if(NOAIRBORNCORPSE_ALLOWSUSPENDED(this))
22 else if(boxesoverlap(this.absmin, this.absmax, this.groundentity.absmin, this.groundentity.absmax))
24 // don't slide if still touching the groundentity
29 this.move_suspendedinair = false;
31 _Movetype_CheckVelocity(this);
33 if(this.move_movetype == MOVETYPE_BOUNCE || this.move_movetype == MOVETYPE_TOSS)
35 this.move_didgravity = true;
36 this.velocity_z -= (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE ? 0.5 : 1)
38 * ((this.gravity) ? this.gravity : 1)
42 /*if (this.move_movetype == MOVETYPE_BOUNCE || this.move_movetype == MOVETYPE_TOSS)
44 this.move_didgravity = true;
45 this.velocity_z -= (((this.gravity) ? this.gravity : 1) * PHYS_GRAVITY(this) * dt);
48 this.angles = this.angles + this.avelocity * dt;
51 for (int bump = 0; bump < MAX_CLIP_PLANES && movetime > 0; bump++)
53 vector move = this.velocity * movetime;
54 if(!_Movetype_PushEntity(this, move, true))
59 // NOTE: this is bmodelstartsolid in the engine
60 if (trace_startsolid && trace_ent.solid == SOLID_BSP)
62 // QC lacks pointers so we must save the old trace values
63 float oldtrace_fraction = trace_fraction;
64 vector oldtrace_plane_normal = trace_plane_normal;
65 entity oldtrace_ent = trace_ent;
66 _Movetype_UnstickEntity(this);
67 trace_fraction = oldtrace_fraction;
68 trace_plane_normal = oldtrace_plane_normal;
69 trace_ent = oldtrace_ent;
70 if(!_Movetype_PushEntity(this, move, true))
76 if (trace_fraction == 1)
79 movetime *= 1 - min(1, trace_fraction);
81 if (this.move_movetype == MOVETYPE_BOUNCEMISSILE)
83 float bouncefac = (!this.bouncefactor) ? 1.0 : this.bouncefactor;
84 this.velocity = _Movetype_ClipVelocity(this.velocity, trace_plane_normal, 1 + bouncefac);
86 if(!GAMEPLAYFIX_SLIDEMOVEPROJECTILES(this))
89 else if (this.move_movetype == MOVETYPE_BOUNCE)
91 float bouncefac = (!this.bouncefactor) ? 0.5 : this.bouncefactor;
92 float bstop = (!this.bouncestop) ? (60 / 800) : this.bouncestop;
93 float grav = ((this.gravity) ? this.gravity : 1);
95 this.velocity = _Movetype_ClipVelocity(this.velocity, trace_plane_normal, 1 + bouncefac);
97 float d = trace_plane_normal * this.velocity;
98 if(!GAMEPLAYFIX_GRENADEBOUNCESLOPES(this))
100 if (trace_plane_normal.z > 0.7 && d < PHYS_GRAVITY(this) * bstop * grav)
103 this.groundentity = trace_ent;
104 this.velocity = '0 0 0';
105 this.avelocity = '0 0 0';
110 UNSET_ONGROUND(this);
111 if(!GAMEPLAYFIX_SLIDEMOVEPROJECTILES(this))
117 this.velocity = _Movetype_ClipVelocity(this.velocity, trace_plane_normal, 1.0);
118 if (trace_plane_normal.z > 0.7)
121 this.groundentity = trace_ent;
122 if (trace_ent.solid == SOLID_BSP)
123 this.move_suspendedinair = true;
124 this.velocity = '0 0 0';
125 this.avelocity = '0 0 0';
130 UNSET_ONGROUND(this);
131 if(!GAMEPLAYFIX_SLIDEMOVEPROJECTILES(this))
136 // DP revision 8905 (just, WHY...)
137 //if (this.move_movetype == MOVETYPE_BOUNCEMISSILE)
140 // DP revision 8918 (WHY...)
141 //if (IS_ONGROUND(this))
145 if (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE && this.move_didgravity > 0 && !IS_ONGROUND(this))
146 this.velocity_z -= 0.5 * dt * ((this.gravity) ? this.gravity : 1) * PHYS_GRAVITY(this);
148 _Movetype_CheckWaterTransition(this);