]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/csqcmodellib/cl_player.qc
Merge branch 'TimePath/global_self' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / csqcmodellib / cl_player.qc
index ee0340dd5dd6629a504d53e42ad6e3248da65a7b..1a96e23dd6d6c0e1fbe77ff4744e541fa3b4ffbf 100644 (file)
@@ -24,7 +24,6 @@
        #include "../dpdefs/csprogsdefs.qh"
        #include "../client/defs.qh"
        #include "../common/constants.qh"
-       #include "../common/p2mathlib.qh"
        #include "../common/stats.qh"
        #include "../common/util.qh"
        #include "interpolate.qh"
@@ -101,7 +100,7 @@ void CSQCPlayer_SetPredictionError(vector o, vector v, float onground_diff)
 }
 
 void CSQCPlayer_Unpredict()
-{
+{SELFPARAM();
        if(csqcplayer_status == CSQCPLAYERSTATUS_UNPREDICTED)
                return;
        if(csqcplayer_status != CSQCPLAYERSTATUS_PREDICTED)
@@ -113,7 +112,7 @@ void CSQCPlayer_Unpredict()
 }
 
 void CSQCPlayer_SetMinsMaxs()
-{
+{SELFPARAM();
        if(self.flags & FL_DUCKED)
        {
                self.mins = PL_CROUCH_MIN;
@@ -129,7 +128,7 @@ void CSQCPlayer_SetMinsMaxs()
 }
 
 void CSQCPlayer_SavePrediction()
-{
+{SELFPARAM();
        player_pmflags = self.flags;
        csqcplayer_origin = self.origin;
        csqcplayer_velocity = self.velocity;
@@ -140,10 +139,10 @@ void CSQCPlayer_SavePrediction()
 void CSQC_ClientMovement_PlayerMove_Frame();
 
 void PM_Movement_Move()
-{
+{SELFPARAM();
        runstandardplayerphysics(self);
 #ifdef CSQC
-       self.flags = 
+       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);
@@ -160,7 +159,7 @@ void CSQCPlayer_Physics(void)
 }
 
 void CSQCPlayer_PredictTo(float endframe, float apply_error)
-{
+{SELFPARAM();
        CSQCPlayer_Unpredict();
        if(apply_error)
        {
@@ -178,7 +177,7 @@ void CSQCPlayer_PredictTo(float endframe, float apply_error)
        {
                csqcplayer_moveframe = clientcommandframe;
                getinputstate(csqcplayer_moveframe-1);
-               print("the Weird code path got hit\n");
+               LOG_INFO("the Weird code path got hit\n");
                return;
        }
 #endif
@@ -205,7 +204,7 @@ void CSQCPlayer_PredictTo(float endframe, float apply_error)
 }
 
 bool CSQCPlayer_IsLocalPlayer()
-{
+{SELFPARAM();
        return (self == csqcplayer);
 }
 
@@ -215,15 +214,13 @@ void CSQCPlayer_SetViewLocation()
 }
 
 void CSQCPlayer_SetCamera()
-{
+{SELFPARAM();
        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;
-               oldself = self;
-               self = csqcplayer;
+               setself(csqcplayer);
 
                if(servercommandframe == 0 || clientcommandframe == 0)
                {
@@ -300,19 +297,15 @@ void CSQCPlayer_SetCamera()
                // relink
                setorigin(self, self.origin);
 
-               self = oldself;
+               setself(this);
        }
 
-       entity view;
-       view = CSQCModel_server2csqc(player_localentnum);
+       entity view = CSQCModel_server2csqc(player_localentnum);
 
        if(view && view != csqcplayer)
        {
-               entity oldself = self;
-               self = view;
-               InterpolateOrigin_Do();
-               self.view_ofs = '0 0 1' * getstati(STAT_VIEWHEIGHT);
-               self = oldself;
+               WITH(entity, self, view, InterpolateOrigin_Do());
+               view.view_ofs = '0 0 1' * getstati(STAT_VIEWHEIGHT);
        }
 
        if(view)
@@ -354,7 +347,7 @@ void CSQCPlayer_Remove()
 }
 
 float CSQCPlayer_PreUpdate()
-{
+{SELFPARAM();
        if(self != csqcplayer)
                return 0;
        if(csqcplayer_status != CSQCPLAYERSTATUS_FROMSERVER)
@@ -363,7 +356,7 @@ float CSQCPlayer_PreUpdate()
 }
 
 float CSQCPlayer_PostUpdate()
-{
+{SELFPARAM();
        if(self.entnum != player_localnum + 1)
                return 0;
        csqcplayer = self;