double CalculatePathingCostMultiplyer(CLayerPart pActor, CPoint StartPoint, CPoint EndPoint, CCollideProcessingState pCollideProcessingState) { CFPoint PolyDelta, NormalPos, CenterPos; pActor.GetCollisionCenterPosition(&CenterPos); pActor.GetPosition(&NormalPos); PolyDelta.Minus(CenterPos, NormalPos); CFPoint FPolyStartPoint, FPolyEndPoint; FPolyStartPoint.Set(StartPoint); FPolyEndPoint.Set(EndPoint); FPolyStartPoint -= PolyDelta; FPolyEndPoint -= PolyDelta; CCollideInputs CollideInputs(&FPolyStartPoint, &FPolyEndPoint); uint IsTempExcluded = pActor.GetFlag(CLayerPart::IsTemporarilyExcluded); const_cast<CLayerPart*>(pActor).OrInFlags(CLayerPart::IsTemporarilyExcluded); // <WIP> pEntityMovable should not require a const cast here (many changes would have to be made) pCollideProcessingState.ResetPathingCostMultiplyer(); bool Collision = pActor.GetLayer().SaveData.CheckCollide(pActor.GetpPolygon(0), &FPolyStartPoint, &CollideInputs, pCollideProcessingState, null, null, const_cast<CLayerPart*>(pActor), 0, 0); const_cast<CLayerPart*>(pActor).ClearFlags(CLayerPart::IsTemporarilyExcluded); const_cast<CLayerPart*>(pActor).OrInFlags(IsTempExcluded); if (Collision) { return CCollideOutputs::MIN_COST_RATIO_TO_TREAT_AS_IMPASSABLE; } else { return pCollideProcessingState.GetAndResetPathingCostMultiplyer(); } }