| 146 | #define DIAG_VISIBLE_THROUGH 0 |
| 147 | |
| 148 | void Landscape::ObjectCollision(CollisionBuffer& retVal, Object* with, const Frame& withPos, bool onlyVehicles) const |
| 149 | { |
| 150 | if (!with->GetShape()->GeometryLevel()) |
| 151 | { |
| 152 | return; // no geometry - no test |
| 153 | } |
| 154 | Vector3Val nPos = withPos.Position(); |
| 155 | Vector3Val oPos = with->Position(); |
| 156 | float radius = with->GetRadius(); |
| 157 | int xMin, xMax, zMin, zMax; |
| 158 | ObjRadiusRectangle(xMin, xMax, zMin, zMax, oPos, nPos, radius); |
| 159 | int x, z; |
| 160 | for (x = xMin; x <= xMax; x++) |
| 161 | { |
| 162 | for (z = zMin; z <= zMax; z++) |
| 163 | { |
| 164 | const ObjectList& list = _objects(x, z); |
| 165 | int n = list.Size(); |
| 166 | for (int i = 0; i < n; i++) |
| 167 | { |
| 168 | Object* obj = list[i]; |
| 169 | if (obj == with) |
| 170 | { |
| 171 | continue; |
| 172 | } |
| 173 | if (obj->GetType() == Network && obj->GetShape()->FindGeometryLevel() < 0) |
| 174 | { |
| 175 | continue; // no collisions with roads |
| 176 | } |
| 177 | if (obj->GetType() == Temporary) |
| 178 | { |
| 179 | continue; // no collisions with temporary |
| 180 | } |
| 181 | if (obj->GetType() == TypeTempVehicle) |
| 182 | { |
| 183 | continue; |
| 184 | } |
| 185 | if (onlyVehicles) |
| 186 | { |
| 187 | if (obj->Static()) |
| 188 | { |
| 189 | continue; |
| 190 | } |
| 191 | } |
| 192 | // do not collide with "soft" dead objects (man bodies, trees) |
| 193 | if (!obj->HasGeometry()) |
| 194 | { |
| 195 | continue; |
| 196 | } |
| 197 | // ObjectCollision(retVal,obj,with,withPos,prec); |
| 198 | obj->Intersect(retVal, with); |
| 199 | } |
| 200 | } |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | struct CheckObjectCollisionContext |
| 205 | { |
no test coverage detected