]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Hack around some more includes in csqcmodel lib (effectively self contained now)
authorMario <mario@smbclan.net>
Wed, 28 Jun 2017 09:44:50 +0000 (19:44 +1000)
committerMario <mario@smbclan.net>
Wed, 28 Jun 2017 09:44:50 +0000 (19:44 +1000)
qcsrc/common/csqcmodel_settings.qh
qcsrc/common/physics/player.qh
qcsrc/lib/csqcmodel/cl_model.qc
qcsrc/lib/csqcmodel/cl_player.qc

index c95bd62ae956831253121d0c977fcd4693431d6a..9e96756ba52de4feb7709164226599e2a8d1632f 100644 (file)
@@ -68,7 +68,7 @@
 
 // add hook function calls here
 #define CSQCPLAYER_HOOK_POSTCAMERASETUP() \
-       CSQCPlayer_SetViewLocation()
+       viewloc_SetViewLocation()
 
 // force updates of player entities this frequently (per second) even if unchanged
 #ifndef CSQCPLAYER_FORCE_UPDATES
index 0a9008b4eb5bfed26b3ba3be9929301d8896327b..7c093c15d81eb061ac95ae6089c1ece0748c67b9 100644 (file)
@@ -29,6 +29,17 @@ float AdjustAirAccelQW(float accelqw, float factor);
 
 bool IsFlying(entity a);
 
+#define PHYS_PL_MAX(s)                                         STAT(PL_MAX, s)
+#define PHYS_PL_MIN(s)                                         STAT(PL_MIN, s)
+#define PHYS_PL_CROUCH_MAX(s)                          STAT(PL_CROUCH_MAX, s)
+#define PHYS_PL_CROUCH_MIN(s)                          STAT(PL_CROUCH_MIN, s)
+
+#define PHYS_PL_VIEWOFS(s)                                     STAT(PL_VIEW_OFS, s)
+#define PHYS_PL_CROUCH_VIEWOFS(s)                      STAT(PL_CROUCH_VIEW_OFS, s)
+
+#define PHYS_VIEWHEIGHT(s)                                     STAT(VIEWHEIGHT, s)
+#define PHYS_HEALTH(s)                                         STAT(HEALTH, s)
+
 #define BUFFS_STAT(s)                       STAT(BUFFS, s)
 
 #define PHYS_ACCELERATE(s)                  STAT(MOVEVARS_ACCELERATE, s)
index e4e1d536aa85eb84175ec0e3350d3f14678f86ba..05aba388c4b7c27a49d13cdb160a75afc559a43b 100644 (file)
 #include "cl_player.qh"
 #include "common.qh"
 #include "interpolate.qh"
-#include <client/defs.qh>
-#include <common/animdecide.qh>
 #include <common/csqcmodel_settings.qh>
-#include <common/util.qh>
 
 float autocvar_cl_lerpanim_maxdelta_framegroups = 0.1;
 float autocvar_cl_nolerp = 0;
index 9e26e70fb7424ff07d3fbf79747bffe218c1dd4f..faefdcad4316b6dc4a034432aba9e811eebf9526 100644 (file)
 #include "cl_model.qh"
 #include "common.qh"
 #include "interpolate.qh"
-#include <client/defs.qh>
-#include <client/main.qh>
-#include <common/constants.qh>
-#include <common/net_linked.qh>
-#include <common/physics/player.qh>
-#include <common/stats.qh>
-#include <common/triggers/trigger/viewloc.qh>
-#include <common/util.qh>
-#include <common/viewloc.qh>
 
 float autocvar_cl_movement_errorcompensation = 0;
 bool autocvar_cl_movement_intermissionrunning = false;
@@ -109,15 +100,15 @@ void CSQCPlayer_SetMinsMaxs(entity this)
 {
        if (IS_DUCKED(this) || !this.isplayermodel)
        {
-               this.mins = STAT(PL_CROUCH_MIN, this);
-               this.maxs = STAT(PL_CROUCH_MAX, this);
-               this.view_ofs = STAT(PL_CROUCH_VIEW_OFS, this);
+               this.mins = PHYS_PL_CROUCH_MIN(this);
+               this.maxs = PHYS_PL_CROUCH_MAX(this);
+               this.view_ofs = PHYS_PL_CROUCH_VIEWOFS(this);
        }
        else
        {
-               this.mins = STAT(PL_MIN, this);
-               this.maxs = STAT(PL_MAX, this);
-               this.view_ofs = STAT(PL_VIEW_OFS, this);
+               this.mins = PHYS_PL_MIN(this);
+               this.maxs = PHYS_PL_MAX(this);
+               this.view_ofs = PHYS_PL_VIEWOFS(this);
        }
 }
 
@@ -216,18 +207,13 @@ bool CSQCPlayer_IsLocalPlayer(entity this)
        return (this == csqcplayer);
 }
 
-void CSQCPlayer_SetViewLocation()
-{
-       viewloc_SetViewLocation();
-}
-
 /** Called once per CSQC_UpdateView() */
 void CSQCPlayer_SetCamera()
 {
        const 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
-       const float vh = STAT(VIEWHEIGHT);
-       const vector pl_viewofs = STAT(PL_VIEW_OFS);
-       const vector pl_viewofs_crouch = STAT(PL_CROUCH_VIEW_OFS);
+       const float vh = PHYS_VIEWHEIGHT(NULL);
+       const vector pl_viewofs = PHYS_PL_VIEWOFS(NULL);
+       const vector pl_viewofs_crouch = PHYS_PL_CROUCH_VIEWOFS(NULL);
        const entity e = csqcplayer;
        if (e)
        {
@@ -303,7 +289,7 @@ void CSQCPlayer_SetCamera()
                if (view.csqcmodel_teleported) refdefflags |= REFDEFFLAG_TELEPORTED;
                if (input_buttons & BIT(1)) refdefflags |= REFDEFFLAG_JUMPING;
                // note: these two only work in WIP2, but are harmless in WIP1
-               if (STAT(HEALTH) <= 0 && STAT(HEALTH) != -666 && STAT(HEALTH) != -2342) refdefflags |= REFDEFFLAG_DEAD;
+               if (PHYS_HEALTH(NULL) <= 0 && PHYS_HEALTH(NULL) != -666 && PHYS_HEALTH(NULL) != -2342) refdefflags |= REFDEFFLAG_DEAD;
                if (intermission) refdefflags |= REFDEFFLAG_INTERMISSION;
                V_CalcRefdef(view, refdefflags);
        }