Qt without tiles

When tiles fail to load, the Qt interface switches to the text map.
But it wasn't inhibiting the player from trying to switch to tiles
map.  Also, when the text map was in use it was forcing the paper
doll inventory subset to be disabled regardless of whether the map
was by choice or because tiles wouldn't load.  Allow the paper doll
in combination with the text map if tiles got loaded successfully.
This commit is contained in:
PatR
2022-01-02 01:48:07 -08:00
parent 30a0cab66f
commit 37ce6f72b3
4 changed files with 30 additions and 10 deletions

View File

@@ -44,6 +44,7 @@ NetHackQtGlyphs::NetHackQtGlyphs()
char cbuf[BUFSZ];
const char *tile_file = NULL, *tile_list[2];
this->no_tiles = false;
tiles_per_row = TILES_PER_ROW;
if (user_tiles) {
@@ -77,9 +78,14 @@ NetHackQtGlyphs::NetHackQtGlyphs()
}
if (!tilesok) {
this->no_tiles = true;
/* tiles wouldn't load so force ascii map */
::iflags.wc_ascii_map = 1;
::iflags.wc_tiled_map = 0;
tiles_per_row = 40; // arbitrary
/* tiles wouldn't load so don't allow toggling to tiled map */
::set_wc_option_mod_status(WC_ASCII_MAP | WC_TILED_MAP,
::set_in_config);
tiles_per_row = 40; // arbitrary to avoid potential divide-by-0
}
if (iflags.wc_tile_width)

View File

@@ -16,6 +16,8 @@ enum border_code {
class NetHackQtGlyphs {
public:
bool no_tiles;
NetHackQtGlyphs();
int width() const { return size.width(); }

View File

@@ -176,7 +176,8 @@ void NetHackQtInvUsageWindow::paintEvent(QPaintEvent*)
// Actually indexed by grid[column][row].
#ifdef ENHANCED_PAPERDOLL
if (iflags.wc_ascii_map)
if (qt_settings->doll_is_shown && ::iflags.wc_ascii_map
&& qt_settings->glyphs().no_tiles)
qt_settings->doll_is_shown = false;
if (!qt_settings->doll_is_shown)
return;
@@ -185,7 +186,7 @@ void NetHackQtInvUsageWindow::paintEvent(QPaintEvent*)
qt_settings->dollHeight);
/* for drawWorn()'s use of obj->invlet */
if (!flags.invlet_constant)
if (!::flags.invlet_constant)
reassign();
#endif

View File

@@ -136,17 +136,28 @@ NetHackQtSettings::NetHackQtSettings() :
}
theglyphs=new NetHackQtGlyphs();
resizeTiles();
if (!theglyphs->no_tiles) {
resizeTiles();
connect(&whichsize, SIGNAL(toggled(bool)), this, SLOT(setGlyphSize(bool)));
connect(&tilewidth, SIGNAL(valueChanged(int)), this, SLOT(resizeTiles()));
connect(&tileheight, SIGNAL(valueChanged(int)), this, SLOT(resizeTiles()));
connect(&whichsize, SIGNAL(toggled(bool)), this,
SLOT(setGlyphSize(bool)));
connect(&tilewidth, SIGNAL(valueChanged(int)), this,
SLOT(resizeTiles()));
connect(&tileheight, SIGNAL(valueChanged(int)), this,
SLOT(resizeTiles()));
#ifdef ENHANCED_PAPERDOLL
connect(&dollshown, SIGNAL(toggled(bool)), this, SLOT(setDollShown(bool)));
connect(&dollwidth, SIGNAL(valueChanged(int)), this, SLOT(resizeDoll()));
connect(&dollheight, SIGNAL(valueChanged(int)), this, SLOT(resizeDoll()));
connect(&dollshown, SIGNAL(toggled(bool)), this,
SLOT(setDollShown(bool)));
connect(&dollwidth, SIGNAL(valueChanged(int)), this,
SLOT(resizeDoll()));
connect(&dollheight, SIGNAL(valueChanged(int)), this,
SLOT(resizeDoll()));
#endif
} else {
// paper doll requires map tiles and those just failed to load
doll_is_shown = false;
}
fontsize.setMinimumContentsLength((int) strlen("Medium"));
fontsize.addItem("Huge");