| 53 | } |
| 54 | |
| 55 | bool CEntity::GetNearestAirPos(vec2 Pos, vec2 PrevPos, vec2 *pOutPos) |
| 56 | { |
| 57 | for(int k = 0; k < 16 && GameServer()->Collision()->CheckPoint(Pos); k++) |
| 58 | { |
| 59 | Pos -= normalize(PrevPos - Pos); |
| 60 | } |
| 61 | |
| 62 | vec2 PosInBlock = vec2(round_to_int(Pos.x) % 32, round_to_int(Pos.y) % 32); |
| 63 | vec2 BlockCenter = vec2(round_to_int(Pos.x), round_to_int(Pos.y)) - PosInBlock + vec2(16.0f, 16.0f); |
| 64 | |
| 65 | *pOutPos = vec2(BlockCenter.x + (PosInBlock.x < 16 ? -2.0f : 1.0f), Pos.y); |
| 66 | if(!GameServer()->Collision()->TestBox(*pOutPos, CCharacterCore::PhysicalSizeVec2())) |
| 67 | return true; |
| 68 | |
| 69 | *pOutPos = vec2(Pos.x, BlockCenter.y + (PosInBlock.y < 16 ? -2.0f : 1.0f)); |
| 70 | if(!GameServer()->Collision()->TestBox(*pOutPos, CCharacterCore::PhysicalSizeVec2())) |
| 71 | return true; |
| 72 | |
| 73 | *pOutPos = vec2(BlockCenter.x + (PosInBlock.x < 16 ? -2.0f : 1.0f), |
| 74 | BlockCenter.y + (PosInBlock.y < 16 ? -2.0f : 1.0f)); |
| 75 | return !GameServer()->Collision()->TestBox(*pOutPos, CCharacterCore::PhysicalSizeVec2()); |
| 76 | } |
| 77 | |
| 78 | bool CEntity::GetNearestAirPosPlayer(vec2 PlayerPos, vec2 *pOutPos) |
| 79 | { |
nothing calls this directly
no test coverage detected