]> granicus.if.org Git - nethack/log
nethack
5 years agoresurrect 'makedefs -m'
PatR [Tue, 21 Apr 2020 21:04:03 +0000 (14:04 -0700)]
resurrect 'makedefs -m'

Have 'makedefs -m' output default mons[].difficulty values in the
stub 'monstr.c' that still gets generated for that option.  It
would be better to allow specifying which monsters are of interest
but I didn't want to get bogged down by interface issues.

I needed it for mons[PM_ELF].difficulty after changing that monster's
level, so it still has a purpose.  Code is from 3.4.3, reformatted
manually.

5 years agoobsolete monst.c comment
PatR [Tue, 21 Apr 2020 20:50:28 +0000 (13:50 -0700)]
obsolete monst.c comment

Remove an obsolete comment about soldiers since they haven't been
contiguous for over 15 years as the 'ants in barracks' bug report
revealed.

Do some reformatting, mostly for attacks among the '@' class.

Only one actual change:  reduce the level for 'elf' (placeholder
for zombie and mummy corpses) from 10 to 0 (and corresponding
difficulty from 12 to 2).  I don't think that level is ever used
anywhere and the one for humans is already zero.  Having it be
higher than Elvenking's level was absurd.

'@' section should either be completely reordered to obey 'rule #2'
or nurse should be moved back to where it once was (in front of
shopkeeper).  I haven't done either but only because I couldn't
which of the two should be done.

5 years agosquadprob array had 5 elements but only 4 initialized
nhmall [Tue, 21 Apr 2020 18:32:14 +0000 (14:32 -0400)]
squadprob array had 5 elements but only 4 initialized

fixes #335

5 years agoTests: Wishing for sprig of wolfsbane etc
Pasi Kallinen [Tue, 21 Apr 2020 17:00:26 +0000 (20:00 +0300)]
Tests: Wishing for sprig of wolfsbane etc

5 years agoAdd Pillars themeroom
Pasi Kallinen [Tue, 21 Apr 2020 16:52:39 +0000 (19:52 +0300)]
Add Pillars themeroom

5 years agoAdjust some themerooms
Pasi Kallinen [Tue, 21 Apr 2020 15:59:25 +0000 (18:59 +0300)]
Adjust some themerooms

5 years agoPrevent branch stairs generating in unjoined room
Pasi Kallinen [Tue, 21 Apr 2020 15:41:08 +0000 (18:41 +0300)]
Prevent branch stairs generating in unjoined room

5 years agoPrevent stairs in Mausoleum themeroom
Pasi Kallinen [Tue, 21 Apr 2020 14:57:42 +0000 (17:57 +0300)]
Prevent stairs in Mausoleum themeroom

... by making the mausoleum part into an unjoined subroom

5 years agodetection bugs when vault guard is at <0,0>
PatR [Mon, 20 Apr 2020 23:11:47 +0000 (16:11 -0700)]
detection bugs when vault guard is at <0,0>

Monster detection skipped dead monsters during fmon traversal but
found semi-dead guard parked at <0,0> waiting to remove temporary
vault corridor.  If that happened to be the only monster found then
the feedback was incorrect (a blank map showing no found monsters
instead of a strange feeling).  Object detection found semi-dead
guard's inventory and might report incorrectly too although the
chance of that being the only objects found on the level is a lot
less than it being the only monster.

5 years agofix issue #325 - wishing for "garlic" doesn't work
PatR [Mon, 20 Apr 2020 21:57:17 +0000 (14:57 -0700)]
fix issue #325 - wishing for "garlic" doesn't work

Wishing allowed "royal jelly" to match "lump of royal jelly" as a
special case, but not "wolfsbane" to match "sprig of wolfsbane" or
"tricks" to match "bag of tricks".  Handle that sort of match in a
more general way.

While in there, add a minor glob bit:  instead of giving a random
corpse (because monster is flagged as no-corpse) if someone wishes
for "gray ooze corpse" give "glob of gray ooze".

Fixes #325

5 years agofix wishing crash
PatR [Mon, 20 Apr 2020 20:28:43 +0000 (13:28 -0700)]
fix wishing crash

After 05403182ebc542da4bacd716cef408a27372c1ad (I think, possibly the
change to objnam.c which followed that one) from a couple of days ago,
wishing for a monster name dereferenced a Null pointer and crashed.

5 years agoClear saved lua_State from dungeons
Pasi Kallinen [Mon, 20 Apr 2020 13:48:52 +0000 (16:48 +0300)]
Clear saved lua_State from dungeons

These will be recreated if necessary in makerooms

5 years agoNo trying themed rooms if lua init failed
Pasi Kallinen [Mon, 20 Apr 2020 13:34:22 +0000 (16:34 +0300)]
No trying themed rooms if lua init failed

5 years agoyet more S_unexplored
PatR [Sun, 19 Apr 2020 23:15:16 +0000 (16:15 -0700)]
yet more S_unexplored

Revert part of one of the earlier S_unexplored changes (erasing
the map window on tty) and deal with the issue differently.

5 years agolua.adoc typo
PatR [Sun, 19 Apr 2020 22:42:32 +0000 (15:42 -0700)]
lua.adoc typo

"not-cursed" was misspelled.

5 years agowindows build fix
nhmall [Sun, 19 Apr 2020 17:40:20 +0000 (13:40 -0400)]
windows build fix

src\cmd.c(505) : error C4703: potentially uninitialized local pointer variable 'efp' used
NMAKE : fatal error U1077

5 years agolua doc for des.object
Pasi Kallinen [Sun, 19 Apr 2020 17:23:22 +0000 (20:23 +0300)]
lua doc for des.object

5 years agoAdd water vault themeroom
Pasi Kallinen [Sun, 19 Apr 2020 16:54:42 +0000 (19:54 +0300)]
Add water vault themeroom

5 years agofix issue #326 - can't wish for were-foo corpse
PatR [Sun, 19 Apr 2020 12:28:18 +0000 (05:28 -0700)]
fix issue #326 - can't wish for were-foo corpse

"were{rat,jackal,wolf}" each occur twice in mons[], once for the
beast form and second time among '@' for the human form.  Wishing
for werecreature corpse or tin always matches the first entry so
yields the beast form, but all their beast forms are flagged as
no-corpse so the wish would fallback to a corpse with random monster
type.  Wishing for werecreature figurine worked but always produced
one that created its beast form if/when activated.

This fix allows specifying "human werecreature" to match the second
entry.  It's optional for corpse and tin; the wish code will now
switch to that implicitly if it gets a no-corpse were-form for
those.  It has to be specified explicitly to get a figurine that
will activate as the human form.  It works for ^G too.

Fixes #326

5 years agowishing fix
PatR [Sun, 19 Apr 2020 11:58:18 +0000 (04:58 -0700)]
wishing fix

name_to_mon() has a bunch of alternate monster names, such as
"gray-elf" to match "grey-elf" and "ki rin" to match "ki-rin".  Those
worked as intended when they occurred at the end of a wish, but only
worked in the middle if their length was the same or one character
less than the canonical name in mons[].mname.

djinni figurine     -> h - a figurine of a djinni
genie figurine      -> i - a figurine of a djinni
figurine of mumak   -> j - a figurine of a mumak
mumak figurine      -> k - a figurine of a mumak
figurine of mumakil -> l - a figurine of a mumak
mumakil figurine    -> nothing fitting that description exists

(The one-less case worked because its following space ended up being
implicitly removed when skipping ahead by the length of mons[].mname;
subsequent explicit removal didn't find a space so was a no-op.)

5 years agoobjects[] infrastructure
PatR [Sun, 19 Apr 2020 11:18:22 +0000 (04:18 -0700)]
objects[] infrastructure

The bases[] array allows finding the index of the first object in
a particular class.  Extend it so that bases[class + 1] - 1 is a
reliable way to find the last object in any class.  The array had
to be extended by one so that the last class has a [class+1] entry
available, and object initialization now makes sure that classes
within objects[] are in ascending order so that [class+1] always
holds a higher index than [class].

5 years ago|| vs &&
PatR [Sun, 19 Apr 2020 10:20:01 +0000 (03:20 -0700)]
|| vs &&

Add some parentheses.

5 years agofix issue #331 - steam clouds vs moats
PatR [Sat, 18 Apr 2020 22:28:53 +0000 (15:28 -0700)]
fix issue #331 - steam clouds vs moats

Water locations on Medusa's level didn't show steam clouds.  It
wasn't because the location was a moat rather than a pool, it was
because the moat location was unlit (and in line of sight) and
tested pool locations were lit.  Poison gas clouds explicitly
override the lit/unlit issue but other region types weren't.

Fixes #331

5 years agoFix negating menu_overlay
Pasi Kallinen [Sat, 18 Apr 2020 19:36:31 +0000 (22:36 +0300)]
Fix negating menu_overlay

5 years agoFix heap use after free
Pasi Kallinen [Sat, 18 Apr 2020 19:13:49 +0000 (22:13 +0300)]
Fix heap use after free

In a lua script, if object was created inside a container, it
might've merged with another object.

Also prevent stacking, lighting, and burying contained objects.

5 years agoShaped and themed rooms
Pasi Kallinen [Thu, 9 Apr 2020 04:22:22 +0000 (07:22 +0300)]
Shaped and themed rooms

Allows creating shaped or themed rooms for the Dungeons of Doom
via lua script.

Invalidates bones and saves.

Makefiles updated for unix/linux by adding themerms.lua, but other
OSes need to have that added.

5 years agoFix segfault on teleport while punished due to flooreffects
Pasi Kallinen [Sat, 18 Apr 2020 13:51:35 +0000 (16:51 +0300)]
Fix segfault on teleport while punished due to flooreffects

... deleting the ball & chain, but keeping a boulder in the pit.

Noticed a segfault when fuzzing, teleport while punished caused
a segfault via fill_pit -> flooreffects -> bury_objs -> unpunish,
and then the next line in teleds tried to look up uchain.

Guard against that particular case.

Fix the case of boulder being in a pit, triggered by you being in
a pit and a giant throwing a boulder on top of you.

5 years agoAlso explode the other bag of holding
Pasi Kallinen [Sat, 18 Apr 2020 08:31:16 +0000 (11:31 +0300)]
Also explode the other bag of holding

5 years agomap updating change to fix tty
PatR [Fri, 17 Apr 2020 23:45:41 +0000 (16:45 -0700)]
map updating change to fix tty

5 years agoadopt pull request #328 - steam clouds
PatR [Fri, 17 Apr 2020 21:56:47 +0000 (14:56 -0700)]
adopt pull request #328 - steam clouds

This adds a superset of the code from github pull request #328
to create a short-lived cloud of steam when fire hits a pool or
fountain.  The original code required C99; this doesn't.  It also
allowed vapor clouds on the Plane of Water where they don't work
sanely becaure regions don't understand air bubble movement and/or
vice versa.  This inhibits the clouds there [the same ought to be
done for scrolls of stinking cloud].  It also left as-is the code
that reported when fountains got used up even though conceptually
the steam should interfere with being able to see that.  This adds
a glyph-check hack to augment cansee() so that fountains that boil
away entirely are hidden at the time.

Regions that block line of slight should be calling block_point()
when created and unblock_point() when removed but a naive attempt
to introduce that didn't work as expected so I'm giving up on.

Fixes #328

5 years agotty: S_unexplored
PatR [Fri, 17 Apr 2020 08:06:37 +0000 (01:06 -0700)]
tty: S_unexplored

Screen erasure leaves the map set to spaces.  If S_unexplored is
something other than <space>, tty wasn't drawing with S_unexplored
after a menu or long message line got erased following temporary
overwrite of part of the map.

This seems to work but is not the correct way to do things.
clear_screen(), cl_eos(), and cl_end() should all be taught to
flag the map as needing to be refreshed after they erase part of it.
tty_clear_nhwindow(WIN_BASE) is also lacking since it erases the
message line, full map, and status lines but leaves their internal
windows with stale data about what is shown instead of marking them
blank.

5 years agoDehardcode the monk minetown food shop conversion
Pasi Kallinen [Thu, 16 Apr 2020 18:01:24 +0000 (21:01 +0300)]
Dehardcode the monk minetown food shop conversion

Instead of trying to figure out in core whether to change a minetown
food shop to health food shop for monks, just figure it out in the
minetown level creation script.

5 years agomimic in health food store
PatR [Thu, 16 Apr 2020 08:09:01 +0000 (01:09 -0700)]
mimic in health food store

Make a mimic that picks special VEGETARIAN_CLASS look like food
instead of a random object.  Also, at least a couple of Minetown
variants are classified as mazes so  had a 50% chance of not even
making that choice and look like a statue instead.  Override maze
when 'in_town()' yields True.

5 years agohealth food store
PatR [Thu, 16 Apr 2020 08:00:31 +0000 (01:00 -0700)]
health food store

When a food shop gets converted into a health food shop (minetown
when playing as a monk), the shop type and underlying room type
weren't changed to match.

5 years agoNerf unicorn horn
Pasi Kallinen [Wed, 15 Apr 2020 19:40:11 +0000 (22:40 +0300)]
Nerf unicorn horn

Unicorn horns are just too good. Nerf it in similar way several
other variants have done: don't let it restore attribute loss.

This makes potion of restore ability more valuable, and the
int loss from the (nerfed) mind flayers matter more.

5 years agogetpos help
PatR [Wed, 15 Apr 2020 08:43:47 +0000 (01:43 -0700)]
getpos help

This started with fixing a warning suggesting parentheses when
mixing || and &&, then started sprawling.  The getpos help for x/X
was misleading.  It said that using x or X would move cursor to the
next unexplored location but it actually moves the cursor to next
explored location that's adjacent to an unexplored one.

5 years agoMimic in a health food store could cause a panic
Pasi Kallinen [Wed, 15 Apr 2020 08:02:33 +0000 (11:02 +0300)]
Mimic in a health food store could cause a panic

Health food stores use a special "vegetarian class" of items,
which mkobj doesn't understand. Just make the mimic use a random
item class in that case.

5 years agoAdd vault guards to undisplaceable monsters
Pasi Kallinen [Wed, 15 Apr 2020 05:59:35 +0000 (08:59 +0300)]
Add vault guards to undisplaceable monsters

5 years agoFixes bit
Pasi Kallinen [Wed, 15 Apr 2020 05:49:43 +0000 (08:49 +0300)]
Fixes bit

5 years agoChange logic for immobilized displacement, fixing a bug
copperwater [Mon, 28 May 2018 23:36:23 +0000 (19:36 -0400)]
Change logic for immobilized displacement, fixing a bug

The bug was that you could easily displace peaceful sleeping monsters.
The source of this was that there was no check for sleeping in the
attack() function that checks for immobilization.

As well as adding the sleeping check, this logic is modified so that it
makes more sense: if a monster is immobilized at all (sleeping, frozen,
or mcanmove = 0) it always "doesn't seem to move!" You can't randomly
displace it anyway 1/6 of the time.

Sessile monsters who are otherwise not immobilized don't move 5/6 of the
time, but can be displaced with the other 1/6.

5 years agoPet displacement improvements
copperwater [Tue, 20 Mar 2018 16:17:38 +0000 (12:17 -0400)]
Pet displacement improvements

Pets can no longer be displaced out of a trap, because that was
inconsistent with peaceful monsters refusing to be displaced out of a
trap. The untaming-via-displacement-out-of-trap code is removed.

Pets also now have a better survival instinct: they follow the code for
peaceful displacement into a bad position, and refuse to swap places.
This means it's no longer possible to accidentally kill a pet by
levitating/walking over water and displacing it.

5 years agoShopkeepers are immune to peaceful displacement as well
copperwater [Mon, 12 Mar 2018 19:57:25 +0000 (15:57 -0400)]
Shopkeepers are immune to peaceful displacement as well

5 years agoFix: rn2(0) when trying to displace peaceful out of trap
copperwater [Mon, 12 Mar 2018 02:20:32 +0000 (22:20 -0400)]
Fix: rn2(0) when trying to displace peaceful out of trap

A side effect of making is_safepet() count peacefuls. Now checks
directly for a trapped, peaceful monster and says "they can't move out
of the trap"; this is inconsistent with pet behavior, and pet behavior
should probably be changed to be in line with it (ie they can't be
displaced out of a trap at all.)

Also refactor the code here a bit: a bunch of different if statements
have the exact same resetting code and steed resetting code in them.
Change this to a boolean flag and put the resetting code in one place
checked by that flag.

5 years agoMore peaceful monsters that can't be displaced: priests, Oracle
copperwater [Sat, 24 Feb 2018 04:02:29 +0000 (23:02 -0500)]
More peaceful monsters that can't be displaced: priests, Oracle

Shouldn't be able to displace priests since that could theoretically
eventually force them out of their temple, which would probably cause
problems. The Oracle doesn't usually move anyway, but seems like she
should "not want to swap places" in any circumstance.

5 years agoPlayer can now displace peaceful monsters
copperwater [Fri, 8 Dec 2017 04:26:17 +0000 (23:26 -0500)]
Player can now displace peaceful monsters

Changes domove() code to allow displacing peaceful monsters.
Specifically, is_safepet() now returns true if the monster is peaceful.
Peacefuls are slightly pickier than pets about whether they consent to
being displaced: they will not displace if a goodpos() check fails for
the displaced space, or if there is a trap on the displaced space, or if
they are your quest leader. is_safepet should probably be renamed to
something else.

In the process of doing this, some other changes were made: the code now
checks whether the player and monster should be swapping places at all
first (previously it ran some code for displacing pets out of traps
first, which was a little weird if the displacement didn't actually
happen.)

In the original commit for this, I needed to guard the spoteffects()
call made in domove with a clause testing whether the player actually
moved; it was previously possible to fail to displace a monster and then
re-trigger a trap on the space you were still standing on. However, the
devteam has apparently put in an if (u.umoved) clause in the same place
and serving the same purpose.

5 years agoFix "x" and "a" when choosing map location
Pasi Kallinen [Wed, 15 Apr 2020 04:15:37 +0000 (07:15 +0300)]
Fix "x" and "a" when choosing map location

Recent(ish) change to split unexplored glyphs from solid wall glyphs
resulted in getloc commands to choose unexplored and interesting
locations not work correctly.

Fixes #323

5 years agoAllow specifying a montype on figurines in lua files
copperwater [Wed, 15 Apr 2020 02:30:20 +0000 (22:30 -0400)]
Allow specifying a montype on figurines in lua files

This was already allowed for the other montype-compatible objects like
statues, corpses, eggs and tins. I don't see a reason why figurines
shouldn't be part of this group; perhaps it was an oversight.

5 years agounclutter mattacku a bit
PatR [Wed, 15 Apr 2020 01:13:32 +0000 (18:13 -0700)]
unclutter mattacku a bit

Move demon summoning and were creature summoning out of mattacku()
to a separate routine.  Should be no change in behavior.

Also, redo several comments that came after what they applied to
rather than before, and reorder the file-scope prototypes to be in
the same order as the corresponding functions.

5 years agoMake hostile monsters with launcher and ammo keep away
Pasi Kallinen [Tue, 14 Apr 2020 12:19:26 +0000 (15:19 +0300)]
Make hostile monsters with launcher and ammo keep away

If a hostile monster is wielding a ranged weapon, and is carrying
appropriate ammo for it, make the monster try to stay away,
outside the melee range.

5 years agoDocument the map characters used in lua
Pasi Kallinen [Tue, 14 Apr 2020 08:43:32 +0000 (11:43 +0300)]
Document the map characters used in lua

5 years agorest/search refinement
PatR [Mon, 13 Apr 2020 21:58:12 +0000 (14:58 -0700)]
rest/search refinement

When rest and search refuse to operate because a hostile monster is
adjacent, include a reminder of how to force them to operate.  Every
time if 'cmdassist' is On, or just once until after some subsequent
try actually does something.

This new rest and search behavior probably needs to be optional and
default to the old behavior.  It isn't uncommon to deliberately rest
while adjacent to a hostile monster if also adjacent to a peaceful
one and trying to wait for Stun or Confusion to time out, or maybe
search while next to such a monster hoping to find a secret door to
run away through.  A count prefix won't work and needing an extra
keystroke each time is going to be an annoyance.

5 years agofix #K797 - wrong message when stealing as nymph
PatR [Mon, 13 Apr 2020 19:58:54 +0000 (12:58 -0700)]
fix #K797 - wrong message when stealing as nymph

When polymorphed into a nymph and melee hit steals items from the
target, the same-gender charm message vs opposite-gender seduce
message is being chosen by hero's base gender rather than nymphs
always being female.  The seduce message used dynamic pronouns for
the target monster but the charm message used hardcoded She and her
for female nymph attacking female target.  I'm not sure why hero's
base gender is used so left that alone; this changes charm message
to use dynamic pronouns that correctly match the target monster.

5 years agoScatter bag of holding contents instead of deleting them
Pasi Kallinen [Mon, 13 Apr 2020 18:49:16 +0000 (21:49 +0300)]
Scatter bag of holding contents instead of deleting them

Losing all of your items in one go is really frustrating.
If you blow up your bag of holding, make the contents scatter around
instead of outright deleting them. This will destroy fragile objects.

5 years agoAdd test for selection.iterate
Pasi Kallinen [Mon, 13 Apr 2020 17:29:06 +0000 (20:29 +0300)]
Add test for selection.iterate

5 years agoAllow matching any wall map terrain in lua scripts
Pasi Kallinen [Mon, 13 Apr 2020 16:59:03 +0000 (19:59 +0300)]
Allow matching any wall map terrain in lua scripts

When matching a terrain, allow using a "w" placeholder that matches
any solid wall:

For example:
   local s = selection.match([[w.w]]);
would match all floor locations with a wall to the left and right of it.
The walls can be solid stone, horizontal, vertical, etc.

This applies to selection.match(), selection.filter_mapchar(), and
des.replace_terrain()

5 years agoTrapped container creates occasionally an actual gas cloud
Pasi Kallinen [Mon, 13 Apr 2020 10:08:36 +0000 (13:08 +0300)]
Trapped container creates occasionally an actual gas cloud

5 years agoIn-game doc the extended commands accepting 'm' prefix
Pasi Kallinen [Mon, 13 Apr 2020 08:10:40 +0000 (11:10 +0300)]
In-game doc the extended commands accepting 'm' prefix

5 years agoAllow random mimics to mimic more furniture
Pasi Kallinen [Sun, 12 Apr 2020 19:06:42 +0000 (22:06 +0300)]
Allow random mimics to mimic more furniture

In addition to stairs, allow altar, grave, throne, and sink.

5 years agoThis is cron-daily v1-Jan-20-2020. guidebook updated: doc/Guidebook.txt
nhw_cron [Sun, 12 Apr 2020 15:24:08 +0000 (11:24 -0400)]
This is cron-daily v1-Jan-20-2020.  guidebook updated: doc/Guidebook.txt

5 years agoPrevent searching or waiting next to a hostile
Pasi Kallinen [Sun, 12 Apr 2020 14:21:23 +0000 (17:21 +0300)]
Prevent searching or waiting next to a hostile

Generally speaking there's no reason to wait or search next to
a hostile monster, so let's just prevent those actions. You can
still do those commands by prefixing them with the 'm' prefix.

5 years agoFix double free
Pasi Kallinen [Sun, 12 Apr 2020 13:55:00 +0000 (16:55 +0300)]
Fix double free

5 years agoRemove incorrect comment
Pasi Kallinen [Sun, 12 Apr 2020 12:45:13 +0000 (15:45 +0300)]
Remove incorrect comment

5 years agoMerge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into...
nhmall [Sat, 11 Apr 2020 21:55:09 +0000 (17:55 -0400)]
Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7

5 years agoprototype for optfn_palette
nhmall [Sat, 11 Apr 2020 21:54:24 +0000 (17:54 -0400)]
prototype for optfn_palette

5 years agorefinement of monster use of undead turning
PatR [Sat, 11 Apr 2020 19:34:32 +0000 (12:34 -0700)]
refinement of monster use of undead turning

Instead of just picking up wands of undead turning when one or more
corpses are in hero's inventory, have monsters also pick those up if
hero has a cockatrice corpse in a carried container.  And instead of
only zapping such wands (as defensive measure) when hero is wielding
a cockatrice corpse, also zap them (as offensive measure) if hero is
carrying any corpse in open inventory.

5 years agocorpse revival nitpicks
PatR [Sat, 11 Apr 2020 19:24:02 +0000 (12:24 -0700)]
corpse revival nitpicks

Testing a forthcoming extension of monsters using wands of undead
turning revealed a couple of pre-existing bugs.  Previously only
noticeable if hero zaps self or breaks a wand of undead turning so
unlikely to have happened much.

"Your <mon> corpse comes alive" was given even if it was revived
as an undead.  Also, it was "your <mon> corpse" instead of "one of
your <mon> corpses" even when one from a stack was involved.  If
done by hero to self that message follows "one of your <mon>
corpses glows iridescently" so the comes alive message was ok but
verbose.  Change that to "it comes alive" or "it reanimates" when
following the glow message.

5 years agotypo fix in .travis.yml
nhmall [Sat, 11 Apr 2020 14:25:47 +0000 (10:25 -0400)]
typo fix in .travis.yml

5 years agomingw build bit
nhmall [Sat, 11 Apr 2020 14:14:05 +0000 (10:14 -0400)]
mingw build bit

5 years agolet monsters use wand of undead turning
PatR [Sat, 11 Apr 2020 01:39:46 +0000 (18:39 -0700)]
let monsters use wand of undead turning

when hero is wielding a cockatrice corpse.  Wands of undead turning
aren't generated as starting equipment but they will now be picked
up if come across while the hero is carrying any corpse, and used
in preference to any other item when carried and non-empty and hero
is wielding a petrifier's corpse.

5 years agom_lined_up() type mismatch
PatR [Sat, 11 Apr 2020 01:09:58 +0000 (18:09 -0700)]
m_lined_up() type mismatch

m_lined_up() was declared 'boolean' but returned 0, 1, or 2.
The 1 case isn't actually used any more.  I changed it to 'int'
rather than 2 to TRUE; it could just as easily be the other way
'round.

5 years agoXcode warning of possible uninitialized variables
nhmall [Fri, 10 Apr 2020 04:29:51 +0000 (00:29 -0400)]
Xcode warning of possible uninitialized variables

5 years agofix gibhub issue #320 and more - 'mention_decor'
PatR [Thu, 9 Apr 2020 01:33:55 +0000 (18:33 -0700)]
fix gibhub issue #320 and more - 'mention_decor'

Fixes #320

Avoid giving "you are back on the bottom" nearly every step when
moving around underwater.

Avoid "you are back on floor" followed by "you trip over <object>"
when fumbling in case that fumbling was due to being on ice when
taking the step to floor.  Done for all fumbling rather than just
one-turn fumbling instigated by ice.

When moving from ice or water to ground, show "you are back on floor"
before listing objects at that spot instead of after.

I think there was at least one more thing but have lost track.  At
any rate, 'mention_rate' potentially has a new set of bugs.

5 years agoteleport message sequencing
PatR [Wed, 8 Apr 2020 22:17:02 +0000 (15:17 -0700)]
teleport message sequencing

"You materialize at another location," was delivered while the
previous location still controlled line of sight.  Very noticeable
if you started from underwater and landed on the surface in an area
which hadn't been mapped yet.

5 years agonull pointer crash fix
PatR [Wed, 8 Apr 2020 21:53:06 +0000 (14:53 -0700)]
null pointer crash fix

The fix to try to avoid messages about out-of-view objects taking
erosion damage made water_damage_chain() vulnerable to dereferencing
a null pointer, leading to a crash if you create a pool via wizard
mode wishing.

5 years agofix github issue #321 - 'Mine Town' vs 'Minetown'
PatR [Wed, 8 Apr 2020 19:52:20 +0000 (12:52 -0700)]
fix github issue #321 - 'Mine Town' vs 'Minetown'

Change achievement spelling to match T-shirt spelling:  Minetown.

Fixes #321

5 years agoAdd missing prototype
Pasi Kallinen [Wed, 8 Apr 2020 05:21:03 +0000 (08:21 +0300)]
Add missing prototype

5 years agofix #K763 - segfault eating tin of Rider meat
PatR [Tue, 7 Apr 2020 23:55:07 +0000 (16:55 -0700)]
fix #K763 - segfault eating tin of Rider meat

Eating a tin of one of the Riders and being life-saved or declining
to die would crash when trying to revive a non-existent corpse.  An
old comment stated that since such tins were impossible it could
assume that it was dealing with a corpse, but wishing for tins of
the Riders is possible in wizard mode.

They can't be passed along to normal mode via bones because they're
changed to empty tins as bones are saved.  So there doesn't seem to
be much point in allowing wizard mode wishing to create them, but
I've left that as is.

5 years agowater_damage() band-aid
PatR [Tue, 7 Apr 2020 18:54:52 +0000 (11:54 -0700)]
water_damage() band-aid

I got "The chain mail rusts." seemingly out of the blue, then when
moving around the corner of the building on Valk home level I saw a
spot of remembered ice be redrawn as water.  Before that I checked
for any mapped objects (via ';' 'o' 'o' ... so I didn't overlook
anything; there were only a couple of objects shown on the map and
none of them were piles) and didn't see any remembered chail mail or
anything at all on that ice spot, so I'm assuming that it was carried
by a monster.  I may be leaving out some steps in the call chain here:

melt_ice -> minliquid -> mondead -> m_detach -> relobj -> mdrop_obj
  -> flooreffects -> water_damage -> erode_obj

erode_obj() uses bhitpos for visibility check of eroding objects not
carried by the hero or by a monster, with a comment expressing doubt
about doing that.  It wouldn't have yielded the right answer for the
possible call chain here unless it got set by some monster activity.
I had been zapping a wand just before and bhitpos would have been set
to a coordinate I could see at the time, fooling erode_obj()'s check
if the value was stale.

Anyway, this only addresses objects eroded from flooreffects(),
water_damage_chain(), and fire_damage_chain().  There are lots of
other indirect calls to erode_obj().

5 years agoExpose scaled mazes to special level lua
Pasi Kallinen [Tue, 7 Apr 2020 16:20:19 +0000 (19:20 +0300)]
Expose scaled mazes to special level lua

Adds a new level init type which directly creates a maze,
optionally setting corridor width and wall thickness,
and removing dead ends.

des.level_init({ style = "maze", corrwid = 3, wallthick = 1, deadends = false });

5 years agoadd missing two-weapon feedback
PatR [Tue, 7 Apr 2020 14:40:33 +0000 (07:40 -0700)]
add missing two-weapon feedback

When dual-wielding and you wield a different weapon, two weapon combat
was silently toggled off even when the new weapon was eligible to be
dual-wielded.  If the verbose flag is On, explicitly tell the player
when wielding something toggles off two-weapon mode.  Wielding '-' is
an exception because you already get told that you're empty handed.

5 years agoFix monster booted into limbo trying to act
Pasi Kallinen [Tue, 7 Apr 2020 14:23:18 +0000 (17:23 +0300)]
Fix monster booted into limbo trying to act

There's a chance that a tactics-using monster (eg. arch-lich)
teleporting next to you on a full level would get booted off
into limbo. After that, if the monster tried using an item
in the same action you'd get panic "relmon: mon not in list"

Fix this particular case by checking monster mstate.
Other cases may lurk in other places that eventually call mnexto.

5 years agotype mismatch in weapon_insight
PatR [Tue, 7 Apr 2020 13:45:53 +0000 (06:45 -0700)]
type mismatch in weapon_insight

can_advance() returns boolean rather than int. Change the affected
local variables to match rather than casting its return value.

5 years ago^X vs two-weapon
PatR [Tue, 7 Apr 2020 13:17:35 +0000 (06:17 -0700)]
^X vs two-weapon

When dual-wielding and both weapons use the same skill, the weapon
feedback by ^X was inadvertently skipping the part where it would
tell the player whether either the weapons' skill or two-weapon
skill or both had already been trained enough to to be advanced.

Most of the diff is change in indentation.

5 years agoX11 - ice on black&white text map
PatR [Mon, 6 Apr 2020 21:15:36 +0000 (14:15 -0700)]
X11 - ice on black&white text map

Add support for black&white ice (3.7.0 feature) similar to already
supported black&white lava:  show in inverse video if it uses the
same character as floor (in the ice case; as water in the lava case).

Inverse for monster detection, black&white lava, and now black&white
ice was being done unconditionally but has been changed so that the
user can disable it by toggling the 'use_inverse' run-time option.

[Bug noticed in the process:  if you move an inverse video cursor
onto inverse video detected monster/lava/ice (when doing farlook, for
instance), the cursor disappears.  I'm not sure how to address that.]

5 years agoX11 map - no more column 0
PatR [Mon, 6 Apr 2020 20:55:48 +0000 (13:55 -0700)]
X11 map - no more column 0

The extra column that the core sometimes uses for bookkeeping and
that was drawn as stone until recently when changed to blank space
(an unintentional left margin) is now gone for both the tiles map
and the text map.  It's still part of the internal data but the map
window width and the map rendering exclude it.

This was too easy.  There are bound to be bugs lurking....

5 years agoX11 map init
PatR [Mon, 6 Apr 2020 19:43:18 +0000 (12:43 -0700)]
X11 map init

Revert the change from impossible() to panic() that I made recently
and add code to allow continuing to succeed.  The raw_print issued
there doesn't seem to go anywhere, but the game switches from tiles
map to text map and runs sanely.

Also, there was a second place that initialized the text map to all
spaces rather than S_unexplored.  Change it to call the routine that
was already fixed for this.

5 years agoConvert math.random percentage computations into percent()
copperwater [Sat, 29 Feb 2020 22:04:26 +0000 (17:04 -0500)]
Convert math.random percentage computations into percent()

5 years agoImplement dice and percent as global lua functions
copperwater [Sat, 29 Feb 2020 02:19:50 +0000 (21:19 -0500)]
Implement dice and percent as global lua functions

Intended to simplify many of the math.random calls currently in use, and
make them more semantic and thus more readable.

The dice function d() takes either a two-argument form which is the same
as in the C source (number of dice, faces per die) or a one-argument
form that rolls a single die.

The percent(N) function returns true N% of the time.

5 years agoAdd selection gradient doc placeholder
Pasi Kallinen [Mon, 6 Apr 2020 16:03:28 +0000 (19:03 +0300)]
Add selection gradient doc placeholder

5 years agoRe-implement gradient selections
copperwater [Sat, 29 Feb 2020 16:06:30 +0000 (11:06 -0500)]
Re-implement gradient selections

Uncomments and makes available selection.gradient in Lua. (The backend C
code for this still existed, it just wasn't used.)

The only valid way to specify a gradient is with a table. I considered
adding non-table versions, but decided that there are too many
independent variables that can be optional. A non-table version, without
named parameters, would be confusing to read, especially since most of
the arguments are ints.

Also adds an impossible in the (possibly unreachable) case that
selection_do_gradient gets called with a bad gradient type.

5 years agoPrint out Lua error message when encountering an error
copperwater [Sun, 1 Mar 2020 20:20:16 +0000 (15:20 -0500)]
Print out Lua error message when encountering an error

Rather than spitting out an error code number that is not particularly
useful. The string contains the line number and the nature of the error,
which is much more useful for debugging or reporting an issue.

5 years agofix segfault fix
PatR [Mon, 6 Apr 2020 15:24:39 +0000 (08:24 -0700)]
fix segfault fix

Previous fix prevented getting skill feedback about bare-handed
combat/martial arts.

5 years agoFix one more prototype warning
Pasi Kallinen [Mon, 6 Apr 2020 15:24:15 +0000 (18:24 +0300)]
Fix one more prototype warning

5 years agoPrevent segfault when not wielding anything
Pasi Kallinen [Mon, 6 Apr 2020 15:09:47 +0000 (18:09 +0300)]
Prevent segfault when not wielding anything

5 years ago^X weapon feedback
PatR [Mon, 6 Apr 2020 13:25:17 +0000 (06:25 -0700)]
^X weapon feedback

Report weapon skill in the ^X status section when dual-wielding,
The effective skill level is the lower of the weapon's skill and
two-weapon skill, separately for primary and secondary.  It's a
much bigger chunk of code than most enlightenment/^X features so
I put it in its own routine.

5 years agodual-wielding tweaks
PatR [Mon, 6 Apr 2020 13:12:25 +0000 (06:12 -0700)]
dual-wielding tweaks

Reject arrows and darts as candidates for wielding two weapons at
once.

Make the check for being able to two-weapon when polymorphed be more
robust.  Instead of just testing whether the monster form's second
atttack is a weapon attack and then assuming that the first one is
too, test the first three to validate that at least two of those are
AT_WEAP.  The existing code works but seemed fragile.

5 years agoAnd some more warning fixes
Pasi Kallinen [Mon, 6 Apr 2020 12:41:26 +0000 (15:41 +0300)]
And some more warning fixes

5 years agoFix even more warnings
Pasi Kallinen [Mon, 6 Apr 2020 08:54:30 +0000 (11:54 +0300)]
Fix even more warnings

5 years agoFix more warnings
Pasi Kallinen [Mon, 6 Apr 2020 07:25:17 +0000 (10:25 +0300)]
Fix more warnings

5 years ago'A' tweak
PatR [Sun, 5 Apr 2020 22:32:00 +0000 (15:32 -0700)]
'A' tweak

Get rid of a couple of unnecessary calls to set_twoweap() to clear
u.twoweap when using 'A' to 'take off' either weapon.  setuwep() and
setuswapwep() don't do that, but they call setworn() which does.

Make the feedback when disarming with 'A' be more specific when you
are two-weaponing at the time either weapon is unwielded.