]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
cl_gunalign: stat. Fixes #1607
authorTimePath <andrew.hardaker1995@gmail.com>
Thu, 17 Dec 2015 22:27:15 +0000 (09:27 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Thu, 17 Dec 2015 22:27:15 +0000 (09:27 +1100)
qcsrc/client/autocvars.qh
qcsrc/common/stats.qh
qcsrc/common/weapons/all.qc
qcsrc/common/weapons/calculations.qc
qcsrc/server/defs.qh
qcsrc/server/miscfunctions.qc

index 4697319d154e31fa392500aad1bbfa0167edb6b8..49cafb896a18fcc122d751fdcda6180c657ff802 100644 (file)
@@ -53,7 +53,6 @@ float autocvar_cl_gibs_velocity_random = 1;
 float autocvar_cl_gibs_velocity_scale = 1;
 float autocvar_cl_gibs_avelocity_scale = 1;
 float autocvar_cl_gibs_velocity_up;
-int autocvar_cl_gunalign;
 bool autocvar_cl_hidewaypoints;
 bool autocvar_cl_lockview;
 bool autocvar_cl_nogibs;
index 30044286653dd65789ffbe41b2c86bb70bc675f0..fc82c13208e7b053baf27b1c661af64b57ae2101 100644 (file)
@@ -292,4 +292,19 @@ REGISTER_STAT(MOVEVARS_MAXAIRSPEED, float)
 REGISTER_STAT(MOVEVARS_STEPHEIGHT, float, autocvar_sv_stepheight)
 REGISTER_STAT(MOVEVARS_AIRACCEL_QW, float)
 REGISTER_STAT(MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION, float)
+
+
+#ifdef CSQC
+noref int autocvar_cl_gunalign;
+#endif
+#ifdef SVQC
+.int cvar_cl_gunalign;
+REPLICATE(cvar_cl_gunalign, int, "cl_gunalign");
+#endif
+REGISTER_STAT(GUNALIGN, int, this.cvar_cl_gunalign)
+#ifdef SVQC
+SPECTATE_COPY(_STAT(GUNALIGN))
+#endif
+
+
 #endif
index b18d6991a8a80c1c7980f6331d7bbd52801aff3d..7d107fd61d5a34d345541cb1697e12dd0e3ca30d 100644 (file)
@@ -517,11 +517,7 @@ void CL_WeaponEntity_SetModel(entity this, string name)
 
        if (this.movedir.x >= 0)
        {
-#ifdef SVQC
-               int algn = this.owner.cvar_cl_gunalign;
-#else
-               int algn = autocvar_cl_gunalign;
-#endif
+               int algn = STAT(GUNALIGN, this.owner);
                vector v = this.movedir;
                this.movedir = shotorg_adjust(v, false, false, algn);
                this.view_ofs = shotorg_adjust(v, false, true, algn) - v;
index 97c1999f84299fc98642f2c2597b84891f215cef..1a4888434cccc287d0dd4c690d062024166b64cf 100644 (file)
@@ -144,11 +144,7 @@ vector findperpendicular(vector v)
 
 int W_GetGunAlignment(entity player)
 {
-#ifdef SVQC
-       int gunalign = player.cvar_cl_gunalign;
-#else
-       int gunalign = autocvar_cl_gunalign;
-#endif
+       int gunalign = STAT(GUNALIGN, player);
        if(gunalign < 1 || gunalign > 4)
                gunalign = 3; // default value
        --gunalign;
index 1aa3059c8ad6a3a1e34043860c00ec30aa3166d9..1674f6d1daba7ee170d05fbcb0cbb03b5478b7df 100644 (file)
@@ -205,7 +205,6 @@ float default_weapon_alpha;
 .string cvar_g_xonoticversion;
 .string cvar_cl_weaponpriority;
 .string cvar_cl_weaponpriorities[10];
-.float cvar_cl_gunalign;
 .float cvar_cl_noantilag;
 
 .string weaponorder_byimpulse;
index 7e8f4cfd357e5930fa1ca9e7cd4da8273b1bb95e..3c4897b098225e0305bb79c07fd883d54ad00019 100644 (file)
@@ -417,7 +417,6 @@ void GetCvars(int f)
        GetCvars_handleFloat(s, f, cvar_cl_voice_directional, "cl_voice_directional");
        GetCvars_handleFloat(s, f, cvar_cl_voice_directional_taunt_attenuation, "cl_voice_directional_taunt_attenuation");
 
-       GetCvars_handleFloatOnce(s, f, cvar_cl_gunalign, "cl_gunalign");
        GetCvars_handleFloat(s, f, cvar_cl_allow_uid2name, "cl_allow_uid2name");
        GetCvars_handleFloat(s, f, cvar_cl_allow_uidtracking, "cl_allow_uidtracking");
        GetCvars_handleFloat(s, f, cvar_cl_movement_track_canjump, "cl_movement_track_canjump");