Commit Graph

2631 Commits

Author SHA1 Message Date
nhmall
5ac860bdc7 there was some left-over k&r code in win/chain 2022-02-07 14:58:16 -05:00
PatR
b3c5d68399 fix movement prefixes
My earlier change resulted in rejecting all commands entered after
a movement prefix key, rather than just ones that aren't supposed to
take any prefix.

This fixes that and also restores the ability to use 'm>' or 'm<' on
stairs to change levels without auto-pickup at the destination.
2022-02-06 17:46:31 -08:00
PatR
f233f1d18c water description
The wall of water goaded me into updating waterbody_name().  It's
mostly the same, aside from being moved from mkmaze.c to pager.c and
adding "{wall of|limitless} water" instead of plain "water" for WATER
terrain.  I'm not very happy with "limitless" for the Plane of Water
because limits imposed by air bubbles are all over the place.  "Wall
of water" might work ok for that level.

Water on Medusa's level is now described as "shallow sea" rather than
lame "water".  The two unusual pools on the Samurai home level are
described as "pond" rather than previous "water" which replaced 3.6's
ridiculous "moat".  When lava is hallucinated, it is described as
"molten <substance>" (yielding silly things like "molten yoghurt"),
rather than just "<substance>" to distinguish it from hallucinated
water.  'autodescribe' doesn't use waterbody_name() though.
2022-02-06 13:20:15 -08:00
PatR
e8341dc9d7 fix github issue #666 - cursed light vs worn light
Another gold dragon scales/mail issue, reported bu vultur-cadens:
reading a cursed scroll of light extinguishes carried light sources
except for wielded Sunsword and worn gold dragon scales/mail; there
was a special message for Sunsword (preventing the hero from being in
darkness) but no such message for gold dragon scales/mail.  Replace
the special message with a more generic one applicable to both cases.

Also, implement the suggestion that cursed light degrade the amount
of light being emitted (which varies by bless/curse state) for those
two cases.  Sunsword has a 75% chance to resist, gold dragon scales
25% chance.  And add the inverse:  blessed scroll of light might
increase the amount of light by improving their bless/curse state.
The resistance check applies here too and isn't inverted; Sunsword
is still fairly likely to resist.

Uncursed scroll of light, spell of light regardless of skill, zapped
or broken wand of light have so such effect.

Closes #666
2022-02-04 16:20:03 -08:00
nhmall
5d4fc4591d more .gitattributes updates 2022-02-04 11:01:20 -05:00
PatR
87bcd2ee50 update .gitignore
Ignore the new timestamp files src/moc.qt5 and src/moc.qt6.  They
probably ought to be renamed Qt*.moc-t but I haven't done that.

Also put back vis_tab.* in case someone checks out 3.6 and builds
that, then checks out 3.7 without doing 'make spotless' first.
2022-02-03 00:27:43 -08:00
PatR
9aea7b587c fix #K3455 - rocks vs xorns
Implement the suggestion that falling rock traps and rolling boulder
traps be harmless to xorns.  I've extended that to all missiles made
of stone (rocks, gems, boulders, a handful of other things that will
only matter if poly'd hero throws in '<' direction or is hit by stuff
scattered by an explosion).

I excluded ghosts because they would become even harder to kill and
the missile handling would need extra checks to test for blessed objs.
2022-02-02 05:26:03 -08:00
nhmall
3a4302773d two minor core changes for hypothetical Amiga cross port
The tilemap change provides three variables that used to be
uppercase compile macros in the past, and Amiga (and other ports?) used
them.

The other change just uncomments the header file include.
2022-02-01 17:11:35 -05:00
nhmall
c75e5d99d2 syntax in prototype 2022-02-01 13:03:41 -05:00
Pasi Kallinen
218c0d4a3b Stinking clouds block line of sight
... you will also get a message when a seen stinking cloud
or the one surrounding the hero dissipates.

Original feature comes from Fourk, but this version (with some
minor changes) comes from xnethack by copperwater <aosdict@gmail.com>
2022-01-31 19:00:19 +02:00
nhkeni
1647125f89 rationalize extensions in doc directory
rename text files to have .txt extension, etc
    update references to changed filenames
2022-01-29 16:28:06 -05:00
SHIRAKATA Kentaro
cf810630de add missing const
If you want to declare a pointer which the address pointed to is constant,
you should declare it as like `static const char *const var = "...";`.

This commit supplies missing `const` and prevents some programming
error in the future.
2022-01-29 11:13:01 -08:00
Pasi Kallinen
c722962713 Cancellation explodes magical traps 2022-01-28 08:30:08 +02:00
Feiyun Wang
96de8d58d6 Some improvements in Makefile.mingw32.depend
- Change $(cce) to output .d file prerequisite too, the same as .o
- Replace $(CLEAN_FILE) handling w/ "clean: cleandep", for more encapsulation
2022-01-27 18:34:50 -05:00
Pasi Kallinen
a6816824c7 Lua: Pass more data to room contents function 2022-01-23 13:27:00 +02:00
Pasi Kallinen
7b87f7b495 X11: Fix map display for hypothetical huge map
memsets don't work very well when xchar isn't char sized.
2022-01-23 01:14:26 +02:00
Pasi Kallinen
9d64d135b8 Curses: fix extended command input
The extended command input prompt was behaving in an unintended way:
Typing #a<enter> executed #adjust. Spaces in the entry prevented matching
any command. No error message was given when no command was matched.

Fix all of those, so it behaves more like the tty.

Clean up the tty, curses, and X11 windowport code, so they don't use
the extcmdlist array directly, but query with extcmds_match
and extcmds_getentry.
2022-01-22 14:32:53 +02:00
PatR
6a72e48a40 fix rest_on_space
When rest_on_space is On, assign same function as for #wait to the
<space> key.  When Off, set that key to Null instead.  Binding some
other command to <space> when rest_on_space is Off doesn't work but
I would classify that as something to be discouraged anyway.
2022-01-21 15:51:05 -08:00
PatR
aab21eba95 blessed objects vs vulnerable creatures
Collect creatures that don't like being hit by blessed objects in one
place.  No change in behavior.
2022-01-21 13:19:57 -08:00
PatR
5f14f0ff57 options help one more time...
Move the help text for the 'O' command from the code into its own file
and allow that to be accessed from the '?' menu as well as by choosing
entry '?' in the 'O' menu.

sys/unix/Makefile.top has been updated to handle new 'optmenu', others
need to catch up.  The game will still build and run without the file
but asking for options menu help won't work until they do.
2022-01-19 14:22:21 -08:00
PatR
f420b9672f Qt: more '#' support
Add an entry for running an extended command to Qt's 'game' menu.
2022-01-17 14:38:16 -08:00
Pasi Kallinen
2e144e814d Change repeat into extended command 2022-01-17 17:13:59 +02:00
Pasi Kallinen
e7fa065203 Change special keys into extended commands
Changes most of the special keys used in the main input loop
into extended commands:

- movement keys are now bound to extended commands, eg.
  #movewest and so on.

- m-prefix is now #reqmenu extended command, still bound to
  the 'm' key.

- run, rush, and fight are now extended commands, still bound
  to the same keys as previously.

- nopickup and runnopickup keys are removed.
  Nopickup was using 'm' key, the same as the m-prefix, so
  allow #reqmenu to modify movement commands to disable pickup.

- multiple prefix commands are allowed. This lets user to
  use #reqmenu, followed by #run, followed by movement to simulate
  runnopickup behaviour. (If necessary, adding runnopickup back
  as an extended command would be easy)
2022-01-16 14:48:24 +02:00
Michael Meyer
f5e3bc3d96 Remove gendered mons indices from roles, races
There are no longer distinct gendered versions of monsters, so femalenum
is unused (i.e. set to NON_PM) for all roles and races. Take a pass at
removing all uses of/references to femalenum, and rename 'malenum' to
'mnum' since it no longer has any particular association with
gender or sex.
2022-01-14 13:51:26 -08:00
PatR
d5b7d8520c 'O' assistance
I don't care for this very much at all, but making it shorter will
reduce its usefullness.  It addresses one of the struggles exhibited
in the "a man and his cat" youtube video, where he was baffled when
selecting booleans didn't change their values and he later used Esc
instead of Enter after eventually finding number_pad.

This inserts some explanatory text (around three dozen lines,
unfortunately) at the start of 'O's menu.  Some of it is general menu
stuff, some is specific options stuff, and some attempts to fend off
various bug reports about options that do or don't persist across
save and restore or RC revisions that seem to have no effect.

The new introductory text can be disabled by turning off cmdassist.
Players who already do that don't need to see this.  Many who ignore
cmdassist and occasionally endure an outburst of compass directions
are likely to be goaded into turning it off.  I hope we won't need a
new 'optassist' for players who want to skip this but leave cmdassist
in general on.

It doesn't attempt to address his attempt to use arrow keys (possibly
arrows overloaded on number pad keys, or perhaps just digits on the
number pad while numpad mode was off) to navigate the menu then having
the Windows port 'helpfully' change those into hjkl which resulted in
selecting and subsequently unintentionally toggling some options on
the first page.  One was 'color' which he did notice and then re-run
'O' to successfully toggle it back on.  There was at least one other
which he either didn't notice to didn't both to reverse.
2022-01-13 14:25:01 -08:00
PatR
27a2c530e3 monnum_to_glyph() followup
This was a fix for missing parentheses, but that just became redundant.
Add it anyway, for the reformatting.
2022-01-11 14:42:28 -08:00
nhmall
ec55b04ace macro argument monnum_to_glyph
In file included from ../include/hack.h:217,
                 from ../win/Qt/qt_plsel.cpp:18:
../win/Qt/qt_plsel.cpp: In member function ‘void nethack_qt_::NetHackQtPlayerSelector::populate_roles()’:
../win/Qt/qt_plsel.cpp:378:53: warning: enumerated and non-enumerated type in conditional expression [-Wextra]
  378 |         gf = monnum_to_glyph(roles[i].malenum, is_f ? FEMALE : MALE);
../include/display.h:610:27: note: in definition of macro ‘monnum_to_glyph’
  610 |                         ((gnd == MALE) ? GLYPH_MON_MALE_OFF : GLYPH_MON_FEM_OFF))
      |                           ^~~
../win/Qt/qt_plsel.cpp: In member function ‘void nethack_qt_::NetHackQtPlayerSelector::populate_races()’:
../win/Qt/qt_plsel.cpp:407:53: warning: enumerated and non-enumerated type in conditional expression [-Wextra]
  407 |         gf = monnum_to_glyph(races[j].malenum, is_f ? FEMALE : MALE);
../include/display.h:610:27: note: in definition of macro ‘monnum_to_glyph’
  610 |                         ((gnd == MALE) ? GLYPH_MON_MALE_OFF : GLYPH_MON_FEM_OFF))
      |                           ^~~
2022-01-11 17:00:31 -05:00
Pasi Kallinen
1f2d16082e Fix shopkeeper Kop summons causing segfault
... if it happened on a level with no downstairs, such as the tourist quest.
2022-01-11 22:55:43 +02:00
PatR
ffeb0e27a8 fix recent Wounded_legs fix
Wounded_legs was changed from (HWounded_legs || EWounded_legs) to
just (HWounded_legs), but when the timeout code decremented the timer
to 0, HWounded_legs became 0 and heal_legs() operated as if there was
nothing to repair and hero didn't recover from temporarily lost Dex.
Change Wounded_legs back to (HWounded_legs || EWounded_legs).
2022-01-11 10:25:50 -08:00
nhmall
560b74fabc remove some dev code
Closes #648
2022-01-10 14:18:12 -05:00
Pasi Kallinen
68b822e4dc Add "user canceled" as extended command return value
Instead of returning ECMD_OK, the commands now return ECMD_CANCEL
when user declined to pick a direction or an object to act on.

Note that this can be ORed with ECMD_TIME, if the command still
took a turn.

For now this has no gameplay meaning.
2022-01-08 20:04:57 +02:00
Pasi Kallinen
a77e1602f1 Apply a wielded bullwhip with fire-command 2022-01-06 17:12:30 +02:00
Pasi Kallinen
48bca11d67 Accessibility: give message for created monsters
Always give a message when creating a detected monster
during gameplay (as opposed to during level creation).
To prevent the message, use the MM_NOMSG flag for makemon.

Most places already handled their own messaging, but there
were some, such as bag of tricks, create monster magic
and random monsters created during gameplay that didn't.
2022-01-06 14:06:49 +02:00
Pasi Kallinen
e5ee580961 Allocate rects dynamically
... instead of hard-coding them to 50. New allocated value is
(COLNO*ROWNO)/30, which is slightly higher (56), and that formula
seems to work for hypothetical larger maps too.
2022-01-05 17:35:33 +02:00
Pasi Kallinen
f065cf01c1 Mark extended commands accepting m-prefix in the command flags 2022-01-04 19:29:18 +02:00
nhmall
1cb5dc0460 work around ubuntu 20.10 build issue
NetHack was trying to suppress warn_unused_result
in include/tradstdc.h, by defining warn_unused_result
to an empty string. That began causing a build error
in a system-supplied header file cdefs.h
when using 20.10 ubuntu impish.

Try skipping that in tradstdc.h for any linux, unless
the NetHack build defines GCC_URWARN to force it into
play.
2022-01-04 08:24:08 -05:00
nhmall
7b8309f178 update patchlevel.h copyright 2022-01-04 00:08:12 -05:00
PatR
292a4f9d03 wounded legs fixes
Document 'HWounded_legs' vs 'EWounded_legs'; they aren't used the way
other properties use their intrinsic and extrinsic values.  And they
switch from hero to steed when riding.  (Can't start riding when
hero's legs are wounded and the steed's legs magically heal when hero
dismounts, so existing wounds never transfer from one to the other.)

Having one leg become injured when the other already was would cure
the other leg but keep the longer of their two timeouts for the new
injury.  Eliminate that mystery cure.  Since their timeouts aren't
tracked separately, the best that can be done is to make both legs
eventually recover at the same time.

Make ^X report which leg is the wounded one when only one of them is.
(It already implicitly reports the both-legs case by using plural.)

When zapping a wand of probing downward while riding, include wounded
leg feedback for the steed.

Simplify wounded leg feedback when probing self a little bit.

Make drinking blessed potions of full healing cure wounded legs for
hero when not mounted or for steed when mounted.  (The latter is a
bit strange--hero drinks potion, steed gets affected--but it's magic.)

Make drinking uncursed potions of full healing or blessed potions of
extra healing cure wounded legs for hero (but not steed; the magic
either isn't that strong or maybe not that reliable...).
2022-01-03 13:44:05 -08:00
PatR
30a0cab66f tiled_map option
It was possible to toggle ascii_map On (which toggles tiled_map Off)
and Off (so tiled_map On) during play, but tiled_map was marked as
config-file only so the converse pair of operations weren't allowed.
Allow tiled_map to be toggled On or Off during play.
2022-01-02 00:35:52 -08:00
Pasi Kallinen
3e620e06eb Define extra sanity checks if not a release 2022-01-02 01:14:16 +02:00
PatR
4f1c213516 more NO_TILE_C
When USE_TILES is disabled, don't let wc_tiled_map be the default.

Qt is capable of showing an (ugly) ascii map, and will do so if built
with NO_TILE_C after this fix (it defaults to tiles without this),
but it requires that a tiles file be loaded because it displays tiles
in other places besides the map, like role selection.  So it can't
skip them when wc_ascii_map is set.
2021-12-31 15:02:35 -08:00
nhmall
eddbff351e change MacOSX to MacOS in version display 2021-12-31 16:44:15 -05:00
Pasi Kallinen
8db18275a6 Define engulfing_u, making clearer code 2021-12-31 21:12:21 +02:00
Pasi Kallinen
d53cd28d46 Make extended commands return defined flags
Instead of returning 0 or 1, we'll now use ECMD_OK or ECMD_TURN.
These have the same meaning as the hardcoded numbers; ECMD_TURN
means the command uses a turn.

In future, could add eg. a flag denoting "user cancelled command"
or "command failed", and should clear eg. the cmdq.

Mostly this was simply replacing return values with the defines
in the extended commands, so hopefully I didn't break anything.
2021-12-30 19:16:33 +02:00
Pasi Kallinen
fa41d5fe66 Apply a wielded polearm with fire-command
Wield a polearm and use 'f'ire to automatically hit with it,
if there's a single valid target.
With fireassist-option, will swapweapon to a polearm.
This only applies if quiver is empty and autoquiver is off.
2021-12-29 19:40:26 +02:00
PatR
8b30f3e1d1 red dragon's sight
Since wearing red dragon scales/mail confers infravision, give that
ability to red dragons.  Matters when the hero is polymorphed into one.
Also give it to the Chromatic Dragon, where I don't think it matters.
2021-12-26 14:57:29 -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