Commit Graph

9997 Commits

Author SHA1 Message Date
nhmall
aba796bb08 Merge branch 'rock_disppear_msg' of https://github.com/argrath/NetHack into NetHack-3.7 2024-11-03 09:10:16 -05:00
nhmall
f46cd2732a W_NONDIGGABLE collisions with overloaded rm flags fields
Resolves #1308
2024-11-03 09:08:11 -05:00
nhmall
9a42d70901 ranged attack in repertoire might not be used
Commit 22884522, ported (from Sporkhack, Evilhack), added the ability
for monsters to maintain awareness of player resistances that they
observed.

Since they will refrain from using a ranged attack that they deem
futile, take the specific monster's seen_resistance field into consideration
when choosing code paths based on the availability of ranged attacks.

Resolves #1307
2024-11-03 09:03:04 -05:00
SHIRAKATA Kentaro
bb401fcb38 split a message of a rock disappearing into a separate function
... to prepare further refactoring
2024-10-27 00:48:01 +09:00
nhmall
79c889502c follow-up: remove trailing whitespace 2024-10-24 08:40:44 -04:00
nhmall
f40c81d2fd Merge branch 'passiveum' of https://github.com/argrath/NetHack into NetHack-3.7 2024-10-24 08:39:09 -04:00
nhmall
2cf52c0374 Merge branch 'dopush' of https://github.com/argrath/NetHack into NetHack-3.7 2024-10-24 08:38:33 -04:00
nhmall
5eefeaf009 msghandler follow-up: msdos cross-compile warnings
pline.c: In function 'execplinehandler':
pline.c:631:17: warning: unused variable 'args' [-Wunused-variable]
  631 |     const char *args[3];
      |                 ^~~~
pline.c:626:30: warning: unused parameter 'line' [-Wunused-parameter]
  626 | execplinehandler(const char *line)
      |                  ~~~~~~~~~~~~^~~~
2024-10-19 08:02:03 -04:00
Pasi Kallinen
945ccff1ff Allow changing command autocompletions via #optionsfull 2024-10-19 14:46:11 +03:00
nhmall
64bb0e2144 msghandler follow-up: fix mingw/MSYS2 build 2024-10-19 07:28:12 -04:00
Pasi Kallinen
696af89299 Change MSGHANDLER from compile-time to sysconf 2024-10-19 10:47:53 +03:00
Pasi Kallinen
d35aa35c3f Don't put the unknown command message into history
Even with Norep, it was cluttering the message history buffer.
2024-10-18 17:54:05 +03:00
Pasi Kallinen
0530ca0758 Fix the undiggable/nonpasswall stuff
wall_info (aka flags) is overloaded with other stuff.
2024-10-18 16:52:29 +03:00
Pasi Kallinen
c33a6e7c0b Wizmode wishing for undiggable/unphaseable walls 2024-10-18 14:20:24 +03:00
Pasi Kallinen
f12635ccd9 Prevent monster generation in the sokoban trap hallway
Makes Sokoban far less tedious when you don't have to worry about
monsters randomly popping up in the trap hallway while you're pushing
the boulder.

Adds a new exclusion zone for monster generation, and the goodpos
routine avoids the zones when GP_AVOID_MONPOS is used.
2024-10-18 13:30:51 +03:00
Pasi Kallinen
9e4b2c121b Improve the exclusion zone code
I forgot to add the code to flip the exclusion zones when implementing them.
Also improve the zone coordinates so they're correct outside of map contents.
2024-10-17 12:34:06 +03:00
SHIRAKATA Kentaro
d2b7c2f5c5 split "assess_dmg" on passiveum() into a separate function 2024-10-15 03:21:08 +09:00
PatR
546c1101b0 more 'selectsaved'
If the saved game menu has more than 13 games, it won't be able to
use 'n' for "new game" and 'q' for "quit".  Switch to 'N' and 'Q'
instead of just using the next letters in sequence.  Only resort to
next-letters if there are more than 39 games.

tty and curses handle a list of many save files via menu pagination.
X11 does so with one long page possessing a scroll bar.  If there
are more than 52 entries, selection via mouse is needed beyond 'Z'.

Qt has one page without any scroll bar so won't provide access to
the full set of save files when there are too many to fit on the
screen.
2024-10-12 15:03:54 -07:00
PatR
35cf713988 fix part of #S11588 - mons eating poisoned items
Prevent non-poison resistant monsters that eat items from eating
poisoned items.
2024-10-12 14:39:48 -07:00
nhmall
3885949c5b resolve a static analyzer complaint in glyphs.c
src/glyphs.c(680): warning: Dereferencing NULL pointer.
                   'other' contains the same NULL value as 'obj_glyphs[idx].u' did.
2024-10-12 15:28:44 -04:00
PatR
10498b1535 monster swapping armor simplification
Slightly simplify yesterday's message adjustment made when a monster
takes off a piece of armor and puts on a different instance of the
same type of armor.  ("a|an <something>" -> "another <something>")
2024-10-12 11:09:50 -07:00
nhmall
57fc8f10a6 replace fuzzer state magic numbers 2024-10-12 10:14:44 -04:00
PatR
e1dbad9194 monster swapping armor
While testing the Demonbane change, I saw
| The Angel of Crom removes a robe and puts on a robe.

which looks a bit silly.  Change that to be
| The Angel of Crom removes a robe and puts on another robe.

when the two items have the same formatted description.  (The second
robe evidently has a better enchantment than the first one.)
2024-10-12 00:17:58 -07:00
PatR
c4a1f298e8 lawful minions vs Demonbane
Back then Demonbane was a long sword, lawful Angels and Archons
could get either it or Sunsword as part of their starting equipment.
After it got changed into a mace instead, they could only get
Sunsword.  Rather than always giving them a long sword, sometimes
give them a mace so that they get back the chance to start with
Demonbane.

Since mace is quite a bit weaker that long sword against large
opponents, provide a better enchantment for maces given to lawful
minions.
2024-10-11 23:34:26 -07:00
PatR
11a4fe42de 'selectsaved' again - update EDITLEVEL again
The role, race, gender, and alignment string values are 3 letters
preceded by a dash.  I was looking at "name-race-role-gend-algn"
and mistakenly treated them as 4 letters preceded by a dash.

Fixing that changes PL_NSIZ_PLUS and there is one item of that size
written into save files, so the fix invalidates existing save files.
2024-10-11 22:35:38 -07:00
PatR
1f36b98b8f 'selectsaved' extension
Instead of a menu listing
 a - hero1
 b - hero2
 n - New game
 q - Quit
show
 a - hero1-role1-race1-gend1-algn1
 b - hero2-role2-race2-gend2-algn2
 n - New game
 q - Quit
or
 a - - hero1-role1-race1-gend1-algn1
 b - X hero2-role2-race2-gend2-algn2
 c - D wizard-role3-race3-gend3-algn3
 n - New game
 q - Quit
when any game in the list wasn't saved during normal play.  (Those
are sorted by character name; the playmode is just coincidence.)

The dash for 'normal' doesn't look great but -/X/D are codes used in
entries written to paniclog.  The whole playmode prefix doesn't look
particularly good but I suspect that most players relying on restore
via menu won't see it.

It should work when the character name has dashes in it but that
hasn't been properly tested.

The gender and alignment suffices reflect their value at the time of
save rather than at the start of the game.  That might be considered
a bug but it was easiest.

Increments EDITLEVEL; existing save and bones files are invalidated.
2024-10-10 23:14:25 -07:00
SHIRAKATA Kentaro
666b053c09 split "dopush" on moverock_core() into a separate function 2024-10-09 23:00:16 +09:00
PatR
5abee166f5 makelevel() oddity
There must have been a reason once to guard against calling makelevel()
when the dungeon hasn't been initialized yet, but that doesn't seem to
be necessary these days.  Calling Is_special() before init_dungeons()
is clearly a bug, so fix that.
2024-10-05 15:48:44 -07:00
nhmall
fb70aadbb5 improve copy_bytes() maintenance
Remove the copy_bytes() function from files.c and util/recover.c
and place a single copy into hacklib.
2024-10-05 15:55:20 -04:00
nhmall
6f8c36df70 copy_bytes() recover function
The version of copy_bytes() in util/recover.c had fallen behind
the internal version in files.c which had received some
analyzer changes in 4bc5e26082 from
December 2022.

This synchronizes them, and addresses a couple of other static
analysis recommendations.
2024-10-05 10:54:54 -04:00
nhmall
5af723669e some static analyzer items 2024-10-04 12:34:09 -04:00
PatR
35220e44cb _suppress_map_output()
Make a macro version of suppress_map_output() to keep an extra
function call out of show_glyph().

Add a couple of missing '#undef's for onefile processing.  display.c
still has a ton of macros that leak beyond its end of file.
2024-10-03 23:38:48 -07:00
PatR
529de54277 spot_monster messages while saving
The 'spot_monster' option (extra feedback for "accessibility") was
causing messages to be delivered during save, and they could end up
triggering unwanted "--More--" interruptions for tty.

I couldn't reproduce it but it was easy to see where it would happen.
This shuts such messages off in two ways.  Only one should be needed
but I'm not sure which one it ought to be.
2024-10-03 23:15:24 -07:00
PatR
dcf18b2b69 fix #K4292 - tame hider-under vs cursed object
A pet with the hides-under attribute could hide under cursed objects
if it first moved reluctantly to their location.  Also, the messages
seem contradictory:
| The cobra slithers reluctantly over a scroll labeled DUAM XNAHT.
| You see your cobra slither under a scroll labeled DUAM XNAHT.
First over, then under, but that was actually accurate; the monster
moved, then after it was on the pile it hid underneath.

Change hideunder() to not let pets hide under an object if it is
cursed or any object in its pile is cursed.  Initially I was just
going to check the top item and the item directly beneath it, but
reluctance to move there extends to the whole pile so I made hiding
do so too.

Change the first message to move reluctantly "onto" an object since
"over" suggests that it has continued past the item, unless it is
actually flying or levitating so truly "over" the pile.
2024-10-03 12:50:10 -07:00
PatR
5653da2c54 find_offensive() bit
Move a couple of variable initializations past some early returns
that might make them unnecessary.
2024-10-02 23:16:50 -07:00
PatR
4e2494c859 fix hunger status highlighting text match
Crash triggered by fuzzer.

The Null value for not-hungry between "Satiated" and "Hungry" in the
array of possible hunger states caused a crash if C++ regex handling
was being used.  With posixregex, it would pass benignly for tty but
crash for curses.  I didn't check any other interface.
2024-09-30 12:41:29 -07:00
nhmall
d7434e5b3a Merge branch 'nopushmsg' of https://github.com/argrath/NetHack into NetHack-3.7 2024-09-29 09:27:15 -04:00
nhmall
357082956f Merge branch 'finish_splitting' of https://github.com/argrath/NetHack into NetHack-3.7 2024-09-29 09:26:05 -04:00
PatR
525c6744ee some changes tried while working on issue #1289
display.h -- bring an unused macro up to date
detect.c  -- always call newsym() when searching or secret door
  detection finds a trap rather than just when not blind
glyphs.c  -- some formatting
pager.c   -- lookat() behaves very strangely when single-stepping
  in the debugger (gdb); this didn't help
2024-09-28 23:50:27 -07:00
Pasi Kallinen
d746060d6e Boomerangs should not mulch
I think this is a regression, but I didn't bother compiling an older
version to check.
2024-09-28 17:50:14 +03:00
SHIRAKATA Kentaro
387b23f633 split "nopushmsg" on moverock_core() into a separate function 2024-09-28 04:47:25 +09:00
PatR
9390a844f0 green dragon/iron golem breath
A poison gas breath attack that hits a wall would leave a 1x1 gas
cloud region at that wall spot.

Not always noticeable due to other spots along the zap path leaving
regions that blocked vision.
2024-09-26 23:29:32 -07:00
PatR
e9a25a0a1c sanity_check: current hero health better than max
Changes to setuhpmax() a couple of days ago to deal with sanity_check
for "current hero health as monster better than maximum" ended up
triggering sanity_check about "current hero health better than maximum"
when gaining experience level(s) while polymorphed.
2024-09-26 23:00:42 -07:00
PatR
01a6e4e1d1 breathless vs breathless()
Avoid having a variable with the same name as a function-like macro
in case the latter eventually gets turned into an actual function.
2024-09-26 22:19:17 -07:00
PatR
02cc7c76e6 add '?' choice after choosing '* for force_invmenu
If the force_invmenu option is On for choosing an inventory item
and the set of likely candidates is only a subset of full inventory,
then "* (list everything)" is an extra menu choice.  If the player
picks that, the menu is reissued showing entire inventory (with the
extra "* (list everyhing)" choice omitted this time).

When that happens, add "? (list likely candidates)" instead, so that
the menu can be toggled back to how it initially was.

If the menu allows choosing anything in inventory (the 'd' command,
for instance), it will already show full inventory and neither '*'
nor '?' gets included as helper choices.
2024-09-26 09:57:31 -07:00
PatR
0dad60e485 fix github issue #1291 - water walking vs lava
Issue reported by ars3niy:  non-fireproof water walking boots are
supposed to be destroyed if worn on lava, but a post-3.6 change
made that only happen if the hero died and left bones.

The boots remained intact if hero was fire resistant or survived
6d6 damage.  Staying intact should only happen if they're fireproof.

This seems to work but each time lava_effects() gets modified it
becomes more fragile.  Having deleted objects stick around doesn't
help with this problem, which is to keep an item which is being
stolen--and whose loss causes the hero to drop into lava--from
being burned up before being transferred to the thief's inventory.

Fixes #1291
2024-09-26 08:10:26 -07:00
nhmall
63294536f6 eliminate gcc 13.2.0 warnings that recently appeared
timeout.c:550:1: warning: no previous prototype for ‘region_dialogue’ [-Wmissing-prototypes]
  550 | region_dialogue(void)
      | ^~~~~~~~~~~~~~~

../win/curses/curswins.c: In function ‘curses_destroy_win’:
../win/curses/curswins.c:202:33: warning: variable ‘dummyht’ set but not used [-Wunused-but-set-variable]
  202 |     int mapwidth = 0, winwidth, dummyht;
      |                                 ^~~~~~~
2024-09-26 09:49:42 -04:00
PatR
f5d889852b hero-as-gremlin enhancements
When hero is poly'd into a gremlin, using #monster at a fountain
location will clone a gremlin pet.  Do the same at a pool location
(might not match the movie but if not, most likely because the
situation never came up).  Also, do the same for #sit at either
fountain or pool.
2024-09-25 01:19:07 -07:00
PatR
2471306112 prayer fix for being in poison gas cloud region
Like stuck-in-wall, there might not be any place to move the hero
in order to escape a poison gas cloud.  That could result in "fix
all troubles" becoming stuck in a loop.  3.6.something fixed the
stuck-in-wall case by temporarily conferring Passes_walls.  Fix the
in-poison-region case by temporarily conferring Magical_breathing.

Not adequately tested...

I don't think that this fixes "#K4252: NH 3.7 Prayer Bug" where the
game hung during a couple out of scores of prayers.  I didn't see
any other fix-trouble cases that seemed likely to remain unfixed
and end up with repair attempts retrying.
2024-09-25 01:01:17 -07:00
PatR
da8ba281a4 more setuhpmax()
Prayer result of fix very low HP.  Tricky because when poly'd,
prayer operates on both u.mhmax and regular u.uhpmax but setuhpmax()
only operates on one of the two depending on Upolyd.
2024-09-25 00:58:43 -07:00