X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=collision.h;h=71bc57f0caa81e8c99611804fbb2a7f5c5786ae1;hb=HEAD;hp=fd693375bed82c88fbc74e06485a8a81dc6ab941;hpb=0a05c446ba26bd5897645a37ceec8646c5bc93eb;p=xonotic%2Fdarkplaces.git diff --git a/collision.h b/collision.h index fd693375..71bc57f0 100644 --- a/collision.h +++ b/collision.h @@ -2,6 +2,10 @@ #ifndef COLLISION_H #define COLLISION_H +#include "matrixlib.h" +struct mempool_s; +struct model_s; + typedef union plane_s { struct @@ -17,19 +21,19 @@ struct texture_s; typedef struct trace_s { // if true, the entire trace was in solid (see hitsupercontentsmask) - int allsolid; + qbool allsolid; // if true, the initial point was in solid (see hitsupercontentsmask) - int startsolid; + qbool startsolid; // this is set to true in world.c if startsolid was set in a trace against world - int worldstartsolid; + qbool worldstartsolid; // this is set to true in world.c if startsolid was set in a trace against a SOLID_BSP entity, in other words this is true if the entity is stuck in a door or wall, but not if stuck in another normal entity - int bmodelstartsolid; + qbool bmodelstartsolid; // if true, the trace passed through empty somewhere // (set only by Q1BSP tracing) - int inopen; + qbool inopen; // if true, the trace passed through water/slime/lava somewhere // (set only by Q1BSP tracing) - int inwater; + qbool inwater; // fraction of the total distance that was traveled before impact // in case of impact this is actually nudged a bit off the surface // (1.0 = did not hit anything) @@ -58,7 +62,7 @@ typedef struct trace_s const struct texture_s *hittexture; // initially false, set when the start leaf is found // (set only by Q1BSP tracing and entity box tracing) - int startfound; + qbool startfound; // if startsolid, contains the minimum penetration depth found in the // trace, and the normal needed to push it out of that solid double startdepth; @@ -72,7 +76,7 @@ void Collision_ClipTrace_Box(trace_t *trace, const vec3_t cmins, const vec3_t cm void Collision_ClipTrace_Point(trace_t *trace, const vec3_t cmins, const vec3_t cmaxs, const vec3_t start, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, int boxsupercontents, int boxq3surfaceflags, const texture_t *boxtexture); void Collision_Cache_Reset(qbool resetlimits); -void Collision_Cache_Init(mempool_t *mempool); +void Collision_Cache_Init(struct mempool_s *mempool); void Collision_Cache_NewFrame(void); typedef struct colpointf_s @@ -137,7 +141,7 @@ typedef struct colboxbrushf_s colboxbrushf_t; void Collision_CalcPlanesForTriangleBrushFloat(colbrushf_t *brush); -colbrushf_t *Collision_NewBrushFromPlanes(mempool_t *mempool, int numoriginalplanes, const colplanef_t *originalplanes, int supercontents, int q3surfaceflags, const texture_t *texture, int hasaabbplanes); +colbrushf_t *Collision_NewBrushFromPlanes(struct mempool_s *mempool, int numoriginalplanes, const colplanef_t *originalplanes, int supercontents, int q3surfaceflags, const texture_t *texture, int hasaabbplanes); void Collision_TraceBrushBrushFloat(trace_t *trace, const colbrushf_t *thisbrush_start, const colbrushf_t *thisbrush_end, const colbrushf_t *thatbrush_start, const colbrushf_t *thatbrush_end); void Collision_TraceBrushTriangleMeshFloat(trace_t *trace, const colbrushf_t *thisbrush_start, const colbrushf_t *thisbrush_end, int numtriangles, const int *element3i, const float *vertex3f, int stride, float *bbox6f, int supercontents, int q3surfaceflags, const texture_t *texture, const vec3_t segmentmins, const vec3_t segmentmaxs); void Collision_TraceLineBrushFloat(trace_t *trace, const vec3_t linestart, const vec3_t lineend, const colbrushf_t *thatbrush_start, const colbrushf_t *thatbrush_end); @@ -167,16 +171,16 @@ void Collision_TraceBrushTriangleFloat(trace_t *trace, const colbrushf_t *thisbr // passedict is excluded from clipping checks struct frameblend_s; struct skeleton_s; -void Collision_ClipToGenericEntity(trace_t *trace, dp_model_t *model, const struct frameblend_s *frameblend, const struct skeleton_s *skeleton, const vec3_t bodymins, const vec3_t bodymaxs, int bodysupercontents, matrix4x4_t *matrix, matrix4x4_t *inversematrix, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend); -void Collision_ClipLineToGenericEntity(trace_t *trace, dp_model_t *model, const struct frameblend_s *frameblend, const struct skeleton_s *skeleton, const vec3_t bodymins, const vec3_t bodymaxs, int bodysupercontents, matrix4x4_t *matrix, matrix4x4_t *inversematrix, const vec3_t start, const vec3_t end, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend, qbool hitsurfaces); -void Collision_ClipPointToGenericEntity(trace_t *trace, dp_model_t *model, const struct frameblend_s *frameblend, const struct skeleton_s *skeleton, const vec3_t bodymins, const vec3_t bodymaxs, int bodysupercontents, matrix4x4_t *matrix, matrix4x4_t *inversematrix, const vec3_t start, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask); +void Collision_ClipToGenericEntity(trace_t *trace, struct model_s *model, const struct frameblend_s *frameblend, const struct skeleton_s *skeleton, const vec3_t bodymins, const vec3_t bodymaxs, int bodysupercontents, matrix4x4_t *matrix, matrix4x4_t *inversematrix, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend); +void Collision_ClipLineToGenericEntity(trace_t *trace, struct model_s *model, const struct frameblend_s *frameblend, const struct skeleton_s *skeleton, const vec3_t bodymins, const vec3_t bodymaxs, int bodysupercontents, matrix4x4_t *matrix, matrix4x4_t *inversematrix, const vec3_t start, const vec3_t end, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend, qbool hitsurfaces); +void Collision_ClipPointToGenericEntity(trace_t *trace, struct model_s *model, const struct frameblend_s *frameblend, const struct skeleton_s *skeleton, const vec3_t bodymins, const vec3_t bodymaxs, int bodysupercontents, matrix4x4_t *matrix, matrix4x4_t *inversematrix, const vec3_t start, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask); // like above but does not do a transform and does nothing if model is NULL -void Collision_ClipToWorld(trace_t *trace, dp_model_t *model, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend); -void Collision_ClipLineToWorld(trace_t *trace, dp_model_t *model, const vec3_t start, const vec3_t end, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend, qbool hitsurfaces); -void Collision_ClipPointToWorld(trace_t *trace, dp_model_t *model, const vec3_t start, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask); +void Collision_ClipToWorld(trace_t *trace, struct model_s *model, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend); +void Collision_ClipLineToWorld(trace_t *trace, struct model_s *model, const vec3_t start, const vec3_t end, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend, qbool hitsurfaces); +void Collision_ClipPointToWorld(trace_t *trace, struct model_s *model, const vec3_t start, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask); // caching surface trace for renderer (NOT THREAD SAFE) -void Collision_Cache_ClipLineToGenericEntitySurfaces(trace_t *trace, dp_model_t *model, matrix4x4_t *matrix, matrix4x4_t *inversematrix, const vec3_t start, const vec3_t end, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask); -void Collision_Cache_ClipLineToWorldSurfaces(trace_t *trace, dp_model_t *model, const vec3_t start, const vec3_t end, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask); +void Collision_Cache_ClipLineToGenericEntitySurfaces(trace_t *trace, struct model_s *model, matrix4x4_t *matrix, matrix4x4_t *inversematrix, const vec3_t start, const vec3_t end, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask); +void Collision_Cache_ClipLineToWorldSurfaces(trace_t *trace, struct model_s *model, const vec3_t start, const vec3_t end, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask); // combines data from two traces: // merges contents flags, startsolid, allsolid, inwater // updates fraction, endpos, plane and surface info if new fraction is shorter @@ -190,10 +194,10 @@ void Collision_CombineTraces(trace_t *cliptrace, const trace_t *trace, void *tou // 3 = spew detailed trace flow (bsp tree recursion info) #define COLLISIONPARANOID 0 -extern cvar_t collision_impactnudge; -extern cvar_t collision_extendtracelinelength; -extern cvar_t collision_extendtraceboxlength; -extern cvar_t collision_extendmovelength; -extern cvar_t collision_bih_fullrecursion; +extern struct cvar_s collision_impactnudge; +extern struct cvar_s collision_extendtracelinelength; +extern struct cvar_s collision_extendtraceboxlength; +extern struct cvar_s collision_extendmovelength; +extern struct cvar_s collision_bih_fullrecursion; #endif