0x0048B86E
| 50 | |
| 51 | // 0x0048B86E |
| 52 | void paintDocks(PaintSession& session, const World::StationElement& elStation) |
| 53 | { |
| 54 | session.setItemType(Ui::ViewportInteraction::InteractionItem::dock); |
| 55 | |
| 56 | auto* dockObj = ObjectManager::get<DockObject>(elStation.objectId()); |
| 57 | |
| 58 | const auto companyColour = CompanyManager::getCompanyColour(elStation.owner()); |
| 59 | |
| 60 | ImageId baseColour(0, companyColour); |
| 61 | if (elStation.isGhost()) |
| 62 | { |
| 63 | session.setItemType(Ui::ViewportInteraction::InteractionItem::noInteraction); |
| 64 | baseColour = Gfx::applyGhostToImage(0); |
| 65 | |
| 66 | // TODO: apply company colour if playerCompanyID != elTrack.owner()?s |
| 67 | } |
| 68 | |
| 69 | // Combine this with any imageId |
| 70 | const auto rotation = (session.getRotation() + elStation.rotation()) & 0x3; |
| 71 | |
| 72 | const int16_t bbLengthZ = std::min(elStation.clearHeight() - elStation.baseHeight(), 128) - 2; |
| 73 | |
| 74 | const auto baseHeight = elStation.baseHeight(); |
| 75 | |
| 76 | const auto variation = elStation.buildingType(); |
| 77 | |
| 78 | // Note: Image offsets will change as you move up the building but bboffset/size does not |
| 79 | const World::Pos3 imageOffset = kImageOffsetBase2x2 + World::Pos3{ 0, 0, baseHeight }; |
| 80 | const World::Pos3 bbOffset = kBBOffsetBase2x2 + World::Pos3{ 0, 0, baseHeight }; |
| 81 | const World::Pos3 bbSize = kBBSizeBase2x2 + World::Pos3{ 0, 0, bbLengthZ }; |
| 82 | |
| 83 | session.resetLastPS(); // Odd... |
| 84 | if (dockObj->hasFlags(DockObjectFlags::hasShadows)) |
| 85 | { |
| 86 | if (session.getRenderTarget()->zoomLevel <= 1) |
| 87 | { |
| 88 | const auto shadowImageOffset = variation * 4 + dockObj->image + rotation + 1; |
| 89 | const ImageId shadowImage = ImageId(shadowImageOffset).withTranslucency(Colours::getShadow(Colour::orange)); |
| 90 | |
| 91 | session.addToPlotListAsChild(shadowImage, imageOffset, bbOffset, bbSize); |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | const auto sequenceIndex = elStation.sequenceIndex(); |
| 96 | // Only the front of the 2x2 area will draw. Images are sized to overlap into the other tiles. |
| 97 | if ((sequenceIndex ^ (1 << 1)) == ((-session.getRotation()) & 0x3)) |
| 98 | { |
| 99 | paintDocksBuilding(session, elStation, *dockObj, imageOffset, bbOffset, bbSize, baseColour, rotation); |
| 100 | } |
| 101 | session.setSegmentsSupportHeight(SegmentFlags::all, 0xFFFF, 0); |
| 102 | session.setGeneralSupportHeight(0xFFFF, 0); // TODO: Check if this works previously would not set slope to zero |
| 103 | } |
| 104 | } |
no test coverage detected