]> granicus.if.org Git - nethack/log
nethack
5 years agoimplement #986 - camera flash 'tweak'
PatR [Sat, 9 May 2020 20:07:35 +0000 (13:07 -0700)]
implement #986 - camera flash 'tweak'

Implement the suggested feature that a camera's flash actually update
hero's memory of the map as it traverses across the level.  Turned
out to be more work than anticipated despite having the code for a
thrown or kicked lit candle or lamp to build upon.

Among other things it needed to update the circle code to handle
previously unused radius 0 to operate on the center point only.  I've
never touched that before and hope this hasn't introduced any bugs.

Also removes several instances of vision code operating on column #0.
(At least one is still present.)

5 years agoextern.h obsolete bit
nhmall [Wed, 6 May 2020 21:03:06 +0000 (17:03 -0400)]
extern.h obsolete bit

5 years agoextern.h updates to reflect drawing.c split
nhmall [Wed, 6 May 2020 20:40:24 +0000 (16:40 -0400)]
extern.h updates to reflect drawing.c split

5 years agosys/winnt/Makefile.gcc updates for new file (mingw)
nhmall [Wed, 6 May 2020 20:24:03 +0000 (16:24 -0400)]
sys/winnt/Makefile.gcc updates for new file (mingw)

5 years agoremove obsolete global variable declaration
nhmall [Wed, 6 May 2020 16:44:12 +0000 (12:44 -0400)]
remove obsolete global variable declaration

5 years agoXcode fixes
nhmall [Wed, 6 May 2020 15:35:55 +0000 (11:35 -0400)]
Xcode fixes

5 years agofrom cron-daily
nhmall [Wed, 6 May 2020 15:30:45 +0000 (11:30 -0400)]
from cron-daily

5 years agomove some text strings from drawing.c over to the file that uses them
nhmall [Wed, 6 May 2020 15:15:25 +0000 (11:15 -0400)]
move some text strings from drawing.c over to the file that uses them

5 years agosplit symbols bits from drawing.c; new file src/symbols.c
nhmall [Wed, 6 May 2020 14:55:54 +0000 (10:55 -0400)]
split symbols bits from drawing.c; new file src/symbols.c

5 years agomove lua context out of dungeons[]
PatR [Wed, 6 May 2020 01:06:00 +0000 (18:06 -0700)]
move lua context out of dungeons[]

and out of save files so restore doesn't need to clear stale data.
Behavior should be the same as before, except that when entering
the endgame branch and discarding the main dungeon and its other
branches, lua theme context is now discarded for those too.

5 years agoextern.h bits
PatR [Tue, 5 May 2020 19:39:24 +0000 (12:39 -0700)]
extern.h bits

Clean up a few things I recently noticed:
  obsolete monstr.c was still present;
  mdlib.c was out of alphabetical order;
  monst_global_init() was listed under the wrong file.

5 years agomore CROSSCOMPILE fixes
nhmall [Tue, 5 May 2020 18:04:29 +0000 (14:04 -0400)]
more CROSSCOMPILE fixes

5 years agotrack eight more achievements
PatR [Mon, 4 May 2020 23:35:40 +0000 (16:35 -0700)]
track eight more achievements

Record reaching experience level 3, 6, 10, 14, 18, 22, 26, and 30,
the levels where the character gets a new rank title, and report
those as achievements at end of game.  These achievements persist
even if enough levels to lose a rank are lost, and if lost ranks
are regained the original achievement is the one that gets tracked
and disclosed.

5 years agodisplacer beast as food
PatR [Mon, 4 May 2020 16:50:11 +0000 (09:50 -0700)]
displacer beast as food

Make eating a displacer beast corpse or a tin of displacer beast
meat confer temporary Displacement lasting 6d6 turns.

5 years agomakemon and goodpos flags
PatR [Mon, 4 May 2020 16:19:37 +0000 (09:19 -0700)]
makemon and goodpos flags

I added another goodpos flag to simplify handling displacer beast
and that pushed the total number of makemon and goodpos flags past
16.  'int' and 'unsigned' might be too small, so change the flags
and several function arguments to 'long'.

5 years agodirectory correction bit in Cross-compiling doc
nhmall [Mon, 4 May 2020 13:16:33 +0000 (09:16 -0400)]
directory correction bit in Cross-compiling doc

panic.c is in util

5 years agochange is_safepet macro name
nhmall [Mon, 4 May 2020 01:52:41 +0000 (21:52 -0400)]
change is_safepet macro name

Leaving the word "pet" in the macro name, when it applied to non-pets
seemed too contradictory, even for NetHack.

5 years agoyet another host-side crosscompile fix
nhmall [Mon, 4 May 2020 01:22:55 +0000 (21:22 -0400)]
yet another host-side crosscompile fix

The host build portion using sys/msdos/Makefile1.cross) was failing because it
was attempting to compile the generated tile.o which is using hack.h.

gcc  -o../util/tilemap host_o/tilemap.o
A new ../src/tile.c has been created
gcc -c -O -I../include -I../sys/msdos -DDLB  -DUSE_TILES -DCROSSCOMPILE -DCROSSCOMPILE_HOST -ohost_o/tile.o ../src/tile.c
In file included from ../include/hack.h:201:0,
                 from ../src/tile.c:3:
../include/dungeon.h:70:5: error: unknown type name ‘lua_State’
     lua_State *themelua;   /* themerms compiled lua */
     ^
../sys/msdos/Makefile1.cross:286: recipe for target 'host_o/tile.o' failed
make: *** [host_o/tile.o] Error 1

I don't think think the tile.o is required on the host build build portion,
so it is probably an error in the Makefile. Try removing it.

5 years agoamulet tiles
PatR [Sun, 3 May 2020 23:34:54 +0000 (16:34 -0700)]
amulet tiles

Replace the octagonal amulet placeholder for the two new tiles.
Give the "cubical amulet" a hint of being cube shaped and rename
"pentagonal amulet" to "perforated amulet" because it's easier to
draw that way.

Bump EDITLEVEL now for the extra objects and monsters because I
forgot to do so earlier.

5 years agotwo new monsters from slash'em
PatR [Sun, 3 May 2020 21:13:08 +0000 (14:13 -0700)]
two new monsters from slash'em

Adds two monsters originally from slash'em.  I used the slash'em
tiles this time, also its code as a starting point but made various
revisions.  Both the tiles could benefit from some touch-ups.

displacer beast:  blue 'f'.  Attempting a melee hit (ie, trying to
  move to its spot) has a 50:50 chance for it to swap places with you.
  Fairly tough monster to begin with, then half your ordinary attacks
  effectively miss and if you try to face a mob by retreating to a
  corridor or backing into a corner you can end up being drawn back
  into the open.  I added bargethrough capability, and also it won't
  be fooled about hero's location by Displacement.  [It only swaps
  places during combat when contact is initiated by the hero, not
  when attacked by another monster or when attacking.]

genetic engineer:  green 'Q'.  Its attack causes the target to be
  polymorphed unless that target resists.  Hero will almost always
  have magic resistance by the time this monster is encountered, but
  it can make conflict become risky by hitting and polymorphing other
  monsters.  Slash'em flagged it hell-only but I took that flag off;
  I also took away its ability to teleport.  Slash'em polymorphs the
  hero if a genetic engineer corpse is eaten; that's included and I
  introduced that for monsters too.

I added both of these to the list of candidates for monster spell
'summon nasties' and for post-Wizard harassment.

I also gave all the 'f's infravision.  Probably only matters if the
hero polymorphs into a feline.

Displacer beast is originally from AD&D which depicts it as a six-
legged cougar with a pair of tentacles; it has Displacement rather
be able to affect an attacker's location.  I think genetic engineer
is original to slash'em where it expands Q class but seems mainly to
be the base monster for Dr.Frankenstein (a unique monster with a
one-level side-branch lair in slash'em's incarnation of Gehennom).

5 years agowin/share/safeproc.c
PatR [Sun, 3 May 2020 19:40:10 +0000 (12:40 -0700)]
win/share/safeproc.c

5 years agonew amulet tiles
PatR [Sun, 3 May 2020 19:25:52 +0000 (12:25 -0700)]
new amulet tiles

The lines intended as comments which weren't treated as comments
were the problem with the revised tiles.  Taking them out fixes the
"psychedelic" tiles map for X11.

The two new amulets still need their own distinct artwork.  Probably
at least one could be 'borrowed' from the slash'em sources although
it wouldn't match either of the new descriptions (assuming any of
them do; their too tiny for me to see well enough to tell).

5 years agoeliminate hack.h usage from win/share/*.c
PatR [Sun, 3 May 2020 17:52:54 +0000 (10:52 -0700)]
eliminate hack.h usage from win/share/*.c

Switch win/share/*.c from hack.h to config.h plus miscellaenous
other headers.  It's possible that there is conditional code that
didn't get exercised in my testing.  The Unix Makefiles don't deal
with safeproc.c or tileset.c so I just compiled those without any
attempt to link.

5 years agomakedefs vs dungeon.h
PatR [Sat, 2 May 2020 23:50:50 +0000 (16:50 -0700)]
makedefs vs dungeon.h

This works for me.  It might be better to move d_level into its
own header and include that instead including dungeon.h.

5 years agoRevert "build fix for platforms that have no LUA awareness during makedefs compile"
nhmall [Sat, 2 May 2020 21:17:40 +0000 (17:17 -0400)]
Revert "build fix for platforms that have no LUA awareness during makedefs compile"

This reverts commit eb704832a91423b5fa13b56efebe2db452f0afbc.

That fix was insufficient.

The addition of
    lua_State *themelua;
to the dungeon struct in dungeon.h prevents the build of host-side utilities that
include "hack.h" via the CROSSCOMPILER_HOST. Unfortunately, it is no longer possible
to cross-compile NetHack 3.7. That includes the cross-compiled MSDOS build.

5 years agoadd two new types of amulet: flying and guarding
PatR [Sat, 2 May 2020 09:07:33 +0000 (02:07 -0700)]
add two new types of amulet: flying and guarding

We haven't added any new objects or monsters in a really long time.
This adds two new useful amulets, putting more pressure on the
decision over which type of amulet to wear.

amulet of flying:  idea from slash'em, implemented from scratch.
  Should be self-explanatory.  Polymorphing into a form capable of
  eating amulets and then eating one does not confer intrinsic
  flight.  (I've no idea how slash'em behaves is in that regard.)

amulet of guarding:  adds +2 AC, which is fairly negligible, also
  +2 MC, which is not.  Initially called amulet of protection but MC
  of 2 is referred to as 'guarded' by enlightenment so I changed it.
  (By that reasoning, rings of protection ought to be called rings of
  warding; oh, well.)  Successfully eating one confers +2 AC without
  any MC benefit.  When wearing one of these, rings of protection
  only confer AC, their +1 MC gets superseded rather than combined.

Monsters will wear an amulet of guarding and gain both the AC and
MC benefit, but if not cursed and they acquire one of life-saving or
reflection, they'll swap.  They won't wear an amulet of flying.

I cloned two extra copies of the tile for one of the existing amulets
and ran sys/share/objects.txt through renumtiles.pl.  The result
appears to be ok but on X11 the tiles map ends up looking psychedelic
so something beyond the tile art itself needs to be fixed here.

5 years agobuild fix for platforms that have no LUA awareness during makedefs compile
nhmall [Sat, 2 May 2020 00:36:11 +0000 (20:36 -0400)]
build fix for platforms that have no LUA awareness during makedefs compile

gcc -c -O -I../include -I../sys/msdos -DDLB  -DUSE_TILES -DCROSSCOMPILE -DCROSSCOMPILE_HOST -ohost_o/makedefs.o ../util/makedefs.c
In file included from ../util/makedefs.c:18:0:
../include/dungeon.h:68:5: error: unknown type name ‘lua_State’
     lua_State *themelua;   /* themerms compiled lua */
     ^

5 years agoDouble Trouble trouble
PatR [Fri, 1 May 2020 19:12:47 +0000 (12:12 -0700)]
Double Trouble trouble

From the newsgroup:  if cloned Wizard arrives out of view of the
hero (and vice versa), it will sit and wait until hero moves into
his view or until suffering some damage (usually via pet).  So if a
mob causes the clone to arrive on the far side of a wall, he might
not come into play until the hero goes to another level and some
future harassment action pulls him off the migrating monsters list.
Treat clones like the resurrected Wizard:  don't start out waiting.

5 years agoliquid_flow when digging pit
PatR [Fri, 1 May 2020 07:42:18 +0000 (00:42 -0700)]
liquid_flow when digging pit

Part of github issue #338 that isn't about shops:  objects at the
spot where a dug pit fills with lava (or water) weren't being
effected by that.

While fixing it, I noticed that hero's steed wasn't affected either.
Also, when conjoined pits are filled in, monsters other than the
steed are at risk but weren't being handled.  Presumably they fell
in on their next move.

5 years agomonster eating (2 of 2)
PatR [Wed, 29 Apr 2020 20:24:31 +0000 (13:24 -0700)]
monster eating (2 of 2)

Some instances of monsters eating nurse corpses or tins of nurse
caused blindness to be cured, others didn't.  Always do that to
match the effect on the hero.

Also, fix a couple more obsolete references to green slime corpses.

5 years agomonster eating (1 of 2)
PatR [Wed, 29 Apr 2020 20:22:27 +0000 (13:22 -0700)]
monster eating (1 of 2)

Move the recently adopted swallower-eats-dropped-corpse code into
a separate routine to unclutter dropz().  Eat all corpses (also
globs and meatball/meat ring/meat stick/huge chunk of meat) rather
than just the few types which trigger special effects (polymorph,
turn to stone, etc).

Also guard against using a freed pointer if somehow a dropped edible
item merges with an existing inventory item (something carried prior
to shape change perhaps?) before having the worm eat it.

5 years agox64 64 bit pointers, 32 bit longs
nhmall [Wed, 29 Apr 2020 19:58:55 +0000 (15:58 -0400)]
x64 64 bit pointers, 32 bit longs

../src/sp_lev.c: In function 'flip_level':
../src/sp_lev.c:816:24: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
             long ty = ((long) timer->arg.a_void) & 0xffff;
                        ^
../src/sp_lev.c:817:25: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
             long tx = (((long) timer->arg.a_void) >> 16) & 0xffff;
                         ^
../src/sp_lev.c:823:33: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
             timer->arg.a_void = (genericptr_t) ((tx << 16) | ty);

5 years agofailure to hold another object when swallowed
PatR [Wed, 29 Apr 2020 19:43:54 +0000 (12:43 -0700)]
failure to hold another object when swallowed

If hold_another_object() decides that the object must be droped, drop
it into u.ustuck's minvent when swallowed instead of magically through
the engulfer direct to the floor.

5 years agoget rid of unused variable warnings in topten.c
nhmall [Wed, 29 Apr 2020 14:18:46 +0000 (10:18 -0400)]
get rid of unused variable warnings in topten.c

5 years agocomment tidbit
PatR [Tue, 28 Apr 2020 20:26:41 +0000 (13:26 -0700)]
comment tidbit

5 years agocomment typo
PatR [Mon, 27 Apr 2020 18:54:52 +0000 (11:54 -0700)]
comment typo

5 years agofix pull request #340 - untrap steed sanity
PatR [Mon, 27 Apr 2020 18:48:55 +0000 (11:48 -0700)]
fix pull request #340 - untrap steed sanity

When a failed #untrap attempt while mounted caused hero to be moved
onto the trap, it neglected to set the steed's coordinates to match.
If 'sanity_check' was On, that would trigger warnings about steed's
anomalous position.  Eventually a normal move would put steed's
coordinates back in sync with the hero's.

The pull request code set u.usteed->{mx,my} directly.  I've used
u_on_newpos() instead.  I also replaced some direct manipulations of
u.{ux,uy} with u_on_newpos() so that if clipping is in effect it will
be updated.

Fixes #340

5 years agoSting vs level teleport revisted
PatR [Mon, 27 Apr 2020 17:49:34 +0000 (10:49 -0700)]
Sting vs level teleport revisted

This reverses all of c67f1dd71044b7d0ec98a6e4645b1c20915467f0
except for the fixes37.0 entry and does a better job in a cleaner
fashion.  If Sting is going to start glowing and "you materialize
on a different level" is pending, give the materialize message
before the glowing message.  Otherwise handle both stop-glowing
and/or you-materialize in the normal fashion.

5 years agoSting vs level teleport's "materialize" message
PatR [Mon, 27 Apr 2020 12:09:19 +0000 (05:09 -0700)]
Sting vs level teleport's "materialize" message

When level teleporting, Sting/Orcrish/Grimtooth would start or stop
glowing based on occupants of the new level before "you materialize
on another level".  That wasn't necessarily incorrect for the glow
stopping but was clearly wrong for it starting.  This fix uses a flag
as a hack to avoid finding and changing all the calls to docrt() and
see_monsters().  It ought to be fixed properly....

5 years agofix issue #339 - duplicate feature messages
PatR [Mon, 27 Apr 2020 11:25:26 +0000 (04:25 -0700)]
fix issue #339 - duplicate feature messages

while 'mention_decor' is enabled.  When stepping onto different
terrain and one or more objects remained on the new spot after
autopickup, describe_decor() was issuing its new-terrain message
right before look_here()'s similar under-the-objects message.  If
autopickup grabbed everything or there weren't any objects to begin
with, look_here() doesn't issue any dfeature (terrain) message.
describe_decor() isn't smart enought to know whether that is going
to happen.  Give look_here() a new flag argument so that its caller
can ask for the dfeature message to be skipped for the case where a
similar message has already been given.

5 years agofix previous #332 fix
PatR [Sun, 26 Apr 2020 02:17:46 +0000 (19:17 -0700)]
fix previous #332 fix

Add missing visibility check.

5 years agofix issue #332 - mon vs mon double hit message
PatR [Sun, 26 Apr 2020 02:06:18 +0000 (19:06 -0700)]
fix issue #332 - mon vs mon double hit message

One monster hitting another with an artifact within the hero's view
gave "<Mon1> swings his <Artifact> at <Mon2>." followed either by
"<Mon1> misses <Mon2>." _or_ the two messages "<Mon1> hits <Mon2>."
and "The <Artifact> hits <Mon2>."  Defer the <Mon1> hits <Mon2> one
when Mon1 is using an artifact and only deliver it if there is no
artifact hit message.

Tested but not exhaustively so....

Fixes #332

5 years agoFixes entry
Pasi Kallinen [Sat, 25 Apr 2020 16:19:36 +0000 (19:19 +0300)]
Fixes entry

5 years agoCandle light radius is now square root, not logarithmic
copperwater [Mon, 6 Nov 2017 16:01:15 +0000 (11:01 -0500)]
Candle light radius is now square root, not logarithmic

After some discussion with Alex Smith, it seems like a good change for
both gameplay and realism that candles' light radius should decay
quadratically instead of exponentially. Now a light radius of 4 from
candles can be accomplished by burning 9 candles, and players who find a
lot of candles might even be able to get up to 5 (16 candles) or 6 (25
candles).

The main impetus for this change is that with the existing formula, the
more candles -> more light mechanic was more or less useless outside of
wizard mode, because you needed 49 candles to do better than a lamp.

5 years agoRecord amount of gold in hero's possession in xlogfile
Patric Mueller [Fri, 24 Apr 2020 21:53:25 +0000 (23:53 +0200)]
Record amount of gold in hero's possession in xlogfile

5 years agoExtended achievement and conduct fields for xlogfile
Patric Mueller [Fri, 24 Apr 2020 18:59:14 +0000 (20:59 +0200)]
Extended achievement and conduct fields for xlogfile

Introducing two new xlogfile fields "achieveX" and "conductX" which encode
achievements and conducts as a series of comma-separated strings which are
more easily parseable and also somewhat interpretable independent from knowing
the source code.

Example for a player that died shortly after picking up the luckstone from the
gnomisch mines:
achieveX=entered_the_gnomish_mines,entered_mine_town,entered_a_shop,entered_a_temple,obtained_the_luckstone_from_the_mines
conductX=polyless,polyselfless,wishless,artiwishless,genocideless

5 years agoobj->oextra->{omid,olong}
PatR [Fri, 24 Apr 2020 16:29:52 +0000 (09:29 -0700)]
obj->oextra->{omid,olong}

Change obj->oextra->omid from a usually-Null pointer field in
oextra to a simple 'unsigned' that doesn't need any allocation
beyond obj->oextra itself.  Value 0 means that it is not in use;
it is used to hold a monst.m_id and those are always non-zero.

Delete unused obj->oextra->olong.  'olong' used to be the last
field in struct obj, put there to force alignment of anything
which followed it back when obj structures were over-allocated to
append extra information.  It had a comment about being used for
temporary gold but whatever that was, temporary gold was gone long
before obj->oextra got introduced.

Bump EDITLEVEL since this invalidates existing 3.7 save files.

Remove a bunch of tabs from obj.h and save.c.

5 years agoX11 missing prototypes
PatR [Fri, 24 Apr 2020 09:40:22 +0000 (02:40 -0700)]
X11 missing prototypes

Add some prototypes and add a new include to a couple of files that
use config.h instead of hack.h.  So sys/unix/Makefile.src has been
changed slightly.

5 years agofix issue #333 - obsolete "green slime corpse"
PatR [Fri, 24 Apr 2020 00:31:21 +0000 (17:31 -0700)]
fix issue #333 - obsolete "green slime corpse"

Issue was for dropping glob of green slime while swallowed by a
purple worm but also applied to pet eating habits.  Green slime
corpse doesn't exist any more; check for glob instead.

Fixes #333

5 years agofix issue #319 - whip can fetch underwater items
PatR [Thu, 23 Apr 2020 23:54:51 +0000 (16:54 -0700)]
fix issue #319 - whip can fetch underwater items

Applying a bullwhip down while levitating or riding gives a chance
to pick up items from the unreachable floor.  Doing so over water
yields "you wrap your bullwhip around <item> on the water" when
that item is actually on the bottom.  Same for lava.  Don't fetch
items from beneath the surface.  Also, for the lava case subject
the whip to fire damage.

This has actually broken the seal on a can of worms.  Every item
at a water location sinks to the bottom even if it should float.
I'm not opening that can....

Fixes #319

5 years agofix issue #337 - crash on start with armhf arch
PatR [Thu, 23 Apr 2020 18:47:29 +0000 (11:47 -0700)]
fix issue #337 - crash on start with armhf arch

Fix "objects[0] class #1 not in order!" panic.  The new check to
make sure that the elements of objects[] were in ascending order
by object class uses a plain 'char' index so -1 to indicate 'no
previous value' didn't work on a system using unsigned chars.

Verfied by temporarily adding '-funsigned-char' to CFLAGS before
and after the revision.  Before: panic, after: no panic.

Fixes #337

5 years agocouple more missing prototypes
PatR [Wed, 22 Apr 2020 22:32:32 +0000 (15:32 -0700)]
couple more missing prototypes

5 years agooption fixes and missing prototypes
PatR [Wed, 22 Apr 2020 20:39:38 +0000 (13:39 -0700)]
option fixes and missing prototypes

I added -Wmissing-prototypes to my CFLAGS and got a bunch of warnings.
This fixes the core ones (there are more for X11 that I haven't looked
at yet).  While fixing these, I discovered a few option processing
issues:  the non-Amiga 'altmeta' should be settable while the game is
in progress (not sure about the Amiga variation so left that as-is),
'altmeta' and 'menucolor' are booleans so shouldn't have had optfn_XXX
functions; 'MACgraphics' and 'subkeyvalue' were conditionally defined
differently in options.c than in optlist.h.

5 years agoAllow nurses heal attack when wielding a non-weapon/weaptool
Patric Mueller [Wed, 22 Apr 2020 09:47:14 +0000 (11:47 +0200)]
Allow nurses heal attack when wielding a non-weapon/weaptool

This matches the nurses' hitting behavior with their chatting messages.

Chatting to them suggested that the heal attack would happen but the check in
mhitu.c was just for wielding anything.

This opens up the possibility of a YAFM in MS_NURSE when wielding something
that allos the heal attack to proceed.  But I couldn't come up with a good
one.

5 years agoswapping places with peaceful monster
PatR [Wed, 22 Apr 2020 09:51:45 +0000 (02:51 -0700)]
swapping places with peaceful monster

When swapping with a peaceful monster rather than a pet, say so.

5 years agocrystal ball followup
PatR [Wed, 22 Apr 2020 08:20:49 +0000 (01:20 -0700)]
crystal ball followup

tile2x11 didn't like the change to drawing.c.  Case-insensitive
string comparison wasn't strictly needed so switch to regular
strcmp().

5 years agocrystal ball enhancements
PatR [Wed, 22 Apr 2020 08:14:09 +0000 (01:14 -0700)]
crystal ball enhancements

Allow crystal ball to search for furniture (stairs and ladders,
altar, throne, sink, fountain) as well as for a class or objects
or of monsters or all traps.  Giving any of '<','>','_','\','#',
or '{' will find all of those rather than just the individual type
specified.  Because of the default character conflict, '_' can no
longer be used to find chains; looking for altars is more useful.

The chance of getting the cursed effect due to failing a saving
throw against intelligence when the ball isn't actually cursed has
been reduced.  If it is the hero's own quest artifact, it will
happen if rnd(8) is greater than Int, so Int of 8 or more will
never yield that effect.  Otherwise if it is blessed, rnd(16) is
used so 16 or better Int means it can't act like it is cursed.
When uncursed and not hero's quest artifact, the old rnd(20) > Int
test is still used.

Crystal balls now start with 3..7 charges rather than 1..5, and
blessed charging sets the amount to 7 charges rather than 6 and
also blesses the ball.  Recharing with uncursed scroll of charging
is slightly better (adds 1..2 charges instead of always just 1,
caps the amount at 7 rather than 5) and uncurses the ball.  Cursed
scroll strips off all charges even if the ball is blessed and also
curses the ball so is harsher than before.

Crystal balls now cancel to -1 instead of 0, like wands, and using
one effect will destroy it, like zapping cancelled wands.

Also a minor tweak to the initial charges for can of grease (5..25
instead of 1..25) and horn of plenty and bag of tricks (both now
3..20 instead of 1..20).

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.