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

Function drawVehicleInline

src/OpenLoco/src/Vehicles/VehicleDraw.cpp:571–607  ·  view source on GitHub ↗

0x004B7711 & 0x004B745B

Source from the content-addressed store, hash-verified

569
570 // 0x004B7711 & 0x004B745B
571 int16_t drawVehicleInline(Gfx::DrawingContext& drawingCtx, int16_t vehicleTypeIdx, CompanyId company, Ui::Point loc)
572 {
573 // This has been simplified from vanilla.
574
575 loc.y += 19;
576 auto* vehObject = ObjectManager::get<VehicleObject>(vehicleTypeIdx);
577
578 loc.y += getVehicleObjectYDisplayOffset(*vehObject);
579
580 auto colourScheme = getCompanyVehicleColourScheme(company, *vehObject);
581
582 const auto yaw = 40;
583
584 const auto drawItems = getDrawItemsForVehicle(*vehObject, yaw, 0, colourScheme);
585
586 auto screenDistDrawItems = toScreenDistDrawItems(drawItems, yaw);
587
588 // Draw all bogies
589 for (auto& item : screenDistDrawItems.items)
590 {
591 if (item.isBody)
592 {
593 continue;
594 }
595 drawingCtx.drawImage(loc + Ui::Point(item.dist, 0), item.image);
596 }
597 // Then draw the bodies
598 for (auto& item : screenDistDrawItems.items)
599 {
600 if (!item.isBody)
601 {
602 continue;
603 }
604 drawingCtx.drawImage(loc + Ui::Point(item.dist, 0), item.image);
605 }
606 return screenDistDrawItems.totalDistance;
607 }
608
609 // 0x004B6D93
610 int16_t drawVehicleInline(Gfx::DrawingContext& drawingCtx, const Vehicles::Car& car, Ui::Point loc, VehicleInlineMode mode, VehiclePartsToDraw parts, std::optional<Colour> disabled)

Callers 4

drawScrollFunction · 0.85
drawScrollFunction · 0.85
drawFunction · 0.85
drawTrainInlineFunction · 0.85

Calls 8

getDrawItemsForVehicleFunction · 0.85
toScreenDistDrawItemsFunction · 0.85
getShadeFunction · 0.85
valueMethod · 0.80
drawImageSolidMethod · 0.80
drawImageMethod · 0.45

Tested by

no test coverage detected