Commit Graph

708 Commits

Author SHA1 Message Date
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
Pasi Kallinen
a309e076e0 X11: Attach translations also to menuform
Without this, the keyboard commands don't work in the extended
command window on Linux. If the translations are removed from
menuformview, then the keyboard commands don't work on Mac.

Having the translations in both doesn't seem to hurt.
2016-01-28 19:44:33 +02: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
0226c904fa X11 menus
Make the six buttons (ok, cancel, all, none, invert, search) on
menus for X11 all have the same width.

'ok' should probably be changed to 'okay' to be consistent with
X11_getlin().  (Another inconsistency:  the extended commands
menu uses 'dismiss' rather than 'cancel'.)
2016-01-21 23:47:42 -08:00
PatR
2bf652dd0f X11_getlin()
Two cosmetic changes for the X11 version of the getlin() routine:
1) Make the text entry box big enough to hold 60 characters before
   sliding the beginning input off the left edge, instead of just 13,
   so that user can see much more of what is being typed;
2) Make the cancel button be a little wider, and the okay button be
   the same width as the cancel button so they look a little nicer.
2016-01-21 23:13:49 -08:00
Pasi Kallinen
d06450817b X11: autoscroll extended command menu
When you type in the extended command menu to select a command,
scroll the window so that the selected command is always in view.
2016-01-17 13:55:13 +02:00
Pasi Kallinen
06aedee513 X11: Match new extcmd immediately if no match was found
When entering an extended command, allow the user just type
and match a new command immediately, if no match was found,
instead of needing to wait the 2.5 seconds.
2016-01-16 19:05:30 +02:00
PatR
6d53aaa6ff more new status - X11 'fancy' status
Update X11's status display to include the expanded set of status
conditions.  This time the order is
 Petrifying   <hunger>       Blind
 Slimed       <encumbrance>  Deaf
 Strangled    Levitating     Stunned
 Food Pois    Flying         Confused
 Term Ill     Riding         Hallucinating
with the application defaults file specifying red text for the first
column and black for the other two.  Previously it was all one column
with seven entries.  [Slimed was missing along with the six new ones
(deaf, stone, strngl, lev, fly, ride) and both types of sickness were
shown as 'FoodPois' or 'Ill' or 'FoodPois Ill' on one line.]

So now basic bot2, #if STATUS_VIA_WINDOWPORT genl_status_update, and
#if !STATUS_VIA_WINDOWPORT X11 fancy status have three different
orderings.  genl_status_update has hunger and encumbrance first
because all the other status conditions are grouped together as one
bitmask item.  bot2 has 'lev', 'fly', 'ride' last so that they're
the first things to be sacrificed if the string of status conditions
ends up being truncated.  (genl_status_update also has those last.)

In addition to updating status conditions, I reordered the Hp, Pw, &c
section too so that it's closer to tty in organization.
 Hit points    Maximum HP
 Power         Maximum Power
 Armor Class   Alignment
 Exp.Level     Exp.Points      (if 'showexp')
 Gold          Moves           (if 'time')
 Score                         (if 'showscore')
I didn't have SCORE_OR_BOTL set so haven't seen the last one, but
it's in the same position as it was before.
2016-01-15 20:56:12 -08:00
nhmall
2a0c69700f win32gui menu color attribute fix
from Alex Kompel...
2016-01-14 23:02:09 -05:00
nhmall
52b8139a4b Merge branch 'win32-guitty' into NetHack-3.6.0 2016-01-14 19:07:48 -05:00
Alex Kompel
f83e09e4ab win32_gui: fix inventory window visibility when perm_invent is set in game 2016-01-14 08:15:56 -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
PatR
a34d327159 bit of X11 reformating
Cleanup up the copyright notice in dialogs.c, and replace some tabs.
2016-01-12 02:20:43 -08:00
PatR
c5db7f57a3 X11 extended command menu
Restore the ability to select extended commands by keystroke.
The key translation stuff had gotten attached to the wrong widget.

When using keys to highlight an entry in the extended command menu,
don't reset the key-by-key handling so quickly.  (On second and
subsequent keystrokes, if you waited more than 0.5 second, the new
key started picking an extended command from scratch rather than
continuing the current one, making it pretty hard to disambiguate
commands which have the same initial letter.  Now the delay
threshold is 2.5 seconds.  In theory that should become a user-
preference resource but I don't think it's worth the effort.)

Display the help choice in response to '?'.

Clean up the formatting of the top two buttons (dismiss + help).

Start with a scroll bar if the menu is too big to fit on the screen.
Prior to this, on OSX, the full menu would be constructed but any
of it that was 'displayed' beneath the bottom of the screen was
inaccessible because it couldn't be dragged higher and couldn't be
resized to get a scroll bar (since the way to resize on OSX is by
dragging the bottom right corner--which was off the screen).

The problems I mentioned recently are still present:  when scroll
bar is present, I can click beneath it and it moves down, but
neither dragging it up nor clicking above it will move it back up.
Fortunately the recently implemented up and down arrows both work,
even after clicking/dragging starts failing.

There was a lot of trial and error involved here.  Most of it
eventually got phased out, but the mystery of 'defaultDistance'
(which is reported to be 0 but is actually 4) remains.  The screen
height stuff at the end ought to be fixed up if someone can figure
out how to get the width of a horizontal scroll bar or the height
of a title bar.  (I'm sure I used to know how to do the latter,
but that was 25 or so years ago, and in Fortran with Xlib rather
than Xt or Xaw....)
2016-01-12 02:15:35 -08:00
Alex Kompel
da95cccc44 win32_gui: cycle accelerator letters on large menues 2016-01-11 20:54:59 -08:00
nhmall
7e52c605a9 Merge branch 'NetHack-3.6.0' into win32-guitty 2016-01-11 18:35:50 -05:00
Pasi Kallinen
a8172e1208 Fix unreferenced variable 2016-01-10 18:24:38 +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
3516f1b8db Merge branch 'NetHack-3.6.0' into win32-guitty 2016-01-06 20:59:50 -05:00
PatR
e6fa0ce809 provisional fix for bz239 - '[tty] Enter key...'
'... inconsistency in character creation menus'.

During role selection, the final 'is this ok?' menu has 'yes'
preselected so accepted <return> or <enter> to answer yes.  The
pick-role, pick-race, &c menus prior to getting to that stage didn't
have a default, so using <enter> meant nothing was chosen, and choosing
nothing was treated as a request to quit.  This changes that so it's a
request for 'random' instead.

'Provisional fix' because it ought to do this by making 'random' be a
pre-selected menu entry so that the default choice is visible.  But
that takes more effort than I'm inclined to expend on this.
2016-01-06 00:07:54 -08:00
Alex Kompel
c4bf762ec1 win32_gui: mimic tty interface when "Nethack mode" is selected (remove window features) 2016-01-03 19:52:05 -08:00
nhmall
14ce76a159 windows visual studio 2013 build updates 2016-01-01 22:01:25 -05:00
Pasi Kallinen
8b0ada1d31 Allow scrolling X11 extended cmd menu with cursors 2016-01-02 00:47:10 +02:00
Pasi Kallinen
8e7e79448e Enable scroll bar in X11 menu windows 2016-01-01 21:24:55 +02:00
nhmall
9a5340a3bf windows: fix undefined reference in release build
Changes to be committed:
	modified:   win/win32/mswproc.c
2015-12-31 20:26:47 -05:00
nhmall
5964438e8f use explicit int sizes in win/share/tile2bin.c
64-bit longs caused tile2bin to write an invalid bmp file.
2015-12-29 21:21:05 -05:00
PatR
c5e2604cca still more while-helpless 2015-12-18 07:42:23 -08:00
PatR
8f2a408ef3 fix #H4065 - unnecessary role select confirmation
If player specified all four facets of role:  role, race, gender, and
alignment, via command line or option settings, the tty interface still
asked the player to confirm whether the character's role/&c was ok?
Skip that confirmation when all four things have already been chosen.
2015-12-17 06:37:08 -08:00
PatR
92858c3e3c more menu <space> screwup
Like the just fixed naming for discoveries list, there are several
other add_menu() calls which specify <space> instead of 0 as a useless
selector on separator lines.  These others are all for role selection,
where menus don't get big enough to need next-page.

I don't know what I was thinking at the time, although it must have
seemed like a good idea for some reason....
2015-12-16 18:42:45 -08:00
nhmall
fa092f5fe9 housekeeping for 3.6.1
Changes to be committed:
	modified:   Files
	modified:   README
	modified:   dat/history
	modified:   doc/Guidebook.mn
	modified:   doc/Guidebook.tex
	modified:   include/global.h
	modified:   include/obj.h
	modified:   include/patchlevel.h
	modified:   src/invent.c
	modified:   src/objnam.c
	modified:   src/shknam.c
	modified:   src/sounds.c
	modified:   src/spell.c
	modified:   sys/winnt/Install.nt
	modified:   sys/winnt/nethack.def
	modified:   win/macosx/NetHackGuidebook.applescript
	modified:   win/macosx/NetHackTerm.applescript
	modified:   win/win32/mswproc.c
2015-12-16 17:52:34 -05:00
nhmall
375a2c28f1 fixes updates for win32gui
Changes to be committed:
	modified:   doc/fixes36.0
	modified:   doc/fixes36.1
	modified:   win/win32/mhsplash.c
	modified:   win/win32/mswproc.c
2015-12-10 07:51:33 -05:00
nhmall
585e9f1b35 fix a 'program in disorder' in tt_oname
Changes to be committed:
	modified:   win/win32/winhack.c

sys_early_init was never called for win32 GUI. That was causing "rnd(0) -
program in disorder" in tt_oname.
2015-12-07 06:48:05 -05:00
nhmall
d267cb1b0f more windows DEBUG 2015-12-02 23:24:34 -05:00
nhmall
8bd70be165 windows build without DEBUG defined in global.h
Changes to be committed:
	modified:   include/global.h
	modified:   sys/share/pcmain.c
	modified:   win/win32/mswproc.c
2015-12-02 23:19:04 -05:00
PatR
e78e393a81 lint cleanup
A couple of things 'gcc -g' didn't care about 'gcc -O2' mistakenly
thinks 'may be used uninitialized'.
2015-12-02 02:36:29 -08:00
Haoyang Wang
70aa7fe818 Merge branch 'master' into mac-build-tty-pkg 2015-11-18 13:23:35 -08:00
PatR
5e5a78fdb2 X11 pilemark.xbm
Update the unix Makefiles and the older OSX hints files to handle the
pile marker tile overlay.  I didn't touch hints/macosx10.10 and .11
since I think there's still a merge for them pending.

A couple of formatting tweaks for bemain.c are included, for no
compelling reason.  What are the odds that anyone will every build
that again?
2015-11-18 03:04:35 -08:00
PatR
0072daa952 tty_exit_nhwindows
Keep window bookkeeping up to date when tty interface is shuting down.

The other interfaces should do something similar when they make windows
known to the core become unavailable.
2015-11-15 15:35:48 -08:00
PatR
2e5818d803 tty build warning
Use casts to try to suppress a couple of assignments of long to short
that Michael's compiler warns about.  'cw->maxrow' might have a value
that's too big for 'short' (when dealing with really big menus), but
'cw->maxcol' never will (unless someone comes up with a terminal or
emulator that's wider that 32K-1 characters...).
2015-11-13 01:12:43 -08:00
nhmall
39a1667677 Repair recent tile mapping error when MAIL is undefined
Changes to be committed:
	modified:   src/objects.c
	modified:   win/share/tilemap.c

Warnings during tile builds (and incorrect tile mappings
at run time when MAIL wasn't defined):
	Creating 16x16 binary tile files (this may take some time)
	warning: for tile 325 (numbered 325) of objects.txt,
	        found 'ETAOIN SHRDLU' while expecting 'stamped / mail'
	warning: for tile 326 (numbered 326) of objects.txt,
	        found 'LOREM IPSUM' while expecting 'ETAOIN SHRDLU'

The recent addition of the first new extra scroll descriptions in a
very long time caused this problem to show up when MAIL was undefined.

There was a magic number in use that made an assumption that there
were only 4 such extra scroll descriptions, those being
"FOOBIE BLETCH", "TEMOV","GARVEN DEH","READ ME"
2015-11-12 00:42:52 -05:00
nhmall
ecd277cec2 unused parameter warning and an invalid index
Changes to be committed:
	modified:   win/tty/wintty.c
2015-11-11 09:57:05 -05:00
PatR
f97c3dec0a tty memory management at program termination
Release some dynamically allocated memory prior to exit.  These were
previously left alone due to assumed complexity (at least by me...),
but dealing with them turned out to be straightforward.

|#if FREE_ALL_MEMORY
 free BASE_WINDOW  -- tty-specific; other windows are drawn on top of it
 free ttyDisplay   -- tty's basic data structure
|#endif
 free nh_HI, nh_HE -- termcap values handled differently from the rest

These are the last things that 'heaputil' always reported as not freed
for the basic Unix+tty configuration.  (I've observed other things not
being freed; those are post-3.4.3 bugs that need to be found and fixed.)
2015-11-11 01:43:03 -08:00
Haoyang Wang
2894f1f873 fix make install; fix the package directory tree 2015-11-09 00:22:33 -08:00
Haoyang Wang
37b7229326 Change the root directory to /usr/local/games 2015-11-09 00:22:33 -08:00
Pasi Kallinen
8bfa1579e7 Remove stray character 2015-11-07 10:59:43 +02:00
PatR
a975287467 couple of string concatenations in win/tty/
Plus a modest amount (really!) of reformatting.

Also got rid of 'copy_of()' since dupstr() does the same thing [except
for the 'treat Null as ""' part; when needed, that can be done in the
call:  dupstr(!str ? "" : str)].
2015-11-06 16:39:29 -08:00
PatR
61319ef1ca force NHSUBST for X11 icons 2015-11-02 01:51:58 -08:00
Pasi Kallinen
e022486cdc Actually destroy the character selection window 2015-11-01 20:49:32 +02:00
PatR
07e2d6175f X11 icon version numbering
One of the steps in the pre-release checklist:  make sure the version
number in the X11 icons is up to date.  nh32icon and nh56icon both have
the version number (major and minor values only, not patchlevel).
Update it from 3.4 to 3.6 for both.  (nh72icon doesn't have any version
info in its design, so doesn't need any update.)

The X11 'bitmap' program strips out the header comments, so I modified
the image, saved it, used 'git diff --patch' to capture the changes,
'git checkout' to revert to the existing file, and edited in the diff
bands pertaining to the changed data.  No doubt this could have been
done in some easier fashion, but it was victory just to find the bitmap
utility and achieve results using a one-button mouse--worse, a clumsy
touchpad substituting for one--when it's designed for a three-button one.
2015-11-01 03:59:55 -08:00