bool CylinderAboveInvalidZone(EERIE_CYLINDER * cyl) { float count = 0; float failcount = 0; for (float rad = 0; rad < cyl->radius; rad += 10.f) for (float ang = 0; ang < 360; ang += 45) { if (rad == 0) ang = 360; EERIE_3D pos; pos.x = cyl->origin.x - EEsin(DEG2RAD(ang)) * rad; pos.y = cyl->origin.y - 20.f; pos.z = cyl->origin.z + EEcos(DEG2RAD(ang)) * rad; EERIEPOLY * ep = ANCHOR_CheckInPoly(pos.x, pos.y, pos.z); if (!ep) continue; if (ep->type & POLY_NOPATH) return true; count += 1.f; float vy; GetTruePolyY(ep, &pos, &vy); if (EEfabs(vy - cyl->origin.y) > 160.f) failcount++; } float failratio = failcount / count; if (failratio > 0.75f) return true; return false; }
bool CylinderAboveInvalidZone(const Cylinder & cyl) { float count = 0; float failcount = 0; for(float rad = 0; rad < cyl.radius; rad += 10.f) { for(float ang = 0; ang < 360; ang += 45) { if(rad == 0) ang = 360; Vec3f pos; pos.x = cyl.origin.x - std::sin(glm::radians(ang)) * rad; pos.y = cyl.origin.y - 20.f; pos.z = cyl.origin.z + std::cos(glm::radians(ang)) * rad; EERIEPOLY * ep = ANCHOR_CheckInPoly(pos); if(!ep) continue; if(ep->type & POLY_NOPATH) return true; count += 1.f; float vy; GetTruePolyY(ep, pos, &vy); if(glm::abs(vy - cyl.origin.y) > 160.f) failcount++; } } float failratio = failcount / count; if(failratio > 0.75f) return true; return false; }