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

Function getWaterSurface

src/OpenLoco/src/Paint/PaintSurface.cpp:675–696  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

673 };
674
675 static WaterSurface getWaterSurface(const World::SurfaceElement& elSurface, uint8_t slope)
676 {
677 int16_t height = elSurface.baseHeight();
678 if (elSurface.waterHeight() > height)
679 {
680 height += World::kMicroZStep;
681 if (elSurface.waterHeight() != height
682 || !elSurface.isSlopeDoubleHeight())
683 {
684 // This is the simple case where the water is flat as no
685 // bits of surface breach the water
686 slope = 0;
687 height = elSurface.waterHeight();
688 }
689 else
690 {
691 // Adjust the slope to handle surface breaches
692 slope = Numerics::rotl4bit((slope & 0xF) ^ 0xF, 2);
693 }
694 }
695 return WaterSurface{ .height = height, .slope = slope };
696 }
697
698 // 0x00465F99
699 static void paintSurfaceFullWaterTileSelection(PaintSession& session, const World::SurfaceElement& elSurface, uint8_t slope)

Callers 2

paintSurfaceFunction · 0.85

Calls 4

rotl4bitFunction · 0.85
baseHeightMethod · 0.80
waterHeightMethod · 0.80
isSlopeDoubleHeightMethod · 0.80

Tested by

no test coverage detected