Commit Graph

14650 Commits

Author SHA1 Message Date
PatR
1755d27bf8 allow full-line comments in tiles source files
Accept
<start of line><optional whitespace>#<anything>
as a comment in win/share/{monsters,objects,other}.txt.  Existing
<start of line><optional whitespace># tile <rest of line>
is grandfathered in as data.

It wouldn't take much more to accept
<data><optional whitespace>#<rest of line>
comments too but this hasn't gone that far.

Reading the colormap at the beginning of each of the three files
used "%[A-Za-z0-i]" to read one characer into a two-character array.
Change that to "%1[A-Za-z0-9]" so that it can't overflow the buffer
if the input data gets accidentally or maliciously mangled.  (Not a
security issue.)

Remove a spurious blank line from objects.txt.

Also, clean up some warnings when compiling gifread.c for gif2txt
although I ultimately didn't do anything with that.
2023-01-08 01:33:18 -08:00
PatR
f0f639f1fa fix for onefile FITSint, FITSuint
I assumed that the complaint about macro refinition was for the two
in alloc.c replacing two from hack.h from another file, but it could
be that those being defined by alloc.c were interferring with the
regular hack.h ones.  alloc.c doesn't need them, and was also skipping
an opportunity to use one of them.
2023-01-07 12:48:10 -08:00
Pasi Kallinen
48ae4f6d30 Another valgrind uninitialized bytes complaint 2023-01-07 17:28:14 +02:00
Pasi Kallinen
8eb3b3d8d1 Silence valgrind uninitialized bytes complaints
Just zero out the allocated memory.

Explicitly setting struct field values isn't enough, because field alignment
means there can be several unused bytes which are written to savefile.
2023-01-07 13:25:07 +02:00
Pasi Kallinen
c68b21d735 Fix lua selection logical-or bounds 2023-01-07 10:55:09 +02:00
Pasi Kallinen
27e2c79e12 Free command queues at end of game
At end of game, the disclose prompts put commands into the queue,
but those weren't freed.
2023-01-06 16:40:58 +02:00
Pasi Kallinen
030fc0036a Remove NO_VSNPRINTF
Affects only ancient VMS where vsnprintf wasn't available.
2023-01-06 15:53:06 +02:00
PatR
18fa85c681 show_glyph() impossible
After glyph expansion a while back, a few 'if's had tests of
|  else if ((offset = (foo - bar)))
which should be
|  else if ((offset = (foo - bar)) >= 0)
Only used if show_glyph() has been passed invalid map coordinates
so never seen.
2023-01-02 23:40:06 -08:00
PatR
c91f142bdb score feedback punctuation
"Killed by Ms. Manlobbi, the shopkeeper" has the comma changed to
a semi-colon prior to being stored in 'record'.  That's intentional,
but "Killed by Ms. Manlobbi; the shopkeeper" looks strange when shown
to the player.  Change semi-colon back to comma when writing scores
for display.
2023-01-02 23:25:38 -08:00
PatR
d20f670710 striking/force-bolt comment
I'm not sure whether newsym_force() is still necessary, but add a
comment about why it's being used in bhito().
2023-01-02 14:25:23 -08:00
nhmall
33c13d6fff static analyzer bit display.c
A static analyzer pointed out that the 'if' was checking
for null pointer, but the 'else' was not, yet they were
both then dereferencing the same variable.
2023-01-02 16:06:11 -05:00
PatR
dc6ad9266b nethack --windowtype=badchoice
If you used the commandline to ask for an interface that doesn't exist
or isn't available, you'd get complaints about it not being recognized
twice.  First before any other options, then again after regular
option processing has taken place.  Clear the command line setting if
the first attempt gets rejected so that it won't be retried later and
be rejected again.  Probably the game should just quit if setting the
interface fails.
2023-01-01 17:35:06 -08:00
nhmall
8755b3bb53 Guidebook update 2023-01-01 20:23:15 -05:00
nhmall
ff814326aa update for tilemap.c generated tile.c code 2023-01-01 20:05:59 -05:00
nhmall
095e4ffe31 add some curses support for coloring of map frame 2023-01-01 20:05:03 -05:00
nhmall
32a030c8c6 introduce X11 support for coloring map frame 2023-01-01 20:04:27 -05:00
nhmall
0a03ca1e99 introduce Qt support for color of map frame 2023-01-01 20:03:30 -05:00
nhmall
2fc0d25d45 introduce support for coloring the frame behind a map location
Also includes support by paxed for polearm targeting using the
frame color.

Also renames USE_TILES to TILES_IN_GLYPHMAP which is a more
accurate description.

Not all window interfaces have full support for the color framing
of the background square yet.

MS-DOS needs further work (to bring it to both VESA and VGA, with
and without tiles.

Windows GUI is missing support.

X11 and Qt have been started, but may require further refinement.
2023-01-01 19:55:02 -05:00
nhmall
1972c8447f update year in copyright 2023-01-01 17:31:34 -05:00
PatR
21b9506d3f comment fix in display.c
A comment in front of unmap_object() was missing the end of a
sentence in the middle of a short paragraph.  That has been the case
as far back as 3.3.0.  I found the sentence's full text in 3.2.0
(without checking 3.2.[123]).  The rest of the paragraph got changed,
presumably at the same time as the missing part got lost.

While in there, change "any more" to "anymore".  According to a
dictionary, the one-word form is the more commonly usage.
2023-01-01 00:21:51 -08:00
PatR
e1a2432233 fix tilemap - no panic()
tilemap isn't linked with util/panic.o so doesn't have access to
panic().  Despite that, linking on OSX found panic() somewhere.
(It doesn't do format argument substitution, just prints out the
argument we pass as format string, then aborts.)

Instead of calling panic(), print a message to stderr, delete the
incomplete tile.c whose construction has failed, and exit with
failure status.  Linking with panic.o wouldn't handle the message
and final failure but not help with the incomplete output file part,
so this hasn't done that.
2022-12-31 13:35:17 -08:00
PatR
765c853a5a pull request #942 - shopkeeper chat changes
Pull request from entrez:  change some pline() messages to verbalize()
and re-enable some chat feedback given when a shopkeeper is poly'd
into some form that can't speak.

Closes #942
2022-12-31 12:42:52 -08:00
Michael Meyer
ee270bfbe0 Use verbalize for shopkeeper price-check #chatting
The shopkeeper is speaking out loud, so use verbalize for consistency
with other types of speech.

I couldn't figure out a way to wrap the multiline version in quotes in a
way that actually worked and looked good, so I restricted this to the
pline responses.
2022-12-31 12:22:13 -08:00
Michael Meyer
f38a40fafd Tweaks to chatting with mute shopkeeper
A mute shopkeeper shouldn't be able to verbally tell you the prices of
objects.  For normal chatting, on the other hand, shk_chat can handle a
mute shopkeeper (by changing from speech to "indications" -- hand signs,
body language, etc), so allow execution to reach that even if the
shopkeeper is mute (in a silent polyform).

Also more generally allow a shopkeeper to continue chatting with normal
shopkeeper responses if polymorphed into another creature, since they
apparently retain their minds (are able to tell you prices, can
transact, etc).

This is mostly inspired by the fact shk_chat has extensive handling for
mute shopkeepers, but it was unreachable as far as I can tell.  It is
also funny to think of a newt or something wriggling around to indicate
it's been making a lot of money lately.
2022-12-31 12:22:13 -08:00
PatR
459b185a98 pull request #939 - revise #wizsmell command
Pull request from entrez:  add a funny message if player targets hero
with #wizsmell command.

I've modified it to put a "remembered, unseen monster" symbol on the
map if sniffing a non-monster location reports a monster's smell and
to remove that symbol if sniffing it reports "no monster there".

Closes #939
2022-12-31 12:13:41 -08:00
PatR
dcd3fe8437 smelling an unseen monster puts 'I' on map 2022-12-31 12:11:28 -08:00
Michael Meyer
be810f3ede Remove canspotmon() requirement from #wizsmell
You can attempt to smell a monster at particular coordinates even if you
can't see it.  Revert the message for the 'can't find a monster there to
smell' case to "That is not a monster", as it was before, since the
change makes it so that you only reach that line if there genuinely is
no monster there (previously it would be reached if there was a hidden
or undetected monster on the specified spot).
2022-12-31 11:37:06 -08:00
Michael Meyer
8c831fcad0 Add a funny message for smelling yourself
I know this is inane, especially for a little-used debug-mode-only
command, but I can't get it out of my head...

The use of the actual monster data instead of the glyph as a proxy ought
to make it somewhat more consistent as well (e.g. hallucination and
'showrace' won't affect the results), though I think that'd hardly be
worth it were it not for the incredibly funny message.
2022-12-31 11:37:06 -08:00
PatR
b3b7e8c19c fixes entry for pull request #920 - paralyzed hero
Pull request from entrez:  hero needs to be able to move in order to
help a nymph or succubus or incubus to remove worn armor.

Closes #920
2022-12-31 11:28:13 -08:00
Michael Meyer
15274fcca1 Make paralysis intefere with seduction attempts
tinklebear on IRC noticed that a hero paralyzed by a floating eye was
still "charmed" and capable of "removing her armor" as part of a nymph's
theft attack.  The same thing was true of foocubus seduction: a
paralyzed hero was still able to respond to the questions about whether
particular pieces of armor should be removed (and also do whatever else
may be involved in a successful attack...).

I think paralysis should prevent both those things.  Nymph theft will
still work, unless she needs the hero's active cooperation in removing a
bulky piece of armor.  Foocubus attacks will be prevented entirely by
paralysis, making it interfere like unconsciousness already does.

Apply a similar constraint to hero vs monster seduction, as well.
2022-12-31 11:25:53 -08:00
PatR
8397b15d83 some tilemap.c cleanup
I'm headed back to the drawing board for some tiles changes I was
attempting, but before tossing what I had I've extracted a modest
amount of cleanup for the code in win/share/tilemap.c.  Some
formatting, a bit of generated formatting, make ENHANCED_SYMBOLS
less intrusive, and an error check to prevent a crash in tilemap
I triggered.  Also avoid one in nethack caused by an object (not
included here) which had a description but no name.
2022-12-30 12:45:02 -08:00
PatR
11b72eb18b Guidebook typo
Fix misspelling of recently added "sortvanquished" option.
Copy+paste propagated it to from Guidebook.mn to Guidebook.tex.
2022-12-28 11:37:14 -08:00
PatR
077fdcfaac followup for miscellaneous objects[] macros
The DUMP_ENUMS definition of 'MARKER()' had the expansion of its
arguments backwards but isn't even needed, so get rid of it rather
than reverse them.  nethack --dumpenums handles them separately
from object definitions.
2022-12-28 11:33:39 -08:00
PatR
ddd358aa03 miscellaneous objects[] macros
Replace FIRST_GEM and LAST_GEM with FIRST_REAL_GEM, LAST_REAL_GEM,
FIRST_GLASS_GEM, and LAST_GLASS_GEM and define those along with
objects[] rather than separately.  Do the latter for FIRST_AMULET
and LAST_AMULET too.  Also new FIRST_SPELL and LAST_SPELL used to
compute MAXSPELLS.  (That value looks wrong to me, but this defines
it with the same value as before.  If it gets fixed, EDITLEVEL will
need to be incremented.)

This started as just proof of concept that extra information could
be collected as objects[] gets initialized at compile time.
2022-12-28 01:50:24 -08:00
nhmall
57dc8891d6 Guidebook datestamp 2022-12-27 21:03:41 -05:00
PatR
fcf2685cc3 'sortvanquished' option in Guidebook.tex
Not tested, but I tried to be more careful than last time....
2022-12-27 14:15:49 -08:00
PatR
249e431e46 new 'sortvanquished' option
Allow the preferred sort order for the vanquished monsters list to
be specified in the run-time config file
|OPTIONS=sortvanquished:X
where X is t, d, a, c, n, or z.  It can also be set to 'A' or 'C'
but those aren't documented and aren't offered as choices when
setting the value interactively, which can be done via 'm O' or by
using 'm #vanquished'.

Guidebook.mn has been updated but Guidebook.tex is lagging again.
2022-12-26 14:56:12 -08:00
PatR
a294fdf179 boomerang bits
Refine the recent throw-and-return catching routine.
2022-12-25 13:28:02 -08:00
PatR
c380234325 {freez,flam,shock}ing spheres difficulty ratings
Adjust mstrength() so it generates difficulty assessments matching
the mons[].difficulty values for freezing spheres, flaming spheres,
and shocking spheres.  #wizmodiff now reports "no discrepancies".
2022-12-25 13:21:56 -08:00
nhmall
a4c9073a7c Guidebook datestamp; updated Guidebook.txt 2022-12-25 10:12:47 -05:00
nhmall
ca716c831b make some corrections to Guidebook.tex 2022-12-25 10:09:43 -05:00
PatR
4436d1eb4a doc update: 'role' changes for Guidebook.tex
Catch the LaTex Guidebook up with the nroff one for the role, race,
gender, and alignment options.

For both formats, comment out the decription of 'altmeta' on Amiga.
2022-12-24 14:29:58 -08:00
PatR
9a9f2d596d fix boomerang equiped in multiple slots
Reported directly to devteam:  with one quivered boomerang and a
compatable stack of one or more boomerangs either wielded or in the
alternate weapon slot, throwing the quivered one, failing to hit any
target or obstacle, and catching the returning boomerang would empty
the quiver, merge the caught boomerang with the wielded weapon or
swap-weapon slot, then re-quiver and yield
|x - 2 boomerangs (wielded) (at the ready)
or
|y - 2 boomerangs (alternate weapon; not wielded) (at the ready)
If 'sanity_check' was On, complaints would ensue.

'autoquiver' may need to be On in addition to the thrown boomerang
being the last item in the quiver.

The unsplit portion of the fix feels unclean.  There's bound to be a
better way.
2022-12-24 00:27:59 -08:00
PatR
9657b78359 dismount tidbit
I just noticed a couple of direction manipulaton macros that I hadn't
been aware of.  Change recenlty added DISMOUNT_KNOCKED to use them.
2022-12-23 15:42:08 -08:00
nhmall
bfe668c7ef memory not freed
Reported directly by feedback form.

Changes from a recent pull request resulted in more array entries
than MAX_GLYPH, so the for loop in free_glyphid_cache() wasn't going far
enough, leaving some dupstr() strings unfreed.
2022-12-23 16:38:53 -05:00
PatR
91e2ab13b2 last? role/race/&c option values update
Keep track of how a role|race|gender|alignment option got its value
so that role:!Tourist in .nethackrc and role:!Priest in NETHACKOPTIONS
yield 'role:!Priest' rather than merging into 'role:!Priest !Tourist'.
It also doesn't write the value into new config file for #saveoptions
if that value comes from environment or command line (not applicable
since the command line arguments for role,&c don't go through options
handling).  Also, the old config file value takes precedence over
the current game's value file so that 'role:random' doesn't become
'role:Healer' or such in a new config after the random value gets
picked for play.

This only tracks the role, race, gender, and alignment options but the
concept could be extended to all options.  The data would need to be
saved and restored if values set interactively need to be retained in
restore sessions (doesn't apply to role,&c since those don't change
during play).
2022-12-22 15:07:33 -08:00
Pasi Kallinen
37f6eee147 Add themeroom filler "Storeroom"
Contains mostly mimics (pretending to be chests), and possibly some chests.
2022-12-22 21:47:13 +02:00
PatR
c77b8b8073 old pull request #609 - neutral #offer feedback
Pull request from Vivit-R was to change feedback when offering on a
neutral altar from "your sacrifice is consumed in a cloud of smoke"
to "... in a puff of smoke".  There were multiple comments, some
agreeing and some disagreeing but no better alternatives offered.

I'm ambivalent to whether any alteration was needed, but think "puff"
sounds rather passive.  I looked at a lot of synonyms and considered
"veil of smoke" and "haze of smoke" and even "puff of vapor", but
finally settled on "plume of smoke".  It isn't something that appears
and is gone in an instant like the lawful flash of light and chaotic
burst of flame, but I think it is more interesting than cloud or puff.

The PR's commit hasn't been used since 100% of its content is being
superseded.

Closes #609
2022-12-21 14:31:13 -08:00
PatR
657f0de5f8 sequencing issue: dismounting from dying steed
Reported by entrez:   if a trap killed hero's steed and dismounting
was fatal for the hero (probably by falling onto the same trap),
impossible "dmonsfree: 1 removed doesn't match 0 pending" warning
occurred during game-over cleanup.

Move the dismount calls in mondead() and mongone() from before their
m_detach() call to the end of m_detach() itself.  This led to a
cascade of problems and attempted fixes until finally zeroing in on
place_monster()'s sanity checks and dismount_steed()'s attempts to
work-around one of them.

This reverts the convoluted hack from four years ago in commit
be327d9822 and deals with the issue in
a simpler way.  After that, the new dismount_steed() placement at
end of m_detach() works cleanly.
2022-12-21 14:02:05 -08:00
PatR
13c1debf26 pull request #951 - Guidebook tweak for #repeat
Pull request from entrez:  in TeX version of Guidebook, the #repeat
command was formatted differently from other extended commands.

(The recent changes to role, race, gender, and alignment options in
Guidebook.mn still haven't made it into Guidebook.tex.)

Closes #951
2022-12-20 23:38:54 -08:00