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

Function locationToMapWindowPos

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

Source from the content-addressed store, hash-verified

150 }
151
152 static Point locationToMapWindowPos(Pos2 pos)
153 {
154 int32_t x = pos.x;
155 int32_t y = pos.y;
156
157 switch (getCurrentRotation())
158 {
159 case 3:
160 std::swap(x, y);
161 x = kMapWidth - 1 - x;
162 break;
163 case 2:
164 x = kMapWidth - 1 - x;
165 y = kMapHeight - 1 - y;
166 break;
167 case 1:
168 std::swap(x, y);
169 y = kMapHeight - 1 - y;
170 break;
171 case 0:
172 break;
173 }
174
175 x /= kTileSize;
176 y /= kTileSize;
177
178 return Point(-x + y + kMapColumns, x + y);
179 }
180
181 // 0x0046B8E6
182 static void onClose(Window& self)

Callers 3

drawVehicleOnMapFunction · 0.85
drawRouteLineFunction · 0.85
drawTownNamesFunction · 0.85

Calls 1

getCurrentRotationFunction · 0.85

Tested by

no test coverage detected