MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / rotateBoundBoxSize

Function rotateBoundBoxSize

src/OpenLoco/src/Paint/Paint.cpp:214–239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212 }
213
214 static constexpr World::Pos3 rotateBoundBoxSize(const World::Pos3& bbSize, const uint8_t rotation)
215 {
216 auto output = bbSize;
217 // This probably rotates the variables so they're relative to rotation 0.
218 // Uses same rotations as directionFlipXAxis
219 switch (rotation)
220 {
221 case 0:
222 output.x--;
223 output.y--;
224 output = World::Pos3{ Math::Vector::rotate(output, 0), output.z };
225 break;
226 case 1:
227 output.x--;
228 output = World::Pos3{ Math::Vector::rotate(output, 3), output.z };
229 break;
230 case 2:
231 output = World::Pos3{ Math::Vector::rotate(output, 2), output.z };
232 break;
233 case 3:
234 output.y--;
235 output = World::Pos3{ Math::Vector::rotate(output, 1), output.z };
236 break;
237 }
238 return output;
239 }
240
241 // 0x004FD140
242 PaintStruct* PaintSession::addToPlotListAsParent(ImageId imageId, const World::Pos3& offset, const World::Pos3& boundBoxOffset, const World::Pos3& boundBoxSize)

Callers 1

Calls 1

rotateFunction · 0.50

Tested by

no test coverage detected