| 20 | constexpr World::Pos3 kBBSizeBase2x2 = { 38, 38, 0 }; |
| 21 | |
| 22 | static void paintBuildingBuilding(PaintSession& session, const World::BuildingElement& elBuilding, const BuildingObject& buildingObj, const World::Pos3& imageOffset, const World::Pos3& bbOffset, const World::Pos3& bbSize, const ImageId& baseColour, const uint8_t rotation, const bool isMultiTile) |
| 23 | { |
| 24 | // 0xE0C3A0 |
| 25 | auto ticks = ScenarioManager::getScenarioTicks(); |
| 26 | uint8_t numSections = 0xF0; // 0xF0 represents all sections completed |
| 27 | // Only used when under construction |
| 28 | uint8_t sectionProgress = 0; |
| 29 | if (!elBuilding.isConstructed()) |
| 30 | { |
| 31 | ticks = 0; |
| 32 | numSections = elBuilding.age(); |
| 33 | sectionProgress = elBuilding.unk5u(); |
| 34 | } |
| 35 | |
| 36 | uint32_t variation = elBuilding.variation(); |
| 37 | const auto parts = buildingObj.getBuildingParts(variation); |
| 38 | |
| 39 | // 0x00525D4F |
| 40 | uint8_t totalSectionHeight = 0; |
| 41 | if (numSections != 0xF0) |
| 42 | { |
| 43 | int8_t sectionCount = numSections; |
| 44 | const auto partHeights = buildingObj.getBuildingPartHeights(); |
| 45 | for (const auto part : parts) |
| 46 | { |
| 47 | totalSectionHeight += partHeights[part]; |
| 48 | sectionCount--; |
| 49 | if (sectionCount == -1) |
| 50 | { |
| 51 | totalSectionHeight = std::max<uint8_t>(1, totalSectionHeight); |
| 52 | break; |
| 53 | } |
| 54 | } |
| 55 | } |
| 56 | // 0x00525D30 (note this should be combined with a applyGhostToImage) |
| 57 | const auto scaffoldingColour = buildingObj.scaffoldingColour; |
| 58 | |
| 59 | const auto scaffSegType = buildingObj.scaffoldingSegmentType; |
| 60 | if (totalSectionHeight != 0 && scaffSegType != 0xFF) |
| 61 | { |
| 62 | const auto* scaffObj = ObjectManager::get<ScaffoldingObject>(); |
| 63 | const auto segmentHeight = scaffObj->segmentHeights[scaffSegType]; |
| 64 | const auto& scaffImages = isMultiTile ? getScaffoldingImages(scaffSegType).get2x2() : getScaffoldingImages(scaffSegType).get1x1(); |
| 65 | uint32_t baseScaffImageIdx = scaffObj->image; |
| 66 | ImageId baseScaffImage{}; |
| 67 | if (elBuilding.isGhost()) |
| 68 | { |
| 69 | baseScaffImage = Gfx::applyGhostToImage(baseScaffImageIdx); |
| 70 | // TODO: apply company colour if playerCompanyID != elTrack.owner()? |
| 71 | } |
| 72 | else |
| 73 | { |
| 74 | baseScaffImage = ImageId(baseScaffImageIdx, scaffoldingColour); |
| 75 | } |
| 76 | ImageId scaffImage = baseScaffImage.withIndexOffset(scaffImages.back); |
| 77 | auto segmentImageOffset = imageOffset; |
| 78 | for (coord_t remainingHeight = totalSectionHeight; remainingHeight > 0; remainingHeight -= segmentHeight, segmentImageOffset.z += segmentHeight) |
| 79 | { |
no test coverage detected