Commit Graph

144 Commits

Author SHA1 Message Date
keni
0e51afc7cd update Files attributes with priorities and %s substitution 2018-05-31 21:42:06 -04:00
keni
9858f69fa8 update .gitattributes files for auto-generation of Files 2018-05-29 19:28:26 -04:00
PatR
d752a4ad93 X11/winX.c w/o TEXTCOLOR
Avoid warnings when TEXTCOLOR isn't enabled.
2018-05-15 17:08:40 -07:00
keni
0f58af6f37 add missing copyright info 2018-04-25 16:54:50 -04:00
keni
09502df9f1 force expand unexpanded substitution variables 2018-04-25 15:36:11 -04:00
keni
11f1983253 update .gitattributes files for substitution and copyright headers 2018-04-25 14:52:43 -04:00
Pasi Kallinen
94ad7512a6 Compile-time option to allow some prompts remember the input
Define EDIT_GETLIN to make the tty, X11, and Qt4 windowports to
remember the input strings for wishing and annotation.
2018-03-26 23:04:53 +03:00
Pasi Kallinen
647ea55b1a Fix compile of tile2x11
I was too zealous changing fprintf to the Fprintf macro, which
ignores the return value.
2017-11-02 23:41:55 +02:00
Pasi Kallinen
fe9762d1cc X11: Fix renaming at player selection
Due to the new player selection dialog I did, it was possible
to rename your character - but this didn't rename the lock files
and tried to load a save from the wrong name.

This is a bit of a hack, but seems to work and didn't seem to
cause problems for the tty.
2017-10-31 21:18:24 +02:00
PatR
da9c3f0ed4 X11 role selection: gender-specific role names
A wishlist/TODO item:  when "female" is highlighted, change "caveman"
to "cavewoman" and "priest" to "priestess".  If it gets toggled to
"male", change them back.
2017-10-16 22:19:35 -07:00
Pasi Kallinen
7e28cc64f6 X11: Capitalize the main window correctly 2017-10-16 17:34:29 +03:00
PatR
ab04d12ccb X11 player selection - wishlist and reformatting
Add a comment about potential changes to make the X11 player selection
dialog.  Also, a bunch of minor formatting tweaks.
2017-10-15 16:24:02 -07:00
Pasi Kallinen
f1618fe6dd X11: Put yn prompts into message history 2017-10-15 21:48:42 +03:00
Pasi Kallinen
1b42b1499b X11: player selection dialog tweaks 2017-10-14 18:07:09 +03:00
Pasi Kallinen
87b94230b5 X11: player selection enter should obey button active state 2017-10-14 17:38:06 +03:00
Pasi Kallinen
1caa212bd9 Fix warnings 2017-10-14 13:48:44 +03:00
Pasi Kallinen
04b08298a3 Use the same macro for output in tile2x11 2017-10-14 13:10:34 +03:00
Pasi Kallinen
8723742015 Don't output x11 tile compilation info into stderr 2017-10-14 09:15:07 +03:00
PatR
842c66750a X11 player selection compile warnings
This eliminates nearly 40 warnings, most by suppressing complaints of
used function arguments but a few for unused local variables.  There's
also some reformatting thrown in....

There are still 18 warnings about uses of XtSetArg(), about assigning
const to non-const.
2017-10-13 17:56:25 -07:00
Pasi Kallinen
9ec7e961d3 Fix copypaste error in Qt4 and X11 plsel dialogs 2017-10-13 23:34:44 +03:00
Pasi Kallinen
7b156bf704 X11: add new player selection dialog
The dialog shows the player's name, race, role, gender, and
alignment in a single window, similar to the Qt4 dialog.
Also allows randomizing the character selection.

Use the dialog by setting OPTIONS=player_selection:dialog
2017-10-13 22:41:43 +03:00
PatR
601bff5159 X11 WC_ flags
Add a few windowing capability flags that were omitted for X11.  There
may be others which ought to be set too; I don't understand a bunch of
them.
2017-10-12 15:18:26 -07:00
PatR
ffeabfdf3b X11 default resources - macro expansion
The X11 interface reads file NetHack.ad (after cd'ing to the playground
directory, where 'make install' puts a copy) and feeds the contents to
X Windows for use as default resources to override the compiled in
defaults.  When use of #define was introduced into NetHack.ad (back in
September, 2016) this was severely hobbled and startup spit out a lot
complaints to stderr about invalid resource values.  This implements
rudimentary macro expansion for '#define name value' within the data
stream that's fed to X, getting back decent default values and
eliminating the invalid value complaints.
2017-10-11 17:29:55 -07: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
189809a55c Rename terminate to nh_terminate so VS2015 can compile 2017-08-19 14:10:29 +03:00
Pasi Kallinen
09c517e830 Fix valgrind complaint 2016-10-11 17:59:35 +03:00
Pasi Kallinen
e177af1e8b Update X11 style, define button rounding 2016-09-15 18:45:18 +03:00
Pasi Kallinen
f0d6a9e02d Better default style for X11
This tries to mimic the terminal, and adds some defines making it easier
to configure.
2016-09-15 18:23:19 +03:00
Pasi Kallinen
5f35d49105 X11: Make statue tiles look like grayscale monsters 2016-06-23 09:44:07 +03:00
PatR
a102ee9a1a ctype tweaks
None of these explains the Windows assertion failure.
 end.c - post-3.6.0
 options.c - in #else block of #if win32
 winmenu.c - X11
2016-05-28 17:18:51 -07:00
PatR
6459b5d301 black&white lava
Add MG_BW_LAVA to mapglyph() instead of hijacking MG_DETECT.  Used
to display lava in inverse video if color is disabled and lava is
using the same display character as water (which is the default).
(The use_inverse option must be enabled for tty to honor it.  X11's
text mode doesn't care.  Win32 does care but probably shouldn't--it's
not a case like tty where the hardware might not support it.)

This implements both MG_DETECT and MG_BW_LAVA for X11, but only if
the program is built with TEXTCOLOR enabled.  Those should work even
when color is not supported, but I suspect that configuration is
unlikely to ever be used so didn't want to spend the time to figure
out how to do it.  (The relevant data is overloaded on the color
data, so not available when TEXTCOLOR is disabled.)

The win32 revision is untested.
2016-05-28 00:51:54 -07:00
PatR
ef9cd17942 X11 extcmd_height_delta resourse
Umpteenth revision of the X11 extended command menu.  Add a new
resource to NetHack.ad to control its initial size.

I still hope there's a better way to do this, but this is my last
shot at it.
2016-03-04 00:13:23 -08:00
PatR
8d2a74b5b0 X11 extended command menu scrolling
When the extended command menu auto-scrolls as the player types in
characters, scroll so that all matching entries come into view rather
than just the first one.  For example, it someone types 'w', instead
of just highlighting and showing "wipe", it will highlight "wipe"
(because that has become the default response when <return> is used)
but also show "wiz-this", "wiz-that", and "wmode".  It actually shows
one extra entry beyond the last matching one--so you can see that
there aren't any more ambiguous choices--except for 'w' where "wmode"
is the very last extended command.

Previously, on subsequent popups of the extended command menu, the
scrollbar's slider was left drawn in the position it was in during
the previous time even though menu content wasn't scrolled.  Now it's
forced back to the top (non-scrolled) position when that menu is
popped up.
2016-02-15 00:59:33 -08:00
PatR
d91b2e5fd7 extended command menu for X11
When the extended command menu is big enough to need a scrollbar,
leave more elbow room when forcing its height to fit on screen.
The last entry was frequently obscured by OSX's "docking tray"
desktop decoration and the resize hotspot (bottom right corner of
the menu popup) could be hard to access.

I'm not particularly happy with this code.  There really has to be
a better way to accomplish what's needed.
2016-02-13 18:06:50 -08:00
PatR
962b3e43f4 win/X11 lint 2016-02-13 10:58:44 -08:00
PatR
8c7f89852a formatting for win/X11/dialogs.c 2016-02-10 18:25:20 -08:00
PatR
a41382d308 fix #H4237 - color ignored for X11 text map
Color was only being tracked for locations that had the pile of
objects flag set.  And hilite_pile made a monster on a pile take
on the color of the top object of the pile.

This restores the tracking of color for the whole map, and makes
highlighted piles be drawn in inverse like highligted pets.  The
drawing routine doesn't know the difference (but could tell, if
necessary, by testing whether the glyph is an object or a monster).

Also, variables 'inbuf', 'inptr', and 'incount' were global; limit
their scope to winmap.c.
2016-02-08 19:01:26 -08:00
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
PatR
518e067e82 X11 default resources
If the user hasn't explicitly loaded application defaults (which I
haven't been doing), the X11 interface behaves differently if invoked
via the shell script than if the executable is run directly, because
the script sets up a path so that X can find $HACKDIR/NetHack.ad.
This hides the difference by reading in that file during initialization
and feeding its contents to XtAppInitialize as fallback resources.
2016-02-07 00:36:46 -08:00
PatR
6d9ac874dd X11 scrolling message window
The scroll bar on the message window doesn't work for me, just like
the one on the extend commands menu.  Moving the pointer to it does
change the cursor, but neither trying to drag the slider nor clicking
above it will make it do anything.  However, at some point I managed
to accidentally scroll the message window, and new messages never
restored it to the unscrolled state.  New messages were hidden until
enough even newer ones had been delivered to push the hidden ones
into view.  So this adds key translations to scroll the message
window via the arrow keys.  Clicking on the scroll bar doesn't change
focus to the right place, so I have to click the text display area of
the message window.  That triggers a beep (I suspect it's interpreted
as an attempt to move the hero beyond the map.)  But then the messages
can be scrolled via the cursor keys.  Getting focus back to the map
seems tricky since doing it via pointer is interpreted as a travel
command.  Not quite optimal....

Anyway, being able to scroll the message window let me figure out how
to unscroll it when new messages are delivered.
2016-02-06 18:25:42 -08:00
PatR
5229260f6b X11 highlight yn prompting
For the 'slow' config (prompting for single-char input done on a
fixed line at the top of the map rather than via a popup window),
invert the background and foreground when creating it so that it
looks like part of the map, then invert again when a prompt is
active in order to highlight that prompt.
2016-02-06 18:00:27 -08:00
PatR
ea21f384ba more X11 memory management
Free askname's widgets after use and free getlin's and yn_function's
persistent widgets at end of game.

When loading an entire text file into one long string in memory,
use strcpy on a pointer to the end of the string instead of having
strcat repeatedly churn through the entire string as it grows for
each line.  [Since that's only used for small help files (biggest
is dat/history), this optimization is probably not noticeable.]

Also, a handful of new comments and quite a bit of reformatting.
2016-02-04 17:55:20 -08: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
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
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
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