MCPcopy Create free account
hub / github.com/NetHack/NetHack / read_tile_indexes

Function read_tile_indexes

sys/msdos/vidvga.c:702–730  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

700}
701
702static void
703read_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
732static void
733decal_planar(struct planar_cell_struct *gpcs UNUSED, unsigned special)

Callers 2

read_planar_tileFunction · 0.85
read_planar_tile_OFunction · 0.85

Calls 1

get_tileFunction · 0.85

Tested by

no test coverage detected