From 053edd4aa7eeb99c4f7d89030a4ca2b9a32f9d74 Mon Sep 17 00:00:00 2001 From: havoc Date: Sun, 17 Feb 2013 05:05:28 +0000 Subject: [PATCH] changed Q1BSP traceline to only use the surface-hitting variant if sv_gameplayfix_q1bsptracelinereportstexture is on, because in one of negke's maps a set of items are crushed by a pusher and are expected to fall through the sky brush they are sitting on, which does not happen if the sky surface is considered solid, but in any other situation this should be reported as solid git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11897 d7cf8633-e32d-0410-b094-e92efae38249 --- model_brush.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/model_brush.c b/model_brush.c index f6453414..702e1159 100644 --- a/model_brush.c +++ b/model_brush.c @@ -903,6 +903,8 @@ static void Mod_Q1BSP_TracePoint(struct model_s *model, const frameblend_t *fram Mod_Q1BSP_RecursiveHullCheckPoint(&rhc, rhc.hull->firstclipnode); } +static void Mod_Q1BSP_TraceLineAgainstSurfaces(struct model_s *model, const frameblend_t *frameblend, const skeleton_t *skeleton, trace_t *trace, const vec3_t start, const vec3_t end, int hitsupercontentsmask); + static void Mod_Q1BSP_TraceLine(struct model_s *model, const frameblend_t *frameblend, const skeleton_t *skeleton, trace_t *trace, const vec3_t start, const vec3_t end, int hitsupercontentsmask) { RecursiveHullCheckTraceInfo_t rhc; @@ -913,6 +915,13 @@ static void Mod_Q1BSP_TraceLine(struct model_s *model, const frameblend_t *frame return; } + // sometimes we want to traceline against polygons so we can report the texture that was hit rather than merely a contents, but using this method breaks one of negke's maps so it must be a cvar check... + if (sv_gameplayfix_q1bsptracelinereportstexture.integer) + { + Mod_Q1BSP_TraceLineAgainstSurfaces(model, frameblend, skeleton, trace, start, end, hitsupercontentsmask); + return; + } + memset(&rhc, 0, sizeof(rhc)); memset(trace, 0, sizeof(trace_t)); rhc.trace = trace; @@ -1783,7 +1792,8 @@ static void Mod_Q1BSP_LoadTextures(sizebuf_t *sb) { tx->supercontents = mod_q1bsp_texture_sky.supercontents; tx->surfaceflags = mod_q1bsp_texture_sky.surfaceflags; - tx->supercontents |= SUPERCONTENTS_SOLID; // for the surface traceline we need to hit this surface as a solid... + // for the surface traceline we need to hit this surface as a solid... + tx->supercontents |= SUPERCONTENTS_SOLID; } else { @@ -3791,10 +3801,7 @@ void Mod_Q1BSP_Load(dp_model_t *mod, void *buffer, void *bufferend) mod->soundfromcenter = true; mod->TraceBox = Mod_Q1BSP_TraceBox; - if (sv_gameplayfix_q1bsptracelinereportstexture.integer) - mod->TraceLine = Mod_Q1BSP_TraceLineAgainstSurfaces; // LordHavoc: use the surface-hitting version of TraceLine in all cases - else - mod->TraceLine = Mod_Q1BSP_TraceLine; + mod->TraceLine = Mod_Q1BSP_TraceLine; mod->TracePoint = Mod_Q1BSP_TracePoint; mod->PointSuperContents = Mod_Q1BSP_PointSuperContents; mod->TraceLineAgainstSurfaces = Mod_Q1BSP_TraceLineAgainstSurfaces; -- 2.39.2