Commit Graph

16517 Commits

Author SHA1 Message Date
nhmall
d5f2b681af follow-up to 57c8ae4b which added NONNULLARG6 2024-02-20 12:18:01 -05:00
nhmall
0a985459f0 make style consistent for function ptr arguments 2024-02-19 17:21:04 -05:00
nhmall
688ac6ffbe remove register from variable declarations 2024-02-19 16:30:07 -05:00
PatR
6f569f0a27 beating dead horses
Extend a joke that no one has ever seen in actual play.
Clears out an old entry from 'git stash'.
2024-02-19 11:30:00 -08:00
PatR
c84dc79610 trap.c reformatting
Monstly changing '<type>* <var>' to '<type> *<var>'.  Wrap or shorten
a few wide lines.

One of the rolling boulder routines accessed gb.bhitpos.x,y many times;
change that to use local x,y instead.
2024-02-19 11:11:23 -08:00
PatR
5ef51a88d4 more DECgraphics tinkering 2024-02-19 11:04:29 -08:00
PatR
4c7259a1d4 another comment typo 2024-02-19 00:42:27 -08:00
PatR
9226a5dea6 couple of DECgraphics optimizations
If a termcap entry for ending attributes and color also contains
the code to switch from secondary font back to primary (HE_resets_AS
hack), maybe strip the AS code out of HE (and clear the HE_resets_AS
flag) when setting up DECgraphics.  Affects whether nethack sends
extra AS sequences while rendering a run of VT line-drawing chars.
My HE doesn't reset AS so that aspect hasn't been exercized.

When switching back and forth between normal and line-drawing,
defer the switch away from line-drawing if the character will be
rendered the same in both character sets (uppercase letter, digit,
most punctuation).  That might just defer the AE, but could skip it
and next AS depending on what characters are written.  The cycle
might repeat an arbitrary number of times, avoiding sending many
AS+AE combinations rather than just one.

Both of these optimizations are pretty small but reducing the number
of characters sent from a server to a remote user is worthwhile.
2024-02-18 15:01:21 -08:00
PatR
44de195718 theft against punished hero with empty inventory
If a punished hero's inventory is empty, have a nymph usually take
off the attached chain and indirectly fix punishment.  If hero is
trapped by being chained to a buried iron ball, sometimes take off
the implicit chain and indirectly release hero from the trap.

Monkeys won't do this and nymphs will only do so if there is no
inventory (aside from gold and/or embedded dragon scales which they
aren't allowed to target).

It's a lot simpler than I was expecting when I wrote the TODO about
it recently.
2024-02-18 11:24:21 -08:00
PatR
d688309012 openholdingtrap() message sequencing
If a trap is blocking levitation or flight and you use wand of opening
or spell of knock to get out, you'd get things like
|You start to float in the air!
|You are released from the bear trap.

Give the release message before the actual untrapping.
2024-02-18 11:18:48 -08:00
Pasi Kallinen
a0c28e97da Qt: split menu window color and attr setting 2024-02-18 13:27:47 +02:00
Pasi Kallinen
2952bdab63 No secret doors or corridors on the early levels
New players often get stuck on the first level when they can't
find the secret door or corridor.  Make the first two levels
have no such features.
2024-02-18 11:47:02 +02:00
PatR
2e6802d2b3 potential DECgraphics optimization
Add a comment about something that occurred to me when fixing the
^C-during-DECgraphics-output situation several days ago.  I don't
think there's any compelling reason to avoid this optimization, but
this only describes it without actually implementing it.
2024-02-17 03:28:40 -08:00
nhmall
20d2ac726c have tile2bmp describe the bmp file layout 2024-02-16 22:15:09 -05:00
nhmall
ef19265438 restore ability to use gdb on NetHack built with mingw-w64 2024-02-16 20:34:58 -05:00
PatR
d253e947da more getpos() highlighting plus jumping in place
Simplify the valid-position highlighting via '$' by combining the
tmp_at(start) and tmp_at(populate) steps.

Add highlighting for a couple of targetting operations that would
give valid/invalid feedback via autodescribe but weren't displaying
highlight markers for $.

I made several jumping changes, most of them dealing with picking
hero's own spot.
2024-02-16 15:36:17 -08:00
PatR
1d5f45aa78 getpos() highlighting of valid positions
Redo getpos() highlighting.  If bgcolors is Off, '$' toggles between
no highlighting and showing dollar signs at valid spots.  ^R removes
those if they're present.  When bgcolors is On, '$' cycles among
three settings:  highlighting via background color, no highlighting,
and highlighting by drawing dollar sign characters.  ^R switches to
background color mode.

This doesn't directly solve the problem of background color causing
conflict with the foreground color of some objects or monsters, but
being able to get rid of the background with a keystroke should be an
improvement.

'bgcolors' defaults to On, which was a problem for tty when 'color'
was Off.  Turn it Off (in the core) for text map if color is Off and
bgcolors hasn't been explicitly set.  Conversely, Qt was leaving
color Off and then using color with abandon.  Turn in On (in the core)
for tiled map if it hasn't been given an explicit value.  Those two
changes should cope with most situations and still let the player
override.
2024-02-16 14:56:20 -08:00
PatR
2e64d35dd2 S_goodpos symbol and tile
Change the goodpos symbol, which is used to mark valid locations for
some operations when getpos() is having the player pick a spot, from
green question mark to blue dollar sign.  Dollar sign is the default
keystroke to toggle those markers off and on.
2024-02-16 14:14:05 -08:00
nhmall
b6ad791f5f quiet some Windows warnings; fix fatal link error 2024-02-15 21:57:36 -05:00
nhmall
437a403286 follow-up - avoid onefile issues 2024-02-15 21:56:47 -05:00
nhmall
48c01b4ac1 quiet some new warnings
end.c:177:16: warning: unused parameter 'why' [-Wunused-parameter]
  177 | NH_abort(char *why)
      |          ~~~~~~^~~
end.c: At top level:
end.c:1191:1: warning: 'get_saved_pline' defined but not used [-Wunused-function]
 1191 | get_saved_pline(int lineno){
      | ^~~~~~~~~~~~~~~
options.c:1263:1: warning: 'optfn_crash_urlmax' defined but not used [-Wunused-function]
 1263 | optfn_crash_urlmax(int optidx UNUSED, int req, boolean negated UNUSED, char *opts, char *op)
      | ^~~~~~~~~~~~~~~~~~
options.c:1240:1: warning: 'optfn_crash_name' defined but not used [-Wunused-function]
 1240 | optfn_crash_name(int optidx UNUSED, int req, boolean negated UNUSED, char *opts, char *op)
      | ^~~~~~~~~~~~~~~~
options.c:1217:1: warning: 'optfn_crash_email' defined but not used [-Wunused-function]
 1217 | optfn_crash_email(int optidx UNUSED, int req, boolean negated UNUSED, char *opts, char *op)
      | ^~~~~~~~~~~~~~~~~
2024-02-15 21:25:22 -05:00
nhkeni
9b238bba09 turn off CRASHREPORT for CI minimal build 2024-02-15 20:43:49 -05:00
nhkeni
72ae3c7282 if makedefs doesn't exist, force NOCRASHREPORT 2024-02-15 20:42:57 -05:00
nhkeni
3a3f5c9923 azure-pipelines.yml: cope with white-space after # 2024-02-15 20:24:41 -05:00
nhkeni
c02220499b Add CROSSCOMPILE to mdgrep, then use it to stop CRASHREPORT when cross-compiling 2024-02-15 19:37:43 -05:00
nhkeni
e378b782fc Yes, apparently there are configurations that still need the NH_abort() macro 2024-02-15 19:00:08 -05:00
nhkeni
a638629e47 unscramble NOCRASHREPORT logic in config.h 2024-02-15 18:53:49 -05:00
nhkeni
727740749e Try to fix linux for installations that don't have openssl includes. 2024-02-15 18:08:58 -05:00
nhkeni
252f70b4b3 Turn off debugging flag in Makefile.mingw32 - that should gix the MinGW build 2024-02-15 17:37:40 -05:00
nhkeni
9c0d2389cb hopefully fix broken MSDOS and MinGW compiles (linux still broken) 2024-02-15 17:07:02 -05:00
nhkeni
3d3ce2369c Merge branch 'keni-wincw2' into NetHack-3.7
Lots of manually resolved conflicts.
2024-02-15 16:25:12 -05:00
nhmall
b96762cdf0 update tested versions of Visual Studio 2024-02-15 2024-02-15 09:29:34 -05:00
PatR
bf8a634760 nethack --version:dump
Add the 'dump' argument to the existing '--version' command-line
option to display the magic numbers used when validating save and
bones files for compatibility.

Nothing exciting, just a line of 5 hex values.  I was going to also
list the values for however many save and bones files are specified
on the command line but it seems to need more effort than I care to
expend.  And I hadn't made up my mind whether that should be done by
nethack, recover, or some new standalone program.  [Single line of
relatively raw output is so that they could be compared more easily.]

nethack --version:bad-argument was writing a message to stdout and
then starting play--which immediately overwrites stdout.  Have it
quit instead.  Player wasn't trying to start a game and quitting is
what it does with --version:good-argument.
2024-02-13 15:58:10 -08:00
Pasi Kallinen
d511944dda Add missing initializer for field w_what 2024-02-12 12:57:50 +02:00
nhmall
a8d3d4c8af Windows Makefile.mingw32 2024-02-11 18:20:21 -05:00
nhmall
f2b1150950 include MAXOCLASSES in --dumpenums 2024-02-11 00:10:17 -05:00
PatR
2d82528920 uskin sanity check
'uskin' isn't part of worn[] so wasn't being checked with the other
slot pointers.  Add that, although it'll be excluded by default and
need to have EXTRA_SANITY_CHECKS defined to include it.
2024-02-10 18:04:10 -08:00
nhmall
3119bc1ec2 more Windows Makefile updates
Default to INTERNET_AVAILABLE=Y. If the build computer is not
online with the internet available, an explicit
INTERNET_AVAILABLE=N
will be required for the build, if pdcurses and Lua are not already
staged in the lib folder. That can be done by editing the appropriate line
in the Makefile, or by altering the command line:
    nmake INTERNET_AVAILABLE=N install

With Makefile.nmake:

Store pdcurses wingui and pdcurses wincon object files in separate
directories.

Rename the two pdcurses static libraries.

Because of the static library changes, the following will be required
prior to the next build:
    nmake spotless
2024-02-10 20:20:14 -05:00
nhmall
9e6872d982 Windows Install.windows correction 2024-02-10 12:44:13 -05:00
nhmall
cc7618438c Windows Install.windows and nhsetup.bat updates 2024-02-10 12:39:49 -05:00
PatR
e2a3c98aac worn/wielded pointer sanity checks
Check the various uarm, uwep, and so forth pointers to make sure that
they point to items in hero's inventory and that those items have the
corresponding W_ARM, W_WEP, &c bit set in their owornmask field.
Also check whether any other items in inventory have the same bit set.
[Some of this is already handled by sanity_check_worn() in mkobj.c.]

Also validate two-weapon combat mode.  I don't recall ever seeing any
problems reported about it though.

Does not validate ball and chain.  Those should have their own sanity
checks that validate a bunch of other stuff besides just worn slots.
They already get some checking by the normal object tests.

This works ok with 'sanity_check' set and items worn and wielded
normally.  The only insane situation tested was by reverting the
confused-looting-with-quivered-gold fix from earlier today.  I haven't
used a debugger to force other such problems so this isn't very
thoroughly tested.
2024-02-09 23:32:16 -08:00
PatR
c490265e35 Q enhancement
Noticed while testing confused #loot:  when using 'Q' to populate
quiver, or 'f' when quiver is empty, don't bother asking what to
ready/fire if inventory is empty.

And when inventory isn't empty, don't list '-' as a likely candidate
if quiver is already empty.

'w' behaves differently.  '-' is treated as a likely candidate when
already not wielding anything, and even when inventory is completely
empty.
2024-02-09 16:46:22 -08:00
PatR
9326f80ecc lava_effects() bit
lava_effects() item destrunction had the logic for handling Book of
the Dead wrong.  (However, that didn't matter since the obj_resists()
check earlier would prevent it from being burned up.  Fix it anyway.)
2024-02-09 15:52:17 -08:00
PatR
381851348b fix #K4103 - crash after confused #loot of throne
If gold is moved into throne's coffer chest (or added to exchequer
monster's minvent) while quivered by the hero, it wasn't being unworn
to remove it from quiver slot.  That could lead to a crash.  Example
was segfault during 'f' command.

freeinv() expects caller to unwear item being removed from inventory;
reverse_loot() wasn't doing so.
2024-02-09 15:48:47 -08:00
nhmall
49fa532fa8 update Windows Makefiles 2024-02-09 17:42:12 -05:00
PatR
bffa88b04e regions vs long worm tails
If any part of a long worm is within a posion gas cloud region,
include it just once no matter how many segments are inside.  The
tail will take harm from poison gas, but only once rather than for
repeated for every segment inside the region.

Unlike with detection, show long worm tail if hero is adjacent to
it in a gas cloud region and would see that tail segment if the
region wasn't inhibiting visibility.
2024-02-08 23:44:22 -08:00
PatR
d682d8b3d3 curses: build fix for italics attribute support
I've been building tty-only for a while in order to speed up
builds, so a recent change to the curses interface that broke
compile on older OSX went unnoticed.  The <curses.h> on my
OSX 10.11.6 system does not define A_ITALIC.
2024-02-08 13:10:42 -08:00
PatR
ad8bcc6b3f comment typo of the day
I have no idea how this got in.  It's not just a typo; what's beyond
thinko?
2024-02-08 12:32:43 -08:00
PatR
fd5526db7c fix for #H9430 and github issue #1207 - gas clouds
Reported yesterday as issue #1207 by elunna and over four years ago
in #H9430:  monsters in gas clouds that should be shown by Warning
aren't.  And in some discussion of #H9430 back then:  monsters
adjacent to the hero while in gas clouds aren't shown on the map,
but combat and other interaction describes them as if they were.
There have been changes since then--to prevent seeing things on the
far side of gas clouds as if there were no clouds in the way--but
the basic problems with warning and adjacency weren't addressed.

This is a band-aid (tm) that probably makes things livable.  Don't
allow gas region display to override monsters that are sensed via
warning or when the hero is next to them.  That part doesn't work
correctly if the hero isn't blind and is inside the cloud while the
monster is adjacent but outside.  I think it will take more than a
band-aid to deal with that sensibly.

Closes #1207
2024-02-08 07:04:15 -08:00
Pasi Kallinen
b37f1408d8 Self-recover for linux
Compile-time option SELF_RECOVER was implemented for Windows;
add it to unix systems too, with it being on by default when
compiling with the linux hints file.
2024-02-08 11:34:59 +02:00