-/* NetHack 3.6 hack.h $NHDT-Date: 1547514631 2019/01/15 01:10:31 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.101 $ */
+/* NetHack 3.6 hack.h $NHDT-Date: 1549327459 2019/02/05 00:44:19 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.102 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Pasi Kallinen, 2017. */
/* NetHack may be freely redistributed. See license for details. */
#define PLINE_NOREPEAT 1
#define OVERRIDE_MSGTYPE 2
#define SUPPRESS_HISTORY 4
+#define URGENT_MESSAGE 8
/* Macros for messages referring to hands, eyes, feet, etc... */
enum bodypart_types {
-/* NetHack 3.6 winprocs.h $NHDT-Date: 1502141230 2017/08/07 21:27:10 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.38 $ */
+/* NetHack 3.6 winprocs.h $NHDT-Date: 1549327479 2019/02/05 00:44:39 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.46 $ */
/* Copyright (c) David Cohrs, 1992 */
/* NetHack may be freely redistributed. See license for details. */
#define WC2_DARKGRAY 0x0020L /* 06 use bold black for black glyphs */
#define WC2_HITPOINTBAR 0x0040L /* 07 show bar representing hit points */
#define WC2_FLUSH_STATUS 0x0080L /* 08 call status_update(BL_FLUSH)
- after updating status window fields */
-#define WC2_RESET_STATUS 0x0100L /* 09 call status_update(BL_RESET) to indicate
- draw everything */
+ * after updating status window fields */
+#define WC2_RESET_STATUS 0x0100L /* 09 call status_update(BL_RESET) to
+ * indicate 'draw everything' */
#define WC2_TERM_SIZE 0x0200L /* 10 support setting terminal size */
#define WC2_WINDOWBORDERS 0x0400L /* 11 display borders on nh windows */
#define WC2_PETATTR 0x0800L /* 12 attributes for hilite_pet */
#define WC2_GUICOLOR 0x1000L /* 13 display colours outside map win */
- /* 19 free bits */
+/* pline() can overload the display attributes argument passed to putstr()
+ with one or more flags and at most one of bold/blink/inverse/&c */
+#define WC2_URGENT_MESG 0x2000L /* 14 putstr(WIN_MESSAGE) supports urgency
+ * via non-display attribute flag */
+#define WC2_SUPPRESS_HIST 0x4000L /* 15 putstr(WIN_MESSAGE) supports history
+ * suppression via non-disp attr */
+ /* 17 free bits */
#define ALIGN_LEFT 1
#define ALIGN_RIGHT 2
-/* NetHack 3.6 wintty.h $NHDT-Date: 1433806583 2015/06/08 23:36:23 $ $NHDT-Branch: master $:$NHDT-Revision: 1.24 $ */
+/* NetHack 3.6 wintty.h $NHDT-Date: 1549327485 2019/02/05 00:44:45 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.32 $ */
/* Copyright (c) David Cohrs, 1991,1992 */
/* NetHack may be freely redistributed. See license for details. */
/* ### topl.c ### */
+E void FDECL(show_topl, (const char *));
+E void NDECL(remember_topl);
E void FDECL(addtopl, (const char *));
E void NDECL(more);
E void FDECL(update_topl, (const char *));
-/* NetHack 3.6 wintype.h $NHDT-Date: 1461028538 2016/04/19 01:15:38 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.16 $ */
+/* NetHack 3.6 wintype.h $NHDT-Date: 1549327486 2019/02/05 00:44:46 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.19 $ */
/* Copyright (c) David Cohrs, 1991 */
/* NetHack may be freely redistributed. See license for details. */
#define NHW_TEXT 5
/* attribute types for putstr; the same as the ANSI value, for convenience */
-#define ATR_NONE 0
-#define ATR_BOLD 1
-#define ATR_DIM 2
-#define ATR_ULINE 4
-#define ATR_BLINK 5
-#define ATR_INVERSE 7
+#define ATR_NONE 0
+#define ATR_BOLD 1
+#define ATR_DIM 2
+#define ATR_ULINE 4
+#define ATR_BLINK 5
+#define ATR_INVERSE 7
+/* not a display attribute but passed to putstr() as an attribute;
+ can be masked with one regular display attribute */
+#define ATR_URGENT 16
+#define ATR_NOHISTORY 32
/* nh_poskey() modifier types */
#define CLICK_1 1
-/* NetHack 3.6 cmd.c $NHDT-Date: 1548978603 2019/01/31 23:50:03 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.330 $ */
+/* NetHack 3.6 cmd.c $NHDT-Date: 1549327488 2019/02/05 00:44:48 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.331 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */
Sprintf(qbuf, "Count: %ld", cnt);
backspaced = FALSE;
}
- /* bypassing pline() keeps intermediate prompt out of
- DUMPLOG message history */
- putstr(WIN_MESSAGE, 0, qbuf);
+ custompline(SUPPRESS_HISTORY, "%s", qbuf);
mark_synch();
}
}
-/* NetHack 3.6 pline.c $NHDT-Date: 1541719974 2018/11/08 23:32:54 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.69 $ */
+/* NetHack 3.6 pline.c $NHDT-Date: 1549327495 2019/02/05 00:44:55 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.73 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2018. */
/* NetHack may be freely redistributed. See license for details. */
static unsigned pline_flags = 0;
static char prevmsg[BUFSZ];
+static void FDECL(putmesg, (const char *));
static char *FDECL(You_buf, (int));
#if defined(MSGHANDLER) && (defined(POSIX_TYPES) || defined(__GNUC__))
static void FDECL(execplinehandler, (const char *));
}
#endif
+/* keeps windowprocs usage out of pline() */
+static void
+putmesg(line)
+const char *line;
+{
+ int attr = ATR_NONE;
+
+ if ((pline_flags & URGENT_MESSAGE) != 0
+ && (windowprocs.wincap2 & WC2_URGENT_MESG) != 0)
+ attr |= ATR_URGENT;
+ if ((pline_flags & SUPPRESS_HISTORY) != 0
+ && (windowprocs.wincap2 & WC2_SUPPRESS_HIST) != 0)
+ attr |= ATR_NOHISTORY;
+
+ putstr(WIN_MESSAGE, attr, line);
+}
+
/* Note that these declarations rely on knowledge of the internals
* of the variable argument handling stuff in "tradstdc.h"
*/
no_repeat = (pline_flags & PLINE_NOREPEAT) ? TRUE : FALSE;
if ((pline_flags & OVERRIDE_MSGTYPE) == 0) {
msgtyp = msgtype_type(line, no_repeat);
- if (msgtyp == MSGTYP_NOSHOW
- || (msgtyp == MSGTYP_NOREP && !strcmp(line, prevmsg)))
+ if ((pline_flags & URGENT_MESSAGE) == 0
+ && (msgtyp == MSGTYP_NOSHOW
+ || (msgtyp == MSGTYP_NOREP && !strcmp(line, prevmsg))))
/* FIXME: we need a way to tell our caller that this message
* was suppressed so that caller doesn't set iflags.last_msg
* for something that hasn't been shown, otherwise a subsequent
if (u.ux)
flush_screen(1); /* %% */
- putstr(WIN_MESSAGE, 0, line);
+ putmesg(line);
#if defined(MSGHANDLER) && (defined(POSIX_TYPES) || defined(__GNUC__))
execplinehandler(line);
-/* NetHack 3.6 topl.c $NHDT-Date: 1540934784 2018/10/30 21:26:24 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.38 $ */
+/* NetHack 3.6 topl.c $NHDT-Date: 1549327499 2019/02/05 00:44:59 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.43 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2009. */
/* NetHack may be freely redistributed. See license for details. */
STATIC_DCL void FDECL(redotoplin, (const char *));
STATIC_DCL void FDECL(topl_putsym, (CHAR_P));
-STATIC_DCL void NDECL(remember_topl);
STATIC_DCL void FDECL(removetopl, (int));
STATIC_DCL void FDECL(msghistory_snapshot, (BOOLEAN_P));
STATIC_DCL void FDECL(free_msghistory_snapshot, (BOOLEAN_P));
more();
}
-STATIC_OVL void
+/* for use by tty_putstr() */
+void
+show_topl(str)
+const char *str;
+{
+ struct WinDesc *cw = wins[WIN_MESSAGE];
+
+ if (!(cw->flags & WIN_STOP)) {
+ cw->curx = cw->cury = 0;
+ home();
+ cl_end();
+ addtopl(str);
+ }
+}
+
+/* used by update_topl(); also by tty_putstr() */
+void
remember_topl()
{
register struct WinDesc *cw = wins[WIN_MESSAGE];
/* If there is room on the line, print message on same line */
/* But messages like "You die..." deserve their own line */
n0 = strlen(bp);
- if ((ttyDisplay->toplin == 1 || (cw->flags & WIN_STOP)) && cw->cury == 0
+ if ((ttyDisplay->toplin == 1 || (cw->flags & WIN_STOP))
+ && cw->cury == 0
&& n0 + (int) strlen(toplines) + 3 < CO - 8 /* room for --More-- */
&& (notdied = strncmp(bp, "You die", 7)) != 0) {
Strcat(toplines, " ");
-/* NetHack 3.6 wintty.c $NHDT-Date: 1545705819 2018/12/25 02:43:39 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.190 $ */
+/* NetHack 3.6 wintty.c $NHDT-Date: 1549327503 2019/02/05 00:45:03 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.193 $ */
/* Copyright (c) David Cohrs, 1991 */
/* NetHack may be freely redistributed. See license for details. */
| WC2_HILITE_STATUS | WC2_HITPOINTBAR | WC2_FLUSH_STATUS
| WC2_RESET_STATUS
#endif
- | WC2_DARKGRAY),
+ | WC2_DARKGRAY | WC2_SUPPRESS_HIST),
tty_init_nhwindows, tty_player_selection, tty_askname, tty_get_nh_event,
tty_exit_nhwindows, tty_suspend_nhwindows, tty_resume_nhwindows,
tty_create_nhwindow, tty_clear_nhwindow, tty_display_nhwindow,
print_vt_code2(AVTC_SELECT_WINDOW, window);
switch (cw->type) {
- case NHW_MESSAGE:
+ case NHW_MESSAGE: {
+ int suppress_history = (attr & ATR_NOHISTORY);
+
+ /* in case we ever support display attributes for topline
+ messages, clear flag mask leaving only display attr */
+ /*attr &= ~(ATR_URGENT | ATR_NOHISTORY);*/
+
/* really do this later */
#if defined(USER_SOUNDS) && defined(WIN32CON)
play_sound_for_message(str);
#endif
- update_topl(str);
+ if (!suppress_history) {
+ /* normal output; add to current top line if room, else flush
+ whatever is there to history and then write this */
+ update_topl(str);
+ } else {
+ /* put anything already on top line into history */
+ remember_topl();
+ /* write to top line without remembering what we're writing */
+ show_topl(str);
+ }
break;
+ }
#ifndef STATUS_HILITES
case NHW_STATUS:
ob = &cw->data[cw->cury][j = cw->curx];