123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- #include "../game/q_shared.h"
- #include "qcommon.h"
- #include "cm_polylib.h"
- #define MAX_SUBMODELS 256
- #define BOX_MODEL_HANDLE 255
- #define CAPSULE_MODEL_HANDLE 254
- typedef struct {
- cplane_t *plane;
- int children[2];
- } cNode_t;
- typedef struct {
- int cluster;
- int area;
- int firstLeafBrush;
- int numLeafBrushes;
- int firstLeafSurface;
- int numLeafSurfaces;
- } cLeaf_t;
- typedef struct cmodel_s {
- vec3_t mins, maxs;
- cLeaf_t leaf;
- } cmodel_t;
- typedef struct {
- cplane_t *plane;
- int surfaceFlags;
- int shaderNum;
- } cbrushside_t;
- typedef struct {
- int shaderNum;
- int contents;
- vec3_t bounds[2];
- int numsides;
- cbrushside_t *sides;
- int checkcount;
- } cbrush_t;
- typedef struct {
- int checkcount;
- int surfaceFlags;
- int contents;
- struct patchCollide_s *pc;
- } cPatch_t;
- typedef struct {
- int floodnum;
- int floodvalid;
- } cArea_t;
- typedef struct {
- char name[MAX_QPATH];
- int numShaders;
- dshader_t *shaders;
- int numBrushSides;
- cbrushside_t *brushsides;
- int numPlanes;
- cplane_t *planes;
- int numNodes;
- cNode_t *nodes;
- int numLeafs;
- cLeaf_t *leafs;
- int numLeafBrushes;
- int *leafbrushes;
- int numLeafSurfaces;
- int *leafsurfaces;
- int numSubModels;
- cmodel_t *cmodels;
- int numBrushes;
- cbrush_t *brushes;
- int numClusters;
- int clusterBytes;
- byte *visibility;
- qboolean vised;
- int numEntityChars;
- char *entityString;
- int numAreas;
- cArea_t *areas;
- int *areaPortals;
- int numSurfaces;
- cPatch_t **surfaces;
- int floodvalid;
- int checkcount;
- } clipMap_t;
- #define SURFACE_CLIP_EPSILON (0.125)
- extern clipMap_t cm;
- extern int c_pointcontents;
- extern int c_traces, c_brush_traces, c_patch_traces;
- extern cvar_t *cm_noAreas;
- extern cvar_t *cm_noCurves;
- extern cvar_t *cm_playerCurveClip;
- typedef struct
- {
- qboolean use;
- float radius;
- float halfheight;
- vec3_t offset;
- } sphere_t;
- typedef struct {
- vec3_t start;
- vec3_t end;
- vec3_t size[2];
- vec3_t offsets[8];
- float maxOffset;
- vec3_t extents;
- vec3_t bounds[2];
- vec3_t modelOrigin;
- int contents;
- qboolean isPoint;
- trace_t trace;
- sphere_t sphere;
- } traceWork_t;
- typedef struct leafList_s {
- int count;
- int maxcount;
- qboolean overflowed;
- int *list;
- vec3_t bounds[2];
- int lastLeaf;
- void (*storeLeafs)( struct leafList_s *ll, int nodenum );
- } leafList_t;
- int CM_BoxBrushes( const vec3_t mins, const vec3_t maxs, cbrush_t **list, int listsize );
- void CM_StoreLeafs( leafList_t *ll, int nodenum );
- void CM_StoreBrushes( leafList_t *ll, int nodenum );
- void CM_BoxLeafnums_r( leafList_t *ll, int nodenum );
- cmodel_t *CM_ClipHandleToModel( clipHandle_t handle );
- struct patchCollide_s *CM_GeneratePatchCollide( int width, int height, vec3_t *points );
- void CM_TraceThroughPatchCollide( traceWork_t *tw, const struct patchCollide_s *pc );
- qboolean CM_PositionTestInPatchCollide( traceWork_t *tw, const struct patchCollide_s *pc );
- void CM_ClearLevelPatches( void );
|