diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 123402de3..76f29dfe1 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,4 +1,4 @@ -NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.285 $ $NHDT-Date: 1597546107 2020/08/16 02:48:27 $ +NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.286 $ $NHDT-Date: 1597700875 2020/08/17 21:47:55 $ General Fixes and Modified Features ----------------------------------- @@ -381,6 +381,7 @@ Qt: "paper doll" subset of persistent inventory has undergone several changes: two-handed weapon in both the shield and primary weapon slots; show first active light source in a previously unused slot on lower right; show first leash-in-use in a previously unused slot on lower left +Qt: paper doll inventory view was inconsistently updated during Hallucination Qt+QSX: fix control key Qt+OSX: rename menu entry "nethack->Preferences..." for invoking nethack's 'O' command to "Game->Run-time options" and entry "Game->Qt settings" diff --git a/include/display.h b/include/display.h index 272ed163d..721b7f10b 100644 --- a/include/display.h +++ b/include/display.h @@ -1,4 +1,4 @@ -/* NetHack 3.7 display.h $NHDT-Date: 1596498533 2020/08/03 23:48:53 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.46 $ */ +/* NetHack 3.7 display.h $NHDT-Date: 1597700875 2020/08/17 21:47:55 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.47 $ */ /* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */ /* and Dave Cohrs, 1990. */ /* NetHack may be freely redistributed. See license for details. */ @@ -328,18 +328,18 @@ enum explosion_types { /* This has the unfortunate side effect of needing a global variable */ /* to store a result. 'otg_temp' is defined and declared in decl.{ch}. */ -#define random_obj_to_glyph(rng) \ - ((g.otg_temp = random_object(rng)) == CORPSE \ - ? random_monster(rng) + GLYPH_BODY_OFF \ +#define random_obj_to_glyph(rng) \ + ((g.otg_temp = random_object(rng)) == CORPSE \ + ? random_monster(rng) + GLYPH_BODY_OFF \ : g.otg_temp + GLYPH_OBJ_OFF) -#define obj_to_glyph(obj, rng) \ - (((obj)->otyp == STATUE) \ - ? statue_to_glyph(obj, rng) \ - : Hallucination \ - ? random_obj_to_glyph(rng) \ - : ((obj)->otyp == CORPSE) \ - ? (int) (obj)->corpsenm + GLYPH_BODY_OFF \ +#define obj_to_glyph(obj, rng) \ + (((obj)->otyp == STATUE) \ + ? statue_to_glyph(obj, rng) \ + : Hallucination \ + ? random_obj_to_glyph(rng) \ + : ((obj)->otyp == CORPSE) \ + ? (int) (obj)->corpsenm + GLYPH_BODY_OFF \ : (int) (obj)->otyp + GLYPH_OBJ_OFF) /* MRKR: Statues now have glyphs corresponding to the monster they */ @@ -349,6 +349,16 @@ enum explosion_types { (Hallucination ? random_monster(rng) + GLYPH_MON_OFF \ : (int) (obj)->corpsenm + GLYPH_STATUE_OFF) +/* briefly used for Qt's "paper doll" inventory which shows map tiles for + equipped objects; those vary like floor items during hallucination now + so this isn't used anywhere */ +#define obj_to_true_glyph(obj) \ + (((obj)->otyp == STATUE) \ + ? ((int) (obj)->corpsenm + GLYPH_STATUE_OFF) \ + : ((obj)->otyp == CORPSE) \ + ? ((int) (obj)->corpsenm + GLYPH_BODY_OFF) \ + : ((int) (obj)->otyp + GLYPH_OBJ_OFF)) + #define cmap_to_glyph(cmap_idx) ((int) (cmap_idx) + GLYPH_CMAP_OFF) #define explosion_to_glyph(expltype, idx) \ ((((expltype) * MAXEXPCHARS) + ((idx) - S_explode1)) + GLYPH_EXPLODE_OFF) diff --git a/src/display.c b/src/display.c index 7445486dd..0efe1582c 100644 --- a/src/display.c +++ b/src/display.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 display.c $NHDT-Date: 1596498156 2020/08/03 23:42:36 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.135 $ */ +/* NetHack 3.7 display.c $NHDT-Date: 1597700875 2020/08/17 21:47:55 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.136 $ */ /* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */ /* and Dave Cohrs, 1990. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1339,9 +1339,16 @@ void see_objects() { register struct obj *obj; + for (obj = fobj; obj; obj = obj->nobj) if (vobj_at(obj->ox, obj->oy) == obj) newsym(obj->ox, obj->oy); + + /* Qt's "paper doll" subset of persistent inventory shows map tiles + for objects which aren't on the floor so not handled by above loop; + inventory which includes glyphs should also be affected, so do this + for all interfaces in case any feature that for persistent inventory */ + update_inventory(); } /* diff --git a/win/Qt/qt_inv.cpp b/win/Qt/qt_inv.cpp index 758fcb7b6..f34d0e48a 100644 --- a/win/Qt/qt_inv.cpp +++ b/win/Qt/qt_inv.cpp @@ -48,13 +48,12 @@ void NetHackQtInvUsageWindow::drawWorn(QPainter& painter, obj* nhobj, int x, int y, bool canbe) { short int glyph; - if (nhobj) - glyph = obj_to_glyph(nhobj, rn2_on_display_rng); - else if (canbe) - glyph = cmap_to_glyph(S_room); - else - glyph = GLYPH_UNEXPLORED; // was cmap_to_glyph(S_stone) - + if (nhobj) { + /* Hallucination doesn't affect inventory */ + glyph = obj_to_glyph(nhobj, rn2_on_display_rng); + } else { + glyph = canbe ? cmap_to_glyph(S_room) : GLYPH_UNEXPLORED; + } qt_settings->glyphs().drawCell(painter, glyph, x, y); }