1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-22 14:24:33 +01:00

Draw vehicle halfway for indeterminate progress

This commit is contained in:
Aaron van Geffen
2024-05-20 19:26:42 +02:00
parent 000637a18e
commit 2f05dc9179

View File

@@ -147,12 +147,14 @@ namespace OpenRCT2::Ui::Windows
GfxDrawSprite(clipDPI, variant.track, trackCoords);
GfxDrawSprite(clipDPI, variant.track, trackCoords + ScreenCoordsXY(256, 0));
if (_totalCount == 0)
return;
// Draw vehicle to indicate progress
// Figure out where to position the vehicle to indicate progress
auto* vehicle = GfxGetG1Element(variant.vehicle);
auto position = (-vehicle->width + 2) + (frame_no % width);
int32_t position;
if (_totalCount > 0)
position = (-vehicle->width + 2) + width * _currentProgress / _totalCount;
else
position = (vehicle->width + width) / 2;
GfxDrawSprite(clipDPI, variant.vehicle, ScreenCoordsXY(position, widget.bottom + 1));
}