| 700 | } |
| 701 | |
| 702 | static void |
| 703 | read_tile_indexes(unsigned glyph, unsigned char (*indexes)[TILE_X]) |
| 704 | { |
| 705 | const struct TileImage *tile; |
| 706 | unsigned x, y; |
| 707 | int tilenum; |
| 708 | |
| 709 | /* We don't have enough colors to show the statues */ |
| 710 | if (glyph_is_statue(glyph)) { |
| 711 | glyph = GLYPH_OBJ_OFF + STATUE; |
| 712 | } |
| 713 | |
| 714 | /* Get the tile from the image */ |
| 715 | tilenum = glyphmap[glyph].tileidx; |
| 716 | tile = get_tile(tilenum); |
| 717 | |
| 718 | /* Map to a 16 bit palette; assume colors laid out as in default tileset */ |
| 719 | for (y = 0; y < TILE_Y && y < tile->height; ++y) { |
| 720 | for (x = 0; x < TILE_X && x < tile->width; ++x) { |
| 721 | static const unsigned char color_to_16[] = { |
| 722 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 14, 15, |
| 723 | 13, 1, 1, 1, 1, 15, 1, 15, 15, 15, 15, 1, 0 |
| 724 | }; |
| 725 | unsigned i = tile->indexes[y * tile->width + x]; |
| 726 | i = (i < SIZE(color_to_16)) ? color_to_16[i] : 15; |
| 727 | indexes[y][x] = i; |
| 728 | } |
| 729 | } |
| 730 | } |
| 731 | |
| 732 | static void |
| 733 | decal_planar(struct planar_cell_struct *gpcs UNUSED, unsigned special) |
no test coverage detected