2 * Copyright (c) 2011 Rudolf Polzer
3 * Copyright (c) 2015 Micah Talkiewicz
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to
7 * deal in the Software without restriction, including without limitation the
8 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 * sell copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
23 #include "cl_player.qh"
25 #include "cl_model.qh"
27 #include "interpolate.qh"
29 float autocvar_cl_movement_errorcompensation = 0;
30 bool autocvar_cl_movement_intermissionrunning = false;
33 float pmove_onground; // weird engine flag we shouldn't really use but have to for now
35 vector csqcplayer_origin, csqcplayer_velocity;
36 float csqcplayer_sequence;
38 float csqcplayer_moveframe;
39 vector csqcplayer_predictionerroro;
40 vector csqcplayer_predictionerrorv;
41 float csqcplayer_predictionerrortime;
42 float csqcplayer_predictionerrorfactor;
44 vector CSQCPlayer_GetPredictionErrorO()
46 if (time >= csqcplayer_predictionerrortime) return '0 0 0';
47 return csqcplayer_predictionerroro * (csqcplayer_predictionerrortime - time) * csqcplayer_predictionerrorfactor;
50 vector CSQCPlayer_GetPredictionErrorV()
52 if (time >= csqcplayer_predictionerrortime) return '0 0 0';
53 return csqcplayer_predictionerrorv * (csqcplayer_predictionerrortime - time) * csqcplayer_predictionerrorfactor;
56 void CSQCPlayer_SetPredictionError(vector o, vector v, float onground_diff)
58 // error too big to compensate, we LIKELY hit a teleport or a
59 // jumppad, or it's a jump time disagreement that'll get fixed
62 // FIXME we sometimes have disagreement in order of jump velocity. Do not act on them!
64 // commented out as this one did not help
67 printf("ONGROUND MISMATCH: %d x=%v v=%v\n", onground_diff, o, v);
71 if(vdist(o, >, 32) || vdist(v, >, 192))
73 //printf("TOO BIG: x=%v v=%v\n", o, v);
77 if(!autocvar_cl_movement_errorcompensation)
79 csqcplayer_predictionerrorfactor = 0;
83 csqcplayer_predictionerroro = CSQCPlayer_GetPredictionErrorO() + o;
84 csqcplayer_predictionerrorv = CSQCPlayer_GetPredictionErrorV() + v;
85 csqcplayer_predictionerrorfactor = autocvar_cl_movement_errorcompensation / ((ticrate) ? ticrate : 1);
86 csqcplayer_predictionerrortime = time + 1.0 / csqcplayer_predictionerrorfactor;
89 void CSQCPlayer_Unpredict(entity this)
91 if (csqcplayer_status == CSQCPLAYERSTATUS_UNPREDICTED) return;
92 if (csqcplayer_status != CSQCPLAYERSTATUS_PREDICTED) LOG_FATALF("Cannot unpredict in current status (%d)", csqcplayer_status);
93 this.origin = csqcplayer_origin;
94 this.velocity = csqcplayer_velocity;
95 csqcplayer_moveframe = csqcplayer_sequence + 1; // + 1 because the recieved frame has the move already done (server side)
96 this.flags = player_pmflags;
99 void CSQCPlayer_SetMinsMaxs(entity this)
101 if (IS_DUCKED(this) || !(this.isplayermodel & ISPLAYER_PLAYER))
103 this.mins = PHYS_PL_CROUCH_MIN(this);
104 this.maxs = PHYS_PL_CROUCH_MAX(this);
105 this.view_ofs = PHYS_PL_CROUCH_VIEWOFS(this);
109 this.mins = PHYS_PL_MIN(this);
110 this.maxs = PHYS_PL_MAX(this);
113 this.view_ofs = PHYS_PL_VIEWOFS(this);
117 void CSQCPlayer_SavePrediction(entity this)
119 player_pmflags = this.flags;
120 csqcplayer_origin = this.origin;
121 csqcplayer_velocity = this.velocity;
122 csqcplayer_sequence = servercommandframe;
123 csqcplayer_status = CSQCPLAYERSTATUS_PREDICTED;
126 void CSQC_ClientMovement_PlayerMove_Frame(entity this);
128 void CSQCPlayer_Physics(entity this)
130 if(!autocvar_cl_movement) { return; }
132 //_Movetype_CheckWater(this); // we apparently need to check water *before* physics so it can use this for water jump
134 vector oldv_angle = this.v_angle;
135 vector oldangles = this.angles; // we need to save these, as they're abused by other code
136 this.v_angle = PHYS_INPUT_ANGLES(this);
137 this.angles = PHYS_WORLD_ANGLES(this);
139 CSQC_ClientMovement_PlayerMove_Frame(this);
141 Movetype_Physics_NoMatchTicrate(this, PHYS_INPUT_TIMELENGTH, true);
143 view_angles = this.v_angle;
144 input_angles = this.angles;
145 this.v_angle = oldv_angle;
146 this.angles = oldangles;
149 ((IS_DUCKED(this)) ? PMF_DUCKED : 0) |
150 ((IS_JUMP_HELD(this)) ? PMF_JUMP_HELD : 0) |
151 ((IS_ONGROUND(this)) ? PMF_ONGROUND : 0);
154 void CSQCPlayer_PredictTo(entity this, float endframe, bool apply_error)
156 CSQCPlayer_Unpredict(this);
159 this.origin += CSQCPlayer_GetPredictionErrorO();
160 this.velocity += CSQCPlayer_GetPredictionErrorV();
162 CSQCPlayer_SetMinsMaxs(this);
164 csqcplayer_status = CSQCPLAYERSTATUS_PREDICTED;
167 // we don't need this
168 // darkplaces makes servercommandframe == 0 in these cases anyway
169 if (STAT(HEALTH) <= 0)
171 csqcplayer_moveframe = clientcommandframe;
172 getinputstate(csqcplayer_moveframe-1);
173 LOG_INFO("the Weird code path got hit");
178 if (csqcplayer_moveframe >= endframe)
180 getinputstate(csqcplayer_moveframe - 1);
186 if (!getinputstate(csqcplayer_moveframe)) break;
187 /*if (input_timelength > 0.0005)
189 if (input_timelength > 0.05)
191 input_timelength /= 2;
192 CSQCPlayer_Physics(this);
194 CSQCPlayer_Physics(this);
196 CSQCPlayer_Physics(this);
197 CSQCPlayer_SetMinsMaxs(this);
198 ++csqcplayer_moveframe;
200 while (csqcplayer_moveframe < endframe);
203 // add in anything that was applied after (for low packet rate protocols)
204 input_angles = view_angles;
207 bool CSQCPlayer_IsLocalPlayer(entity this)
209 return (this == csqcplayer);
213 float autocvar_cl_stairsmoothspeed = 200;
214 float autocvar_cl_smoothviewheight = 0.05;
215 float smooth_prevtime;
217 vector CSQCPlayer_ApplySmoothing(entity this, vector v)
219 float smoothtime = bound(0, time - smooth_prevtime, 0.1);
220 smooth_prevtime = max(smooth_prevtime, drawtime); // drawtime is the previous frame's time at this point
222 if(this.csqcmodel_teleported || !(this.pmove_flags & PMF_ONGROUND) || autocvar_cl_stairsmoothspeed <= 0 || this.ground_networkentity)
226 if(stairsmoothz < v.z)
227 v.z = stairsmoothz = bound(v.z - PHYS_STEPHEIGHT(this), stairsmoothz + smoothtime * autocvar_cl_stairsmoothspeed, v.z);
228 else if(stairsmoothz > v.z)
229 v.z = stairsmoothz = bound(v.z, stairsmoothz - smoothtime * autocvar_cl_stairsmoothspeed, v.z + PHYS_STEPHEIGHT(this));
232 float viewheight = bound(0, (time - smooth_prevtime) / max(0.0001, autocvar_cl_smoothviewheight), 1);
233 viewheightavg = viewheightavg * (1 - viewheight) + this.view_ofs.z * viewheight;
234 v.z += viewheightavg;
236 smooth_prevtime = time;
241 // simplified copy of CSQCPlayer_ApplySmoothing for use on player models
242 .float stairsmooth_offset;
243 .float stairsmooth_prevtime;
244 .float stairsmooth_drawtime; // holds the previous draw time
245 vector CSQCModel_ApplyStairSmoothing(entity this, bool isonground, vector v)
247 float smoothtime = bound(0, time - this.stairsmooth_prevtime, 0.1);
248 this.stairsmooth_prevtime = max(this.stairsmooth_prevtime, this.stairsmooth_drawtime); // stairsmooth_drawtime is the previous frame's time at this point
250 if(this.csqcmodel_teleported || !isonground || autocvar_cl_stairsmoothspeed <= 0 || this.ground_networkentity)
251 this.stairsmooth_offset = v.z;
254 if(this.stairsmooth_offset < v.z)
255 v.z = this.stairsmooth_offset = bound(v.z - PHYS_STEPHEIGHT(this), this.stairsmooth_offset + smoothtime * autocvar_cl_stairsmoothspeed, v.z);
256 else if(this.stairsmooth_offset > v.z)
257 v.z = this.stairsmooth_offset = bound(v.z, this.stairsmooth_offset - smoothtime * autocvar_cl_stairsmoothspeed, v.z + PHYS_STEPHEIGHT(this));
260 this.stairsmooth_prevtime = time;
261 this.stairsmooth_drawtime = drawtime;
266 bool autocvar_v_deathtilt;
267 float autocvar_v_deathtiltangle;
268 void CSQCPlayer_ApplyDeathTilt(entity this)
270 if(!this.csqcmodel_isdead || !autocvar_v_deathtilt)
272 view_angles.z = autocvar_v_deathtiltangle;
275 float autocvar_v_idlescale;
276 float autocvar_v_ipitch_cycle;
277 float autocvar_v_iyaw_cycle;
278 float autocvar_v_iroll_cycle;
279 float autocvar_v_ipitch_level;
280 float autocvar_v_iyaw_level;
281 float autocvar_v_iroll_level;
282 void CSQCPlayer_ApplyIdleScaling(entity this)
284 if(!autocvar_v_idlescale)
286 view_angles.x += autocvar_v_idlescale * sin(time * autocvar_v_ipitch_cycle) * autocvar_v_ipitch_level;
287 view_angles.y += autocvar_v_idlescale * sin(time * autocvar_v_iyaw_cycle) * autocvar_v_iyaw_level;
288 view_angles.z += autocvar_v_idlescale * sin(time * autocvar_v_iroll_cycle) * autocvar_v_iroll_level;
289 //setproperty(VF_CL_VIEWANGLES, view_angles); // update view angles as well so we can aim
292 float autocvar_cl_bob = 0;
293 float autocvar_cl_bobcycle = 0.5;
294 float autocvar_cl_bob_limit = 7;
295 float autocvar_cl_bob_limit_heightcheck = 0;
296 float autocvar_cl_bob_velocity_limit = 400;
297 float autocvar_cl_bobup = 0.5;
298 float autocvar_cl_bobfall = 0.05;
299 float autocvar_cl_bobfallcycle = 3;
300 float autocvar_cl_bobfallminspeed = 200;
301 float autocvar_cl_bob2 = 0;
302 float autocvar_cl_bob2cycle = 1;
303 float autocvar_cl_bob2smooth = 0.05;
307 vector CSQCPlayer_ApplyBobbing(entity this, vector v)
309 if(this.csqcmodel_isdead || PHYS_INVEHICLE(this) || !(this.isplayermodel & ISPLAYER_PLAYER))
312 // bounded XY speed, used by several effects below
315 // vertical view bobbing code
316 if(autocvar_cl_bob && autocvar_cl_bobcycle)
318 float bob_limit = autocvar_cl_bob_limit;
320 if(autocvar_cl_bob_limit_heightcheck)
322 // use traces to determine what range the view can bob in, and scale down the bob as needed
323 vector bob_height_check_dest = v;
324 bob_height_check_dest.z += autocvar_cl_bob_limit * 1.1;
325 traceline(v, bob_height_check_dest, MOVE_NOMONSTERS, NULL);
326 float trace1fraction = trace_fraction;
328 bob_height_check_dest = v;
329 bob_height_check_dest.z += autocvar_cl_bob_limit * -0.5;
330 traceline(v, bob_height_check_dest, MOVE_NOMONSTERS, NULL);
331 float trace2fraction = trace_fraction;
333 bob_limit *= min(trace1fraction, trace2fraction);
336 // LordHavoc: figured out bobup: the time at which the sin is at 180
337 // degrees (which allows lengthening or squishing the peak or valley)
338 cycle = time / autocvar_cl_bobcycle;
339 cycle -= rint(cycle);
340 if(cycle < autocvar_cl_bobup)
341 cycle = sin(M_PI * cycle / autocvar_cl_bobup);
343 cycle = sin(M_PI + M_PI * (cycle - autocvar_cl_bobup) / (1.0 - autocvar_cl_bobup));
344 // bob is proportional to velocity in the xy plane
345 // (don't count Z, or jumping messes it up)
346 float xyspeed = bound(0, sqrt(this.velocity.x * this.velocity.x + this.velocity.y * this.velocity.y), autocvar_cl_bob_velocity_limit);
347 bob = xyspeed * autocvar_cl_bob;
348 bob = bound(0, bob, bob_limit);
349 bob = bob * 0.3 + bob * 0.7 * cycle;
353 // horizontal view bobbing code
354 if(autocvar_cl_bob2 && autocvar_cl_bob2cycle)
356 cycle = time / autocvar_cl_bob2cycle;
357 cycle -= rint(cycle);
359 cycle = cos(M_PI * cycle / 0.5); // cos looks better here with the other view bobbing using sin
361 cycle = cos(M_PI + M_PI * (cycle - 0.5) / 0.5);
362 bob = autocvar_cl_bob2 * cycle;
364 // this value slowly decreases from 1 to 0 when we stop touching the ground.
365 // The cycle is later multiplied with it so the view smooths back to normal
366 if(IS_ONGROUND(this) && !(input_buttons & BIT(1))) // also block the effect while the jump button is pressed, to avoid twitches when bunny-hopping
371 bob2_smooth -= bound(0, autocvar_cl_bob2smooth, 1);
376 // calculate the front and side of the player between the X and Y axes
377 makevectors(view_angles);
378 // now get the speed based on those angles. The bounds should match the same value as xyspeed's
379 float side = bound(-autocvar_cl_bob_velocity_limit, (this.velocity * v_right) * bob2_smooth, autocvar_cl_bob_velocity_limit);
380 float front = bound(-autocvar_cl_bob_velocity_limit, (this.velocity * v_forward) * bob2_smooth, autocvar_cl_bob_velocity_limit);
381 v_forward = v_forward * bob;
382 v_right = v_right * bob;
383 // we use side with forward and front with right, so the bobbing goes
384 // to the side when we walk forward and to the front when we strafe
386 bob2vel.x = side * v_forward.x + front * v_right.x + 0 * v_up.x;
387 bob2vel.y = side * v_forward.y + front * v_right.y + 0 * v_up.y;
388 bob2vel.z = side * v_forward.z + front * v_right.z + 0 * v_up.z;
394 // causes the view to swing down and back up when touching the ground
395 if(autocvar_cl_bobfall && autocvar_cl_bobfallcycle)
397 if(!IS_ONGROUND(this))
399 bobfall_speed = bound(-400, this.velocity.z, 0) * bound(0, autocvar_cl_bobfall, 0.1);
400 if(this.velocity.z < -autocvar_cl_bobfallminspeed)
403 bobfall_swing = 0; // really?
407 bobfall_swing = max(0, bobfall_swing - autocvar_cl_bobfallcycle * frametime);
408 float bobfall = sin(M_PI * bobfall_swing) * bobfall_speed;
416 float autocvar_cl_rollangle;
417 float autocvar_cl_rollspeed;
418 float CSQCPlayer_CalcRoll(entity this)
420 makevectors(view_angles);
421 float side = (this.velocity * v_right);
422 float sign = (side < 0) ? -1 : 1;
425 if(side < autocvar_cl_rollspeed)
426 side = side * autocvar_cl_rollangle / autocvar_cl_rollspeed;
428 side = autocvar_cl_rollangle;
433 float autocvar_chase_back;
434 float autocvar_chase_up;
435 bool autocvar_chase_overhead;
436 float autocvar_chase_pitchangle;
437 vector CSQCPlayer_ApplyChase(entity this, vector v)
442 if(autocvar_chase_overhead)
445 makevectors(view_angles);
448 // trace a little further so it hits a surface more consistently (to avoid 'snapping' on the edge of the range)
449 chase_dest.x = v.x - forward.x * autocvar_chase_back + up.x * autocvar_chase_up;
450 chase_dest.y = v.y - forward.y * autocvar_chase_back + up.y * autocvar_chase_up;
451 chase_dest.z = v.z - forward.z * autocvar_chase_back + up.z * autocvar_chase_up;
453 // trace from first person view location to our chosen third person view location
454 traceline(v, chase_dest, MOVE_NOMONSTERS, NULL);
456 vector bestvieworg = trace_endpos;
457 vector offset = '0 0 0';
458 for(offset.x = -16; offset.x <= 16; offset.x += 8)
460 for(offset.y = -16; offset.y <= 16; offset.y += 8)
462 makevectors(view_angles);
464 chase_dest.x = v.x - forward.x * autocvar_chase_back + up.x * autocvar_chase_up + offset.x;
465 chase_dest.y = v.y - forward.y * autocvar_chase_back + up.y * autocvar_chase_up + offset.y;
466 chase_dest.z = v.z - forward.z * autocvar_chase_back + up.z * autocvar_chase_up + offset.z;
467 traceline(v, chase_dest, MOVE_NOMONSTERS, NULL);
468 if(bestvieworg.z > trace_endpos.z)
469 bestvieworg.z = trace_endpos.z;
475 view_angles.x = autocvar_chase_pitchangle;
476 //setproperty(VF_CL_VIEWANGLES, view_angles); // update view angles as well so we can aim
480 makevectors(view_angles);
482 if(autocvar_chase_front && spectatee_status != -1)
483 forward = normalize(forward * -1);
484 // trace a little further so it hits a surface more consistently (to avoid 'snapping' on the edge of the range)
485 float cdist = -autocvar_chase_back - 8;
486 chase_dest.x = v.x + forward.x * cdist;
487 chase_dest.y = v.y + forward.y * cdist;
488 chase_dest.z = v.z + forward.z * cdist + autocvar_chase_up;
489 if (this.move_movetype == MOVETYPE_NOCLIP)
491 // as if traceline hasn't hit anything
492 trace_endpos = chase_dest;
493 trace_plane_normal = '0 0 0';
497 traceline(v, chase_dest, MOVE_NOMONSTERS, NULL);
499 v.x = 1 * trace_endpos.x + 8 * forward.x + 4 * trace_plane_normal.x;
500 v.y = 1 * trace_endpos.y + 8 * forward.y + 4 * trace_plane_normal.y;
501 v.z = 1 * trace_endpos.z + 8 * forward.z + 4 * trace_plane_normal.z;
503 if(autocvar_chase_front && spectatee_status != -1)
505 // now flip the view so the player is looking at themselves
506 vector newang = vectoangles(forward);
507 view_angles.x = view_angles.x * -1; // inverse up-down looking direction
508 view_angles.y = newang.y;
513 tracebox(v, '-4 -4 -4', '4 4 4', v - v_forward * autocvar_chase_back, MOVE_NORMAL, this);
515 tracebox(v, '-4 -4 -4', '4 4 4', v + v_up * autocvar_chase_up, MOVE_NORMAL, this);
521 void CSQCPlayer_CalcRefdef(entity this)
523 vector vieworg = this.origin;
526 // just update view offset, don't need to do anything else
527 vieworg.z += this.view_ofs.z;
531 vieworg = CSQCPlayer_ApplySmoothing(this, vieworg);
532 if(autocvar_chase_active)
533 vieworg = CSQCPlayer_ApplyChase(this, vieworg);
537 CSQCPlayer_ApplyDeathTilt(this);
538 view_angles = view_angles + view_punchangle;
539 view_angles.z += CSQCPlayer_CalcRoll(this);
540 // TODO? we don't have damage time accessible here
542 vieworg = vieworg + view_punchvector;
543 vieworg = CSQCPlayer_ApplyBobbing(this, vieworg);
545 CSQCPlayer_ApplyIdleScaling(this);
547 setproperty(VF_ORIGIN, vieworg);
548 setproperty(VF_ANGLES, view_angles);
551 /** Called once per CSQC_UpdateView() */
552 void CSQCPlayer_SetCamera()
554 vector v0 = ((intermission && !autocvar_cl_movement_intermissionrunning) ? '0 0 0' : pmove_vel); // TRICK: pmove_vel is set by the engine when we get here. No need to network velocity
555 float vh = PHYS_VIEWHEIGHT(NULL);
556 vector pl_viewofs = PHYS_PL_VIEWOFS(NULL);
557 vector pl_viewofs_crouch = PHYS_PL_CROUCH_VIEWOFS(NULL);
558 entity e = csqcplayer;
561 if (servercommandframe == 0 || clientcommandframe == 0)
563 InterpolateOrigin_Do(e);
564 e.view_ofs = '0 0 1' * vh;
566 // get crouch state from the server
567 if (vh == pl_viewofs.z) e.flags &= ~FL_DUCKED;
568 else if (vh == pl_viewofs_crouch.z) e.flags |= FL_DUCKED;
570 // get onground state from the server
571 e.flags = BITSET(e.flags, FL_ONGROUND, pmove_onground);
573 CSQCPlayer_SetMinsMaxs(e);
575 // override it back just in case
576 e.view_ofs = '0 0 1' * vh;
583 int flg = e.iflags; e.iflags &= ~(IFLAG_ORIGIN | IFLAG_ANGLES);
584 InterpolateOrigin_Do(e);
587 if (csqcplayer_status == CSQCPLAYERSTATUS_FROMSERVER)
590 csqcplayer_status = CSQCPLAYERSTATUS_PREDICTED;
591 CSQCPlayer_PredictTo(e, servercommandframe + 1, false);
592 CSQCPlayer_SetPredictionError(e.origin - o, e.velocity - v0, pmove_onground - IS_ONGROUND(e));
596 // get crouch state from the server
597 if (vh == pl_viewofs.z) e.flags &= ~FL_DUCKED;
598 else if(vh == pl_viewofs_crouch.z) e.flags |= FL_DUCKED;
600 // get onground state from the server
601 e.flags = BITSET(e.flags, FL_ONGROUND, pmove_onground);
603 CSQCPlayer_SavePrediction(e);
605 CSQCPlayer_PredictTo(e, clientcommandframe + 1, true);
607 #ifdef CSQCMODEL_SERVERSIDE_CROUCH
608 // get crouch state from the server (LAG)
609 if (vh == pl_viewofs.z) e.flags &= ~FL_DUCKED;
610 else if (vh == pl_viewofs_crouch.z) e.flags |= FL_DUCKED;
612 CSQCPlayer_SetMinsMaxs(e);
615 e.angles.y = input_angles.y;
619 e.stairsmooth_drawtime = drawtime; // since drawtime is a frame old at this point, copy it now to avoid using a drawtime 2 frames old!
620 e.origin = CSQCModel_ApplyStairSmoothing(e, (e.pmove_flags & PMF_ONGROUND), e.origin);
621 setorigin(e, e.origin);
624 const entity view = CSQCModel_server2csqc(player_localentnum - 1);
627 if (view != csqcplayer)
629 InterpolateOrigin_Do(view);
630 view.view_ofs = '0 0 1' * vh;
632 CSQCPlayer_CalcRefdef(view);
636 // FIXME by CSQC spec we have to do this:
637 // but it breaks chase cam
639 setproperty(VF_ORIGIN, pmove_org + '0 0 1' * vh);
640 setproperty(VF_ANGLES, view_angles);
643 CSQCPLAYER_HOOK_POSTCAMERASETUP();
646 void CSQCPlayer_Remove(entity this)
649 cvar_settemp("cl_movement_replay", "1");
652 bool CSQCPlayer_PreUpdate(entity this)
654 if (this != csqcplayer) return false;
655 if (csqcplayer_status != CSQCPLAYERSTATUS_FROMSERVER) CSQCPlayer_Unpredict(this);
659 bool CSQCPlayer_PostUpdate(entity this)
661 if (this.entnum != player_localnum + 1) return false;
663 csqcplayer_status = CSQCPLAYERSTATUS_FROMSERVER;
664 if (cvar("cl_movement_replay"))
665 cvar_settemp("cl_movement_replay", "0");
666 this.entremove = CSQCPlayer_Remove;