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

Function isPixelPresentRLE

src/OpenLoco/src/Paint/Paint.cpp:1133–1154  ·  view source on GitHub ↗

0x00447D26

Source from the content-addressed store, hash-verified

1131
1132 // 0x00447D26
1133 static bool isPixelPresentRLE(const Gfx::G1Element& g1, const Ui::Point& coords)
1134 {
1135 const uint16_t* data16 = reinterpret_cast<const uint16_t*>(g1.offset);
1136 uint16_t startOffset = data16[coords.y];
1137 const uint8_t* data8 = static_cast<const uint8_t*>(g1.offset) + startOffset;
1138
1139 bool lastDataLine = false;
1140 while (!lastDataLine)
1141 {
1142 int32_t numPixels = *data8++;
1143 uint8_t pixelRunStart = *data8++;
1144 lastDataLine = numPixels & 0x80;
1145 numPixels &= 0x7F;
1146 data8 += numPixels;
1147
1148 if (pixelRunStart <= coords.x && coords.x < pixelRunStart + numPixels)
1149 {
1150 return true;
1151 }
1152 }
1153 return false;
1154 }
1155
1156 // 0x00447A5F
1157 static bool isSpriteInteractedWithPaletteSet(const Gfx::RenderTarget* rt, ImageId imageId, const Ui::Point& coords, const Gfx::PaletteMap::View paletteMap)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected