Go to the documentation of this file.
155 for (
i=0 ;
i<
count ;
i++, in++, out++)
159 for (
j=0 ;
j<3 ;
j++)
193 for (
i=0 ;
i<
count ;
i++, in++, out++)
195 strncpy (out->
c.
name, in->texture,
sizeof(out->
c.
name)-1);
196 strncpy (out->
rname, in->texture,
sizeof(out->
rname)-1);
230 for (
i=0 ;
i<
count ;
i++, out++, in++)
233 for (
j=0 ;
j<2 ;
j++)
236 out->children[
j] = child;
266 for (
i=0 ;
i<
count ;
i++, out++, in++)
302 for (
i=0 ;
i<
count ;
i++, in++, out++)
357 for (
i=0 ;
i<
count ;
i++, in++, out++)
360 for (
j=0 ;
j<3 ;
j++)
399 for (
i=0 ;
i<
count ;
i++, in++, out++)
428 for (
i=0 ;
i<
count ;
i++, in++, out++)
462 for (
i=0 ;
i<
count ;
i++, in++, out++)
494 for (
i=0 ;
i<
count ;
i++, in++, out++)
554 static unsigned last_checksum;
560 *checksum = last_checksum;
596 *checksum = last_checksum;
600 ((
int *)&header)[
i] =
LittleLong ( ((
int *)&header)[
i]);
603 Com_Error (
ERR_DROP,
"CMod_LoadBrushModel: %s has wrong version number (%i should be %i)"
669 if (leafnum < 0 || leafnum >=
numleafs)
676 if (leafnum < 0 || leafnum >=
numleafs)
683 if (leafnum < 0 || leafnum >=
numleafs)
733 for (
i=0 ;
i<6 ;
i++)
759 p->
type = 3 + (
i>>1);
949 (angles[0] || angles[1] || angles[2]) )
974 #define DIST_EPSILON (0.03125)
995 float enterfrac, leavefrac;
1018 plane = side->
plane;
1028 for (
j=0 ;
j<3 ;
j++)
1036 dist = plane->
dist - dist;
1052 if (d1 > 0 && d2 >= d1)
1055 if (d1 <= 0 && d2 <= 0)
1084 if (enterfrac < leavefrac)
1086 if (enterfrac > -1 && enterfrac < trace->fraction)
1091 trace->
plane = *clipplane;
1119 plane = side->
plane;
1128 for (
j=0 ;
j<3 ;
j++)
1136 dist = plane->
dist - dist;
1231 float t1, t2, offset;
1254 plane = node->
plane;
1256 if (plane->
type < 3)
1258 t1 = p1[plane->
type] - plane->
dist;
1259 t2 = p2[plane->
type] - plane->
dist;
1282 if (t1 >= offset && t2 >= offset)
1287 if (t1 < -offset && t2 < -offset)
1296 idist = 1.0/(t1-t2);
1303 idist = 1.0/(t1-t2);
1321 midf = p1f + (p2f - p1f)*frac;
1322 for (
i=0 ;
i<3 ;
i++)
1323 mid[
i] = p1[
i] + frac*(p2[
i] - p1[
i]);
1334 midf = p1f + (p2f - p1f)*frac2;
1335 for (
i=0 ;
i<3 ;
i++)
1336 mid[
i] = p1[
i] + frac2*(p2[
i] - p1[
i]);
1352 int headnode,
int brushmask)
1377 if (start[0] == end[0] && start[1] == end[1] && start[2] == end[2])
1386 for (
i=0 ;
i<3 ;
i++)
1406 if (mins[0] == 0 && mins[1] == 0 && mins[2] == 0
1407 && maxs[0] == 0 && maxs[1] == 0 && maxs[2] == 0)
1431 for (
i=0 ;
i<3 ;
i++)
1447 #pragma optimize( "", off )
1453 int headnode,
int brushmask,
1469 (angles[0] || angles[1] || angles[2]) )
1490 trace =
CM_BoxTrace (start_l, end_l, mins, maxs, headnode, brushmask);
1492 if (rotated && trace.
fraction != 1.0)
1504 trace.
endpos[0] = start[0] + trace.
fraction * (end[0] - start[0]);
1505 trace.
endpos[1] = start[1] + trace.
fraction * (end[1] - start[1]);
1506 trace.
endpos[2] = start[2] + trace.
fraction * (end[2] - start[2]);
1512 #pragma optimize( "", on )
1559 if ((out_p - out) + c > row)
1561 c = row - (out_p - out);
1562 Com_DPrintf (
"warning: Vis decompression overrun\n");
1569 }
while (out_p - out < row);
1696 memset (
buffer, 255, bytes);
1700 memset (
buffer, 0, bytes);
1705 if (
map_areas[
i].floodnum == floodnum || !area)
1756 leafnum = -1-nodenum;
1760 if (visbits[cluster>>3] & (1<<(cluster&7)))
trace_t CM_BoxTrace(vec3_t start, vec3_t end, vec3_t mins, vec3_t maxs, int headnode, int brushmask)
void FS_Read(void *buffer, int len, FILE *f)
int CM_PointLeafnum_r(vec3_t p, int num)
void CMod_LoadEntityString(lump_t *l)
short LittleShort(short l)
#define VectorSubtract(a, b, c)
#define BOX_ON_PLANE_SIDE(emins, emaxs, p)
void CMod_LoadVisibility(lump_t *l)
void CM_BoxLeafnums_r(int nodenum)
void CMod_LoadSubmodels(lump_t *l)
mapsurface_t map_surfaces[MAX_MAP_TEXINFO]
dareaportal_t map_areaportals[MAX_MAP_AREAPORTALS]
void CM_RecursiveHullCheck(int num, float p1f, float p2f, vec3_t p1, vec3_t p2)
void CM_WritePortalState(FILE *f)
byte map_visibility[MAX_MAP_VISIBILITY]
qboolean portalopen[MAX_MAP_AREAPORTALS]
int CM_WriteAreaBits(byte *buffer, int area)
int CM_TransformedPointContents(vec3_t p, int headnode, vec3_t origin, vec3_t angles)
cmodel_t map_cmodels[MAX_MAP_MODELS]
cvar_t * Cvar_Get(char *var_name, char *var_value, int flags)
void CM_ClipBoxToBrush(vec3_t mins, vec3_t maxs, vec3_t p1, vec3_t p2, trace_t *trace, cbrush_t *brush)
int CM_LeafArea(int leafnum)
int CM_PointContents(vec3_t p, int headnode)
void AngleVectors(vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
void CM_TestInLeaf(int leafnum)
void CM_DecompressVis(byte *in, byte *out)
void CMod_LoadAreas(lump_t *l)
#define MAX_MAP_LEAFBRUSHES
float LittleFloat(float l)
byte * CM_ClusterPVS(int cluster)
void CMod_LoadBrushSides(lump_t *l)
qboolean CM_AreasConnected(int area1, int area2)
void CMod_LoadLeafBrushes(lump_t *l)
cleaf_t map_leafs[MAX_MAP_LEAFS]
unsigned short numleafbrushes
int FS_LoadFile(char *path, void **buffer)
int CM_LeafContents(int leafnum)
void CMod_LoadNodes(lump_t *l)
#define MAX_MAP_AREAPORTALS
void Com_Error(int code, char *fmt,...)
void FloodArea_r(carea_t *area, int floodnum)
cnode_t map_nodes[MAX_MAP_NODES+6]
cmodel_t * CM_InlineModel(char *name)
void CM_TestBoxInBrush(vec3_t mins, vec3_t maxs, vec3_t p1, trace_t *trace, cbrush_t *brush)
void CM_ReadPortalState(FILE *f)
void CMod_LoadPlanes(lump_t *l)
carea_t map_areas[MAX_MAP_AREAS]
int CM_BoxLeafnums(vec3_t mins, vec3_t maxs, int *list, int listsize, int *topnode)
#define VectorAdd(a, b, c)
#define MAX_MAP_ENTSTRING
unsigned Com_BlockChecksum(void *buffer, int length)
cmodel_t * CM_LoadMap(char *name, qboolean clientload, unsigned *checksum)
byte * CM_ClusterPHS(int cluster)
char * CM_EntityString(void)
cbrush_t map_brushes[MAX_MAP_BRUSHES]
int CM_HeadnodeForBox(vec3_t mins, vec3_t maxs)
cbrushside_t map_brushsides[MAX_MAP_BRUSHSIDES]
int CM_LeafCluster(int leafnum)
char map_entitystring[MAX_MAP_ENTSTRING]
#define MAX_MAP_BRUSHSIDES
void FloodAreaConnections(void)
int CM_NumInlineModels(void)
unsigned short firstleafbrush
void Com_DPrintf(char *fmt,...)
cplane_t map_planes[MAX_MAP_PLANES+6]
void FS_FreeFile(void *buffer)
byte phsrow[MAX_MAP_LEAFS/8]
void CM_TraceToLeaf(int leafnum)
void CM_SetAreaPortalState(int portalnum, qboolean open)
trace_t CM_TransformedBoxTrace(vec3_t start, vec3_t end, vec3_t mins, vec3_t maxs, int headnode, int brushmask, vec3_t origin, vec3_t angles)
int CM_BoxLeafnums_headnode(vec3_t mins, vec3_t maxs, int *list, int listsize, int headnode, int *topnode)
void CMod_LoadAreaPortals(lump_t *l)
qboolean CM_HeadnodeVisible(int nodenum, byte *visbits)
byte pvsrow[MAX_MAP_LEAFS/8]
unsigned short map_leafbrushes[MAX_MAP_LEAFBRUSHES]
void CMod_LoadBrushes(lump_t *l)
#define MAX_MAP_VISIBILITY
int CM_PointLeafnum(vec3_t p)
void CMod_LoadSurfaces(lump_t *l)
#define VectorNegate(a, b)
void CMod_LoadLeafs(lump_t *l)
float Cvar_VariableValue(char *var_name)
void CM_InitBoxHull(void)