From 2a165a646bbad047e0a42eb5e2a4bb90fcec00fe Mon Sep 17 00:00:00 2001 From: WPMGPRoSToTeMa Date: Mon, 24 Sep 2018 06:39:12 +0300 Subject: [PATCH] Added missing *_hull constants --- rehlds/HLTV/Core/src/BSPModel.cpp | 12 ++++++------ rehlds/engine/model.cpp | 10 +++++----- rehlds/engine/pmovetst.cpp | 24 ++++++++++++------------ rehlds/engine/world.cpp | 10 +++++----- rehlds/public/rehlds/model.h | 1 + 5 files changed, 29 insertions(+), 28 deletions(-) diff --git a/rehlds/HLTV/Core/src/BSPModel.cpp b/rehlds/HLTV/Core/src/BSPModel.cpp index 01c70f282..638b2dec6 100644 --- a/rehlds/HLTV/Core/src/BSPModel.cpp +++ b/rehlds/HLTV/Core/src/BSPModel.cpp @@ -431,7 +431,7 @@ void BSPModel::Clear() Free(m_model.surfaces); Free(m_model.marksurfaces); Free(m_model.clipnodes); - Free(m_model.hulls[0].clipnodes); + Free(m_model.hulls[point_hull].clipnodes); Free(m_model.texinfo); if (m_model.textures) @@ -508,7 +508,7 @@ void BSPModel::MakeHull0() int i, j, count; hull_t *hull; - hull = &m_model.hulls[0]; + hull = &m_model.hulls[point_hull]; in = m_model.nodes; count = m_model.numnodes; @@ -981,7 +981,7 @@ void BSPModel::LoadClipnodes(lump_t *l) m_model.clipnodes = out; m_model.numclipnodes = count; - hull = &m_model.hulls[1]; + hull = &m_model.hulls[human_hull]; hull->clipnodes = out; hull->firstclipnode = 0; hull->lastclipnode = count - 1; @@ -993,7 +993,7 @@ void BSPModel::LoadClipnodes(lump_t *l) hull->clip_maxs[1] = 16; hull->clip_maxs[2] = 36; - hull = &m_model.hulls[2]; + hull = &m_model.hulls[large_hull]; hull->clipnodes = out; hull->firstclipnode = 0; hull->lastclipnode = count - 1; @@ -1005,7 +1005,7 @@ void BSPModel::LoadClipnodes(lump_t *l) hull->clip_maxs[1] = 32; hull->clip_maxs[2] = 32; - hull = &m_model.hulls[3]; + hull = &m_model.hulls[head_hull]; hull->clipnodes = out; hull->firstclipnode = 0; hull->lastclipnode = count - 1; @@ -1027,7 +1027,7 @@ void BSPModel::LoadClipnodes(lump_t *l) 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) { return CONTENTS_EMPTY; } diff --git a/rehlds/engine/model.cpp b/rehlds/engine/model.cpp index 1bc30e7ad..b3c188951 100644 --- a/rehlds/engine/model.cpp +++ b/rehlds/engine/model.cpp @@ -1090,7 +1090,7 @@ void Mod_LoadClipnodes(lump_t *l) loadmodel->clipnodes = out; loadmodel->numclipnodes = count; - hull = &loadmodel->hulls[1]; + hull = &loadmodel->hulls[human_hull]; hull->clipnodes = out; hull->firstclipnode = 0; hull->lastclipnode = count - 1; @@ -1102,7 +1102,7 @@ void Mod_LoadClipnodes(lump_t *l) hull->clip_maxs[1] = 16; hull->clip_maxs[2] = 36; - hull = &loadmodel->hulls[2]; + hull = &loadmodel->hulls[large_hull]; hull->clipnodes = out; hull->firstclipnode = 0; hull->lastclipnode = count - 1; @@ -1114,7 +1114,7 @@ void Mod_LoadClipnodes(lump_t *l) hull->clip_maxs[1] = 32; hull->clip_maxs[2] = 32; - hull = &loadmodel->hulls[3]; + hull = &loadmodel->hulls[head_hull]; hull->clipnodes = out; hull->firstclipnode = 0; hull->lastclipnode = count - 1; @@ -1141,7 +1141,7 @@ void Mod_MakeHull0(void) int i, j, count; hull_t *hull; - hull = &loadmodel->hulls[0]; + hull = &loadmodel->hulls[point_hull]; in = loadmodel->nodes; count = loadmodel->numnodes; @@ -1317,7 +1317,7 @@ void EXT_FUNC Mod_LoadBrushModel_internal(model_t *mod, void *buffer) { 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++) { mod->hulls[j].firstclipnode = bm->headnode[j]; diff --git a/rehlds/engine/pmovetst.cpp b/rehlds/engine/pmovetst.cpp index f9b0f55d8..e8e43727c 100644 --- a/rehlds/engine/pmovetst.cpp +++ b/rehlds/engine/pmovetst.cpp @@ -145,7 +145,7 @@ int PM_LinkContents(vec_t *p, int *pIndex) test[0] = p[0] - pe->origin[0]; test[1] = p[1] - pe->origin[1]; 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) *pIndex = pe->info; return pe->skin; @@ -165,7 +165,7 @@ int EXT_FUNC PM_PointContents(vec_t *p, int *truecontents) { int entityContents = PM_HullPointContents( pmove->physents[0].model->hulls, - pmove->physents[0].model->hulls[0].firstclipnode, + pmove->physents[0].model->hulls[point_hull].firstclipnode, p); if (truecontents) *truecontents = entityContents; @@ -198,7 +198,7 @@ int PM_WaterEntity(vec_t *p) #endif 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) { return CONTENTS_EMPTY; } @@ -212,7 +212,7 @@ int EXT_FUNC PM_TruePointContents(vec_t *p) if ((int)pmove->physents[0].model == -208) return CONTENTS_EMPTY; 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) @@ -235,19 +235,19 @@ hull_t* EXT_FUNC PM_HullForBsp(physent_t *pe, vec_t *offset) switch (pmove->usehull) { case 1: - hull = &pe->model->hulls[3]; + hull = &pe->model->hulls[head_hull]; break; case 2: - hull = &pe->model->hulls[0]; + hull = &pe->model->hulls[point_hull]; break; case 3: - hull = &pe->model->hulls[2]; + hull = &pe->model->hulls[large_hull]; break; default: - hull = &pe->model->hulls[1]; + hull = &pe->model->hulls[human_hull]; break; } @@ -405,16 +405,16 @@ pmtrace_t _PM_PlayerTrace(vec_t *start, vec_t *end, int traceFlags, int numphyse switch (pmove->usehull) { case 1: - hull = &pe->model->hulls[3]; + hull = &pe->model->hulls[head_hull]; break; case 2: - hull = &pe->model->hulls[0]; + hull = &pe->model->hulls[point_hull]; break; case 3: - hull = &pe->model->hulls[2]; + hull = &pe->model->hulls[large_hull]; break; default: - hull = &pe->model->hulls[1]; + hull = &pe->model->hulls[human_hull]; break; } offset[0] = hull->clip_mins[0] - player_mins[pmove->usehull][0]; diff --git a/rehlds/engine/world.cpp b/rehlds/engine/world.cpp index 74ccc3346..06d3ee6d1 100644 --- a/rehlds/engine/world.cpp +++ b/rehlds/engine/world.cpp @@ -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) { - hull = &model->hulls[0]; + hull = &model->hulls[point_hull]; VectorCopy(hull->clip_mins, offset); } else @@ -202,13 +202,13 @@ hull_t *SV_HullForBsp(edict_t *ent, const vec_t *mins, const vec_t *maxs, vec_t #else if (size[2] <= 36.0f) #endif - hull = &model->hulls[3]; + hull = &model->hulls[head_hull]; else - hull = &model->hulls[1]; + hull = &model->hulls[human_hull]; } else { - hull = &model->hulls[2]; + hull = &model->hulls[large_hull]; } // 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; 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); if (trace->fraction != 1.0f) diff --git a/rehlds/public/rehlds/model.h b/rehlds/public/rehlds/model.h index bcb952a9e..542974d36 100644 --- a/rehlds/public/rehlds/model.h +++ b/rehlds/public/rehlds/model.h @@ -204,6 +204,7 @@ typedef struct hull_s int lastclipnode; vec3_t clip_mins, clip_maxs; } hull_t; +typedef enum { point_hull = 0, human_hull = 1, large_hull = 2, head_hull = 3 }; typedef struct mspriteframe_t {