From 276774e916493020226779229db91d4f7dc6fc06 Mon Sep 17 00:00:00 2001 From: havoc Date: Wed, 12 Oct 2011 08:15:00 +0000 Subject: [PATCH] added cvar sv_gameplayfix_bugfixedcheckwatertransition to allow the contents bugfixes to be disabled if desired, improved contents handling to prevent a splash sound on spawn git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11398 d7cf8633-e32d-0410-b094-e92efae38249 --- server.h | 1 + sv_main.c | 2 ++ sv_phys.c | 15 +++++++++------ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/server.h b/server.h index 34c68e2d..d55f0f07 100644 --- a/server.h +++ b/server.h @@ -454,6 +454,7 @@ extern cvar_t sv_gameplayfix_downtracesupportsongroundflag; extern cvar_t sv_gameplayfix_q1bsptracelinereportstexture; extern cvar_t sv_gameplayfix_unstickplayers; extern cvar_t sv_gameplayfix_unstickentities; +extern cvar_t sv_gameplayfix_fixedcheckwatertransition; extern cvar_t sv_gravity; extern cvar_t sv_idealpitchscale; extern cvar_t sv_jumpstep; diff --git a/sv_main.c b/sv_main.c index 6d2c9d18..9b41ecaa 100644 --- a/sv_main.c +++ b/sv_main.c @@ -123,6 +123,7 @@ cvar_t sv_gameplayfix_downtracesupportsongroundflag = {0, "sv_gameplayfix_downtr cvar_t sv_gameplayfix_q1bsptracelinereportstexture = {0, "sv_gameplayfix_q1bsptracelinereportstexture", "1", "enables mods to get accurate trace_texture results on q1bsp by using a surface-hitting traceline implementation rather than the standard solidbsp method, q3bsp always reports texture accurately"}; cvar_t sv_gameplayfix_unstickplayers = {0, "sv_gameplayfix_unstickplayers", "1", "big hack to try and fix the rare case of MOVETYPE_WALK entities getting stuck in the world clipping hull."}; cvar_t sv_gameplayfix_unstickentities = {0, "sv_gameplayfix_unstickentities", "1", "hack to check if entities are crossing world collision hull and try to move them to the right position"}; +cvar_t sv_gameplayfix_fixedcheckwatertransition = {0, "sv_gameplayfix_fixedcheckwatertransition", "1", "fix two very stupid bugs in SV_CheckWaterTransition when watertype is CONTENTS_EMPTY (the bugs causes waterlevel to be 1 on first frame, -1 on second frame - the fix makes it 0 on both frames)"}; cvar_t sv_gravity = {CVAR_NOTIFY, "sv_gravity","800", "how fast you fall (512 = roughly earth gravity)"}; cvar_t sv_idealpitchscale = {0, "sv_idealpitchscale","0.8", "how much to look up/down slopes and stairs when not using freelook"}; cvar_t sv_jumpstep = {CVAR_NOTIFY, "sv_jumpstep", "0", "whether you can step up while jumping (sv_gameplayfix_stepwhilejumping must also be 1)"}; @@ -529,6 +530,7 @@ void SV_Init (void) Cvar_RegisterVariable (&sv_gameplayfix_q1bsptracelinereportstexture); Cvar_RegisterVariable (&sv_gameplayfix_unstickplayers); Cvar_RegisterVariable (&sv_gameplayfix_unstickentities); + Cvar_RegisterVariable (&sv_gameplayfix_fixedcheckwatertransition); Cvar_RegisterVariable (&sv_gravity); Cvar_RegisterVariable (&sv_idealpitchscale); Cvar_RegisterVariable (&sv_jumpstep); diff --git a/sv_phys.c b/sv_phys.c index a3f84f4b..c21044d1 100644 --- a/sv_phys.c +++ b/sv_phys.c @@ -2505,21 +2505,24 @@ SV_CheckWaterTransition */ void SV_CheckWaterTransition (prvm_edict_t *ent) { + // LordHavoc: bugfixes in this function are keyed to the sv_gameplayfix_bugfixedcheckwatertransition cvar - if this cvar is 0 then all the original bugs should be reenabled for compatibility int cont; cont = Mod_Q1BSP_NativeContentsFromSuperContents(NULL, SV_PointSuperContents(PRVM_serveredictvector(ent, origin))); if (!PRVM_serveredictfloat(ent, watertype)) { // just spawned here - PRVM_serveredictfloat(ent, watertype) = cont; - PRVM_serveredictfloat(ent, waterlevel) = 1; - return; + if (!sv_gameplayfix_fixedcheckwatertransition.integer) + { + PRVM_serveredictfloat(ent, watertype) = cont; + PRVM_serveredictfloat(ent, waterlevel) = 1; + return; + } } - // DRESK - Support for Entity Contents Transition Event // NOTE: Call here BEFORE updating the watertype below, // and suppress watersplash sound if a valid function // call was made to allow for custom "splash" sounds. - if( !SV_CheckContentsTransition(ent, cont) ) + else if( !SV_CheckContentsTransition(ent, cont) ) { // Contents Transition Function Invalid; Potentially Play Water Sound // check if the entity crossed into or out of water if (sv_sound_watersplash.string && ((PRVM_serveredictfloat(ent, watertype) == CONTENTS_WATER || PRVM_serveredictfloat(ent, watertype) == CONTENTS_SLIME) != (cont == CONTENTS_WATER || cont == CONTENTS_SLIME))) @@ -2534,7 +2537,7 @@ void SV_CheckWaterTransition (prvm_edict_t *ent) else { PRVM_serveredictfloat(ent, watertype) = CONTENTS_EMPTY; - PRVM_serveredictfloat(ent, waterlevel) = 0; + PRVM_serveredictfloat(ent, waterlevel) = sv_gameplayfix_fixedcheckwatertransition.integer ? 0 : cont; } } -- 2.39.2