new supercontents flags: BOTCLIP (matching Q3's botclip), and OPAQUE (matching anythi...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 20 May 2009 17:29:41 +0000 (17:29 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 20 May 2009 17:29:41 +0000 (17:29 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8981 d7cf8633-e32d-0410-b094-e92efae38249

bspfile.h
model_alias.c
model_brush.c
model_brush.h

index 77e9dce..724e643 100644 (file)
--- a/bspfile.h
+++ b/bspfile.h
@@ -169,6 +169,7 @@ typedef struct dplane_s
 #define CONTENTSQ3_JUMPPAD                     0x00080000 // hint for Q3's bots
 #define CONTENTSQ3_CLUSTERPORTAL       0x00100000 // hint for Q3's bots
 #define CONTENTSQ3_DONOTENTER          0x00200000 // hint for Q3's bots
+#define CONTENTSQ3_BOTCLIP                     0x00400000 // hint for Q3's bots
 #define CONTENTSQ3_ORIGIN                      0x01000000 // used by origin brushes to indicate origin of bmodel (removed by map compiler)
 #define CONTENTSQ3_BODY                                0x02000000 // used by bbox entities (should never be on a brush)
 #define CONTENTSQ3_CORPSE                      0x04000000 // used by dead bodies (SOLID_CORPSE in darkplaces)
@@ -189,6 +190,17 @@ typedef struct dplane_s
 #define SUPERCONTENTS_PLAYERCLIP       0x00000100
 #define SUPERCONTENTS_MONSTERCLIP      0x00000200
 #define SUPERCONTENTS_DONOTENTER       0x00000400
+#define SUPERCONTENTS_BOTCLIP          0x00000800
+#define SUPERCONTENTS_OPAQUE           0x00001000
+// TODO: is there any reason to define:
+//   fog?
+//   areaportal?
+//   teleporter?
+//   jumppad?
+//   clusterportal?
+//   detail?         (div0) no, game code should not be allowed to differentiate between structural and detail
+//   structural?     (div0) no, game code should not be allowed to differentiate between structural and detail
+//   trigger?        (div0) no, as these are always solid anyway, and that's all that matters for trigger brushes
 #define SUPERCONTENTS_LIQUIDSMASK      (SUPERCONTENTS_LAVA | SUPERCONTENTS_SLIME | SUPERCONTENTS_WATER)
 
 /*
index dfb43c8..ebc5677 100644 (file)
@@ -657,7 +657,7 @@ static void Mod_MDLMD2MD3_TraceBox(dp_model_t *model, int frame, trace_t *trace,
                for (i = 0, surface = model->data_surfaces;i < model->num_surfaces;i++, surface++)
                {
                        model->AnimateVertices(model, frameblend, vertex3f, NULL, NULL, NULL);
-                       Collision_TraceLineTriangleMeshFloat(trace, start, end, model->surfmesh.num_triangles, model->surfmesh.data_element3i, vertex3f, SUPERCONTENTS_SOLID, 0, surface->texture, segmentmins, segmentmaxs);
+                       Collision_TraceLineTriangleMeshFloat(trace, start, end, model->surfmesh.num_triangles, model->surfmesh.data_element3i, vertex3f, SUPERCONTENTS_SOLID | (surface->texture->basematerialflags & MATERIALFLAGMASK_TRANSLUCENT ? 0 : SUPERCONTENTS_OPAQUE), 0, surface->texture, segmentmins, segmentmaxs);
                }
        }
        else
@@ -687,7 +687,7 @@ static void Mod_MDLMD2MD3_TraceBox(dp_model_t *model, int frame, trace_t *trace,
                                vertex3f = (float *)Z_Malloc(maxvertices * sizeof(float[3]));
                        }
                        model->AnimateVertices(model, frameblend, vertex3f, NULL, NULL, NULL);
-                       Collision_TraceBrushTriangleMeshFloat(trace, thisbrush_start, thisbrush_end, model->surfmesh.num_triangles, model->surfmesh.data_element3i, vertex3f, SUPERCONTENTS_SOLID, 0, surface->texture, segmentmins, segmentmaxs);
+                       Collision_TraceBrushTriangleMeshFloat(trace, thisbrush_start, thisbrush_end, model->surfmesh.num_triangles, model->surfmesh.data_element3i, vertex3f, SUPERCONTENTS_SOLID | (surface->texture->basematerialflags & MATERIALFLAGMASK_TRANSLUCENT ? 0 : SUPERCONTENTS_OPAQUE), 0, surface->texture, segmentmins, segmentmaxs);
                }
        }
 }
index 2b66aea..6049834 100644 (file)
@@ -564,7 +564,7 @@ int Mod_Q1BSP_SuperContentsFromNativeContents(dp_model_t *model, int nativeconte
                case CONTENTS_EMPTY:
                        return 0;
                case CONTENTS_SOLID:
-                       return SUPERCONTENTS_SOLID;
+                       return SUPERCONTENTS_SOLID | SUPERCONTENTS_OPAQUE;
                case CONTENTS_WATER:
                        return SUPERCONTENTS_WATER;
                case CONTENTS_SLIME:
@@ -572,7 +572,7 @@ int Mod_Q1BSP_SuperContentsFromNativeContents(dp_model_t *model, int nativeconte
                case CONTENTS_LAVA:
                        return SUPERCONTENTS_LAVA | SUPERCONTENTS_NODROP;
                case CONTENTS_SKY:
-                       return SUPERCONTENTS_SKY | SUPERCONTENTS_NODROP;
+                       return SUPERCONTENTS_SKY | SUPERCONTENTS_NODROP | SUPERCONTENTS_OPAQUE; // to match behaviour of Q3 maps, let sky count as opaque
        }
        return 0;
 }
@@ -5750,6 +5750,10 @@ static int Mod_Q3BSP_SuperContentsFromNativeContents(dp_model_t *model, int nati
                supercontents |= SUPERCONTENTS_MONSTERCLIP;
        if (nativecontents & CONTENTSQ3_DONOTENTER)
                supercontents |= SUPERCONTENTS_DONOTENTER;
+       if (nativecontents & CONTENTSQ3_BOTCLIP)
+               supercontents |= SUPERCONTENTS_BOTCLIP;
+       if (!(nativecontents & CONTENTSQ3_TRANSLUCENT))
+               supercontents |= SUPERCONTENTS_OPAQUE;
        return supercontents;
 }
 
@@ -5776,6 +5780,10 @@ static int Mod_Q3BSP_NativeContentsFromSuperContents(dp_model_t *model, int supe
                nativecontents |= CONTENTSQ3_MONSTERCLIP;
        if (supercontents & SUPERCONTENTS_DONOTENTER)
                nativecontents |= CONTENTSQ3_DONOTENTER;
+       if (supercontents & SUPERCONTENTS_BOTCLIP)
+               nativecontents |= CONTENTSQ3_BOTCLIP;
+       if (!(supercontents & SUPERCONTENTS_OPAQUE))
+               nativecontents |= CONTENTSQ3_TRANSLUCENT;
        return nativecontents;
 }
 
index 0c0f0e5..3e90e25 100644 (file)
@@ -110,6 +110,8 @@ mplane_t;
 #define MATERIALFLAG_MODELLIGHT_DIRECTIONAL 8388608
 // combined mask of all attributes that require depth sorted rendering
 #define MATERIALFLAGMASK_DEPTHSORTED (MATERIALFLAG_BLENDED | MATERIALFLAG_NODEPTHTEST)
+// combined mask of all attributes that cause some sort of transparency
+#define MATERIALFLAGMASK_TRANSLUCENT (MATERIALFLAG_WATERALPHA | MATERIALFLAG_SKY | MATERIALFLAG_NODRAW | MATERIALFLAG_ALPHATEST | MATERIALFLAG_BLENDED | MATERIALFLAG_WATERSHADER | MATERIALFLAG_REFRACTION)
 
 typedef struct medge_s
 {