Commit Graph

2621 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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