Better q3 map support
This commit is contained in:
parent
82090154c6
commit
3af378bcd8
6 changed files with 21 additions and 16 deletions
|
@ -226,7 +226,7 @@ void DecalWalkBsp_R(decal_t *dec, mnode_t *node)
|
||||||
float dist;
|
float dist;
|
||||||
mleaf_t *leaf;
|
mleaf_t *leaf;
|
||||||
|
|
||||||
if (node->contents < 0) {
|
if (node->contents & CONTENTS_LEAF) {
|
||||||
|
|
||||||
//we are in a leaf
|
//we are in a leaf
|
||||||
leaf = (mleaf_t *)node;
|
leaf = (mleaf_t *)node;
|
||||||
|
|
|
@ -89,7 +89,7 @@ mleaf_t *Mod_PointInLeaf (vec3_t p, model_t *model)
|
||||||
node = model->nodes;
|
node = model->nodes;
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
if (node->contents < 0)
|
if (node->contents & CONTENTS_LEAF)
|
||||||
return (mleaf_t *)node;
|
return (mleaf_t *)node;
|
||||||
plane = node->plane;
|
plane = node->plane;
|
||||||
d = DotProduct (p,plane->normal) - plane->dist;
|
d = DotProduct (p,plane->normal) - plane->dist;
|
||||||
|
@ -907,7 +907,7 @@ Mod_SetParent
|
||||||
void Mod_SetParent (mnode_t *node, mnode_t *parent)
|
void Mod_SetParent (mnode_t *node, mnode_t *parent)
|
||||||
{
|
{
|
||||||
node->parent = parent;
|
node->parent = parent;
|
||||||
if (node->contents < 0)
|
if (node->contents & CONTENTS_LEAF)
|
||||||
return;
|
return;
|
||||||
Mod_SetParent (node->children[0], node);
|
Mod_SetParent (node->children[0], node);
|
||||||
Mod_SetParent (node->children[1], 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];
|
out->ambient_sound_level[j] = in->ambient_level[j];
|
||||||
|
|
||||||
// gl underwater warp
|
// gl underwater warp
|
||||||
if (out->contents == CONTENTS_WATER)
|
if (out->contents & CONTENTS_WATER)
|
||||||
{
|
{
|
||||||
qboolean iswater = true;
|
qboolean iswater = true;
|
||||||
|
|
||||||
|
@ -1136,7 +1136,7 @@ void Mod_MakeHull0 (void)
|
||||||
for (j=0 ; j<2 ; j++)
|
for (j=0 ; j<2 ; j++)
|
||||||
{
|
{
|
||||||
child = in->children[j];
|
child = in->children[j];
|
||||||
if (child->contents < 0)
|
if (child->contents & CONTENTS_LEAF)
|
||||||
out->children[j] = child->contents;
|
out->children[j] = child->contents;
|
||||||
else
|
else
|
||||||
out->children[j] = child - loadmodel->nodes;
|
out->children[j] = child - loadmodel->nodes;
|
||||||
|
|
|
@ -101,7 +101,7 @@ void R_SplitEntityOnNode (mnode_t *node)
|
||||||
|
|
||||||
// add an efrag if the node is a leaf
|
// add an efrag if the node is a leaf
|
||||||
|
|
||||||
if ( node->contents < 0)
|
if (node->contents & CONTENTS_LEAF)
|
||||||
{
|
{
|
||||||
if (!r_pefragtopnode)
|
if (!r_pefragtopnode)
|
||||||
r_pefragtopnode = node;
|
r_pefragtopnode = node;
|
||||||
|
@ -260,7 +260,7 @@ void R_SplitEntityOnNodePenta (mnode_t *node)
|
||||||
|
|
||||||
// add an efrag if the node is a leaf
|
// add an efrag if the node is a leaf
|
||||||
|
|
||||||
if ( node->contents < 0)
|
if (node->contents & CONTENTS_LEAF)
|
||||||
{
|
{
|
||||||
leaf = (mleaf_t *)node;
|
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
|
// 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) {
|
if (ent->numleafs == MAX_CLIENT_ENT_LEAFS) {
|
||||||
//Con_Printf("Max ent leafs reached\n");
|
//Con_Printf("Max ent leafs reached\n");
|
||||||
|
|
|
@ -99,7 +99,7 @@ int RecursiveLightPoint (mnode_t *node, vec3_t start, vec3_t end)
|
||||||
unsigned scale;
|
unsigned scale;
|
||||||
int maps;
|
int maps;
|
||||||
|
|
||||||
if (node->contents < 0)
|
if (node->contents & CONTENTS_LEAF)
|
||||||
return -1; // didn't hit anything
|
return -1; // didn't hit anything
|
||||||
|
|
||||||
// calculate mid point
|
// calculate mid point
|
||||||
|
|
15
gl_rmain.c
15
gl_rmain.c
|
@ -162,6 +162,8 @@ cvar_t fog_end = {"fog_end","700"};
|
||||||
cvar_t gl_fog = {"gl_fog","1"};
|
cvar_t gl_fog = {"gl_fog","1"};
|
||||||
cvar_t fog_waterfog = {"fog_waterfog","1"};
|
cvar_t fog_waterfog = {"fog_waterfog","1"};
|
||||||
float fog_color[4];
|
float fog_color[4];
|
||||||
|
cvar_t r_tangentscale = {"r_tangentscale","16"};
|
||||||
|
|
||||||
|
|
||||||
mirrorplane_t mirrorplanes[NUM_MIRROR_PLANES];
|
mirrorplane_t mirrorplanes[NUM_MIRROR_PLANES];
|
||||||
int mirror_contents;
|
int mirror_contents;
|
||||||
|
@ -222,9 +224,12 @@ int CL_PointContents (vec3_t p)
|
||||||
{
|
{
|
||||||
int cont;
|
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)
|
if (cont <= CONTENTS_CURRENT_0 && cont >= CONTENTS_CURRENT_DOWN)
|
||||||
cont = CONTENTS_WATER;
|
cont = CONTENTS_WATER;
|
||||||
|
*/
|
||||||
return cont;
|
return cont;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2774,7 +2779,7 @@ void R_RenderView (void)
|
||||||
|
|
||||||
viewcont = CL_PointContents(r_origin);
|
viewcont = CL_PointContents(r_origin);
|
||||||
fog_color[3] = 1.0;
|
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);
|
glFogi(GL_FOG_MODE, GL_LINEAR);
|
||||||
fog_color[0] = 64/255.0;
|
fog_color[0] = 64/255.0;
|
||||||
fog_color[1] = 48/255.0;
|
fog_color[1] = 48/255.0;
|
||||||
|
@ -2785,7 +2790,7 @@ void R_RenderView (void)
|
||||||
glEnable(GL_FOG);
|
glEnable(GL_FOG);
|
||||||
oldfogen = gl_fog.value;
|
oldfogen = gl_fog.value;
|
||||||
gl_fog.value = 1.0;
|
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);
|
glFogi(GL_FOG_MODE, GL_LINEAR);
|
||||||
fog_color[0] = 0.0;
|
fog_color[0] = 0.0;
|
||||||
fog_color[1] = 128/255.0;
|
fog_color[1] = 128/255.0;
|
||||||
|
@ -2796,7 +2801,7 @@ void R_RenderView (void)
|
||||||
glEnable(GL_FOG);
|
glEnable(GL_FOG);
|
||||||
oldfogen = gl_fog.value;
|
oldfogen = gl_fog.value;
|
||||||
gl_fog.value = 1.0;
|
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);
|
glFogi(GL_FOG_MODE, GL_LINEAR);
|
||||||
fog_color[0] = 255/255.0;
|
fog_color[0] = 255/255.0;
|
||||||
fog_color[1] = 64/255.0;
|
fog_color[1] = 64/255.0;
|
||||||
|
@ -2846,7 +2851,7 @@ void R_RenderView (void)
|
||||||
|
|
||||||
// More fog right here :)
|
// More fog right here :)
|
||||||
|
|
||||||
if ((viewcont == CONTENTS_WATER) && (fog_waterfog.value)){
|
if ((viewcont & CONTENTS_WATER) && (fog_waterfog.value)){
|
||||||
gl_fog.value = oldfogen;
|
gl_fog.value = oldfogen;
|
||||||
}
|
}
|
||||||
glDisable(GL_FOG);
|
glDisable(GL_FOG);
|
||||||
|
|
|
@ -586,7 +586,7 @@ void R_MarkShadowCasting (shadowlight_t *light, mnode_t *node)
|
||||||
mleaf_t *leaf;
|
mleaf_t *leaf;
|
||||||
int c,leafindex;
|
int c,leafindex;
|
||||||
|
|
||||||
if (node->contents < 0) {
|
if (node->contents & CONTENTS_LEAF) {
|
||||||
//we are in a leaf
|
//we are in a leaf
|
||||||
leaf = (mleaf_t *)node;
|
leaf = (mleaf_t *)node;
|
||||||
leafindex = leaf->cluster;
|
leafindex = leaf->cluster;
|
||||||
|
@ -1770,7 +1770,7 @@ void R_RecursiveShadowAdd(mnode_t *node)
|
||||||
return; // solid
|
return; // solid
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node->contents < 0) {
|
if (node->contents & CONTENTS_LEAF) {
|
||||||
return; // leaf
|
return; // leaf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue