MCPcopy Create free account
hub / github.com/assaultcube/AC / loopv

Function loopv

source/src/bot/bot_util.cpp:187–206  ·  view source on GitHub ↗

Check if the 'line' collides with entities like mapmodels

Source from the content-addressed store, hash-verified

185
186 // Check if the 'line' collides with entities like mapmodels
187 loopv(ents)
188 {
189 entity &e = ents[i];
190 if(e.type!=MAPMODEL) continue; // Only check map models for now
191
192 mapmodelinfo *mmi = getmminfo(e.attr2);
193 if(!mmi || !mmi->h) continue;
194
195 float lo = (float)(S(e.x, e.y)->floor + mmi->zoff + e.attr3);
196 float hi = lo + mmi->h;
197 float z = (fabs(from.z-lo) < fabs(from.z-hi)) ? lo : hi;
198 makevec(&v, e.x, e.y, z);
199 flDist = GetDistance(from, v);
200
201 if ((flDist < flNearestDist) && (intersect(&e, from, to, &tr->end)))
202 {
203 flNearestDist = GetDistance(from, tr->end);
204 tr->collided = true;
205 }
206 }
207
208 if (CheckPlayers)
209 {

Callers

nothing calls this directly

Calls 4

getmminfoFunction · 0.85
makevecFunction · 0.85
GetDistanceFunction · 0.85
intersectFunction · 0.85

Tested by

no test coverage detected