Commit Graph

128 Commits

Author SHA1 Message Date
PatR
58477b33f4 more fix for #H5056 - achievement tracking
The followup message about the fix for #5056 was trapped by the spam
filter so didn't reach us for a while.

xlogfile has an extra field to track various achievements made during
the game it logs, two of which are fully exploring the gnomish mines
and fully exploring sokoban.  Those are accomplished by finding the
special 'prize' item on the final level of their branch:  luckstone
for mines and bag of holding or amulet of reflecition for sokoban.
3.6.0 had a bug where any item of the target type found anywhere in
the dungeon resulted in achieving the relevant goal.  A post-3.6.1 fix
for that required that the item be found on the end level of the branch
and attempted to require that it an item explicitly placed there by the
special level loader, but the latter aspect had a bug which meant that
random items of the appropriate type placed on final level would count
as the prize.  Chance of extra luckstones on mines' end is fairly high,
so potential for false completion of the achievement was also high.

The second complaint was that since the achievement was only recorded
if the special prize item was found on final level, then if a monster
took it to another level then the achievement became impossible.  (Not
true, the player could take it back, drop it, and pick it up again, but
that is admittedly a pretty silly hoop to jump through.)  On the other
hand, if a monster removed the item before the hero found it, then a
case could be made that the hero hadn't really fully explored the
level.  However, this fix records the achievement no matter where the
hero picks up the item.  The final level must be entered--otherwise no
monster could possibly acquire and transport the item--but it isn't
guaranteed to have been fully explored.  Big deal....

The prize could also be acquired in bones data.  Before the second
portion of this fix, that wouldn't have mattered.  But now it does, so
clear the prize indicator when saving bones unless it happens to be the
same level where that item is created (impossible for sokoban, where no
bones are left; not sure offhand about mines' end).  The former prize
stone or bag or amulet becomes an ordinary one of its type.

This can all be done in a much cleaner fashion once we give up on the
current save file compatability.  Putting obj->o_id values into new
context.mines_prize and context.soko_prize, plus a hack to mkobj() to
not reuse those two values if the o_id counter ever wraps back to 0,
would cover most of the details.  Adding an achievement tracking flag
to lev_comp's object handling for use by the special level loader
would cover most of the rest.
2017-10-24 00:37:21 -07:00
Pasi Kallinen
99c6b7f4da Add context menu for current location
Add a new boolean option herecmd_menu. If this is on, and using
a windowport that supports mouse, clicking on your character pops
up a menu of actions doable in that location. Basically this is
nothing new, as almost all of the same actions were done before
on the mouse click.

You can also pop up the context menu with the #herecmdmenu
extended command
2017-10-10 15:35:33 +03:00
Pasi Kallinen
69f7a78dba Hilite Status: Improved
Allow defining multiple stops per field. Add hitpointbar.
2017-09-26 10:04:25 +03:00
Pasi Kallinen
596bc64341 Add option to make commands ask an inventory item via menu
Turning the boolean option force_invmenu makes all the commands
that ask for an inventory item pop up a menu instead of asking
a text query.  This should be much more friendlier to new
players, and is very useful for window ports on systems
with touch screens and no physical keyboard, such as cell phones.
2017-09-23 22:47:14 +03:00
Pasi Kallinen
2db7e20116 Fix invisible gold symbol in status lines 2017-09-16 23:49:28 +03:00
Pasi Kallinen
2c688a12d5 Handle config file reading at single function
The function handles comments, empty lines, config sections,
CHOOSE, and line continuation, while calling another function
for other lines.

Currently used for config file, sysconf, and WIZKIT.
2017-09-13 12:27:38 +03:00
PatR
5710944258 address #H5590 - paranoid_confirm vs lycanthropy
Polymorph control gives the player a chance to accept or reject a form
change due to lycanthropy, but if it occurs during combat or movement
the player might type 'y' before realizing that the prompt is pending.
Provide a paranoid_confirmation setting for 'Were-change' to allow a
player to require "yes" instead of 'y' for that.

The existing setting 'wand' is renamed to 'wand-break' and now requires
at least two letters in the config file options instead of just 1.  The
spelling of its synonym is changed from 'breakwand' to 'break-wand';
it can be shorted to as few as 2 letters (same as before) but if more
than 5 are present, the new dash is required.

Both 'wand-break' and 'Were-change' are placed before 'pray' in the 'O'
menu for paranoid_confirmation so that all the "yes" vs 'y' settings
are grouped together.

Bonus fixes:
Reverting from were-critter form to human (due to timeout) did not give
a player with polymorph control the option of remaining in creature
form; now it does.
The 'O' command's menu would not show "wand" (now "wand-break") in the
current value of paranoid_confirmation.  (A post 3.6.0 issue, so no
fixes entry included.)

The revised Guidebook.mn has been tested; Guidebook.tex has not.
2017-09-12 04:14:44 -07:00
Pasi Kallinen
4e05de9bff Add whatis_moveskip option to change fast-moving cursor
Previously the "fast-moving" when getting a target location
was always by 8 units. If this option is on, fast-moving
will instead skip the same map glyphs. This should be much more
useful for blind players.
2017-08-06 15:41:31 +03:00
Pasi Kallinen
b13bae91dc Add way to cycle through valid locations for polearm or jump target 2017-07-31 19:10:26 +03:00
Pasi Kallinen
439028dcae Add whatis_filter option to filter eligible map locations for travel
Compound option whatis_filter, filters the eligible map locations
when getting a cursor location for targeting. Accepts 'n' (none),
'v' (map locations in view), or 'a' (map locations in the same area,
eg. room or corridor).
2017-07-31 16:58:23 +03:00
PatR
6a84840971 address #H5426 - inventory category selections
Report #5426 was classified as not-a-bug, but the underlying issue
can be improved.

For item selection where BUCX (bless/curse state) filtering is
supported (mostly for menustyle:Full, but there are a few actions
where Traditional and Combination handle BUCX too), 3.4.3 took the
union of object class and bless/curse state (so ?!B gave all scrolls
and all potions and every blessed item from other classes) but 3.6.0
changed that to the intersection (so ?!B gives blessed scrolls and
blessed potions, period).  Since gold is inherently not blessed or
cursed it has been getting excluded during intersection handling
when that includes BUCX filtering.  Report #5426 was from a player
who was used to choosing $X when putting newly acquired loot into a
container asking to have the old behavior reinstated.

The ideal fix would be to support both union ($ | X) and intersection
(?! & B), but implementation would be bug prone and the interface,
especially when done for menus, would be cumbersome.  Instead, this
adds new boolean option, goldX, to allow the player to decide whether
gold is classified as uncursed--even though it is never described as
such--or unknown.  The new-loot-into-container issued can be solved
either via $abcX, where abc lists all classes that have any X items
(when gold is included as one of the classes, its BUCX state is now
ignored for the current selection), or by setting the goldX option
and then just picking X for the types of items to put into the
container (or drop or whatever other action supports BUCX filtering).

The situations where menustyle:Full allows BUCX filtering during
object class specification and styles Traditional and Combination
don't should to be fixed (by extending BUCX support to Traditional
and Combination rather than removing it from Full, obviously).
2017-06-21 14:02:13 -07:00
PatR
dc8354bb1c iflags fields
A small amount of comment formatting in flag.h, plus rearranging
some of the boolean fields into alphabetical order.  I only touched
one section of struct instance_flags.
2017-06-14 15:24:45 -07:00
Pasi Kallinen
7d8b4d4f97 Add end-of-game dumplogs
This is based on the "new" dumplog patch for 3.6.0, by Maxime Bacoux.

Define DUMPLOG to enable. By default only enabled for the TTY linux.
2017-02-19 15:33:27 +02:00
Pasi Kallinen
c6f26c05d7 Accessibility: option to prevent status line updates
Apparently some screen readers keep reading the status lines
at the bottom of the screen when parts of those change.
Add an option to prevent updates to those lines.
2017-01-10 22:19:03 +02:00
Pasi Kallinen
abb4f0fab2 Allow toggling menu for any travel target list 2016-10-13 20:16:21 +03:00
Pasi Kallinen
552647fb36 Use more enums
We're already using enums, so convert some already existing defines.
2016-10-10 16:18:20 +03:00
Pasi Kallinen
efd7526194 Accessibility: Pick travel/cursor targets from a menu
Adds two new configurable keys to the cursor targeting: 'A' (getpos.menu)
and 'a' (getpos.menu.cansee). First one shows a menu of all interesting
glyphs on the map, second one shows only those in sight.

Travel command also now obeys the "request menu" -prefix, showing
the menu with interesting targets in sight, and then traveling there.

Idea via the NetHack accessibility research by Alexei Pepers.
2016-10-06 13:10:13 +03:00
Pasi Kallinen
680c8a542c Add key rebinding
This is a modified version of Jason Dorje Short's key rebinding
patch, and allows also binding special keys, such as the ones
used in getloc and getpos.

One of the ways to play NetHack on nethack.alt.org is via a HTML
terminal in browser. Unfortunately this means several ctrl-key
combinations cannot be entered, because the browser intercepts
those. Similar thing applies to some international keyboard layouts
on Windows. With this patch, the user can just rebind the command
to a key that works best for them.

I've tested this on Linux TTY, X11, and Windows TTY and GUI.
2016-10-05 20:04:56 +03:00
Pasi Kallinen
28e36b3136 Add full compass coordinate mode for screen readers 2016-09-20 18:36:06 +03:00
Pasi Kallinen
f82205c232 For travel target location, report if no known travel path
Yet another accessibility feature.  When asked for a location
to travel, and autodescribe is on, the location description
has "(no travel path)" appended, if there is no known path
to that location.
2016-08-31 22:08:15 +03:00
PatR
805f7c5644 fix #H4418/#H4419 - #tip of gold inside shops
The #tip command tries to reduce verbosity by formatting drop messages
with just the object name instead of with full sentences, yielding
  Objects spill out: obj1, obj2, obj3, ..., objN.
where the trailing comma or period is included with each successive
object.  If an intervening message occurs, such "25 zorkmids are
added to your credit", the rest of the objects will no longer be
extending the original sentence and end up looking silly.
  Objects spill out: obj1, obj2,--More--
  25 zorkmids are added to your credit.  obj3, ..., objN.
This fix causes the post-interruption messages to revert to verbose
format.
  Objects spill out: obj1, obj2,--More--
  25 zorkmids are added to your credit.--More--
  obj3 drops to the floor.--More--
...
  objN drops to the floor.

The interrupting message still follows the comma of the partial
sentence, but I don't see any sane way to fix that other than to
abandon the terse format altogether, and doing that makes #tip way
too verbose when the container has a lot of items in it.  But #tip
inside shops now does that, since there will always be buy/not-
interested feedback interrupting the terse format in that situation.
For other situations, a full sentence message might end up following
a partial sentence list of dropped items.

There was a more significant bug.  Dropping a hero-owned container
with gold in it onto shop floor sold the gold to shk, giving hero
credit.  Subsequent #tip gave the hero credit for that same gold
when it spilled out.  addtobill(obj) relies on obj->ox,oy to
determine whether events are taking place in a shop, and #tip was
relying on placement onto floor to set those, too late for shop
billing.  The fix yields suboptimal results:  you're given credit
when you drop the container, then during #tip when you spill the
contents, credit for the gold is removed, then new credit for it
is given.  That's down to shop insanity, not tipping behavior.
2016-06-27 17:20:28 -07:00
PatR
894d6c6859 detection revamp
Change most instances of detection to offer the player a chance to
move the cursor around on the map so that the getpos() autodescribe
feature can explain things that might go away as soon as the
current detection completes.  The few instances that don't offer
such a chance are the ones where everything which has been revealed
will still be there once the action finishes (such as regular magic
mapping and blessed/persistent monster detection).

There were quite a lot of inconsistencies in things like handling
for detection while swallowed or underwater.  I didn't keep track
of them to distinguish between 3.6.0, current dev code, or my patch
in progess.  They should be much more consistent now but without a
comprehensive fixes36.1 entry.

Blessed clairvoyance (divination spells at skilled or expert) now
shows monsters as well as terrain.  I first had it like that for
any clairvoyance, but having getpos/autodescribe kick in every 15
or 30 turns once you have the amulet--or pay the appropriate amount
to a temple preist--was nearly unplayable.  When it only follows an
explicit spell cast it is not intrusive.
2016-06-02 01:08:34 -07:00
PatR
4ce52dc07f iflags.save_uswallow
Some groundwork for detection enhancements.

you.h  - just formatting
flag.h - add iflags.save_uswallow so that u.uswallow manipulation ...
save.c - ... can be undone if a hangup save occurs
2016-06-01 05:58:22 -07:00
PatR
cb14aa332d number_pad:-1 qwertz keyboard
Reported almost exactly one year ago by a beta tester proofreading
the Guidebook, the number_pad setting to support the German keyboard
which swaps the Y and Z keys is for a keyboard that is used in other
places too.  The report mentioned France and Belgium; Wikipedia's
"keyboard layout" entry mentions "Germany, Austria, Switzerland and
other parts of Central Europe".  This changes references to "German
keyboard" (there were only a couple) into "QWERTZ keyboard".
2016-05-27 18:39:17 -07:00
PatR
dccc818801 autodescribe for #terrain
Requested during beta-testing however long ago:  want a way to
look at specific map locations while #terrain is showing them
without monsters and/or objects and/or traps being displayed in
the way.  The post-3.6.0 autodescribe feature for getpos() made
this pretty easy to achieve, although the lookat() aspect felt
more like trail-and-error than careful design.

Instead of putting up a --More-- prompt, ask the player to pick
a location with the cursor.  Moving the cursor gives the terse
description for every location traversed.  Actually picking a
spot just ends #terrain and goes back to normal play.
2016-05-12 18:57:10 -07:00
PatR
b98427955c complicate #vanquished monsters processing...
...to make it more interesting.  Using #vanquished in wizard mode
or answering 'a' to the "disclose vanquished monsters?" prompt will
put up a menu to choose how the list of vanquished monsters should
be ordered.  Right now there are 6 choices:

  Traditional: by monster level, by internal index within level;
  by monster toughness, by internal index within monstr[] rating;
  alphabetically, first unique monsters, then others;
  by monster class, low to high level within class;
  by count, high to low, by internal index within tied count;
  by count, low to high, by internal index within tied count.

Two other orderings are implemented but suppressed from the menu
since they seemed uninteresting (alphabetical with uniques
intermixed with other monsters, and by-class high to low within
class).  The first two are very similar to each other and one of
them should probably be discarded too.  The by-class order(s) have
class-name separator lines between classes.

Options parsing for end of game disclosure has extended current
  +v (always show vanquished monsters)
  -v (never show vanquished monsters)
  yv (prompt about them, with default response 'y')
  nv (prompt about them, with default response 'n')
to include
  #v (always show vanquished monsters and choose the ordering)
  ?v (prompt about them, with default response 'a' to choose ordering)

The 'a' response was picked because it's easy to use ynaq()
instead of ynq(), but it can be considered to mean "ask about sort
order".  (Neither of the two new option values could be "av"; 'a'
for disclosing attributes would become ambiguous.)

+v or answering 'y' for any of yv, nv, or ?v uses the most recent
sort ordering (if #vanquished has been used in wizard mode) or the
traditional one (normal mode, or #vanquished not used).  Players
will probably want to specify a default order and then use +v
rather than choose the final order from a menu.  That hasn't been
implemented here.  Count high to low might be a better default than
level high to low.

While looking through Guidebook.tex to try to determine whether
the new text needed special handling, I spotted multiple mistakes
in the existing text.  Probably all from earlier updates of mine;
this attempts to fix them.  As usual of late, Guidebook.mn has been
tested and Guidebook.tex hasn't.
2016-05-03 01:12:32 -07:00
PatR
a0a4408957 flags.sortloot tweaks
flags.sortloot was changed from boolean to xchar, but proper type
is plain char.  (Presumeably it was originally off or on, then got
changed to 'n' for off, 'l' for on, plus 'f' for super-on.)

Also, make the sortloot menu for 'O' mark the current value as
preselected when interactively setting the value.  (I've been
meaning to do this for various other options but haven't gotten
around to it.  The need to workaround PICK_ONE+MENU_SELECTED menu
behavior is a nuisance.)
2016-04-19 14:40:59 -07:00
C.W. Betts
41ade6d37d Change flag::sortloot to xchar
When typedefed to C99's bool type, Clang complains in container_contents about "comparison of constant 108 with expression of type 'boolean' (aka 'bool') is always false".
2016-04-14 14:04:22 -06:00
nhmall
78857961d2 some of Ray Chason's MSDOS and other fixes 2016-03-05 14:44:50 -05:00
PatR
2e2b54e548 overriding message suppression, revisited
This is more robust than the previous hack.  The issue of whether to
use it in other places is still unexplored.  Ultimately it's the user's
fault if overzealous message suppression hides something important.
[For an eerie game, try 'MSGTYPE=hide .'.]
2016-01-19 18:16:13 -08:00
PatR
0544b998de fix #H4028 - ':' sometimes doesn't work
User had
MSGTTYPE=norep "You see here"
and complained that once the message had been given while walking
over an object, using ':' to intentionally look at something would
end up doing nothing if its feedback was a repeat of "You see here".

Trying to classify which actions should deliberately override
no-repeat (or no-show) will be an ordeal.  This fixes the case for
the ':' command where the user obviously expects feedback.  I think
it could be done better but am settling for something quick and easy.
2016-01-19 07:13:18 -08:00
PatR
83a4234292 whatis_coord - rename 'getpos_coord' option
Rename the option for adding coordinates to autodescribe feedback for
the '/' and ';' commands from 'getpos_coord' to 'whatis_coord', after
the '/' command that uses it instead of after the internal routine
that implements it.  The 'whatis' name was only in dat/hh as far as I
could find, so this changes it to 'what-is' and also updates dat/help
and the Guidebook to mention the name too.

Add a 'screen' choice to the option to show coordinates as row,column
rather than x,y or compass direction(s).  Revise the /m, /M, /o, /O
operations of 'what-is' to honor the whatis_coord option (mostly; a
value of 'none' gets overridden by 'map' to force coordinates).

Also, update the description of the functionality of the '/' command
in the Guidebook.  The .mn version is tested, the .tex one isn't.
2016-01-18 19:27:53 -08:00
Pasi Kallinen
c49490dfd4 Rename getpos_coord values to "compass" and "map" 2016-01-13 12:21:27 +02:00
Pasi Kallinen
0ee5d8ce47 Add getpos_coord option
Allows showing the coordinate when picking a position on the
map with '/' and autodescribe is on.

This is another blind player request
2016-01-11 21:10:51 +02:00
Pasi Kallinen
e7d65a44cd TTY: Add compile-time option for tile data hinting
Several people have asked if 3.6.0 supports playing with tiles on
a public server. Because there's no way for the user's end to know
what that white @ is, this adds special console escape codes for
tile hinting.

The idea was originally a patch called TelnetTiles by Justin Hiltscher,
but this expanded version comes via NAO, where it's been in use for years.

This is basically an interim hack, which should go away when/if
we support actual client-server model.
2016-01-10 10:53:15 +02:00
Pasi Kallinen
befc6a65b5 TTY: Add menu_overlay option
This was a request from a blind player.  It's hard to find
the left edge of the menu when it's drawn on the map, so
clear the screen and align menus to the left edge of the screen
when this option is turned off.

Originally this was called the window edge patch.
2016-01-08 22:17:40 +02:00
nhmall
c70d466325 wizweight optional
Changes to be committed:
	modified:   include/flag.h
	modified:   include/hack.h
	modified:   src/objnam.c
	modified:   src/options.c
2016-01-01 16:17:46 -05:00
Pasi Kallinen
929be769ec Add option to have autodescribe on by default 2015-12-16 21:42:43 +02:00
Pasi Kallinen
66dd87454b Comment typofixes, pt 3 2015-10-17 13:47:25 +03:00
Pasi Kallinen
d9bc2fb621 Add paranoid option for breaking a wand
Add OPTION=paranoid_confirm:wand to prevent accidental
wand breaking - suggested by scorchgeek
2015-09-27 19:13:20 +03:00
nhmall
5df350d548 separate option to toggle hilite_pile
Beta tester report.

The use of use_inverse meant that you couldn't selectively
choose to hilite pets but not piles. Add its own option.
2015-06-22 15:51:43 -04:00
nhmall
b33c3381e6 update master's version of display.c
Incorporate a few pieces of in-progress code into master
so that it isn't left in an odd state, thus prompting
patches.
2015-06-16 06:23:28 -04:00
nhmall
00d25adab2 actual field is always around anyway
Changes to be committed:
	modified:   include/flag.h
2015-06-10 20:48:29 -04:00
nhmall
66ae23a77e option name change to statushilites
Changes to be committed:
	modified:   doc/Guidebook.mn
	modified:   doc/Guidebook.tex
	modified:   include/flag.h
	modified:   src/options.c
	modified:   win/tty/wintty.c

example:
OPTIONS=statushilites
OPTIONS=hilite_status:hitpoints/30%/bright-magenta/normal
2015-06-01 22:30:04 -04:00
nhmall
ca8f25d4b6 more updates and on/off option 2015-06-01 08:33:17 -04:00
Pasi Kallinen
773eecc472 Rename omit_buc option to implicit_uncursed
... so the name is less cryptic.
2015-05-27 20:43:22 +03:00
Pasi Kallinen
5fabcdf692 Add omit_buc -option
The option defaults to on, which is the old-style behaviour.
Turning the option off will never omit the "uncursed" -status
from inventory lines. This is pretty much required if users
want to use menucolors based on the BUC state.
2015-05-27 12:46:35 +03:00
Sean Hunt
1c081b1647 Remove stale version control lines. 2015-05-25 09:21:31 +09:00
Sean Hunt
8b57d96fd2 Reformat .h files.
I did my best to exempt some of the bigger aligned blocks from the reformatting
using the /* clang-format off */ and /* clang-format on */ tags. Probably some
that shouldn't have been formatted were anyway; if you encounter them, please
fix.

The clang-format tags were left in on the basis that it's much easier to prune
those out later than to put them back in, and it means that, modulo my custom
version of clang-format, I should be able to run clang-format on the source tree
again without changing anything, now that Pat has fixed the VA_DECL issues.
2015-05-25 09:21:15 +09:00
nhmall
20069798d4 Merge branch 'master' into win32-x64-working 2015-05-07 04:52:30 -04:00