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

Function paintSupportNE

src/OpenLoco/src/Paint/PaintBridge.cpp:771–828  ·  view source on GitHub ↗

0x0042BF7F

Source from the content-addressed store, hash-verified

769
770 // 0x0042BF7F
771 static void paintSupportNE(PaintSession& session, const BridgeObject& bridgeObj, const BridgeEntry& bridgeEntry, const uint8_t pillarSpacing, int16_t lhsSupportLength, int16_t rhsSupportLength, const int16_t supportHeight, const uint32_t supportEdgeLhsImage, const uint32_t supportEdgeRhsImage)
772 {
773 if (pillarSpacing & (1U << 0))
774 {
775 auto lhsSupportHeight = supportHeight;
776 while (lhsSupportLength >= 16)
777 {
778 const bool is16section = lhsSupportLength == 16 || ((lhsSupportHeight - 16) == session.getWaterHeight());
779 const int16_t sectionHeight = is16section ? 16 : 32;
780 const auto bbLength = is16section ? World::Pos3{ 2, 32, 15 } : World::Pos3{ 2, 32, 31 };
781 const auto imageIndex = is16section ? Bridge::ImageIds::supportSegmentLhs16NE : Bridge::ImageIds::supportSegmentLhs32NE;
782
783 lhsSupportLength -= sectionHeight;
784 lhsSupportHeight -= sectionHeight;
785 const auto supportSectionImage = bridgeEntry.imageBase.withIndex(bridgeObj.image).withIndexOffset(imageIndex);
786 const auto heightOffset = World::Pos3{ 0, 0, lhsSupportHeight };
787 constexpr World::Pos3 bbOffset = { 0, 0, 0 };
788 session.addToPlotList4FD150(supportSectionImage, heightOffset, bbOffset + heightOffset, bbLength);
789 }
790 if (supportEdgeLhsImage != 0)
791 {
792 lhsSupportHeight -= 16;
793 const auto image = bridgeEntry.imageBase.withIndex(bridgeObj.image).withIndexOffset(supportEdgeLhsImage);
794 const auto heightOffset = World::Pos3{ 0, 0, lhsSupportHeight };
795 constexpr World::Pos3 bbOffset = { 0, 0, 0 };
796 constexpr World::Pos3 bbLength = { 2, 32, 14 };
797 session.addToPlotList4FD150(image, heightOffset, bbOffset + heightOffset, bbLength);
798 }
799 }
800
801 if (pillarSpacing & (1U << 1))
802 {
803 auto rhsSupportHeight = supportHeight;
804 while (rhsSupportLength >= 16)
805 {
806 const bool is16section = rhsSupportLength == 16 || ((rhsSupportHeight - 16) == session.getWaterHeight());
807 const int16_t sectionHeight = is16section ? 16 : 32;
808 const auto bbLength = is16section ? World::Pos3{ 2, 32, 15 } : World::Pos3{ 2, 32, 31 };
809 const auto imageIndex = is16section ? Bridge::ImageIds::supportSegmentRhs16NE : Bridge::ImageIds::supportSegmentRhs32NE;
810
811 rhsSupportLength -= sectionHeight;
812 rhsSupportHeight -= sectionHeight;
813 const auto supportSectionImage = bridgeEntry.imageBase.withIndex(bridgeObj.image).withIndexOffset(imageIndex);
814 const auto heightOffset = World::Pos3{ 0, 0, rhsSupportHeight };
815 constexpr World::Pos3 bbOffset = { 30, 0, 0 };
816 session.addToPlotList4FD150(supportSectionImage, heightOffset, bbOffset + heightOffset, bbLength);
817 }
818 if (supportEdgeRhsImage != 0)
819 {
820 rhsSupportHeight -= 16;
821 const auto image = bridgeEntry.imageBase.withIndex(bridgeObj.image).withIndexOffset(supportEdgeRhsImage);
822 const auto heightOffset = World::Pos3{ 0, 0, rhsSupportHeight };
823 constexpr World::Pos3 bbOffset = { 30, 0, 0 };
824 constexpr World::Pos3 bbLength = { 2, 32, 14 };
825 session.addToPlotList4FD150(image, heightOffset, bbOffset + heightOffset, bbLength);
826 }
827 }
828 }

Callers 1

paintBridgeNEFunction · 0.85

Calls 4

getWaterHeightMethod · 0.80
withIndexOffsetMethod · 0.80
withIndexMethod · 0.80
addToPlotList4FD150Method · 0.80

Tested by

no test coverage detected