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

Function setMapPixels

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

0x0046C544

Source from the content-addressed store, hash-verified

936
937 // 0x0046C544
938 static void setMapPixels(const Window& self)
939 {
940 _flashingItems = self.var_854;
941 auto offset = _drawMapRowIndex * (kRenderedMapWidth - 1) + (kMapRows - 1);
942 auto* mapPtr = &_mapPixels[offset];
943 auto* mapAltPtr = &_mapAltPixels[offset];
944
945 Pos2 pos{};
946 Pos2 delta{};
947 switch (WindowManager::getCurrentRotation())
948 {
949 case 0:
950 pos = Pos2(_drawMapRowIndex * kTileSize, 0);
951 delta = { 0, kTileSize };
952 break;
953 case 1:
954 pos = Pos2(kMapWidth - kTileSize, _drawMapRowIndex * kTileSize);
955 delta = { -kTileSize, 0 };
956 break;
957 case 2:
958 pos = Pos2((kMapColumns - 1 - _drawMapRowIndex) * kTileSize, kMapWidth - kTileSize);
959 delta = { 0, -kTileSize };
960 break;
961 case 3:
962 pos = Pos2(0, (kMapColumns - 1 - _drawMapRowIndex) * kTileSize);
963 delta = { kTileSize, 0 };
964 break;
965 }
966
967 switch (self.currentTab)
968 {
969 case 0: setMapPixelsOverall(mapPtr, mapAltPtr, pos, delta); return;
970 case 1: setMapPixelsVehicles(mapPtr, mapAltPtr, pos, delta); return;
971 case 2: setMapPixelsIndustries(mapPtr, mapAltPtr, pos, delta); return;
972 case 3: setMapPixelsRoutes(mapPtr, mapAltPtr, pos, delta); return;
973 case 4: setMapPixelsOwnership(mapPtr, mapAltPtr, pos, delta); return;
974 }
975 }
976
977 // 0x0046D34D based on
978 static void setHoverItem(Window* self, int16_t y, int index)

Callers 1

onUpdateFunction · 0.85

Calls 6

getCurrentRotationFunction · 0.85
setMapPixelsOverallFunction · 0.85
setMapPixelsVehiclesFunction · 0.85
setMapPixelsIndustriesFunction · 0.85
setMapPixelsRoutesFunction · 0.85
setMapPixelsOwnershipFunction · 0.85

Tested by

no test coverage detected