From b33b66aa29527e3d2226b9b6f25382c007130f7c Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Wed, 12 Sep 2018 18:42:29 +0300 Subject: [PATCH 1/5] Qt: Remember the tile and font size The QT_TILEWIDTH and QT_TILEHEIGHT read from NetHack config file override the remembered settings. Also set the smallest tile size to 6x6 --- doc/fixes36.2 | 1 + win/Qt4/qt4main.cpp | 4 ++++ win/Qt4/qt4set.cpp | 21 +++++++++++++++------ win/Qt4/qt4set.h | 2 ++ 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 9f76fc3e8..69a952609 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -162,6 +162,7 @@ unix: Makefile.src and Makefile.utl inadvertently relied on a 'gnu make' Qt: add Qt5 specific hints file for linux and Mac OS X (Ray Chason) Qt: enable compiling Qt5 on Windows (Ray Chason) Qt: entering extended commands, hide non-matching ones +Qt: remember tile and font size General New Features diff --git a/win/Qt4/qt4main.cpp b/win/Qt4/qt4main.cpp index 4fd8d14da..547cc3e62 100644 --- a/win/Qt4/qt4main.cpp +++ b/win/Qt4/qt4main.cpp @@ -490,6 +490,10 @@ NetHackQtMainWindow::NetHackQtMainWindow(NetHackQtKeyBuffer& ks) : addToolBar(toolbar); menubar = menuBar(); + QCoreApplication::setOrganizationName("The NetHack DevTeam"); + QCoreApplication::setOrganizationDomain("nethack.org"); + QCoreApplication::setApplicationName("NetHack"); + setWindowTitle("Qt NetHack"); if ( qt_compact_mode ) setWindowIcon(QIcon(QPixmap(nh_icon_small))); diff --git a/win/Qt4/qt4set.cpp b/win/Qt4/qt4set.cpp index 03de1f6f7..f9bfa246e 100644 --- a/win/Qt4/qt4set.cpp +++ b/win/Qt4/qt4set.cpp @@ -36,10 +36,11 @@ int qt_compact_mode = 0; namespace nethack_qt4 { -#define TILEWMIN 1 -#define TILEHMIN 1 +#define TILEWMIN 6 +#define TILEHMIN 6 NetHackQtSettings::NetHackQtSettings(int w, int h) : + settings(), tilewidth(this), tileheight(this), widthlbl("&Width:",this), @@ -63,9 +64,9 @@ NetHackQtSettings::NetHackQtSettings(int w, int h) : heightlbl.setBuddy(&tileheight); tileheight.setRange(TILEHMIN, 128); - default_fontsize=2; - tilewidth.setValue(16); - tileheight.setValue(16); + tilewidth.setValue(settings.value("tilewidth", 16).toInt()); + tileheight.setValue(settings.value("tileheight", 16).toInt()); + default_fontsize = settings.value("fontsize", 2).toInt(); // Tile/font sizes read from .nethackrc if (qt_tilewidth != NULL) { @@ -100,7 +101,7 @@ NetHackQtSettings::NetHackQtSettings(int w, int h) : fontsize.addItem("Small"); fontsize.addItem("Tiny"); fontsize.setCurrentIndex(default_fontsize); - connect(&fontsize,SIGNAL(activated(int)),this,SIGNAL(fontChanged())); + connect(&fontsize,SIGNAL(activated(int)),this,SLOT(changedFont())); QGridLayout* grid = new QGridLayout(this); grid->addWidget(&whichsize, 0, 0, 1, 2); @@ -126,11 +127,19 @@ NetHackQtGlyphs& NetHackQtSettings::glyphs() return *theglyphs; } +void NetHackQtSettings::changedFont() +{ + settings.setValue("fontsize", fontsize.currentIndex()); + emit fontChanged(); +} + void NetHackQtSettings::resizeTiles() { int w = tilewidth.value(); int h = tileheight.value(); + settings.setValue("tilewidth", tilewidth.value()); + settings.setValue("tileheight", tileheight.value()); theglyphs->setSize(w,h); emit tilesChanged(); } diff --git a/win/Qt4/qt4set.h b/win/Qt4/qt4set.h index e2253a8d6..48b90f306 100644 --- a/win/Qt4/qt4set.h +++ b/win/Qt4/qt4set.h @@ -33,6 +33,7 @@ public slots: void setGlyphSize(bool); private: + QSettings settings; QSpinBox tilewidth; QSpinBox tileheight; QLabel widthlbl; @@ -48,6 +49,7 @@ private: private slots: void resizeTiles(); + void changedFont(); }; extern NetHackQtSettings* qt_settings; From 7d4a7a1f423e3e49dda3268e2ab7c3c9a76b4d6b Mon Sep 17 00:00:00 2001 From: nhmall Date: Wed, 12 Sep 2018 19:42:45 -0400 Subject: [PATCH 2/5] tty column placement of BL_HUNGER and BL_CAP could collide Change the placement of the code that makes a replica of the current status fields for later comparison. A loop shortcut was causing it to be skipped under some circumstances and that was negatively impacting the placement of status field values that were further to the right. --- doc/fixes36.2 | 2 ++ win/tty/wintty.c | 31 ++++++++++++++----------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 69a952609..82680868b 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -125,6 +125,8 @@ setting the inverse attribute for gold had the space before "$:" sortloot segfaulted when filtering a subset of items (seen with 'A' command) tty: turn off an optimization that is the suspected cause of Windows reported partial status lines following level changes +tty: ensure that current status fields are always copied to prior status + values so that comparisons are correct Platform- and/or Interface-Specific Fixes diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 6e0214911..5c98c0299 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -3837,7 +3837,8 @@ int *topsz, *bottomsz; tty_status[NOW][idx].y = row; tty_status[NOW][idx].x = col; - /* evaluate */ + /* On a change to the field length, everything + further to the right must be updated as well */ if (tty_status[NOW][idx].lth != tty_status[BEFORE][idx].lth) update_right = TRUE; @@ -4129,16 +4130,11 @@ render_status(VOID_ARGS) for (i = 0; fieldorder[row][i] != BL_FLUSH; ++i) { int fldidx = fieldorder[row][i]; - if (do_field_opt && !tty_status[NOW][fldidx].redraw) - continue; - /* - * Ignore zero length fields. check_fields() didn't count - * them in either. - */ - if (!tty_status[NOW][fldidx].lth && fldidx != BL_CONDITION) + if (!status_activefields[fldidx]) continue; - if (status_activefields[fldidx]) { + if ((tty_status[NOW][fldidx].lth || fldidx == BL_CONDITION) + && (tty_status[NOW][fldidx].redraw || !do_field_opt)) { int coloridx = tty_status[NOW][fldidx].color; int attridx = tty_status[NOW][fldidx].attr; int x = tty_status[NOW][fldidx].x; @@ -4296,15 +4292,16 @@ render_status(VOID_ARGS) End_Attr(attridx); } } - /* reset .redraw and .dirty now that they've been rendered */ - tty_status[NOW][fldidx].dirty = FALSE; - tty_status[NOW][fldidx].redraw = FALSE; - /* - * Make a copy of the entire tty_status struct for comparison - * of current and previous. - */ - tty_status[BEFORE][fldidx] = tty_status[NOW][fldidx]; } + /* reset .redraw and .dirty now that they've been rendered */ + tty_status[NOW][fldidx].dirty = FALSE; + tty_status[NOW][fldidx].redraw = FALSE; + + /* + * Make a copy of the entire tty_status struct for comparison + * of current and previous. + */ + tty_status[BEFORE][fldidx] = tty_status[NOW][fldidx]; } } if (cond_disp_width[NOW] < cond_width_at_shrink) { From 37f8d0edb3826c7e845f79566b54845fd1c2f6a4 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 13 Sep 2018 17:10:25 -0700 Subject: [PATCH 3/5] fix #H7385 - double trap activation when jumping Jumping performs the placement of the last step after using hurtle() to move to the destination, so if hurtle() triggered a trap then it would happen twice. Report was for a Sokoban pit but it would happen for fire traps too. Other traps would yield "you pass over " while hurtling and then trigger the trap when landing. Have hurtle_step() ignore a trap for the last step of a jump, leaving it to the jump's landing to handle. Also, give feedback when hurtling over water or lava, similar to what happens when passing over a previously seen trap which doesn't activate. --- doc/fixes36.2 | 3 ++- src/dothrow.c | 31 +++++++++++++++++++++---------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 82680868b..b8fff8bea 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -114,7 +114,7 @@ add window port status_update() value BL_RESET to use as a flag to for hilite_status of string status fields (title, dungeon-level, alignment), the types value-goes-up and -down aren't meaningful; treat them as value-changed if from config file and don't offer as choices with 'O' -spiders will occasionally spin webs when moving around +jumping into or over a Sokoban pit, or over a fire trap, triggers trap twice Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository @@ -182,6 +182,7 @@ make it clear when a leprechaun dodges your attack wizard mode #wizidentify can now select individual items for permanent identification and don't display the selection to permanently identify everything if everything is already fully identified +spiders will occasionally spin webs when moving around Code Cleanup and Reorganization diff --git a/src/dothrow.c b/src/dothrow.c index 81487a5b6..b9d122a7d 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -571,7 +571,7 @@ int x, y; int ox, oy, *range = (int *) arg; struct obj *obj; struct monst *mon; - boolean may_pass = TRUE; + boolean may_pass = TRUE, via_jumping, stopping_short; struct trap *ttmp; int dmg = 0; @@ -583,6 +583,8 @@ int x, y; } else if (*range == 0) { return FALSE; /* previous step wants to stop now */ } + via_jumping = (EWwalking & I_SPECIAL) != 0L; + stopping_short = (via_jumping && *range < 2); if (!Passes_walls || !(may_pass = may_passwall(x, y))) { boolean odoor_diag = (IS_DOOR(levl[x][y].typ) @@ -710,12 +712,17 @@ int x, y; vision_recalc(1); /* update for new position */ flush_screen(1); - if (is_pool(x, y) && !u.uinwater - && ((Is_waterlevel(&u.uz) && levl[x][y].typ == WATER) - || !(Levitation || Flying || Wwalking))) { - multi = 0; /* can move, so drown() allows crawling out of water */ - (void) drown(); - return FALSE; + if (is_pool(x, y) && !u.uinwater) { + if ((Is_waterlevel(&u.uz) && levl[x][y].typ == WATER) + || !(Levitation || Flying || Wwalking)) { + multi = 0; /* can move, so drown() allows crawling out of water */ + (void) drown(); + return FALSE; + } else if (!Is_waterlevel(&u.uz) && !stopping_short) { + Norep("You move over %s.", an(is_moat(x, y) ? "moat" : "pool")); + } + } else if (is_lava(x, y) && !stopping_short) { + Norep("You move over some lava."); } /* FIXME: @@ -727,7 +734,9 @@ int x, y; * ones that we have not yet tested. */ if ((ttmp = t_at(x, y)) != 0) { - if (ttmp->ttyp == MAGIC_PORTAL) { + if (stopping_short) { + ; /* see the comment above hurtle_jump() */ + } else if (ttmp->ttyp == MAGIC_PORTAL) { dotrap(ttmp, 0); return FALSE; } else if (ttmp->ttyp == VIBRATING_SQUARE) { @@ -738,8 +747,10 @@ int x, y; } else if ((ttmp->ttyp == PIT || ttmp->ttyp == SPIKED_PIT || ttmp->ttyp == HOLE || ttmp->ttyp == TRAPDOOR) && Sokoban) { - /* Air currents overcome the recoil */ - dotrap(ttmp, 0); + /* air currents overcome the recoil in Sokoban; + when jumping, caller performs last step and enters trap */ + if (!via_jumping) + dotrap(ttmp, 0); *range = 0; return TRUE; } else { From 97b2ba2e545fe9b6fd646d35d1bc5dbb2e1570b0 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Fri, 14 Sep 2018 21:07:08 +0300 Subject: [PATCH 4/5] Mimics created by #wizgenesis blocked vision incorrectly --- doc/fixes36.2 | 1 + src/makemon.c | 7 +++---- src/read.c | 8 +++++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index b8fff8bea..6887cd195 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -115,6 +115,7 @@ for hilite_status of string status fields (title, dungeon-level, alignment), the types value-goes-up and -down aren't meaningful; treat them as value-changed if from config file and don't offer as choices with 'O' jumping into or over a Sokoban pit, or over a fire trap, triggers trap twice +mimics created by #wizgenesis could block or not block vision incorrectly Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/makemon.c b/src/makemon.c index 0ba833def..0d38383dc 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -2126,16 +2126,12 @@ register struct monst *mtmp; appear = Is_rogue_level(&u.uz) ? S_hwall : S_hcdoor; else appear = Is_rogue_level(&u.uz) ? S_vwall : S_vcdoor; - if (!mtmp->minvis || See_invisible) - block_point(mx, my); /* vision */ } else if (level.flags.is_maze_lev && !In_sokoban(&u.uz) && rn2(2)) { ap_type = M_AP_OBJECT; appear = STATUE; } else if (roomno < 0 && !t_at(mx, my)) { ap_type = M_AP_OBJECT; appear = BOULDER; - if (!mtmp->minvis || See_invisible) - block_point(mx, my); /* vision */ } else if (rt == ZOO || rt == VAULT) { ap_type = M_AP_OBJECT; appear = GOLD_PIECE; @@ -2193,6 +2189,9 @@ register struct monst *mtmp; if (appear == EGG && !can_be_hatched(MCORPSENM(mtmp))) MCORPSENM(mtmp) = NON_PM; /* revert to generic egg */ } + + if (does_block(mx, my, &levl[mx][my])) + block_point(mx, my); } /* release monster from bag of tricks; return number of monsters created */ diff --git a/src/read.c b/src/read.c index c4cf716e9..8691d7f4c 100644 --- a/src/read.c +++ b/src/read.c @@ -2550,8 +2550,14 @@ struct _create_particular_data *d; put_saddle_on_mon(otmp, mtmp); } - if (d->invisible) + if (d->invisible) { + int mx = mtmp->mx, my = mtmp->my; mon_set_minvis(mtmp); + if (does_block(mx, my, &levl[mx][my])) + block_point(mx, my); + else + unblock_point(mx, my); + } if (d->sleeping) mtmp->msleeping = 1; madeany = TRUE; From e37087e99954e0750ceac9069eef7cf1581d75b9 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Fri, 14 Sep 2018 21:49:02 +0300 Subject: [PATCH 5/5] Handle monsters inside the invocation area --- doc/fixes36.2 | 1 + src/mklev.c | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 6887cd195..3c514a8a4 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -116,6 +116,7 @@ for hilite_status of string status fields (title, dungeon-level, alignment), value-changed if from config file and don't offer as choices with 'O' jumping into or over a Sokoban pit, or over a fire trap, triggers trap twice mimics created by #wizgenesis could block or not block vision incorrectly +handle monsters inside the invocation area Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/mklev.c b/src/mklev.c index 5ae75498d..f704db27d 100644 --- a/src/mklev.c +++ b/src/mklev.c @@ -1733,6 +1733,7 @@ int dist; struct obj *otmp; boolean make_rocks; register struct rm *lev = &levl[x][y]; + struct monst *mon; /* clip at existing map borders if necessary */ if (!within_bounded_area(x, y, x_maze_min + 1, y_maze_min + 1, @@ -1759,7 +1760,6 @@ int dist; obfree(otmp, (struct obj *) 0); } } - unblock_point(x, y); /* make sure vision knows this location is open */ /* fake out saved state */ lev->seenv = 0; @@ -1796,6 +1796,20 @@ int dist; break; } + if ((mon = m_at(x, y)) != 0) { + /* wake up mimics, don't want to deal with them blocking vision */ + if (mon->m_ap_type) + seemimic(mon); + + if ((ttmp = t_at(x, y)) != 0) + (void) mintrap(mon); + else + (void) minliquid(mon); + } + + if (!does_block(x, y, lev)) + unblock_point(x, y); /* make sure vision knows this location is open */ + /* display new value of position; could have a monster/object on it */ newsym(x, y); }