]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/csqcmodellib/cl_player.qc
Remove `-Wno-double-declaration`
[xonotic/xonotic-data.pk3dir.git] / qcsrc / csqcmodellib / cl_player.qc
index f77f9512623e099cea3f7f4fecff98e762e5019c..64fe370a2c3cb58b66e4efb74de034bf75f5ac99 100644 (file)
  * IN THE SOFTWARE.
  */
 
-var float autocvar_cl_movement_errorcompensation = 0;
+float autocvar_cl_movement_errorcompensation = 0;
 
 // 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;
@@ -60,13 +58,13 @@ void CSQCPlayer_SetPredictionError(vector o, vector v, float onground_diff)
        // commented out as this one did not help
        if(onground_diff)
        {
-               print(sprintf("ONGROUND MISMATCH: %d x=%v v=%v\n", onground_diff, o, v));
+               printf("ONGROUND MISMATCH: %d x=%v v=%v\n", onground_diff, o, v);
                return;
        }
        */
        if(vlen(o) > 32 || vlen(v) > 192)
        {
-               //print(sprintf("TOO BIG: x=%v v=%v\n", o, v));
+               //printf("TOO BIG: x=%v v=%v\n", o, v);
                return;
        }
 
@@ -169,8 +167,6 @@ float CSQCPlayer_IsLocalPlayer()
        return (self == csqcplayer);
 }
 
-void(entity e, float fl) V_CalcRefdef = #640; // DP_CSQC_V_CALCREFDEF
-
 void CSQCPlayer_SetCamera()
 {
        vector v0;
@@ -182,18 +178,14 @@ void CSQCPlayer_SetCamera()
                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;
+                               self.pmove_flags &= ~PMF_DUCKED;
                        else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS_z)
                                self.pmove_flags |= PMF_DUCKED;
 
@@ -201,7 +193,7 @@ void CSQCPlayer_SetCamera()
                        if(pmove_onground)
                                self.pmove_flags |= PMF_ONGROUND;
                        else
-                               self.pmove_flags &~= PMF_ONGROUND;
+                               self.pmove_flags &= ~PMF_ONGROUND;
 
                        CSQCPlayer_SetMinsMaxs();
 
@@ -213,20 +205,25 @@ void CSQCPlayer_SetCamera()
                }
                else
                {
+                       float flg = self.iflags;
+                       self.iflags &= ~(IFLAG_ORIGIN | IFLAG_ANGLES);
+                       InterpolateOrigin_Do();
+                       self.iflags = flg;
+
                        if(csqcplayer_status == CSQCPLAYERSTATUS_FROMSERVER)
                        {
                                vector o, v;
                                o = self.origin;
                                v = v0;
                                csqcplayer_status = CSQCPLAYERSTATUS_PREDICTED;
-                               CSQCPlayer_PredictTo(servercommandframe + 1, FALSE);
+                               CSQCPlayer_PredictTo(servercommandframe + 1, false);
                                CSQCPlayer_SetPredictionError(self.origin - o, self.velocity - v, pmove_onground - !!(self.pmove_flags & PMF_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;
+                                       self.pmove_flags &= ~PMF_DUCKED;
                                else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS_z)
                                        self.pmove_flags |= PMF_DUCKED;
 
@@ -234,23 +231,23 @@ void CSQCPlayer_SetCamera()
                                if(pmove_onground)
                                        self.pmove_flags |= PMF_ONGROUND;
                                else
-                                       self.pmove_flags &~= PMF_ONGROUND;
+                                       self.pmove_flags &= ~PMF_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;
+                               self.pmove_flags &= ~PMF_DUCKED;
                        else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS_z)
                                self.pmove_flags |= PMF_DUCKED;
 #endif
 
                        CSQCPlayer_SetMinsMaxs();
 
-                       self.angles_y = input_angles_y;
+                       self.angles_y = input_angles.y;
                }
 
                // relink
@@ -260,11 +257,7 @@ void CSQCPlayer_SetCamera()
        }
 
        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)
        {
@@ -275,18 +268,9 @@ void CSQCPlayer_SetCamera()
                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;