| 471 | |
| 472 | |
| 473 | static void MinimapScreenCallback(void *buf, uint y, uint pitch, uint n) |
| 474 | { |
| 475 | uint32_t *ubuf = (uint32_t *)buf; |
| 476 | uint num = (pitch * n); |
| 477 | for (uint i = 0; i < num; i++) { |
| 478 | uint row = y + (int)(i / pitch); |
| 479 | uint col = (Map::SizeX() - 1) - (i % pitch); |
| 480 | |
| 481 | TileIndex tile = TileXY(col, row); |
| 482 | uint8_t val = GetSmallMapOwnerPixels(tile, GetTileType(tile), IncludeHeightmap::Never) & 0xFF; |
| 483 | |
| 484 | uint32_t colour_buf = 0; |
| 485 | colour_buf = (_cur_palette.palette[val].b << 0); |
| 486 | colour_buf |= (_cur_palette.palette[val].g << 8); |
| 487 | colour_buf |= (_cur_palette.palette[val].r << 16); |
| 488 | |
| 489 | *ubuf = colour_buf; |
| 490 | ubuf++; // Skip alpha |
| 491 | } |
| 492 | } |
| 493 | |
| 494 | /** |
| 495 | * Make a minimap screenshot. |
nothing calls this directly
no test coverage detected