MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / ViewportDrawBoundingBoxes

Function ViewportDrawBoundingBoxes

src/viewport.cpp:1738–1751  ·  view source on GitHub ↗

* Draws the bounding boxes of all ParentSprites * @param psd Array of ParentSprites */

Source from the content-addressed store, hash-verified

1736 * @param psd Array of ParentSprites
1737 */
1738static void ViewportDrawBoundingBoxes(const ParentSpriteToSortVector *psd)
1739{
1740 for (const ParentSpriteToDraw *ps : *psd) {
1741 Point pt1 = RemapCoords(ps->xmax + 1, ps->ymax + 1, ps->zmax + 1); // top front corner
1742 Point pt2 = RemapCoords(ps->xmin , ps->ymax + 1, ps->zmax + 1); // top left corner
1743 Point pt3 = RemapCoords(ps->xmax + 1, ps->ymin , ps->zmax + 1); // top right corner
1744 Point pt4 = RemapCoords(ps->xmax + 1, ps->ymax + 1, ps->zmin ); // bottom front corner
1745
1746 DrawBox( pt1.x, pt1.y,
1747 pt2.x - pt1.x, pt2.y - pt1.y,
1748 pt3.x - pt1.x, pt3.y - pt1.y,
1749 pt4.x - pt1.x, pt4.y - pt1.y);
1750 }
1751}
1752
1753/**
1754 * Draw/colour the blocks that have been redrawn.

Callers 1

ViewportDoDrawFunction · 0.85

Calls 2

RemapCoordsFunction · 0.85
DrawBoxFunction · 0.85

Tested by

no test coverage detected