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

Function drawScroll

src/OpenLoco/src/Ui/Windows/MapWindow.cpp:2157–2199  ·  view source on GitHub ↗

0x0046B806

Source from the content-addressed store, hash-verified

2155
2156 // 0x0046B806
2157 static void drawScroll(Window& self, Gfx::DrawingContext& drawingCtx, [[maybe_unused]] const uint32_t scrollIndex)
2158 {
2159 if (!Game::hasFlags(GameStateFlags::tileManagerLoaded))
2160 {
2161 return;
2162 }
2163
2164 drawingCtx.clearSingle(PaletteIndex::black0);
2165
2166 auto* element = Gfx::getG1Element(0);
2167 auto backupElement = *element;
2168
2169 auto* offset = _mapPixels;
2170 if (mapFrameNumber & (1 << 2))
2171 {
2172 offset = _mapAltPixels;
2173 }
2174
2175 Gfx::getG1Element(0)->offset = offset;
2176 Gfx::getG1Element(0)->width = kMapColumns * 2;
2177 Gfx::getG1Element(0)->height = kMapRows * 2;
2178 Gfx::getG1Element(0)->xOffset = 0;
2179 Gfx::getG1Element(0)->yOffset = 0;
2180 Gfx::getG1Element(0)->flags = Gfx::G1ElementFlags::none;
2181
2182 drawingCtx.drawImage(0, 0, 0);
2183
2184 *element = backupElement;
2185
2186 if (self.currentTab + widx::tabOverall == widx::tabVehicles)
2187 {
2188 countVehiclesOnMap();
2189 }
2190
2191 drawVehiclesOnMap(drawingCtx, self.currentTab + widx::tabOverall);
2192
2193 drawViewportPosition(drawingCtx);
2194
2195 if (self.showTownNames)
2196 {
2197 drawTownNames(drawingCtx);
2198 }
2199 }
2200
2201 static constexpr WindowEventList kEvents = {
2202 .onClose = onClose,

Callers

nothing calls this directly

Calls 8

getG1ElementFunction · 0.85
countVehiclesOnMapFunction · 0.85
drawVehiclesOnMapFunction · 0.85
drawViewportPositionFunction · 0.85
clearSingleMethod · 0.80
drawTownNamesFunction · 0.70
hasFlagsFunction · 0.50
drawImageMethod · 0.45

Tested by

no test coverage detected