From 3af378bcd8ce8054cd9150602f1d598d6996c23b Mon Sep 17 00:00:00 2001 From: cholleme <> Date: Mon, 3 Feb 2003 14:05:25 +0000 Subject: [PATCH] Better q3 map support --- gl_decals.c | 2 +- gl_model.c | 8 ++++---- gl_refrag.c | 6 +++--- gl_rlight.c | 2 +- gl_rmain.c | 15 ++++++++++----- gl_shadow.c | 4 ++-- 6 files changed, 21 insertions(+), 16 deletions(-) diff --git a/gl_decals.c b/gl_decals.c index 87b9426..d88f3c4 100644 --- a/gl_decals.c +++ b/gl_decals.c @@ -226,7 +226,7 @@ void DecalWalkBsp_R(decal_t *dec, mnode_t *node) float dist; mleaf_t *leaf; - if (node->contents < 0) { + if (node->contents & CONTENTS_LEAF) { //we are in a leaf leaf = (mleaf_t *)node; diff --git a/gl_model.c b/gl_model.c index bbaa68d..84b6400 100644 --- a/gl_model.c +++ b/gl_model.c @@ -89,7 +89,7 @@ mleaf_t *Mod_PointInLeaf (vec3_t p, model_t *model) node = model->nodes; while (1) { - if (node->contents < 0) + if (node->contents & CONTENTS_LEAF) return (mleaf_t *)node; plane = node->plane; d = DotProduct (p,plane->normal) - plane->dist; @@ -907,7 +907,7 @@ Mod_SetParent void Mod_SetParent (mnode_t *node, mnode_t *parent) { node->parent = parent; - if (node->contents < 0) + if (node->contents & CONTENTS_LEAF) return; Mod_SetParent (node->children[0], node); Mod_SetParent (node->children[1], node); @@ -1006,7 +1006,7 @@ void Mod_LoadLeafs (lump_t *l) out->ambient_sound_level[j] = in->ambient_level[j]; // gl underwater warp - if (out->contents == CONTENTS_WATER) + if (out->contents & CONTENTS_WATER) { qboolean iswater = true; @@ -1136,7 +1136,7 @@ void Mod_MakeHull0 (void) for (j=0 ; j<2 ; j++) { child = in->children[j]; - if (child->contents < 0) + if (child->contents & CONTENTS_LEAF) out->children[j] = child->contents; else out->children[j] = child - loadmodel->nodes; diff --git a/gl_refrag.c b/gl_refrag.c index 5fbfe3f..6509832 100644 --- a/gl_refrag.c +++ b/gl_refrag.c @@ -101,7 +101,7 @@ void R_SplitEntityOnNode (mnode_t *node) // add an efrag if the node is a leaf - if ( node->contents < 0) + if (node->contents & CONTENTS_LEAF) { if (!r_pefragtopnode) r_pefragtopnode = node; @@ -260,7 +260,7 @@ void R_SplitEntityOnNodePenta (mnode_t *node) // add an efrag if the node is a leaf - if ( node->contents < 0) + if (node->contents & CONTENTS_LEAF) { leaf = (mleaf_t *)node; @@ -309,7 +309,7 @@ void R_SplitEntityOnNodePenta (entity_t *ent, mnode_t *node) // add an efrag if the node is a leaf - if ( node->contents < 0) + if (node->contents & CONTENTS_LEAF) { if (ent->numleafs == MAX_CLIENT_ENT_LEAFS) { //Con_Printf("Max ent leafs reached\n"); diff --git a/gl_rlight.c b/gl_rlight.c index 9c16c46..a9009e9 100644 --- a/gl_rlight.c +++ b/gl_rlight.c @@ -99,7 +99,7 @@ int RecursiveLightPoint (mnode_t *node, vec3_t start, vec3_t end) unsigned scale; int maps; - if (node->contents < 0) + if (node->contents & CONTENTS_LEAF) return -1; // didn't hit anything // calculate mid point diff --git a/gl_rmain.c b/gl_rmain.c index c97502a..4c7bb5f 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -162,6 +162,8 @@ cvar_t fog_end = {"fog_end","700"}; cvar_t gl_fog = {"gl_fog","1"}; cvar_t fog_waterfog = {"fog_waterfog","1"}; float fog_color[4]; +cvar_t r_tangentscale = {"r_tangentscale","16"}; + mirrorplane_t mirrorplanes[NUM_MIRROR_PLANES]; int mirror_contents; @@ -222,9 +224,12 @@ int CL_PointContents (vec3_t p) { int cont; - cont = SV_HullPointContents (&cl.worldmodel->hulls[0], 0, p); + cont = CM_PointContents(p,0); + //cont = SV_HullPointContents (&cl.worldmodel->hulls[0], 0, p); + /* if (cont <= CONTENTS_CURRENT_0 && cont >= CONTENTS_CURRENT_DOWN) cont = CONTENTS_WATER; + */ return cont; } @@ -2774,7 +2779,7 @@ void R_RenderView (void) viewcont = CL_PointContents(r_origin); fog_color[3] = 1.0; - if ((viewcont == CONTENTS_WATER) && (fog_waterfog.value)){ + if ((viewcont & CONTENTS_WATER) && (fog_waterfog.value)){ glFogi(GL_FOG_MODE, GL_LINEAR); fog_color[0] = 64/255.0; fog_color[1] = 48/255.0; @@ -2785,7 +2790,7 @@ void R_RenderView (void) glEnable(GL_FOG); oldfogen = gl_fog.value; gl_fog.value = 1.0; - } else if ((viewcont == CONTENTS_SLIME) && (fog_waterfog.value)){ + } else if ((viewcont & CONTENTS_SLIME) && (fog_waterfog.value)){ glFogi(GL_FOG_MODE, GL_LINEAR); fog_color[0] = 0.0; fog_color[1] = 128/255.0; @@ -2796,7 +2801,7 @@ void R_RenderView (void) glEnable(GL_FOG); oldfogen = gl_fog.value; gl_fog.value = 1.0; - } else if ((viewcont == CONTENTS_LAVA) && (fog_waterfog.value)){ + } else if ((viewcont & CONTENTS_LAVA) && (fog_waterfog.value)){ glFogi(GL_FOG_MODE, GL_LINEAR); fog_color[0] = 255/255.0; fog_color[1] = 64/255.0; @@ -2846,7 +2851,7 @@ void R_RenderView (void) // More fog right here :) - if ((viewcont == CONTENTS_WATER) && (fog_waterfog.value)){ + if ((viewcont & CONTENTS_WATER) && (fog_waterfog.value)){ gl_fog.value = oldfogen; } glDisable(GL_FOG); diff --git a/gl_shadow.c b/gl_shadow.c index 6b8351c..c88262e 100644 --- a/gl_shadow.c +++ b/gl_shadow.c @@ -586,7 +586,7 @@ void R_MarkShadowCasting (shadowlight_t *light, mnode_t *node) mleaf_t *leaf; int c,leafindex; - if (node->contents < 0) { + if (node->contents & CONTENTS_LEAF) { //we are in a leaf leaf = (mleaf_t *)node; leafindex = leaf->cluster; @@ -1770,7 +1770,7 @@ void R_RecursiveShadowAdd(mnode_t *node) return; // solid } - if (node->contents < 0) { + if (node->contents & CONTENTS_LEAF) { return; // leaf }