Commit Graph

14961 Commits

Author SHA1 Message Date
Pasi Kallinen
5d659cf1f6 Tips and option to disable them
Adds a more general way to handle gameplay tips, and adds
a boolean option "tips", which can be used to disable all
tips.  Adds a helpful longer message when the game goes
into the "farlook" mode.

Also adds a lua binding to easily show multi-line text
in a menu window.

Breaks save compat.
2023-02-19 15:56:18 +02:00
PatR
80842979aa reverse main bit of 'build fix: COMPRESS_OPTIONS'
I realized that I put opts[] inside a block that would go out of
scope while it was still needed.  When I went to fix that, I
discovered that it is already present where it ought to be.  My
'experimentation' should have defined COMPRESS_OPTIONS sooner so
that the outer scope would see it.

This doesn't revert the previous commit because a couple of comments
and a bit of reformatting from it are still useful.
2023-02-18 18:03:21 -08:00
PatR
91d6a79c11 build fix: COMPRESS_OPTIONS
While experimenting I tried defining COMPRESS_OPTIONS and files.c
would no longer compile.  Evidently nobody has been using that.
2023-02-18 17:32:26 -08:00
nhmall
84390fa600 expand C99=1 with macOS.370 and linux.370 hints
In addition to C99=1 on the make command line, also allow
C89=1 or C11=1 or C23=1.

NOTE: Those won't all lead to a successful build of NetHack,
and the use of C23=1 (-std=c2x) will only be valid on recent
compiler versions (clang-15, for one, accepts it).
2023-02-18 11:35:40 -05:00
nhmall
20f2c5569b Cross-compiling update 2023-02-18 00:55:01 -05:00
PatR
5fd6c02170 pyrolisk feedback
From a report 9 years ago, a pet pyrolisk was repeatedly gazing at a
grey-elf and nothing happened.  It turned out that the elf was wearing
an elven cloak which was negating damage some of the time (most of the
time back then) but with no indication that that's what was happening.

This makes many types of damage that are negated by MC say so.
Probably other types of damage should do likewise.
2023-02-17 14:40:26 -08:00
nhmall
d1fda1773a fix a warning on Linux for X11 if -std=c99 2023-02-17 16:56:27 -05:00
PatR
04ef7cba46 Address github issue #983 - getpos valid locations
Issue reported by entrez:  when getpos() is being used to have the
player pick a map location, if player types '$' (for some operations
like jumping or applying a polearm) then valid spots are highlighted
but the highlighting obscures what was shown on the map.  I'm not
sure whether this 'fixes' the issue but it's probably good enough.
Allow typing another '$' to toggle the highlighting back off,
redisplaying the map in the process, without needing to move the
cursor or type ^R to accomplish that.  Toggling seems more intuitive.

This is a lot more complicated than it needs to be because I assumed
that the background aspect of highlighting stayed visible when the
glyphs were reverted.  It doesn't work that way but I haven't thrown
out the effort to make toggling the highlights work sanely.  Prior
to this, typing '$' again just redrew the highlighting again, with
no visible effect.

Closes #983
2023-02-17 12:21:54 -08:00
nhmall
24dab18167 allow setting the standard
CSTD can be manually set near the top of src/Makefile, util/Makefile
or by including c99=1 or C99=1 on the build make command line if
using the linux.370 or macOS.370 hints files.
2023-02-17 10:23:40 -05:00
nhw_cron
ee32339634 This is cron-daily v1-May-8-2022. 000files updated: Files 2023-02-17 08:55:11 -05:00
PatR
6cf079b3f6 3.7: add doc/fixes36.7 as doc/fixes3-6-7.txt 2023-02-16 23:43:37 -08:00
nhmall
709125a915 update patchlevel.h with NetHack 3.6.7 release info 2023-02-16 21:06:06 -05:00
nhmall
7aab1c0b76 Guidebook update 2023-02-16 20:56:33 -05:00
nhmall
288cc01f3a Merge branch 'naming-overflow-fix2' into NetHack-3.7 2023-02-16 18:52:47 -05:00
Pasi Kallinen
91dc1ea834 Fix angering monsters with non-hero magic rays
Can't use gc.context.mon_moving to check if the ray was caused
by hero, as some rays can happen while hero is moving in response
to their action - for example a bolt of lightning from a god.
dobuzz() uses positive type values for magic rays caused by hero,
so just use that.
2023-02-15 11:28:09 +02:00
Michael Meyer
7f0bbc28a8 Don't anger target via mon vs mon zap/breath
dobuzz() was modified in 677b32c2a7 to anger the target, but beams
handled by dobuzz() don't necessarily originate from the hero.  Monsters
can zap wands that hit other monsters, dragons can use their breath
attacks, etc.  Those things were causing the targets to become angry at
the hero.
2023-02-14 09:22:56 +02:00
Michael Meyer
3890491ef0 Fix: message when pet moves from water to eat
The <x,y> params of dog_eat are the pet's starting position that turn,
not necessarily the position of the object being eaten.  If the pet is
doing a combined move-and-eat action, <x,y> will be its original spot,
but it will have already moved to <mtmp->mx,mtmp->my>, where the food
object also is.

The attempt to check whether the eating was happening out-of-sight
underwater (to suppress the message in that case) was checking the pet's
starting location, not its new location/the location of the food object.
So if a pet moved from water to land to eat something, the chowing-down
message would be improperly suppressed (and presumably the message for a
pet moving from land to water to eat would be improperly left
_un_suppressed, though I didn't actually try to reproduce that).
2023-02-14 09:20:21 +02:00
SHIRAKATA Kentaro
6e1016be45 split kicking a door into a separate function 2023-02-14 09:16:47 +02:00
copperwater
f9fd56b5dc Fix: Change gradient math to avoid isqrt
isqrt adds some noticeable distortion artifacts to gradients (test case
I used is to draw a line from 10,10 to 20,15 with mindist = maxdist = 2
and see how the gradient is biased towards the upper right); changing
the distance calculations to use the square of the distance rather than
the raw distance avoids this. This makes radial gradients more radial,
and square gradients more square.

There still appears to be a bit of bias, but I think this is due to the
line algorithm not lining up perfectly with the tiles.
2023-02-14 09:13:59 +02:00
copperwater
9d0df0c9f0 Invert the behavior of selection.gradient
selection.gradient has some pretty unintuitive behavior, in that it
selects points that are NOT close to the defined center. I've used
gradient selections several times and so far all of them have had to be
negated, because I wanted to select points close to the center with a
decreasing probability further out.

This implements that behavior, and also fixes a bug in which the x,y
coordinates of the gradient center(s) were not converted properly when
used within a des.room or des.map. Also updated the lua documentation
for gradient.

I removed the "limited" argument, as it was previously used to control
whether the rest of the map outside the max given distance would be
included in the selection; now that the area beyond maxdist is naturally
never in the selection, it doesn't have much use. (And I can't think of
a reasonable use case for the inverse: wanting to select points close to
the center, with decreasing chance towards maxdist, but then select the
entire map beyond maxdist.)

Currently this does not affect any special levels or themed rooms
because none of them use selection.gradient.
2023-02-14 09:13:59 +02:00
nhmall
10cafddcb0 more bundle work for macOS
This iteration:

Places the resulting bundle folder off the top of the tree, rather than as a subdirectory of src.

Leaves the Applescript files out for now.

Builds the Info.plist (for now) via hard-coded values in the Makefile.

Builds the bundle launch script on the fly at make-time.

I think this revision may be working, at lease on my test machine.
There are more improvements to be done.
2023-02-12 01:19:05 -05:00
PatR
382fd52fb7 fixes entry for #genocided 2023-02-11 11:49:12 -08:00
PatR
6fd0047784 add #genocided command
Comparable to #vanquished, be able to view info normally available
during end of game disclosure while the game is still in progress.
The new #genocided command lists all genocided and extincted types
of monsters.  Unlike #vanquished, there aren't any sorting choices.

Potential future enhancement:  provide a way to view the genocided
list at the "what do you want to genocide?" prompt.
2023-02-11 11:35:06 -08:00
PatR
df18c96840 Makefile management
Have 'make clean' and 'make spotless' in 3.7 cleanup include/tile.h
from 3.6.  Otherwise use of 'cc -I../include -I../win/share' in
util/Makefile will get 3.6's include/tile.h instead of 3.7's
win/share/tile.h; use of FDECL() causes the old header to break when
used in various tiles utilities.
2023-02-10 16:42:01 -08:00
PatR
a07098b206 X11_hangup()
I was looking at backporting an X11 build fix to 3.6 and decided
that the hangup handling wasn't correct if SAFERHANGUP is defined
(which it is by default).  It didn't attempt to perform a hangup
save.  Also, the handler might return when the X code calling it
expected it to not do so.

I don't know how to force a hangup within X11 so haven't tested
this properly.  It works fine when there's no hangup.  :-/
2023-02-10 15:19:13 -08:00
nhmall
3ada7caf61 missed one, there were two 2023-02-10 14:28:27 -05:00
nhmall
3cd1a09d41 prevent a static analyzer warning 2023-02-10 08:56:06 -05:00
nhmall
24461058e6 more work on bundle and starting from Finder 2023-02-10 01:55:49 -05:00
nhw_cron
61bb25889c This is cron-daily v1-May-8-2022. 005guidebook updated: doc/Guidebook.txt 2023-02-09 20:27:47 -05:00
nhmall
f93d17173f Merge branch 'pr977' into NetHack-3.7 2023-02-09 20:08:39 -05:00
G. Branden Robinson
ecd2e4dba1 Set up *roff hyphenation more carefully.
* doc/Guidebook.mn: Remove workaround, in favor of...
* doc/tmac.n: ...setting automatic hyphenation mode appropriate to
  hyphenation systems used by AT&T-descended troffs on the one hand
  ("suftab") and groff (TeX hyphenation patterns) on the other.

modify results of pull request #977 to target tmac.nh instead.

Guidebook update to trigger the process following pull request 977.
2023-02-09 20:07:18 -05:00
PatR
4acc3cde36 pull request #976 - D of AP
Pull request from entrez:  combining just-picked-up (P) with explicit
accept without confirmation (A) for multi-drop (D) ignored the
just-picked-up part and dropped everything.

Affects menustyle:Full.  For menustyle:Traditional, 'A' operates very
differently and combining 'a' with 'P' or vice versa already does the
right thing.

Closes #976
2023-02-09 15:48:45 -08:00
Michael Meyer
51c0221383 Fix: 'A'+'P' regression when dropping by type
Selecting both 'P' (the just-picked-up items category) and 'A' (the
'auto-select relevant items' flag) when dropping items by type with 'D'
was automatically dropping every item in inventory instead of only items
that were marked as just having been picked up.  Basically, it was
causing 'A' to act like it did before b65c93c amended its functionality.

This commit is more-or-less identical to 991e739, both in terms of the
problem and the fix, except that it applies to dropping items instead of
looting.
2023-02-09 15:34:09 -08:00
PatR
5073aacffe pull request #975 - maybe_unhide_at()
Pull request from entrez:  mayby_unhide_at() operating on the hero
rather than on a monster was buggy because it was looking at the wrong
fields when checking for being hidden (recently fixed) and for being
trapped (fixed here) because those are tracked by fields in 'u' rather
than in 'youmonst'.

Closes #975
2023-02-09 15:31:41 -08:00
Michael Meyer
e725c195d9 Tweak maybe_unhide_at() a bit more
A monster may be unhidden if it's caught in a trap, but maybe_unhide_at
was checking mtmp->mtrapped across the board, which wouldn't work for
the hero.  Use u.utrap instead under those circumstances.  Also refactor
a bit so it shouldn't need the repeated guards against mtmp being null.
2023-02-09 15:17:51 -08:00
nhmall
738bccc344 updated to Makefile bundling 2023-02-09 15:25:42 -05:00
PatR
a807b208ba wintty.c and cursstat.c formatting bits
Apply another old stashed commit.
2023-02-09 10:48:04 -08:00
nhmall
a443747211 eliminate some Xcode warnings on macsound.m 2023-02-09 12:10:22 -05:00
Pasi Kallinen
861fd82926 Fix the part I forgot 2023-02-09 08:33:32 +02:00
nhmall
4ce722b8b2 more follow-up 2023-02-08 18:12:15 -05:00
nhmall
c67d9e96a6 correct a typo 2023-02-08 17:48:26 -05:00
nhmall
aad0586239 add new macOS target 'bundle'
This creates a new target 'bundle' for make on macOS, when using
sys/hints/macOS.370.

The 'bundle' recipe:
    - creates a subdirectory of src called 'bundle', and creates
      a bundle (nethack.app/ etc) below that.
    - the executable that is placed inside the bundle
      (bundle/nethack.app/Contents/MacOS/nethack) will find resources
      within the bundle, including the sounds, so a manual placement
      of the sounds into your '~/Library/Sounds' is no longer
      required when using the executable that's inside the bundle.
    - the sounds are included in the bundle if a soundlib option is
      chose at build time (for example 'make WANT_MACSOUND=1'), such
      that the bundled executable supports sounds.
    - the executable inside the bundle seems to find the resources
      it needs, even if invoked through a symlink elsewhere that points
      to the executable that's inside the bundle (only limited testing of that
      has been done).
    - at some point, its probably appropriate to add a
      'mv bundle/nethack.app <proper location>', possibly under
      a subsequent 'make install' step.
    - right now, the bundle step has a dependency on 'update'. I don't
      know if that's the right ordering or not, yet.

make WANT_MACSOUND=1 update
make WANT_MACSOUND=1 bundle

or, you can probably get away with:

make WANT_MACSOUND=1 bundle

if the nethack bundle is the goal anyway.

make clean
will clear the bundle subdirectory and everything below it.
2023-02-08 17:17:43 -05:00
PatR
ab00de45d1 mread() in restore.c
Update and apply an old stashed commit:  hide the casts in calls to
mread() made in restore.c.  Some split lines get recombined and there
is less clutter when reading the code.
2023-02-08 12:59:47 -08:00
PatR
bfd3cee886 Unix Makefiles
Move building uudecode for unpacking .Wav files from Makefile.dat to
Makefile.utl and add uudecode to util's 'make spotless'.
2023-02-08 11:38:47 -08:00
nhmall
37b5eae64d suppress one more warning 2023-02-08 13:07:37 -05:00
nhmall
da71e22fac suppress some warnings if SND_SPEECH is not defined
apply.c:1413:27: warning: unused variable 'shkp' [-Wunused-variable]
            struct monst *shkp = shop_keeper(*in_rooms(u.ux, u.uy, SHOPBASE));
                          ^
apply.c:1570:27: warning: unused variable 'shkp' [-Wunused-variable]
            struct monst *shkp = shop_keeper(*in_rooms(u.ux, u.uy, SHOPBASE));
                          ^
apply.c:1650:31: warning: unused variable 'shkp' [-Wunused-variable]
                struct monst *shkp = shop_keeper(*in_rooms(u.ux, u.uy, SHOPBASE));
                              ^
apply.c:1697:23: warning: unused variable 'shkp' [-Wunused-variable]
        struct monst *shkp = shop_keeper(*in_rooms(u.ux, u.uy, SHOPBASE));
                      ^
apply.c:2157:31: warning: unused variable 'shkp' [-Wunused-variable]
                struct monst *shkp = shop_keeper(*in_rooms(u.ux, u.uy, SHOPBASE));
                              ^
apply.c:2165:31: warning: unused variable 'shkp' [-Wunused-variable]
                struct monst *shkp = shop_keeper(*in_rooms(corpse->ox,
2023-02-08 12:44:14 -05:00
Pasi Kallinen
79f3491b21 Fix hero unhiding
maybe_unhide_at tried to handle both a monster and hero, but
hero being hidden is in u.uundetected flag, and the code was
only checking the monster mundetected field.

The code should probably be changed, either to change all uses
of the u.uundetected to gy.youmonster.mundetected, or perhaps
use a macro ... but these changes are all too big for me
to tackle for now.
2023-02-08 17:10:27 +02:00
nhmall
6cc35abba3 follow-up - Change the terminology in mO menu 2023-02-08 00:06:56 -05:00
nhmall
08404ddac3 Options menu should indicate unavailability of voices
If SND_SPEECH is not defined (such as via Makefile WANT_SPEECH=1),
indicate so on the options menu.
2023-02-07 23:41:12 -05:00
nhmall
dbc148342b try work-around for Guidebook.txt nroff ver diffs 2023-02-07 21:40:36 -05:00