Commit Graph

1767 Commits

Author SHA1 Message Date
Pasi Kallinen
60f1b7e35b Fix compiling without DLB 2019-05-09 19:44:34 +03:00
nhmall
63858f39de mark development 3.7 builds as such 2019-05-09 07:47:10 -04:00
nhmall
3be48695a5 Merge branch 'NetHack-3.6.2' 2019-05-07 21:18:51 -04:00
nhmall
39320dec2b NetHack 3.6.2 release-related updates 2019-05-07 14:39:24 -04:00
nhmall
db25fe56a8 Merge branch 'NetHack-3.6.2' 2019-05-05 23:30:50 -04:00
PatR
a8550fc0e7 ball&chain sanity checking
Add a bc sanity check.  It seems to work ok--in other words, not
trigger--under normal punishment.  I don't have any test cases to
exercise its warnings.

This dragged in a couple of minor bc changes that were pending.  I
should have cleared those out before tackling the sanity checking.
2019-05-05 13:33:30 -07:00
nhmall
d15496ba31 Merge branch 'NetHack-3.6.2' 2019-04-22 14:36:58 -04:00
nhmall
82353f1965 enum bit 2019-04-22 14:27:41 -04:00
nhmall
dcf4da2150 preserve dknown field between fakeobj instances
Preserve temporary fake object's previous dknown value by storing it
as a flag value within the m_ap_type field of the posing monster, and
recalling it when it is needed.

This is intended to help eliminate observable differences in price display
between real objects and mimics posing as objects.

98% of this is just switching the code to utilize macro M_AP_TYPE(mon)
everywhere to ensure that the flag bits are stripped off when needed.
2019-04-22 14:17:18 -04:00
nhmall
e4ac043747 Merge branch 'NetHack-3.6.2' 2019-04-21 04:08:57 -04:00
PatR
edd412e56c VMS config1.h
Some port of yacc was generating '#include <stdlib.h>' before our
'#include "config.h" and needed a specific define from config1.h to
be supplied on the command line to avoid conflicting contents within
that header file, but then config1.h drew complaints about redefining
the macro.  Guard against that.
2019-04-19 12:42:35 -07:00
nhmall
8e4ee7847f Merge branch 'NetHack-3.6.2' 2019-04-17 14:30:19 -04:00
PatR
7088247883 vms update revisited
Redo the UCHAR_P handling from df84da3ec2
(5 weeks ago) and 02b21865fd followup.
The earlier #define was happening too late in the #include sequence;
tradstdc.h is processed before global.h+(vmsconf.h,unixconf.h,...).

Also, DEC C in 'common' mode complains about indented '#' starting a
line but not in column 1.  Putting #pragma in column 2 was deliberate
in case of an ancient compiler which doesn't understand that directive.
Splitting the difference via non-indented '# pragma' may or may not
mollify the latter when it's bypassing conditionally excluded code.
2019-04-15 13:48:27 -07:00
nhmall
c4465c35ed Merge branch 'NetHack-3.6.2' 2019-04-13 22:40:44 -04:00
PatR
0776a864f1 slightly better shop repair feedback
During shop repair, give a message about the shopkeeper using a spell
(if hero is close enough) before "Suddenly, <various repairs occur>."
And when shop repair is for a single untrap of landmine or bear trap
adjacent to shk (and the hero can see it happen), say "<Shk> untraps
<trap>" rather than just "Suddenly, a trap is removed from the floor!"
2019-04-13 17:28:26 -07:00
PatR
86e5022293 fix #H8534 - thrown pick-axe vs "scum!"
Change in meaning of mnearto()'s return value wasn't progagated to
shkcatch().  Make it an int instead of boolean so that it can
communicate both 'moved successfully' and 'moved but had to move
another monster out of the way to do so'.
2019-04-11 15:38:51 -07:00
nhmall
08af2b3b92 Merge branch 'NetHack-3.6.2' 2019-04-10 13:06:37 -04:00
PatR
2e30f6916f more !STATUS_HILITES
No point in checking for timed out temporary highlights if there aren't
any highlights.
2019-04-09 17:45:32 -07:00
nhmall
ea1f04959f Merge branch 'NetHack-3.6.2' 2019-04-06 21:08:01 -04:00
PatR
0e425d645f curses vs !HILITE_STATUS
The curses interface wouldn't build with HILITE_STATUS disabled.  I
started adapting it to handle genl_status_update() but that was taking
too much effort with each niggling detail leading to another.  This
goes the opposite direction:  forcing the old STATUS_VIA_WINDOWPORT
behavior without having that #define available.  That dragged along a
bunch of unexpected changes too.
2019-04-06 15:53:51 -07:00
nhmall
add4540ba9 Merge branch 'NetHack-3.6.2' 2019-04-06 09:13:20 -04:00
PatR
0bfd12dd16 tty status
Take care of a minor 'TODO' and make another stab at getting truncated
encumbrance and/or level-description to reset to full size when enough
space becomes available.
2019-04-06 05:36:29 -07:00
nhmall
9a51f8c06f Merge branch 'NetHack-3.6.2' 2019-04-06 08:22:49 -04:00
PatR
b7a884289d botl.c functions
Put the prototypes for routines in botl.c into the same order as the
corresponding functions are in the file.  Also a few were missing and
another few used STATIC_OVL when STATIC_DCL was appropriate.
2019-04-06 01:08:16 -07:00
nhmall
7cefa8331f Merge branch 'NetHack-3.6.2' 2019-04-04 22:37:28 -04:00
PatR
8c4e792770 curses ">>" (terse "--More--")
I've noticed many instances of the game pausing and not being sure why,
then pressing <space> and having it resume.  The curses interface had
a tendency to put its equivalent of the --More-- prompt, >>, somewhere
where that wasn't visible, either off the right hand edge (possibly) or
underneath the window borders if those were enabled.  Especially the
very last one it issues prior to exit.  (An extra one compared to tty
behavior.)

This ended up being a pretty substantial overhaul of message window
handling.  I wouldn't be surprised if it has off-by-one errors which
happen to be paired up and cancel each other out.  ">>" is still drawn
in orange if guicolor is on, now in inverse video when that is off.
If it happens to be drawn at the same screen location in consecutive
instances, the first ">" will toggle between blink and not blink so
that there'll be no doubt as to whether the keypress registered when
dismissing it (moot if the text preceding it is different but there's
no attempt to be smart enough to check that, just screen placement).
2019-04-04 17:55:40 -07:00
nhmall
abfd80d3d7 Merge branch 'NetHack-3.6.2' 2019-04-02 12:25:16 -04:00
PatR
be966cfe5a curses ^P msg_window:Full
This changes the recently added msg_window:f for curses to start
viewing the old messages on the last page rather than the first.  For
msg_window:Reversed (the default for curses) and for either direction
when all of the message history happens to fit on one page, there's
no change.  But for multiple pages, the FIFO feedback now pads the top
of the first page with blank lines so that the last page is full, and
it starts out showing that last page first.  So if you only want to go
back few or several messages, they will be in view immediately.

Old layout:
|first message (oldest)   |  |1st message of last page |
|2nd message of 1st page  |  | ...                     |
| ...                     |  |final (most recent) mesg |
| ...                     |  | (blank filler)          |
|last message of 1st page |  | (blank filler)          |
|             (1 of 2) => |  |          <= (2 of 2)    |
and ^P started with first page visible and needed normal menu handling,
<space> or '>' or '|', to go forward to view the most recent messages.

New layout:
|1st message of last page |  | (blank filler)          |
|2nd message of last page |  | (blank filler)          |
| ...                     |  |first message (oldest)   |
| ...                     |  | ...                     |
|final (most recent)      |  |last message of 1st page |
| <= (2 of 2)             |  |    (1 of 2) =>          |
and ^P starts on last page (two of two in this example) but can go
back with '<' and '^'.

So if the total size takes one and third pages (which isn't uncommon
for the default number of kept messages), you'll see 3/4 of the most
recent messages on the initial screen, then you can page backward if
you want to see the other 1/4.

The page indicator is deliberately drawn a bit differently just to
draw attention to the fact you're starting on the last page.  I'm not
sure whether that is actually worthwhile but it was trivial to do.
2019-04-02 01:11:59 -07:00
PatR
72696a36a5 build fix for X11-only
I didn't noticed this because I've been building for tty+curses+X11
and either of the first two cause iflags.extmenu to exist.  Make it
unconditional; there's not much benefit from trying to suppress it
for configurations that don't need it.
2019-04-01 14:56:00 -07:00
PatR
0a847f46f9 streamlined status update for 'time'
When the 'time' option is on and context.botl isn't already set,
call a simpler status update routine that ignores all other fields.
When that flag is already set, full status update takes care of time
along with the other fields.

Expected to reduce bottom lines processing time but not screen I/O.
Only lightly tested.
2019-03-31 08:23:36 -07:00
PatR
68542da636 curses: save/restore message history
Have the curses interface save and restore message history for use
by ^P.  It doesn't spit the saved messages out into the visible
message window after restore; that's too distracting.
2019-03-29 17:03:03 -07:00
PatR
14d8ed199e tty: panning while clipped
Noticed while testing statuslines on a small terminal window.  Using
the cursor to pick locations that panned the map to view a new subset
would end up showing a new view of the regular map rather than a
different section of what was currently displayed.  For farlook that
caused monsters to take on new hallucinatory forms which was fairly
inconsequential, but for #terrain and various forms of detection it
reverted to the ordinary map instead of showing the map features that
the player requested or the temporarily revealed monsters and such.

Most interfaces keep track of the whole map and just show their view
of the new subset when panning, similar to redisplay after being
covered up and then re-exposed, but tty isn't doing that.  I made
same change to Amiga as to tty since the code it was using was very
similar.  I haven't touched any of the other interfaces and assume
that they don't need this.  I've verified that curses and X11 don't.
2019-03-29 14:35:36 -07:00
PatR
d1dade164e tty statuslines:3
Implement the 'statuslines' option for tty.  2 and 3 line status are
similar to curses.  Tty's version doesn't include insertion of extra
spaces for enhanced readability, or ignoring 'showexp' when space is
needed for other fields, or right justifying 'score' and suppressing
it when there isn't room for the entire number.  It continues to have
abbreviated condition and encumbrance descriptions that curses lacks
which get used when the normal ones take up too much space.

'statuslines' can be set with 'O' so it is feasible to switch back
and forth between 2 and 3 lines on the fly.  But only if the display
is at least 25 lines (actually ROWNO+4) or else CLIPPING is enabled
at build time.

This fixes the bug where after resorting to abbreviated condition
values it sometimes (always?) wouldn't switch back after more room
became available.  Abbreviated encumbrance values had problems too
(lack of leading space and not changing value if encumbrance changed
to anything other than unencumbered) and this fixes that as well.
2019-03-29 04:21:18 -07:00
nhmall
7ff8b21a15 Merge branch 'NetHack-3.6.2' 2019-03-25 07:26:43 -04:00
PatR
ee53a9fea6 curses message recall, memory leaks
Using ^P right after resize or 'O' of align_message, align_status,
statuslines, or windowborders would result in
'curses_display_nhmenu: attempt to display empty menu'
because some memory cleanup I added several weeks back was being
executed when the curses interface tore down and recreated its
internal windows.

This fixes ^P handling by making sure that that menu (which is just
text but uses a menu to support '>'/'<'/'^'/'|' scrolling) will never
be empty and it also fixes the window deletion to not throw away
message history until it's final deletion at exit time.

^P uses a popup window to display previous messages and it was never
deleting that window, just creating a new one each time.  Same with
the routine which displays an external help file.  Using either or
combination of both close to 5000 times would probably make internal
window creation get stuck in an infinite loop.  Delete those windows
after they're used so it'll never be put to the test.

The memory cleanup I added for map/status/messages/invent was only
being preformed at end of game, not when saving.  Fix that too.
2019-03-24 17:50:26 -07:00
nhmall
bfa7421edb Merge branch 'NetHack-3.6.2' 2019-03-24 12:44:51 -04:00
PatR
d989b36763 revamped curses status display
I've overhauled the status display for curses.  Horizontal layout
supports both 2 lines and 3 lines which can be changed dynamically
via using 'O' to set 'statuslines'.  Fields are spread out a little
more than they used to be, making it more readable--at least to me--
but the extra spaces get squeezed out when lines become too long.
If 'showexp' is on and either conditions or hunger+encumbrance go
off the right edge, experience points are suppressed (but the option
is left on, so they'll come back once there is room).

For traditional 2-line hozizontal status, if hunger+encumbrance+
conditions go off the right edge even after experience points are
knocked out, there will be a '+' in the rightmost column if there
are any conditions that are all the way off.  At present it doesn't
use the tty method of switching to abbreviated condition names to
reduce their legnth.  I'll probably tackle that eventually if no one
beats me to it.

For 3-line horizonal status, there was an older implementation (but
disabled via #if 0) with gold and score moving to the third line.
(I'm not sure how status conditions were handled.)  This one ignored
that and modified 2-line from scratch, moving alignment from line one
to line 2 and level description, time, and conditions from line 2 to
line 3.  It looks like this (view with a fixed-width font...).

Wizard the Hatamoto            St:16 Dx:15 Co:18 In:8 Wi:11 Ch:7    S:25
Lawful  $:21  HP:25(25)  Pw:6(6)  AC:4  Xp:2/21  Hungry Burdened
Dlvl:1  T:36                                     Blind Lev

Score is actually right aligned with the edge but I've deleted several
spaces to keep the line shorter here.  The status conditions line up
with the hunger slot as that shifts due to changes in gold/HP/power/AC/
experience, and conditions prefer that column even when hunger and/or
encumbrance are blank.  Howver, if the number of conditions increase to
the point where they would go off the edge, the whole list shifts left
instead of trying to stay lined up with hunger.  (It's just coincidence
that the lefthand parts of lines 2 and 3 seem to line up in this sample.
In general, they don't.)

The vertical layout has reordered most of the fields and now has a few
blank lines to separate those fields into some groups for readability.
Lines have the form of
Field-name  : Value
and when highlights apply, now they only affect the value portion.
Single digit characteristics are padded with a leading space so that
all six of them line up (for "18/xx", "/xx" protrudes to the right).
HP and Pw are aligned with each other.  Hunger and encumbrance share a
line.  When there are more than three conditions, they're shown three
per line instead of wrapping across lines.  And if too many lines are
present, it will squeeze out enough blank ones to fit.

To see the vertical status, you need a display size of at least 106
columns with 'windowborders' explicitly off, or 110 with them on; also
set option 'align_status' to 'right' or 'left'.  (With borders on,
including the default 'auto' setting, the vertical status appears at
width of 108 columns, but does so by hiding 2 columns of the map; using
110 columns avoids that.)  Resizing from outside the game or changing
align_status via 'O' both cause dynamic reconfiguration of the layout;
there's no need to save, make config changes, then restore.
2019-03-23 17:38:23 -07:00
nhmall
c3b89f775e Merge branch 'NetHack-3.6.2' 2019-03-21 18:18:34 -04:00
PatR
5efea7115a curses options and status groundwork
More groundwork for overhauling the status display for curses, plus
a few functional changes.  It was doing a full status update for
every changed field (except conditions), instead of waiting for a
flush directive after gathering multiple changes at a time.  Since
it already does gather every change, the fix to wait is trivial.

This decouples 'hitpointbar' from 'statushilites'.  When highlighting
is off, it uses inverse video only.  When on, it behaves as before:
using inverse video plus the most recent color used to highlight HP
(which can vary if that has rules to highlight changes or percentage
thresholds) but ignoring any HP attribute(s).  This also enables the
latent 'statuslines' option and changes 'windowborders' option from
being settable at startup only to changeable during play.

'statuslines' can have a value of 2 (the default) or 3 and applies to
'align_status:bottom' or 'top'; it's ignored for 'left' and 'right'.
At the moment, setting it to 3 only allows status condition overflow
to wrap from the end of line to 2 to the beginning of line 3, and if
window borders are drawn they'll clobber the last character on line 2
and first one on line 3.  There's no point in trying to fix that
because it will go away when the main status overhaul changes go in.
Condition wrapping for vertical orientation (left or right placement)
was already subject to the same phenomenon and will be superseded too.

This also changes the meaning of the 'windowborders' value so could
impact players using source from git (or possibly beta binaries for
Windows, but not for OSX where curses interface wasn't included).
Old:
 0 = unspecified, 1 = On, 2 = Off, 3 = Auto (On if display is big
     enough, Off otherwise; reevaluated after dynamic resizing);
 Unspecified got changed to 3 during curses windowing initialization.
New:
 0 = Off, 1 = On, 2 = Auto;
 0 gets changed to 2 for default value at start of options processing.
So old value of 2 is changing meaning and explicit old value of 3 is
becoming invalid.  Implicit 3 changes to default 2.  Explicit 3 could
be the subject of a fixup but there isn't much point since 2 can't
have a similar fix.  Users who are using old 2 or explicit 3 will need
to update their run-time config files.

This adds 'statuslines' to the Guidebook and moves some other recently
added documentation of curses options from among the general options
(section 9.4) to "Window Port Customization options" (section 9.5).
None of them have been added to dat/opthelp which seems to be missing
all the wincap options.

Originally I made a lot of changes (mostly moving C99 declarations to
start of their blocks) to the old '#if 0' code at end of cursstat.c,
but have tossed those, except for one subtle bug that assumed 'int'
and 'long' are the same size.
2019-03-21 14:33:39 -07:00
nhmall
5a7d780db6 Merge branch 'NetHack-3.6.2' 2019-03-20 09:28:48 -04:00
PatR
7049145712 curses update
Miscellaenous stuff either groundwork for or noticed while updating
curses status.  The status changes themselves need some more testing.
One or two of the comments refer to that revised status which hasn't
been checked in yet.
2019-03-18 15:08:01 -07:00
PatR
44a7bfbab6 decode_mixed()'s return type
decode_mixed() writes its output into a 'char *' buffer that's passed
in to it and then returns that buffer.  Some excessively paranoid
error checking forced to return 'const char *'.  Relax that and use
'char *' so callers can work with the result without extra casts.
2019-03-18 14:38:30 -07:00
nhmall
fc9dde7ae1 Merge branch 'NetHack-3.6.2' 2019-03-13 20:21:56 -04:00
nhmall
963cb352bc Merge branch 'NetHack-3.6.2-beta01' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.6.2-beta01 2019-03-13 20:04:50 -04:00
nhmall
13c0428721 even more mingw 2019-03-13 19:59:57 -04:00
PatR
ccd6d1407e curses: hilite_pet, hilite_pile without color
The curses interface was ignoring video attributes (bold, inverse, &c)
when color is toggled off or if built with TEXTCOLOR disabled.  Honor
attributes regardless of whether color is displayed.

Also, toggling 'hilite_pet' On during play wouldn't do anything if the
curses-specific 'petattr' option had been left as None.  (It worked as
intended if set in starting options.)
2019-03-13 16:50:56 -07:00
nhmall
fa186b49a1 Merge branch 'NetHack-3.6.2' 2019-03-12 21:18:46 -04:00
nhmall
93201e9e24 first attempt at mingw w64 build for Windows 2019-03-12 21:14:43 -04:00
PatR
02b21865fd more UCHAR_P
When setting up an alternate definition for UCHAR_P to accommodate
DEC C's non-ANSI mode(s), leave the default definition to tradstdc.h.
DEC C's VAXC mode will end up expecting 'unsigned char' rather than
either 'int' or 'unsigned int'.  Not applicable for Unix but this
makes similar change there as is being made for VMS.
2019-03-08 11:48:31 -08:00
nhmall
7e79bb2169 Merge branch 'NetHack-3.6.2' 2019-03-08 10:38:18 -05:00