]> granicus.if.org Git - nethack/log
nethack
2 years agoHit and wake sleeping monster makes it growl
Pasi Kallinen [Sat, 21 Jan 2023 14:52:17 +0000 (16:52 +0200)]
Hit and wake sleeping monster makes it growl

Unless you kill the monster with one hit, it'll wake up
cranky and make noise - waking up other sleeping monsters.

This was a bit tricky with all the message sequencing; I tested
all the hit/throw/fire/zap combos I could think of, and it took
a while to get things looking right.

2 years agoend.c bit - unnecessary 'else'
PatR [Sat, 21 Jan 2023 09:56:07 +0000 (01:56 -0800)]
end.c bit - unnecessary 'else'

2 years agosplitobj() never returns Null
PatR [Sat, 21 Jan 2023 09:53:59 +0000 (01:53 -0800)]
splitobj() never returns Null

While deliberately omitting something unrelated from the
'analyzer vs eat.c' commit, I accidentally left this out too.

2 years agoanalyzer vs eat.c
PatR [Sat, 21 Jan 2023 09:52:04 +0000 (01:52 -0800)]
analyzer vs eat.c

scan-build from llvm-14 (clang) doesn't complain about bite() or
maybe_finished_meal() so this is unlikely to fix those.  But this
does fix one bogus complaint it has for doeat().  Testing whether
the result from touchfood() is Null was fooling it into thinking
that that was a possibility when it's not.

Also, use plain 1 and 0 instead of TRUE and FALSE when assigning
to the victual bit-fields.  The analyzer doesn't care but the type
was mismatched due to the cast to (boolean) hidden in their macro
definitions.

2 years agoUnify monster-consumes-object
Pasi Kallinen [Sat, 21 Jan 2023 08:05:44 +0000 (10:05 +0200)]
Unify monster-consumes-object

This code was in three different places; pet eating,
monster eating metal, and monster eating other objects.

Other than very minor changes (eg. rustproofing completely
protects pets from bad effects, rustproof items are no longer
giving apport, and monsters eating corpses are healed), it
should behave the same as before... But I haven't exhaustively
gone through every iteration.

2 years agofix misplaced brace; also relocate Soundeffect()
nhmall [Sat, 21 Jan 2023 01:51:31 +0000 (20:51 -0500)]
fix misplaced brace; also relocate Soundeffect()

The brace added to dokick was misplaced - it should have included
the You_hear() as well.

The puts the code back the way it was, and relocates the Soundeffect().
The Soundeffect should play whether the hero is Blind or not, and the
Soundeffect() macro already includes a Deaf guard.

2 years agoplace a comment to identify the unreachable code
nhmall [Sat, 21 Jan 2023 01:41:03 +0000 (20:41 -0500)]
place a comment to identify the unreachable code

2 years agore-suppress the three warnings that reappeared
nhmall [Sat, 21 Jan 2023 01:32:36 +0000 (20:32 -0500)]
re-suppress the three warnings that reappeared

src/nhlua.c(1118) : warning C4702: unreachable code
src/nhlua.c(1045) : warning C4702: unreachable code
src/nhlua.c(1107) : warning C4702: unreachable code

2 years agonew static analyzer fix - nhlua.c
PatR [Sat, 21 Jan 2023 01:18:27 +0000 (17:18 -0800)]
new static analyzer fix - nhlua.c

Cope with get_nh_lua_variable() possibly returning Null.

Either or both of the DISABLE_WARNING_UNREACHABLE_CODE and
RESTORE_WARNING_UNREACHABLE_CODE in the vicinity looked misplaced so
I took them out.  They may need to be added back in.

2 years agoresolve 5 analyzer warnings if no SND_LIB_* define
nhmall [Fri, 20 Jan 2023 22:32:55 +0000 (17:32 -0500)]
resolve 5 analyzer warnings if no SND_LIB_* define

2 years agoSet SNDCAP_USERSOUNDS bit in windsound interface
nhmall [Fri, 20 Jan 2023 19:50:06 +0000 (14:50 -0500)]
Set SNDCAP_USERSOUNDS bit in windsound interface

2 years agowhitespace cleanup on files just modified
nhmall [Fri, 20 Jan 2023 19:28:33 +0000 (14:28 -0500)]
whitespace cleanup on files just modified

2 years agoadd soundeffects hooks to core
nhmall [Fri, 20 Jan 2023 19:18:48 +0000 (14:18 -0500)]
add soundeffects hooks to core

Insert the calls to trigger a number of potential soundeffects
into the core.

If no additional soundlib support is integrated into the
build, then the Soundeffect macro (sndprocs.h) expands to nothing:

[#define Soundeffect(seid, vol)
]

If, however, at least one additional soundlib support is integrated
into the build, then the Soundeffect macro gets defined as this
in sndprocs.h:

[#define Soundeffect(seid, vol) \
    do {                                                              \
        if (!Deaf && soundprocs.sound_soundeffect                     \
            && ((soundprocs.sndcap & SNDCAP_SOUNDEFFECTS) != 0))      \
            (*soundprocs.sound_soundeffect)(emptystr, (seid), (vol)); \
    } while(0)
]

That macro definition checks for the hero not being Deaf; it checks
to ensure that the active soundlib interface has a non-null
sound_soundeffect() function pointer; and it checks to ensure
that the active soundlib interface has declared that it supports
soundeffects by setting the SNDCAP_SOUNDEFFECTS bit in its sndcap
entry. That just means that the interface routines are prepared to
accept and deal with the calls from the core, whether or not it
actually produces the desired soundeffect.

2 years agoPoly into fire elemental, eat flammable items
Pasi Kallinen [Fri, 20 Jan 2023 16:56:01 +0000 (18:56 +0200)]
Poly into fire elemental, eat flammable items

2 years agoRandom sink effect: noxious gas cloud
Pasi Kallinen [Fri, 20 Jan 2023 15:35:14 +0000 (17:35 +0200)]
Random sink effect: noxious gas cloud

2 years agoFix mouse menu movement
Pasi Kallinen [Fri, 20 Jan 2023 12:35:30 +0000 (14:35 +0200)]
Fix mouse menu movement

When using mouse to move to a location next to the hero,
the test_move result was reversed, causing the click to fall
in to the travel case instead of normal movement.

2 years agoAdd hell_tweaks to Orcus' level
Pasi Kallinen [Fri, 20 Jan 2023 12:08:34 +0000 (14:08 +0200)]
Add hell_tweaks to Orcus' level

2 years agoguard call
nhmall [Fri, 20 Jan 2023 10:19:06 +0000 (05:19 -0500)]
guard call

2 years agoupdate visual studio dirs.props with new directory
nhmall [Fri, 20 Jan 2023 01:09:39 +0000 (20:09 -0500)]
update visual studio dirs.props with new directory

2 years agomingw32 bit
nhmall [Fri, 20 Jan 2023 01:03:45 +0000 (20:03 -0500)]
mingw32 bit

2 years agoanother update to visual studio project files
nhmall [Fri, 20 Jan 2023 00:48:55 +0000 (19:48 -0500)]
another update to visual studio project files

2 years agoupdate visual studio project files
nhmall [Fri, 20 Jan 2023 00:44:25 +0000 (19:44 -0500)]
update visual studio project files

2 years agoThis is cron-daily v1-May-8-2022. 000files updated: Files
nhw_cron [Fri, 20 Jan 2023 00:24:08 +0000 (19:24 -0500)]
This is cron-daily v1-May-8-2022.  000files updated: Files

2 years agofollow-up for windows build based on CI results
nhmall [Fri, 20 Jan 2023 00:26:23 +0000 (19:26 -0500)]
follow-up for windows build based on CI results

2 years agoremove obsolete file sys/windows/ntsound.c
nhmall [Fri, 20 Jan 2023 00:13:55 +0000 (19:13 -0500)]
remove obsolete file sys/windows/ntsound.c

2 years agoadd an interface for sound libraries
nhmall [Thu, 19 Jan 2023 23:51:42 +0000 (18:51 -0500)]
add an interface for sound libraries

Groundwork for a more versatile interface for using
sound libraries. A lot of sound libraries work across
multiple platforms.

The current NetHack sound stuff is quite limited.

Binaries can have a variety of window ports linked into
them, and it makes sense to have something similar for
sound.

This tries to set things up in a more soundlib-centric way,
rather than inserting things in a platform-centric way.

It establishes a new top-level directory sound (akin to win
for the window interface routines, or "window-port") where
sound-related additions and sndprocs and support files can be
added and used across platforms.

The default interface is nosound and the 'nosound' interface
is in src/sounds.c

The interface for 'windsound', which contains the same minimal
USER_SOUNDS support using built-in routines that has been in the
windows port for a long time is added to
sound/windsound/windsound.c.

For now, the sound interface support for 'qtsound' has been added
to the existing Qt files win/Qt/qt_bind.h and win/Qt/qt_bind.cpp,
and a note has been placed in sound/qtsound/README.md to avoid
confusion.

New header file added: include/sndprocs.h.

2 years agoMindless monsters are not scared of music
Pasi Kallinen [Thu, 19 Jan 2023 20:18:52 +0000 (22:18 +0200)]
Mindless monsters are not scared of music

2 years agoBoomerang hitting a sink is noisy
Pasi Kallinen [Thu, 19 Jan 2023 17:59:19 +0000 (19:59 +0200)]
Boomerang hitting a sink is noisy

2 years agoDigging is noisy
Pasi Kallinen [Thu, 19 Jan 2023 17:55:24 +0000 (19:55 +0200)]
Digging is noisy

2 years agoFix vibrating square
Pasi Kallinen [Thu, 19 Jan 2023 10:12:26 +0000 (12:12 +0200)]
Fix vibrating square

The Gehennom changes broke the vibrating square, allowing hero to go
down into the Sanctum via stairs without performing the invocation.

Fix this by making the hellfill lua check for invocation level, and
placing down the vibrating square trap, instead of stairs.

2 years agoadd Japanese item names to discoveries list
PatR [Thu, 19 Jan 2023 06:00:57 +0000 (22:00 -0800)]
add Japanese item names to discoveries list

When playing as a Samurai, add things like "osaku" to the discoveries
list even though they don't have separate descriptions to be used
when not yet discovered.  Non-magic ones are pre-discovered and
players can now use the '\' command to figure out what things like
"tanko" mean without resorting to '/?'.

"wooden harp" has been getting changed to "koto (harp)"; make that be
| koto [wooden harp] (koto)
"magic harp" has been staying as "magic harp (harp)"; add it to the
list of Japanese item names.  Since it's magic it isn't pre-discovered.
Once discovered it becomes
| magic koto [magic harp] (koto)

Those two needed special case handling, none of the other items did
aside from forcing them to be discoverable when lacking descriptions.
The discoveries list now has things like
| wakizashi [short sword]
| naginata [glaive] (single-edged polearm)
| gunyoki [food ration]
if--and only if--the hero is a Samurai.

2 years agoMove familiar level message into function
Pasi Kallinen [Wed, 18 Jan 2023 21:33:21 +0000 (23:33 +0200)]
Move familiar level message into function

2 years agopacify static analyzer - vision.c
PatR [Wed, 18 Jan 2023 19:57:49 +0000 (11:57 -0800)]
pacify static analyzer - vision.c

Include some assertions to convince the analyzer that some pointers
can't be Null.  They're Null if 'vis_func' is non-Null but only used
when that function pointer is Null and they have values.

If there's a macro that's defined when the analyzer is running and
undefined when not--or vice versa--it could be used to control NDEBUG
and avoid the assertion code when not analyzing.  That's a bit like
using fake code to pacify 'lint'; however, since the assertions should
never fail, suppressing them isn't really switching to fake code.

I reordered a couple of macros so that the set of them matches the
comment which precedes them and refers to "the last three".  It is
referring to the three within the block comment rather than the macro
defintions but putting those in the same order removes any ambiguity.

2 years agostatic analyzer vs symbols.c
PatR [Wed, 18 Jan 2023 19:29:40 +0000 (11:29 -0800)]
static analyzer vs symbols.c

This will probably shut up the static analyzer's exceedingly verbose
complaint for symbols.c.

2 years agoMake plane of fire hot
Pasi Kallinen [Wed, 18 Jan 2023 08:50:32 +0000 (10:50 +0200)]
Make plane of fire hot

2 years agovisual studio package settings
nhmall [Wed, 18 Jan 2023 02:07:45 +0000 (21:07 -0500)]
visual studio package settings

2 years agoquiet a new warning
nhmall [Wed, 18 Jan 2023 00:59:24 +0000 (19:59 -0500)]
quiet a new warning

src/eat.c(74,46): warning C4132: 'zero_victual': const object should be initialized

2 years agocomment typo: vicutal -> victual
nhmall [Wed, 18 Jan 2023 00:44:05 +0000 (19:44 -0500)]
comment typo: vicutal -> victual

2 years agomaybe pacify static analyzer - eat.c
PatR [Wed, 18 Jan 2023 00:31:59 +0000 (16:31 -0800)]
maybe pacify static analyzer - eat.c

The complaint is that victual.canchoke might be used without having
been initialized.  I'm fairly sure that that isn't correct but get
dizzy trying to trace through the eating code.

This might improve the situation, or maybe not.

2 years agopacify static analyzer - dog.c
PatR [Tue, 17 Jan 2023 18:42:00 +0000 (10:42 -0800)]
pacify static analyzer - dog.c

This is similar to the earlier potential fix that I didn't like,
but I think think one is better.

The analyzer claimed that 'fptr' might be Null inside the switch
case for
|struct permonst *fptr = NULL;
|if (obj->otyp == CORPSE || ...) fptr = &mons[obj->corpsenm];
|switch (obj->otyp) { case CORPSE: ... /* dereference 'fptr' */ }
even though it will always have a non-Null value for otyp==CORPSE.

Make the assignment of 'fptr' unconditional.  mons[NUMMONS] is
valid and won't match any actual monster.  In this case it will
only be used when initializing fptr, never when fptr gets used.

2 years agoLevel temperature
Pasi Kallinen [Tue, 17 Jan 2023 18:07:24 +0000 (20:07 +0200)]
Level temperature

Allow setting a per-level "temperature": hot, cold, or temperate
via special level flags. Currently it only affects some messages
in Gehennom, but it could be expanded to ice melting, water freezing,
or monster generation, for example.

Invalidates saves and bones.

2 years agostatic analyzer - shk.c
PatR [Tue, 17 Jan 2023 01:15:26 +0000 (17:15 -0800)]
static analyzer - shk.c

Add a couple of redundant tests for 'shkp = shop_keeper()' yielding
Null to pacify the static analyzer.

Make the paired calls to shkp = shop_keeper() and inhishop(shkp) look
more consistent.  Barring typos, the behavior hasn't been changed.

2 years agosome tilebmp.c code cleanup
nhmall [Mon, 16 Jan 2023 18:58:58 +0000 (13:58 -0500)]
some tilebmp.c code cleanup

Remove some conditional code that isn't needed these days.

Use C99 fixed width integer types for all platforms, instead
of using it for some and Microsoft types for others.

2 years agoAdd a cold, watery gehennom filler maze
Pasi Kallinen [Mon, 16 Jan 2023 17:09:28 +0000 (19:09 +0200)]
Add a cold, watery gehennom filler maze

2 years agofixes entry
Pasi Kallinen [Mon, 16 Jan 2023 08:45:23 +0000 (10:45 +0200)]
fixes entry

2 years agoFix deleting worn object
Pasi Kallinen [Mon, 16 Jan 2023 07:40:05 +0000 (09:40 +0200)]
Fix deleting worn object

When going down stairs while punished, if you had quivered a mirror
and the mirror was dropped because you fell down the stairs, it would
not have been unequiped.

2 years agosuppress a new warning
nhmall [Sun, 15 Jan 2023 20:39:22 +0000 (15:39 -0500)]
suppress a new warning

2 years agogeneric object fix
PatR [Sun, 15 Jan 2023 19:04:35 +0000 (11:04 -0800)]
generic object fix

When hallucinating, random object selection for objects was including
the new generic objects.  It was already excluding 'strange object'
by using 'rn2(NUM_OBJECTS - 1) + 1' to skip objects[0]; changing that
to be 'rn2(NUM_OBJECTS - MAXOCLASSES) + MAXOCLASSES' will skip the
first 18 objects, 'strange object' plus the 17 generic objects.

(I'm trying to convince myself that there's no off-by-1 or off-by-N
error and think I've succeeded.)

2 years agostrange object vs generic objects
PatR [Sun, 15 Jan 2023 09:45:14 +0000 (01:45 -0800)]
strange object vs generic objects

Try to fix a fuzzer issue.  I wasn't able to reproduce it so am not
sure whether this actually fixes it.  A mimic seemed to be mimicking
object #1 (generic ILLOBJ_CLASS object which shouldn't occur) rather
than #0 (strange object).  Strange object always has dknown==1 and
generic objects should always have dknown==0 but farlook of mystery
object #1 had its dknown flag set.

An earlier fix to force non-Null oc_name when formatting objects in
order to pacify the static analyzer might have been the reason that
the problem couldn't be reproduced.

This includes a few miscellaneous changes made while unsuccessfully
hunting for the problem.

2 years agoLua: Persistent variables
Pasi Kallinen [Sun, 15 Jan 2023 08:32:31 +0000 (10:32 +0200)]
Lua: Persistent variables

Add a way for the lua scripts to set and retrieve variables
that are persistent - saved and restored with the game.

Invalidates saves.

2 years agocouple more analyzer complains - nhlua.c
PatR [Sat, 14 Jan 2023 23:55:55 +0000 (15:55 -0800)]
couple more analyzer complains - nhlua.c

I don't know whether there is potentially a real problem with either
of these.  The two trivial changes should shut the static analyzer.

2 years agoanother static analyzer bit - cast_protection()
PatR [Sat, 14 Jan 2023 07:55:37 +0000 (23:55 -0800)]
another static analyzer bit - cast_protection()

The code tested u.uswallow and then accessed u.ustuck.  Under normal
circumstances that works fine but it could be a problem if the two
fields got out of synch.  This ought to fix the analyzer complaint
and avoid any trouble with mondata access.

2 years agoanother static analyzer bit - Japanese_item_name()
PatR [Sat, 14 Jan 2023 07:41:23 +0000 (23:41 -0800)]
another static analyzer bit - Japanese_item_name()

The analyzer complained that the second call to Japanese_item_name()
might return Null after the first one didn't.
|    if (Role_if(PM_SAMURAI) && Japanese_item_name(otyp))
|        actualnm = Japanese_item_name(otyp);
even though the code involved is self-contained and deterministic.
Then later in obj_typename() 'actualnm' gets passed to strcat() or
strcpy() where Null isn't acceptable.

Could probably fix that by caching and reusing the first return value:
|    if (Role_if(PM_SAMURAI) && (jname = Japanese_item_name(otyp)) != 0)
|        actualnm = jname;
but I went a different route, revising that routine to take a second
argument:
|    if (Role_if(PM_SAMURAI))
|        actualnm = Japanese_item_name(otyp, actualnm);
It now passes back 'actualnm' instead of Null when no substitution
takes place.

The recent introduction of generic objects without names meant that
'actualnm' could actually be Null, but generic objects only occur
for map glyphs and only when dknown is 0, so the actual-name field
shouldn't ever be get used for them.  Give actualnm a fallback value
just in case.

Wishing is a place that loops over all of objects[] so have it skip
the generic objects.  They're all flagged no-wish so weren't being
chosen, but explicitly skipping them makes the intention clear.

2 years agopacify analyzer's complaint - restore_waterlevel()
PatR [Sat, 14 Jan 2023 06:23:30 +0000 (22:23 -0800)]
pacify analyzer's complaint - restore_waterlevel()

Redo the restore_waterlevel() code a bit to eliminate a static
analyzer complaint.  The previous code would not have done the right
thing if 'gb.bbubbles' was already non-Null, but that should not be
possible.  I didn't backtrack to make sure that it was always Null
at the time restore_waterlevel() gets called.

Also, some of the code was misformatted.

2 years agofree newbmp memory
nhmall [Fri, 13 Jan 2023 00:24:52 +0000 (19:24 -0500)]
free newbmp memory

Even though the program is exiting on the next line, free the
memory that was allocated. That should keep any monitoring tools
content.

2 years agoremove extra potion enums
PatR [Thu, 12 Jan 2023 22:54:05 +0000 (14:54 -0800)]
remove extra potion enums

Generic object handling ended up not using FIRST_POTION, LAST_POTION,
and NUM_POTIONS so don't bother setting those up.

2 years agoavoid a warning on x ? :
nhmall [Thu, 12 Jan 2023 21:31:35 +0000 (16:31 -0500)]
avoid a warning on x ? :

Surround the code to the left of the '?' in the DESTROY_ARM(o) macro
with () to quiet a warning on each use of the macro.

2 years agoremove a static analyzer warning from botl.c
nhmall [Thu, 12 Jan 2023 21:28:39 +0000 (16:28 -0500)]
remove a static analyzer warning from botl.c

One static analyzer warned that there was a lower bound range check
ahead of the array index, but no upper bound check.

2 years agoDeadly afflictions and resistances for safe_wait
Pasi Kallinen [Thu, 12 Jan 2023 21:15:51 +0000 (23:15 +0200)]
Deadly afflictions and resistances for safe_wait

Amend the safe_wait so it still waits if you have a deadly property,
even if you have a resistance to it.

External resistances do not protect against already existing
deadly properties, for example becoming deadly ill is not cured
even if you wear a green dragon scale mail.

2 years agoyn()
nhmall [Thu, 12 Jan 2023 21:04:40 +0000 (16:04 -0500)]
yn()

A number of C compiler suites have a math.h library that includes a yn()
function name that conflicts with NetHack's yn() macro:
"The y0(), y1(), and yn() functions are Bessel functions of the second kind,
for orders 0, 1, and n, respectively. The argument x must be positive. The
argument n should be greater than or equal to zero. If n is less than zero,
there will be a negative exponent in the result."

At one point, isaac64.h included math.h, although that has since been removed.

Some libraries used in NetHack (Qt for one) do include math.h and that required
build work-arounds to avoid the conflict.

Rename the NetHack macro from yn() to y_n() and avoid the math.h conflict
altogether, eliminating the need for that particular work-around.

2 years agomore ATTNORETURN
nhmall [Thu, 12 Jan 2023 20:38:15 +0000 (15:38 -0500)]
more ATTNORETURN

A recent commit to alloc.c by Keni drew attention to the fact that
there are extern prototypes scattered around in various .c files.
Those can make use of ATTRNORETURN (non-gcc compilers and C23) the
same way the prototypes in extern.h can, and they were overlooked
when ATTRNORETURN was first added.

2 years agoadd some tile credit where it is due
nhmall [Thu, 12 Jan 2023 18:10:33 +0000 (13:10 -0500)]
add some tile credit where it is due

Since tile files can now contain comments, incorporate the comments
that accompanied some contributions that were adopted back when
male and female tile differentiation became possible.

If the original contributing artist wants to alter their name or handle
that was used in any of the credits, or wants to change any comment text,
please send your corrections to devteam@nethack.org.
Or, better yet, do a pull request with your desired alterations.

Alternatively, if they are fine as they are, a note to devteam@nethack.org
acknowledging that would be welcome, but certainly not required.

Thanks again for contributing the tiles.

2 years agoAvoid magic numbers in tile2bmp
Pasi Kallinen [Thu, 12 Jan 2023 15:34:58 +0000 (17:34 +0200)]
Avoid magic numbers in tile2bmp

2 years agotab to spaces
nhmall [Thu, 12 Jan 2023 14:52:14 +0000 (09:52 -0500)]
tab to spaces

2 years agoremove some outdated code, tidy up
nhmall [Thu, 12 Jan 2023 14:42:02 +0000 (09:42 -0500)]
remove some outdated code, tidy up

2 years agofix warning
nhmall [Thu, 12 Jan 2023 14:24:56 +0000 (09:24 -0500)]
fix warning

fix warning introduced in 1755d27bf8584c8e1dab716a8e11b18b2cb0be24

win/share/tiletext.c(208) : warning C4701: potentially uninitialized local
variable 'i' used

2 years agodo exit
nhmall [Thu, 12 Jan 2023 14:21:53 +0000 (09:21 -0500)]
do exit

2 years agofix actual problem of #955 by counting the tiles
nhmall [Thu, 12 Jan 2023 13:51:59 +0000 (08:51 -0500)]
fix actual problem of #955 by counting the tiles

2 years agofix github issue #955 - tile2bmp bounds failure
PatR [Thu, 12 Jan 2023 11:12:56 +0000 (03:12 -0800)]
fix github issue #955 - tile2bmp bounds failure

Issue reported by argrath:  building with 'address sanitizing'
reported tile2bmp writing out of array bounds after the addition
of the generic object tiles.

'MAGICTILENO' in tile2bmp.c is extremely fragile.  It was already
inaccurate before the generic tiles, but had a big enough value to
handle the final row of tiles prior to that.

Fixes #955

2 years agoMore Gehennom filler level variance
Pasi Kallinen [Thu, 12 Jan 2023 10:36:29 +0000 (12:36 +0200)]
More Gehennom filler level variance

2 years agodisplaying generic objects
PatR [Tue, 10 Jan 2023 22:33:21 +0000 (14:33 -0800)]
displaying generic objects

Add 17 fake objects to objects[], one for each object class.  All
specific color as gray.  They're grouped at the start--actually near
the start since "strange object" is still objects[0]--rather than
being among the objects for each class.  init_object() knows to start
at [MAXOCLASSES] instead of [0]; other code that loops through every
object might need adjusting.

For potions, non-stone gems, and non-novel/non-Book_of_the_Dead
spellbooks that don't have obj->dknown set, display the corresponding
generic object rather the object itself.  Fixes the longstanding bug
of seeing color for not-yet-seen objects whose primary distinguishing
characteristic is their color.  Walking next to a generic object
while able to see its spot will set dknown and redraw as specific.
It's slightly disconcerting to have objects change as you reach them;
I hope it's just a matter of becoming used to that.  (If there is any
code still changing the hero's location manually instead of using
u_on_newpos(), it should be changed to use that routine.)

Most of the new tiles are just a big rendering of punctuation
characters.  The potion, gem, and spellbook ones could be cloned from
a specific object in their class and then have the color removed.  I
started out that way but wasn't happy with the result.  I'm not
artisticly inclined; hopefully someone else will do better.  Each of
them is preceded by a comment beginning with "#_"; the underscore
isn't required, just being used to make the comments stand out a bit.

Invalidates existing save and bones files.

2 years agomake the 2 panic declarations fully match
keni [Tue, 10 Jan 2023 21:55:35 +0000 (16:55 -0500)]
make the 2 panic declarations fully match

2 years agoalloc.c: add missing NORETURN
keni [Tue, 10 Jan 2023 20:55:30 +0000 (15:55 -0500)]
alloc.c: add missing NORETURN

2 years agoMore interesting Gehennom levels
Pasi Kallinen [Mon, 9 Jan 2023 20:25:23 +0000 (22:25 +0200)]
More interesting Gehennom levels

Instead of just plain old boring mazes, spice up Gehennom by
occasionally adding lava, iron bars, or even mines-style levels
(with lava, of course).

Of the fixed Gehennom levels, only Asmodeus' lair has been changed
to add some random lava pools.

Also some lua fixes and changes:
- Fixed a selection negation bounding box being wrong.
- Fixed a selection negated and ORed returning wrong results.
- des.map now returns a selection of the map grids it touched.
- When using des.map contents-function the commands following the
  map are not relative to it.

2 years agoidentifying via menu
PatR [Tue, 10 Jan 2023 07:34:32 +0000 (23:34 -0800)]
identifying via menu

From the newsgroup:  identifying by menu pops up multiple menus in
succession if the player picks fewer invent entries than are being
granted, but the second and subsequent ones could cover up the
message window and hide the feedback from prior ones.

If multiple popup menus are needed when identifying, issue --More--
before each menu after the first.  The code seemed to be trying to
do this already, but it should have used wait_synch() rather than
mark_synch(), or perhaps used display_nhwindow(WIN_MESSAGE, TRUE)
instead of either one of those.  For curses, both mark_synch() and
wait_synch() were no-ops.  Now they do something.  X11's behavior
wasn't right either; it seemed to be lagging one message behind
(something I had noticed recently and then forgotten about; I still
don't remember the context then so don't know whether this fixes
that earlier situation).

2 years agoallow full-line comments in tiles source files
PatR [Sun, 8 Jan 2023 09:33:18 +0000 (01:33 -0800)]
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.

2 years agofix for onefile FITSint, FITSuint
PatR [Sat, 7 Jan 2023 20:48:10 +0000 (12:48 -0800)]
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.

2 years agoAnother valgrind uninitialized bytes complaint
Pasi Kallinen [Sat, 7 Jan 2023 15:28:14 +0000 (17:28 +0200)]
Another valgrind uninitialized bytes complaint

2 years agoSilence valgrind uninitialized bytes complaints
Pasi Kallinen [Sat, 7 Jan 2023 11:20:39 +0000 (13:20 +0200)]
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.

2 years agoFix lua selection logical-or bounds
Pasi Kallinen [Sat, 7 Jan 2023 08:55:05 +0000 (10:55 +0200)]
Fix lua selection logical-or bounds

2 years agoFree command queues at end of game
Pasi Kallinen [Fri, 6 Jan 2023 14:40:54 +0000 (16:40 +0200)]
Free command queues at end of game

At end of game, the disclose prompts put commands into the queue,
but those weren't freed.

2 years agoRemove NO_VSNPRINTF
Pasi Kallinen [Fri, 6 Jan 2023 13:53:03 +0000 (15:53 +0200)]
Remove NO_VSNPRINTF

Affects only ancient VMS where vsnprintf wasn't available.

2 years agoshow_glyph() impossible
PatR [Tue, 3 Jan 2023 07:40:06 +0000 (23:40 -0800)]
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.

2 years agoscore feedback punctuation
PatR [Tue, 3 Jan 2023 07:25:38 +0000 (23:25 -0800)]
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.

2 years agostriking/force-bolt comment
PatR [Mon, 2 Jan 2023 22:25:23 +0000 (14:25 -0800)]
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().

2 years agostatic analyzer bit display.c
nhmall [Mon, 2 Jan 2023 21:06:11 +0000 (16:06 -0500)]
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.

2 years agonethack --windowtype=badchoice
PatR [Mon, 2 Jan 2023 01:35:06 +0000 (17:35 -0800)]
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.

2 years agoGuidebook update
nhmall [Mon, 2 Jan 2023 01:23:15 +0000 (20:23 -0500)]
Guidebook update

2 years agoupdate for tilemap.c generated tile.c code
nhmall [Mon, 2 Jan 2023 01:05:59 +0000 (20:05 -0500)]
update for tilemap.c generated tile.c code

2 years agoadd some curses support for coloring of map frame
nhmall [Mon, 2 Jan 2023 01:05:03 +0000 (20:05 -0500)]
add some curses support for coloring of map frame

2 years agointroduce X11 support for coloring map frame
nhmall [Mon, 2 Jan 2023 01:04:27 +0000 (20:04 -0500)]
introduce X11 support for coloring map frame

2 years agointroduce Qt support for color of map frame
nhmall [Mon, 2 Jan 2023 01:03:30 +0000 (20:03 -0500)]
introduce Qt support for color of map frame

2 years agointroduce support for coloring the frame behind a map location
nhmall [Mon, 2 Jan 2023 00:55:02 +0000 (19:55 -0500)]
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.

2 years agoupdate year in copyright
nhmall [Sun, 1 Jan 2023 22:31:34 +0000 (17:31 -0500)]
update year in copyright

2 years agocomment fix in display.c
PatR [Sun, 1 Jan 2023 08:21:51 +0000 (00:21 -0800)]
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.

2 years agofix tilemap - no panic()
PatR [Sat, 31 Dec 2022 21:35:17 +0000 (13:35 -0800)]
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.

2 years agopull request #942 - shopkeeper chat changes
PatR [Sat, 31 Dec 2022 20:42:52 +0000 (12:42 -0800)]
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

2 years agoUse verbalize for shopkeeper price-check #chatting
Michael Meyer [Fri, 2 Dec 2022 17:45:00 +0000 (12:45 -0500)]
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.

2 years agoTweaks to chatting with mute shopkeeper
Michael Meyer [Fri, 2 Dec 2022 17:32:35 +0000 (12:32 -0500)]
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.

2 years agopull request #939 - revise #wizsmell command
PatR [Sat, 31 Dec 2022 20:13:41 +0000 (12:13 -0800)]
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