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

Added missing *_hull constants

This commit is contained in:
WPMGPRoSToTeMa 2018-09-24 06:39:12 +03:00
parent 622ea32b8b
commit 2a165a646b
5 changed files with 29 additions and 28 deletions

View File

@ -431,7 +431,7 @@ void BSPModel::Clear()
Free(m_model.surfaces); Free(m_model.surfaces);
Free(m_model.marksurfaces); Free(m_model.marksurfaces);
Free(m_model.clipnodes); Free(m_model.clipnodes);
Free(m_model.hulls[0].clipnodes); Free(m_model.hulls[point_hull].clipnodes);
Free(m_model.texinfo); Free(m_model.texinfo);
if (m_model.textures) if (m_model.textures)
@ -508,7 +508,7 @@ void BSPModel::MakeHull0()
int i, j, count; int i, j, count;
hull_t *hull; hull_t *hull;
hull = &m_model.hulls[0]; hull = &m_model.hulls[point_hull];
in = m_model.nodes; in = m_model.nodes;
count = m_model.numnodes; count = m_model.numnodes;
@ -981,7 +981,7 @@ void BSPModel::LoadClipnodes(lump_t *l)
m_model.clipnodes = out; m_model.clipnodes = out;
m_model.numclipnodes = count; m_model.numclipnodes = count;
hull = &m_model.hulls[1]; hull = &m_model.hulls[human_hull];
hull->clipnodes = out; hull->clipnodes = out;
hull->firstclipnode = 0; hull->firstclipnode = 0;
hull->lastclipnode = count - 1; hull->lastclipnode = count - 1;
@ -993,7 +993,7 @@ void BSPModel::LoadClipnodes(lump_t *l)
hull->clip_maxs[1] = 16; hull->clip_maxs[1] = 16;
hull->clip_maxs[2] = 36; hull->clip_maxs[2] = 36;
hull = &m_model.hulls[2]; hull = &m_model.hulls[large_hull];
hull->clipnodes = out; hull->clipnodes = out;
hull->firstclipnode = 0; hull->firstclipnode = 0;
hull->lastclipnode = count - 1; hull->lastclipnode = count - 1;
@ -1005,7 +1005,7 @@ void BSPModel::LoadClipnodes(lump_t *l)
hull->clip_maxs[1] = 32; hull->clip_maxs[1] = 32;
hull->clip_maxs[2] = 32; hull->clip_maxs[2] = 32;
hull = &m_model.hulls[3]; hull = &m_model.hulls[head_hull];
hull->clipnodes = out; hull->clipnodes = out;
hull->firstclipnode = 0; hull->firstclipnode = 0;
hull->lastclipnode = count - 1; hull->lastclipnode = count - 1;
@ -1027,7 +1027,7 @@ void BSPModel::LoadClipnodes(lump_t *l)
int BSPModel::TruePointContents(vec_t *point) int BSPModel::TruePointContents(vec_t *point)
{ {
hull_t *hull = &m_model.hulls[0]; hull_t *hull = &m_model.hulls[point_hull];
if (hull->firstclipnode >= hull->lastclipnode) { if (hull->firstclipnode >= hull->lastclipnode) {
return CONTENTS_EMPTY; return CONTENTS_EMPTY;
} }

View File

@ -1090,7 +1090,7 @@ void Mod_LoadClipnodes(lump_t *l)
loadmodel->clipnodes = out; loadmodel->clipnodes = out;
loadmodel->numclipnodes = count; loadmodel->numclipnodes = count;
hull = &loadmodel->hulls[1]; hull = &loadmodel->hulls[human_hull];
hull->clipnodes = out; hull->clipnodes = out;
hull->firstclipnode = 0; hull->firstclipnode = 0;
hull->lastclipnode = count - 1; hull->lastclipnode = count - 1;
@ -1102,7 +1102,7 @@ void Mod_LoadClipnodes(lump_t *l)
hull->clip_maxs[1] = 16; hull->clip_maxs[1] = 16;
hull->clip_maxs[2] = 36; hull->clip_maxs[2] = 36;
hull = &loadmodel->hulls[2]; hull = &loadmodel->hulls[large_hull];
hull->clipnodes = out; hull->clipnodes = out;
hull->firstclipnode = 0; hull->firstclipnode = 0;
hull->lastclipnode = count - 1; hull->lastclipnode = count - 1;
@ -1114,7 +1114,7 @@ void Mod_LoadClipnodes(lump_t *l)
hull->clip_maxs[1] = 32; hull->clip_maxs[1] = 32;
hull->clip_maxs[2] = 32; hull->clip_maxs[2] = 32;
hull = &loadmodel->hulls[3]; hull = &loadmodel->hulls[head_hull];
hull->clipnodes = out; hull->clipnodes = out;
hull->firstclipnode = 0; hull->firstclipnode = 0;
hull->lastclipnode = count - 1; hull->lastclipnode = count - 1;
@ -1141,7 +1141,7 @@ void Mod_MakeHull0(void)
int i, j, count; int i, j, count;
hull_t *hull; hull_t *hull;
hull = &loadmodel->hulls[0]; hull = &loadmodel->hulls[point_hull];
in = loadmodel->nodes; in = loadmodel->nodes;
count = loadmodel->numnodes; count = loadmodel->numnodes;
@ -1317,7 +1317,7 @@ void EXT_FUNC Mod_LoadBrushModel_internal(model_t *mod, void *buffer)
{ {
bm = &mod->submodels[i]; bm = &mod->submodels[i];
mod->hulls[0].firstclipnode = bm->headnode[0]; mod->hulls[point_hull].firstclipnode = bm->headnode[point_hull];
for (int j = 1; j < MAX_MAP_HULLS; j++) for (int j = 1; j < MAX_MAP_HULLS; j++)
{ {
mod->hulls[j].firstclipnode = bm->headnode[j]; mod->hulls[j].firstclipnode = bm->headnode[j];

View File

@ -145,7 +145,7 @@ 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) != CONTENTS_EMPTY) { if (PM_HullPointContents(model->hulls, model->hulls[point_hull].firstclipnode, test) != CONTENTS_EMPTY) {
if (pIndex) if (pIndex)
*pIndex = pe->info; *pIndex = pe->info;
return pe->skin; return pe->skin;
@ -165,7 +165,7 @@ int EXT_FUNC PM_PointContents(vec_t *p, int *truecontents)
{ {
int entityContents = PM_HullPointContents( int entityContents = PM_HullPointContents(
pmove->physents[0].model->hulls, pmove->physents[0].model->hulls,
pmove->physents[0].model->hulls[0].firstclipnode, pmove->physents[0].model->hulls[point_hull].firstclipnode,
p); p);
if (truecontents) if (truecontents)
*truecontents = entityContents; *truecontents = entityContents;
@ -198,7 +198,7 @@ int PM_WaterEntity(vec_t *p)
#endif #endif
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[point_hull].firstclipnode, p);
if (cont == CONTENTS_SOLID) { if (cont == CONTENTS_SOLID) {
return CONTENTS_EMPTY; return CONTENTS_EMPTY;
} }
@ -212,7 +212,7 @@ int EXT_FUNC PM_TruePointContents(vec_t *p)
if ((int)pmove->physents[0].model == -208) if ((int)pmove->physents[0].model == -208)
return CONTENTS_EMPTY; 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[point_hull].firstclipnode, p);
} }
hull_t *PM_HullForStudioModel(model_t *pModel, vec_t *offset, float frame, int sequence, const vec_t *angles, const vec_t *origin, const unsigned char *pcontroller, const unsigned char *pblending, int *pNumHulls) hull_t *PM_HullForStudioModel(model_t *pModel, vec_t *offset, float frame, int sequence, const vec_t *angles, const vec_t *origin, const unsigned char *pcontroller, const unsigned char *pblending, int *pNumHulls)
@ -235,19 +235,19 @@ hull_t* EXT_FUNC PM_HullForBsp(physent_t *pe, vec_t *offset)
switch (pmove->usehull) { switch (pmove->usehull) {
case 1: case 1:
hull = &pe->model->hulls[3]; hull = &pe->model->hulls[head_hull];
break; break;
case 2: case 2:
hull = &pe->model->hulls[0]; hull = &pe->model->hulls[point_hull];
break; break;
case 3: case 3:
hull = &pe->model->hulls[2]; hull = &pe->model->hulls[large_hull];
break; break;
default: default:
hull = &pe->model->hulls[1]; hull = &pe->model->hulls[human_hull];
break; break;
} }
@ -405,16 +405,16 @@ pmtrace_t _PM_PlayerTrace(vec_t *start, vec_t *end, int traceFlags, int numphyse
switch (pmove->usehull) switch (pmove->usehull)
{ {
case 1: case 1:
hull = &pe->model->hulls[3]; hull = &pe->model->hulls[head_hull];
break; break;
case 2: case 2:
hull = &pe->model->hulls[0]; hull = &pe->model->hulls[point_hull];
break; break;
case 3: case 3:
hull = &pe->model->hulls[2]; hull = &pe->model->hulls[large_hull];
break; break;
default: default:
hull = &pe->model->hulls[1]; hull = &pe->model->hulls[human_hull];
break; break;
} }
offset[0] = hull->clip_mins[0] - player_mins[pmove->usehull][0]; offset[0] = hull->clip_mins[0] - player_mins[pmove->usehull][0];

View File

@ -190,7 +190,7 @@ hull_t *SV_HullForBsp(edict_t *ent, const vec_t *mins, const vec_t *maxs, vec_t
if (size[0] <= 8.0f) if (size[0] <= 8.0f)
{ {
hull = &model->hulls[0]; hull = &model->hulls[point_hull];
VectorCopy(hull->clip_mins, offset); VectorCopy(hull->clip_mins, offset);
} }
else else
@ -202,13 +202,13 @@ hull_t *SV_HullForBsp(edict_t *ent, const vec_t *mins, const vec_t *maxs, vec_t
#else #else
if (size[2] <= 36.0f) if (size[2] <= 36.0f)
#endif #endif
hull = &model->hulls[3]; hull = &model->hulls[head_hull];
else else
hull = &model->hulls[1]; hull = &model->hulls[human_hull];
} }
else else
{ {
hull = &model->hulls[2]; hull = &model->hulls[large_hull];
} }
// calculate an offset value to center the origin // calculate an offset value to center the origin
@ -1459,7 +1459,7 @@ void SV_SingleClipMoveToPoint(const vec_t *start, const vec_t *end, trace_t *tra
trace->allsolid = TRUE; trace->allsolid = TRUE;
VectorCopy(end, trace->endpos); VectorCopy(end, trace->endpos);
hull_t *hull = &g_psv.models[1]->hulls[0]; // world point hull hull_t *hull = &g_psv.models[1]->hulls[point_hull]; // world point hull
SV_RecursiveHullCheck(hull, hull->firstclipnode, 0.0f, 1.0f, start, end, trace); SV_RecursiveHullCheck(hull, hull->firstclipnode, 0.0f, 1.0f, start, end, trace);
if (trace->fraction != 1.0f) if (trace->fraction != 1.0f)

View File

@ -204,6 +204,7 @@ typedef struct hull_s
int lastclipnode; int lastclipnode;
vec3_t clip_mins, clip_maxs; vec3_t clip_mins, clip_maxs;
} hull_t; } hull_t;
typedef enum { point_hull = 0, human_hull = 1, large_hull = 2, head_hull = 3 };
typedef struct mspriteframe_t typedef struct mspriteframe_t
{ {