MCPcopy Create free account
hub / github.com/JACoders/OpenJK / G_CheckInSolid

Function G_CheckInSolid

code/game/g_utils.cpp:1262–1302  ·  view source on GitHub ↗

===============================================================================

Source from the content-addressed store, hash-verified

1260
1261//===============================================================================
1262qboolean G_CheckInSolid (gentity_t *self, qboolean fix)
1263{
1264 trace_t trace;
1265 vec3_t end, mins;
1266
1267 VectorCopy(self->currentOrigin, end);
1268 end[2] += self->mins[2];
1269 VectorCopy(self->mins, mins);
1270 mins[2] = 0;
1271
1272 gi.trace(&trace, self->currentOrigin, mins, self->maxs, end, self->s.number, self->clipmask, (EG2_Collision)0, 0);
1273 if(trace.allsolid || trace.startsolid)
1274 {
1275 return qtrue;
1276 }
1277
1278#ifdef _DEBUG
1279 if(trace.fraction < 0.99999713)
1280#else
1281 if(trace.fraction < 1.0)
1282#endif
1283 {
1284 if(fix)
1285 {//Put them at end of trace and check again
1286 vec3_t neworg;
1287
1288 VectorCopy(trace.endpos, neworg);
1289 neworg[2] -= self->mins[2];
1290 G_SetOrigin(self, neworg);
1291 gi.linkentity(self);
1292
1293 return G_CheckInSolid(self, qfalse);
1294 }
1295 else
1296 {
1297 return qtrue;
1298 }
1299 }
1300
1301 return qfalse;
1302}
1303
1304qboolean infront(gentity_t *from, gentity_t *to)
1305{

Callers 5

SP_waypointFunction · 0.70
SP_waypoint_smallFunction · 0.70
SP_waypoint_navgoalFunction · 0.70
NPC_BeginFunction · 0.70
SP_point_combatFunction · 0.70

Calls 2

VectorCopyFunction · 0.85
G_SetOriginFunction · 0.70

Tested by

no test coverage detected