0x0042B25D
| 1081 | |
| 1082 | // 0x0042B25D |
| 1083 | static void paintBridgeSW(PaintSession& session, const BridgeObject& bridgeObj, const BridgeEntry& bridgeEntry, const int16_t supportLength, const uint8_t slope, const uint8_t pillarSpacing, const SpanImages& spanImages) |
| 1084 | { |
| 1085 | const auto baseHeightOffset = World::Pos3{ 0, 0, bridgeEntry.height }; |
| 1086 | if ((bridgeObj.flags & BridgeObjectFlags::hasRoof) != BridgeObjectFlags::none) |
| 1087 | { |
| 1088 | const auto roofImageIdx = (bridgeEntry.edgesQuarters & 0xF0) == 0xF0 ? Bridge::ImageIds::roofFullTile : spanImages.roof; |
| 1089 | const auto roofImage = bridgeEntry.imageBase.withIndex(bridgeObj.image).withIndexOffset(roofImageIdx); |
| 1090 | constexpr World::Pos3 bbOffset = { 0, 0, 30 }; |
| 1091 | constexpr World::Pos3 bbLength = { 32, 32, 0 }; |
| 1092 | session.addToPlotList4FD150(roofImage, baseHeightOffset, bbOffset + baseHeightOffset, bbLength); |
| 1093 | } |
| 1094 | |
| 1095 | const auto supportLengths = [&session, &bridgeEntry, &bridgeObj, pillarSpacing, supportLength, slope]() -> std::optional<SupportLengths> { |
| 1096 | if ((bridgeEntry.edgesQuarters & ((1U << 6) | (1U << 5))) == ((1U << 6) | (1U << 5))) |
| 1097 | { |
| 1098 | return std::nullopt; |
| 1099 | } |
| 1100 | if (pillarSpacing & (1U << 0)) |
| 1101 | { |
| 1102 | if (session.getSupportHeight(0).height == 0xFFFFU |
| 1103 | || session.getSupportHeight(1).height == 0xFFFFU |
| 1104 | || session.getSupportHeight(5).height == 0xFFFFU) |
| 1105 | { |
| 1106 | return std::nullopt; |
| 1107 | } |
| 1108 | } |
| 1109 | if (pillarSpacing & (1U << 1)) |
| 1110 | { |
| 1111 | if (session.getSupportHeight(2).height == 0xFFFFU |
| 1112 | || session.getSupportHeight(3).height == 0xFFFFU |
| 1113 | || session.getSupportHeight(8).height == 0xFFFFU) |
| 1114 | { |
| 1115 | return std::nullopt; |
| 1116 | } |
| 1117 | } |
| 1118 | |
| 1119 | int16_t unkHeight = supportLength - bridgeObj.deckDepth; |
| 1120 | if (unkHeight < 0) |
| 1121 | { |
| 1122 | return std::nullopt; |
| 1123 | } |
| 1124 | if (bridgeObj.deckDepth == 32) |
| 1125 | { |
| 1126 | unkHeight = bridgeEntry.height - 16; |
| 1127 | if (unkHeight == session.getWaterHeight()) |
| 1128 | { |
| 1129 | return std::nullopt; |
| 1130 | } |
| 1131 | } |
| 1132 | |
| 1133 | const int16_t rhsSupportLength = unkHeight - k4F901C[slope]; |
| 1134 | if (rhsSupportLength < 0) |
| 1135 | { |
| 1136 | return std::nullopt; |
| 1137 | } |
| 1138 | |
| 1139 | const int16_t lhsSupportLength = unkHeight - k4F8FDC[slope]; |
| 1140 | if (lhsSupportLength < 0) |
no test coverage detected