]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Turn the global hitbox/view offset cvars into stats (sv_ cvars shouldn't be used...
authorMario <zacjardine@y7mail.com>
Mon, 20 Apr 2015 07:31:37 +0000 (17:31 +1000)
committerMario <zacjardine@y7mail.com>
Mon, 20 Apr 2015 07:31:37 +0000 (17:31 +1000)
16 files changed:
qcsrc/common/constants.qh
qcsrc/common/physics.qc
qcsrc/common/physics.qh
qcsrc/common/stats.qh
qcsrc/common/triggers/trigger/jumppads.qc
qcsrc/common/weapons/w_porto.qc
qcsrc/csqcmodellib/cl_player.qc
qcsrc/server/autocvars.qh
qcsrc/server/bot/havocbot/havocbot.qc
qcsrc/server/bot/navigation.qc
qcsrc/server/bot/waypoints.qc
qcsrc/server/cl_client.qc
qcsrc/server/mutators/gamemode_ctf.qh
qcsrc/server/mutators/gamemode_keyhunt.qh
qcsrc/server/mutators/gamemode_onslaught.qh
qcsrc/server/portals.qc

index 6553d4cb4596351583807ac9dde98f0e476f6246..9c6c13d2d71b89d315e9052065362361139a42ff 100644 (file)
@@ -328,6 +328,8 @@ vector autocvar_sv_player_crouch_mins = '-16 -16 -24';
 vector autocvar_sv_player_crouch_viewoffset = '0 0 20';
 vector autocvar_sv_player_headsize = '24 24 12';
 
+
+#ifdef SVQC
 #define PL_VIEW_OFS autocvar_sv_player_viewoffset
 #define PL_MIN autocvar_sv_player_mins
 #define PL_MAX autocvar_sv_player_maxs
@@ -335,16 +337,14 @@ vector autocvar_sv_player_headsize = '24 24 12';
 #define PL_CROUCH_MIN autocvar_sv_player_crouch_mins
 #define PL_CROUCH_MAX autocvar_sv_player_crouch_maxs
 #define PL_HEAD autocvar_sv_player_headsize
-
-// helpers
-#define PL_VIEW_OFS_z autocvar_sv_player_viewoffset.z
-#define PL_MIN_z autocvar_sv_player_mins.z
-#define PL_MAX_z autocvar_sv_player_maxs.z
-#define PL_CROUCH_VIEW_OFS_z autocvar_sv_player_crouch_viewoffset.z
-#define PL_CROUCH_MIN_z autocvar_sv_player_mins.z
-#define PL_HEAD_x autocvar_sv_player_headsize.x
-#define PL_HEAD_y autocvar_sv_player_headsize.y
-#define PL_HEAD_z autocvar_sv_player_headsize.z
+#elif defined(CSQC)
+#define PL_VIEW_OFS vec3(getstatf(STAT_PL_VIEW_OFS1), getstatf(STAT_PL_VIEW_OFS2), getstatf(STAT_PL_VIEW_OFS3))
+#define PL_MIN vec3(getstatf(STAT_PL_MIN1), getstatf(STAT_PL_MIN2), getstatf(STAT_PL_MIN3))
+#define PL_MAX vec3(getstatf(STAT_PL_MAX1), getstatf(STAT_PL_MAX2), getstatf(STAT_PL_MAX3))
+#define PL_CROUCH_VIEW_OFS vec3(getstatf(STAT_PL_CROUCH_VIEW_OFS1), getstatf(STAT_PL_CROUCH_VIEW_OFS2), getstatf(STAT_PL_CROUCH_VIEW_OFS3))
+#define PL_CROUCH_MIN vec3(getstatf(STAT_PL_CROUCH_MIN1), getstatf(STAT_PL_CROUCH_MIN2), getstatf(STAT_PL_CROUCH_MIN3))
+#define PL_CROUCH_MAX vec3(getstatf(STAT_PL_CROUCH_MAX1), getstatf(STAT_PL_CROUCH_MAX2), getstatf(STAT_PL_CROUCH_MAX3))
+#endif
 
 // spawnpoint prios
 const int SPAWN_PRIO_NEAR_TEAMMATE_FOUND = 200;
index 18126aaa92fef4b4d81d2f50ba01e5d02bf22161..442a9939b8e75f98d54dea33c854175016bc473b 100644 (file)
@@ -27,6 +27,28 @@ float Physics_ClientOption(entity pl, string option)
 
 void Physics_AddStats()
 {
+       // static view offset and hitbox vectors
+       // networked for all you bandwidth pigs out there
+       addstat(STAT_PL_VIEW_OFS1, AS_FLOAT, stat_pl_view_ofs_x);
+       addstat(STAT_PL_VIEW_OFS2, AS_FLOAT, stat_pl_view_ofs_y);
+       addstat(STAT_PL_VIEW_OFS3, AS_FLOAT, stat_pl_view_ofs_z);
+       addstat(STAT_PL_CROUCH_VIEW_OFS1, AS_FLOAT, stat_pl_crouch_view_ofs_x);
+       addstat(STAT_PL_CROUCH_VIEW_OFS2, AS_FLOAT, stat_pl_crouch_view_ofs_y);
+       addstat(STAT_PL_CROUCH_VIEW_OFS3, AS_FLOAT, stat_pl_crouch_view_ofs_z);
+
+       addstat(STAT_PL_MIN1, AS_FLOAT, stat_pl_min_x);
+       addstat(STAT_PL_MIN2, AS_FLOAT, stat_pl_min_y);
+       addstat(STAT_PL_MIN3, AS_FLOAT, stat_pl_min_z);
+       addstat(STAT_PL_MAX1, AS_FLOAT, stat_pl_max_x);
+       addstat(STAT_PL_MAX2, AS_FLOAT, stat_pl_max_y);
+       addstat(STAT_PL_MAX3, AS_FLOAT, stat_pl_max_z);
+       addstat(STAT_PL_CROUCH_MIN1, AS_FLOAT, stat_pl_crouch_min_x);
+       addstat(STAT_PL_CROUCH_MIN2, AS_FLOAT, stat_pl_crouch_min_y);
+       addstat(STAT_PL_CROUCH_MIN3, AS_FLOAT, stat_pl_crouch_min_z);
+       addstat(STAT_PL_CROUCH_MAX1, AS_FLOAT, stat_pl_crouch_max_x);
+       addstat(STAT_PL_CROUCH_MAX2, AS_FLOAT, stat_pl_crouch_max_y);
+       addstat(STAT_PL_CROUCH_MAX3, AS_FLOAT, stat_pl_crouch_max_z);
+
        // g_movementspeed hack
        addstat(STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW, AS_FLOAT, stat_sv_airspeedlimit_nonqw);
        addstat(STAT_MOVEVARS_MAXSPEED, AS_FLOAT, stat_sv_maxspeed);
@@ -85,6 +107,16 @@ void Physics_AddStats()
 
 void Physics_UpdateStats(float maxspd_mod)
 {
+       // blah
+       self.stat_pl_view_ofs = PL_VIEW_OFS;
+       self.stat_pl_crouch_view_ofs = PL_CROUCH_VIEW_OFS;
+
+       self.stat_pl_min = PL_MIN;
+       self.stat_pl_max = PL_MAX;
+       self.stat_pl_crouch_min = PL_CROUCH_MIN;
+       self.stat_pl_crouch_max = PL_CROUCH_MAX;
+
+
        self.stat_sv_airaccel_qw = AdjustAirAccelQW(Physics_ClientOption(self, "airaccel_qw"), maxspd_mod);
        if(Physics_ClientOption(self, "airstrafeaccel_qw"))
                self.stat_sv_airstrafeaccel_qw = AdjustAirAccelQW(Physics_ClientOption(self, "airstrafeaccel_qw"), maxspd_mod);
index 0544d53ae089b4a65874f83e1b92d81f70d29d4a..d8c4d870c847de1ab0433e4232eee70656ded553 100644 (file)
@@ -175,6 +175,14 @@ bool IsFlying(entity a);
 
        .float discomode;
 
+       .vector stat_pl_view_ofs;
+       .vector stat_pl_crouch_view_ofs;
+
+       .vector stat_pl_min;
+       .vector stat_pl_max;
+       .vector stat_pl_crouch_min;
+       .vector stat_pl_crouch_max;
+
        .float stat_sv_airaccel_qw;
        .float stat_sv_airstrafeaccel_qw;
        .float stat_sv_airspeedlimit_nonqw;
index edbe4ecde399b6bb85f61761a6971e32fc800be1..f5f987fe348b107b3c4bebf5e8dc55712256189b 100644 (file)
@@ -132,24 +132,24 @@ const int STAT_VIP_PINK               = 104;
 
 /* Gamemode-specific stats end here */
 
-// 105 empty?
-// 106 empty?
-// 107 empty?
-// 108 empty?
-// 109 empty?
-// 110 empty?
-// 111 empty?
-// 112 empty?
-// 113 empty?
-// 114 empty?
-// 115 empty?
-// 116 empty?
-// 117 empty?
-// 118 empty?
-// 119 empty?
-// 120 empty?
-// 121 empty?
-// 122 empty?
+const int STAT_PL_VIEW_OFS1           = 105;
+const int STAT_PL_VIEW_OFS2           = 106;
+const int STAT_PL_VIEW_OFS3           = 107;
+const int STAT_PL_MIN1                = 108;
+const int STAT_PL_MIN2                = 109;
+const int STAT_PL_MIN3                = 110;
+const int STAT_PL_MAX1                = 111;
+const int STAT_PL_MAX2                = 112;
+const int STAT_PL_MAX3                = 113;
+const int STAT_PL_CROUCH_MIN1         = 114;
+const int STAT_PL_CROUCH_MIN2         = 115;
+const int STAT_PL_CROUCH_MIN3         = 116;
+const int STAT_PL_CROUCH_MAX1         = 117;
+const int STAT_PL_CROUCH_MAX2         = 118;
+const int STAT_PL_CROUCH_MAX3         = 119;
+const int STAT_PL_CROUCH_VIEW_OFS1    = 117;
+const int STAT_PL_CROUCH_VIEW_OFS2    = 118;
+const int STAT_PL_CROUCH_VIEW_OFS3    = 119;
 // 123 empty?
 // 124 empty?
 // 125 empty?
index 5095e015ae4cc5b7279e64a89039bab9bfb10f1c..9ba5f4a12af5bc805e46f12435ad65dbd09f9f9a 100644 (file)
@@ -263,7 +263,7 @@ void trigger_push_findtarget()
 
        // first calculate a typical start point for the jump
        org = (self.absmin + self.absmax) * 0.5;
-       org_z = self.absmax.z - PL_MIN_z;
+       org_z = self.absmax.z - PL_MIN.z;
 
        if (self.target)
        {
index 06a53b34654dab247806f56e5df7e4d2aa688e67..2bb0cc2d135ad0881c0facb6dc06b4016ed385b7 100644 (file)
@@ -125,7 +125,7 @@ void W_Porto_Touch(void)
        norm = trace_plane_normal;
        if(trace_ent.iscreature)
        {
-               traceline(trace_ent.origin, trace_ent.origin + '0 0 2' * PL_MIN_z, MOVE_WORLDONLY, self);
+               traceline(trace_ent.origin, trace_ent.origin + '0 0 2' * PL_MIN.z, MOVE_WORLDONLY, self);
                if(trace_fraction >= 1)
                        return;
                if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK || trace_dphitcontents & DPCONTENTS_PLAYERCLIP)
index e3717d275b9e11839d978c4acf04b95671598d5c..b659f6f7dfef129c6a84d35ff862628ccccc9c19 100644 (file)
@@ -220,9 +220,9 @@ void CSQCPlayer_SetCamera()
                        self.view_ofs = '0 0 1' * getstati(STAT_VIEWHEIGHT);
 
                        // get crouch state from the server
-                       if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS_z)
+                       if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS.z)
                                self.flags &= ~FL_DUCKED;
-                       else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS_z)
+                       else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS.z)
                                self.flags |= FL_DUCKED;
 
                        // get onground state from the server
@@ -258,9 +258,9 @@ void CSQCPlayer_SetCamera()
                                self.velocity = v;
 
                                // get crouch state from the server
-                               if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS_z)
+                               if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS.z)
                                        self.flags &= ~FL_DUCKED;
-                               else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS_z)
+                               else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS.z)
                                        self.flags |= FL_DUCKED;
 
                                // get onground state from the server
@@ -276,9 +276,9 @@ void CSQCPlayer_SetCamera()
 //#ifdef CSQCMODEL_SERVERSIDE_CROUCH
                        // get crouch state from the server (LAG)
                        if(!autocvar_cl_crouch)
-                       if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS_z)
+                       if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS.z)
                                self.flags &= ~FL_DUCKED;
-                       else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS_z)
+                       else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS.z)
                                self.flags |= FL_DUCKED;
 //#endif
 
index d545963cf20250c192ce3e80e64405be83132ba1..1535cf6b68f4646ad552f989c8e515fef41dd684 100644 (file)
@@ -1084,4 +1084,5 @@ string autocvar_g_itemeditor_storage_name = "default";
 string autocvar_sv_weapons_modeloverride;
 string autocvar_sv_weapons_sounddir;
 string autocvar_sv_items_modeloverride;
+float autocvar_sv_player_scale;
 #endif
index ba1055facc1506966c46a5c126943c63f1cef5ae..90c57e8143ba4e4c7546f2d2f0bbea51731fa56e 100644 (file)
@@ -469,7 +469,7 @@ void havocbot_movetogoal()
 
                // Flying
                self.BUTTON_HOOK = true;
-               if(self.navigation_jetpack_point.z - PL_MAX_z + PL_MIN_z < self.origin.z)
+               if(self.navigation_jetpack_point.z - PL_MAX.z + PL_MIN.z < self.origin.z)
                {
                        self.movement_x = dir * v_forward * maxspeed;
                        self.movement_y = dir * v_right * maxspeed;
index d80f8336c8ba179bd52e862bc2807181d92efebc..67353587b18aaa8684f47affac322624adfda21a 100644 (file)
@@ -387,7 +387,7 @@ entity navigation_findnearestwaypoint_withdist_except(entity ent, float walkfrom
        }
 
        org = ent.origin + 0.5 * (ent.mins + ent.maxs);
-       org.z = ent.origin.z + ent.mins.z - PL_MIN_z; // player height
+       org.z = ent.origin.z + ent.mins.z - PL_MIN.z; // player height
        // TODO possibly make other code have the same support for bboxes
        if(ent.tag_entity)
                org = org + ent.tag_entity.origin;
@@ -710,7 +710,7 @@ void navigation_routerating(entity e, float f, float rangebias)
                        float zdistance, xydistance, cost, t, fuel;
                        vector down, npa, npb;
 
-                       down = '0 0 -1' * (PL_MAX_z - PL_MIN_z) * 10;
+                       down = '0 0 -1' * (PL_MAX.z - PL_MIN.z) * 10;
 
                        do{
                                npa = pointa + down;
index 23e7af3f9242061e5ffeadd5a0d0d924c569052d..4877e98b347afca050357cacd67f8085a96dfd72 100644 (file)
@@ -196,7 +196,7 @@ void waypoint_think()
                        navigation_testtracewalk = 0;
                        if (!self.wpisbox)
                        {
-                               tracebox(sv - PL_MIN_z * '0 0 1', PL_MIN, PL_MAX, sv, false, self);
+                               tracebox(sv - PL_MIN.z * '0 0 1', PL_MIN, PL_MAX, sv, false, self);
                                if (!trace_startsolid)
                                {
                                        //dprint("sv deviation", vtos(trace_endpos - sv), "\n");
@@ -205,7 +205,7 @@ void waypoint_think()
                        }
                        if (!e.wpisbox)
                        {
-                               tracebox(ev - PL_MIN_z * '0 0 1', PL_MIN, PL_MAX, ev, false, e);
+                               tracebox(ev - PL_MIN.z * '0 0 1', PL_MIN, PL_MAX, ev, false, e);
                                if (!trace_startsolid)
                                {
                                        //dprint("ev deviation", vtos(trace_endpos - ev), "\n");
@@ -719,7 +719,7 @@ float waypoint_loadall()
 
 vector waypoint_fixorigin(vector position)
 {
-       tracebox(position + '0 0 1' * (1 - PL_MIN_z), PL_MIN, PL_MAX, position + '0 0 -512', MOVE_NOMONSTERS, world);
+       tracebox(position + '0 0 1' * (1 - PL_MIN.z), PL_MIN, PL_MAX, position + '0 0 -512', MOVE_NOMONSTERS, world);
        if(trace_fraction < 1)
                position = trace_endpos;
        //traceline(position, position + '0 0 -512', MOVE_NOMONSTERS, world);
index 6c1cd6b47f48fa783e8b8929546316a45e30ba4f..2e87836ed054a480fa4a31890a0da89fa6130538 100644 (file)
@@ -688,7 +688,7 @@ void PutClientInServer (void)
                self.respawn_flags = 0;
                self.respawn_time = 0;
                self.stat_respawn_time = 0;
-               self.scale = 0;
+               self.scale = autocvar_sv_player_scale;
                self.fade_time = 0;
                self.pain_frame = 0;
                self.pain_finished = 0;
index 450e83721a16a257a6a087639e15f20023091dd0..93d976cef69453912285e63f366557bc9c820fd6 100644 (file)
@@ -27,7 +27,7 @@ const float WPFE_THINKRATE = 0.5;
 
 const vector FLAG_DROP_OFFSET = ('0 0 32');
 const vector FLAG_CARRY_OFFSET = ('-16 0 8');
-#define FLAG_SPAWN_OFFSET ('0 0 1' * (PL_MAX_z - 13))
+#define FLAG_SPAWN_OFFSET ('0 0 1' * (PL_MAX.z - 13))
 const vector FLAG_WAYPOINT_OFFSET = ('0 0 64');
 const vector FLAG_FLOAT_OFFSET = ('0 0 32');
 const vector FLAG_PASS_ARC_OFFSET = ('0 0 -10');
index 33b70a2c81f897376be1b0b0a453f547634a2b51..6c0c684a2e470a0de07e46f747b57b44967fb399 100644 (file)
@@ -31,7 +31,7 @@ const float KEY_TOUCHRATE = 0.5;
 
 const vector KEY_DROP_OFFSET = ('0 0 16');
 const vector KEY_CARRY_OFFSET = ('-16 0 8');
-#define KEY_SPAWN_OFFSET ('0 0 1' * (PL_MAX_z - 13))
+#define KEY_SPAWN_OFFSET ('0 0 1' * (PL_MAX.z - 13))
 const vector KEY_WAYPOINT_OFFSET = ('0 0 64');
 const vector KEY_FLOAT_OFFSET = ('0 0 16');
 const vector KEY_PASS_ARC_OFFSET = ('0 0 -10');
index 58afe0a8cd0e5139ed6bec615a0f2e5bd2201b83..2eab141b30362dc1ffcf8095ba60a992a303ff10 100644 (file)
@@ -7,7 +7,7 @@
 // control point / generator constants
 #define ONS_CP_THINKRATE 0.2
 #define GEN_THINKRATE 1
-#define CPGEN_SPAWN_OFFSET ('0 0 1' * (PL_MAX_z - 13))
+#define CPGEN_SPAWN_OFFSET ('0 0 1' * (PL_MAX.z - 13))
 #define CPGEN_WAYPOINT_OFFSET ('0 0 128')
 #define CPICON_OFFSET ('0 0 96')
 
index e6e606f5f909a7d680c2a421a3cf9f5dadfc542b..9ce48d8e37d315b5b1d870909aa91f1d7564c237 100644 (file)
@@ -315,8 +315,8 @@ void Portal_Touch()
                return;
 
        /*
-       if(other.mins_x < PL_MIN_x || other.mins_y < PL_MIN_y || other.mins_z < PL_MIN_z
-       || other.maxs_x > PL_MAX_x || other.maxs_y > PL_MAX_y || other.maxs_z > PL_MAX_z)
+       if(other.mins_x < PL_MIN.x || other.mins_y < PL_MIN.y || other.mins_z < PL_MIN.z
+       || other.maxs_x > PL_MAX.x || other.maxs_y > PL_MAX.y || other.maxs_z > PL_MAX.z)
        {
                // can't teleport this
                return;