restore support for non-square XPM-based tiles (X11 & Gnome)
- change the way the tile sizes are calculated, based on the image size, so non-square tiles can once again be supported. - fix Gnome port so it can actually display non-square tiles, several height/width uses were backwards - update Install.X11 to note the number of tiles per row in the XPM image
This commit is contained in:
+5
-2
@@ -50,8 +50,11 @@ When using tiles, you have the option of defining USE_XPM in config.h.
|
||||
This causes NetHack to use the XPM file format for the "x11tiles" file
|
||||
rather than a custom format. Since the XPM format can be processed by
|
||||
existing tools such as PBMPlus and XV, you can modify the tiles to suit
|
||||
your environment. For example, you may magnify them for display on
|
||||
high-resolution screens using the following command:
|
||||
your environment. However, you need to make sure the number of tiles
|
||||
in each row of the image remains the same (currently 40), as the code
|
||||
depends on this to calculate the size of each tile. For example, you may
|
||||
magnify them for display on high-resolution screens using the following
|
||||
command:
|
||||
xpmtoppm x11tiles | pnmscale -xscale 1 -yscale 1.6875 |
|
||||
pnmdepth 255 | ppmquant 100 | ppmtoxpm >x11tiles_big.xpm
|
||||
To use XPM, you must have the free XPM libraries installed in your system.
|
||||
|
||||
+8
-11
@@ -306,7 +306,8 @@ init_tiles(wp)
|
||||
}
|
||||
|
||||
/* assume a fixed number of tiles per row */
|
||||
if (tile_image->width % TILES_PER_ROW != 0) {
|
||||
if (tile_image->width % TILES_PER_ROW != 0 ||
|
||||
tile_image->width <= TILES_PER_ROW) {
|
||||
Sprintf(buf,
|
||||
"%s is not a multiple of %d (number of tiles/row) pixels wide",
|
||||
appResources.tile_file, TILES_PER_ROW);
|
||||
@@ -317,20 +318,16 @@ init_tiles(wp)
|
||||
goto tiledone;
|
||||
}
|
||||
|
||||
/* infer tile dimensions from image size, assume square tiles */
|
||||
/* infer tile dimensions from image size and TILES_PER_ROW */
|
||||
image_width = tile_image->width;
|
||||
image_height = tile_image->height;
|
||||
tile_width = image_width / TILES_PER_ROW;
|
||||
tile_height = tile_width;
|
||||
tile_count = (image_width * image_height) / (tile_width * tile_height);
|
||||
|
||||
if (tile_count < total_tiles_used) {
|
||||
Sprintf(buf, "%s incomplete, expecting %d tiles, found %d",
|
||||
appResources.tile_file, total_tiles_used, tile_count);
|
||||
X11_raw_print(buf);
|
||||
result = FALSE;
|
||||
goto tiledone;
|
||||
tile_count = total_tiles_used;
|
||||
if ((tile_count % TILES_PER_ROW) != 0) {
|
||||
tile_count += TILES_PER_ROW - (tile_count % TILES_PER_ROW);
|
||||
}
|
||||
tile_width = image_width / TILES_PER_ROW;
|
||||
tile_height = image_height / (tile_count / TILES_PER_ROW);
|
||||
#else
|
||||
/* any less than 16 colours makes tiles useless */
|
||||
ddepth = DefaultDepthOfScreen(screen);
|
||||
|
||||
Reference in New Issue
Block a user