void doCheck() { double radius; // Get list of lines to check vector<MapLine*> check_lines; MapLine* line; for (unsigned a = 0; a < map->nLines(); a++) { line = map->getLine(a); // Skip if line is 2-sided and not blocking if (line->s2() && !theGameConfiguration->lineBasicFlagSet("blocking", line, map->currentFormat())) continue; check_lines.push_back(line); } // Go through things for (unsigned a = 0; a < map->nThings(); a++) { MapThing* thing = map->getThing(a); ThingType* tt = theGameConfiguration->thingType(thing->getType()); // Skip if not a solid thing if (!tt->isSolid()) continue; radius = tt->getRadius() - 1; // Go through lines for (unsigned b = 0; b < check_lines.size(); b++) { line = check_lines[b]; // Check intersection if (MathStuff::boxLineIntersect(thing->xPos() - radius, thing->yPos() - radius, thing->xPos() + radius, thing->yPos() + radius, line->x1(), line->y1(), line->x2(), line->y2())) { things.push_back(thing); lines.push_back(line); break; } } } }