]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make more of the shotorg adjustments available to CSQC
authorMario <mario@smbclan.net>
Fri, 2 Mar 2018 13:02:28 +0000 (23:02 +1000)
committerMario <mario@smbclan.net>
Fri, 2 Mar 2018 13:02:28 +0000 (23:02 +1000)
qcsrc/client/main.qc
qcsrc/common/stats.qh
qcsrc/common/weapons/all.qc
qcsrc/common/weapons/all.qh
qcsrc/server/autocvars.qh
qcsrc/server/client.qc

index f0b8aac6c9ee3b69d1c4c51abfde9cf98f7c23ca..9c146c09bd9115091c24585fc02c323558b75d19 100644 (file)
@@ -134,6 +134,8 @@ void CSQC_Init()
        registercvar("cl_jumpspeedcap_min", "");
        registercvar("cl_jumpspeedcap_max", "");
 
+       registercvar("cl_shootfromfixedorigin", "");
+
        registercvar("cl_multijump", "1");
 
        registercvar("cl_spawn_near_teammate", "1");
index 69d3a4f583326714cc89f44f23fe2d097f3a993d..db681315a6c4d27b3d804f5fb4a90bc13bf7e196 100644 (file)
@@ -299,6 +299,13 @@ REGISTER_STAT(SLICK_APPLYGRAVITY, bool, autocvar_sv_slick_applygravity)
 float warmup_limit;
 #endif
 
+#ifdef SVQC
+bool autocvar_g_shootfromcenter;
+bool autocvar_g_shootfromeye;
+#endif
+REGISTER_STAT(SHOOTFROMEYE, bool, autocvar_g_shootfromeye)
+REGISTER_STAT(SHOOTFROMCENTER, bool, autocvar_g_shootfromcenter)
+
 REGISTER_STAT(MOVEVARS_AIRACCEL_QW_STRETCHFACTOR, float)
 REGISTER_STAT(MOVEVARS_AIRCONTROL_PENALTY, float)
 REGISTER_STAT(MOVEVARS_AIRSPEEDLIMIT_NONQW, float)
index 5c51c2d87b4da7071b8dcde95671038f3618e630..dca20d0cdbf1b627bf920ddee47aeb93c60ce58d 100644 (file)
@@ -293,24 +293,21 @@ vector shotorg_adjustfromclient(vector vecs, float y_is_right, float algn)
 
 vector shotorg_adjust_values(vector vecs, bool y_is_right, bool visual, int algn)
 {
-#ifdef SVQC
        string s;
-#endif
        if (visual)
        {
                vecs = shotorg_adjustfromclient(vecs, y_is_right, algn);
        }
-#ifdef SVQC
-       else if (autocvar_g_shootfromeye)
+       else if (STAT(SHOOTFROMEYE))
        {
                vecs.y = vecs.z = 0;
        }
-       else if (autocvar_g_shootfromcenter)
+       else if (STAT(SHOOTFROMCENTER))
        {
                vecs.y = 0;
                vecs.z -= 2;
        }
-       else if ((s = autocvar_g_shootfromfixedorigin) != "")
+       else if ((s = G_SHOOTFROMFIXEDORIGIN) != "")
        {
                vector v = stov(s);
                if (y_is_right) v.y = -v.y;
@@ -318,7 +315,6 @@ vector shotorg_adjust_values(vector vecs, bool y_is_right, bool visual, int algn
                vecs.y = v.y;
                vecs.z = v.z;
        }
-#endif
        else  // just do the same as top
        {
                vecs = shotorg_adjustfromclient(vecs, y_is_right, algn);
index beaa6cb48a3773e2555b4817177696242b7b7e43..0af47590078a8dde4c44257de429ff240e0dd19e 100644 (file)
@@ -359,6 +359,13 @@ ENUMCLASS_END(WFRAME)
 
 .WFRAME wframe;
 
+#ifdef SVQC
+    #define G_SHOOTFROMFIXEDORIGIN autocvar_g_shootfromfixedorigin
+#elif defined(CSQC)
+    string autocvar_cl_shootfromfixedorigin;
+    #define G_SHOOTFROMFIXEDORIGIN autocvar_cl_shootfromfixedorigin
+#endif
+
 vector shotorg_adjust_values(vector vecs, bool y_is_right, bool visual, int algn);
 void CL_WeaponEntity_SetModel(entity this, string name, bool _anim);
 #endif
index a2f917fafcaee15b204ce9cc80eb1455ce89dc38..a2f9ab49b4f9c48497e8599806adc6ff7cd247a2 100644 (file)
@@ -204,8 +204,6 @@ bool autocvar_g_respawn_ghosts;
 float autocvar_g_respawn_ghosts_maxtime;
 float autocvar_g_respawn_ghosts_speed;
 int autocvar_g_respawn_waves;
-bool autocvar_g_shootfromcenter;
-bool autocvar_g_shootfromeye;
 string autocvar_g_shootfromfixedorigin;
 int autocvar_g_showweaponspawns;
 bool autocvar_g_spawn_alloweffects;
index 01f2b74e0b05c756706089065311b90c92d8af64..5a199e06dc3396c61b7de4b0ff5e24bf112bcbb8 100644 (file)
@@ -1094,6 +1094,8 @@ void FixClientCvars(entity e)
        stuffcmd(e, sprintf("\ncl_jumpspeedcap_min \"%s\"\n", autocvar_sv_jumpspeedcap_min));
        stuffcmd(e, sprintf("\ncl_jumpspeedcap_max \"%s\"\n", autocvar_sv_jumpspeedcap_max));
 
+       stuffcmd(e, sprintf("\ncl_shootfromfixedorigin \"%s\"\n", autocvar_g_shootfromfixedorigin));
+
        MUTATOR_CALLHOOK(FixClientCvars, e);
 }
 
@@ -2144,6 +2146,7 @@ bool joinAllowed(entity this)
 }
 
 .int items_added;
+.string shootfromfixedorigin;
 bool PlayerThink(entity this)
 {
        if (game_stopped || intermission_running) {
@@ -2278,6 +2281,11 @@ bool PlayerThink(entity this)
 
        FixPlayermodel(this);
 
+       if (this.shootfromfixedorigin != autocvar_g_shootfromfixedorigin) {
+               this.shootfromfixedorigin = autocvar_g_shootfromfixedorigin;
+               stuffcmd(this, sprintf("\ncl_shootfromfixedorigin \"%s\"\n", autocvar_g_shootfromfixedorigin));
+       }
+
        // LordHavoc: allow firing on move frames (sub-ticrate), this gives better timing on slow servers
        //if(frametime)
        {