Commit Graph

1152 Commits

Author SHA1 Message Date
PatR
c8aa84337b revise X11 highlight yn prompting
The three line change I made previously to implement highlighting for
prompts that ask for single-character input was easy and worked well
for a tiles map, but it didn't look very good for a text map.  This
handles both text map and tile map and also adds a configurable
'highlight_prompt' X resource to let the user enable or disable the
feature.  The resource template file (win/X11/NetHack.ad, copied to
$HACKDIR during install) now has it enabled by default.

The highlighting--more specifically, the "lowlighting" when no prompt
is active--still looks bad if the map window has a vertical scrollbar
on left edge.  I don't have any inspiration about how to fix that up.
2016-02-08 16:32:07 -08:00
Pasi Kallinen
fe006b9c0a Add CHECK_PLNAME to sysconf
Setting CHECK_PLNAME to 1 makes WIZARDS, EXPLORERS, and SHELLERS
check the player name instead of the user's login name.

This is mostly useful for public servers which have external
login system and don't create user accounts for players.
2016-02-05 20:39:17 +02:00
Pasi Kallinen
0ca477486d Unify putting a saddle on steed 2016-02-05 17:23:22 +02:00
PatR
ca3ccdd5ab lint cleanup to pacify gcc
I upgraded from OSX 10.5.8 via 10.6.3 to 10.6.8, plus Xcode to whatever
version was on the 10.6 dvd, and ended up with a more recent version of
gcc that is configured to use 64 bit longs and 64 bit pointers (by
default; presumably that can be changed if necessary).  It triggered
several warnings about converting int to pointer of different size or
vice versa even when explicit casts were in use, and a couple of other
things.
2016-02-03 23:39:24 -08:00
PatR
6591f8beb1 fix #H4094 - shopkeeper "it" message
Most shop messages use shkname() to give the shopkeeper's accurate
name (or hallucinatory substitute) even if he or she can't be seen.
stolen_value() was using mon_nam(), which calls shkname() if the
monster is a shopkeeper who can be seen, but produces "it" when not
seen.  Change it to use shkname() like the rest of the shop routines.
Also, replace Monnam() (quite a few instances) with new Shknam() to
do the same duty when the name is at the start of a sentence.

There was also a very obscure bug where if you could see two
shopkeepers at the same time, you could probe the map one spot at
a time with repeated use of the 'p' command to locate monsters in
general and other shopkeepers in particular.  Very tedious and not
very useful, but now fixed.
2016-02-02 23:44:58 -08:00
PatR
64112c8464 X11 memory management
The big memory allocation for tiles that was unfreed according to
heaputil was actually freed by X according to a comment in the code.
But free it explicitly for #if MONITOR_HEAP so that the alloc/free
tracking stays accurate.

Also, the cached extended commands menu was not being freed, so take
care of that.  I wasn't sure where to handle it; I ended up making it
happen when the map window is torn down.
2016-02-02 15:19:31 -08:00
PatR
54325de339 fix bz16 - book becoming cursed while being read
Attempting to read a cursed spellbook fails with a nasty effect.  But
a non-cursed book can become cursed while being read (malignant aura
after Wizard has been killed).  Assuming no interruption for other
reasons, the read would finish, the spell be learned, and then the
nasty effect would be given.  This changes things so that if the book
being read becomes cursed and the hero notices (book's bknown flag is
set), the read-in-progress will be interrupted.  Resuming will take
the attempting-to-read-a-cursed-book path.  Unfortunately, if the
hero doesn't notice, the old behavior still applies.  Maybe the new
behavior should happen even if bknown isn't set (but then player
won't be told why the interruption occurred).
2016-01-31 18:22:31 -08:00
PatR
757c51bb3c X11 menus - support pre-selected menu entries
X11 had been ignoring add_menu(..., MENU_SELECTED) to specify a
pre-selected menu entry.  This adds support for that.

Attempt to implement pre-selected entry for PICK_ONE menu sanely by
returning the pre-selected entry instead of toggling it off if the
user chooses it explicitly.   Inner workings of menus are convoluted
so I'm not sure it's 100% correct, although testing hasn't found any
problems.  (tty currently returns 0 for "nothing picked" when
explicitly picking a pre-selected entry in a PICK_ONE menu, and the
core jumps through hoops to handle it.  That can't be cleaned up until
all interfaces which support pre-selected entries achieve sanity.)

Make "random" be chosen for <return> or <enter> during role selection
and highlight it to reflect that.  (Role selection for X11 uses its
own code instead of nethack menus, so pre-selection isn't applicable.)
2016-01-30 19:39:29 -08:00
PatR
b632247a74 revisit #H4083 - glob ID and merging
Globs on the floor used different criteria (anything goes) than globs
in inventory (mostly requiring same ownership when in shops and same
curse/bless state--other stuff generally isn't applicable) when
deciding whether two globs should merge.  That was okay as long as
the globs on the floor were from being left behind when a pudding or
ooze was killed, but not if the player had picked some up, dipped
them in holy or unholy water, and dropped them again.  This changes
things so that globs on the floor use the same criteria as globs in
inventory when deciding whether to coallesce.

Also, my earlier fix was modifying globs in the mergeable() test (to
make bknown and rknown match) rather than during actual merge, which
would be a problem if the merger didn't take place for some reason.
2016-01-28 18:13:25 -08:00
PatR
7e86003367 tty role selection - 'random' default
Instead of just using 'random' as the default choice if the user hits
<return> when picking role, race, gender, or alignment, flag it as
pre-selected in the menu so that it can be seen to be the default.

Someday somebody is going to have to fix up the interaction between
PICK_ONE menu and pre-selected choice....
2016-01-22 18:09:05 -08:00
PatR
fca2f74134 X11_getlin() missing winX.h diff 2016-01-21 23:26:00 -08: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
04bc048073 Limit aggravate to inside or outside of the Wizard's tower
There have been several comments on IRC how the Wizard is a very
light sleeper now; aggravate cast by monsters makes him wake up
and come out of the tower.  So, lets limit aggravate to either
outside or inside of the tower, depending on which side the player is.
2016-01-16 09:45:12 +02:00
PatR
cd2f4ac225 another status bit
Accept four digits for spell power rather than hide the amount
exceeding 999.
2016-01-15 21:05:58 -08:00
PatR
fa20ef382d status line update
Adding deafness to the status line spurred me on to something I've
wanted to do for a long time.  This adds 'Stone' and 'Strngl' as
new status conditions, and moves the five fatal ones: "Stone Slime
Strngl FoodPois TermIll" to the front of the status list since
information about them is more important than any of the others.
"Ill" has been renamed "TermIll"; "Df" has been renamed "Deaf";
"Lev", "Fly", and "Ride" are three additional new conditions, with
Lev and Fly being mutually exclusive.  After the fatal ones, the
order of the rest is now
<hunger> <encumbrance> Blind Deaf Stun Conf Hallu Lev Fly Ride

To handle the longer potential status line, the basic bot2() is now
smarter.  If the line is wider than the map, 'T:moves' is moved from
the middle to the end.  If the line without time is still wider than
the map, then experience (HD if polyd, Xp:M/nnnnnn is showexp is on,
or Exp:M) is moved in front of time at the end.  If the line without
experience and time is still wider than the map, dungeon level plus
gold is moved from the beginning to be in front of experience.  The
fields are just reordered, not truncated, so if the interface code
can display lines wider than the map they'll retain the extra info.
The gist is than health and associated fields (Hp, Pw, Ac) get first
priority, status conditions get second priority, then the rest.  In
the usual case where there aren't many conditions, status display is
the same as it has been in the past.

STATUS_VIA_WINDOWPORT has been updated too, and it builds for tty
and X11.  But the bot2() revision to reorder sections has not been
implemented for that.

win/win32/mswproc.c has been updated but not tested.

STATUS_VIA_WINDOWPORT without STATUS_HILITES had several compile
problems; now fixed for core and tty.  STATUS_VIA_WINDOWPORT with
STATUS_HILITES has not been tested.
2016-01-13 19:13:10 -08:00
Pasi Kallinen
1dd37b7fca Make status hilites use same color string matching as menucolors 2016-01-13 20:27:21 +02:00
Pasi Kallinen
c49490dfd4 Rename getpos_coord values to "compass" and "map" 2016-01-13 12:21:27 +02:00
nhmall
32a4859e5b show deafness indicator on status line
May as well show a deafness indicator.
2016-01-12 23:43:28 -05: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
854fe40609 Fix bz175: Pile mark is shown when potion is destroyed
Original bug report:

> When killing something that's carrying a potion, or death-drops a potion,
> or stands on top of a potion, with a force bolt or a wand of striking,
> "you hear something shatter" or "a potion of foo shatters" but the corpse
> is inverse as if it's (still) a pile.

Unfortunately the newsym() checks for already existing glyph, and
the gbuf doesn't distinguish between object piles and single items,
so newsym doesn't mark the location for update.

This is a dirty hack to force the newsym to update the glyph.
The glyph buffering should be revisited in a future version.
2016-01-10 18:33:41 +02:00
Pasi Kallinen
65d780dc3d Add compile-time option MSGHANDLER
This was a feature request from a blind player; he wanted to
play a sound whenever a pline message was given.
2016-01-10 13:08:20 +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
PatR
db234f743d integrate 'msgtype' option and Norep()
Allow 'msgtype=show' for messages that nethack uses Norep() for.
I don't know whether anyone will ever want to do that, but if felt
strange to have two different message suppression mechanisms that
were completely disconnected from each other.

For a user with no msgtype filter, there'll be no difference in
behavior.
2016-01-08 00:38:34 -08:00
PatR
c8cd550a5a get_count() cleanup
Fix several warnings.  Accept ASCII RUBOUT (aka DELETE) in addition
to backspace.  [Should use erase_char (and add support for kill_char)
but that means pushing get_count() into the interface code.]  Guard
against user causing the count to wrap if someone ever adds a call to
get_count() which doesn't specifying a maximum value.
2016-01-06 15:37:46 -08:00
Pasi Kallinen
c740425a90 Use define for iron ball weight increment 2016-01-06 16:23:48 +02:00
Pasi Kallinen
237c4a2787 Allow dissolving iron bars with potion of acid
Force-fight iron bars with wielded potion of acid to dissolve them

This change comes via UnNetHack by Patric Mueller.
2016-01-06 15:49:06 +02:00
Pasi Kallinen
4c016853d4 Unify getting a count into single function 2016-01-06 13:54:09 +02:00
Pasi Kallinen
4aeb2913cf Only requiver pickup_thrown ammo and throwing weapons 2016-01-06 04:58:37 +02:00
Pasi Kallinen
f314fe87bd Fix unmapped branch stairs on premapped levels
This happens when levelporting to the first Sokoban level in wizard mode
before visiting the level, causing the branch stairs to not appear until
the space it is in comes in sight of the player.

The issue was that levels flagged premapped would cause the special
level coder to call sokoban_detect() before fixup_special() had a chance
to place the branch stairs properly.

Fix from Dynahack by Tung Nguyen.
2016-01-06 03:35:58 +02:00
Pasi Kallinen
db4120012d Make mimics mimicing walls or trees also block light 2016-01-06 01:44:18 +02:00
PatR
e8e1673df7 build fix for ck_server_admin_msg()
ck_server_admin_msg() is only available for '#if (UNIX && MAIL)' but
moveloop() tried to call it unconditionally.  Call if from the UNIX
edition of ckmailstatus() instead.
2016-01-04 16:51:24 -08:00
Pasi Kallinen
e9b0fa23d2 Add server admin messaging functionality
It's occasionally important for public servers to notify
all the players. Sending a mail is not reliable, as not everyone
wants to break conduct, or have mail on.

This adds a compile-time defined filename, which NetHack
will monitor. The contents of the file are in the same
format as SIMPLE_MAIL: "sender:message" on one line.
2016-01-04 23:04:59 +02:00
Pasi Kallinen
89e4d5e9fa Add SIMPLE_MAIL compile-time option for public servers 2016-01-04 19:54:36 +02:00
Pasi Kallinen
34b45a2c10 Add an alternative paniclog format as compile-time option 2016-01-04 18:05:16 +02:00
nhmall
c4d45d6960 make some mextra guard macros available
Changes to be committed:
	modified:   doc/fixes36.1
	modified:   include/mextra.h
2016-01-03 10:48:47 -05:00
Pasi Kallinen
cb574aadcc Split wallification into two by function 2016-01-03 00:36:36 +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
nhmall
fff3425de4 Happy New Year 2016
Changes to be committed:
	modified:   include/patchlevel.h
2015-12-31 17:26:25 -05:00
Pasi Kallinen
7be8e1f8bb Another tiny formatting fix 2015-12-30 17:41:48 +02:00
Pasi Kallinen
e29c21f367 Tiny formatting fix 2015-12-30 17:29:44 +02:00
PatR
901317f57c force TIMED_DELAY for OSX
Outputing extra characters to induce a delay is useless on OSX, so set
TIMED_DELAY by default instead of relying on user to do it.
2015-12-28 14:35:23 -08:00
Pasi Kallinen
a5ed69288f Split get_rnd_toptenentry from tt_oname 2015-12-28 18:06:48 +02:00
nhmall
6117eddc62 one statue from single vampire via cockatrice corpse
Changes to be committed:
	modified:   doc/fixes36.1
	modified:   include/extern.h
	modified:   src/mon.c

Fixes H4148 (bz246) and H4150 (bz248)

comments:
I wielded a c-corpse against a shapeshifting vampire bat (checked with a
stethoscope, it said "shapeshifter".) The bat turned to stone and spawned a
vampire.  I hit the vampire and it also turned to stone, so I had two statues
from one monster (vampire bat and vampire.)  Not sure if this is a bug or a
feature...

comments:
Engulfed by a fog cloud that was actually a Vampire,
and got the message: "You break out of the vampire!"
2015-12-26 19:08:08 -05:00
PatR
c4a9d6a45c newline handling
In light of the recent 'bad options' feedback issue where \r messed
up message display, try to to make newline handling be more consistent.
I'm sure there are lots of places that still handle \n manually, but
it's a start.
2015-12-25 21:54:01 -08:00
PatR
1c80503938 fix #H4146 - more enlightenment vs drain resistance
Duplicate of another recent report as far as drain resistance from
Excalibur/Stormbringer/Staff of Aesculapius not being shown by
enlightenment goes, but this one mentioned that it also wasn't being
shown for lycanthropy.  Being inflicted by that does confers level-
drain resistance.  were_change() wasn't calling set_uasmon() since
it isn't changing youmonst.data, but set_uasmon() is were intrinsics
conferred by creature form are set up.  So call it when changing
were-form.  Direct access to u.ulycn wasn't calling it either, so add
a new routine to assign the value to that instead doing so directly.
2015-12-25 16:46:02 -08:00
Pasi Kallinen
69e7f4e29b Allow defining symbols with OPTIONS
Some people are confused by the boulder -option, and
SYMBOLS=S_boulder, so allow defining symbols with
OPTION-lines in addition to the SYMBOLS.

So these are the same thing:

  SYMBOLS=S_boulder:0
  OPTIONS=S_boulder:0
2015-12-24 12:33:17 +02:00
Pasi Kallinen
9a2eb370e7 Make travel consider traps like closed doors
Test case: U-shaped corridor, with a known trap in it.
Before this change, travel would try to move straight at
the target, bumping the wall or walking into a dead-end.
After this, travel will go along the corridor and then stop
right before the trap.

Original patch via AceHack by Alex Smith.
2015-12-21 17:36:14 +02:00