* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
+#if defined(CSQC)
+ #include "../dpdefs/csprogsdefs.qh"
+ #include "../client/defs.qh"
+ #include "../common/constants.qh"
+ #include "../common/stats.qh"
+ #include "../common/util.qh"
+ #include "interpolate.qh"
+ #include "../client/main.qh"
+ #include "common.qh"
+ #include "cl_model.qh"
+ #include "cl_player.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+#endif
-var float autocvar_cl_movement_errorcompensation = 0;
+float autocvar_cl_movement_errorcompensation = 0;
+int autocvar_cl_movement = 1;
// engine stuff
-#define REFDEFFLAG_TELEPORTED 1
-#define REFDEFFLAG_JUMPING 2
float pmove_onground; // weird engine flag we shouldn't really use but have to for now
vector csqcplayer_origin, csqcplayer_velocity;
-float csqcplayer_sequence, player_pmflags;
+float csqcplayer_sequence;
+int player_pmflags;
float csqcplayer_moveframe;
vector csqcplayer_predictionerroro;
vector csqcplayer_predictionerrorv;
self.origin = csqcplayer_origin;
self.velocity = csqcplayer_velocity;
csqcplayer_moveframe = csqcplayer_sequence+1; //+1 because the recieved frame has the move already done (server side)
- self.pmove_flags = player_pmflags;
+ self.flags = player_pmflags;
}
void CSQCPlayer_SetMinsMaxs()
{
- if(self.pmove_flags & PMF_DUCKED)
+ if(self.flags & FL_DUCKED)
{
self.mins = PL_CROUCH_MIN;
self.maxs = PL_CROUCH_MAX;
void CSQCPlayer_SavePrediction()
{
- player_pmflags = self.pmove_flags;
+ player_pmflags = self.flags;
csqcplayer_origin = self.origin;
csqcplayer_velocity = self.velocity;
csqcplayer_sequence = servercommandframe;
csqcplayer_status = CSQCPLAYERSTATUS_PREDICTED;
}
+void CSQC_ClientMovement_PlayerMove_Frame();
+
+void PM_Movement_Move()
+{
+ runstandardplayerphysics(self);
+#ifdef CSQC
+ self.flags =
+ ((self.pmove_flags & PMF_DUCKED) ? FL_DUCKED : 0) |
+ (!(self.pmove_flags & PMF_JUMP_HELD) ? FL_JUMPRELEASED : 0) |
+ ((self.pmove_flags & PMF_ONGROUND) ? FL_ONGROUND : 0);
+#endif
+}
+
+void CSQCPlayer_Physics(void)
+{
+ switch(autocvar_cl_movement)
+ {
+ case 1: CSQC_ClientMovement_PlayerMove_Frame(); break;
+ case 2: PM_Movement_Move(); break;
+ }
+}
+
void CSQCPlayer_PredictTo(float endframe, float apply_error)
{
CSQCPlayer_Unpredict();
{
if (!getinputstate(csqcplayer_moveframe))
break;
- runstandardplayerphysics(self);
+ CSQCPlayer_Physics();
CSQCPlayer_SetMinsMaxs();
csqcplayer_moveframe++;
}
input_angles = view_angles;
}
-float CSQCPlayer_IsLocalPlayer()
+bool CSQCPlayer_IsLocalPlayer()
{
return (self == csqcplayer);
}
-void(entity e, float fl) V_CalcRefdef = #640; // DP_CSQC_V_CALCREFDEF
-
void CSQCPlayer_SetCamera()
{
vector v0;
oldself = self;
self = csqcplayer;
-#ifdef COMPAT_XON050_ENGINE
- if(servercommandframe == 0 || clientcommandframe == 0 || !(checkextension("DP_CSQC_V_CALCREFDEF") || checkextension("DP_CSQC_V_CALCREFDEF_WIP1")))
-#else
if(servercommandframe == 0 || clientcommandframe == 0)
-#endif
{
InterpolateOrigin_Do();
self.view_ofs = '0 0 1' * getstati(STAT_VIEWHEIGHT);
// get crouch state from the server
- if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS_z)
- self.pmove_flags &= ~PMF_DUCKED;
- else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS_z)
- self.pmove_flags |= PMF_DUCKED;
+ if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS.z)
+ self.flags &= ~FL_DUCKED;
+ else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS.z)
+ self.flags |= FL_DUCKED;
// get onground state from the server
if(pmove_onground)
- self.pmove_flags |= PMF_ONGROUND;
+ self.flags |= FL_ONGROUND;
else
- self.pmove_flags &= ~PMF_ONGROUND;
+ self.flags &= ~FL_ONGROUND;
CSQCPlayer_SetMinsMaxs();
o = self.origin;
v = v0;
csqcplayer_status = CSQCPLAYERSTATUS_PREDICTED;
- CSQCPlayer_PredictTo(servercommandframe + 1, FALSE);
- CSQCPlayer_SetPredictionError(self.origin - o, self.velocity - v, pmove_onground - !!(self.pmove_flags & PMF_ONGROUND));
+ CSQCPlayer_PredictTo(servercommandframe + 1, false);
+ CSQCPlayer_SetPredictionError(self.origin - o, self.velocity - v, pmove_onground - !!(self.flags & FL_ONGROUND));
self.origin = o;
self.velocity = v;
// get crouch state from the server
- if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS_z)
- self.pmove_flags &= ~PMF_DUCKED;
- else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS_z)
- self.pmove_flags |= PMF_DUCKED;
+ if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS.z)
+ self.flags &= ~FL_DUCKED;
+ else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS.z)
+ self.flags |= FL_DUCKED;
// get onground state from the server
if(pmove_onground)
- self.pmove_flags |= PMF_ONGROUND;
+ self.flags |= FL_ONGROUND;
else
- self.pmove_flags &= ~PMF_ONGROUND;
+ self.flags &= ~FL_ONGROUND;
CSQCPlayer_SavePrediction();
}
- CSQCPlayer_PredictTo(clientcommandframe + 1, TRUE);
+ CSQCPlayer_PredictTo(clientcommandframe + 1, true);
#ifdef CSQCMODEL_SERVERSIDE_CROUCH
// get crouch state from the server (LAG)
- if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS_z)
- self.pmove_flags &= ~PMF_DUCKED;
- else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS_z)
- self.pmove_flags |= PMF_DUCKED;
+ if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS.z)
+ self.flags &= ~FL_DUCKED;
+ else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS.z)
+ self.flags |= FL_DUCKED;
#endif
CSQCPlayer_SetMinsMaxs();
- self.angles_y = input_angles_y;
+ self.angles_y = input_angles.y;
}
// relink
}
entity view;
-#ifdef COMPAT_XON050_ENGINE
- view = CSQCModel_server2csqc((spectatee_status > 0) ? spectatee_status : player_localentnum);
-#else
view = CSQCModel_server2csqc(player_localentnum);
-#endif
if(view && view != csqcplayer)
{
self = oldself;
}
-#ifdef COMPAT_XON050_ENGINE
- if(view && !(checkextension("DP_CSQC_V_CALCREFDEF") || checkextension("DP_CSQC_V_CALCREFDEF_WIP1")))
- {
- // legacy code, not totally correct, but good enough for not having V_CalcRefdef
- setproperty(VF_ORIGIN, view.origin + '0 0 1' * getstati(STAT_VIEWHEIGHT));
- setproperty(VF_ANGLES, view_angles);
- }
- else
-#endif
if(view)
{
- var float refdefflags = 0;
+ int refdefflags = 0;
if(view.csqcmodel_teleported)
refdefflags |= REFDEFFLAG_TELEPORTED;