csqcplayer_status = CSQCPLAYERSTATUS_PREDICTED;
+ // FIXME do we really NEED this? dead players have servercommandframe
+ // == 0 and thus won't predict
if (getstatf(STAT_HEALTH) <= 0)
{
csqcplayer_moveframe = clientcommandframe;
return;
}
- while(csqcplayer_moveframe < endframe)
+ if(csqcplayer_moveframe >= endframe)
{
- if (!getinputstate(csqcplayer_moveframe))
+ getinputstate(csqcplayer_moveframe - 1);
+ }
+ else
+ {
+ do
{
- break;
+ if (!getinputstate(csqcplayer_moveframe))
+ break;
+ runstandardplayerphysics(self);
+ CSQCPlayer_SetMinsMaxs();
+ csqcplayer_moveframe++;
}
- runstandardplayerphysics(self);
- CSQCPlayer_SetMinsMaxs();
- csqcplayer_moveframe++;
+ while(csqcplayer_moveframe < endframe);
}
//add in anything that was applied after (for low packet rate protocols)
void CSQCPlayer_SetCamera()
{
+ vector v0;
+ v0 = pmove_vel; // TRICK: pmove_vel is set by the engine when we get here. No need to network velocity
+
if(csqcplayer)
{
entity oldself;
// override it back just in case
self.view_ofs = '0 0 1' * getstati(STAT_VIEWHEIGHT);
+
+ // set velocity
+ self.velocity = v0;
}
else
{
{
vector o, v;
o = self.origin;
- v = pmove_vel; // TRICK: pmove_vel is set by the engine when we get here. No need to network velocity
csqcplayer_status = CSQCPLAYERSTATUS_PREDICTED;
CSQCPlayer_PredictTo(servercommandframe + 1);
CSQCPlayer_SetPredictionError(o - self.origin);
self.origin = o;
- self.velocity = v;
+ self.velocity = v0;
// get crouch state from the server
if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS_z)
view = CSQCModel_server2csqc(player_localentnum);
#endif
- if(view != csqcplayer)
+ if(view && view != csqcplayer)
{
entity oldself = self;
self = view;
if(input_buttons & 4)
refdefflags |= REFDEFFLAG_JUMPING;
+ // note: these two only work in WIP2, but are harmless in WIP1
+ if(getstati(STAT_HEALTH) <= 0)
+ refdefflags |= REFDEFFLAG_DEAD;
+
+ if(intermission)
+ refdefflags |= REFDEFFLAG_INTERMISSION;
+
+ // FIXME this is a stupid hack and is only there because
+ // bobfall got unreliable otherwise (it restores the old
+ // behaviour); need to find out why
+ vector vsave = view.velocity;
+ view.velocity = v0;
+
V_CalcRefdef(view, refdefflags);
+
+ view.velocity = vsave;
}
else
{