From: Samual Date: Mon, 16 May 2011 17:37:44 +0000 (-0400) Subject: Add a check to ObserverThink() function to automatically change the movetype of the... X-Git-Tag: xonotic-v0.5.0~109^2~14 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=101207b33a08ec67ab066e611c276d22900c01b7;p=xonotic%2Fxonotic-data.pk3dir.git Add a check to ObserverThink() function to automatically change the movetype of the spectator to fix the issue stated in previous commit. --- diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 8783944f8..7c3fb2100 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -1712,9 +1712,9 @@ alias gl_flashblend_update "_gl_flashblend_update_$r_shadow_realtime_dlight$r_sh set sv_clones 0 "number of clones a player may make (reset by the \"kill\" command)" -set cl_handicap 1 "the higher, the more damage you will receive (client setting)" +set cl_handicap 1 "the higher, the more damage you will receive (client setting) NOTE: reconnect or use sendcvar command to update the choice." -seta cl_noclipspectating 0 "noclip for spectators so that you can pass through walls and such. (client setting)" +seta cl_clippedspectating 1 "movement collision for spectators so that you can't pass through walls and such. (client setting) NOTE: reconnect or use sendcvar command to update the choice." // must be at the bottom of this file: // alias for switching the teamselect menu diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 16d6a25f1..d884c6d61 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -659,7 +659,7 @@ void PutObserverInServer (void) self.health = -666; self.takedamage = DAMAGE_NO; self.solid = SOLID_NOT; - self.movetype = (self.cvar_cl_noclipspectating ? MOVETYPE_NOCLIP : MOVETYPE_FLY); + self.movetype = MOVETYPE_FLY; //(self.cvar_cl_clippedspectating ? MOVETYPE_NOCLIP : MOVETYPE_FLY); // it's too early for this anyway, lets just set it in playerprethink self.flags = FL_CLIENT | FL_NOTARGET; self.armorvalue = 666; self.effects = 0; @@ -2519,6 +2519,7 @@ void checkSpectatorBlock() { void ObserverThink() { + float prefered_movetype; if (self.flags & FL_JUMPRELEASED) { if (self.BUTTON_JUMP && !self.version_mismatch) { self.welcomemessage_time = 0; @@ -2530,6 +2531,10 @@ void ObserverThink() if(SpectateNext() == 1) { self.classname = "spectator"; } + } else { + prefered_movetype = (self.cvar_cl_clippedspectating ? MOVETYPE_FLY : MOVETYPE_NOCLIP); + if (self.movetype != prefered_movetype) + self.movetype = prefered_movetype; } } else { if (!(self.BUTTON_ATCK || self.BUTTON_JUMP)) { diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 92872dc65..a4ee43bab 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -314,7 +314,7 @@ float default_weapon_alpha; .float cvar_cl_playerdetailreduction; .float cvar_scr_centertime; .float cvar_cl_shownames; -.float cvar_cl_noclipspectating; +.float cvar_cl_clippedspectating; .string cvar_g_xonoticversion; .string cvar_cl_weaponpriority; diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 4679f9264..a79745143 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -582,7 +582,7 @@ void GetCvars(float f) GetCvars_handleFloat(s, f, cvar_scr_centertime, "scr_centertime"); GetCvars_handleString(s, f, cvar_g_xonoticversion, "g_xonoticversion"); GetCvars_handleFloat(s, f, cvar_cl_handicap, "cl_handicap"); - GetCvars_handleFloat(s, f, cvar_cl_noclipspectating, "cl_noclipspectating"); + GetCvars_handleFloat(s, f, cvar_cl_clippedspectating, "cl_clippedspectating"); GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriority, "cl_weaponpriority", W_FixWeaponOrder_ForceComplete_AndBuildImpulseList); GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[0], "cl_weaponpriority0", W_FixWeaponOrder_AllowIncomplete); GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[1], "cl_weaponpriority1", W_FixWeaponOrder_AllowIncomplete);