Commit Graph

12543 Commits

Author SHA1 Message Date
PatR
80a61c6e67 curses message management
Switch from 'moves' to 'hero_seq' for tracking whether consecutive
messages were issued on the same move and for whether current move
is still same one after played has responded to --More-- with ESC.
2021-12-26 00:43:24 -08:00
PatR
5fbe1de2a7 hero_seq
'moves' is actually turns and there hasn't been any straightforward
way to track actual hero moves.  Add hero_seq for that.  It isn't a
counter but is distinct each time the hero makes a move.  I wanted
it for curses ^P support but so far use it for checking stethoscope
usage and for shopkeeper behavior when items in a shop are broken by
the hero.

Increment EDITLEVEL due to change in save file contents.
2021-12-26 00:16:55 -08:00
PatR
c4724fd271 dragon armor fix
Fix a segfault when polymorphed into a dragon and using ^X.

One inconsistency I've spotted that I hadn't noticed earlier:  if
you wear red dragon scales/mail you obtain infravision ability, but
if polymorph into a red dragon, you don't.
2021-12-25 14:31:33 -08:00
PatR
439b6b7779 dragon armor properties
Special abilities conferred by wearing dragon armor was implemented in
a somewhat half-assed fashion; extend it to 3/4-assed.  Abilities came
from wearing dragon armor but not from being poly'd into a dragon or
for monsters that were wearing dragon armor or actually were dragons.
This covers much of that.

There are umpteen calls of 'resists_foo(mon)' and some are now
'resists_foo(mon) || defended(mon, AD_FOO)' but the second part ought
to be incorporated into update_mon_intrinics() so that the extra
'|| defended()' doesn't have to be spread all over the place and the
ones being put in now could/should be removed.

While testing, I noticed that a monster wielding Fire Brand did not
resist being hit by a wand of fire.  This fixes that and should also
fix various comparable situations for other artifacts.  But so far it
has only been done for zapping (and any other actions which use the
zapping code).  Folding defended() checks into update_mon_intrinsics()
matters more than that probably sounds.
2021-12-25 10:26:44 -08:00
Pasi Kallinen
4b525374d0 Make vrocks emit a poison cloud when they flee 2021-12-25 10:51:20 +02:00
nhmall
6c0bc4fe25 another Makefile.msc comment tidbit 2021-12-24 09:37:52 -05:00
nhmall
19ef16a882 Makefile.msc comment tidbit 2021-12-24 09:36:43 -05:00
nhmall
c0f9d93ea4 update Windows test build to Visual Studio 17.0.4 2021-12-24 09:33:56 -05:00
PatR
4eb0592959 sickness countdown
Give messages when sickness countdown has nearly expired to warn
player that hero is dying and also so that death at the end doesn't
seem so abrupt after an arbitrary period with just "TermIll" and/or
"FoodPois" on the status line.

Also, abuse constitution each turn when Sick (either variation, but
not a double amount if both).
2021-12-22 19:36:52 -08:00
PatR
75fe21d00f more urgent_pline()'s
countdown messages for turning to stone or slime or being strangled
drowning
burning in lava
feeling feverish
changing form
2021-12-22 18:29:01 -08:00
PatR
69906f0edb curses: urgent messages
This is comparable to the recent fix for tty.  When messages aren't
currently being suppressed by use of ESC at --More-- (">>" for
curses), if an urgent message itself triggers --More--, don't start
suppressing messages if player dismisses it with ESC.
2021-12-22 12:23:50 -08:00
PatR
29cadc0452 curses: fix "---" separators in ^P output
This one has me baffled, first how/when it happened and then why no
one reported it.  The line
 current_mesg->turn = g.moves;
vanished from mesg_add_line() at some point.  It is visible in diff
context of commit 99ed00012e from March,
2019 but I can't find any commit since that time which removed it.

[I've been using
 git log --no-min-parents --no-max-parents --patch win/curses/cursmesg.c
and then searching within the pager.  Maybe that's flaky, but if so,
things wouldn't be any less strange.]

The missing line resulted in mesg->turn being uninitialized, so when
^P compared consecutive messages to decide whether they were issued on
the same turn, arbitrary junk made them all seem to be from different
turns so "---" got inserted before every message.  I suppose that if
someone uses a malloc that zeroes the memory it hands out, mesg->turn
field would always be 0 and ^P would behave as if all messages were
from the same turn, so not show any "---" separators.  Then players
might not be aware that "---" between groups of messages was intended.

[The messages ought to be grouped by move rather than by turn, but
that's something the core would have to provide.]
2021-12-22 11:33:35 -08:00
PatR
459b1c1c8d switch makedefs from malloc() to alloc()
Avoids any need for MONITOR_HEAP hackery.  Link src/alloc.o and
util/panic.o into util/makedefs.

When replacing the realloc() call in fgetline(), I noticed that
fgetline() would miss the last line of an input file if it lacked a
terminating newline.  This was hard to test because OSX seems to be
supplying one when it is missing (VMS would do that too).  I had to
modify epitaph (my test bed) to take off the final character, run
'makedefs -s' under debugger control and strip away final newline
that stdio added back, build new nhdat and move it into place, then
run nethack and execute #wizrumorcheck all multiple times before
the fix and once more after it.  Much effort for little gain...

Plus some of the recent reformatting:  indent labels one space,
replace tabs with spaces, shorten or split wide lines.
2021-12-22 00:18:37 -08:00
Pasi Kallinen
b1ed92abad Apply runmode to multiturn actions 2021-12-21 17:37:48 +02:00
Pasi Kallinen
8f366c725e Minor linewrap and comment fix 2021-12-21 16:25:21 +02:00
Pasi Kallinen
54bba21dd9 Give message for genod shifter changing shape
For accessibility, give a message when a monster changes shape
due to the previous shape being genocided.
2021-12-21 13:10:07 +02:00
PatR
f08c7f2101 bullwhip and polearm attack feedback
When testing the urgent message for having weapon be snagged by a
bullwhip, in between the occasional weapon grabs (which mention
flicking the bullwhip) I saw lots of regular attacks that said
"<mon> swings his bullwhip."  That is accurate but seems odd, so
change it to "<mon> lashes his bullwhip."  Do same for the hero.

While working on that, I discovered that monsters using a polearm
for a ranged attack always showed "<mon> thrusts <a polearm>" even
for ones that aren't defined as piercing so should be swung rather
that thrust.  And they're allowed to do that when adjacent where
there isn't enough room to thrust or swing a long polearm.  Now it's
"<mon> bashes with <a polearm>" in that situation.
2021-12-21 02:56:59 -08:00
Pasi Kallinen
81a7157d7d Vampire in a genocided shape
When you genocided a monster a vampire was shapeshifted into,
the vampire might've stayed in the genocided form.
Always revert back to vampire form if we tried to pick a genocided form.
2021-12-21 11:18:48 +02:00
Pasi Kallinen
ef1eeed755 Give dragon armor extra effects
Dragon scales and dragon scale mails will provide some extra effects
when worn:

 - blue:   very fast speed
 - black:  level-drain resistance
 - green:  sickness resistance
 - gold:   hallucination resistance
 - orange: free action
 - red:    infravision
 - white:  slow digestion
 - yellow: stoning resistance

gray and silver don't have extra effects - those two are already the
best ones, so don't need any.
2021-12-20 23:30:27 +02:00
PatR
0bc396282d additional urgent messages
Now I've remembered why I didn't follow through with these back when
I originally laid the groundwork.  New urgent messages:

 having an item of armor be destroyed
 having weapon be grabbed by a monster's bullwhip
 becoming engulfed
 being grabbed by an eel
 subsequently being drowned by an eel
 dying of petrification
 turning into slime then dying due to genocide
 dying due to fatal illness

There are lots more candidates.
2021-12-20 08:42:58 -08:00
PatR
2278434228 simplify issuing urgent messages
Change
 custompline(URGENT_MESSAGE, mesg, ...);
calls to new
 urgent_pline(mesg, ...);
2021-12-20 08:30:48 -08:00
PatR
aaed434d46 fix for urgent messages for tty
If messages aren't currently being skipped due to --More--ESC when a
message flagged as urgent is issued and that urgent message itself
triggers --More-- to have the user acknowledge the previous message,
and the user types ESC at this new --More--, message suppression
starts.  With the overly simplistic existing code from a few days
ago, it was too late for the current message to override that.  Since
the urgent message gets buffered like any other (until another message
needs the top line or until input is needed), it wouldn't be shown
when the next message came along and discovered suppression in effect.

I'm not sure that all the changes here are necessary; there was some
flailing about involved.  But it seems to behave as intended now.
2021-12-20 08:16:13 -08:00
PatR
63e47d8ac8 region save/restore
When shortening/splitting wide lines I noticed that the save and
restore code for regions had a bunch of those and they could be
shortened by using an intermediate variable.  Easier to read too.

Also, change several 'unsigned int' to just 'unsigned' as is used in
most of the rest of the code.

At one point I omitted a (genericptr_t) cast (which should no longer
be necessary...) and discovered that bwrite() wasn't declaring the
input buffer it never modifies as 'const'.
2021-12-19 19:31:19 -08:00
PatR
7ccc195155 fix #K3496 - leash description when pet changes
If persistent inventory is displayed and contains an entry for a leash
attached to a pet and the pet's type or name changes, the perm_invent
window didn't get updated to reflect the new leash information:
 x - leash (attached to <mon>)
Report was for polymorph but applied to growing into bigger form and
to being (re-/un-)christened as well.
2021-12-19 09:30:07 -08:00
PatR
5f98102e73 create_door() warning hackery
Redo the warning suppression in create_door().  The unreachable 'goto'
was unnecessary and without it there's no need to toggle unreachable
code warnings off and back on.  Taking a step back, the whole 'default'
case is unnecessary since rn2(4) will always hit one of the 0..3 cases.
So instead of just getting rid of the unreachable 'goto', get rid of
the panic() too.
2021-12-19 04:54:34 -08:00
PatR
9f41ab7bfe Qt paper doll fix
This fixes the broken paper doll display.  Changes for new glyphs
added code to an 'if' but not to the corresponding 'else'.

Showing map column 0 as something other than blank is still a problem.

The splash window shows a red dragon and says "loading".  I'm pretty
sure that that used to be a crisp image but it is now a fuzzy one.
It doesn't use glyphs or their tiles so shouldn't have been affected
by changes to them.
2021-12-19 03:46:21 -08:00
PatR
c5544a8011 'urgent' messages for curses
Have curses catch up with tty.  Some particular messages override
message suppression after --More-ESC (tty) or >>ESC (curses).
2021-12-18 11:07:23 -08:00
PatR
420d121f93 'urgent' messages
Follow up on some old groundwork.  For tty, if the core has designated
a message as 'urgent', override any message suppression taking place
because of ESC typed at the --More-- prompt.  Right now, "You die"
messages, feedback about having something stolen, feedback for
"amorous demon" interaction (mainly in case of armor removal), and
exploding a bag of holding are treated as urgent.

The "You die" case is already handled by a hack in top-line handling;
I left that in place so the conversion of 3 or 4 pline("You die.*")
to custompline(URGENT_MESSAGE, "You die.*") was redundant.  There
are probably various non-You_die messages which precede done() which
should be marked urgent too.

Other interfaces might want to do something similar.  And we ought to
implement MSGTYPE=force or MSGTYPE=urgent to allow players to indicate
other messages that they want have to override suppression.  But I'm
not intending to work on either of those.  I mainly wanted to force
the magic bag explosion message to be shown since a sequence of "You
put <foo> into <bag>." messages is a likely candidate for --More--ESC.
2021-12-17 17:46:49 -08:00
PatR
420afb6b1f fixes entry for pull-req #643 - historic statues
monstone() was using a hardcoded value when flagging the statue of
a unique monster as historic and didn't get updated when the corpse
and statue flags kept in obj->spe were changed last June by commit
04a8ddcce1.

Closes #643
2021-12-17 16:29:53 -08:00
Michael Meyer
4b20ed6211 Fix: gender, historicity of stoned monster statue
The way statues of stoned unique monsters were marked as "historic" was
not changed when mkcorpstat flags were updated in 04a8ddc, resulting in
unique statues which were no longer marked as historic and were instead
marked as female.

While fixing that, also use the gender-related mkcorpstat flags to
assign the gender of a stoned monster to the resulting statue.
2021-12-17 16:28:48 -08:00
PatR
6ae05df1c3 more reformatting - label placement
Indent all labels one space.  Having uniform placement makes spotting
them much easier.  (Having no indent at all would impact the change
bars of 'git diff'.  Those display the last unindented line--which
doesn't start with punctuation--occuring before each band of changes,
so usually the name of the function being changed now that we no
longer have unindented K&R-style function argument declarations.)

While in there, shorten or split various wide lines and replace a few
tabs with spaces.
2021-12-16 15:56:52 -08:00
PatR
0a0ee2d1e6 date.c vs MONITOR_HEAP
I tried building with MONITOR_HEAP defined for the first time in a
while.  It wasn't pretty.

date.c was calling libc's strdup() instead of our dupstr() so alloc.c
wasn't tracking those allocations when/if MONITOR_HEAP is enabled.
Then it called free() which is actually a call to nhfree() in that
situation.  If the file of allocations and releases was subsequently
fed to heaputil, it would complain about freeing pointers that hadn't
been allocated.

Worse, makedefs and tilemap wouldn't link.  For MONITOR_HEAP,
makedefs was undefining free() in order to avoid nhfree() but it now
links with date.o so got nhfree() calls anyway.  And it wouldn't link
because that routine isn't available without alloc.o.  tilemap
doesn't link with date.o but it does call malloc() and free() and it
wasn't undefining free(), so looked for nhfree() when linking and got
the same no-such-routine failure.
2021-12-15 18:39:29 -08:00
PatR
d6a1835f0d refine #wizrumorscheck
If #wizrumorscheck isn't able to open or read the rumors file,
continue on to check engravings, epitaphs, and bogusmons instead of
immediately returning.
2021-12-15 16:45:52 -08:00
Pasi Kallinen
e251bb6a82 Decouple mon state adjustment from find_roll_to_hit
If you have a function named like that, and it goes and
changes the monster state, that's just wrong.

Move waking up the monster from the hit into separate function.
2021-12-15 22:11:22 +02:00
PatR
4d42823fd8 remove duplicate novel titles
For novel title lookups, have the variant spelling substitutions use
the entries from array of titles instead of explicit strings which
duplicate those.
2021-12-14 17:15:17 -08:00
PatR
495cda17b7 some reformatting
Replace some
  (foo &&
   bar)
that had crept back into the code with
  (foo
   && bar)
to match the reformatting which took place before 3.6.0.  There are a
couple of lines ending in '||' still present but they look intentional.
isaac64.c has some trailing '|' bit operators that could/should be
moved to the start of the next line but I didn't touch that file.

While in the affected files, I tried to shorten most overly wide lines
(the right margin is supposed to at column 78 and there are quite a
few lines which are 79 characters long, but I left most of those
rather than introduce new line splits).  Also replace a handful of
tabs with spaces.  I was a little surprised not find any trailing
spaces (in the dozen or so files being updated).  I didn't look for
trailing arithmetic or '?'/':' operators which aught to be moved to
the start of the next line.
2021-12-14 07:43:40 -08:00
PatR
d0197bd3e7 document obj->owornmask
ship_object() and obj_delivery() use obj->owornmask for something
other than tracking what slot(s) an object is worn in.
2021-12-14 05:49:31 -08:00
PatR
78c84a1e5d insufficient spell power feedback
If attempting to cast a spell without having enough power, you get
 |You don't have enough energy to cast that spell.
Recently that was augmented to
 |You don't have enough energy to cast that spell yet.
if your current power is at maximum and not enough.  Augment again to
 |You don't have enough energy to cast that spell anymore.
if current power is at maximum and that maximum is less than the peak
value it once had and that peak value would have been enough.
2021-12-14 02:38:17 -08:00
PatR
1fd379a980 glob update
Initialize glob weight sooner in mksobj() and have weight() skip the
fix up it had been doing when it was passed a glob with weight 0.
This allows shrink_glob() to be simplified slightly in the situation
where a glob inside a container shrinks away to nothing.

weight(glob) with glob->owt==0 now yields 0 instead of 20.  That was
only needed for 'obj->owt=weight(obj)' during object creation and
the new earlier weight init makes the 0 to 20 fixup obsolete.  In
turn, that allows a glob which has shrunk to 0 while in a container
to not have to be removed before updating the container's weight.
2021-12-13 07:04:30 -08:00
PatR
9b150b0249 pickup.c bits
This started out as just some minor reformatting but ended up including
a couple of new comments and a revision in how the use_container()
decides whether it is feasible to put something into the container.
Behavior isn't changing.
2021-12-13 05:07:30 -08:00
PatR
f10ef7aba8 attrcurse() on 'see invisible'
If hero has intrinsic see-invisible and a gremlin steals that, the
map wasn't being updated to hide invisible monsters (until the next
iteration of moveloop() after other monsters finished current turn).
2021-12-12 11:32:09 -08:00
Pasi Kallinen
f6b7be49f4 Accessibility: give a message when teleporting a monster
Teleporting a monster only updated the map. Give a message
so blind players can get the same information.
Making a monster invisible gives the same message, if you
cannot detect invisible.
Several other places where monsters teleported themselves
now also give the same message.
2021-12-12 16:50:49 +02:00
PatR
e25f8ec6e3 endless shrink_glob...
A shrink_glob timer keeps running for a glob on the migrating objects
list so shink_glob() needs to be aware of that.
2021-12-11 18:39:36 -08:00
PatR
ba255875cd shrink_glob bug when when glob is totally gone
When a wielded glob shrank away to nothing, an impossible warning:
"obfree: deleting worn obj" would be issued.

If a glob is quivered or wielded or set up as swap weapon when it
shrinks away to nothing, clear the relevant weapon slot before
destroying the glob.

Won't happen for monsters since they never wield globs.  Also won't
happen for migrating objects (which overload obj->owornmask) because
they have to have arrived somewhere in order to have their shrink
timer execute.
2021-12-10 20:16:30 -08:00
PatR
8aa90bdbac formatting bit 2021-12-08 16:24:48 -08:00
PatR
a80969f280 wizard mode polyself to "priest"
When polymorphing while already polymorphed, picking your own role
will rehumanize (wizard mode only; restores old characteristics and
experience level, unlike becoming a new man which can change those
and even be fatal if level drops below 1).  But it didn't work if
you were a priest or priestess because name_to_mon() yields aligned
cleric monster rather than cleric role.
2021-12-08 16:08:57 -08:00
PatR
5ce53f4d17 shape change while strangling
Polymorphing into a vulnerable form while wearing an amulet of
strangulation says "your amulet still constricts your neck" if your
previous form was also vulnerable or "your amulet beings constricting
your neck" if previous form wasn't vulnerable.  But a change nearly
6 years ago to have the status line be updated to say "Strangling"
during the message--instead of next status update after it--caused
the "still constricts" variation to always be given even when the
"begins constricting" was appropriate.
2021-12-08 15:31:06 -08:00
PatR
49f21769da long worm growth again
The previous change could have resulted in a long worm losing HP when
gaining a segment (if it had gained levels while at the peak amount
for the previous number of segments).  I think this is finally right.
2021-12-07 15:54:46 -08:00
PatR
47243ba860 long worm growth
I think this is what was originally intended.
2021-12-07 03:10:57 -08:00
PatR
ec58e917f3 misuse of hero_glyph
It isn't just the hero's normal glyph, it gets adjusted when poly'd.
So the way I tried to use it didn't work as intended.  Explicitly
check Upolyd separately so that hero_glyph won't be affected by tat
and only returns the player monster or race monster value.
2021-12-05 15:09:08 -08:00