Skip to content

Commit

Permalink
Added missing *_hull constants
Browse files Browse the repository at this point in the history
  • Loading branch information
WPMGPRoSToTeMa committed Sep 26, 2018
1 parent c8612a6 commit a562637
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 28 deletions.
12 changes: 6 additions & 6 deletions rehlds/HLTV/Core/src/BSPModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
}
Expand Down
10 changes: 5 additions & 5 deletions rehlds/engine/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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];
Expand Down
24 changes: 12 additions & 12 deletions rehlds/engine/pmovetst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}
Expand All @@ -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)
Expand All @@ -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;
}

Expand Down Expand Up @@ -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];
Expand Down
10 changes: 5 additions & 5 deletions rehlds/engine/world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions rehlds/public/rehlds/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

0 comments on commit a562637

Please sign in to comment.