Check if the 'line' collides with entities like mapmodels
| 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 | { |
nothing calls this directly
no test coverage detected