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

Function convert_tiles

win/X11/tile2x11.c:50–76  ·  view source on GitHub ↗

Convert the tiles in the file to our format of bytes. */

Source from the content-addressed store, hash-verified

48
49/* Convert the tiles in the file to our format of bytes. */
50static unsigned long
51convert_tiles(unsigned char **tb_ptr, /* pointer to a tile byte pointer */
52 unsigned long total) /* total tiles so far */
53{
54 unsigned char *tb = *tb_ptr;
55 unsigned long count = 0;
56 pixel tile[TILE_Y][TILE_X];
57 int x, y;
58
59 while (read_text_tile(tile)) {
60 count++;
61 total++;
62 for (y = 0; y < TILE_Y; y++) {
63 for (x = 0; x < TILE_X; x++)
64 tb[x] = pix_to_colormap(tile[y][x]);
65 tb += TILE_X * header.per_row;
66 }
67
68 /* repoint at the upper-left corner of the next tile */
69 *tb_ptr += TILE_X;
70 if (header.per_row == 1 || (total % header.per_row) == 0)
71 *tb_ptr += TILE_X * (TILE_Y - 1) * header.per_row;
72 tb = *tb_ptr;
73 }
74
75 return count;
76}
77
78/* Merge the current text colormap (ColorMap) with ours (x11_colormap). */
79static void

Callers 1

process_fileFunction · 0.85

Calls 2

read_text_tileFunction · 0.85
pix_to_colormapFunction · 0.85

Tested by

no test coverage detected