2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-03-15 23:10:26 +03:00

Fixed missing CONTENTS_* usages

This commit is contained in:
WPMGPRoSToTeMa 2018-09-24 06:05:20 +03:00
parent af457716c4
commit 622ea32b8b

View File

@ -83,7 +83,7 @@ void PM_InitBoxHull(void)
{ {
int side = i & 1; int side = i & 1;
box_clipnodes_0[i].planenum = i; box_clipnodes_0[i].planenum = i;
box_clipnodes_0[i].children[side] = -1; box_clipnodes_0[i].children[side] = CONTENTS_EMPTY;
box_clipnodes_0[i].children[side ^ 1] = (i != 5) ? i + 1 : CONTENTS_SOLID; box_clipnodes_0[i].children[side ^ 1] = (i != 5) ? i + 1 : CONTENTS_SOLID;
box_planes_0[i].type = i >> 1; box_planes_0[i].type = i >> 1;
box_planes_0[i].normal[i >> 1] = 1.0f; box_planes_0[i].normal[i >> 1] = 1.0f;
@ -108,7 +108,7 @@ int EXT_FUNC PM_HullPointContents(hull_t *hull, int num, vec_t *p)
mplane_t *plane; mplane_t *plane;
if (hull->firstclipnode >= hull->lastclipnode) if (hull->firstclipnode >= hull->lastclipnode)
return -1; return CONTENTS_EMPTY;
while (num >= 0) while (num >= 0)
{ {
@ -145,14 +145,14 @@ int PM_LinkContents(vec_t *p, int *pIndex)
test[0] = p[0] - pe->origin[0]; test[0] = p[0] - pe->origin[0];
test[1] = p[1] - pe->origin[1]; test[1] = p[1] - pe->origin[1];
test[2] = p[2] - pe->origin[2]; test[2] = p[2] - pe->origin[2];
if (PM_HullPointContents(model->hulls, model->hulls[0].firstclipnode, test) != -1) { if (PM_HullPointContents(model->hulls, model->hulls[0].firstclipnode, test) != CONTENTS_EMPTY) {
if (pIndex) if (pIndex)
*pIndex = pe->info; *pIndex = pe->info;
return pe->skin; return pe->skin;
} }
} }
return -1; return CONTENTS_EMPTY;
} }
int EXT_FUNC PM_PointContents(vec_t *p, int *truecontents) int EXT_FUNC PM_PointContents(vec_t *p, int *truecontents)
@ -169,23 +169,23 @@ int EXT_FUNC PM_PointContents(vec_t *p, int *truecontents)
p); p);
if (truecontents) if (truecontents)
*truecontents = entityContents; *truecontents = entityContents;
if (entityContents > -9 || entityContents < -14) if (entityContents > CONTENTS_CURRENT_0 || entityContents < CONTENTS_CURRENT_DOWN)
{ {
if (entityContents == -2) if (entityContents == CONTENTS_SOLID)
return entityContents; return entityContents;
} }
else else
{ {
entityContents = -3; entityContents = CONTENTS_WATER;
} }
int cont = PM_LinkContents(p, 0); int cont = PM_LinkContents(p, 0);
if (cont != -1) if (cont != CONTENTS_EMPTY)
return cont; return cont;
return entityContents; return entityContents;
} }
if (truecontents) if (truecontents)
*truecontents = -1; *truecontents = CONTENTS_EMPTY;
return -2; return CONTENTS_SOLID;
} }
int PM_WaterEntity(vec_t *p) int PM_WaterEntity(vec_t *p)
@ -199,8 +199,8 @@ int PM_WaterEntity(vec_t *p)
model_t* model = pmove->physents[0].model; model_t* model = pmove->physents[0].model;
cont = PM_HullPointContents(model->hulls, model->hulls[0].firstclipnode, p); cont = PM_HullPointContents(model->hulls, model->hulls[0].firstclipnode, p);
if (cont == -2) { if (cont == CONTENTS_SOLID) {
return -1; return CONTENTS_EMPTY;
} }
entityIndex = 0; entityIndex = 0;
@ -210,7 +210,7 @@ int PM_WaterEntity(vec_t *p)
int EXT_FUNC PM_TruePointContents(vec_t *p) int EXT_FUNC PM_TruePointContents(vec_t *p)
{ {
if ((int)pmove->physents[0].model == -208) if ((int)pmove->physents[0].model == -208)
return -1; return CONTENTS_EMPTY;
else else
return PM_HullPointContents(pmove->physents[0].model->hulls, pmove->physents[0].model->hulls[0].firstclipnode, p); return PM_HullPointContents(pmove->physents[0].model->hulls, pmove->physents[0].model->hulls[0].firstclipnode, p);
} }
@ -700,7 +700,7 @@ qboolean PM_RecursiveHullCheck(hull_t *hull, int num, float p1f, float p2f, cons
if (!PM_RecursiveHullCheck(hull, node->children[side], p1f, frac, p1, mid, trace)) if (!PM_RecursiveHullCheck(hull, node->children[side], p1f, frac, p1, mid, trace))
return 0; return 0;
if (PM_HullPointContents(hull, node->children[side ^ 1], mid) != -2) if (PM_HullPointContents(hull, node->children[side ^ 1], mid) != CONTENTS_SOLID)
return PM_RecursiveHullCheck(hull, node->children[side ^ 1], frac, p2f, mid, p2, trace); return PM_RecursiveHullCheck(hull, node->children[side ^ 1], frac, p2f, mid, p2, trace);
if (trace->allsolid) if (trace->allsolid)
@ -721,7 +721,7 @@ qboolean PM_RecursiveHullCheck(hull_t *hull, int num, float p1f, float p2f, cons
trace->plane.dist = plane->dist; trace->plane.dist = plane->dist;
} }
if (PM_HullPointContents(hull, hull->firstclipnode, mid) != -2) if (PM_HullPointContents(hull, hull->firstclipnode, mid) != CONTENTS_SOLID)
{ {
trace->fraction = frac; trace->fraction = frac;
trace->endpos[0] = mid[0]; trace->endpos[0] = mid[0];
@ -740,7 +740,7 @@ qboolean PM_RecursiveHullCheck(hull_t *hull, int num, float p1f, float p2f, cons
mid[0] = (p2[0] - p1[0]) * midf + p1[0]; mid[0] = (p2[0] - p1[0]) * midf + p1[0];
mid[1] = (p2[1] - p1[1]) * midf + p1[1]; mid[1] = (p2[1] - p1[1]) * midf + p1[1];
mid[2] = (p2[2] - p1[2]) * midf + p1[2]; mid[2] = (p2[2] - p1[2]) * midf + p1[2];
if (PM_HullPointContents(hull, hull->firstclipnode, mid) != -2) if (PM_HullPointContents(hull, hull->firstclipnode, mid) != CONTENTS_SOLID)
{ {
trace->fraction = frac; trace->fraction = frac;
trace->endpos[0] = mid[0]; trace->endpos[0] = mid[0];
@ -858,7 +858,7 @@ qboolean PM_RecursiveHullCheck(hull_t *hull, int num, float p1f, float p2f, cons
if (!PM_RecursiveHullCheck(hull, node->children[side], p1f, frac, p1, mid, trace)) if (!PM_RecursiveHullCheck(hull, node->children[side], p1f, frac, p1, mid, trace))
return 0; return 0;
if (PM_HullPointContents(hull, node->children[side ^ 1], mid) != -2) if (PM_HullPointContents(hull, node->children[side ^ 1], mid) != CONTENTS_SOLID)
{ {
num = node->children[side ^ 1]; num = node->children[side ^ 1];
p1f = frac; p1f = frac;
@ -887,7 +887,7 @@ qboolean PM_RecursiveHullCheck(hull_t *hull, int num, float p1f, float p2f, cons
trace->plane.dist = plane->dist; trace->plane.dist = plane->dist;
} }
if (PM_HullPointContents(hull, hull->firstclipnode, mid) != -2) if (PM_HullPointContents(hull, hull->firstclipnode, mid) != CONTENTS_SOLID)
{ {
trace->fraction = frac; trace->fraction = frac;
trace->endpos[0] = mid[0]; trace->endpos[0] = mid[0];
@ -906,7 +906,7 @@ qboolean PM_RecursiveHullCheck(hull_t *hull, int num, float p1f, float p2f, cons
mid[0] = (p2[0] - p1[0]) * midf + p1[0]; mid[0] = (p2[0] - p1[0]) * midf + p1[0];
mid[1] = (p2[1] - p1[1]) * midf + p1[1]; mid[1] = (p2[1] - p1[1]) * midf + p1[1];
mid[2] = (p2[2] - p1[2]) * midf + p1[2]; mid[2] = (p2[2] - p1[2]) * midf + p1[2];
if (PM_HullPointContents(hull, hull->firstclipnode, mid) != -2) if (PM_HullPointContents(hull, hull->firstclipnode, mid) != CONTENTS_SOLID)
{ {
trace->fraction = frac; trace->fraction = frac;
trace->endpos[0] = mid[0]; trace->endpos[0] = mid[0];