Commit Graph

12034 Commits

Author SHA1 Message Date
nhmall
ca7b1d5df0 another nhsetup.bat tweak 2021-06-08 14:15:36 -04:00
nhmall
e6d9e6be0b no need to check vs version in nhsetup.bat 2021-06-08 13:56:02 -04:00
PatR
04a8ddcce1 fix github issue #531 - genderless corpses
Dead monsters that had traits saved with the corpse would revive as
the same gender, but ordinary corpses revived with random gender so
could be different from before they got killed.

Since corpses of monsters lacked gender, those for monsters with
gender-specific names were described by the neuter name.

This is a fairly big change for a fairly minor problem and needs a
lot more testing.

Fixes #531
2021-06-08 03:43:46 -07:00
PatR
14b2330fd6 curses color cleanup
The color handling changes for curses left a set of variables
unused, so get rid of them.
2021-06-06 15:23:39 -07:00
PatR
e20dd2e760 fix github issue #530 - weapon skill enlightenment
^X feedback and end of game disclosure reported
 Your two weapon skill {is,was} [also] limited by being <skill rating>
 with with <secondary weapon>.
when the skill rating for the secondary weapon is/was less than the
skill rating for two-weapon combat.  The corresponding message for
primary weapon did not duplicate the word "with".

Fixes #530
2021-06-06 13:38:49 -07:00
Pasi Kallinen
97e58a4fdc Change autopickup and color default values
Change the default value of autopickup to off. Having it on is
harmful for new players, making them very easily burdened.
We can't expect new players to know how to configure
pickup_types, pickup_burden, and pickup exceptions.

Change the default value of color to on. We can safely assume
new users have a terminal that supports color, and most people
want color.
2021-06-06 19:25:49 +03:00
PatR
41eecdf6b3 curses menu: support backspace/delete for counts
Have curses call the core get_count() routine instead rolling its
own so that backspace and delete are supported.  That part was
trivial to accomplish.  Unfortunately it brought the disappearing
menu phenomenon back so it became more complicated overall.
2021-06-06 05:54:53 -07:00
PatR
0280006d76 fix #K3357 - curses menu disappears
This fixes the disappearing menu, but not curses menu count entry
failing to honor backspace/delete.  Entering two or more digits
to get a "Count:12" message, followed by non-digit which removes
that, resulted in the menu for apply/loot in-out container operation
vanishing while it was still waiting for a choice.  (Typing a choice
blindly did work.)

The code intended to handle this.  I don't understand why refresh()
wasn't working.  Reordering stuff didn't help until I changed that
from refresh() to wrefresh(win).

The original Count:123 display was limited to 25 characters and
menus to half the main window, so they didn't overlap.  I made the
count display wider--because it is now also used for 'autodescribe'
feedback when moving the cursor around the map--so made something
that originally was impossible become possible.  One line of the
menu does get erased while "Count:" is displayed, but then gets put
back by the wrefresh().
2021-06-05 16:11:50 -07:00
PatR
b8b95718d7 fix pull request #527 - cursed levitation
The stair handling reorganization changed drinking a cursed potion
of levitation to only check whether stairs up existed on the level
instead of whether the hero drank the potion while at their spot.
That resulted in always attempting to go up and then getting "you
can't go up here" when not at stairs instead of the intended "you
hit your head on the ceiling".

Fixes #527
2021-06-05 15:37:03 -07:00
PatR
60cc48890b fix pull request #526 - 'menucolor' help message
being given when it shouldn't be.  A change for perm_invent handling
back in March screwed up the if/then/else logic for code executed
when finishing MENUCOLOR manipulation via the 'O' command.  That
resulted in the reminder to set menucolors to True being given even
when it was already True if perm_invent happened to be False.

I noticed this myself recently, then neglected to investigate it or
even write it down anywhere.

Fixes #526
2021-06-05 15:17:55 -07:00
Patric Mueller
5c15ca1002 curses: remove unnecessary special handling for dark gray
On terminals with at least 16 colors there should be no need for special
handling dark gray.

The curses code uses COLORS < 16, COLORS <= 16, COLORS > 16, or COLORS >= 16
at several places although I'm not sure if they are correct or which could
possibly be off-by-one errors.

But realistically in this case, we only need to distinguish between 8 color
terminals and terminals supporting more than 8 colors as this will mean the
terminal supports at least 256 colors.
2021-06-05 14:38:41 +02:00
Patric Mueller
6e7f1bc1f0 curses: don't change the terminal's default colors
The curses port changed some of the basic 8 terminal colors and all 8 bright
colors on terminals supporting changing colors.
2021-06-05 14:38:13 +02:00
nhmall
70925807f6 nuget restore task 2021-06-04 23:01:49 -04:00
nhmall
0305a14a27 windows substitution error in gcc Makefile 2021-06-04 21:46:03 -04:00
PatR
e7cc458225 a few formatting bits for zap.c 2021-06-04 15:51:36 -07:00
nhmall
7439c8b060 windsys.c name tidbit 2021-06-04 08:51:42 -04:00
nhmall
4c3078041d Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7 2021-06-04 08:49:47 -04:00
nhmall
631e80c47a msdos Install.dos tidbit 2021-06-04 08:49:20 -04:00
Pasi Kallinen
8849f66dae Don't bind quit to any key by default
Quit is not a commmand you usually need very often, and generally
don't want to use by accident.

Apparently, on Spanish keyboard layout, n-with-tilde is interpreted
by the Windows NetHack as M-q, and the key is next to l. Loot also
asks for confirmation, just like quit.

Prevent stuff like this by not binding the quit command to any key.
2021-06-04 09:13:30 +03:00
nhmall
0fcc151706 cron daily Files update 2021-06-04 00:27:20 -04:00
nhmall
80d3178d25 windows doc update tidbit 2021-06-04 00:24:46 -04:00
nhmall
254c6c55f5 Windows build warning and Makefile update
.\hack.c(2657): warning C4389: '!=': signed/unsigned mismatch
Visual Studio autodetection update for Makefile.msc
2021-06-04 00:14:37 -04:00
nhmall
d27c507c16 pipelines update 2021-06-04 00:01:37 -04:00
nhmall
91ab71f0f9 windows and visual studio follow-up bit 2021-06-03 23:43:32 -04:00
nhmall
0a10bd632d change references from winnt to windows
rename sys/winnt to sys/windows
move vs (visual studio) folder out of win/win32 and into sys/windows
rename include/ntconf.h to include/windconf.h
rename winnt.c to windsys.c
place visual studio projects into individual subfolders.

This will hopefully resolve GitHub issue #484 as well.
2021-06-03 23:26:00 -04:00
PatR
acfbf20958 unix/Makefile.top fetch-Lua bit
% make spotless
% sh sys/unix/setup.sh sys/unix/hints/macOS.2020
% make fetch-Lua

worked, but the last ended with

|rm include/nhlua.h
|rm: include/nhlua.h: No such file or directory
|make: [fetch-Lua] Error 1 (ignored)

which might frighten skittish users (like me).  Check whether the
constructed header file exists (so is assumed to be for an earlier
Lua version) and only delete it in that case.  No more scary report
of benign failure when it isn't there (after 'make spotless' or for
brand new source setup).

Also, some time ago we came to the conclusion that 'if [ ]' was an
extension for GNU 'bash' and wouldn't work with some older actual
'sh' implementations.  This replaces the one post-3.6 instance of
|if [ ! -d foo ] then bar; fi
in Makefile.top with
|if test -d foo; then true; else bar; fi
Testing was successful but done with bash rather than an old sh. :-}
2021-06-02 17:13:56 -07:00
nhmall
5c95603a82 Makefile command echo suppression 2021-06-02 19:21:37 -04:00
nhmall
e69808987e support for build with current Lua version 5.4.3
On some platforms this may require:
	make spotless
	make fetch-lua

I did attempt to force a reminder message about the latter to
Makefile.top this time, and hope that works correctly for everyone.
2021-06-02 19:12:47 -04:00
PatR
9e59977c79 fix pull request #521 - valk+warrior alignment
Valkyrie player monster was set to be chaotic even though valk
hero is lawful by default and can also be neutral but not chaotic.
Change it to be lawful.  Warrior quest monsters attending leader
were also chaotic; change to lawful to match revised valk.  If
hero is a neutral valk then both the player monster and warriors
get changed to neutral at start of game (and stay that way even
if hero changes alignment).  The leader defaults to neutral but
gets changed to lawful for lawful valk hero.

Attentdant quest monsters with the healer leader were lawful but
if they gain enough experience they get promoted to healer, so
make them neutral like the latter.

I've added some miscellaneous comments and done a small amount of
reformatting.  Comment about alignment changing in bones applies
to all roles that can be played with different alignments, not
just to valkyries.  It isn't new; I just thought that it ought to
be mentioned somewhere.

Fixes #521
2021-06-01 17:14:50 -07:00
PatR
ffddb3ecf9 append_str(pager.c) again
More for issue #524.

The revised append_str() was still vulnerable to unsigned subtraction
overflowing from small negative value to huge positive one, if caller
ever passed an outbuf buffer which already had more than BUFSZ
characters in it.

Also the semantics were changed.  If there wasn't room for the whole
" or "+string to be appended, it used to add as much as would fit.
The revised version changed that to all-or-nothing.  This changes it
back, although players will probably never know the difference.
2021-05-31 15:28:19 -07:00
PatR
6fb8434ec9 Tribute: Feet of Clay
Add a page citation for passage #1 and change the wording of that
passage to match the book:  the second "does not need" should be
"doesn't even need".

Also make the comments about various added passages (for other
books) be more consistent.
2021-05-31 07:59:12 -07:00
nhmall
174cd59616 potential buffer overflow in append_str
fixes #524
2021-05-31 10:21:44 -04:00
PatR
53888a713c add ^ and " choices to / command
Like /m for nearby monsters and /O for all objects, implement /^
and /" to view a list of nearby traps or all known traps.  Only
lists discovered traps (or mimics immitating traps, or detected
door or chest traps iff still shown as such on map), but lists
map traps even when an object or monster at the same location is
blocking view of them.

For traps on the Water and Air levels that have been mapped, they
will only be listed when within line of sight so that this feature
can't be used to track portal location as it moves around.  However,
when within line of sight it does allow the portal to be recognized
if that has become covered.
2021-05-30 17:31:47 -07:00
PatR
494b374e12 whatis / quick-whatis for '^'
When using '//' or ';' to examine the map and player uses '^' to
move the cursor to the next displayed trap, have cursor go to
locations containing webs, the vibrating square, or other non-'^'
trap when such is the next trap symbol up.  Otherwise looking at
webs is very tedious because '"' is treated as a look-at command
rather than than a target symbol.
2021-05-30 01:31:54 -07:00
PatR
0fda8504bb sp_lev.c reformatting
Mostly reformatting but fixes a bug in mapfrag_free(); would matter
if the same map fragment gets freed a second time.
2021-05-30 01:01:01 -07:00
PatR
72866e2252 special level loading error
For the baalz 'lit=0' fix, I first tried 'lit=false'.  That isn't
supported and triggered an error, but the error reporting passed
a null pointer to sprintf() for a %s argument.  OSX's stdio shows
"null" instead of crashing in that situation; most implementations
wouldn't be so forgiving.

It intends to complain about "false" but that won't work if the
unexpected value doesn't get put into the lua table.  I don't know
how to fix that aspect of this.  This fix just avoids passing a
null pointer to sprintf.  Plus some miscellaneous reformatting.
2021-05-29 13:34:32 -07:00
PatR
7f2620b98c fix pull request #523 - lighting on baalz level
Details for baalz level are different from other levels and that
unintentionally gave it a chance to be lit.  Force it to be unlit.

Fixes #523
2021-05-29 13:33:15 -07:00
PatR
825314c040 tribute update: Maskerade
Accept "novel named Masquerade" when wishing for Maskerade.

Add four new passages, bringing total to 13.
2021-05-26 13:19:36 -07:00
Pasi Kallinen
a71482af71 Check genocided zombies before raising the zombified corpse
Fixes #520
2021-05-26 09:02:38 +03:00
PatR
0cdb91aa50 Unix 'make update'
Revise Makefile.top to remove the obsolete commands which change
the last modified date of save and bones files during 'make update'.
Using file dates to validate save files against nethack hasn't been
useful for many years.

Also, update assorted comments.
2021-05-23 18:14:13 -07:00
Pasi Kallinen
8d2407f1f2 Monsters can gain resistances by eating corpses
This is based on both the EvilHack implementation by
k21971 <keith.simpson1971@gmail.com>, and xNetHack
implementation by copperwater <aosdict@gmail.com>.
2021-05-23 19:03:33 +03:00
Pasi Kallinen
20cbadcf85 Unlock your quest by killing your quest leader
Allow killing your quest leader, just to make games winnable if you
converted before doing the quest.
Boost the quest leaders and give them some equipment. King Arthur
gets Excalibur. Killing quest leader gives really bad luck and
makes your god angry at you, and killing quest guardians gives
smaller penalties.

This is based on both the EvilHack implementation by
k21971 <keith.simpson1971@gmail.com>, and xNetHack
implementation by copperwater <aosdict@gmail.com>.
2021-05-23 11:11:58 +03:00
copperwater
882efdcf58 Pets are more careful about attacking monsters at low health
Another SliceHack feature. However, the math implemented by SliceHack
seemed incorrect, so I tweaked it.

Pets previously attacked monsters of up to one level higher than them as
long as they were above 25% health. Now, they will attack monsters as
follows:
100%: up to level + 2 (pets could not attack this high before)
80%+: up to level + 1
60%+: up to same level
40%+: up to level - 1
25%+: up to level - 2

The case that prevents any attacks below 25% health still exists.
2021-05-22 16:44:58 +03:00
Pasi Kallinen
6b60618e0e Exploding spheres cause real explosions
Despite active explosion attacks being called explosions in-game,
they only affected a single target, and were handled differently
from actual explosions. Make them do an actual explosion instead.
This should make spheres more interesting and inspire different
tactics handling them.

Because spheres deal more damage on average and can destroy items
in their explosions, their difficulty has been increased slightly.

Polyselfed hero exploding won't cause elemental damage to their
own gear.

Originally from xNetHack by copperwater <aosdict@gmail.com>.
2021-05-22 13:37:39 +03:00
Pasi Kallinen
7f8cfb43d2 More hallu colors 2021-05-22 08:56:54 +03:00
Pasi Kallinen
29868036f1 Lua: nhcore script with function callbacks
Adds possible callbacks for "start_new_game", "restore_old_game",
"moveloop_turn", and "game_exit" which when defined, will be called
from core code at the appropriate time.

Adds lua hooks for dump_fmtstr (only if DUMPLOG), dnum_name, u.moves,
u.uhave_amulet, and u.depth.
2021-05-21 21:24:59 +03:00
PatR
0e9bf2e03c config error reporting
Try to handle the convoluted error handling better.  Not very
thoroughly tested...
2021-05-21 08:52:18 -07:00
PatR
164417f01f fix github issue #514 - 'O' segfault
The #version command retrieves the lua version number to include
in its output, but it was leaving the 'in_lua' flag set.  So if a
later 'O' command tried to complain about a bad option value, the
error reporting routine crashed.
2021-05-21 08:40:39 -07:00
PatR
d6cafdc527 fix github issue #515 - grappling hook internals
Grappling hook used to have an undiscovered description of "iron hook"
and when that was removed, the oc_name_known flag was left set as if
for something that could become discovered.  I'm not sure whether that
made any difference anywhere.

Gold piece was in a similar situation, except that it wasn't because
an alternate description had been present and then removed.  That one
definitely didn't make any difference anywhere.

Fixes #515
2021-05-20 18:56:03 -07:00
Pasi Kallinen
5ad45fc696 Make anti-magic fields drain more energy
... and make them actually deal damage based on the energy
it would've drained, if you have Antimagic.
Also prevent them appearing too early in the dungeon.

Allow drain energy attacks (and anti-magic traps) drain more
than your level of energy.

Make eating magical monsters such as wizards and shamans give
the same tiny buzz bonus as eating a newt.
2021-05-20 21:35:23 +03:00