Skip to content

Commit 2a165a6

Browse files
Added missing *_hull constants
1 parent 622ea32 commit 2a165a6

File tree

5 files changed

+29
-28
lines changed

5 files changed

+29
-28
lines changed

rehlds/HLTV/Core/src/BSPModel.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ void BSPModel::Clear()
431431
Free(m_model.surfaces);
432432
Free(m_model.marksurfaces);
433433
Free(m_model.clipnodes);
434-
Free(m_model.hulls[0].clipnodes);
434+
Free(m_model.hulls[point_hull].clipnodes);
435435
Free(m_model.texinfo);
436436

437437
if (m_model.textures)
@@ -508,7 +508,7 @@ void BSPModel::MakeHull0()
508508
int i, j, count;
509509
hull_t *hull;
510510

511-
hull = &m_model.hulls[0];
511+
hull = &m_model.hulls[point_hull];
512512

513513
in = m_model.nodes;
514514
count = m_model.numnodes;
@@ -981,7 +981,7 @@ void BSPModel::LoadClipnodes(lump_t *l)
981981
m_model.clipnodes = out;
982982
m_model.numclipnodes = count;
983983

984-
hull = &m_model.hulls[1];
984+
hull = &m_model.hulls[human_hull];
985985
hull->clipnodes = out;
986986
hull->firstclipnode = 0;
987987
hull->lastclipnode = count - 1;
@@ -993,7 +993,7 @@ void BSPModel::LoadClipnodes(lump_t *l)
993993
hull->clip_maxs[1] = 16;
994994
hull->clip_maxs[2] = 36;
995995

996-
hull = &m_model.hulls[2];
996+
hull = &m_model.hulls[large_hull];
997997
hull->clipnodes = out;
998998
hull->firstclipnode = 0;
999999
hull->lastclipnode = count - 1;
@@ -1005,7 +1005,7 @@ void BSPModel::LoadClipnodes(lump_t *l)
10051005
hull->clip_maxs[1] = 32;
10061006
hull->clip_maxs[2] = 32;
10071007

1008-
hull = &m_model.hulls[3];
1008+
hull = &m_model.hulls[head_hull];
10091009
hull->clipnodes = out;
10101010
hull->firstclipnode = 0;
10111011
hull->lastclipnode = count - 1;
@@ -1027,7 +1027,7 @@ void BSPModel::LoadClipnodes(lump_t *l)
10271027

10281028
int BSPModel::TruePointContents(vec_t *point)
10291029
{
1030-
hull_t *hull = &m_model.hulls[0];
1030+
hull_t *hull = &m_model.hulls[point_hull];
10311031
if (hull->firstclipnode >= hull->lastclipnode) {
10321032
return CONTENTS_EMPTY;
10331033
}

rehlds/engine/model.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ void Mod_LoadClipnodes(lump_t *l)
10901090
loadmodel->clipnodes = out;
10911091
loadmodel->numclipnodes = count;
10921092

1093-
hull = &loadmodel->hulls[1];
1093+
hull = &loadmodel->hulls[human_hull];
10941094
hull->clipnodes = out;
10951095
hull->firstclipnode = 0;
10961096
hull->lastclipnode = count - 1;
@@ -1102,7 +1102,7 @@ void Mod_LoadClipnodes(lump_t *l)
11021102
hull->clip_maxs[1] = 16;
11031103
hull->clip_maxs[2] = 36;
11041104

1105-
hull = &loadmodel->hulls[2];
1105+
hull = &loadmodel->hulls[large_hull];
11061106
hull->clipnodes = out;
11071107
hull->firstclipnode = 0;
11081108
hull->lastclipnode = count - 1;
@@ -1114,7 +1114,7 @@ void Mod_LoadClipnodes(lump_t *l)
11141114
hull->clip_maxs[1] = 32;
11151115
hull->clip_maxs[2] = 32;
11161116

1117-
hull = &loadmodel->hulls[3];
1117+
hull = &loadmodel->hulls[head_hull];
11181118
hull->clipnodes = out;
11191119
hull->firstclipnode = 0;
11201120
hull->lastclipnode = count - 1;
@@ -1141,7 +1141,7 @@ void Mod_MakeHull0(void)
11411141
int i, j, count;
11421142
hull_t *hull;
11431143

1144-
hull = &loadmodel->hulls[0];
1144+
hull = &loadmodel->hulls[point_hull];
11451145

11461146
in = loadmodel->nodes;
11471147
count = loadmodel->numnodes;
@@ -1317,7 +1317,7 @@ void EXT_FUNC Mod_LoadBrushModel_internal(model_t *mod, void *buffer)
13171317
{
13181318
bm = &mod->submodels[i];
13191319

1320-
mod->hulls[0].firstclipnode = bm->headnode[0];
1320+
mod->hulls[point_hull].firstclipnode = bm->headnode[point_hull];
13211321
for (int j = 1; j < MAX_MAP_HULLS; j++)
13221322
{
13231323
mod->hulls[j].firstclipnode = bm->headnode[j];

rehlds/engine/pmovetst.cpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ int PM_LinkContents(vec_t *p, int *pIndex)
145145
test[0] = p[0] - pe->origin[0];
146146
test[1] = p[1] - pe->origin[1];
147147
test[2] = p[2] - pe->origin[2];
148-
if (PM_HullPointContents(model->hulls, model->hulls[0].firstclipnode, test) != CONTENTS_EMPTY) {
148+
if (PM_HullPointContents(model->hulls, model->hulls[point_hull].firstclipnode, test) != CONTENTS_EMPTY) {
149149
if (pIndex)
150150
*pIndex = pe->info;
151151
return pe->skin;
@@ -165,7 +165,7 @@ int EXT_FUNC PM_PointContents(vec_t *p, int *truecontents)
165165
{
166166
int entityContents = PM_HullPointContents(
167167
pmove->physents[0].model->hulls,
168-
pmove->physents[0].model->hulls[0].firstclipnode,
168+
pmove->physents[0].model->hulls[point_hull].firstclipnode,
169169
p);
170170
if (truecontents)
171171
*truecontents = entityContents;
@@ -198,7 +198,7 @@ int PM_WaterEntity(vec_t *p)
198198
#endif
199199

200200
model_t* model = pmove->physents[0].model;
201-
cont = PM_HullPointContents(model->hulls, model->hulls[0].firstclipnode, p);
201+
cont = PM_HullPointContents(model->hulls, model->hulls[point_hull].firstclipnode, p);
202202
if (cont == CONTENTS_SOLID) {
203203
return CONTENTS_EMPTY;
204204
}
@@ -212,7 +212,7 @@ int EXT_FUNC PM_TruePointContents(vec_t *p)
212212
if ((int)pmove->physents[0].model == -208)
213213
return CONTENTS_EMPTY;
214214
else
215-
return PM_HullPointContents(pmove->physents[0].model->hulls, pmove->physents[0].model->hulls[0].firstclipnode, p);
215+
return PM_HullPointContents(pmove->physents[0].model->hulls, pmove->physents[0].model->hulls[point_hull].firstclipnode, p);
216216
}
217217

218218
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)
235235

236236
switch (pmove->usehull) {
237237
case 1:
238-
hull = &pe->model->hulls[3];
238+
hull = &pe->model->hulls[head_hull];
239239
break;
240240

241241
case 2:
242-
hull = &pe->model->hulls[0];
242+
hull = &pe->model->hulls[point_hull];
243243
break;
244244

245245
case 3:
246-
hull = &pe->model->hulls[2];
246+
hull = &pe->model->hulls[large_hull];
247247
break;
248248

249249
default:
250-
hull = &pe->model->hulls[1];
250+
hull = &pe->model->hulls[human_hull];
251251
break;
252252
}
253253

@@ -405,16 +405,16 @@ pmtrace_t _PM_PlayerTrace(vec_t *start, vec_t *end, int traceFlags, int numphyse
405405
switch (pmove->usehull)
406406
{
407407
case 1:
408-
hull = &pe->model->hulls[3];
408+
hull = &pe->model->hulls[head_hull];
409409
break;
410410
case 2:
411-
hull = &pe->model->hulls[0];
411+
hull = &pe->model->hulls[point_hull];
412412
break;
413413
case 3:
414-
hull = &pe->model->hulls[2];
414+
hull = &pe->model->hulls[large_hull];
415415
break;
416416
default:
417-
hull = &pe->model->hulls[1];
417+
hull = &pe->model->hulls[human_hull];
418418
break;
419419
}
420420
offset[0] = hull->clip_mins[0] - player_mins[pmove->usehull][0];

rehlds/engine/world.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ hull_t *SV_HullForBsp(edict_t *ent, const vec_t *mins, const vec_t *maxs, vec_t
190190

191191
if (size[0] <= 8.0f)
192192
{
193-
hull = &model->hulls[0];
193+
hull = &model->hulls[point_hull];
194194
VectorCopy(hull->clip_mins, offset);
195195
}
196196
else
@@ -202,13 +202,13 @@ hull_t *SV_HullForBsp(edict_t *ent, const vec_t *mins, const vec_t *maxs, vec_t
202202
#else
203203
if (size[2] <= 36.0f)
204204
#endif
205-
hull = &model->hulls[3];
205+
hull = &model->hulls[head_hull];
206206
else
207-
hull = &model->hulls[1];
207+
hull = &model->hulls[human_hull];
208208
}
209209
else
210210
{
211-
hull = &model->hulls[2];
211+
hull = &model->hulls[large_hull];
212212
}
213213

214214
// 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
14591459
trace->allsolid = TRUE;
14601460
VectorCopy(end, trace->endpos);
14611461

1462-
hull_t *hull = &g_psv.models[1]->hulls[0]; // world point hull
1462+
hull_t *hull = &g_psv.models[1]->hulls[point_hull]; // world point hull
14631463
SV_RecursiveHullCheck(hull, hull->firstclipnode, 0.0f, 1.0f, start, end, trace);
14641464

14651465
if (trace->fraction != 1.0f)

rehlds/public/rehlds/model.h

+1
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ typedef struct hull_s
204204
int lastclipnode;
205205
vec3_t clip_mins, clip_maxs;
206206
} hull_t;
207+
typedef enum { point_hull = 0, human_hull = 1, large_hull = 2, head_hull = 3 };
207208

208209
typedef struct mspriteframe_t
209210
{

0 commit comments

Comments
 (0)