From: Mario Date: Fri, 2 Mar 2018 13:02:28 +0000 (+1000) Subject: Make more of the shotorg adjustments available to CSQC X-Git-Tag: xonotic-v0.8.5~2264 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f242b05ab828abab5e2bd9f8497b84cdadc86d13;p=xonotic%2Fxonotic-data.pk3dir.git Make more of the shotorg adjustments available to CSQC --- diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index f0b8aac6c..9c146c09b 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -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"); diff --git a/qcsrc/common/stats.qh b/qcsrc/common/stats.qh index 69d3a4f58..db681315a 100644 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@ -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) diff --git a/qcsrc/common/weapons/all.qc b/qcsrc/common/weapons/all.qc index 5c51c2d87..dca20d0cd 100644 --- a/qcsrc/common/weapons/all.qc +++ b/qcsrc/common/weapons/all.qc @@ -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); diff --git a/qcsrc/common/weapons/all.qh b/qcsrc/common/weapons/all.qh index beaa6cb48..0af475900 100644 --- a/qcsrc/common/weapons/all.qh +++ b/qcsrc/common/weapons/all.qh @@ -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 diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index a2f917faf..a2f9ab49b 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -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; diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 01f2b74e0..5a199e06d 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -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) {