Commit Graph

8984 Commits

Author SHA1 Message Date
Pasi Kallinen
9cd9280276 Lua: remove dgn_comp, use lua instead 2019-11-06 18:45:10 +02:00
Pasi Kallinen
fd55d9118e Use lua for special level files
Game is playable, and should compile on linux and Windows.
Assumes you have a lua 5.3 library available.

Removes level compiler and associated files.
Replaces special level des-files with lua scripts.
Exposes some NetHack internals to lua:
 - des-table with commands to create special levels
 - nh-table with NetHack core commands
 - nhc-table with some constants
 - u-table with some player-specific data (u-struct)
 - selection userdata

Adds some rudimentary tests.

Adds new extended command #wizloadlua to run a specific script,
and #wizloaddes to run a specific level-creation script.

nhlib.lua is loaded for every lua script.

Download and untar lua:
  mkdir lib
  cd lib
  curl -R -O http://www.lua.org/ftp/lua-5.3.5.tar.gz
  tar zxf lua-5.3.5.tar.gz

Then make nethack normally.
2019-11-06 18:43:20 +02:00
PatR
3e029d2900 attributes disclosure: experience points
Wizard mode shows the number of points needed to reach the next level
(unless already maxxed out at 30) for ^X and end of game disclosure.
Do it in normal play for the latter too.  (I think it would ok to do
that for ^X too but haven't gone that far.)

Even when it was wizard mode only, the phrasing for past tense had a
minor grammar bug, and it could make the line a little too long for
tty and curses (not sure about others) when level was high, resulting
in wrapped text.  That looked bad for tty, which first tries removing
indentation (just 1 space in this case), making that line outdented
as well as wrapped.  So change the phrasing slightly when experience
level is 'too high'.  I had a version which formatted, measured, and
re-formatted if necessary but that was overkill; simple hardcoded
rephrasing suffices particularly when measuring was against assumed
display width (80) rather than actual width.
2019-11-06 17:25:45 +02:00
nhmall
ee70762c69 add --depth 1 to git clone for travis windows test 2019-11-06 17:25:45 +02:00
nhmall
c9bba80786 add pdcurses support to travis ci windows test builds
pdcurses is obtained on-the-fly from the github source
2019-11-06 17:25:45 +02:00
nhmall
466516b125 remove "bogus" bit :) 2019-11-06 17:25:45 +02:00
nhmall
ddb5e6e8e5 lower case windows in .travis.yml 2019-11-06 17:25:44 +02:00
nhmall
43935698e0 TRAVIS CI updated to include Windows and osx testing
TRAVIS CI added Windows to their platform list in late 2018.

Update the .travis.yml file to include a pair of Windows in
machines in the testing suite, one built with visual studio
command line tools and the other with mingw gcc tools.

The visual studio build is currently using nmake with the
sys/winnt/Makefile.msc Makefile from our distribution,
That's the same process we've been using for building
our binaries, pretty much.

BRH may be able to modernize it over the next couple of
weeks to use the msbuild process instead.

I went with the HINTS environment variable on windows
for consistent self-documenting purposes, even though
the environment variable isn't used on windows.

included:
   os: linux
   Compiler: gcc C
   HINTS=linux

   os: linux
   Compiler: clang C
   HINTS=linux

   os: linux
   Compiler: gcc C
   HINTS=linux-x11

   os: linux
   Compiler: gcc C
   HINTS=linux-qt5

   os: linux
   Compiler: gcc C
   HINTS=linux-minimal

   os: windows
   language: shell
   HINTS=Windows-visual-studio

   os: windows
   HINTS=Windows-mingw

excluded:
   os: osx
   Compiler: clang
   Xcode: xcode10.2 C
   HINTS=macosx10.14
2019-11-06 17:25:44 +02:00
nhmall
29002ccf0b No PDCurses right out-of-the-box; requires an edit 2019-11-06 17:25:44 +02:00
nhmall
0c7e740b44 update Windows Makefiles to support TRAVIS CI builds 2019-11-06 17:25:44 +02:00
PatR
de44286d79 curses+EDIT_GETLIN again
Turns the "fix" in commit 319dcf4746
handled removing the default answer for single-line-prompt plus
multi-line-answer but not for multi-line-prompt plus long-enough-
answer-to-reach-another-line.  The logic wasn't quite right and I
misunderstood what is stored in linestarts[] so even correct logic
wouldn't have solved things.
2019-11-06 17:25:44 +02:00
nhmall
be94808d67 build fix for Windows if pdcurses is included after recent changes
cursmain.o : error LNK2001: unresolved external symbol _erase_char
cursmesg.o : error LNK2001: unresolved external symbol _erase_char
cursmain.o : error LNK2001: unresolved external symbol _kill_char
cursmesg.o : error LNK2001: unresolved external symbol _kill_char
2019-11-06 17:25:44 +02:00
nhmall
0b861f64e6 merge bit 2019-11-06 17:25:44 +02:00
nhmall
133185c72e Merge branch 'master' into NetHack-3.7 2019-06-28 18:30:47 -04:00
nhmall
0a32747794 Merge branch 'NetHack-3.6' 2019-06-28 18:30:32 -04:00
PatR
7013563415 ^I vs perm_invent again
A recent fix for #wizidentify showing "Not carrying anything" after
listing inventory items still showed "Not carrying anything" after
"(all items are already identified)".  Fix is easy.

Trickier bug was that ^I performs object ID on selected items while
the inventory routine is still in progress (but after it has processed
every item) and the ID routine will call update_inventory() which
will call the inventory routine to reformat invent.  So the inventory
display routine was called recursively without having returned to
wizidentify where iflags.override_ID gets cleared to revert to normal
inventory.  The nested call was unintentionally narrowing the contents
of persistent inventory window to whatever items were still unIDed.
(Any inventory update, including ^R, restored it to full inventory.)
2019-06-28 12:50:08 -07:00
PatR
bed5570e3b curses popup single char input
With 'popup_dialog' On, a one line popup with question and likely
responses and default answer was shown, but without having the
cursor displayed at the end of emphasize that it was waiting for an
answer.  Make the popup be one character wider so that there is room
to show the cursor.  No effect when 'popup_dialog' is Off and prompts
are shown at the bottom of the message window; those already have the
cursor sitting at the end.
2019-06-28 12:28:40 -07:00
PatR
2145387ac8 curses menu and text window size
Make final inventory disclosure use a full width menu instead of
the default 38-column width with lots of wrapping.  Also, increase
that default from 38 to 40 for the rest of the time.  Commit
9f6588af49 made the 38 vs 40 portion
matter much less but I decided to keep it in anyway.

When a menu or 'things that are here' popup has only a couple of
lines and they happen to be narrow, a sized-to-fit window isn't
always easy to spot when it is shown over the ends of old messages
rather than over the map, even with a border box around it.  Give
such windows a minimum size of 5x25 so that they always stand out
enough to be immediately seen.  This will cause more message text to
be rewritten occasionally (after dismissing the menu or text window)
but the curses interface seems to discount that as something to be
concerned about.
2019-06-28 11:59:14 -07:00
PatR
119f0365f7 curses mouse_support bit for fixes36.3 2019-06-28 03:17:25 -07:00
PatR
80374d46b5 Merge 'curses-mouse_support' into NetHack-3.6
Fully support the mouse_support option for curses, via 'O' as well as
via config file.  At the moment, mouse_support:1 and mouse_support:2
are equivalent.

Also, fix the screen-to-map coordinate translation.  When the mouse
is active and over the map, the pointer's cursor becomes a cross-hair
(may very by platform) and the character cell chosen for a click
seems to be a few pixels to the right of the center of the '+'.
2019-06-28 03:08:30 -07:00
nhmall
39eed81aa2 PDCurses behaves the same as ncurses 2019-06-27 23:22:34 -04:00
nhmall
1f31b8cbda Revert "PDCurses behaves the same as ncurses"
This reverts commit aa9e03eef8.
2019-06-27 23:21:36 -04:00
nhmall
aa9e03eef8 PDCurses behaves the same as ncurses 2019-06-27 23:20:13 -04:00
nhmall
99aa1b9bc5 Merge branch 'master' into NetHack-3.7 2019-06-27 23:15:46 -04:00
nhmall
1509aea758 Merge branch 'NetHack-3.6' 2019-06-27 23:15:07 -04:00
nhmall
bd2cd75f7a PDCurses requires PDC_NCMOUSE for compatibility with ncurses
The PDC_NCMOUSE has to be defined on the command line
or above the #include entries in win/curses/cursmisc.c.

This does the former command line change.
2019-06-27 23:12:06 -04:00
PatR
928534509f UNIX|VMS compile warning
So no one on Unix or Unix-like ever builds without tty support?

options.c:694:11: warning: unused variable 'opts' [-Wunused-variable]

Noticed when producing a curses-only binary to verify that erase_char
and kill_char weren't relying on tty being present.
2019-06-27 17:42:56 -07:00
PatR
df8eac79b5 curses erase char and kill char
Support user's terminal settings for erase char and for kill char.
Erase char is typically <delete> or <backspace>, both of which are
already explicitly handled so probably no effect there.  Kill char
(generally ^U these days) will be honored unless it is a printable
character (don't know whether there are any troglodytes out there
who still use '@' for that...).  The current handling for ESC works
the same if there is any input to kill, but yields 'cancelled' when
there isn't.

That's for message window getline(), which operates char-by-char.
The popup getline() uses a curses routine to get an entire string
and already honors kill char but treats ESC as input of ^[.
2019-06-27 17:18:07 -07:00
PatR
56387dccb6 curses mouse right-click
Right button is button3 rather than button2.  Accept either and treat
both as "not left" to pass CLICK_2 back to the core.

Treat <Ctrl>+left-click as "not left" too, to simplify usage with Mac
one-button mouse (where <Ctrl>+left-click can be configured to send
"secondary click" but might not be set do so) or one-button laptop
trackpad (where having two fingers on the scrolling portion of the pad
while clicking the button is necessary to send "secondary click").
2019-06-27 15:02:49 -07:00
nhmall
924a0e691f Merge branch 'master' into NetHack-3.7 2019-06-27 00:00:58 -04:00
nhmall
28879d296d Merge branch 'NetHack-3.6' 2019-06-26 23:52:56 -04:00
PatR
aada9e2706 mouse_support for win/curses using ncurses 2019-06-26 15:46:44 -07:00
PatR
fa4f9bb8ae coalescing partly eaten globs
Another one which has been around for a while.  When merging two
globs, the result is partly eaten if either (or both) of them was
partly eaten, not just when the one that's going to stick around as
the combined glob already was.
2019-06-26 15:37:17 -07:00
PatR
54e2e71319 mpickobj sanity, ball&chain theft feedback
Something I've had sitting around for quite a while.  Add a sanity
check to mpickobj().  (It will need tweaking if b&c are changed to be
in engulfer's inventory.)

Also, include more information in the feedback when a nymph steals
attached iron ball:  "Nymph removed your chain and stole a heavy iron
ball".

And don't set the avenge-ok flag if uball is the item stolen since
thief was doing hero a favor, or for anything when the thief is under
the influence of Conflict.
2019-06-26 15:33:40 -07:00
nhmall
7e268d7952 macosx warning suppression final for tonight 2019-06-25 22:11:31 -04:00
nhmall
1ab2fff539 macosx warning suppression part 4 2019-06-25 22:09:25 -04:00
nhmall
06c4b6cd7e macosx warning suppression part 3 2019-06-25 21:44:38 -04:00
nhmall
7775918a1a macosx warning suppression part 2 2019-06-25 21:17:39 -04:00
nhmall
1b058e4f2a more warning suppression from unused variables 2019-06-25 21:04:37 -04:00
nhmall
ed97095670 Merge branch 'master' into NetHack-3.7 2019-06-25 15:59:39 -04:00
nhmall
9b467c7c06 Merge branch 'NetHack-3.6' 2019-06-25 15:54:08 -04:00
PatR
88f19c57e4 ball&chain bit
A check for bad restoration (ball without chain or vice versa) issued
a warning but then left the problem around to trip up other code.
'Fix' the problem by clearing those owornmask slots and their pointers.
Doesn't try to recover memory if the one that's found is OBJ_FREE.

Also some formatting.
2019-06-25 11:02:07 -07:00
nhmall
dedff68f5a remove a 3.6 save file compat kludge and clear another warning 2019-06-25 10:20:06 -04:00
nhmall
fade914218 Merge branch 'master' into NetHack-3.7 2019-06-25 09:42:49 -04:00
nhmall
78805516be Merge branch 'NetHack-3.6' 2019-06-25 09:42:13 -04:00
PatR
d0a32762ab keyhelp typo 2019-06-25 03:27:42 -07:00
PatR
4f0b1262c5 curses clipped map 'scrollbars'
The position bars shown by curses when the map is clipped weren't
being drawn as intended (integer arithmetic).  Changing parentheses
was enough to get it working, but it didn't handle the edge case
where non-zero got rounded to 0 (so when map was panned down, the
uppermost character of the vertical position bar still showed '*',
falsely indicating that top of map was currently within view.
2019-06-25 03:17:47 -07:00
PatR
3bd46a3536 curses cursor
Followup to 1c03d0970115c776d1c4791fea3c33f70b0b5378; that had been
too easy.  When map was clipped and panned to the side, the highlight
for hero's spot was shown next to the '@' instead of on it.
2019-06-25 02:30:27 -07:00
nhmall
163a9287f5 shadow variable bit in version.c 2019-06-25 01:10:47 -04:00
nhmall
bbedd61c9e even more macosx warnings 2019-06-25 01:07:18 -04:00