158 | | entity_pos_t x0 = entity_pos_t::FromInt(i).Multiply(Pathfinding::NAVCELL_SIZE); |
159 | | entity_pos_t z0 = entity_pos_t::FromInt(j).Multiply(Pathfinding::NAVCELL_SIZE); |
160 | | entity_pos_t x1 = x0 + Pathfinding::NAVCELL_SIZE; |
161 | | entity_pos_t z1 = z0 + Pathfinding::NAVCELL_SIZE; |
162 | | entity_pos_t nx = Clamp(x, x0, x1); |
163 | | entity_pos_t nz = Clamp(z, z0, z1); |
164 | | if ((CFixedVector2D(nx, nz) - CFixedVector2D(x, z)).CompareLength(hw) <= 0) |
| 158 | if (NavcellContainsCircle(i, j, x, z, hw, true)) |
188 | | entity_pos_t x0 = entity_pos_t::FromInt(i).Multiply(Pathfinding::NAVCELL_SIZE); |
189 | | entity_pos_t z0 = entity_pos_t::FromInt(j).Multiply(Pathfinding::NAVCELL_SIZE); |
190 | | entity_pos_t x1 = x0 + Pathfinding::NAVCELL_SIZE; |
191 | | entity_pos_t z1 = z0 + Pathfinding::NAVCELL_SIZE; |
192 | | entity_pos_t nx = Clamp(x, x0, x1); |
193 | | entity_pos_t nz = Clamp(z, z0, z1); |
194 | | if ((CFixedVector2D(nx, nz) - CFixedVector2D(x, z)).CompareLength(hw) > 0) |
| 182 | if (NavcellContainsCircle(i, j, x, z, hw, false)) |
218 | | entity_pos_t x0 = entity_pos_t::FromInt(i).Multiply(Pathfinding::NAVCELL_SIZE); |
219 | | entity_pos_t z0 = entity_pos_t::FromInt(j).Multiply(Pathfinding::NAVCELL_SIZE); |
220 | | entity_pos_t x1 = x0 + Pathfinding::NAVCELL_SIZE; |
221 | | entity_pos_t z1 = z0 + Pathfinding::NAVCELL_SIZE; |
222 | | entity_pos_t nx = Clamp(x, x0, x1); |
223 | | entity_pos_t nz = Clamp(z, z0, z1); |
224 | | if (Geometry::PointIsInSquare(CFixedVector2D(nx - x, nz - z), u, v, CFixedVector2D(hw, hh))) |
| 206 | if (NavcellContainsSquare(i, j, x, z, u, v, hw, hh, true)) |
248 | | entity_pos_t x0 = entity_pos_t::FromInt(i).Multiply(Pathfinding::NAVCELL_SIZE); |
249 | | entity_pos_t z0 = entity_pos_t::FromInt(j).Multiply(Pathfinding::NAVCELL_SIZE); |
250 | | entity_pos_t x1 = x0 + Pathfinding::NAVCELL_SIZE; |
251 | | entity_pos_t z1 = z0 + Pathfinding::NAVCELL_SIZE; |
252 | | entity_pos_t nx = Clamp(x, x0, x1); |
253 | | entity_pos_t nz = Clamp(z, z0, z1); |
254 | | if (!Geometry::PointIsInSquare(CFixedVector2D(nx - x, nz - z), u, v, CFixedVector2D(hw, hh))) |
| 230 | if (NavcellContainsSquare(i, j, x, z, u, v, hw, hh, false)) |
287 | | entity_pos_t nx = Clamp(x, x0, x1); |
288 | | entity_pos_t nz = Clamp(z, z0, z1); |
289 | | return (CFixedVector2D(nx, nz) - CFixedVector2D(x, z)).CompareLength(hw) > 0; |
| 263 | return ((CFixedVector2D(x0, z0) - CFixedVector2D(x, z)).CompareLength(hw) >= 0 |
| 264 | || (CFixedVector2D(x1, z0) - CFixedVector2D(x, z)).CompareLength(hw) >= 0 |
| 265 | || (CFixedVector2D(x0, z1) - CFixedVector2D(x, z)).CompareLength(hw) >= 0 |
| 266 | || (CFixedVector2D(x1, z1) - CFixedVector2D(x, z)).CompareLength(hw) >= 0); |
301 | | entity_pos_t nx = Clamp(x, x0, x1); |
302 | | entity_pos_t nz = Clamp(z, z0, z1); |
303 | | return !Geometry::PointIsInSquare(CFixedVector2D(nx - x, nz - z), u, v, CFixedVector2D(hw, hh)); |
| 278 | return (!Geometry::PointIsInSquare(CFixedVector2D(x0 - x, z0 - z), u, v, CFixedVector2D(hw, hh)) |
| 279 | || !Geometry::PointIsInSquare(CFixedVector2D(x1 - x, z0 - z), u, v, CFixedVector2D(hw, hh)) |
| 280 | || !Geometry::PointIsInSquare(CFixedVector2D(x0 - x, z1 - z), u, v, CFixedVector2D(hw, hh)) |
| 281 | || !Geometry::PointIsInSquare(CFixedVector2D(x1 - x, z1 - z), u, v, CFixedVector2D(hw, hh))); |