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

Function drawVehicleOverview

src/OpenLoco/src/Vehicles/VehicleDraw.cpp:482–524  ·  view source on GitHub ↗

0x004B777B

Source from the content-addressed store, hash-verified

480
481 // 0x004B777B
482 void drawVehicleOverview(Gfx::DrawingContext& drawingCtx, Ui::Point offset, const VehicleObject& vehObject, const uint8_t yaw, const uint8_t roll, const ColourScheme colourScheme)
483 {
484 offset.y += getVehicleObjectYDisplayOffset(vehObject);
485
486 // 0x01136152 stores offset.x
487 // 0x01136154 stores offset.y
488
489 const auto drawItems = getDrawItemsForVehicle(vehObject, yaw, roll, colourScheme);
490
491 const auto midDist = drawItems.totalDistance / 2;
492
493 // First draw all the bogies
494 for (auto& item : drawItems.items)
495 {
496 if (!item.isBody)
497 {
498 drawItem(drawingCtx, offset, item, midDist, yaw);
499 }
500 }
501
502 // Then draw the bodies forward/backward depending on where we are in the rotation
503 if (yaw >= 8 && yaw < 40)
504 {
505 for (auto iter = drawItems.items.rbegin(); iter != drawItems.items.rend(); ++iter)
506 {
507 auto& item = *iter;
508 if (item.isBody)
509 {
510 drawItem(drawingCtx, offset, item, midDist, yaw);
511 }
512 }
513 }
514 else
515 {
516 for (auto& item : drawItems.items)
517 {
518 if (item.isBody)
519 {
520 drawItem(drawingCtx, offset, item, midDist, yaw);
521 }
522 }
523 }
524 }
525
526 static ColourScheme getCompanyVehicleColourScheme(CompanyId companyId, const VehicleObject& vehObject)
527 {

Callers 3

drawScrollFunction · 0.85
drawNewsSubjectImagesFunction · 0.85
drawPreviewImageMethod · 0.85

Calls 6

getDrawItemsForVehicleFunction · 0.85
drawItemFunction · 0.85
rbeginMethod · 0.80
rendMethod · 0.80

Tested by

no test coverage detected