Merge branch 'NetHack-3.7'

This commit is contained in:
nhmall
2019-12-27 08:52:42 -05:00
98 changed files with 1137 additions and 843 deletions
+16 -10
View File
@@ -5,6 +5,11 @@ matrix:
env: DESCR=linux-xenial-gcc HINTS=linux env: DESCR=linux-xenial-gcc HINTS=linux
compiler: gcc compiler: gcc
script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make fetch-lua && make install" script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make fetch-lua && make install"
- os: linux
env: DESCR=linux-bionic-gcc HINTS=linux
dist: bionic
compiler: gcc
script: "cd sys/unix/ && sh setup.sh hints/$HINTS && cd ../../ && make fetch-lua && make install"
- os: linux - os: linux
env: DESCR=linux-xenial-clang HINTS=linux env: DESCR=linux-xenial-clang HINTS=linux
compiler: clang compiler: clang
@@ -74,6 +79,17 @@ matrix:
language: shell language: shell
script: script:
- ./win/win32/vs2017/travisci.sh - ./win/win32/vs2017/travisci.sh
- os: windows
# install: choco install mingw
env: DESCR=windows-mingw
script:
- sh sys/winnt/travis-gcc.sh
- export ADD_CURSES=Y
- export PDCURSES_TOP=../lib/pdcurses
- export LUA_VERSION=5.3.5
- cd src
- cp ../sys/winnt/Makefile.gcc ./Makefile
- mingw32-make install
- os: linux - os: linux
env: DESCR=msdos-cross-on-linux HINTS=linux LUA_VERSION=5.3.5 env: DESCR=msdos-cross-on-linux HINTS=linux LUA_VERSION=5.3.5
compiler: gcc compiler: gcc
@@ -84,16 +100,6 @@ matrix:
- cd lib/lua-$LUA_VERSION/src && make a && cd ../../.. - cd lib/lua-$LUA_VERSION/src && make a && cd ../../..
- sh sys/msdos/msdos-cross-compile.sh - sh sys/msdos/msdos-cross-compile.sh
exclude: exclude:
- os: windows
# install: choco install mingw
env: DESCR=windows-mingw
script:
- git clone --depth 1 https://github.com/wmcbrine/PDCurses.git ../pdcurses
- export ADD_CURSES=Y
- export PDCURSES_TOP=../../pdcurses
- cd src
- cp ../sys/winnt/Makefile.gcc ./Makefile
- mingw32-make install
# - os: osx # - os: osx
# osx_image: xcode10.3 # osx_image: xcode10.3
# env: DESCR=osx-xcode10.3-x11 HINTS=macosx10.14 WANT_WIN_CURSES=1 WANT_WIN_X11=1 USE_XPM=1 # env: DESCR=osx-xcode10.3-x11 HINTS=macosx10.14 WANT_WIN_CURSES=1 WANT_WIN_X11=1 USE_XPM=1
+10 -10
View File
@@ -163,13 +163,13 @@ sys/msdos:
Install.dos Makefile.BC Makefile.GCC Install.dos Makefile.BC Makefile.GCC
Makefile.MSC Makefile1.cross Makefile2.cross Makefile.MSC Makefile1.cross Makefile2.cross
SCHEMA35.MSC moveinit.pat msdos-cross-compile.sh SCHEMA35.MSC moveinit.pat msdos-cross-compile.sh
msdos.c msdoshlp.txt ovlinit.c msdos.c msdoshlp.txt nhlua.h
pckeys.c pctiles.c pctiles.h ovlinit.c pckeys.c pctiles.c
pcvideo.h portio.h schema1.BC pctiles.h pcvideo.h portio.h
schema2.BC schema3.MSC setup.bat schema1.BC schema2.BC schema3.MSC
sysconf tile2bin.c vesa.h setup.bat sysconf tile2bin.c
video.c vidtxt.c vidvesa.c vesa.h video.c vidtxt.c
vidvga.c vidvesa.c vidvga.c
(files for running MSDOS binary under Windows) (files for running MSDOS binary under Windows)
nhico.uu nhpif.uu nhico.uu nhpif.uu
@@ -289,9 +289,9 @@ Makefile.msc console.rc nethack.def
nh340key.c nhdefkey.c nhico.uu nh340key.c nhdefkey.c nhico.uu
nhraykey.c nhsetup.bat ntsound.c nhraykey.c nhsetup.bat ntsound.c
nttty.c porthelp stub-pdcscrn.c nttty.c porthelp stub-pdcscrn.c
stubs.c sysconf.template win10.c stubs.c sysconf.template travis-gcc.sh
win10.h win32api.h windmain.c win10.c win10.h win32api.h
winnt.c winos.h windmain.c winnt.c winos.h
test: test:
(files in top directory) (files in top directory)
+2
View File
@@ -43,6 +43,8 @@ perm_invent keep inventory in a permanent window [FALSE]
pickup_thrown override pickup_types for thrown objects [TRUE] pickup_thrown override pickup_types for thrown objects [TRUE]
pushweapon when wielding a new weapon, put your previously [FALSE] pushweapon when wielding a new weapon, put your previously [FALSE]
wielded weapon into the secondary weapon slot wielded weapon into the secondary weapon slot
quick_farsight usually skip the chance to browse the map when [FALSE]
randomly triggered clairvoyance takes place
rawio allow the use of raw I/O [FALSE] rawio allow the use of raw I/O [FALSE]
rest_on_space count the space bar as a rest character [FALSE] rest_on_space count the space bar as a rest character [FALSE]
safe_pet prevent you from (knowingly) attacking your pet(s) [TRUE] safe_pet prevent you from (knowingly) attacking your pet(s) [TRUE]
+9 -1
View File
@@ -1,4 +1,4 @@
.\" $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.337 $ $NHDT-Date: 1576431522 2019/12/15 17:38:42 $ .\" $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.345 $ $NHDT-Date: 1577050469 2019/12/22 21:34:29 $
.\" .\"
.\" This is an excerpt from the 'roff' man page from the 'groff' package. .\" This is an excerpt from the 'roff' man page from the 'groff' package.
.\" NetHack's Guidebook.mn currently does *not* adhere to these guidelines. .\" NetHack's Guidebook.mn currently does *not* adhere to these guidelines.
@@ -3422,6 +3422,14 @@ something pushes the old item into your alternate weapon slot (default off).
Likewise for the \(oqa\(cq (apply) command if it causes the applied item to Likewise for the \(oqa\(cq (apply) command if it causes the applied item to
become wielded. become wielded.
Persistent. Persistent.
.lp quick_farsight
When set, usually prevents the \(lqyou sense your surroundings\(rq message
where play pauses to allow you to browse the map whenever clairvoyance
randomly activates.
Some situations, such as being underwater or engulfed, ignore this option.
It does not affect the clairvoyance spell where pausing to examine revealed
objects or monsters is less intrusive.
Default is off. Persistent.
.lp "race " .lp "race "
Selects your race (for example, \(lqrace:human\(rq). Selects your race (for example, \(lqrace:human\(rq).
Default is random. Default is random.
+10 -1
View File
@@ -3760,7 +3760,16 @@ Using the `w' (wield) command when already wielding
something pushes the old item into your alternate weapon slot (default off). something pushes the old item into your alternate weapon slot (default off).
Likewise for the `a' (apply) command if it causes the applied item to Likewise for the `a' (apply) command if it causes the applied item to
become wielded. Persistent. become wielded. Persistent.
%.Ip %.lp
\item[\ib(quick\verb+_+farsight}
When set, usually prevents the ``you sense your surroundings'' message
where play pauses to allow you to browse the map whenever clairvoyance
randomly activates.
Some situations, such as being underwater or engulfed, ignore this option.
It does not affect the clairvoyance spell where pausing to examine revealed
objects or monsters is less intrusive.
Default is off. Persistent.
%.lp
\item[\ib{race}] \item[\ib{race}]
Selects your race (for example, ``{\tt race:human}''). Default is random. Selects your race (for example, ``{\tt race:human}''). Default is random.
If you prefix the value with `{\tt !}' or ``{\tt no}'', you will If you prefix the value with `{\tt !}' or ``{\tt no}'', you will
+190 -190
View File
@@ -3934,6 +3934,15 @@
off). Likewise for the `a' (apply) command if it causes the off). Likewise for the `a' (apply) command if it causes the
applied item to become wielded. Persistent. applied item to become wielded. Persistent.
quick_farsight
When set, usually prevents the "you sense your surroundings"
message where play pauses to allow you to browse the map when-
ever clairvoyance randomly activates. Some situations, such as
being underwater or engulfed, ignore this option. It does not
affect the clairvoyance spell where pausing to examine revealed
objects or monsters is less intrusive. Default is off. Per-
sistent.
race race
Selects your race (for example, "race:human"). Default is ran- Selects your race (for example, "race:human"). Default is ran-
dom. If you prefix the value with `!' or "no", you will ex- dom. If you prefix the value with `!' or "no", you will ex-
@@ -3944,15 +3953,6 @@
Make the space bar a synonym for the `.' (#wait) command (de- Make the space bar a synonym for the `.' (#wait) command (de-
fault off). Persistent. fault off). Persistent.
role
Pick your type of character (for example "role:Samurai"); syn-
onym for "character". See "name" for an alternate method of
specifying your role. Normally only the first letter of the
value is examined; `r' is an exception with "Rogue", "Ranger",
and "random" values. If you prefix the value with `!' or "no",
you will exclude that role from being picked randomly. Cannot
be set with the `O' command. Persistent.
NetHack 3.7 December 18, 2019 NetHack 3.7 December 18, 2019
@@ -3964,6 +3964,15 @@
role
Pick your type of character (for example "role:Samurai"); syn-
onym for "character". See "name" for an alternate method of
specifying your role. Normally only the first letter of the
value is examined; `r' is an exception with "Rogue", "Ranger",
and "random" values. If you prefix the value with `!' or "no",
you will exclude that role from being picked randomly. Cannot
be set with the `O' command. Persistent.
roguesymset roguesymset
This option may be used to select one of the named symbol sets This option may be used to select one of the named symbol sets
found within "symbols" to alter the symbols displayed on the found within "symbols" to alter the symbols displayed on the
@@ -4009,15 +4018,6 @@
Show your accumulated experience points on bottom line (default Show your accumulated experience points on bottom line (default
off). Persistent. off). Persistent.
showrace
Display yourself as the glyph for your race, rather than the
glyph for your role (default off). Note that this setting af-
fects only the appearance of the display, not the way the game
treats you. Persistent.
showscore
Show your approximate accumulated score on bottom line (default
off). Persistent.
NetHack 3.7 December 18, 2019 NetHack 3.7 December 18, 2019
@@ -4030,6 +4030,16 @@
showrace
Display yourself as the glyph for your race, rather than the
glyph for your role (default off). Note that this setting af-
fects only the appearance of the display, not the way the game
treats you. Persistent.
showscore
Show your approximate accumulated score on bottom line (default
off). Persistent.
silent silent
Suppress terminal beeps (default on). Persistent. Suppress terminal beeps (default on). Persistent.
@@ -4075,16 +4085,6 @@
screen. Use "symset:default" to explicitly select the default screen. Use "symset:default" to explicitly select the default
symbols. symbols.
time
Show the elapsed game time in turns on bottom line (default
off). Persistent.
timed_delay
When pausing momentarily for display effect, such as with ex-
plosions and moving objects, use a timer rather than sending
extra characters to the screen. (Applies to "tty" interface
only; "X11" interface always uses a timer based delay. The
NetHack 3.7 December 18, 2019 NetHack 3.7 December 18, 2019
@@ -4096,7 +4096,16 @@
default is on if configured into the program.) Persistent. time
Show the elapsed game time in turns on bottom line (default
off). Persistent.
timed_delay
When pausing momentarily for display effect, such as with ex-
plosions and moving objects, use a timer rather than sending
extra characters to the screen. (Applies to "tty" interface
only; "X11" interface always uses a timer based delay. The de-
fault is on if configured into the program.) Persistent.
tombstone tombstone
Draw a tombstone graphic upon your death (default on). Persis- Draw a tombstone graphic upon your death (default on). Persis-
@@ -4141,15 +4150,6 @@
through next and previous targets, allows filtering the possi- through next and previous targets, allows filtering the possi-
ble targets. ble targets.
n - no filtering [default]
v - in view only
a - in same area only
The area-filter tries to be slightly predictive -- if you're
standing on a doorway, it will consider the area on the side of
the door you were last moving towards.
NetHack 3.7 December 18, 2019 NetHack 3.7 December 18, 2019
@@ -4162,6 +4162,14 @@
n - no filtering [default]
v - in view only
a - in same area only
The area-filter tries to be slightly predictive -- if you're
standing on a doorway, it will consider the area on the side of
the door you were last moving towards.
Filtering can also be changed when getting a location with the Filtering can also be changed when getting a location with the
"getpos.filter" key. "getpos.filter" key.
@@ -4208,14 +4216,6 @@
ing to suit your preferences, it will attempt to do so. If it ing to suit your preferences, it will attempt to do so. If it
can't it will silently ignore it. You can find out if an option can't it will silently ignore it. You can find out if an option
is supported by the window port that you are currently using by is supported by the window port that you are currently using by
checking to see if it shows up in the Options list. Some options
are dynamic and can be specified during the game with the `O'
command.
align_message
Where to align or place the message window (top, bottom, left,
or right)
NetHack 3.7 December 18, 2019 NetHack 3.7 December 18, 2019
@@ -4228,6 +4228,14 @@
checking to see if it shows up in the Options list. Some options
are dynamic and can be specified during the game with the `O'
command.
align_message
Where to align or place the message window (top, bottom, left,
or right)
align_status align_status
Where to align or place the status window (top, bottom, left, Where to align or place the status window (top, bottom, left,
or right). or right).
@@ -4274,14 +4282,6 @@
font_size_message font_size_message
If NetHack can, it should use this size font for the message If NetHack can, it should use this size font for the message
window.
font_size_status
If NetHack can, it should use this size font for the status
window.
font_size_text
If NetHack can, it should use this size font for text windows.
NetHack 3.7 December 18, 2019 NetHack 3.7 December 18, 2019
@@ -4294,6 +4294,15 @@
window.
font_size_status
If NetHack can, it should use this size font for the status
window.
font_size_text
If NetHack can, it should use this size font for text windows.
fullscreen fullscreen
If NetHack can, it should try and display on the entire screen If NetHack can, it should try and display on the entire screen
rather than in a window. rather than in a window.
@@ -4338,16 +4347,7 @@
games for the player to choose from at game startup, if it can. games for the player to choose from at game startup, if it can.
Not all ports support this option. Not all ports support this option.
softkeyboard
Display an onscreen keyboard. Handhelds are most likely to
support this option.
splash_screen
If NetHack can, it should display an opening splash screen when
it starts up (default yes).
statuslines
Number of lines for traditional below-the-map status display.
NetHack 3.7 December 18, 2019 NetHack 3.7 December 18, 2019
@@ -4360,6 +4360,16 @@
softkeyboard
Display an onscreen keyboard. Handhelds are most likely to
support this option.
splash_screen
If NetHack can, it should display an opening splash screen when
it starts up (default yes).
statuslines
Number of lines for traditional below-the-map status display.
Acceptable values are 2 and 3 (default is 2). Curses and tty Acceptable values are 2 and 3 (default is 2). Curses and tty
interfaces only. interfaces only.
@@ -4405,16 +4415,6 @@
1 - on, always show borders 1 - on, always show borders
2 - auto, on if display is at least (24+2)x(80+2) (default) 2 - auto, on if display is at least (24+2)x(80+2) (default)
(The 26x82 size threshold for `2' refers to number of rows and
columns of the display. A width of at least 110 columns
(80+2+26+2) is needed for align_status set to left or right.)
windowcolors
If NetHack can, it should display windows with the specified
foreground/background colors. Windows GUI only. The format is
NetHack 3.7 December 18, 2019 NetHack 3.7 December 18, 2019
@@ -4426,6 +4426,14 @@
(The 26x82 size threshold for `2' refers to number of rows and
columns of the display. A width of at least 110 columns
(80+2+26+2) is needed for align_status set to left or right.)
windowcolors
If NetHack can, it should display windows with the specified
foreground/background colors. Windows GUI only. The format is
OPTION=windowcolors:wintype foreground/background OPTION=windowcolors:wintype foreground/background
where wintype is one of "menu", "message", "status", or where wintype is one of "menu", "message", "status", or
@@ -4472,14 +4480,6 @@
abort the count by typing ESC will leave NetHack waiting for abort the count by typing ESC will leave NetHack waiting for
another character to complete the two character sequence. Type another character to complete the two character sequence. Type
a second ESC to finish cancelling such a count. At other a second ESC to finish cancelling such a count. At other
prompts a single ESC suffices.
BIOS
Use BIOS calls to update the screen display quickly and to read
the keyboard (allowing the use of arrow keys to move) on ma-
chines with an IBM PC compatible BIOS ROM (default off, OS/2,
PC, and ST NetHack only).
NetHack 3.7 December 18, 2019 NetHack 3.7 December 18, 2019
@@ -4492,6 +4492,14 @@
prompts a single ESC suffices.
BIOS
Use BIOS calls to update the screen display quickly and to read
the keyboard (allowing the use of arrow keys to move) on ma-
chines with an IBM PC compatible BIOS ROM (default off, OS/2,
PC, and ST NetHack only).
flush flush
(default off, Amiga NetHack only). (default off, Amiga NetHack only).
@@ -4538,14 +4546,6 @@
not correct the problem, try !color. Cannot be set with the not correct the problem, try !color. Cannot be set with the
`O' command. `O' command.
9.7. Regular Expressions
Regular expressions are normally POSIX extended regular ex-
pressions. It is possible to compile NetHack without regular ex-
pression support on a platform where there is no regular expres-
sion library. While this is not true of any modern platform, if
your NetHack was built this way, patterns are instead glob pat-
terns. This applies to Autopickup exceptions, Message types, Menu
NetHack 3.7 December 18, 2019 NetHack 3.7 December 18, 2019
@@ -4558,6 +4558,14 @@
9.7. Regular Expressions
Regular expressions are normally POSIX extended regular ex-
pressions. It is possible to compile NetHack without regular ex-
pression support on a platform where there is no regular expres-
sion library. While this is not true of any modern platform, if
your NetHack was built this way, patterns are instead glob pat-
terns. This applies to Autopickup exceptions, Message types, Menu
colors, and User sounds. colors, and User sounds.
9.8. Configuring Autopickup Exceptions 9.8. Configuring Autopickup Exceptions
@@ -4601,16 +4609,8 @@
any corpse from autopickup. The last example results in the ex- any corpse from autopickup. The last example results in the ex-
clusion of items known to be cursed from autopickup. clusion of items known to be cursed from autopickup.
9.9. Changing Key Bindings
It is possible to change the default key bindings of some
special commands, menu accelerator keys, and extended commands,
by using BIND stanzas in the configuration file. Format is key,
followed by the command to bind to, separated by a colon. The
key can be a single character ("x"), a control key ("^X", "C-x"),
a meta key ("M-x"), or a three-digit decimal ASCII code.
For example:
@@ -4624,6 +4624,17 @@
9.9. Changing Key Bindings
It is possible to change the default key bindings of some
special commands, menu accelerator keys, and extended commands,
by using BIND stanzas in the configuration file. Format is key,
followed by the command to bind to, separated by a colon. The
key can be a single character ("x"), a control key ("^X", "C-x"),
a meta key ("M-x"), or a three-digit decimal ASCII code.
For example:
BIND=^X:getpos.autodescribe BIND=^X:getpos.autodescribe
BIND={:menu_first_page BIND={:menu_first_page
BIND=v:loot BIND=v:loot
@@ -4668,17 +4679,6 @@
When asked for a direction, the key to target yourself. De- When asked for a direction, the key to target yourself. De-
fault is `.'. fault is `.'.
getdir.self2
When asked for a direction, the key to target yourself. De-
fault is `s'.
getpos.autodescribe
When asked for a location, the key to toggle autodescribe. De-
fault is `#'.
getpos.all.next
When asked for a location, the key to go to next closest
NetHack 3.7 December 18, 2019 NetHack 3.7 December 18, 2019
@@ -4690,7 +4690,17 @@
interesting thing. Default is `a'. getdir.self2
When asked for a direction, the key to target yourself. De-
fault is `s'.
getpos.autodescribe
When asked for a location, the key to toggle autodescribe. De-
fault is `#'.
getpos.all.next
When asked for a location, the key to go to next closest inter-
esting thing. Default is `a'.
getpos.all.prev getpos.all.prev
When asked for a location, the key to go to previous closest When asked for a location, the key to go to previous closest
@@ -4734,16 +4744,6 @@
or meta-digit keys to fast-move around, move by skipping the or meta-digit keys to fast-move around, move by skipping the
same glyphs instead of by 8 units. Default is `*'. same glyphs instead of by 8 units. Default is `*'.
getpos.filter
When asked for a location, change the filtering mode when using
one of the next or previous keys to cycle through targets.
Toggles between no filtering, in view only, and in the same
area only. Default is `"'.
getpos.pick
When asked for a location, the key to choose the location, and
possibly ask for more info. Default is `.'.
NetHack 3.7 December 18, 2019 NetHack 3.7 December 18, 2019
@@ -4756,6 +4756,16 @@
getpos.filter
When asked for a location, change the filtering mode when using
one of the next or previous keys to cycle through targets.
Toggles between no filtering, in view only, and in the same
area only. Default is `"'.
getpos.pick
When asked for a location, the key to choose the location, and
possibly ask for more info. Default is `.'.
getpos.pick.once getpos.pick.once
When asked for a location, the key to choose the location, and When asked for a location, the key to choose the location, and
skip asking for more info. Default is `,'. skip asking for more info. Default is `,'.
@@ -4799,16 +4809,6 @@
redraw redraw
Key to redraw the screen. Default is `^R'. Key to redraw the screen. Default is `^R'.
redraw.numpad
Key to redraw the screen. With number_pad only. Default is
`^L'.
repeat
Key to repeat previous command. Default is `^A'.
reqmenu
Prefix key to request menu from some commands. Default is `m'.
@@ -4822,6 +4822,16 @@
redraw.numpad
Key to redraw the screen. With number_pad only. Default is
`^L'.
repeat
Key to repeat previous command. Default is `^A'.
reqmenu
Prefix key to request menu from some commands. Default is `m'.
run run
Prefix key to run towards a direction. Default is `G'. Prefix key to run towards a direction. Default is `G'.
@@ -4867,16 +4877,6 @@
the user is prompted with more-prompt, and a message matching the user is prompted with more-prompt, and a message matching
"You displaced <something>." is not shown at all. "You displaced <something>." is not shown at all.
The order of the defined MSGTYPE lines is important; the last
matching rule is used. Put the general case first, exceptions
below them.
9.11. Configuring Menu Colors
Some platforms allow you to define colors used in menu lines
when the line matches a user-defined pattern. At this time the
tty, curses, win32tty and win32gui interfaces support this.
NetHack 3.7 December 18, 2019 NetHack 3.7 December 18, 2019
@@ -4888,6 +4888,16 @@
The order of the defined MSGTYPE lines is important; the last
matching rule is used. Put the general case first, exceptions
below them.
9.11. Configuring Menu Colors
Some platforms allow you to define colors used in menu lines
when the line matches a user-defined pattern. At this time the
tty, curses, win32tty and win32gui interfaces support this.
In general, the configuration file entries to describe the In general, the configuration file entries to describe the
menu color mappings look like this: menu color mappings look like this:
@@ -4932,16 +4942,6 @@
Note that if you intend to have one or more color specifica- Note that if you intend to have one or more color specifica-
tions match " uncursed ", you will probably want to turn the im- tions match " uncursed ", you will probably want to turn the im-
plicit_uncursed option off so that all items known to be uncursed plicit_uncursed option off so that all items known to be uncursed
are actually displayed with the "uncursed" description.
9.12. Configuring User Sounds
Some platforms allow you to define sound files to be played
when a message that matches a user-defined pattern is delivered
to the message window. At this time the Qt port and the win32tty
and win32gui ports support the use of user sounds.
NetHack 3.7 December 18, 2019 NetHack 3.7 December 18, 2019
@@ -4954,6 +4954,15 @@
are actually displayed with the "uncursed" description.
9.12. Configuring User Sounds
Some platforms allow you to define sound files to be played
when a message that matches a user-defined pattern is delivered
to the message window. At this time the Qt port and the win32tty
and win32gui ports support the use of user sounds.
The following configuration file entries are relevant to The following configuration file entries are relevant to
mapping user sounds to messages: mapping user sounds to messages:
@@ -4999,15 +5008,6 @@
OPTION=hilite_status:wisdom/down/red/up/green OPTION=hilite_status:wisdom/down/red/up/green
Allowed colors are black, red, green, brown, blue, magenta,
cyan, gray, orange, light-green, yellow, light-blue, light-magen-
ta, light-cyan, and white. And "no-color", the default fore-
ground color on the display, which is not necessarily the same as
black or white or any of the other colors.
Allowed attributes are none, bold, dim, underline, blink,
and inverse. "Normal" is a synonym for "none"; they should not
be used in combination with any of the other attributes.
NetHack 3.7 December 18, 2019 NetHack 3.7 December 18, 2019
@@ -5020,6 +5020,16 @@
Allowed colors are black, red, green, brown, blue, magenta,
cyan, gray, orange, light-green, yellow, light-blue, light-magen-
ta, light-cyan, and white. And "no-color", the default fore-
ground color on the display, which is not necessarily the same as
black or white or any of the other colors.
Allowed attributes are none, bold, dim, underline, blink,
and inverse. "Normal" is a synonym for "none"; they should not
be used in combination with any of the other attributes.
To specify both a color and an attribute, use `&' to combine To specify both a color and an attribute, use `&' to combine
them. To specify multiple attributes, use `+' to combine those. them. To specify multiple attributes, use `+' to combine those.
For example: "magenta&inverse+dim". For example: "magenta&inverse+dim".
@@ -5064,16 +5074,6 @@
* "always" will set the default attributes for that field. * "always" will set the default attributes for that field.
* "up", "down" set the field attributes for when the field
value changes upwards or downwards. This attribute times
out after statushilites turns.
* "changed" sets the field attribute for when the field val-
ue changes. This attribute times out after statushilites
turns. (If a field has both a "changed" rule and an "up"
or "down" rule which matches a change in the field's val-
ue, the "up" or "down" one takes precedence.)
NetHack 3.7 December 18, 2019 NetHack 3.7 December 18, 2019
@@ -5086,6 +5086,16 @@
* "up", "down" set the field attributes for when the field
value changes upwards or downwards. This attribute times
out after statushilites turns.
* "changed" sets the field attribute for when the field val-
ue changes. This attribute times out after statushilites
turns. (If a field has both a "changed" rule and an "up"
or "down" rule which matches a change in the field's val-
ue, the "up" or "down" one takes precedence.)
* percentage sets the field attribute when the field value * percentage sets the field attribute when the field value
matches the percentage. It is specified as a number be- matches the percentage. It is specified as a number be-
tween 0 and 100, followed by `%' (percent sign). If the tween 0 and 100, followed by `%' (percent sign). If the
@@ -5129,16 +5139,6 @@
The whole feature can be disabled by setting option sta- The whole feature can be disabled by setting option sta-
tushilites to 0. tushilites to 0.
Example hilites:
@@ -5152,6 +5152,8 @@
Example hilites:
OPTION=hilite_status: gold/up/yellow/down/brown OPTION=hilite_status: gold/up/yellow/down/brown
OPTION=hilite_status: characteristics/up/green/down/red OPTION=hilite_status: characteristics/up/green/down/red
OPTION=hilite_status: hitpoints/100%/gray&normal OPTION=hilite_status: hitpoints/100%/gray&normal
@@ -5203,8 +5205,6 @@
B S_bat (bat or bird) B S_bat (bat or bird)
^ S_bear_trap (bear trap) ^ S_bear_trap (bear trap)
- S_blcorn (bottom left corner) - S_blcorn (bottom left corner)
b S_blob (blob)
+ S_book (spellbook)
@@ -5218,6 +5218,8 @@
b S_blob (blob)
+ S_book (spellbook)
) S_boomleft (boomerang open left) ) S_boomleft (boomerang open left)
( S_boomright (boomerang open right) ( S_boomright (boomerang open right)
` S_boulder (boulder) ` S_boulder (boulder)
@@ -5269,8 +5271,6 @@
. S_hodbridge (horizontal lowered drawbridge) . S_hodbridge (horizontal lowered drawbridge)
| S_hodoor (open door in horizontal wall) | S_hodoor (open door in horizontal wall)
^ S_hole (hole) ^ S_hole (hole)
@ S_human (human or elf)
h S_humanoid (humanoid)
@@ -5284,6 +5284,8 @@
@ S_human (human or elf)
h S_humanoid (humanoid)
- S_hwall (horizontal wall) - S_hwall (horizontal wall)
. S_ice (ice) . S_ice (ice)
i S_imp (imp or minor demon) i S_imp (imp or minor demon)
@@ -5335,8 +5337,6 @@
s S_spider (arachnid or centipede) s S_spider (arachnid or centipede)
^ S_spiked_pit (spiked pit) ^ S_spiked_pit (spiked pit)
^ S_squeaky_board (squeaky board) ^ S_squeaky_board (squeaky board)
0 S_ss1 (magic shield 1 of 4)
# S_ss2 (magic shield 2 of 4)
@@ -5350,6 +5350,8 @@
0 S_ss1 (magic shield 1 of 4)
# S_ss2 (magic shield 2 of 4)
@ S_ss3 (magic shield 3 of 4) @ S_ss3 (magic shield 3 of 4)
* S_ss4 (magic shield 4 of 4) * S_ss4 (magic shield 4 of 4)
^ S_statue_trap (statue trap) ^ S_statue_trap (statue trap)
@@ -5401,8 +5403,6 @@
x S_xan (xan or other extraordinary insect) x S_xan (xan or other extraordinary insect)
X S_xorn (xorn) X S_xorn (xorn)
Y S_yeti (apelike creature) Y S_yeti (apelike creature)
Z S_zombie (zombie)
z S_zruty (zruty)
@@ -5416,6 +5416,8 @@
Z S_zombie (zombie)
z S_zruty (zruty)
S_pet_override (any pet if ACCESSIBILITY=1 is set) S_pet_override (any pet if ACCESSIBILITY=1 is set)
S_hero_override (hero if ACCESSIBILITY=1 is set) S_hero_override (hero if ACCESSIBILITY=1 is set)
@@ -5468,8 +5470,6 @@
ficial distributions of NetHack is a symset called NHAccess. Se- ficial distributions of NetHack is a symset called NHAccess. Se-
lecting that symset in your configuration file will cause the lecting that symset in your configuration file will cause the
game to run in a manner accessible to the blind. After you have game to run in a manner accessible to the blind. After you have
gained some experience with the game and with editing files, you
may want to alter settings via SYMBOLS= and ROGUESYMBOLS= in your
NetHack 3.7 December 18, 2019 NetHack 3.7 December 18, 2019
@@ -5482,6 +5482,8 @@
gained some experience with the game and with editing files, you
may want to alter settings via SYMBOLS= and ROGUESYMBOLS= in your
configuration file to better suit your preferences. See the pre- configuration file to better suit your preferences. See the pre-
vious section for the special symbols S_pet_override to force a vious section for the special symbols S_pet_override to force a
consistent symbol for all pets and S_hero_override to force a consistent symbol for all pets and S_hero_override to force a
@@ -5536,8 +5538,6 @@
formation can be seen via the "#attributes" command. formation can be seen via the "#attributes" command.
NetHack 3.7 December 18, 2019 NetHack 3.7 December 18, 2019
+26 -5
View File
@@ -1,8 +1,7 @@
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.22 $ $NHDT-Date: 1576288434 2019/12/14 01:53:54 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.35 $ $NHDT-Date: 1577190687 2019/12/24 12:31:27 $
General Fixes and Modified Features General Fixes and Modified Features
----------------------------------- -----------------------------------
fix compile when DLB isn't defined
hero polymorphed into a vampire can use #monster to shape-shift rather than hero polymorphed into a vampire can use #monster to shape-shift rather than
just do a one-shot polymorph into bat/cloud/wolf and shifted vampire just do a one-shot polymorph into bat/cloud/wolf and shifted vampire
hero can use #monster again to take on another form (randomly chosen hero can use #monster again to take on another form (randomly chosen
@@ -12,10 +11,28 @@ fix internal self-recover to work with recent fields added to checkpoint file
improvements to pronoun usage when hallucinating improvements to pronoun usage when hallucinating
function calls made from mapglyph based on dungeon level are now called once function calls made from mapglyph based on dungeon level are now called once
per level per level
fix accessing mons[-1] when trying to gate in a non-valid demon
fast hero could have random clairvoyance happen more than once on same turn
using 'Q' on wielded weapon would offer to split stack; make using 'w' on a
quivered stack behave similarly
weight for giant spider was too low for creature of size 'large';
weight for giant beetle was much too low for 'large'
leave some menu items out of "invert all" via '@' when their inclusion would
degrade the usefulness of that interface feature
change crysknife from mineral to bone and worm tooth from unspecified to bone
worn meat ring shouldn't cause increased hunger; neither should fake Amulet
worn +0 ring of protection should cause increased hunger if it is the only
source of extrinsic Protection
Fixes to Pre-3.7.0 Problems that Were Exposed Via git Repository Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
------------------------------------------------------------------ ------------------------------------------------------------------
fix compile when DLB isn't defined
urealtime.realtime was being incorrectly calculated
revised "mysterious force" when climbing out of gehennom could generate
warnings about "rn2(0) attempted" or "rn2(-n) attempted"
after 'w' on split stack patch, wielding '-' would cause an object_lost panic
same patch allowed partial stack from getobj to replace cursed wielded weapon
Platform- and/or Interface-Specific Fixes Platform- and/or Interface-Specific Fixes
@@ -40,6 +57,9 @@ split off some of the functionality that was in makedefs (compiled-in options
replace quest.txt and associated conversion to quest.dat via makedefs with replace quest.txt and associated conversion to quest.dat via makedefs with
lua quest texts loaded at runtime lua quest texts loaded at runtime
some altars are displayed in different colors (for tty and curses at least) some altars are displayed in different colors (for tty and curses at least)
add 'quick_farsight' option to provide some control over random clairvoyance
where pausing to be able to browse temporarily visible aspects of the
revealed map can seem intrusive; doesn't affect clairvoyance spell
Platform- and/or Interface-Specific New Features Platform- and/or Interface-Specific New Features
@@ -57,7 +77,8 @@ Code Cleanup and Reorganization
move majority of global variables into instance_globals struct g move majority of global variables into instance_globals struct g
move zeroobj, zeromonst, zeroany into const_globals struct cg move zeroobj, zeromonst, zeroany into const_globals struct cg
remove STATIC_DCL, STATIC_OVL, STATIC_VAR, STATIC_PTR remove STATIC_DCL, STATIC_OVL, STATIC_VAR, STATIC_PTR
old Qt moved from win/Qt to win/Qt3 old Qt moved from win/Qt to win/Qt3 and files renamed to use qt3_ prefix
more current Qt for Qt version 4 and 5 moved from win/Qt4 to win/Qt; qt4 more current Qt for Qt version 4 and 5 moved from win/Qt4 to win/Qt; qt4
moniker changed to qt_ moniker changed to qt_
window-port-interface: add_menu() modified to take a more general itemflags
parameter to support uses beyond just 'preselected'
+2 -3
View File
@@ -310,7 +310,7 @@ start_menu(window)
be used for menus. be used for menus.
add_menu(windid window, int glyph, const anything identifier, add_menu(windid window, int glyph, const anything identifier,
char accelerator, char groupacc, char accelerator, char groupacc,
int attr, char *str, boolean preselected) int attr, char *str, unsigned itemflags)
-- Add a text line str to the given menu window. If identifier -- Add a text line str to the given menu window. If identifier
is 0, then the line cannot be selected (e.g. a title). is 0, then the line cannot be selected (e.g. a title).
Otherwise, identifier is the value returned if the line is Otherwise, identifier is the value returned if the line is
@@ -337,8 +337,7 @@ add_menu(windid window, int glyph, const anything identifier,
the menu command (or their user defined aliases), it loses. the menu command (or their user defined aliases), it loses.
The menu commands and aliases take care not to interfere The menu commands and aliases take care not to interfere
with the default object class symbols. with the default object class symbols.
-- If you want this choice to be preselected when the -- itemflags on this item (such as MENU_ITEMFLAGS_SELECTED etc.).
menu is displayed, set preselected to TRUE.
end_menu(window, prompt) end_menu(window, prompt)
-- Stop adding entries to the menu and flushes the window -- Stop adding entries to the menu and flushes the window
+8 -7
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 context.h $NHDT-Date: 1575775592 2019/12/08 03:26:32 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.35 $ */ /* NetHack 3.6 context.h $NHDT-Date: 1577050216 2019/12/22 21:30:16 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.36 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2006. */ /*-Copyright (c) Michael Allison, 2006. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -111,14 +111,15 @@ struct context_info {
unsigned run; /* 0: h (etc), 1: H (etc), 2: fh (etc) */ unsigned run; /* 0: h (etc), 1: H (etc), 2: fh (etc) */
/* 3: FH, 4: ff+, 5: ff-, 6: FF+, 7: FF- */ /* 3: FH, 4: ff+, 5: ff-, 6: FF+, 7: FF- */
/* 8: travel */ /* 8: travel */
unsigned startingpet_mid; unsigned startingpet_mid; /* monster id number for initial pet */
int current_fruit; /* fruit->fid corresponding to g.pl_fruit[] */ int current_fruit; /* fruit->fid corresponding to g.pl_fruit[] */
int warnlevel; int mysteryforce; /* adjusts how often "mysterious force" kicks in */
int rndencode; /* randomized escape sequence introducer */ int rndencode; /* randomized escape sequence introducer */
int mysteryforce; int warnlevel; /* threshold (digit) to warn about unseen mons */
long next_attrib_check; /* next attribute check */ long next_attrib_check; /* next attribute check */
long stethoscope_move; long seer_turn; /* when random clairvoyance will next kick in */
short stethoscope_movement; long stethoscope_move; /* when a stethoscope was last used */
short stethoscope_movement; /* to track multiple moves on same turn */
boolean travel; /* find way automatically to u.tx,u.ty */ boolean travel; /* find way automatically to u.tx,u.ty */
boolean travel1; /* first travel step */ boolean travel1; /* first travel step */
boolean forcefight; boolean forcefight;
+2
View File
@@ -1217,6 +1217,7 @@ E int FDECL(mapglyph, (int, int *, int *, unsigned *, int, int, unsigned));
E char *FDECL(encglyph, (int)); E char *FDECL(encglyph, (int));
E char *FDECL(decode_mixed, (char *, const char *)); E char *FDECL(decode_mixed, (char *, const char *));
E void FDECL(genl_putmixed, (winid, int, const char *)); E void FDECL(genl_putmixed, (winid, int, const char *));
E boolean FDECL(menuitem_invert_test, (int, unsigned, BOOLEAN_P));
/* ### mcastu.c ### */ /* ### mcastu.c ### */
@@ -1674,6 +1675,7 @@ E int FDECL(l_selection_register, (lua_State *));
/* ### nhlobj.c ### */ /* ### nhlobj.c ### */
#if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_TARGET) #if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_TARGET)
E void FDECL(nhl_push_obj, (lua_State *, struct obj *));
E int FDECL(l_obj_register, (lua_State *)); E int FDECL(l_obj_register, (lua_State *));
#endif #endif
+16 -13
View File
@@ -1,4 +1,4 @@
/* NetHack 3.7 flag.h $NHDT-Date: 1574982014 2019/11/28 23:00:14 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.166 $ */ /* NetHack 3.7 flag.h $NHDT-Date: 1577050470 2019/12/22 21:34:30 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.167 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2006. */ /*-Copyright (c) Michael Allison, 2006. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -16,20 +16,19 @@
*/ */
struct flag { struct flag {
boolean acoustics; /* allow dungeon sound messages */ boolean acoustics; /* allow dungeon sound messages */
boolean autodig; /* MRKR: Automatically dig */ boolean autodig; /* MRKR: Automatically dig */
boolean autoquiver; /* Automatically fill quiver */ boolean autoquiver; /* Automatically fill quiver */
boolean autoopen; /* open doors by walking into them */ boolean autoopen; /* open doors by walking into them */
boolean autounlock; /* automatically apply unlocking tools */ boolean autounlock; /* automatically apply unlocking tools */
boolean beginner; boolean biff; /* enable checking for mail */
boolean biff; /* enable checking for mail */ boolean bones; /* allow saving/loading bones */
boolean bones; /* allow saving/loading bones */ boolean confirm; /* confirm before hitting tame monsters */
boolean confirm; /* confirm before hitting tame monsters */ boolean dark_room; /* show shadows in lit rooms */
boolean dark_room; /* show shadows in lit rooms */ boolean debug; /* in debugging mode (aka wizard mode) */
boolean debug; /* in debugging mode */
#define wizard flags.debug #define wizard flags.debug
boolean end_own; /* list all own scores */ boolean end_own; /* list all own scores */
boolean explore; /* in exploration mode */ boolean explore; /* in exploration mode (aka discover mode) */
#define discover flags.explore #define discover flags.explore
boolean female; boolean female;
boolean friday13; /* it's Friday the 13th */ boolean friday13; /* it's Friday the 13th */
@@ -45,6 +44,8 @@ struct flag {
boolean pickup; /* whether you pickup or move and look */ boolean pickup; /* whether you pickup or move and look */
boolean pickup_thrown; /* auto-pickup items you threw */ boolean pickup_thrown; /* auto-pickup items you threw */
boolean pushweapon; /* When wielding, push old weapon into second slot */ boolean pushweapon; /* When wielding, push old weapon into second slot */
boolean quick_farsight; /* True disables map browsing during random
* clairvoyance */
boolean rest_on_space; /* space means rest */ boolean rest_on_space; /* space means rest */
boolean safe_dog; /* give complete protection to the dog */ boolean safe_dog; /* give complete protection to the dog */
boolean showexp; /* show experience points */ boolean showexp; /* show experience points */
@@ -242,6 +243,8 @@ struct instance_flags {
*/ */
unsigned msg_history; /* hint: # of top lines to save */ unsigned msg_history; /* hint: # of top lines to save */
int getpos_coords; /* show coordinates when getting cursor position */ int getpos_coords; /* show coordinates when getting cursor position */
int menuinvertmode; /* 0 = invert toggles every item;
1 = invert skips 'all items' item */
int menu_headings; /* ATR for menu headings */ int menu_headings; /* ATR for menu headings */
int *opt_booldup; /* for duplication of boolean opts in config file */ int *opt_booldup; /* for duplication of boolean opts in config file */
int *opt_compdup; /* for duplication of compound opts in conf file */ int *opt_compdup; /* for duplication of compound opts in conf file */
-3
View File
@@ -490,9 +490,6 @@ enum bodypart_types {
#define MENU_FULL 2 #define MENU_FULL 2
#define MENU_PARTIAL 3 #define MENU_PARTIAL 3
#define MENU_SELECTED TRUE
#define MENU_UNSELECTED FALSE
/* /*
* Option flags * Option flags
* Each higher number includes the characteristics of the numbers * Each higher number includes the characteristics of the numbers
+1 -1
View File
@@ -227,7 +227,7 @@ E void FDECL(mac_curs, (winid, int, int));
E void FDECL(mac_putstr, (winid, int, const char *)); E void FDECL(mac_putstr, (winid, int, const char *));
E void FDECL(mac_start_menu, (winid)); E void FDECL(mac_start_menu, (winid));
E void FDECL(mac_add_menu, (winid, int, const anything *, CHAR_P, CHAR_P, int, E void FDECL(mac_add_menu, (winid, int, const anything *, CHAR_P, CHAR_P, int,
const char *, BOOLEAN_P)); const char *, unsigned int));
E void FDECL(mac_end_menu, (winid, const char *)); E void FDECL(mac_end_menu, (winid, const char *));
E int FDECL(mac_select_menu, (winid, int, menu_item **)); E int FDECL(mac_select_menu, (winid, int, menu_item **));
#ifdef CLIPPING #ifdef CLIPPING
+1
View File
@@ -119,6 +119,7 @@ struct obj {
unsigned oeaten; /* nutrition left in food, if partly eaten */ unsigned oeaten; /* nutrition left in food, if partly eaten */
long age; /* creation date */ long age; /* creation date */
long owornmask; long owornmask;
unsigned lua_ref_cnt; /* # of lua script references for this object */
struct oextra *oextra; /* pointer to oextra struct */ struct oextra *oextra; /* pointer to oextra struct */
}; };
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.7 patchlevel.h $NHDT-Date: 1575775596 2019/12/08 03:26:36 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.136 $ */ /* NetHack 3.7 patchlevel.h $NHDT-Date: 1577050471 2019/12/22 21:34:31 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.142 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2012. */ /*-Copyright (c) Michael Allison, 2012. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -14,7 +14,7 @@
* Incrementing EDITLEVEL can be used to force invalidation of old bones * Incrementing EDITLEVEL can be used to force invalidation of old bones
* and save files. * and save files.
*/ */
#define EDITLEVEL 3 #define EDITLEVEL 6
#define COPYRIGHT_BANNER_A "NetHack, Copyright 1985-2019" #define COPYRIGHT_BANNER_A "NetHack, Copyright 1985-2019"
#define COPYRIGHT_BANNER_B \ #define COPYRIGHT_BANNER_B \
+2 -1
View File
@@ -133,6 +133,7 @@ typedef struct x11_mi {
int attr; /* Attribute for the line. */ int attr; /* Attribute for the line. */
boolean selected; /* Been selected? */ boolean selected; /* Been selected? */
boolean preselected; /* in advance? */ boolean preselected; /* in advance? */
unsigned itemflags; /* MENU_ITEMFLAGS_foo */
char selector; /* Char used to select this entry. */ char selector; /* Char used to select this entry. */
char gselector; /* Group selector. */ char gselector; /* Group selector. */
Widget w; Widget w;
@@ -418,7 +419,7 @@ E void FDECL(X11_putstr, (winid, int, const char *));
E void FDECL(X11_display_file, (const char *, BOOLEAN_P)); E void FDECL(X11_display_file, (const char *, BOOLEAN_P));
E void FDECL(X11_start_menu, (winid)); E void FDECL(X11_start_menu, (winid));
E void FDECL(X11_add_menu, (winid, int, const ANY_P *, CHAR_P, CHAR_P, int, E void FDECL(X11_add_menu, (winid, int, const ANY_P *, CHAR_P, CHAR_P, int,
const char *, BOOLEAN_P)); const char *, unsigned int));
E void FDECL(X11_end_menu, (winid, const char *)); E void FDECL(X11_end_menu, (winid, const char *));
E int FDECL(X11_select_menu, (winid, int, MENU_ITEM_P **)); E int FDECL(X11_select_menu, (winid, int, MENU_ITEM_P **));
E void NDECL(X11_update_inventory); E void NDECL(X11_update_inventory);
+2 -2
View File
@@ -82,7 +82,7 @@ extern void curses_display_file(const char *filename, BOOLEAN_P must_exist);
extern void curses_start_menu(winid wid); extern void curses_start_menu(winid wid);
extern void curses_add_menu(winid wid, int glyph, const ANY_P * identifier, extern void curses_add_menu(winid wid, int glyph, const ANY_P * identifier,
CHAR_P accelerator, CHAR_P group_accel, int attr, CHAR_P accelerator, CHAR_P group_accel, int attr,
const char *str, BOOLEAN_P presel); const char *str, unsigned int itemflags);
extern void curses_end_menu(winid wid, const char *prompt); extern void curses_end_menu(winid wid, const char *prompt);
extern int curses_select_menu(winid wid, int how, MENU_ITEM_P **selected); extern int curses_select_menu(winid wid, int how, MENU_ITEM_P **selected);
extern void curses_update_inventory(void); extern void curses_update_inventory(void);
@@ -177,7 +177,7 @@ extern void curses_create_nhmenu(winid wid);
extern void curses_add_nhmenu_item(winid wid, int glyph, extern void curses_add_nhmenu_item(winid wid, int glyph,
const ANY_P *identifier, CHAR_P accelerator, const ANY_P *identifier, CHAR_P accelerator,
CHAR_P group_accel, int attr, CHAR_P group_accel, int attr,
const char *str, BOOLEAN_P presel); const char *str, unsigned itemflags);
extern void curs_menu_set_bottom_heavy(winid); extern void curs_menu_set_bottom_heavy(winid);
extern void curses_finalize_nhmenu(winid wid, const char *prompt); extern void curses_finalize_nhmenu(winid wid, const char *prompt);
extern int curses_display_nhmenu(winid wid, int how, MENU_ITEM_P **_selected); extern int curses_display_nhmenu(winid wid, int how, MENU_ITEM_P **_selected);
+1 -1
View File
@@ -71,7 +71,7 @@ E void FDECL(Gem_putstr, (winid, int, const char *));
E void FDECL(Gem_display_file, (const char *, BOOLEAN_P)); E void FDECL(Gem_display_file, (const char *, BOOLEAN_P));
E void FDECL(Gem_start_menu, (winid)); E void FDECL(Gem_start_menu, (winid));
E void FDECL(Gem_add_menu, (winid, int, const ANY_P *, CHAR_P, CHAR_P, int, E void FDECL(Gem_add_menu, (winid, int, const ANY_P *, CHAR_P, CHAR_P, int,
const char *, BOOLEAN_P)); const char *, unsigned int));
E void FDECL(Gem_end_menu, (winid, const char *)); E void FDECL(Gem_end_menu, (winid, const char *));
E int FDECL(Gem_select_menu, (winid, int, MENU_ITEM_P **)); E int FDECL(Gem_select_menu, (winid, int, MENU_ITEM_P **));
E char FDECL(Gem_message_menu, (CHAR_P, int, const char *)); E char FDECL(Gem_message_menu, (CHAR_P, int, const char *));
+3 -3
View File
@@ -32,7 +32,7 @@ struct window_procs {
void FDECL((*win_display_file), (const char *, BOOLEAN_P)); void FDECL((*win_display_file), (const char *, BOOLEAN_P));
void FDECL((*win_start_menu), (winid)); void FDECL((*win_start_menu), (winid));
void FDECL((*win_add_menu), (winid, int, const ANY_P *, CHAR_P, CHAR_P, void FDECL((*win_add_menu), (winid, int, const ANY_P *, CHAR_P, CHAR_P,
int, const char *, BOOLEAN_P)); int, const char *, unsigned int));
void FDECL((*win_end_menu), (winid, const char *)); void FDECL((*win_end_menu), (winid, const char *));
int FDECL((*win_select_menu), (winid, int, MENU_ITEM_P **)); int FDECL((*win_select_menu), (winid, int, MENU_ITEM_P **));
char FDECL((*win_message_menu), (CHAR_P, int, const char *)); char FDECL((*win_message_menu), (CHAR_P, int, const char *));
@@ -331,7 +331,7 @@ struct chain_procs {
void FDECL((*win_display_file), (CARGS, const char *, BOOLEAN_P)); void FDECL((*win_display_file), (CARGS, const char *, BOOLEAN_P));
void FDECL((*win_start_menu), (CARGS, winid)); void FDECL((*win_start_menu), (CARGS, winid));
void FDECL((*win_add_menu), (CARGS, winid, int, const ANY_P *, CHAR_P, void FDECL((*win_add_menu), (CARGS, winid, int, const ANY_P *, CHAR_P,
CHAR_P, int, const char *, BOOLEAN_P)); CHAR_P, int, const char *, unsigned int));
void FDECL((*win_end_menu), (CARGS, winid, const char *)); void FDECL((*win_end_menu), (CARGS, winid, const char *));
int FDECL((*win_select_menu), (CARGS, winid, int, MENU_ITEM_P **)); int FDECL((*win_select_menu), (CARGS, winid, int, MENU_ITEM_P **));
char FDECL((*win_message_menu), (CARGS, CHAR_P, int, const char *)); char FDECL((*win_message_menu), (CARGS, CHAR_P, int, const char *));
@@ -405,7 +405,7 @@ extern void FDECL(safe_putmixed, (winid, int, const char *));
extern void FDECL(safe_display_file, (const char *, BOOLEAN_P)); extern void FDECL(safe_display_file, (const char *, BOOLEAN_P));
extern void FDECL(safe_start_menu, (winid)); extern void FDECL(safe_start_menu, (winid));
extern void FDECL(safe_add_menu, (winid, int, const ANY_P *, CHAR_P, CHAR_P, extern void FDECL(safe_add_menu, (winid, int, const ANY_P *, CHAR_P, CHAR_P,
int, const char *, BOOLEAN_P)); int, const char *, unsigned int));
extern void FDECL(safe_end_menu, (winid, const char *)); extern void FDECL(safe_end_menu, (winid, const char *));
extern int FDECL(safe_select_menu, (winid, int, MENU_ITEM_P **)); extern int FDECL(safe_select_menu, (winid, int, MENU_ITEM_P **));
extern char FDECL(safe_message_menu, (CHAR_P, int, const char *)); extern char FDECL(safe_message_menu, (CHAR_P, int, const char *));
+2 -1
View File
@@ -18,6 +18,7 @@ typedef struct tty_mi {
char *str; /* description string (including accelerator) */ char *str; /* description string (including accelerator) */
int attr; /* string attribute */ int attr; /* string attribute */
boolean selected; /* TRUE if selected by user */ boolean selected; /* TRUE if selected by user */
unsigned itemflags; /* item flags */
char selector; /* keyboard accelerator */ char selector; /* keyboard accelerator */
char gselector; /* group accelerator */ char gselector; /* group accelerator */
} tty_menu_item; } tty_menu_item;
@@ -191,7 +192,7 @@ E void FDECL(tty_putstr, (winid, int, const char *));
E void FDECL(tty_display_file, (const char *, BOOLEAN_P)); E void FDECL(tty_display_file, (const char *, BOOLEAN_P));
E void FDECL(tty_start_menu, (winid)); E void FDECL(tty_start_menu, (winid));
E void FDECL(tty_add_menu, (winid, int, const ANY_P *, CHAR_P, CHAR_P, int, E void FDECL(tty_add_menu, (winid, int, const ANY_P *, CHAR_P, CHAR_P, int,
const char *, BOOLEAN_P)); const char *, unsigned int));
E void FDECL(tty_end_menu, (winid, const char *)); E void FDECL(tty_end_menu, (winid, const char *));
E int FDECL(tty_select_menu, (winid, int, MENU_ITEM_P **)); E int FDECL(tty_select_menu, (winid, int, MENU_ITEM_P **));
E char FDECL(tty_message_menu, (CHAR_P, int, const char *)); E char FDECL(tty_message_menu, (CHAR_P, int, const char *));
+8 -2
View File
@@ -54,8 +54,9 @@ enum any_types {
/* menu return list */ /* menu return list */
typedef struct mi { typedef struct mi {
anything item; /* identifier */ anything item; /* identifier */
long count; /* count */ long count; /* count */
unsigned itemflags; /* item flags */
} menu_item; } menu_item;
#define MENU_ITEM_P struct mi #define MENU_ITEM_P struct mi
@@ -105,6 +106,11 @@ typedef struct mi {
#define MENU_UNSELECT_PAGE '\\' #define MENU_UNSELECT_PAGE '\\'
#define MENU_INVERT_PAGE '~' #define MENU_INVERT_PAGE '~'
#define MENU_SEARCH ':' #define MENU_SEARCH ':'
#define MENU_ITEMFLAGS_NONE 0x0000000U
#define MENU_ITEMFLAGS_SELECTED 0x0000001U
#define MENU_ITEMFLAGS_SKIPINVERT 0x0000002U
/* clang-format on */ /* clang-format on */
#endif /* WINTYPE_H */ #endif /* WINTYPE_H */
+2
View File
@@ -11,3 +11,5 @@ tiles.bmp
graphicschk graphicschk
nhdat nhdat
o o
nhdat370
+20 -4
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 allmain.c $NHDT-Date: 1555552624 2019/04/18 01:57:04 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.100 $ */ /* NetHack 3.6 allmain.c $NHDT-Date: 1577050218 2019/12/22 21:30:18 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.136 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -66,6 +66,10 @@ boolean resuming;
g.context.rndencode = rnd(9000); g.context.rndencode = rnd(9000);
set_wear((struct obj *) 0); /* for side-effects of starting gear */ set_wear((struct obj *) 0); /* for side-effects of starting gear */
(void) pickup(1); /* autopickup at initial location */ (void) pickup(1); /* autopickup at initial location */
/* only matters if someday a character is able to start with
clairvoyance (wizard with cornuthaum perhaps?); without this,
first "random" occurrence would always kick in on turn 1 */
g.context.seer_turn = (long) rnd(30);
} }
g.context.botlx = TRUE; /* for STATUS_HILITES */ g.context.botlx = TRUE; /* for STATUS_HILITES */
update_inventory(); /* for perm_invent */ update_inventory(); /* for perm_invent */
@@ -336,9 +340,21 @@ boolean resuming;
#endif #endif
if (g.context.bypasses) if (g.context.bypasses)
clear_bypasses(); clear_bypasses();
if ((u.uhave.amulet || Clairvoyant) && !In_endgame(&u.uz) if (g.moves >= g.context.seer_turn) {
&& !BClairvoyant && !(g.moves % 15) && !rn2(2)) if ((u.uhave.amulet || Clairvoyant) && !In_endgame(&u.uz)
do_vicinity_map((struct obj *) 0); && !BClairvoyant)
do_vicinity_map((struct obj *) 0);
/* we maintain this counter even when clairvoyance isn't
taking place; on average, go again 30 turns from now */
g.context.seer_turn = g.moves + (long) rn1(31, 15); /*15..45*/
/* [it used to be that on every 15th turn, there was a 50%
chance of farsight, so it could happen as often as every
15 turns or theoretically never happen at all; but when
a fast hero got multiple moves on that 15th turn, it
could actually happen more than once on the same turn!] */
}
/* [fast hero who gets multiple moves per turn ends up sinking
multiple times per turn; is that what we really want?] */
if (u.utrap && u.utraptype == TT_LAVA) if (u.utrap && u.utraptype == TT_LAVA)
sink_into_lava(); sink_into_lava();
/* when/if hero escapes from lava, he can't just stay there */ /* when/if hero escapes from lava, he can't just stay there */
+3 -3
View File
@@ -3173,14 +3173,14 @@ struct obj *obj;
any.a_int++; any.a_int++;
Sprintf(buf, "an object on the %s", surface(cc.x, cc.y)); Sprintf(buf, "an object on the %s", surface(cc.x, cc.y));
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
any.a_int++; any.a_int++;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "a monster", add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "a monster",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
any.a_int++; any.a_int++;
Sprintf(buf, "the %s", surface(cc.x, cc.y)); Sprintf(buf, "the %s", surface(cc.x, cc.y));
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
end_menu(tmpwin, "Aim for what?"); end_menu(tmpwin, "Aim for what?");
tohit = rn2(4); tohit = rn2(4);
if (select_menu(tmpwin, PICK_ONE, &selected) > 0 if (select_menu(tmpwin, PICK_ONE, &selected) > 0
+1 -1
View File
@@ -1524,7 +1524,7 @@ struct obj *obj;
continue; continue;
any.a_int = i + 1; any.a_int = i + 1;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
g.dungeons[i].dname, MENU_UNSELECTED); g.dungeons[i].dname, MENU_ITEMFLAGS_NONE);
num_ok_dungeons++; num_ok_dungeons++;
last_ok_dungeon = i; last_ok_dungeon = i;
} }
+27 -22
View File
@@ -1930,7 +1930,7 @@ int arrmin, arrmax;
any = cg.zeroany; any = cg.zeroany;
any.a_int = i + adj; any.a_int = i + adj;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
arr[i], MENU_UNSELECTED); arr[i], MENU_ITEMFLAGS_NONE);
} }
end_menu(tmpwin, querystr); end_menu(tmpwin, querystr);
@@ -2305,7 +2305,7 @@ query_conditions()
any = cg.zeroany; any = cg.zeroany;
any.a_ulong = valid_conditions[i].bitmask; any.a_ulong = valid_conditions[i].bitmask;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
valid_conditions[i].id, MENU_UNSELECTED); valid_conditions[i].id, MENU_ITEMFLAGS_NONE);
} }
end_menu(tmpwin, "Choose status conditions"); end_menu(tmpwin, "Choose status conditions");
@@ -2874,7 +2874,7 @@ status_hilite_menu_choose_field()
any = cg.zeroany; any = cg.zeroany;
any.a_int = (i + 1); any.a_int = (i + 1);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
initblstats[i].fldname, MENU_UNSELECTED); initblstats[i].fldname, MENU_ITEMFLAGS_NONE);
} }
end_menu(tmpwin, "Select a hilite field:"); end_menu(tmpwin, "Select a hilite field:");
@@ -2913,7 +2913,7 @@ int fld;
any.a_int = onlybeh = BL_TH_ALWAYS_HILITE; any.a_int = onlybeh = BL_TH_ALWAYS_HILITE;
Sprintf(buf, "Always highlight %s", initblstats[fld].fldname); Sprintf(buf, "Always highlight %s", initblstats[fld].fldname);
add_menu(tmpwin, NO_GLYPH, &any, 'a', 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 'a', 0, ATR_NONE,
buf, MENU_UNSELECTED); buf, MENU_ITEMFLAGS_NONE);
nopts++; nopts++;
} }
@@ -2921,7 +2921,7 @@ int fld;
any = cg.zeroany; any = cg.zeroany;
any.a_int = onlybeh = BL_TH_CONDITION; any.a_int = onlybeh = BL_TH_CONDITION;
add_menu(tmpwin, NO_GLYPH, &any, 'b', 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 'b', 0, ATR_NONE,
"Bitmask of conditions", MENU_UNSELECTED); "Bitmask of conditions", MENU_ITEMFLAGS_NONE);
nopts++; nopts++;
} }
@@ -2930,7 +2930,7 @@ int fld;
any.a_int = onlybeh = BL_TH_UPDOWN; any.a_int = onlybeh = BL_TH_UPDOWN;
Sprintf(buf, "%s value changes", initblstats[fld].fldname); Sprintf(buf, "%s value changes", initblstats[fld].fldname);
add_menu(tmpwin, NO_GLYPH, &any, 'c', 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 'c', 0, ATR_NONE,
buf, MENU_UNSELECTED); buf, MENU_ITEMFLAGS_NONE);
nopts++; nopts++;
} }
@@ -2939,7 +2939,7 @@ int fld;
any = cg.zeroany; any = cg.zeroany;
any.a_int = onlybeh = BL_TH_VAL_ABSOLUTE; any.a_int = onlybeh = BL_TH_VAL_ABSOLUTE;
add_menu(tmpwin, NO_GLYPH, &any, 'n', 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 'n', 0, ATR_NONE,
"Number threshold", MENU_UNSELECTED); "Number threshold", MENU_ITEMFLAGS_NONE);
nopts++; nopts++;
} }
@@ -2947,7 +2947,7 @@ int fld;
any = cg.zeroany; any = cg.zeroany;
any.a_int = onlybeh = BL_TH_VAL_PERCENTAGE; any.a_int = onlybeh = BL_TH_VAL_PERCENTAGE;
add_menu(tmpwin, NO_GLYPH, &any, 'p', 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 'p', 0, ATR_NONE,
"Percentage threshold", MENU_UNSELECTED); "Percentage threshold", MENU_ITEMFLAGS_NONE);
nopts++; nopts++;
} }
@@ -2957,7 +2957,7 @@ int fld;
any.a_int = onlybeh = BL_TH_TEXTMATCH; any.a_int = onlybeh = BL_TH_TEXTMATCH;
Sprintf(buf, "%s text match", initblstats[fld].fldname); Sprintf(buf, "%s text match", initblstats[fld].fldname);
add_menu(tmpwin, NO_GLYPH, &any, 't', 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 't', 0, ATR_NONE,
buf, MENU_UNSELECTED); buf, MENU_ITEMFLAGS_NONE);
nopts++; nopts++;
} }
@@ -3004,7 +3004,7 @@ boolean ltok, gtok;
any = cg.zeroany; any = cg.zeroany;
any.a_int = 10 + LT_VALUE; any.a_int = 10 + LT_VALUE;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
buf, MENU_UNSELECTED); buf, MENU_ITEMFLAGS_NONE);
if (str) { if (str) {
Sprintf(buf, "%s or %s", Sprintf(buf, "%s or %s",
@@ -3012,7 +3012,7 @@ boolean ltok, gtok;
any = cg.zeroany; any = cg.zeroany;
any.a_int = 10 + LE_VALUE; any.a_int = 10 + LE_VALUE;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
buf, MENU_UNSELECTED); buf, MENU_ITEMFLAGS_NONE);
} }
} }
@@ -3023,7 +3023,7 @@ boolean ltok, gtok;
any = cg.zeroany; any = cg.zeroany;
any.a_int = 10 + EQ_VALUE; any.a_int = 10 + EQ_VALUE;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
buf, MENU_UNSELECTED); buf, MENU_ITEMFLAGS_NONE);
if (gtok) { if (gtok) {
if (str) { if (str) {
@@ -3032,7 +3032,7 @@ boolean ltok, gtok;
any = cg.zeroany; any = cg.zeroany;
any.a_int = 10 + GE_VALUE; any.a_int = 10 + GE_VALUE;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
buf, MENU_UNSELECTED); buf, MENU_ITEMFLAGS_NONE);
} }
if (str) if (str)
@@ -3043,7 +3043,7 @@ boolean ltok, gtok;
any = cg.zeroany; any = cg.zeroany;
any.a_int = 10 + GT_VALUE; any.a_int = 10 + GT_VALUE;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
buf, MENU_UNSELECTED); buf, MENU_ITEMFLAGS_NONE);
} }
Sprintf(buf, "Select field %s value:", initblstats[fld].fldname); Sprintf(buf, "Select field %s value:", initblstats[fld].fldname);
end_menu(tmpwin, buf); end_menu(tmpwin, buf);
@@ -3545,25 +3545,28 @@ int fld;
any = cg.zeroany; any = cg.zeroany;
any.a_int = hlstr->id; any.a_int = hlstr->id;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
hlstr->str, MENU_UNSELECTED); hlstr->str, MENU_ITEMFLAGS_NONE);
} }
hlstr = hlstr->next; hlstr = hlstr->next;
} }
} else { } else {
any = cg.zeroany; any = cg.zeroany;
Sprintf(buf, "No current hilites for %s", initblstats[fld].fldname); Sprintf(buf, "No current hilites for %s", initblstats[fld].fldname);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
MENU_ITEMFLAGS_NONE);
} }
/* separator line */ /* separator line */
any = cg.zeroany; any = cg.zeroany;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "",
MENU_ITEMFLAGS_NONE);
if (count) { if (count) {
any = cg.zeroany; any = cg.zeroany;
any.a_int = -1; any.a_int = -1;
add_menu(tmpwin, NO_GLYPH, &any, 'X', 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 'X', 0, ATR_NONE,
"Remove selected hilites", MENU_UNSELECTED); "Remove selected hilites",
MENU_ITEMFLAGS_NONE);
} }
#ifndef SCORE_ON_BOTL #ifndef SCORE_ON_BOTL
@@ -3579,7 +3582,7 @@ int fld;
any = cg.zeroany; any = cg.zeroany;
any.a_int = -2; any.a_int = -2;
add_menu(tmpwin, NO_GLYPH, &any, 'Z', 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 'Z', 0, ATR_NONE,
"Add a new hilite", MENU_UNSELECTED); "Add a new hilite", MENU_ITEMFLAGS_NONE);
} }
Sprintf(buf, "Current %s hilites:", initblstats[fld].fldname); Sprintf(buf, "Current %s hilites:", initblstats[fld].fldname);
@@ -3675,10 +3678,12 @@ shlmenu_redo:
any = cg.zeroany; any = cg.zeroany;
any.a_int = -1; any.a_int = -1;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
"View all hilites in config format", MENU_UNSELECTED); "View all hilites in config format",
MENU_ITEMFLAGS_NONE);
any = cg.zeroany; any = cg.zeroany;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "",
MENU_ITEMFLAGS_NONE);
} }
for (i = 0; i < MAXBLSTATS; i++) { for (i = 0; i < MAXBLSTATS; i++) {
@@ -3699,7 +3704,7 @@ shlmenu_redo:
if (count) if (count)
Sprintf(eos(buf), " (%d defined)", count); Sprintf(eos(buf), " (%d defined)", count);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
buf, MENU_UNSELECTED); buf, MENU_ITEMFLAGS_NONE);
} }
end_menu(tmpwin, "Status hilites:"); end_menu(tmpwin, "Status hilites:");
+67 -44
View File
@@ -378,9 +378,10 @@ doextlist(VOID_ARGS)
any = cg.zeroany; any = cg.zeroany;
start_menu(menuwin); start_menu(menuwin);
add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
"Extended Commands List", MENU_UNSELECTED); "Extended Commands List",
MENU_ITEMFLAGS_NONE);
add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
"", MENU_UNSELECTED); "", MENU_ITEMFLAGS_NONE);
Strcpy(buf, menumode ? "Show" : "Hide"); Strcpy(buf, menumode ? "Show" : "Hide");
Strcat(buf, " commands that don't autocomplete"); Strcat(buf, " commands that don't autocomplete");
@@ -388,7 +389,7 @@ doextlist(VOID_ARGS)
Strcat(buf, " (those not marked with [A])"); Strcat(buf, " (those not marked with [A])");
any.a_int = 1; any.a_int = 1;
add_menu(menuwin, NO_GLYPH, &any, 'a', 0, ATR_NONE, buf, add_menu(menuwin, NO_GLYPH, &any, 'a', 0, ATR_NONE, buf,
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
if (!*searchbuf) { if (!*searchbuf) {
any.a_int = 2; any.a_int = 2;
@@ -398,7 +399,8 @@ doextlist(VOID_ARGS)
having ':' as an explicit selector overrides the default having ':' as an explicit selector overrides the default
menu behavior for it; we retain 's' as a group accelerator */ menu behavior for it; we retain 's' as a group accelerator */
add_menu(menuwin, NO_GLYPH, &any, ':', 's', ATR_NONE, add_menu(menuwin, NO_GLYPH, &any, ':', 's', ATR_NONE,
"Search extended commands", MENU_UNSELECTED); "Search extended commands",
MENU_ITEMFLAGS_NONE);
} else { } else {
Strcpy(buf, "Show all, clear search"); Strcpy(buf, "Show all, clear search");
if (strlen(buf) + strlen(searchbuf) + strlen(" (\"\")") < QBUFSZ) if (strlen(buf) + strlen(searchbuf) + strlen(" (\"\")") < QBUFSZ)
@@ -410,18 +412,18 @@ doextlist(VOID_ARGS)
work for interfaces which support ':' to search; use as a work for interfaces which support ':' to search; use as a
general menu command takes precedence over group accelerator */ general menu command takes precedence over group accelerator */
add_menu(menuwin, NO_GLYPH, &any, 's', ':', ATR_NONE, add_menu(menuwin, NO_GLYPH, &any, 's', ':', ATR_NONE,
buf, MENU_UNSELECTED); buf, MENU_ITEMFLAGS_NONE);
} }
if (wizard) { if (wizard) {
any.a_int = 4; any.a_int = 4;
add_menu(menuwin, NO_GLYPH, &any, 'z', 0, ATR_NONE, add_menu(menuwin, NO_GLYPH, &any, 'z', 0, ATR_NONE,
onelist ? "Show debugging commands in separate section" onelist ? "Show debugging commands in separate section"
: "Show all alphabetically, including debugging commands", : "Show all alphabetically, including debugging commands",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
} }
any = cg.zeroany; any = cg.zeroany;
add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
"", MENU_UNSELECTED); "", MENU_ITEMFLAGS_NONE);
menushown[0] = menushown[1] = 0; menushown[0] = menushown[1] = 0;
n = 0; n = 0;
for (pass = 0; pass <= 1; ++pass) { for (pass = 0; pass <= 1; ++pass) {
@@ -463,7 +465,8 @@ doextlist(VOID_ARGS)
if (!menushown[pass]) { if (!menushown[pass]) {
Strcpy(buf, headings[pass]); Strcpy(buf, headings[pass]);
add_menu(menuwin, NO_GLYPH, &any, 0, 0, add_menu(menuwin, NO_GLYPH, &any, 0, 0,
iflags.menu_headings, buf, MENU_UNSELECTED); iflags.menu_headings, buf,
MENU_ITEMFLAGS_NONE);
menushown[pass] = 1; menushown[pass] = 1;
} }
Sprintf(buf, " %-14s %-3s %s", Sprintf(buf, " %-14s %-3s %s",
@@ -471,16 +474,16 @@ doextlist(VOID_ARGS)
(efp->flags & AUTOCOMPLETE) ? "[A]" : " ", (efp->flags & AUTOCOMPLETE) ? "[A]" : " ",
efp->ef_desc); efp->ef_desc);
add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
buf, MENU_UNSELECTED); buf, MENU_ITEMFLAGS_NONE);
++n; ++n;
} }
if (n) if (n)
add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
"", MENU_UNSELECTED); "", MENU_ITEMFLAGS_NONE);
} }
if (*searchbuf && !n) if (*searchbuf && !n)
add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(menuwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
"no matches", MENU_UNSELECTED); "no matches", MENU_ITEMFLAGS_NONE);
end_menu(menuwin, (char *) 0); end_menu(menuwin, (char *) 0);
n = select_menu(menuwin, PICK_ONE, &selected); n = select_menu(menuwin, PICK_ONE, &selected);
@@ -617,7 +620,7 @@ extcmd_via_menu()
Sprintf(buf, fmtstr, prompt); Sprintf(buf, fmtstr, prompt);
any.a_char = prevaccelerator; any.a_char = prevaccelerator;
add_menu(win, NO_GLYPH, &any, any.a_char, 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, any.a_char, 0, ATR_NONE,
buf, FALSE); buf, MENU_ITEMFLAGS_NONE);
acount = 0; acount = 0;
if (!(accelerator != prevaccelerator || one_per_line)) if (!(accelerator != prevaccelerator || one_per_line))
wastoolong = TRUE; wastoolong = TRUE;
@@ -641,7 +644,7 @@ extcmd_via_menu()
Sprintf(buf, fmtstr, prompt); Sprintf(buf, fmtstr, prompt);
any.a_char = prevaccelerator; any.a_char = prevaccelerator;
add_menu(win, NO_GLYPH, &any, any.a_char, 0, ATR_NONE, buf, add_menu(win, NO_GLYPH, &any, any.a_char, 0, ATR_NONE, buf,
FALSE); MENU_ITEMFLAGS_NONE);
} }
Sprintf(prompt, "Extended Command: %s", cbuf); Sprintf(prompt, "Extended Command: %s", cbuf);
end_menu(win, prompt); end_menu(win, prompt);
@@ -943,7 +946,7 @@ wiz_detect(VOID_ARGS)
static int static int
wiz_load_lua(VOID_ARGS) wiz_load_lua(VOID_ARGS)
{ {
if (wizard) { if (wizard && !iflags.debug_fuzzer) {
char buf[BUFSZ]; char buf[BUFSZ];
buf[0] = '\0'; buf[0] = '\0';
@@ -961,7 +964,7 @@ wiz_load_lua(VOID_ARGS)
static int static int
wiz_load_splua(VOID_ARGS) wiz_load_splua(VOID_ARGS)
{ {
if (wizard) { if (wizard && !iflags.debug_fuzzer) {
boolean was_in_W_tower = In_W_tower(u.ux, u.uy, &u.uz); boolean was_in_W_tower = In_W_tower(u.ux, u.uy, &u.uz);
char buf[BUFSZ]; char buf[BUFSZ];
int ridx; int ridx;
@@ -1488,7 +1491,8 @@ wiz_intrinsic(VOID_ARGS)
} }
if (p == FIRE_RES) { if (p == FIRE_RES) {
any.a_int = 0; any.a_int = 0;
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "--", FALSE); add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "--",
MENU_ITEMFLAGS_NONE);
} }
any.a_int = i + 1; /* +1: avoid 0 */ any.a_int = i + 1; /* +1: avoid 0 */
oldtimeout = u.uprops[p].intrinsic & TIMEOUT; oldtimeout = u.uprops[p].intrinsic & TIMEOUT;
@@ -1496,7 +1500,8 @@ wiz_intrinsic(VOID_ARGS)
Sprintf(buf, "%-27s [%li]", propname, oldtimeout); Sprintf(buf, "%-27s [%li]", propname, oldtimeout);
else else
Sprintf(buf, "%s", propname); Sprintf(buf, "%s", propname);
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
MENU_ITEMFLAGS_NONE);
} }
end_menu(win, "Which intrinsics?"); end_menu(win, "Which intrinsics?");
n = select_menu(win, PICK_ANY, &pick_list); n = select_menu(win, PICK_ANY, &pick_list);
@@ -1623,29 +1628,29 @@ doterrain(VOID_ARGS)
any.a_int = 1; any.a_int = 1;
add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE,
"known map without monsters, objects, and traps", "known map without monsters, objects, and traps",
MENU_SELECTED); MENU_ITEMFLAGS_SELECTED);
any.a_int = 2; any.a_int = 2;
add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE,
"known map without monsters and objects", "known map without monsters and objects",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
any.a_int = 3; any.a_int = 3;
add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE,
"known map without monsters", "known map without monsters",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
if (discover || wizard) { if (discover || wizard) {
any.a_int = 4; any.a_int = 4;
add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE,
"full map without monsters, objects, and traps", "full map without monsters, objects, and traps",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
if (wizard) { if (wizard) {
any.a_int = 5; any.a_int = 5;
add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE,
"internal levl[][].typ codes in base-36", "internal levl[][].typ codes in base-36",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
any.a_int = 6; any.a_int = 6;
add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(men, NO_GLYPH, &any, 0, 0, ATR_NONE,
"legend of base-36 levl[][].typ codes", "legend of base-36 levl[][].typ codes",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
} }
} }
end_menu(men, "View which?"); end_menu(men, "View which?");
@@ -1715,7 +1720,8 @@ const char *buf;
anything any; anything any;
any = cg.zeroany; any = cg.zeroany;
add_menu(g.en_win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); add_menu(g.en_win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
MENU_ITEMFLAGS_NONE);
} else } else
putstr(g.en_win, 0, buf); putstr(g.en_win, 0, buf);
} }
@@ -3163,64 +3169,78 @@ minimal_enlightenment()
tmpwin = create_nhwindow(NHW_MENU); tmpwin = create_nhwindow(NHW_MENU);
start_menu(tmpwin); start_menu(tmpwin);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
"Starting", FALSE); "Starting", MENU_ITEMFLAGS_NONE);
/* Starting name, race, role, gender */ /* Starting name, race, role, gender */
Sprintf(buf, fmtstr, "name", g.plname); Sprintf(buf, fmtstr, "name", g.plname);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
MENU_ITEMFLAGS_NONE);
Sprintf(buf, fmtstr, "race", g.urace.noun); Sprintf(buf, fmtstr, "race", g.urace.noun);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
MENU_ITEMFLAGS_NONE);
Sprintf(buf, fmtstr, "role", Sprintf(buf, fmtstr, "role",
(flags.initgend && g.urole.name.f) ? g.urole.name.f : g.urole.name.m); (flags.initgend && g.urole.name.f) ? g.urole.name.f : g.urole.name.m);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
MENU_ITEMFLAGS_NONE);
Sprintf(buf, fmtstr, "gender", genders[flags.initgend].adj); Sprintf(buf, fmtstr, "gender", genders[flags.initgend].adj);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
MENU_ITEMFLAGS_NONE);
/* Starting alignment */ /* Starting alignment */
Sprintf(buf, fmtstr, "alignment", align_str(u.ualignbase[A_ORIGINAL])); Sprintf(buf, fmtstr, "alignment", align_str(u.ualignbase[A_ORIGINAL]));
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
MENU_ITEMFLAGS_NONE);
/* Current name, race, role, gender */ /* Current name, race, role, gender */
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", FALSE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "",
MENU_ITEMFLAGS_NONE);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
"Current", FALSE); "Current", MENU_ITEMFLAGS_NONE);
Sprintf(buf, fmtstr, "race", Upolyd ? g.youmonst.data->mname : g.urace.noun); Sprintf(buf, fmtstr, "race", Upolyd ? g.youmonst.data->mname : g.urace.noun);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
MENU_ITEMFLAGS_NONE);
if (Upolyd) { if (Upolyd) {
Sprintf(buf, fmtstr, "role (base)", Sprintf(buf, fmtstr, "role (base)",
(u.mfemale && g.urole.name.f) ? g.urole.name.f (u.mfemale && g.urole.name.f) ? g.urole.name.f
: g.urole.name.m); : g.urole.name.m);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
MENU_ITEMFLAGS_NONE);
} else { } else {
Sprintf(buf, fmtstr, "role", Sprintf(buf, fmtstr, "role",
(flags.female && g.urole.name.f) ? g.urole.name.f (flags.female && g.urole.name.f) ? g.urole.name.f
: g.urole.name.m); : g.urole.name.m);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
MENU_ITEMFLAGS_NONE);
} }
/* don't want poly_gender() here; it forces `2' for non-humanoids */ /* don't want poly_gender() here; it forces `2' for non-humanoids */
genidx = is_neuter(g.youmonst.data) ? 2 : flags.female; genidx = is_neuter(g.youmonst.data) ? 2 : flags.female;
Sprintf(buf, fmtstr, "gender", genders[genidx].adj); Sprintf(buf, fmtstr, "gender", genders[genidx].adj);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
MENU_ITEMFLAGS_NONE);
if (Upolyd && (int) u.mfemale != genidx) { if (Upolyd && (int) u.mfemale != genidx) {
Sprintf(buf, fmtstr, "gender (base)", genders[u.mfemale].adj); Sprintf(buf, fmtstr, "gender (base)", genders[u.mfemale].adj);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
MENU_ITEMFLAGS_NONE);
} }
/* Current alignment */ /* Current alignment */
Sprintf(buf, fmtstr, "alignment", align_str(u.ualign.type)); Sprintf(buf, fmtstr, "alignment", align_str(u.ualign.type));
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
MENU_ITEMFLAGS_NONE);
/* Deity list */ /* Deity list */
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", FALSE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "",
MENU_ITEMFLAGS_NONE);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
"Deities", FALSE); "Deities", MENU_ITEMFLAGS_NONE);
Sprintf(buf2, deity_fmtstr, align_gname(A_CHAOTIC), Sprintf(buf2, deity_fmtstr, align_gname(A_CHAOTIC),
(u.ualignbase[A_ORIGINAL] == u.ualign.type (u.ualignbase[A_ORIGINAL] == u.ualign.type
&& u.ualign.type == A_CHAOTIC) ? " (s,c)" && u.ualign.type == A_CHAOTIC) ? " (s,c)"
: (u.ualignbase[A_ORIGINAL] == A_CHAOTIC) ? " (s)" : (u.ualignbase[A_ORIGINAL] == A_CHAOTIC) ? " (s)"
: (u.ualign.type == A_CHAOTIC) ? " (c)" : ""); : (u.ualign.type == A_CHAOTIC) ? " (c)" : "");
Sprintf(buf, fmtstr, "Chaotic", buf2); Sprintf(buf, fmtstr, "Chaotic", buf2);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
MENU_ITEMFLAGS_NONE);
Sprintf(buf2, deity_fmtstr, align_gname(A_NEUTRAL), Sprintf(buf2, deity_fmtstr, align_gname(A_NEUTRAL),
(u.ualignbase[A_ORIGINAL] == u.ualign.type (u.ualignbase[A_ORIGINAL] == u.ualign.type
@@ -3228,7 +3248,8 @@ minimal_enlightenment()
: (u.ualignbase[A_ORIGINAL] == A_NEUTRAL) ? " (s)" : (u.ualignbase[A_ORIGINAL] == A_NEUTRAL) ? " (s)"
: (u.ualign.type == A_NEUTRAL) ? " (c)" : ""); : (u.ualign.type == A_NEUTRAL) ? " (c)" : "");
Sprintf(buf, fmtstr, "Neutral", buf2); Sprintf(buf, fmtstr, "Neutral", buf2);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
MENU_ITEMFLAGS_NONE);
Sprintf(buf2, deity_fmtstr, align_gname(A_LAWFUL), Sprintf(buf2, deity_fmtstr, align_gname(A_LAWFUL),
(u.ualignbase[A_ORIGINAL] == u.ualign.type (u.ualignbase[A_ORIGINAL] == u.ualign.type
@@ -3236,7 +3257,8 @@ minimal_enlightenment()
: (u.ualignbase[A_ORIGINAL] == A_LAWFUL) ? " (s)" : (u.ualignbase[A_ORIGINAL] == A_LAWFUL) ? " (s)"
: (u.ualign.type == A_LAWFUL) ? " (c)" : ""); : (u.ualign.type == A_LAWFUL) ? " (c)" : "");
Sprintf(buf, fmtstr, "Lawful", buf2); Sprintf(buf, fmtstr, "Lawful", buf2);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
MENU_ITEMFLAGS_NONE);
end_menu(tmpwin, "Base Attributes"); end_menu(tmpwin, "Base Attributes");
n = select_menu(tmpwin, PICK_NONE, &selected); n = select_menu(tmpwin, PICK_NONE, &selected);
@@ -5443,7 +5465,8 @@ const char *text;
if ((ch = cmd_from_func(func)) != '\0') { if ((ch = cmd_from_func(func)) != '\0') {
any = cg.zeroany; any = cg.zeroany;
any.a_nfunc = func; any.a_nfunc = func;
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, text, MENU_UNSELECTED); add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, text,
MENU_ITEMFLAGS_NONE);
} }
} }
+15 -3
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 detect.c $NHDT-Date: 1575245054 2019/12/02 00:04:14 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.100 $ */ /* NetHack 3.6 detect.c $NHDT-Date: 1577050472 2019/12/22 21:34:32 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.110 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2018. */ /*-Copyright (c) Robert Patrick Rankin, 2018. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1314,7 +1314,8 @@ struct obj *sobj; /* scroll--actually fake spellbook--object */
/* fake spellbook 'sobj' implies hero has cast the spell; /* fake spellbook 'sobj' implies hero has cast the spell;
when book is blessed, casting is skilled or expert level; when book is blessed, casting is skilled or expert level;
if already clairvoyant, non-skilled spell acts like skilled */ if already clairvoyant, non-skilled spell acts like skilled */
extended = (sobj && (sobj->blessed || Clairvoyant)); extended = (sobj && (sobj->blessed || Clairvoyant)),
random_farsight = !sobj;
int newglyph, oldglyph, int newglyph, oldglyph,
lo_y = ((u.uy - 5 < 0) ? 0 : u.uy - 5), lo_y = ((u.uy - 5 < 0) ? 0 : u.uy - 5),
hi_y = ((u.uy + 6 >= ROWNO) ? ROWNO - 1 : u.uy + 6), hi_y = ((u.uy + 6 >= ROWNO) ? ROWNO - 1 : u.uy + 6),
@@ -1391,7 +1392,18 @@ struct obj *sobj; /* scroll--actually fake spellbook--object */
} }
} }
if (!g.level.flags.hero_memory || unconstrained || mdetected || odetected) { /* when this instance of clairvoyance is random (see allmain()) and
the only reason to browse the map is that previously undetected
monster(s) or object(s) have been revealed, player can prevent
the you-sense-your-surroundings message and browse operation from
happening by setting 'quick_farsight' option; for clairvoyance
spell, that option is ignored because the message and the pause
for map browsing isn't as intrusive in that circumstance */
if (random_farsight && flags.quick_farsight)
mdetected = odetected = FALSE;
if (!g.level.flags.hero_memory || unconstrained
|| mdetected || odetected) {
flush_screen(1); /* flush temp screen */ flush_screen(1); /* flush temp screen */
/* the getpos() prompt from browse_map() is only shown when /* the getpos() prompt from browse_map() is only shown when
flags.verbose is set, but make this unconditional so that flags.verbose is set, but make this unconditional so that
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 do.c $NHDT-Date: 1576638499 2019/12/18 03:08:19 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.198 $ */ /* NetHack 3.6 do.c $NHDT-Date: 1577063925 2019/12/23 01:18:45 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.220 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */ /*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1311,7 +1311,7 @@ boolean at_stairs, falling, portal;
if (diff != 0) { if (diff != 0) {
assign_rnd_level(newlevel, &u.uz, diff); assign_rnd_level(newlevel, &u.uz, diff);
/* assign_rnd_level() may have used a value less than diff */ /* assign_rnd_level() may have used a value less than diff */
diff = u.uz.dlevel - newlevel->dlevel; /* actual descent */ diff = newlevel->dlevel - u.uz.dlevel; /* actual descent */
/* if inside the tower, stay inside */ /* if inside the tower, stay inside */
if (was_in_W_tower && !On_W_tower_level(newlevel)) if (was_in_W_tower && !On_W_tower_level(newlevel))
diff = 0; diff = 0;
+7 -7
View File
@@ -601,7 +601,7 @@ int gloc;
Sprintf(fullbuf, "%s%s%s", firstmatch, Sprintf(fullbuf, "%s%s%s", firstmatch,
(*tmpbuf ? " " : ""), tmpbuf); (*tmpbuf ? " " : ""), tmpbuf);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, fullbuf, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, fullbuf,
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
} }
} }
@@ -1352,26 +1352,26 @@ docallcmd()
any = cg.zeroany; any = cg.zeroany;
any.a_char = 'm'; /* group accelerator 'C' */ any.a_char = 'm'; /* group accelerator 'C' */
add_menu(win, NO_GLYPH, &any, abc ? 0 : any.a_char, 'C', ATR_NONE, add_menu(win, NO_GLYPH, &any, abc ? 0 : any.a_char, 'C', ATR_NONE,
"a monster", MENU_UNSELECTED); "a monster", MENU_ITEMFLAGS_NONE);
if (g.invent) { if (g.invent) {
/* we use y and n as accelerators so that we can accept user's /* we use y and n as accelerators so that we can accept user's
response keyed to old "name an individual object?" prompt */ response keyed to old "name an individual object?" prompt */
any.a_char = 'i'; /* group accelerator 'y' */ any.a_char = 'i'; /* group accelerator 'y' */
add_menu(win, NO_GLYPH, &any, abc ? 0 : any.a_char, 'y', ATR_NONE, add_menu(win, NO_GLYPH, &any, abc ? 0 : any.a_char, 'y', ATR_NONE,
"a particular object in inventory", MENU_UNSELECTED); "a particular object in inventory", MENU_ITEMFLAGS_NONE);
any.a_char = 'o'; /* group accelerator 'n' */ any.a_char = 'o'; /* group accelerator 'n' */
add_menu(win, NO_GLYPH, &any, abc ? 0 : any.a_char, 'n', ATR_NONE, add_menu(win, NO_GLYPH, &any, abc ? 0 : any.a_char, 'n', ATR_NONE,
"the type of an object in inventory", MENU_UNSELECTED); "the type of an object in inventory", MENU_ITEMFLAGS_NONE);
} }
any.a_char = 'f'; /* group accelerator ',' (or ':' instead?) */ any.a_char = 'f'; /* group accelerator ',' (or ':' instead?) */
add_menu(win, NO_GLYPH, &any, abc ? 0 : any.a_char, ',', ATR_NONE, add_menu(win, NO_GLYPH, &any, abc ? 0 : any.a_char, ',', ATR_NONE,
"the type of an object upon the floor", MENU_UNSELECTED); "the type of an object upon the floor", MENU_ITEMFLAGS_NONE);
any.a_char = 'd'; /* group accelerator '\' */ any.a_char = 'd'; /* group accelerator '\' */
add_menu(win, NO_GLYPH, &any, abc ? 0 : any.a_char, '\\', ATR_NONE, add_menu(win, NO_GLYPH, &any, abc ? 0 : any.a_char, '\\', ATR_NONE,
"the type of an object on discoveries list", MENU_UNSELECTED); "the type of an object on discoveries list", MENU_ITEMFLAGS_NONE);
any.a_char = 'a'; /* group accelerator 'l' */ any.a_char = 'a'; /* group accelerator 'l' */
add_menu(win, NO_GLYPH, &any, abc ? 0 : any.a_char, 'l', ATR_NONE, add_menu(win, NO_GLYPH, &any, abc ? 0 : any.a_char, 'l', ATR_NONE,
"record an annotation for the current level", MENU_UNSELECTED); "record an annotation for the current level", MENU_ITEMFLAGS_NONE);
end_menu(win, "What do you want to name?"); end_menu(win, "What do you want to name?");
if (select_menu(win, PICK_ONE, &pick_list) > 0) { if (select_menu(win, PICK_ONE, &pick_list) > 0) {
ch = pick_list[0].item.a_char; ch = pick_list[0].item.a_char;
+2 -2
View File
@@ -1978,7 +1978,7 @@ boolean unreachable;
any.a_int = lchoices->idx + 1; any.a_int = lchoices->idx + 1;
} }
add_menu(win, NO_GLYPH, &any, lchoices->menuletter, 0, ATR_NONE, entry, add_menu(win, NO_GLYPH, &any, lchoices->menuletter, 0, ATR_NONE, entry,
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
/* this assumes there are at most 52 interesting levels */ /* this assumes there are at most 52 interesting levels */
if (lchoices->menuletter == 'z') if (lchoices->menuletter == 'z')
lchoices->menuletter = 'A'; lchoices->menuletter = 'A';
@@ -2090,7 +2090,7 @@ xchar *rdgn;
if (bymenu) { if (bymenu) {
any = cg.zeroany; any = cg.zeroany;
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, buf, add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, buf,
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
} else } else
putstr(win, 0, buf); putstr(win, 0, buf);
+34 -6
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 eat.c $NHDT-Date: 1574900825 2019/11/28 00:27:05 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.206 $ */ /* NetHack 3.6 eat.c $NHDT-Date: 1577190688 2019/12/24 12:31:28 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.222 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -2810,19 +2810,47 @@ gethungry()
/* Conflict uses up food too */ /* Conflict uses up food too */
if (HConflict || (EConflict & (~W_ARTI))) if (HConflict || (EConflict & (~W_ARTI)))
u.uhunger--; u.uhunger--;
/* +0 charged rings don't do anything, so don't affect hunger. /*
Slow digestion cancels move hunger but still causes ring hunger. */ * +0 charged rings don't do anything, so don't affect hunger.
* Slow digestion cancels movement and melee hunger but still
* causes ring hunger.
* Possessing the real Amulet imposes a separate hunger penalty
* from wearing an amulet (so gets a double penalty when worn).
*
* 3.7.0: Worn meat rings don't affect hunger.
* Same with worn cheap plastic imitation of the Amulet.
* +0 ring of protection might do something (enhanced "magical
* cancellation") if hero doesn't have protection from some
* other source (cloak or second ring).
*/
switch ((int) (g.moves % 20)) { /* note: use even cases only */ switch ((int) (g.moves % 20)) { /* note: use even cases only */
case 4: case 4:
if (uleft && (uleft->spe || !objects[uleft->otyp].oc_charged)) if (uleft && uleft->otyp != MEAT_RING
/* more hungry if +/- is nonzero or +/- doesn't apply or
+0 ring of protection is only source of protection;
need to check whether both rings are +0 protection or
they'd both slip by the "is there another source?" test,
but don't do that for both rings or they will both be
treated as supplying "MC" when only one matters */
&& (uleft->spe
|| !objects[uleft->otyp].oc_charged
|| (uleft->otyp == RIN_PROTECTION
&& ((EProtection & ~W_RINGL) == 0L
|| ((EProtection & ~W_RINGL) == W_RINGR
&& uright && uright->otyp == RIN_PROTECTION
&& !uright->spe)))))
u.uhunger--; u.uhunger--;
break; break;
case 8: case 8:
if (uamul) if (uamul && uamul->otyp != FAKE_AMULET_OF_YENDOR)
u.uhunger--; u.uhunger--;
break; break;
case 12: case 12:
if (uright && (uright->spe || !objects[uright->otyp].oc_charged)) if (uright && uright->otyp != MEAT_RING
&& (uright->spe
|| !objects[uright->otyp].oc_charged
|| (uright->otyp == RIN_PROTECTION
&& (EProtection & ~W_RINGR) == 0L)))
u.uhunger--; u.uhunger--;
break; break;
case 16: case 16:
+2 -1
View File
@@ -1815,7 +1815,8 @@ set_vanq_order()
continue; continue;
any.a_int = i + 1; any.a_int = i + 1;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, vanqorders[i], add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, vanqorders[i],
(i == g.vanq_sortmode) ? MENU_SELECTED : MENU_UNSELECTED); (i == g.vanq_sortmode)
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
} }
end_menu(tmpwin, "Sort order for vanquished monster counts"); end_menu(tmpwin, "Sort order for vanquished monster counts");
+15 -15
View File
@@ -2654,11 +2654,11 @@ long *out_cnt;
Sprintf(eos(prompt), Sprintf(eos(prompt),
" -- unidentified or partially identified item%s", " -- unidentified or partially identified item%s",
plur(unid_cnt)); plur(unid_cnt));
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, prompt, MENU_UNSELECTED); add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, prompt, MENU_ITEMFLAGS_NONE);
if (!unid_cnt) { if (!unid_cnt) {
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE,
"(all items are permanently identified already)", "(all items are permanently identified already)",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
gotsomething = TRUE; gotsomething = TRUE;
} else { } else {
any.a_obj = &wizid_fakeobj; any.a_obj = &wizid_fakeobj;
@@ -2673,17 +2673,17 @@ long *out_cnt;
Sprintf(eos(prompt), " (%s for all)", Sprintf(eos(prompt), " (%s for all)",
visctrl(iflags.override_ID)); visctrl(iflags.override_ID));
add_menu(win, NO_GLYPH, &any, '_', iflags.override_ID, ATR_NONE, add_menu(win, NO_GLYPH, &any, '_', iflags.override_ID, ATR_NONE,
prompt, MENU_UNSELECTED); prompt, MENU_ITEMFLAGS_NONE);
gotsomething = TRUE; gotsomething = TRUE;
} }
} else if (xtra_choice) { } else if (xtra_choice) {
/* wizard override ID and xtra_choice are mutually exclusive */ /* wizard override ID and xtra_choice are mutually exclusive */
if (flags.sortpack) if (flags.sortpack)
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
"Miscellaneous", MENU_UNSELECTED); "Miscellaneous", MENU_ITEMFLAGS_NONE);
any.a_char = HANDS_SYM; /* '-' */ any.a_char = HANDS_SYM; /* '-' */
add_menu(win, NO_GLYPH, &any, HANDS_SYM, 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, HANDS_SYM, 0, ATR_NONE,
xtra_choice, MENU_UNSELECTED); xtra_choice, MENU_ITEMFLAGS_NONE);
gotsomething = TRUE; gotsomething = TRUE;
} }
nextclass: nextclass:
@@ -2700,7 +2700,7 @@ long *out_cnt;
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
let_to_name(*invlet, FALSE, let_to_name(*invlet, FALSE,
(want_reply && iflags.menu_head_objsym)), (want_reply && iflags.menu_head_objsym)),
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
classcount++; classcount++;
} }
if (wizid) if (wizid)
@@ -2709,7 +2709,7 @@ long *out_cnt;
any.a_char = ilet; any.a_char = ilet;
add_menu(win, obj_to_glyph(otmp, rn2_on_display_rng), &any, ilet, add_menu(win, obj_to_glyph(otmp, rn2_on_display_rng), &any, ilet,
wizid ? def_oc_syms[(int) otmp->oclass].sym : 0, wizid ? def_oc_syms[(int) otmp->oclass].sym : 0,
ATR_NONE, doname(otmp), MENU_UNSELECTED); ATR_NONE, doname(otmp), MENU_ITEMFLAGS_NONE);
gotsomething = TRUE; gotsomething = TRUE;
} }
} }
@@ -2724,10 +2724,10 @@ long *out_cnt;
if (iflags.force_invmenu && lets && want_reply) { if (iflags.force_invmenu && lets && want_reply) {
any = cg.zeroany; any = cg.zeroany;
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
"Special", MENU_UNSELECTED); "Special", MENU_ITEMFLAGS_NONE);
any.a_char = '*'; any.a_char = '*';
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE,
"(list everything)", MENU_UNSELECTED); "(list everything)", MENU_ITEMFLAGS_NONE);
gotsomething = TRUE; gotsomething = TRUE;
} }
unsortloot(&sortedinvent); unsortloot(&sortedinvent);
@@ -2738,7 +2738,7 @@ long *out_cnt;
if (iflags.perm_invent && !lets && !gotsomething) { if (iflags.perm_invent && !lets && !gotsomething) {
any = cg.zeroany; any = cg.zeroany;
add_menu(win, NO_GLYPH, &any, 0, 0, 0, add_menu(win, NO_GLYPH, &any, 0, 0, 0,
not_carrying_anything, MENU_UNSELECTED); not_carrying_anything, MENU_ITEMFLAGS_NONE);
want_reply = FALSE; want_reply = FALSE;
} }
end_menu(win, query && *query ? query : (char *) 0); end_menu(win, query && *query ? query : (char *) 0);
@@ -2824,13 +2824,13 @@ char avoidlet;
add_menu(win, NO_GLYPH, &any, 0, 0, add_menu(win, NO_GLYPH, &any, 0, 0,
iflags.menu_headings, iflags.menu_headings,
let_to_name(*invlet, FALSE, FALSE), let_to_name(*invlet, FALSE, FALSE),
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
classcount++; classcount++;
} }
any.a_char = ilet; any.a_char = ilet;
add_menu(win, obj_to_glyph(otmp, rn2_on_display_rng), add_menu(win, obj_to_glyph(otmp, rn2_on_display_rng),
&any, ilet, 0, ATR_NONE, &any, ilet, 0, ATR_NONE,
doname(otmp), MENU_UNSELECTED); doname(otmp), MENU_ITEMFLAGS_NONE);
} }
} }
if (flags.sortpack && *++invlet) if (flags.sortpack && *++invlet)
@@ -4274,9 +4274,9 @@ const char *hdr, *txt;
win = create_nhwindow(NHW_MENU); win = create_nhwindow(NHW_MENU);
start_menu(win); start_menu(win);
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, hdr, add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, hdr,
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE);
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, txt, MENU_UNSELECTED); add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, txt, MENU_ITEMFLAGS_NONE);
end_menu(win, (char *) 0); end_menu(win, (char *) 0);
if (select_menu(win, PICK_NONE, &selected) > 0) if (select_menu(win, PICK_NONE, &selected) > 0)
free((genericptr_t) selected); free((genericptr_t) selected);
+22
View File
@@ -438,4 +438,26 @@ const char *str;
putstr(window, attr, decode_mixed(buf, str)); putstr(window, attr, decode_mixed(buf, str));
} }
/*
* Window port helper function for menu invert routines to move the decision
* logic into one place instead of 7 different window-port routines.
*/
boolean
menuitem_invert_test(mode, itemflags, is_selected)
int mode;
unsigned itemflags; /* The itemflags for the item */
boolean is_selected; /* The current selection status of the item */
{
boolean skipinvert = (itemflags & MENU_ITEMFLAGS_SKIPINVERT) != 0;
if ((iflags.menuinvertmode == 1 || iflags.menuinvertmode == 2)
&& !mode && skipinvert && !is_selected)
return FALSE;
else if (iflags.menuinvertmode == 2
&& !mode && skipinvert && is_selected)
return TRUE;
else
return TRUE;
}
/*mapglyph.c*/ /*mapglyph.c*/
+8 -4
View File
@@ -78,11 +78,13 @@ struct monst *mon;
if (is_dprince(ptr) || (ptr == &mons[PM_WIZARD_OF_YENDOR])) { if (is_dprince(ptr) || (ptr == &mons[PM_WIZARD_OF_YENDOR])) {
dtype = (!rn2(20)) ? dprince(atyp) : (!rn2(4)) ? dlord(atyp) dtype = (!rn2(20)) ? dprince(atyp) : (!rn2(4)) ? dlord(atyp)
: ndemon(atyp); : ndemon(atyp);
cnt = (!rn2(4) && is_ndemon(&mons[dtype])) ? 2 : 1; cnt = ((dtype != NON_PM)
&& !rn2(4) && is_ndemon(&mons[dtype])) ? 2 : 1;
} else if (is_dlord(ptr)) { } else if (is_dlord(ptr)) {
dtype = (!rn2(50)) ? dprince(atyp) : (!rn2(20)) ? dlord(atyp) dtype = (!rn2(50)) ? dprince(atyp) : (!rn2(20)) ? dlord(atyp)
: ndemon(atyp); : ndemon(atyp);
cnt = (!rn2(4) && is_ndemon(&mons[dtype])) ? 2 : 1; cnt = ((dtype != NON_PM)
&& !rn2(4) && is_ndemon(&mons[dtype])) ? 2 : 1;
} else if (is_ndemon(ptr)) { } else if (is_ndemon(ptr)) {
dtype = (!rn2(20)) ? dlord(atyp) : (!rn2(6)) ? ndemon(atyp) dtype = (!rn2(20)) ? dlord(atyp) : (!rn2(6)) ? ndemon(atyp)
: monsndx(ptr); : monsndx(ptr);
@@ -91,7 +93,8 @@ struct monst *mon;
dtype = (is_lord(ptr) && !rn2(20)) dtype = (is_lord(ptr) && !rn2(20))
? llord() ? llord()
: (is_lord(ptr) || !rn2(6)) ? lminion() : monsndx(ptr); : (is_lord(ptr) || !rn2(6)) ? lminion() : monsndx(ptr);
cnt = (!rn2(4) && !is_lord(&mons[dtype])) ? 2 : 1; cnt = ((dtype != NON_PM)
&& !rn2(4) && !is_lord(&mons[dtype])) ? 2 : 1;
} else if (ptr == &mons[PM_ANGEL]) { } else if (ptr == &mons[PM_ANGEL]) {
/* non-lawful angels can also summon */ /* non-lawful angels can also summon */
if (!rn2(6)) { if (!rn2(6)) {
@@ -107,7 +110,8 @@ struct monst *mon;
} else { } else {
dtype = PM_ANGEL; dtype = PM_ANGEL;
} }
cnt = (!rn2(4) && !is_lord(&mons[dtype])) ? 2 : 1; cnt = ((dtype != NON_PM)
&& !rn2(4) && !is_lord(&mons[dtype])) ? 2 : 1;
} }
if (dtype == NON_PM) if (dtype == NON_PM)
+7 -1
View File
@@ -444,6 +444,7 @@ long num;
obj->owt = weight(obj); obj->owt = weight(obj);
otmp->quan = num; otmp->quan = num;
otmp->owt = weight(otmp); /* -= obj->owt ? */ otmp->owt = weight(otmp); /* -= obj->owt ? */
otmp->lua_ref_cnt = 0;
g.context.objsplit.parent_oid = obj->o_id; g.context.objsplit.parent_oid = obj->o_id;
g.context.objsplit.child_oid = otmp->o_id; g.context.objsplit.child_oid = otmp->o_id;
@@ -797,6 +798,7 @@ boolean artif;
otmp->lknown = 0; otmp->lknown = 0;
otmp->cknown = 0; otmp->cknown = 0;
otmp->corpsenm = NON_PM; otmp->corpsenm = NON_PM;
otmp->lua_ref_cnt = 0;
if (init) { if (init) {
switch (let) { switch (let) {
@@ -2178,8 +2180,10 @@ struct obj *obj;
* list must track all objects that can have a light source * list must track all objects that can have a light source
* attached to it (and also requires lamplit to be set). * attached to it (and also requires lamplit to be set).
*/ */
if (obj_sheds_light(obj)) if (obj_sheds_light(obj)) {
del_light_source(LS_OBJECT, obj_to_any(obj)); del_light_source(LS_OBJECT, obj_to_any(obj));
obj->lamplit = 0;
}
if (obj == g.thrownobj) if (obj == g.thrownobj)
g.thrownobj = 0; g.thrownobj = 0;
@@ -2188,6 +2192,8 @@ struct obj *obj;
if (obj->oextra) if (obj->oextra)
dealloc_oextra(obj); dealloc_oextra(obj);
if (obj->lua_ref_cnt)
return; /* obj is referenced from a lua script, let lua gc free it */
free((genericptr_t) obj); free((genericptr_t) obj);
} }
+3 -3
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 monst.c $NHDT-Date: 1547118631 2019/01/10 11:10:31 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.62 $ */ /* NetHack 3.6 monst.c $NHDT-Date: 1577096800 2019/12/23 10:26:40 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.70 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2006. */ /*-Copyright (c) Michael Allison, 2006. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -131,7 +131,7 @@ NEARDATA struct permonst mons_init[] = {
MON("giant beetle", S_ANT, LVL(5, 6, 4, 0, 0), (G_GENO | 3), MON("giant beetle", S_ANT, LVL(5, 6, 4, 0, 0), (G_GENO | 3),
A(ATTK(AT_BITE, AD_PHYS, 3, 6), NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, A(ATTK(AT_BITE, AD_PHYS, 3, 6), NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK,
NO_ATTK), NO_ATTK),
SIZ(10, 10, MS_SILENT, MZ_LARGE), MR_POISON, MR_POISON, SIZ(200, 50, MS_SILENT, MZ_LARGE), MR_POISON, MR_POISON,
M1_ANIMAL | M1_NOHANDS | M1_POIS | M1_CARNIVORE, M2_HOSTILE, 0, M1_ANIMAL | M1_NOHANDS | M1_POIS | M1_CARNIVORE, M2_HOSTILE, 0,
6, CLR_BLACK), 6, CLR_BLACK),
MON("queen bee", S_ANT, LVL(9, 24, -4, 0, 0), (G_GENO | G_NOGEN), MON("queen bee", S_ANT, LVL(9, 24, -4, 0, 0), (G_GENO | G_NOGEN),
@@ -787,7 +787,7 @@ NEARDATA struct permonst mons_init[] = {
MON("giant spider", S_SPIDER, LVL(5, 15, 4, 0, 0), (G_GENO | 1), MON("giant spider", S_SPIDER, LVL(5, 15, 4, 0, 0), (G_GENO | 1),
A(ATTK(AT_BITE, AD_DRST, 2, 4), NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, A(ATTK(AT_BITE, AD_DRST, 2, 4), NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK,
NO_ATTK), NO_ATTK),
SIZ(100, 100, MS_SILENT, MZ_LARGE), MR_POISON, MR_POISON, SIZ(200, 100, MS_SILENT, MZ_LARGE), MR_POISON, MR_POISON,
M1_ANIMAL | M1_NOHANDS | M1_OVIPAROUS | M1_POIS | M1_CARNIVORE, M1_ANIMAL | M1_NOHANDS | M1_OVIPAROUS | M1_POIS | M1_CARNIVORE,
M2_HOSTILE | M2_STRONG, 0, 7, CLR_MAGENTA), M2_HOSTILE | M2_STRONG, 0, 7, CLR_MAGENTA),
MON("scorpion", S_SPIDER, LVL(5, 15, 3, 0, 0), (G_GENO | 2), MON("scorpion", S_SPIDER, LVL(5, 15, 3, 0, 0), (G_GENO | 2),
+16 -12
View File
@@ -6,24 +6,16 @@
#include "sp_lev.h" #include "sp_lev.h"
static int FDECL(l_obj_add_to_container, (lua_State *)); static int FDECL(l_obj_add_to_container, (lua_State *));
static int FDECL(l_obj_addcontent, (lua_State *));
static int FDECL(l_obj_at, (lua_State *));
static int FDECL(l_obj_class, (lua_State *));
static int FDECL(l_obj_container, (lua_State *));
static int FDECL(l_obj_contents, (lua_State *));
static int FDECL(l_obj_gc, (lua_State *)); static int FDECL(l_obj_gc, (lua_State *));
static int FDECL(l_obj_getcontents, (lua_State *)); static int FDECL(l_obj_getcontents, (lua_State *));
static int FDECL(l_obj_isnull, (lua_State *)); static int FDECL(l_obj_isnull, (lua_State *));
static int FDECL(l_obj_new_readobjnam, (lua_State *)); static int FDECL(l_obj_new_readobjnam, (lua_State *));
static int FDECL(l_obj_next, (lua_State *));
static int FDECL(l_obj_nextobj, (lua_State *)); static int FDECL(l_obj_nextobj, (lua_State *));
static int FDECL(l_obj_obj_add_to_container, (lua_State *));
static int FDECL(l_obj_obj_getcontents, (lua_State *));
static int FDECL(l_obj_obj_objects_to_table, (lua_State *));
static int FDECL(l_obj_objects_to_table, (lua_State *)); static int FDECL(l_obj_objects_to_table, (lua_State *));
static int FDECL(l_obj_placeobj, (lua_State *)); static int FDECL(l_obj_placeobj, (lua_State *));
static int FDECL(l_obj_to_table, (lua_State *)); static int FDECL(l_obj_to_table, (lua_State *));
static int FDECL(l_obj_totable, (lua_State *)); static int FDECL(l_obj_at, (lua_State *));
static int FDECL(l_obj_container, (lua_State *));
struct _lua_obj { struct _lua_obj {
int state; /* UNUSED */ int state; /* UNUSED */
@@ -51,8 +43,10 @@ lua_State *L;
struct _lua_obj *lo = l_obj_check(L, 1); struct _lua_obj *lo = l_obj_check(L, 1);
if (lo && lo->obj) { if (lo && lo->obj) {
/* free-floating objects are deallocated */ if (lo->obj->lua_ref_cnt > 0)
if (lo->obj->where == OBJ_FREE) { lo->obj->lua_ref_cnt--;
/* free-floating objects with no other refs are deallocated. */
if (lo->obj->where == OBJ_FREE && !lo->obj->lua_ref_cnt) {
if (Has_contents(lo->obj)) { if (Has_contents(lo->obj)) {
struct obj *otmp; struct obj *otmp;
while ((otmp = lo->obj->cobj) != 0) { while ((otmp = lo->obj->cobj) != 0) {
@@ -79,10 +73,20 @@ struct obj *otmp;
lo->state = 0; lo->state = 0;
lo->obj = otmp; lo->obj = otmp;
if (otmp)
otmp->lua_ref_cnt++;
return lo; return lo;
} }
void
nhl_push_obj(L, otmp)
lua_State *L;
struct obj *otmp;
{
(void) l_obj_push(L, otmp);
}
/* local o = obj.new("large chest"); /* local o = obj.new("large chest");
local cobj = o:contents(); */ local cobj = o:contents(); */
static int static int
+7 -1
View File
@@ -482,7 +482,8 @@ lua_State *L;
if (*key) if (*key)
any.a_char = key[0]; any.a_char = key[0];
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, str, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, str,
(*defval && *key && defval[0] == key[0]) ? MENU_SELECTED : MENU_UNSELECTED); (*defval && *key && defval[0] == key[0])
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
lua_pop(L, 1); /* removes 'value'; keeps 'key' for next iteration */ lua_pop(L, 1); /* removes 'value'; keeps 'key' for next iteration */
} }
@@ -838,6 +839,11 @@ lua_State *L;
return nhl_push_anything(L, ustruct[i].type, ustruct[i].ptr); return nhl_push_anything(L, ustruct[i].type, ustruct[i].ptr);
} }
if (!strcmp(tkey, "inventory")) {
nhl_push_obj(L, g.invent);
return 1;
}
nhl_error(L, "Unknown u table index"); nhl_error(L, "Unknown u table index");
return 0; return 0;
} }
+5 -5
View File
@@ -532,7 +532,7 @@ doclassdisco()
if (!traditional) { if (!traditional) {
any.a_int = 'u'; any.a_int = 'u';
add_menu(tmpwin, NO_GLYPH, &any, menulet++, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, menulet++, 0, ATR_NONE,
unique_items, MENU_UNSELECTED); unique_items, MENU_ITEMFLAGS_NONE);
} }
break; break;
} }
@@ -543,7 +543,7 @@ doclassdisco()
if (!traditional) { if (!traditional) {
any.a_int = 'a'; any.a_int = 'a';
add_menu(tmpwin, NO_GLYPH, &any, menulet++, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, menulet++, 0, ATR_NONE,
artifact_items, MENU_UNSELECTED); artifact_items, MENU_ITEMFLAGS_NONE);
} }
} }
@@ -565,7 +565,7 @@ doclassdisco()
any.a_int = c; any.a_int = c;
add_menu(tmpwin, NO_GLYPH, &any, menulet++, c, add_menu(tmpwin, NO_GLYPH, &any, menulet++, c,
ATR_NONE, oclass_to_name(oclass, buf), ATR_NONE, oclass_to_name(oclass, buf),
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
} }
} }
} }
@@ -707,12 +707,12 @@ rename_disco()
any.a_int = 0; any.a_int = 0;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
let_to_name(oclass, FALSE, FALSE), let_to_name(oclass, FALSE, FALSE),
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
prev_class = oclass; prev_class = oclass;
} }
any.a_int = dis; any.a_int = dis;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
obj_typename(dis), MENU_UNSELECTED); obj_typename(dis), MENU_ITEMFLAGS_NONE);
} }
} }
if (ct == 0) { if (ct == 0) {
+4 -3
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 objects.c $NHDT-Date: 1535422421 2018/08/28 02:13:41 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.51 $ */ /* NetHack 3.6 objects.c $NHDT-Date: 1577184069 2019/12/24 10:41:09 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.59 $ */
/* Copyright (c) Mike Threepoint, 1989. */ /* Copyright (c) Mike Threepoint, 1989. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -173,10 +173,11 @@ WEAPON("stiletto", None,
/* 3.6: worm teeth and crysknives now stack; /* 3.6: worm teeth and crysknives now stack;
when a stack of teeth is enchanted at once, they fuse into one crysknife; when a stack of teeth is enchanted at once, they fuse into one crysknife;
when a stack of crysknives drops, the whole stack reverts to teeth */ when a stack of crysknives drops, the whole stack reverts to teeth */
/* 3.7: change crysknife from MINERAL to BONE and worm tooth from 0 to BONE */
WEAPON("worm tooth", None, WEAPON("worm tooth", None,
1, 1, 0, 0, 20, 2, 2, 2, 0, 0, P_KNIFE, 0, CLR_WHITE), 1, 1, 0, 0, 20, 2, 2, 2, 0, 0, P_KNIFE, BONE, CLR_WHITE),
WEAPON("crysknife", None, WEAPON("crysknife", None,
1, 1, 0, 0, 20, 100, 10, 10, 3, P, P_KNIFE, MINERAL, CLR_WHITE), 1, 1, 0, 0, 20, 100, 10, 10, 3, P, P_KNIFE, BONE, CLR_WHITE),
/* axes */ /* axes */
WEAPON("axe", None, WEAPON("axe", None,
+97 -66
View File
@@ -1,4 +1,4 @@
/* NetHack 3.7 options.c $NHDT-Date: 1575245078 2019/12/02 00:04:38 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.391 $ */ /* NetHack 3.7 options.c $NHDT-Date: 1577050473 2019/12/22 21:34:33 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.422 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2008. */ /*-Copyright (c) Michael Allison, 2008. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -185,6 +185,7 @@ static const struct Bool_Opt {
{ "popup_dialog", &iflags.wc_popup_dialog, FALSE, SET_IN_GAME }, /*WC*/ { "popup_dialog", &iflags.wc_popup_dialog, FALSE, SET_IN_GAME }, /*WC*/
{ "preload_tiles", &iflags.wc_preload_tiles, TRUE, DISP_IN_GAME }, /*WC*/ { "preload_tiles", &iflags.wc_preload_tiles, TRUE, DISP_IN_GAME }, /*WC*/
{ "pushweapon", &flags.pushweapon, FALSE, SET_IN_GAME }, { "pushweapon", &flags.pushweapon, FALSE, SET_IN_GAME },
{ "quick_farsight", &flags.quick_farsight, FALSE, SET_IN_GAME },
#if defined(MICRO) && !defined(AMIGA) #if defined(MICRO) && !defined(AMIGA)
{ "rawio", &iflags.rawio, FALSE, DISP_IN_GAME }, { "rawio", &iflags.rawio, FALSE, DISP_IN_GAME },
#else #else
@@ -311,6 +312,7 @@ static struct Comp_Opt {
{ "horsename", "the name of your (first) horse (e.g., horsename:Silver)", { "horsename", "the name of your (first) horse (e.g., horsename:Silver)",
PL_PSIZ, DISP_IN_GAME }, PL_PSIZ, DISP_IN_GAME },
{ "map_mode", "map display mode under Windows", 20, DISP_IN_GAME }, /*WC*/ { "map_mode", "map display mode under Windows", 20, DISP_IN_GAME }, /*WC*/
{ "menuinvertmode", "behaviour of menu iverts", 5, SET_IN_GAME },
{ "menustyle", "user interface for object selection", MENUTYPELEN, { "menustyle", "user interface for object selection", MENUTYPELEN,
SET_IN_GAME }, SET_IN_GAME },
{ "menu_deselect_all", "deselect all items in a menu", 4, SET_IN_FILE }, { "menu_deselect_all", "deselect all items in a menu", 4, SET_IN_FILE },
@@ -1451,8 +1453,8 @@ const char *prompt;
break; break;
any.a_int = i + 1; any.a_int = i + 1;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, colornames[i].name, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, colornames[i].name,
(colornames[i].color == NO_COLOR) ? MENU_SELECTED (colornames[i].color == NO_COLOR) ? MENU_ITEMFLAGS_SELECTED
: MENU_UNSELECTED); : MENU_ITEMFLAGS_NONE);
} }
end_menu(tmpwin, (prompt && *prompt) ? prompt : "Pick a color"); end_menu(tmpwin, (prompt && *prompt) ? prompt : "Pick a color");
pick_cnt = select_menu(tmpwin, PICK_ONE, &picks); pick_cnt = select_menu(tmpwin, PICK_ONE, &picks);
@@ -1498,8 +1500,8 @@ const char *prompt;
any.a_int = i + 1; any.a_int = i + 1;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, attrnames[i].attr, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, attrnames[i].attr,
attrnames[i].name, attrnames[i].name,
(attrnames[i].attr == default_attr) ? MENU_SELECTED (attrnames[i].attr == default_attr) ? MENU_ITEMFLAGS_SELECTED
: MENU_UNSELECTED); : MENU_ITEMFLAGS_NONE);
} }
end_menu(tmpwin, (prompt && *prompt) ? prompt : "Pick an attribute"); end_menu(tmpwin, (prompt && *prompt) ? prompt : "Pick an attribute");
pick_cnt = select_menu(tmpwin, allow_many ? PICK_ANY : PICK_ONE, &picks); pick_cnt = select_menu(tmpwin, allow_many ? PICK_ANY : PICK_ONE, &picks);
@@ -1595,7 +1597,7 @@ query_msgtype()
if (msgtype_names[i].descr) { if (msgtype_names[i].descr) {
any.a_int = msgtype_names[i].msgtyp + 1; any.a_int = msgtype_names[i].msgtyp + 1;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
msgtype_names[i].descr, MENU_UNSELECTED); msgtype_names[i].descr, MENU_ITEMFLAGS_NONE);
} }
end_menu(tmpwin, "How to show the message"); end_menu(tmpwin, "How to show the message");
pick_cnt = select_menu(tmpwin, PICK_ONE, &picks); pick_cnt = select_menu(tmpwin, PICK_ONE, &picks);
@@ -2362,6 +2364,24 @@ boolean tinitial, tfrom_file;
return retval; return retval;
} }
/* menuinvertmode=0 or 1 or 2 (2 is experimental) */
fullname = "menuinvertmode";
if (match_optname(opts, fullname, 5, TRUE)) {
if (negated) {
bad_negation(fullname, FALSE);
return FALSE;
} else {
int mode = atoi(op);
if (mode < 0 || mode > 2) {
config_error_add("Illegal %s parameter '%s'", fullname, op);
return FALSE;
}
iflags.menuinvertmode = mode;
}
return retval;
}
fullname = "msghistory"; fullname = "msghistory";
if (match_optname(opts, fullname, 3, TRUE)) { if (match_optname(opts, fullname, 3, TRUE)) {
if (duplicate) if (duplicate)
@@ -4340,7 +4360,7 @@ int indexoffset; /* value to add to index in compopt[], or zero
value); value);
else else
Sprintf(buf, fmtstr_doset_tab, option, value); Sprintf(buf, fmtstr_doset_tab, option, value);
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED); add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_ITEMFLAGS_NONE);
} }
static void static void
@@ -4364,7 +4384,7 @@ int nset;
name, buf2); name, buf2);
else else
Sprintf(buf, fmtstr_doset_tab, name, buf2); Sprintf(buf, fmtstr_doset_tab, name, buf2);
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED); add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_ITEMFLAGS_NONE);
} }
int int
@@ -4462,7 +4482,7 @@ doset() /* changing options via menu by Per Liboriussen */
any = cg.zeroany; any = cg.zeroany;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
"Booleans (selecting will toggle value):", MENU_UNSELECTED); "Booleans (selecting will toggle value):", MENU_ITEMFLAGS_NONE);
any.a_int = 0; any.a_int = 0;
/* first list any other non-modifiable booleans, then modifiable ones */ /* first list any other non-modifiable booleans, then modifiable ones */
for (pass = 0; pass <= 1; pass++) for (pass = 0; pass <= 1; pass++)
@@ -4486,16 +4506,16 @@ doset() /* changing options via menu by Per Liboriussen */
Sprintf(buf, fmtstr_doset_tab, Sprintf(buf, fmtstr_doset_tab,
name, *bool_p ? "true" : "false"); name, *bool_p ? "true" : "false");
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
} }
boolcount = i; boolcount = i;
indexoffset = boolcount; indexoffset = boolcount;
any = cg.zeroany; any = cg.zeroany;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
"Compounds (selecting will prompt for new value):", "Compounds (selecting will prompt for new value):",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
/* deliberately put playmode, name, role+race+gender+align first */ /* deliberately put playmode, name, role+race+gender+align first */
doset_add_menu(tmpwin, "playmode", 0); doset_add_menu(tmpwin, "playmode", 0);
@@ -4521,9 +4541,9 @@ doset() /* changing options via menu by Per Liboriussen */
} }
any = cg.zeroany; any = cg.zeroany;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
"Other settings:", MENU_UNSELECTED); "Other settings:", MENU_ITEMFLAGS_NONE);
for (i = 0; (name = othropt[i].name) != 0; i++) { for (i = 0; (name = othropt[i].name) != 0; i++) {
if ((is_wc_option(name) && !wc_supported(name)) if ((is_wc_option(name) && !wc_supported(name))
@@ -4535,9 +4555,9 @@ doset() /* changing options via menu by Per Liboriussen */
#ifdef PREFIXES_IN_USE #ifdef PREFIXES_IN_USE
any = cg.zeroany; any = cg.zeroany;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
"Variable playground locations:", MENU_UNSELECTED); "Variable playground locations:", MENU_ITEMFLAGS_NONE);
for (i = 0; i < PREFIX_COUNT; i++) for (i = 0; i < PREFIX_COUNT; i++)
doset_add_menu(tmpwin, fqn_prefix_names[i], 0); doset_add_menu(tmpwin, fqn_prefix_names[i], 0);
#endif #endif
@@ -4649,7 +4669,7 @@ int numtotal;
Sprintf(tmpbuf, action_titles[i].desc, Sprintf(tmpbuf, action_titles[i].desc,
(i == 1) ? makeplural(optname) : optname); (i == 1) ? makeplural(optname) : optname);
add_menu(tmpwin, NO_GLYPH, &any, action_titles[i].letr, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, action_titles[i].letr, 0, ATR_NONE,
tmpbuf, (i == 3) ? MENU_SELECTED : MENU_UNSELECTED); tmpbuf, (i == 3) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
} }
end_menu(tmpwin, "Do what?"); end_menu(tmpwin, "Do what?");
if ((pick_cnt = select_menu(tmpwin, PICK_ONE, &pick_list)) > 0) { if ((pick_cnt = select_menu(tmpwin, PICK_ONE, &pick_list)) > 0) {
@@ -4691,7 +4711,7 @@ boolean setinitial, setfromfile;
to avoid an optimizer bug in VAX C V2.3 */ to avoid an optimizer bug in VAX C V2.3 */
any.a_int = i + 1; any.a_int = i + 1;
add_menu(tmpwin, NO_GLYPH, &any, *style_name, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, *style_name, 0, ATR_NONE,
style_name, MENU_UNSELECTED); style_name, MENU_ITEMFLAGS_NONE);
} }
end_menu(tmpwin, "Select menustyle:"); end_menu(tmpwin, "Select menustyle:");
if (select_menu(tmpwin, PICK_ONE, &style_pick) > 0) { if (select_menu(tmpwin, PICK_ONE, &style_pick) > 0) {
@@ -4712,8 +4732,8 @@ boolean setinitial, setfromfile;
add_menu(tmpwin, NO_GLYPH, &any, *paranoia[i].argname, 0, add_menu(tmpwin, NO_GLYPH, &any, *paranoia[i].argname, 0,
ATR_NONE, paranoia[i].explain, ATR_NONE, paranoia[i].explain,
(flags.paranoia_bits & paranoia[i].flagmask) (flags.paranoia_bits & paranoia[i].flagmask)
? MENU_SELECTED ? MENU_ITEMFLAGS_SELECTED
: MENU_UNSELECTED); : MENU_ITEMFLAGS_NONE);
} }
end_menu(tmpwin, "Actions requiring extra confirmation:"); end_menu(tmpwin, "Actions requiring extra confirmation:");
i = select_menu(tmpwin, PICK_ANY, &paranoia_picks); i = select_menu(tmpwin, PICK_ANY, &paranoia_picks);
@@ -4741,7 +4761,7 @@ boolean setinitial, setfromfile;
burden_name = burdentype[i]; burden_name = burdentype[i];
any.a_int = i + 1; any.a_int = i + 1;
add_menu(tmpwin, NO_GLYPH, &any, burden_letters[i], 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, burden_letters[i], 0, ATR_NONE,
burden_name, MENU_UNSELECTED); burden_name, MENU_ITEMFLAGS_NONE);
} }
end_menu(tmpwin, "Select encumbrance level:"); end_menu(tmpwin, "Select encumbrance level:");
if (select_menu(tmpwin, PICK_ONE, &burden_pick) > 0) { if (select_menu(tmpwin, PICK_ONE, &burden_pick) > 0) {
@@ -4773,7 +4793,7 @@ boolean setinitial, setfromfile;
flags.end_disclose[i], disclosure_options[i]); flags.end_disclose[i], disclosure_options[i]);
any.a_int = i + 1; any.a_int = i + 1;
add_menu(tmpwin, NO_GLYPH, &any, disclosure_options[i], 0, add_menu(tmpwin, NO_GLYPH, &any, disclosure_options[i], 0,
ATR_NONE, buf, MENU_UNSELECTED); ATR_NONE, buf, MENU_ITEMFLAGS_NONE);
disc_cat[i] = 0; disc_cat[i] = 0;
} }
end_menu(tmpwin, "Change which disclosure options categories:"); end_menu(tmpwin, "Change which disclosure options categories:");
@@ -4800,32 +4820,32 @@ boolean setinitial, setfromfile;
any.a_char = DISCLOSE_NO_WITHOUT_PROMPT; any.a_char = DISCLOSE_NO_WITHOUT_PROMPT;
add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE,
"Never disclose, without prompting", "Never disclose, without prompting",
(c == any.a_char) ? MENU_SELECTED : MENU_UNSELECTED); (c == any.a_char) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
any.a_char = DISCLOSE_YES_WITHOUT_PROMPT; any.a_char = DISCLOSE_YES_WITHOUT_PROMPT;
add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE,
"Always disclose, without prompting", "Always disclose, without prompting",
(c == any.a_char) ? MENU_SELECTED : MENU_UNSELECTED); (c == any.a_char) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
if (*disclosure_names[i] == 'v') { if (*disclosure_names[i] == 'v') {
any.a_char = DISCLOSE_SPECIAL_WITHOUT_PROMPT; /* '#' */ any.a_char = DISCLOSE_SPECIAL_WITHOUT_PROMPT; /* '#' */
add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE,
"Always disclose, pick sort order from menu", "Always disclose, pick sort order from menu",
(c == any.a_char) ? MENU_SELECTED (c == any.a_char) ? MENU_ITEMFLAGS_SELECTED
: MENU_UNSELECTED); : MENU_ITEMFLAGS_NONE);
} }
any.a_char = DISCLOSE_PROMPT_DEFAULT_NO; any.a_char = DISCLOSE_PROMPT_DEFAULT_NO;
add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE,
"Prompt, with default answer of \"No\"", "Prompt, with default answer of \"No\"",
(c == any.a_char) ? MENU_SELECTED : MENU_UNSELECTED); (c == any.a_char) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
any.a_char = DISCLOSE_PROMPT_DEFAULT_YES; any.a_char = DISCLOSE_PROMPT_DEFAULT_YES;
add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE,
"Prompt, with default answer of \"Yes\"", "Prompt, with default answer of \"Yes\"",
(c == any.a_char) ? MENU_SELECTED : MENU_UNSELECTED); (c == any.a_char) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
if (*disclosure_names[i] == 'v') { if (*disclosure_names[i] == 'v') {
any.a_char = DISCLOSE_PROMPT_DEFAULT_SPECIAL; /* '?' */ any.a_char = DISCLOSE_PROMPT_DEFAULT_SPECIAL; /* '?' */
add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, any.a_char, ATR_NONE,
"Prompt, with default answer of \"Ask\" to request sort menu", "Prompt, with default answer of \"Ask\" to request sort menu",
(c == any.a_char) ? MENU_SELECTED (c == any.a_char) ? MENU_ITEMFLAGS_SELECTED
: MENU_UNSELECTED); : MENU_ITEMFLAGS_NONE);
} }
end_menu(tmpwin, buf); end_menu(tmpwin, buf);
n = select_menu(tmpwin, PICK_ONE, &disclosure_pick); n = select_menu(tmpwin, PICK_ONE, &disclosure_pick);
@@ -4849,7 +4869,7 @@ boolean setinitial, setfromfile;
mode_name = runmodes[i]; mode_name = runmodes[i];
any.a_int = i + 1; any.a_int = i + 1;
add_menu(tmpwin, NO_GLYPH, &any, *mode_name, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, *mode_name, 0, ATR_NONE,
mode_name, MENU_UNSELECTED); mode_name, MENU_ITEMFLAGS_NONE);
} }
end_menu(tmpwin, "Select run/travel display mode:"); end_menu(tmpwin, "Select run/travel display mode:");
if (select_menu(tmpwin, PICK_ONE, &mode_pick) > 0) { if (select_menu(tmpwin, PICK_ONE, &mode_pick) > 0) {
@@ -4868,33 +4888,38 @@ boolean setinitial, setfromfile;
any.a_char = GPCOORDS_COMPASS; any.a_char = GPCOORDS_COMPASS;
add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_COMPASS, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_COMPASS, 0, ATR_NONE,
"compass ('east' or '3s' or '2n,4w')", "compass ('east' or '3s' or '2n,4w')",
(gp == GPCOORDS_COMPASS) ? MENU_SELECTED : MENU_UNSELECTED); (gp == GPCOORDS_COMPASS)
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
any.a_char = GPCOORDS_COMFULL; any.a_char = GPCOORDS_COMFULL;
add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_COMFULL, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_COMFULL, 0, ATR_NONE,
"full compass ('east' or '3south' or '2north,4west')", "full compass ('east' or '3south' or '2north,4west')",
(gp == GPCOORDS_COMFULL) ? MENU_SELECTED : MENU_UNSELECTED); (gp == GPCOORDS_COMFULL)
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
any.a_char = GPCOORDS_MAP; any.a_char = GPCOORDS_MAP;
add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_MAP, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_MAP, 0, ATR_NONE,
"map <x,y>", "map <x,y>",
(gp == GPCOORDS_MAP) ? MENU_SELECTED : MENU_UNSELECTED); (gp == GPCOORDS_MAP)
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
any.a_char = GPCOORDS_SCREEN; any.a_char = GPCOORDS_SCREEN;
add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_SCREEN, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_SCREEN, 0, ATR_NONE,
"screen [row,column]", "screen [row,column]",
(gp == GPCOORDS_SCREEN) ? MENU_SELECTED : MENU_UNSELECTED); (gp == GPCOORDS_SCREEN)
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
any.a_char = GPCOORDS_NONE; any.a_char = GPCOORDS_NONE;
add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_NONE, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_NONE, 0, ATR_NONE,
"none (no coordinates displayed)", "none (no coordinates displayed)",
(gp == GPCOORDS_NONE) ? MENU_SELECTED : MENU_UNSELECTED); (gp == GPCOORDS_NONE)
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
any.a_long = 0L; any.a_long = 0L;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE);
Sprintf(buf, "map: upper-left: <%d,%d>, lower-right: <%d,%d>%s", Sprintf(buf, "map: upper-left: <%d,%d>, lower-right: <%d,%d>%s",
1, 0, COLNO - 1, ROWNO - 1, 1, 0, COLNO - 1, ROWNO - 1,
flags.verbose ? "; column 0 unused, off left edge" : ""); flags.verbose ? "; column 0 unused, off left edge" : "");
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_ITEMFLAGS_NONE);
if (strcmp(windowprocs.name, "tty")) /* only show for non-tty */ if (strcmp(windowprocs.name, "tty")) /* only show for non-tty */
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
"screen: row is offset to accommodate tty interface's use of top line", "screen: row is offset to accommodate tty interface's use of top line",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
#if COLNO == 80 #if COLNO == 80
#define COL80ARG flags.verbose ? "; column 80 is not used" : "" #define COL80ARG flags.verbose ? "; column 80 is not used" : ""
#else #else
@@ -4903,8 +4928,8 @@ boolean setinitial, setfromfile;
Sprintf(buf, "screen: upper-left: [%02d,%02d], lower-right: [%d,%d]%s", Sprintf(buf, "screen: upper-left: [%02d,%02d], lower-right: [%d,%d]%s",
0 + 2, 1, ROWNO - 1 + 2, COLNO - 1, COL80ARG); 0 + 2, 1, ROWNO - 1 + 2, COLNO - 1, COL80ARG);
#undef COL80ARG #undef COL80ARG
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_ITEMFLAGS_NONE);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE);
end_menu(tmpwin, end_menu(tmpwin,
"Select coordinate display when auto-describing a map position:"); "Select coordinate display when auto-describing a map position:");
if ((pick_cnt = select_menu(tmpwin, PICK_ONE, &window_pick)) > 0) { if ((pick_cnt = select_menu(tmpwin, PICK_ONE, &window_pick)) > 0) {
@@ -4927,15 +4952,18 @@ boolean setinitial, setfromfile;
any.a_char = (GFILTER_NONE + 1); any.a_char = (GFILTER_NONE + 1);
add_menu(tmpwin, NO_GLYPH, &any, 'n', add_menu(tmpwin, NO_GLYPH, &any, 'n',
0, ATR_NONE, "no filtering", 0, ATR_NONE, "no filtering",
(gf == GFILTER_NONE) ? MENU_SELECTED : MENU_UNSELECTED); (gf == GFILTER_NONE)
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
any.a_char = (GFILTER_VIEW + 1); any.a_char = (GFILTER_VIEW + 1);
add_menu(tmpwin, NO_GLYPH, &any, 'v', add_menu(tmpwin, NO_GLYPH, &any, 'v',
0, ATR_NONE, "in view only", 0, ATR_NONE, "in view only",
(gf == GFILTER_VIEW) ? MENU_SELECTED : MENU_UNSELECTED); (gf == GFILTER_VIEW)
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
any.a_char = (GFILTER_AREA + 1); any.a_char = (GFILTER_AREA + 1);
add_menu(tmpwin, NO_GLYPH, &any, 'a', add_menu(tmpwin, NO_GLYPH, &any, 'a',
0, ATR_NONE, "in same area", 0, ATR_NONE, "in same area",
(gf == GFILTER_AREA) ? MENU_SELECTED : MENU_UNSELECTED); (gf == GFILTER_AREA)
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
end_menu(tmpwin, end_menu(tmpwin,
"Select location filtering when going for next/previous map position:"); "Select location filtering when going for next/previous map position:");
if ((pick_cnt = select_menu(tmpwin, PICK_ONE, &window_pick)) > 0) { if ((pick_cnt = select_menu(tmpwin, PICK_ONE, &window_pick)) > 0) {
@@ -4959,17 +4987,17 @@ boolean setinitial, setfromfile;
if (!WINDOWPORT("curses")) { if (!WINDOWPORT("curses")) {
any.a_char = 's'; any.a_char = 's';
add_menu(tmpwin, NO_GLYPH, &any, 's', 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 's', 0, ATR_NONE,
"single", MENU_UNSELECTED); "single", MENU_ITEMFLAGS_NONE);
any.a_char = 'c'; any.a_char = 'c';
add_menu(tmpwin, NO_GLYPH, &any, 'c', 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 'c', 0, ATR_NONE,
"combination", MENU_UNSELECTED); "combination", MENU_ITEMFLAGS_NONE);
} }
any.a_char = 'f'; any.a_char = 'f';
add_menu(tmpwin, NO_GLYPH, &any, 'f', 0, ATR_NONE, "full", add_menu(tmpwin, NO_GLYPH, &any, 'f', 0, ATR_NONE, "full",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
any.a_char = 'r'; any.a_char = 'r';
add_menu(tmpwin, NO_GLYPH, &any, 'r', 0, ATR_NONE, "reversed", add_menu(tmpwin, NO_GLYPH, &any, 'r', 0, ATR_NONE, "reversed",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
end_menu(tmpwin, "Select message history display type:"); end_menu(tmpwin, "Select message history display type:");
if (select_menu(tmpwin, PICK_ONE, &window_pick) > 0) { if (select_menu(tmpwin, PICK_ONE, &window_pick) > 0) {
iflags.prevmsg_window = window_pick->item.a_char; iflags.prevmsg_window = window_pick->item.a_char;
@@ -4992,7 +5020,7 @@ boolean setinitial, setfromfile;
any.a_char = *sortl_name; any.a_char = *sortl_name;
add_menu(tmpwin, NO_GLYPH, &any, *sortl_name, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, *sortl_name, 0, ATR_NONE,
sortl_name, (flags.sortloot == *sortl_name) sortl_name, (flags.sortloot == *sortl_name)
? MENU_SELECTED : MENU_UNSELECTED); ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
} }
end_menu(tmpwin, "Select loot sorting type:"); end_menu(tmpwin, "Select loot sorting type:");
n = select_menu(tmpwin, PICK_ONE, &sortl_pick); n = select_menu(tmpwin, PICK_ONE, &sortl_pick);
@@ -5016,16 +5044,16 @@ boolean setinitial, setfromfile;
any = cg.zeroany; any = cg.zeroany;
any.a_int = ALIGN_TOP; any.a_int = ALIGN_TOP;
add_menu(tmpwin, NO_GLYPH, &any, 't', 0, ATR_NONE, "top", add_menu(tmpwin, NO_GLYPH, &any, 't', 0, ATR_NONE, "top",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
any.a_int = ALIGN_BOTTOM; any.a_int = ALIGN_BOTTOM;
add_menu(tmpwin, NO_GLYPH, &any, 'b', 0, ATR_NONE, "bottom", add_menu(tmpwin, NO_GLYPH, &any, 'b', 0, ATR_NONE, "bottom",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
any.a_int = ALIGN_LEFT; any.a_int = ALIGN_LEFT;
add_menu(tmpwin, NO_GLYPH, &any, 'l', 0, ATR_NONE, "left", add_menu(tmpwin, NO_GLYPH, &any, 'l', 0, ATR_NONE, "left",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
any.a_int = ALIGN_RIGHT; any.a_int = ALIGN_RIGHT;
add_menu(tmpwin, NO_GLYPH, &any, 'r', 0, ATR_NONE, "right", add_menu(tmpwin, NO_GLYPH, &any, 'r', 0, ATR_NONE, "right",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
Sprintf(abuf, "Select %s window placement relative to the map:", Sprintf(abuf, "Select %s window placement relative to the map:",
msg ? "message" : "status"); msg ? "message" : "status");
end_menu(tmpwin, abuf); end_menu(tmpwin, abuf);
@@ -5052,7 +5080,7 @@ boolean setinitial, setfromfile;
for (i = 0; i < SIZE(npchoices); i++) { for (i = 0; i < SIZE(npchoices); i++) {
any.a_int = i + 1; any.a_int = i + 1;
add_menu(tmpwin, NO_GLYPH, &any, 'a' + i, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 'a' + i, 0, ATR_NONE,
npchoices[i], MENU_UNSELECTED); npchoices[i], MENU_ITEMFLAGS_NONE);
} }
end_menu(tmpwin, "Select number_pad mode:"); end_menu(tmpwin, "Select number_pad mode:");
if (select_menu(tmpwin, PICK_ONE, &mode_pick) > 0) { if (select_menu(tmpwin, PICK_ONE, &mode_pick) > 0) {
@@ -5137,7 +5165,7 @@ boolean setinitial, setfromfile;
else else
Strcat(strcat(mtbuf, tmp->pattern), "\""); Strcat(strcat(mtbuf, tmp->pattern), "\"");
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, mtbuf, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, mtbuf,
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
tmp = tmp->next; tmp = tmp->next;
} }
Sprintf(mtbuf, "%s message types", Sprintf(mtbuf, "%s message types",
@@ -5226,7 +5254,7 @@ boolean setinitial, setfromfile;
/* combine main string and suffix */ /* combine main string and suffix */
Strcat(mcbuf, &buf[1]); /* skip buf[]'s initial quote */ Strcat(mcbuf, &buf[1]); /* skip buf[]'s initial quote */
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, mcbuf, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, mcbuf,
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
tmp = tmp->next; tmp = tmp->next;
} }
Sprintf(mcbuf, "%s menu colors", Sprintf(mcbuf, "%s menu colors",
@@ -5284,7 +5312,7 @@ boolean setinitial, setfromfile;
any = cg.zeroany; any = cg.zeroany;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
"Always pickup '<'; never pickup '>'", "Always pickup '<'; never pickup '>'",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
for (i = 0; i < numapes && ape; i++) { for (i = 0; i < numapes && ape; i++) {
any.a_void = (opt_idx == 1) ? 0 : ape; any.a_void = (opt_idx == 1) ? 0 : ape;
/* length of pattern plus quotes (plus '<'/'>') is /* length of pattern plus quotes (plus '<'/'>') is
@@ -5292,7 +5320,7 @@ boolean setinitial, setfromfile;
Sprintf(apebuf, "\"%c%s\"", ape->grab ? '<' : '>', Sprintf(apebuf, "\"%c%s\"", ape->grab ? '<' : '>',
ape->pattern); ape->pattern);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, apebuf, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, apebuf,
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
ape = ape->next; ape = ape->next;
} }
} }
@@ -5371,8 +5399,8 @@ boolean setinitial, setfromfile;
defindx = any.a_int; defindx = any.a_int;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
"Default Symbols", "Default Symbols",
(any.a_int == defindx) ? MENU_SELECTED (any.a_int == defindx) ? MENU_ITEMFLAGS_SELECTED
: MENU_UNSELECTED); : MENU_ITEMFLAGS_NONE);
for (sl = g.symset_list; sl; sl = sl->next) { for (sl = g.symset_list; sl; sl = sl->next) {
/* check restrictions */ /* check restrictions */
@@ -5391,8 +5419,8 @@ boolean setinitial, setfromfile;
defindx = any.a_int; defindx = any.a_int;
Sprintf(buf, fmtstr, sl->name, sl->desc ? sl->desc : ""); Sprintf(buf, fmtstr, sl->name, sl->desc ? sl->desc : "");
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
(any.a_int == defindx) ? MENU_SELECTED (any.a_int == defindx) ? MENU_ITEMFLAGS_SELECTED
: MENU_UNSELECTED); : MENU_ITEMFLAGS_NONE);
} }
} }
Sprintf(buf, "Select %ssymbol set:", Sprintf(buf, "Select %ssymbol set:",
@@ -5606,7 +5634,9 @@ char *buf;
: (i == MAP_MODE_ASCII_FIT_TO_SCREEN) : (i == MAP_MODE_ASCII_FIT_TO_SCREEN)
? "fit_to_screen" ? "fit_to_screen"
: defopt); : defopt);
} else if (!strcmp(optname, "menustyle")) } else if (!strcmp(optname, "menuinvertmode"))
Sprintf(buf, "%d", iflags.menuinvertmode);
else if (!strcmp(optname, "menustyle"))
Sprintf(buf, "%s", menutype[(int) flags.menu_style]); Sprintf(buf, "%s", menutype[(int) flags.menu_style]);
else if (!strcmp(optname, "menu_deselect_all")) else if (!strcmp(optname, "menu_deselect_all"))
Sprintf(buf, "%s", to_be_done); Sprintf(buf, "%s", to_be_done);
@@ -6422,7 +6452,8 @@ char *class_select;
} }
any.a_int = *class_list; any.a_int = *class_list;
add_menu(win, NO_GLYPH, &any, accelerator, category ? *class_list : 0, add_menu(win, NO_GLYPH, &any, accelerator, category ? *class_list : 0,
ATR_NONE, buf, selected); ATR_NONE, buf,
selected ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
++class_list; ++class_list;
if (category > 0) { if (category > 0) {
++next_accelerator; ++next_accelerator;
@@ -6435,13 +6466,13 @@ char *class_select;
if (category == 1 && next_accelerator <= 'z') { if (category == 1 && next_accelerator <= 'z') {
/* for objects, add "A - ' ' all classes", after a separator */ /* for objects, add "A - ' ' all classes", after a separator */
any = cg.zeroany; any = cg.zeroany;
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE);
any.a_int = (int) ' '; any.a_int = (int) ' ';
Sprintf(buf, "%c %s", (char) any.a_int, "all classes of objects"); Sprintf(buf, "%c %s", (char) any.a_int, "all classes of objects");
/* we won't preselect this even if the incoming list is empty; /* we won't preselect this even if the incoming list is empty;
having it selected means that it would have to be explicitly having it selected means that it would have to be explicitly
de-selected in order to select anything else */ de-selected in order to select anything else */
add_menu(win, NO_GLYPH, &any, 'A', 0, ATR_NONE, buf, MENU_UNSELECTED); add_menu(win, NO_GLYPH, &any, 'A', 0, ATR_NONE, buf, MENU_ITEMFLAGS_NONE);
} }
end_menu(win, prompt); end_menu(win, prompt);
n = select_menu(win, way ? PICK_ANY : PICK_ONE, &pick_list); n = select_menu(win, way ? PICK_ANY : PICK_ONE, &pick_list);
+9 -9
View File
@@ -1166,19 +1166,19 @@ coord *click_cc;
versions: "Specify unknown object by cursor?" */ versions: "Specify unknown object by cursor?" */
add_menu(win, NO_GLYPH, &any, add_menu(win, NO_GLYPH, &any,
flags.lootabc ? 0 : any.a_char, 'y', ATR_NONE, flags.lootabc ? 0 : any.a_char, 'y', ATR_NONE,
"something on the map", MENU_UNSELECTED); "something on the map", MENU_ITEMFLAGS_NONE);
any.a_char = 'i'; any.a_char = 'i';
add_menu(win, NO_GLYPH, &any, add_menu(win, NO_GLYPH, &any,
flags.lootabc ? 0 : any.a_char, 0, ATR_NONE, flags.lootabc ? 0 : any.a_char, 0, ATR_NONE,
"something you're carrying", MENU_UNSELECTED); "something you're carrying", MENU_ITEMFLAGS_NONE);
any.a_char = '?'; any.a_char = '?';
add_menu(win, NO_GLYPH, &any, add_menu(win, NO_GLYPH, &any,
flags.lootabc ? 0 : any.a_char, 'n', ATR_NONE, flags.lootabc ? 0 : any.a_char, 'n', ATR_NONE,
"something else (by symbol or name)", MENU_UNSELECTED); "something else (by symbol or name)", MENU_ITEMFLAGS_NONE);
if (!u.uswallow && !Hallucination) { if (!u.uswallow && !Hallucination) {
any = cg.zeroany; any = cg.zeroany;
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE,
"", MENU_UNSELECTED); "", MENU_ITEMFLAGS_NONE);
/* these options work sensibly for the swallowed case, /* these options work sensibly for the swallowed case,
but there's no reason for the player to use them then; but there's no reason for the player to use them then;
objects work fine when hallucinating, but screen objects work fine when hallucinating, but screen
@@ -1187,19 +1187,19 @@ coord *click_cc;
any.a_char = 'm'; any.a_char = 'm';
add_menu(win, NO_GLYPH, &any, add_menu(win, NO_GLYPH, &any,
flags.lootabc ? 0 : any.a_char, 0, ATR_NONE, flags.lootabc ? 0 : any.a_char, 0, ATR_NONE,
"nearby monsters", MENU_UNSELECTED); "nearby monsters", MENU_ITEMFLAGS_NONE);
any.a_char = 'M'; any.a_char = 'M';
add_menu(win, NO_GLYPH, &any, add_menu(win, NO_GLYPH, &any,
flags.lootabc ? 0 : any.a_char, 0, ATR_NONE, flags.lootabc ? 0 : any.a_char, 0, ATR_NONE,
"all monsters shown on map", MENU_UNSELECTED); "all monsters shown on map", MENU_ITEMFLAGS_NONE);
any.a_char = 'o'; any.a_char = 'o';
add_menu(win, NO_GLYPH, &any, add_menu(win, NO_GLYPH, &any,
flags.lootabc ? 0 : any.a_char, 0, ATR_NONE, flags.lootabc ? 0 : any.a_char, 0, ATR_NONE,
"nearby objects", MENU_UNSELECTED); "nearby objects", MENU_ITEMFLAGS_NONE);
any.a_char = 'O'; any.a_char = 'O';
add_menu(win, NO_GLYPH, &any, add_menu(win, NO_GLYPH, &any,
flags.lootabc ? 0 : any.a_char, 0, ATR_NONE, flags.lootabc ? 0 : any.a_char, 0, ATR_NONE,
"all objects shown on map", MENU_UNSELECTED); "all objects shown on map", MENU_ITEMFLAGS_NONE);
} }
end_menu(win, "What do you want to look at:"); end_menu(win, "What do you want to look at:");
if (select_menu(win, PICK_ONE, &pick_list) > 0) { if (select_menu(win, PICK_ONE, &pick_list) > 0) {
@@ -2051,7 +2051,7 @@ dohelp()
} }
any.a_int = i + 1; any.a_int = i + 1;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
helpbuf, MENU_UNSELECTED); helpbuf, MENU_ITEMFLAGS_NONE);
} }
end_menu(tmpwin, "Select one item:"); end_menu(tmpwin, "Select one item:");
n = select_menu(tmpwin, PICK_ONE, &selected); n = select_menu(tmpwin, PICK_ONE, &selected);
+32 -28
View File
@@ -901,7 +901,7 @@ boolean FDECL((*allow), (OBJ_P)); /* allow function */
let_to_name(*pack, FALSE, let_to_name(*pack, FALSE,
((how != PICK_NONE) ((how != PICK_NONE)
&& iflags.menu_head_objsym)), && iflags.menu_head_objsym)),
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
printed_type_name = TRUE; printed_type_name = TRUE;
} }
@@ -910,7 +910,7 @@ boolean FDECL((*allow), (OBJ_P)); /* allow function */
(qflags & USE_INVLET) ? curr->invlet (qflags & USE_INVLET) ? curr->invlet
: (first && curr->oclass == COIN_CLASS) ? '$' : 0, : (first && curr->oclass == COIN_CLASS) ? '$' : 0,
def_oc_syms[(int) objects[curr->otyp].oc_class].sym, def_oc_syms[(int) objects[curr->otyp].oc_class].sym,
ATR_NONE, doname_with_price(curr), MENU_UNSELECTED); ATR_NONE, doname_with_price(curr), MENU_ITEMFLAGS_NONE);
first = FALSE; first = FALSE;
} }
} }
@@ -926,7 +926,7 @@ boolean FDECL((*allow), (OBJ_P)); /* allow function */
Sprintf(buf, "%s Creatures", Sprintf(buf, "%s Creatures",
is_animal(u.ustuck->data) ? "Swallowed" : "Engulfed"); is_animal(u.ustuck->data) ? "Swallowed" : "Engulfed");
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, buf, add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, buf,
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
} }
fake_hero_object = cg.zeroobj; fake_hero_object = cg.zeroobj;
fake_hero_object.quan = 1L; /* not strictly necessary... */ fake_hero_object.quan = 1L; /* not strictly necessary... */
@@ -934,7 +934,7 @@ boolean FDECL((*allow), (OBJ_P)); /* allow function */
add_menu(win, mon_to_glyph(&g.youmonst, rn2_on_display_rng), &any, add_menu(win, mon_to_glyph(&g.youmonst, rn2_on_display_rng), &any,
/* fake inventory letter, no group accelerator */ /* fake inventory letter, no group accelerator */
CONTAINED_SYM, 0, ATR_NONE, an(self_lookat(buf)), CONTAINED_SYM, 0, ATR_NONE, an(self_lookat(buf)),
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
} }
end_menu(win, qstr); end_menu(win, qstr);
@@ -1014,6 +1014,7 @@ int how; /* type of query */
boolean do_blessed = FALSE, do_cursed = FALSE, do_uncursed = FALSE, boolean do_blessed = FALSE, do_cursed = FALSE, do_uncursed = FALSE,
do_buc_unknown = FALSE; do_buc_unknown = FALSE;
int num_buc_types = 0; int num_buc_types = 0;
unsigned itemflags = MENU_ITEMFLAGS_NONE;
*pick_list = (menu_item *) 0; *pick_list = (menu_item *) 0;
if (!olist) if (!olist)
@@ -1068,22 +1069,24 @@ int how; /* type of query */
invlet = 'A'; invlet = 'A';
any = cg.zeroany; any = cg.zeroany;
any.a_int = 'A'; any.a_int = 'A';
itemflags = MENU_ITEMFLAGS_SKIPINVERT;
add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE,
(qflags & WORN_TYPES) ? "Auto-select every item being worn" (qflags & WORN_TYPES) ? "Auto-select every item being worn"
: "Auto-select every item", : "Auto-select every item",
MENU_UNSELECTED); itemflags);
any = cg.zeroany; any = cg.zeroany;
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE);
} }
if ((qflags & ALL_TYPES) && (ccount > 1)) { if ((qflags & ALL_TYPES) && (ccount > 1)) {
invlet = 'a'; invlet = 'a';
any = cg.zeroany; any = cg.zeroany;
any.a_int = ALL_TYPES_SELECTED; any.a_int = ALL_TYPES_SELECTED;
itemflags = MENU_ITEMFLAGS_SKIPINVERT;
add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE,
(qflags & WORN_TYPES) ? "All worn types" : "All types", (qflags & WORN_TYPES) ? "All worn types" : "All types",
MENU_UNSELECTED); itemflags);
invlet = 'b'; invlet = 'b';
} else } else
invlet = 'a'; invlet = 'a';
@@ -1102,7 +1105,7 @@ int how; /* type of query */
ATR_NONE, let_to_name(*pack, FALSE, ATR_NONE, let_to_name(*pack, FALSE,
(how != PICK_NONE) (how != PICK_NONE)
&& iflags.menu_head_objsym), && iflags.menu_head_objsym),
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
collected_type_name = TRUE; collected_type_name = TRUE;
} }
} }
@@ -1118,7 +1121,7 @@ int how; /* type of query */
if (do_unpaid || (qflags & BILLED_TYPES) || do_blessed || do_cursed if (do_unpaid || (qflags & BILLED_TYPES) || do_blessed || do_cursed
|| do_uncursed || do_buc_unknown) { || do_uncursed || do_buc_unknown) {
any = cg.zeroany; any = cg.zeroany;
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE);
} }
/* unpaid items if there are any */ /* unpaid items if there are any */
@@ -1127,7 +1130,7 @@ int how; /* type of query */
any = cg.zeroany; any = cg.zeroany;
any.a_int = 'u'; any.a_int = 'u';
add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, "Unpaid items", add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, "Unpaid items",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
} }
/* billed items: checked by caller, so always include if BILLED_TYPES */ /* billed items: checked by caller, so always include if BILLED_TYPES */
if (qflags & BILLED_TYPES) { if (qflags & BILLED_TYPES) {
@@ -1135,39 +1138,40 @@ int how; /* type of query */
any = cg.zeroany; any = cg.zeroany;
any.a_int = 'x'; any.a_int = 'x';
add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE,
"Unpaid items already used up", MENU_UNSELECTED); "Unpaid items already used up", MENU_ITEMFLAGS_NONE);
} }
/* items with b/u/c/unknown if there are any; /* items with b/u/c/unknown if there are any;
this cluster of menu entries is in alphabetical order, this cluster of menu entries is in alphabetical order,
reversing the usual sequence of 'U' and 'C' in BUCX */ reversing the usual sequence of 'U' and 'C' in BUCX */
itemflags = MENU_ITEMFLAGS_SKIPINVERT;
if (do_blessed) { if (do_blessed) {
invlet = 'B'; invlet = 'B';
any = cg.zeroany; any = cg.zeroany;
any.a_int = 'B'; any.a_int = 'B';
add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE,
"Items known to be Blessed", MENU_UNSELECTED); "Items known to be Blessed", itemflags);
} }
if (do_cursed) { if (do_cursed) {
invlet = 'C'; invlet = 'C';
any = cg.zeroany; any = cg.zeroany;
any.a_int = 'C'; any.a_int = 'C';
add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE,
"Items known to be Cursed", MENU_UNSELECTED); "Items known to be Cursed", itemflags);
} }
if (do_uncursed) { if (do_uncursed) {
invlet = 'U'; invlet = 'U';
any = cg.zeroany; any = cg.zeroany;
any.a_int = 'U'; any.a_int = 'U';
add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE,
"Items known to be Uncursed", MENU_UNSELECTED); "Items known to be Uncursed", itemflags);
} }
if (do_buc_unknown) { if (do_buc_unknown) {
invlet = 'X'; invlet = 'X';
any = cg.zeroany; any = cg.zeroany;
any.a_int = 'X'; any.a_int = 'X';
add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE,
"Items of unknown Bless/Curse status", MENU_UNSELECTED); "Items of unknown Bless/Curse status", itemflags);
} }
end_menu(win, qstr); end_menu(win, qstr);
n = select_menu(win, how, pick_list); n = select_menu(win, how, pick_list);
@@ -1829,7 +1833,7 @@ doloot()
if (Is_container(cobj)) { if (Is_container(cobj)) {
any.a_obj = cobj; any.a_obj = cobj;
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE,
doname(cobj), MENU_UNSELECTED); doname(cobj), MENU_ITEMFLAGS_NONE);
} }
end_menu(win, "Loot which containers?"); end_menu(win, "Loot which containers?");
n = select_menu(win, PICK_ANY, &pick_list); n = select_menu(win, PICK_ANY, &pick_list);
@@ -2897,47 +2901,47 @@ boolean outokay, inokay, alreadyused, more_containers;
any.a_int = 1; /* ':' */ any.a_int = 1; /* ':' */
Sprintf(buf, "Look inside %s", thesimpleoname(obj)); Sprintf(buf, "Look inside %s", thesimpleoname(obj));
add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE, buf, add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE, buf,
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
if (outokay) { if (outokay) {
any.a_int = 2; /* 'o' */ any.a_int = 2; /* 'o' */
Sprintf(buf, "take %s out", something); Sprintf(buf, "take %s out", something);
add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE,
buf, MENU_UNSELECTED); buf, MENU_ITEMFLAGS_NONE);
} }
if (inokay) { if (inokay) {
any.a_int = 3; /* 'i' */ any.a_int = 3; /* 'i' */
Sprintf(buf, "put %s in", something); Sprintf(buf, "put %s in", something);
add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE,
buf, MENU_UNSELECTED); buf, MENU_ITEMFLAGS_NONE);
} }
if (outokay) { if (outokay) {
any.a_int = 4; /* 'b' */ any.a_int = 4; /* 'b' */
Sprintf(buf, "%stake out, then put in", inokay ? "both; " : ""); Sprintf(buf, "%stake out, then put in", inokay ? "both; " : "");
add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE,
buf, MENU_UNSELECTED); buf, MENU_ITEMFLAGS_NONE);
} }
if (inokay) { if (inokay) {
any.a_int = 5; /* 'r' */ any.a_int = 5; /* 'r' */
Sprintf(buf, "%sput in, then take out", Sprintf(buf, "%sput in, then take out",
outokay ? "both reversed; " : ""); outokay ? "both reversed; " : "");
add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE,
buf, MENU_UNSELECTED); buf, MENU_ITEMFLAGS_NONE);
any.a_int = 6; /* 's' */ any.a_int = 6; /* 's' */
Sprintf(buf, "stash one item into %s", thesimpleoname(obj)); Sprintf(buf, "stash one item into %s", thesimpleoname(obj));
add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE,
buf, MENU_UNSELECTED); buf, MENU_ITEMFLAGS_NONE);
} }
any.a_int = 0; any.a_int = 0;
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE);
if (more_containers) { if (more_containers) {
any.a_int = 7; /* 'n' */ any.a_int = 7; /* 'n' */
add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE,
"loot next container", MENU_SELECTED); "loot next container", MENU_ITEMFLAGS_SELECTED);
} }
any.a_int = 8; /* 'q' */ any.a_int = 8; /* 'q' */
Strcpy(buf, alreadyused ? "done" : "do nothing"); Strcpy(buf, alreadyused ? "done" : "do nothing");
add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE, buf, add_menu(win, NO_GLYPH, &any, menuselector[any.a_int], 0, ATR_NONE, buf,
more_containers ? MENU_UNSELECTED : MENU_SELECTED); more_containers ? MENU_ITEMFLAGS_NONE : MENU_ITEMFLAGS_SELECTED);
end_menu(win, prompt); end_menu(win, prompt);
n = select_menu(win, PICK_ONE, &pick_list); n = select_menu(win, PICK_ONE, &pick_list);
@@ -2997,18 +3001,18 @@ dotip()
++i; ++i;
any.a_obj = cobj; any.a_obj = cobj;
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE,
doname(cobj), MENU_UNSELECTED); doname(cobj), MENU_ITEMFLAGS_NONE);
} }
if (g.invent) { if (g.invent) {
any = cg.zeroany; any = cg.zeroany;
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE,
"", MENU_UNSELECTED); "", MENU_ITEMFLAGS_NONE);
any.a_obj = &dummyobj; any.a_obj = &dummyobj;
/* use 'i' for inventory unless there are so many /* use 'i' for inventory unless there are so many
containers that it's already being used */ containers that it's already being used */
i = (i <= 'i' - 'a' && !flags.lootabc) ? 'i' : 0; i = (i <= 'i' - 'a' && !flags.lootabc) ? 'i' : 0;
add_menu(win, NO_GLYPH, &any, i, 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, i, 0, ATR_NONE,
"tip something being carried", MENU_SELECTED); "tip something being carried", MENU_ITEMFLAGS_SELECTED);
} }
end_menu(win, "Tip which container?"); end_menu(win, "Tip which container?");
n = select_menu(win, PICK_ONE, &pick_list); n = select_menu(win, PICK_ONE, &pick_list);
+7 -6
View File
@@ -201,6 +201,7 @@ struct obj *otmp;
if (nhfp->structlevel) if (nhfp->structlevel)
mread(nhfp->fd, (genericptr_t) otmp, sizeof(struct obj)); mread(nhfp->fd, (genericptr_t) otmp, sizeof(struct obj));
otmp->lua_ref_cnt = 0;
/* next object pointers are invalid; otmp->cobj needs to be left /* next object pointers are invalid; otmp->cobj needs to be left
as is--being non-null is key to restoring container contents */ as is--being non-null is key to restoring container contents */
otmp->nobj = otmp->nexthere = (struct obj *) 0; otmp->nobj = otmp->nexthere = (struct obj *) 0;
@@ -1435,25 +1436,25 @@ winid bannerwin; /* if not WIN_ERR, clear window and show copyright in menu */
/* COPYRIGHT_BANNER_[ABCD] */ /* COPYRIGHT_BANNER_[ABCD] */
for (k = 1; k <= 4; ++k) for (k = 1; k <= 4; ++k)
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
copyright_banner_line(k), MENU_UNSELECTED); copyright_banner_line(k), MENU_ITEMFLAGS_NONE);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
} }
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
"Select one of your saved games", MENU_UNSELECTED); "Select one of your saved games", MENU_ITEMFLAGS_NONE);
for (k = 0; saved[k]; ++k) { for (k = 0; saved[k]; ++k) {
any.a_int = k + 1; any.a_int = k + 1;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, saved[k], add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, saved[k],
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
} }
clet = (k <= 'n' - 'a') ? 'n' : 0; /* new game */ clet = (k <= 'n' - 'a') ? 'n' : 0; /* new game */
any.a_int = -1; /* not >= 0 */ any.a_int = -1; /* not >= 0 */
add_menu(tmpwin, NO_GLYPH, &any, clet, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, clet, 0, ATR_NONE,
"Start a new character", MENU_UNSELECTED); "Start a new character", MENU_ITEMFLAGS_NONE);
clet = (k + 1 <= 'q' - 'a') ? 'q' : 0; /* quit */ clet = (k + 1 <= 'q' - 'a') ? 'q' : 0; /* quit */
any.a_int = -2; any.a_int = -2;
add_menu(tmpwin, NO_GLYPH, &any, clet, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, clet, 0, ATR_NONE,
"Never mind (quit)", MENU_SELECTED); "Never mind (quit)", MENU_ITEMFLAGS_SELECTED);
/* no prompt on end_menu, as we've done our own at the top */ /* no prompt on end_menu, as we've done our own at the top */
end_menu(tmpwin, (char *) 0); end_menu(tmpwin, (char *) 0);
if (select_menu(tmpwin, PICK_ONE, &chosen_game) > 0) { if (select_menu(tmpwin, PICK_ONE, &chosen_game) > 0) {
+5 -5
View File
@@ -1902,24 +1902,24 @@ boolean preselect;
/* use four spaces of padding to fake a grayed out menu choice */ /* use four spaces of padding to fake a grayed out menu choice */
Sprintf(buf, "%4s%s forces %s", "", constrainer, forcedvalue); Sprintf(buf, "%4s%s forces %s", "", constrainer, forcedvalue);
add_menu(where, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, add_menu(where, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
} else if (what) { } else if (what) {
any.a_int = RS_menu_arg(which); any.a_int = RS_menu_arg(which);
Sprintf(buf, "Pick%s %s first", (f >= 0) ? " another" : "", what); Sprintf(buf, "Pick%s %s first", (f >= 0) ? " another" : "", what);
add_menu(where, NO_GLYPH, &any, RS_menu_let[which], 0, ATR_NONE, buf, add_menu(where, NO_GLYPH, &any, RS_menu_let[which], 0, ATR_NONE, buf,
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
} else if (which == RS_filter) { } else if (which == RS_filter) {
any.a_int = RS_menu_arg(RS_filter); any.a_int = RS_menu_arg(RS_filter);
add_menu(where, NO_GLYPH, &any, '~', 0, ATR_NONE, add_menu(where, NO_GLYPH, &any, '~', 0, ATR_NONE,
"Reset role/race/&c filtering", MENU_UNSELECTED); "Reset role/race/&c filtering", MENU_ITEMFLAGS_NONE);
} else if (which == ROLE_RANDOM) { } else if (which == ROLE_RANDOM) {
any.a_int = ROLE_RANDOM; any.a_int = ROLE_RANDOM;
add_menu(where, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", add_menu(where, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
preselect ? MENU_SELECTED : MENU_UNSELECTED); preselect ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
} else if (which == ROLE_NONE) { } else if (which == ROLE_NONE) {
any.a_int = ROLE_NONE; any.a_int = ROLE_NONE;
add_menu(where, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", add_menu(where, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
preselect ? MENU_SELECTED : MENU_UNSELECTED); preselect ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
} else { } else {
impossible("role_menu_extra: bad arg (%d)", which); impossible("role_menu_extra: bad arg (%d)", which);
} }
-4
View File
@@ -287,10 +287,6 @@ NHFILE *nhfp;
urealtime.finish_time = getnow(); urealtime.finish_time = getnow();
urealtime.realtime += (long) (urealtime.finish_time urealtime.realtime += (long) (urealtime.finish_time
- urealtime.start_timing); - urealtime.start_timing);
urealtime.finish_time = getnow();
urealtime.realtime += (long) (urealtime.finish_time
- urealtime.start_timing);
if (nhfp->structlevel) { if (nhfp->structlevel) {
bwrite(nhfp->fd, (genericptr_t) &u, sizeof u); bwrite(nhfp->fd, (genericptr_t) &u, sizeof u);
bwrite(nhfp->fd, yyyymmddhhmmss(ubirthday), 14); bwrite(nhfp->fd, yyyymmddhhmmss(ubirthday), 14);
+5 -5
View File
@@ -1565,13 +1565,13 @@ spellsortmenu()
/* separate final choice from others with a blank line */ /* separate final choice from others with a blank line */
any.a_int = 0; any.a_int = 0;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
} else { } else {
let = 'a' + i; let = 'a' + i;
} }
any.a_int = i + 1; any.a_int = i + 1;
add_menu(tmpwin, NO_GLYPH, &any, let, 0, ATR_NONE, spl_sortchoices[i], add_menu(tmpwin, NO_GLYPH, &any, let, 0, ATR_NONE, spl_sortchoices[i],
(i == g.spl_sortmode) ? MENU_SELECTED : MENU_UNSELECTED); (i == g.spl_sortmode) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
} }
end_menu(tmpwin, "View known spells list sorted"); end_menu(tmpwin, "View known spells list sorted");
@@ -1658,7 +1658,7 @@ int *spell_no;
fmt = "%s\t%-d\t%s\t%-d%%\t%s"; fmt = "%s\t%-d\t%s\t%-d%%\t%s";
} }
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, buf, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, buf,
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
for (i = 0; i < MAXSPELL && spellid(i) != NO_SPELL; i++) { for (i = 0; i < MAXSPELL && spellid(i) != NO_SPELL; i++) {
splnum = !g.spl_orderindx ? i : g.spl_orderindx[i]; splnum = !g.spl_orderindx ? i : g.spl_orderindx[i];
Sprintf(buf, fmt, spellname(splnum), spellev(splnum), Sprintf(buf, fmt, spellname(splnum), spellev(splnum),
@@ -1668,7 +1668,7 @@ int *spell_no;
any.a_int = splnum + 1; /* must be non-zero */ any.a_int = splnum + 1; /* must be non-zero */
add_menu(tmpwin, NO_GLYPH, &any, spellet(splnum), 0, ATR_NONE, buf, add_menu(tmpwin, NO_GLYPH, &any, spellet(splnum), 0, ATR_NONE, buf,
(splnum == splaction) ? MENU_SELECTED : MENU_UNSELECTED); (splnum == splaction) ? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
} }
how = PICK_ONE; how = PICK_ONE;
if (splaction == SPELLMENU_VIEW) { if (splaction == SPELLMENU_VIEW) {
@@ -1679,7 +1679,7 @@ int *spell_no;
/* more than 1 spell, add an extra menu entry */ /* more than 1 spell, add an extra menu entry */
any.a_int = SPELLMENU_SORT + 1; any.a_int = SPELLMENU_SORT + 1;
add_menu(tmpwin, NO_GLYPH, &any, '+', 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, '+', 0, ATR_NONE,
"[sort spells]", MENU_UNSELECTED); "[sort spells]", MENU_ITEMFLAGS_NONE);
} }
} }
end_menu(tmpwin, prompt); end_menu(tmpwin, prompt);
+2 -2
View File
@@ -607,8 +607,8 @@ dotelecmd()
any.a_int = (int) tports[i].menulet; any.a_int = (int) tports[i].menulet;
add_menu(win, NO_GLYPH, &any, (char) any.a_int, 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, (char) any.a_int, 0, ATR_NONE,
tports[i].menudesc, tports[i].menudesc,
(tports[i].menulet == 'w') ? MENU_SELECTED (tports[i].menulet == 'w') ? MENU_ITEMFLAGS_SELECTED
: MENU_UNSELECTED); : MENU_ITEMFLAGS_NONE);
} }
end_menu(win, "Which way do you want to teleport?"); end_menu(win, "Which way do you want to teleport?");
i = select_menu(win, PICK_ONE, &picks); i = select_menu(win, PICK_ONE, &picks);
+5 -5
View File
@@ -1195,17 +1195,17 @@ enhance_weapon_skill()
? "when you're more experienced" ? "when you're more experienced"
: "if skill slots become available"); : "if skill slots become available");
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
} }
if (maxxed_cnt > 0) { if (maxxed_cnt > 0) {
Sprintf(buf, Sprintf(buf,
"(Skill%s flagged by \"#\" cannot be enhanced any further.)", "(Skill%s flagged by \"#\" cannot be enhanced any further.)",
plur(maxxed_cnt)); plur(maxxed_cnt));
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
} }
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
} }
/* List the skills, making ones that could be advanced /* List the skills, making ones that could be advanced
@@ -1219,7 +1219,7 @@ enhance_weapon_skill()
any = cg.zeroany; any = cg.zeroany;
if (i == skill_ranges[pass].first) if (i == skill_ranges[pass].first)
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
skill_ranges[pass].name, MENU_UNSELECTED); skill_ranges[pass].name, MENU_ITEMFLAGS_NONE);
if (P_RESTRICTED(i)) if (P_RESTRICTED(i))
continue; continue;
@@ -1261,7 +1261,7 @@ enhance_weapon_skill()
} }
any.a_int = can_advance(i, speedy) ? i + 1 : 0; any.a_int = can_advance(i, speedy) ? i + 1 : 0;
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
} }
Strcpy(buf, (to_advance > 0) ? "Pick a skill to advance:" Strcpy(buf, (to_advance > 0) ? "Pick a skill to advance:"
+68 -11
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 wield.c $NHDT-Date: 1559670611 2019/06/04 17:50:11 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.59 $ */ /* NetHack 3.6 wield.c $NHDT-Date: 1577186790 2019/12/24 11:26:30 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.69 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2009. */ /*-Copyright (c) Robert Patrick Rankin, 2009. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -245,7 +245,7 @@ register struct obj *obj;
/*** Commands to change particular slot(s) ***/ /*** Commands to change particular slot(s) ***/
static NEARDATA const char wield_objs[] = { static NEARDATA const char wield_objs[] = {
ALL_CLASSES, ALLOW_NONE, WEAPON_CLASS, TOOL_CLASS, 0 ALLOW_COUNT, ALL_CLASSES, ALLOW_NONE, WEAPON_CLASS, TOOL_CLASS, 0
}; };
static NEARDATA const char ready_objs[] = { static NEARDATA const char ready_objs[] = {
ALLOW_COUNT, COIN_CLASS, ALL_CLASSES, ALLOW_NONE, WEAPON_CLASS, 0 ALLOW_COUNT, COIN_CLASS, ALL_CLASSES, ALLOW_NONE, WEAPON_CLASS, 0
@@ -258,7 +258,9 @@ static NEARDATA const char bullets[] = { /* (note: different from dothrow.c) */
int int
dowield() dowield()
{ {
register struct obj *wep, *oldwep; char qbuf[QBUFSZ];
struct obj *wep, *oldwep;
boolean finish_splitting = FALSE;
int result; int result;
/* May we attempt this? */ /* May we attempt this? */
@@ -269,10 +271,12 @@ dowield()
} }
/* Prompt for a new weapon */ /* Prompt for a new weapon */
if (!(wep = getobj(wield_objs, "wield"))) clear_splitobjs();
if (!(wep = getobj(wield_objs, "wield"))) {
/* Cancelled */ /* Cancelled */
return 0; return 0;
else if (wep == uwep) { } else if (wep == uwep) {
already_wielded:
You("are already wielding that!"); You("are already wielding that!");
if (is_weptool(wep) || is_wet_towel(wep)) if (is_weptool(wep) || is_wet_towel(wep))
g.unweapon = FALSE; /* [see setuwep()] */ g.unweapon = FALSE; /* [see setuwep()] */
@@ -281,21 +285,74 @@ dowield()
weldmsg(uwep); weldmsg(uwep);
/* previously interrupted armor removal mustn't be resumed */ /* previously interrupted armor removal mustn't be resumed */
reset_remarm(); reset_remarm();
/* if player chose a partial stack but can't wield it, undo split */
if (wep->o_id && wep->o_id == g.context.objsplit.child_oid)
unsplitobj(wep);
return 0; return 0;
} else if (wep->o_id && wep->o_id == g.context.objsplit.child_oid) {
/* if wep is the result of supplying a count to getobj()
we don't want to split something already wielded; for
any other item, we need to give it its own inventory slot */
if (uwep && uwep->o_id == g.context.objsplit.parent_oid) {
unsplitobj(wep);
goto already_wielded;
}
finish_splitting = TRUE;
goto wielding;
} }
/* Handle no object, or object in other slot */ /* Handle no object, or object in other slot */
if (wep == &cg.zeroobj) if (wep == &cg.zeroobj) {
wep = (struct obj *) 0; wep = (struct obj *) 0;
else if (wep == uswapwep) } else if (wep == uswapwep) {
return doswapweapon(); return doswapweapon();
else if (wep == uquiver) } else if (wep == uquiver) {
/* offer to split stack if multiple are quivered */
if (uquiver->quan > 1L && inv_cnt(FALSE) < 52 && splittable(uquiver)) {
Sprintf(qbuf, "You have %ld %s readied. Wield one?",
uquiver->quan, simpleonames(uquiver));
switch (ynq(qbuf)) {
case 'q':
return 0;
case 'y':
/* leave N-1 quivered, split off 1 to wield */
wep = splitobj(uquiver, 1L);
finish_splitting = TRUE;
goto wielding;
default:
break;
}
Strcpy(qbuf, "Wield all of them instead?");
} else {
boolean use_plural = (is_plural(uquiver) || pair_of(uquiver));
Sprintf(qbuf, "You have %s readied. Wield %s instead?",
!use_plural ? "that" : "those",
!use_plural ? "it" : "them");
}
/* require confirmation to wield the quivered weapon */
if (ynq(qbuf) != 'y') {
(void) Shk_Your(qbuf, uquiver); /* replace qbuf[] contents */
pline("%s%s %s readied.", qbuf,
simpleonames(uquiver), otense(uquiver, "remain"));
return 0;
}
/* wielding whole readied stack, so no longer quivered */
setuqwep((struct obj *) 0); setuqwep((struct obj *) 0);
else if (wep->owornmask & (W_ARMOR | W_ACCESSORY | W_SADDLE)) { } else if (wep->owornmask & (W_ARMOR | W_ACCESSORY | W_SADDLE)) {
You("cannot wield that!"); You("cannot wield that!");
return 0; return 0;
} }
wielding:
if (finish_splitting) {
/* wep was split off from something; give it its own invlet */
freeinv(wep);
wep->nomerge = 1;
addinv(wep);
wep->nomerge = 0;
}
/* Set your new primary weapon */ /* Set your new primary weapon */
oldwep = uwep; oldwep = uwep;
result = ready_weapon(wep); result = ready_weapon(wep);
@@ -363,7 +420,7 @@ dowieldquiver()
/* will_weld(), touch_petrifies(), etc. */ /* will_weld(), touch_petrifies(), etc. */
g.multi = 0; g.multi = 0;
/* forget last splitobj() before calling getobj() with ALLOW_COUNT */ /* forget last splitobj() before calling getobj() with ALLOW_COUNT */
g.context.objsplit.child_oid = g.context.objsplit.parent_oid = 0; clear_splitobjs();
/* Prompt for a new quiver: "What do you want to ready?" /* Prompt for a new quiver: "What do you want to ready?"
(Include gems/stones as likely candidates if either primary (Include gems/stones as likely candidates if either primary
@@ -398,7 +455,7 @@ dowieldquiver()
} }
finish_splitting = TRUE; finish_splitting = TRUE;
} else if (newquiver == uquiver) { } else if (newquiver == uquiver) {
already_quivered: already_quivered:
pline("That ammunition is already readied!"); pline("That ammunition is already readied!");
return 0; return 0;
} else if (newquiver->owornmask & (W_ARMOR | W_ACCESSORY | W_SADDLE)) { } else if (newquiver->owornmask & (W_ARMOR | W_ACCESSORY | W_SADDLE)) {
+6 -6
View File
@@ -68,7 +68,7 @@ static void FDECL(dump_display_nhwindow, (winid, BOOLEAN_P));
static void FDECL(dump_destroy_nhwindow, (winid)); static void FDECL(dump_destroy_nhwindow, (winid));
static void FDECL(dump_start_menu, (winid)); static void FDECL(dump_start_menu, (winid));
static void FDECL(dump_add_menu, (winid, int, const ANY_P *, CHAR_P, static void FDECL(dump_add_menu, (winid, int, const ANY_P *, CHAR_P,
CHAR_P, int, const char *, BOOLEAN_P)); CHAR_P, int, const char *, unsigned int));
static void FDECL(dump_end_menu, (winid, const char *)); static void FDECL(dump_end_menu, (winid, const char *));
static int FDECL(dump_select_menu, (winid, int, MENU_ITEM_P **)); static int FDECL(dump_select_menu, (winid, int, MENU_ITEM_P **));
static void FDECL(dump_putstr, (winid, int, const char *)); static void FDECL(dump_putstr, (winid, int, const char *));
@@ -495,7 +495,7 @@ static void FDECL(hup_exit_nhwindows, (const char *));
static winid FDECL(hup_create_nhwindow, (int)); static winid FDECL(hup_create_nhwindow, (int));
static int FDECL(hup_select_menu, (winid, int, MENU_ITEM_P **)); static int FDECL(hup_select_menu, (winid, int, MENU_ITEM_P **));
static void FDECL(hup_add_menu, (winid, int, const anything *, CHAR_P, CHAR_P, static void FDECL(hup_add_menu, (winid, int, const anything *, CHAR_P, CHAR_P,
int, const char *, BOOLEAN_P)); int, const char *, unsigned int));
static void FDECL(hup_end_menu, (winid, const char *)); static void FDECL(hup_end_menu, (winid, const char *));
static void FDECL(hup_putstr, (winid, int, const char *)); static void FDECL(hup_putstr, (winid, int, const char *));
static void FDECL(hup_print_glyph, (winid, XCHAR_P, XCHAR_P, int, int)); static void FDECL(hup_print_glyph, (winid, XCHAR_P, XCHAR_P, int, int));
@@ -681,13 +681,13 @@ struct mi **menu_list UNUSED;
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
hup_add_menu(window, glyph, identifier, sel, grpsel, attr, txt, preselected) hup_add_menu(window, glyph, identifier, sel, grpsel, attr, txt, itemflags)
winid window UNUSED; winid window UNUSED;
int glyph UNUSED, attr UNUSED; int glyph UNUSED, attr UNUSED;
const anything *identifier UNUSED; const anything *identifier UNUSED;
char sel UNUSED, grpsel UNUSED; char sel UNUSED, grpsel UNUSED;
const char *txt UNUSED; const char *txt UNUSED;
boolean preselected UNUSED; unsigned int itemflags UNUSED;
{ {
return; return;
} }
@@ -1307,7 +1307,7 @@ winid win UNUSED;
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
dump_add_menu(win, glyph, identifier, ch, gch, attr, str, preselected) dump_add_menu(win, glyph, identifier, ch, gch, attr, str, itemflags)
winid win UNUSED; winid win UNUSED;
int glyph; int glyph;
const anything *identifier UNUSED; const anything *identifier UNUSED;
@@ -1315,7 +1315,7 @@ char ch;
char gch UNUSED; char gch UNUSED;
int attr UNUSED; int attr UNUSED;
const char *str; const char *str;
boolean preselected UNUSED; unsigned int itemflags UNUSED;
{ {
if (dumplog_file) { if (dumplog_file) {
if (glyph == NO_GLYPH) if (glyph == NO_GLYPH)
+14 -14
View File
@@ -776,7 +776,7 @@ amii_get_ext_cmd(void)
sprintf(buf, "%-10s - %s ", extcmdlist[i].ef_txt, sprintf(buf, "%-10s - %s ", extcmdlist[i].ef_txt,
extcmdlist[i].ef_desc); extcmdlist[i].ef_desc);
amii_add_menu(win, NO_GLYPH, &id, extcmdlist[i].ef_txt[0], 0, 0, amii_add_menu(win, NO_GLYPH, &id, extcmdlist[i].ef_txt[0], 0, 0,
buf, MENU_UNSELECTED); buf, MENU_ITEMFLAGS_NONE);
} }
amii_end_menu(win, (char *) 0); amii_end_menu(win, (char *) 0);
@@ -837,7 +837,7 @@ amii_get_ext_cmd(void)
sprintf(buf, "%-10s - %s ", extcmdlist[i].ef_txt, sprintf(buf, "%-10s - %s ", extcmdlist[i].ef_txt,
extcmdlist[i].ef_desc); extcmdlist[i].ef_desc);
amii_add_menu(win, NO_GLYPH, &id, extcmdlist[i].ef_txt[0], 0, amii_add_menu(win, NO_GLYPH, &id, extcmdlist[i].ef_txt[0], 0,
0, buf, MENU_UNSELECTED); 0, buf, MENU_ITEMFLAGS_NONE);
} }
amii_end_menu(win, (char *) 0); amii_end_menu(win, (char *) 0);
@@ -1413,7 +1413,7 @@ amii_player_selection()
Strcpy(rolenamebuf, roles[i].name.m); Strcpy(rolenamebuf, roles[i].name.m);
} }
add_menu(win, NO_GLYPH, &any, thisch, 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, thisch, 0, ATR_NONE,
an(rolenamebuf), MENU_UNSELECTED); an(rolenamebuf), MENU_ITEMFLAGS_NONE);
lastch = thisch; lastch = thisch;
} }
} }
@@ -1422,10 +1422,10 @@ amii_player_selection()
if (any.a_int == 0) /* must be non-zero */ if (any.a_int == 0) /* must be non-zero */
any.a_int = randrole(FALSE) + 1; any.a_int = randrole(FALSE) + 1;
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
any.a_int = i + 1; /* must be non-zero */ any.a_int = i + 1; /* must be non-zero */
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
Sprintf(pbuf, "Pick a role for your %s", plbuf); Sprintf(pbuf, "Pick a role for your %s", plbuf);
end_menu(win, pbuf); end_menu(win, pbuf);
n = select_menu(win, PICK_ONE, &selected); n = select_menu(win, PICK_ONE, &selected);
@@ -1488,17 +1488,17 @@ amii_player_selection()
any.a_int = i + 1; /* must be non-zero */ any.a_int = i + 1; /* must be non-zero */
add_menu(win, NO_GLYPH, &any, races[i].noun[0], 0, add_menu(win, NO_GLYPH, &any, races[i].noun[0], 0,
ATR_NONE, races[i].noun, ATR_NONE, races[i].noun,
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
} }
any.a_int = pick_race(flags.initrole, flags.initgend, any.a_int = pick_race(flags.initrole, flags.initgend,
flags.initalign, PICK_RANDOM) + 1; flags.initalign, PICK_RANDOM) + 1;
if (any.a_int == 0) /* must be non-zero */ if (any.a_int == 0) /* must be non-zero */
any.a_int = randrace(flags.initrole) + 1; any.a_int = randrace(flags.initrole) + 1;
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
any.a_int = i + 1; /* must be non-zero */ any.a_int = i + 1; /* must be non-zero */
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
Sprintf(pbuf, "Pick the race of your %s", plbuf); Sprintf(pbuf, "Pick the race of your %s", plbuf);
end_menu(win, pbuf); end_menu(win, pbuf);
n = select_menu(win, PICK_ONE, &selected); n = select_menu(win, PICK_ONE, &selected);
@@ -1560,17 +1560,17 @@ amii_player_selection()
flags.initalign)) { flags.initalign)) {
any.a_int = i + 1; any.a_int = i + 1;
add_menu(win, NO_GLYPH, &any, genders[i].adj[0], 0, add_menu(win, NO_GLYPH, &any, genders[i].adj[0], 0,
ATR_NONE, genders[i].adj, MENU_UNSELECTED); ATR_NONE, genders[i].adj, MENU_ITEMFLAGS_NONE);
} }
any.a_int = pick_gend(flags.initrole, flags.initrace, any.a_int = pick_gend(flags.initrole, flags.initrace,
flags.initalign, PICK_RANDOM) + 1; flags.initalign, PICK_RANDOM) + 1;
if (any.a_int == 0) /* must be non-zero */ if (any.a_int == 0) /* must be non-zero */
any.a_int = randgend(flags.initrole, flags.initrace) + 1; any.a_int = randgend(flags.initrole, flags.initrace) + 1;
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
any.a_int = i + 1; /* must be non-zero */ any.a_int = i + 1; /* must be non-zero */
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
Sprintf(pbuf, "Pick the gender of your %s", plbuf); Sprintf(pbuf, "Pick the gender of your %s", plbuf);
end_menu(win, pbuf); end_menu(win, pbuf);
n = select_menu(win, PICK_ONE, &selected); n = select_menu(win, PICK_ONE, &selected);
@@ -1631,17 +1631,17 @@ amii_player_selection()
flags.initgend, i)) { flags.initgend, i)) {
any.a_int = i + 1; any.a_int = i + 1;
add_menu(win, NO_GLYPH, &any, aligns[i].adj[0], 0, add_menu(win, NO_GLYPH, &any, aligns[i].adj[0], 0,
ATR_NONE, aligns[i].adj, MENU_UNSELECTED); ATR_NONE, aligns[i].adj, MENU_ITEMFLAGS_NONE);
} }
any.a_int = pick_align(flags.initrole, flags.initrace, any.a_int = pick_align(flags.initrole, flags.initrace,
flags.initgend, PICK_RANDOM) + 1; flags.initgend, PICK_RANDOM) + 1;
if (any.a_int == 0) /* must be non-zero */ if (any.a_int == 0) /* must be non-zero */
any.a_int = randalign(flags.initrole, flags.initrace) + 1; any.a_int = randalign(flags.initrole, flags.initrace) + 1;
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
any.a_int = i + 1; /* must be non-zero */ any.a_int = i + 1; /* must be non-zero */
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
Sprintf(pbuf, "Pick the alignment of your %s", plbuf); Sprintf(pbuf, "Pick the alignment of your %s", plbuf);
end_menu(win, pbuf); end_menu(win, pbuf);
n = select_menu(win, PICK_ONE, &selected); n = select_menu(win, PICK_ONE, &selected);
+1 -1
View File
@@ -5,7 +5,7 @@
void FDECL(amii_raw_print, (const char *)); void FDECL(amii_raw_print, (const char *));
void FDECL(amii_raw_print_bold, (const char *)); void FDECL(amii_raw_print_bold, (const char *));
void FDECL(amii_start_menu, (winid )); void FDECL(amii_start_menu, (winid ));
void FDECL(amii_add_menu, (winid , char , int , const char *)); void FDECL(amii_add_menu, (winid , char , int , const char *, unsigned int));
void FDECL(amii_end_menu, (winid , char , const char * , const char *)); void FDECL(amii_end_menu, (winid , char , const char * , const char *));
char FDECL(amii_select_menu, (winid )); char FDECL(amii_select_menu, (winid ));
void NDECL(amii_update_inventory ); void NDECL(amii_update_inventory );
+4 -3
View File
@@ -56,7 +56,7 @@ register winid window;
/* Add a string to a menu */ /* Add a string to a menu */
void void
amii_add_menu(window, glyph, id, ch, gch, attr, str, preselected) amii_add_menu(window, glyph, id, ch, gch, attr, str, itemflags)
register winid window; register winid window;
register int glyph; register int glyph;
register const anything *id; register const anything *id;
@@ -64,9 +64,10 @@ register char ch;
register char gch; register char gch;
register int attr; register int attr;
register const char *str; register const char *str;
register BOOLEAN_P preselected; register unsigned int itemflags;
{ {
register struct amii_WinDesc *cw; register struct amii_WinDesc *cw;
boolean preselected = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0);
amii_menu_item *mip; amii_menu_item *mip;
char buf[4 + BUFSZ]; char buf[4 + BUFSZ];
@@ -143,7 +144,7 @@ register const char *morestr;
#endif #endif
any.a_void = 0; any.a_void = 0;
amii_add_menu(window, NO_GLYPH, &any, 0, 0, ATR_NONE, morestr, amii_add_menu(window, NO_GLYPH, &any, 0, 0, ATR_NONE, morestr,
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
#ifdef PROMPTFIRST /* Do some shuffling. Last first, push others one forward \ #ifdef PROMPTFIRST /* Do some shuffling. Last first, push others one forward \
*/ */
mip->next = NULL; mip->next = NULL;
+1 -1
View File
@@ -41,7 +41,7 @@ void amii_getret(void);
/* winmenu.c */ /* winmenu.c */
void amii_start_menu(winid window); void amii_start_menu(winid window);
void FDECL(amii_add_menu, (winid, int, const anything *, CHAR_P, CHAR_P, int, void FDECL(amii_add_menu, (winid, int, const anything *, CHAR_P, CHAR_P, int,
const char *, BOOLEAN_P)); const char *, unsigned int));
void FDECL(amii_end_menu, (winid, const char *)); void FDECL(amii_end_menu, (winid, const char *));
int FDECL(amii_select_menu, (winid, int, menu_item **)); int FDECL(amii_select_menu, (winid, int, menu_item **));
int DoMenuScroll(int win, int blocking, int how, menu_item **); int DoMenuScroll(int win, int blocking, int how, menu_item **);
+2 -1
View File
@@ -1937,7 +1937,7 @@ mac_start_menu(winid win)
void void
mac_add_menu(winid win, int glyph, const anything *any, CHAR_P menuChar, mac_add_menu(winid win, int glyph, const anything *any, CHAR_P menuChar,
CHAR_P groupAcc, int attr, const char *inStr, int preselected) CHAR_P groupAcc, int attr, const char *inStr, unsigned int itemflags)
{ {
#if defined(__SC__) || defined(__MRC__) #if defined(__SC__) || defined(__MRC__)
#pragma unused(glyph) #pragma unused(glyph)
@@ -1946,6 +1946,7 @@ mac_add_menu(winid win, int glyph, const anything *any, CHAR_P menuChar,
const char *str; const char *str;
char locStr[4 + BUFSZ]; char locStr[4 + BUFSZ];
MacMHMenuItem *item; MacMHMenuItem *item;
int preselected = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0);
if (!inStr) if (!inStr)
return; return;
+61 -91
View File
@@ -295,7 +295,7 @@ VOBJ07 = $(O)getline.o $(O)hack.o $(O)hacklib.o $(O)invent.o $(O)lock.o
VOBJ08 = $(O)mail.o $(O)main.o $(O)makemon.o $(O)mapglyph.o $(O)mcastu.o $(O)mhitm.o VOBJ08 = $(O)mail.o $(O)main.o $(O)makemon.o $(O)mapglyph.o $(O)mcastu.o $(O)mhitm.o
VOBJ09 = $(O)mhitu.o $(O)minion.o $(O)mkmap.o $(O)mklev.o $(O)mkmaze.o VOBJ09 = $(O)mhitu.o $(O)minion.o $(O)mkmap.o $(O)mklev.o $(O)mkmaze.o
VOBJ10 = $(O)mkobj.o $(O)mkroom.o $(O)mon.o $(O)mondata.o $(O)monmove.o VOBJ10 = $(O)mkobj.o $(O)mkroom.o $(O)mon.o $(O)mondata.o $(O)monmove.o
VOBJ11 = $(O)monst.o $(O)monstr.o $(O)mplayer.o $(O)mthrowu.o $(O)muse.o VOBJ11 = $(O)monst.o $(O)mplayer.o $(O)mthrowu.o $(O)muse.o
VOBJ12 = $(O)music.o $(O)o_init.o $(O)objects.o $(O)objnam.o $(O)options.o VOBJ12 = $(O)music.o $(O)o_init.o $(O)objects.o $(O)objnam.o $(O)options.o
VOBJ13 = $(O)pickup.o $(O)pline.o $(O)polyself.o $(O)potion.o $(O)quest.o VOBJ13 = $(O)pickup.o $(O)pline.o $(O)polyself.o $(O)potion.o $(O)quest.o
VOBJ14 = $(O)questpgr.o $(O)pager.o $(O)pray.o $(O)priest.o $(O)read.o VOBJ14 = $(O)questpgr.o $(O)pager.o $(O)pray.o $(O)priest.o $(O)read.o
@@ -357,14 +357,15 @@ LUASRCFILES = lapi.c lauxlib.c lbaselib.c lbitlib.c lcode.c \
ltable.c ltablib.c ltm.c lundump.c lutf8lib.c \ ltable.c ltablib.c ltm.c lundump.c lutf8lib.c \
lvm.c lzio.c lvm.c lzio.c
LUAOBJFILES = $(O)lapi.o $(O)lauxlib.o $(O)lbaselib.o $(O)lbitlib.o \ LUAOBJFILES1 = $(O)lapi.o $(O)lauxlib.o $(O)lbaselib.o $(O)lbitlib.o \
$(O)lcode.o $(O)lcorolib.o $(O)lctype.o $(O)ldblib.o \ $(O)lcode.o $(O)lcorolib.o $(O)lctype.o $(O)ldblib.o \
$(O)ldebug.o $(O)ldo.o $(O)ldump.o $(O)lfunc.o \ $(O)ldebug.o $(O)ldo.o $(O)ldump.o $(O)lfunc.o
$(O)lgc.o $(O)linit.o $(O)liolib.o $(O)llex.o \ LUAOBJFILES2 = $(O)lgc.o $(O)linit.o $(O)liolib.o $(O)llex.o \
$(O)lmathlib.o $(O)lmem.o $(O)loadlib.o $(O)lobject.o \ $(O)lmathlib.o $(O)lmem.o $(O)loadlib.o $(O)lobject.o \
$(O)lopcodes.o $(O)loslib.o $(O)lparser.o $(O)lstate.o \ $(O)lopcodes.o $(O)loslib.o $(O)lparser.o $(O)lstate.o
$(O)lstring.o $(O)lstrlib.o $(O)ltable.o $(O)ltablib.o \ LUAOBJFILES3 = $(O)lstring.o $(O)lstrlib.o $(O)ltable.o $(O)ltablib.o \
$(O)ltm.o $(O)lundump.o $(O)lutf8lib.o $(O)lvm.o $(O)lzio.o $(O)ltm.o $(O)lundump.o $(O)lutf8lib.o $(O)lvm.o $(O)lzio.o
LUAOBJFILES = $(LUAOBJFILES1) $(LUAOBJFILES2) $(LUAOBJFILES3)
endif endif
ifeq "$(ADD_CURSES)" "Y" ifeq "$(ADD_CURSES)" "Y"
@@ -376,14 +377,17 @@ PDCURSES_CURSPRIV_H = $(PDCURSES_TOP)/curspriv.h
PDCURSES_HEADERS = $(PDCURSES_CURSES_H) $(PDCURSES_CURSPRIV_H) PDCURSES_HEADERS = $(PDCURSES_CURSES_H) $(PDCURSES_CURSPRIV_H)
PDCSRC = $(PDCURSES_TOP)/pdcurses PDCSRC = $(PDCURSES_TOP)/pdcurses
PDCDOS = $(PDCURSES_TOP)/dos PDCDOS = $(PDCURSES_TOP)/dos
PDCLIBOBJS = $(O)addch.o $(O)addchstr.o $(O)addstr.o $(O)attr.o $(O)beep.o \ PDCLIBOBJS1 = $(O)addch.o $(O)addchstr.o $(O)addstr.o $(O)attr.o $(O)beep.o \
$(O)bkgd.o $(O)border.o $(O)clear.o $(O)color.o $(O)delch.o $(O)deleteln.o \ $(O)bkgd.o $(O)border.o $(O)clear.o $(O)color.o $(O)delch.o $(O)deleteln.o \
$(O)getch.o $(O)getstr.o $(O)getyx.o $(O)inch.o $(O)inchstr.o \ $(O)getch.o
$(O)initscr.o $(O)inopts.o $(O)insch.o $(O)insstr.o $(O)instr.o $(O)kernel.o \ PDCLIBOBJS2 = $(O)getstr.o $(O)getyx.o $(O)inch.o $(O)inchstr.o $(O)initscr.o \
$(O)keyname.o $(O)mouse.o $(O)move.o $(O)outopts.o $(O)overlay.o $(O)pad.o \ $(O)inopts.o $(O)insch.o $(O)insstr.o $(O)instr.o $(O)kernel.o \
$(O)panel.o $(O)printw.o $(O)refresh.o $(O)scanw.o $(O)scr_dump.o $(O)scroll.o \ $(O)keyname.o $(O)mouse.o
$(O)slk.o $(O)termattr.o $(O)touch.o $(O)util.o $(O)window.o \ PDCLIBOBJS3 = $(O)move.o $(O)outopts.o $(O)overlay.o $(O)pad.o $(O)panel.o \
$(O)debug.o $(O)printw.o $(O)refresh.o $(O)scanw.o $(O)scr_dump.o $(O)scroll.o \
$(O)slk.o $(O)termattr.o
PDCLIBOBJS4 = $(O)touch.o $(O)util.o $(O)window.o $(O)debug.o
PDCLIBOBJS = $(PDCLIBOBJS1) $(PDCLIBOBJS2) $(PDCLIBOBJS3) $(PDCLIBOBJS4)
PDCOBJS = $(O)pdcclip.o $(O)pdcdisp.o $(O)pdcgetsc.o $(O)pdckbd.o \ PDCOBJS = $(O)pdcclip.o $(O)pdcdisp.o $(O)pdcgetsc.o $(O)pdckbd.o \
$(O)pdcscrn.o $(O)pdcsetsc.o $(O)pdcutil.o $(O)pdcscrn.o $(O)pdcsetsc.o $(O)pdcutil.o
@@ -586,7 +590,7 @@ else
LEVCOMPEXE = LEVCOMPEXE =
endif endif
$(O)utility.tag: $(INCL)/date.h $(INCL)/trap.h $(INCL)/onames.h \ $(O)utility.tag: $(INCL)/date.h $(INCL)/trap.h $(INCL)/onames.h \
$(INCL)/pm.h monstr.c vis_tab.c $(TILEUTIL) $(INCL)/pm.h vis_tab.c $(TILEUTIL)
$(subst /,\,echo utilities made > $@) $(subst /,\,echo utilities made > $@)
tileutil: $(U)gif2txt.exe $(U)txt2ppm.exe tileutil: $(U)gif2txt.exe $(U)txt2ppm.exe
@@ -620,6 +624,7 @@ endif
-@$(subst /,\,touch $(GAMEDIR)/record) -@$(subst /,\,touch $(GAMEDIR)/record)
@$(subst /,\,copy $(DOC)/guideb*.txt $(GAMEDIR)) @$(subst /,\,copy $(DOC)/guideb*.txt $(GAMEDIR))
@$(subst /,\,copy ../sys/winnt/sysconf $(GAMEDIR)) @$(subst /,\,copy ../sys/winnt/sysconf $(GAMEDIR))
@$(subst /,\,if not exist $(GAMEDIR)/sysconf touch $(GAMEDIR)/sysconf)
@$(subst /,\,if exist $(DOC)/nethack.txt copy $(DOC)/nethack.txt $(GAMEDIR)) @$(subst /,\,if exist $(DOC)/nethack.txt copy $(DOC)/nethack.txt $(GAMEDIR))
ifdef CWSDPMI ifdef CWSDPMI
@$(subst /,\,if exist $(CWSDPMI) copy $(CWSDPMI) $(GAMEDIR)) @$(subst /,\,if exist $(CWSDPMI) copy $(CWSDPMI) $(GAMEDIR))
@@ -633,86 +638,50 @@ endif
#========================================== #==========================================
$(GAMEFILE): $(O)obj.tag $(PATCHLEV_H) $(PDCLIB) $(LUATARGETS) \ $(GAMEFILE): $(O)obj.tag $(PATCHLEV_H) $(PDCLIB) $(LUATARGETS) \
$(O)utility.tag $(ALLOBJ) $(O)$(GAME).lnk $(O)utility.tag $(ALLOBJ)
@if exist temp.a del temp.a @if exist temp.a del temp.a
@ar ru temp.a $(VOBJ01) @ar ruS temp.a $(VOBJ01)
@ar ru temp.a $(VOBJ02) @ar ruS temp.a $(VOBJ02)
@ar ru temp.a $(VOBJ03) @ar ruS temp.a $(VOBJ03)
@ar ru temp.a $(VOBJ04) @ar ruS temp.a $(VOBJ04)
@ar ru temp.a $(VOBJ05) @ar ruS temp.a $(VOBJ05)
@ar ru temp.a $(VOBJ06) @ar ruS temp.a $(VOBJ06)
@ar ru temp.a $(VOBJ07) @ar ruS temp.a $(VOBJ07)
@ar ru temp.a $(VOBJ08) @ar ruS temp.a $(VOBJ08)
@ar ru temp.a $(VOBJ09) @ar ruS temp.a $(VOBJ09)
@ar ru temp.a $(VOBJ10) @ar ruS temp.a $(VOBJ10)
@ar ru temp.a $(VOBJ11) @ar ruS temp.a $(VOBJ11)
@ar ru temp.a $(VOBJ12) @ar ruS temp.a $(VOBJ12)
@ar ru temp.a $(VOBJ13) @ar ruS temp.a $(VOBJ13)
@ar ru temp.a $(VOBJ14) @ar ruS temp.a $(VOBJ14)
@ar ru temp.a $(VOBJ15) @ar ruS temp.a $(VOBJ15)
@ar ru temp.a $(VOBJ16) @ar ruS temp.a $(VOBJ16)
@ar ru temp.a $(VOBJ17) @ar ruS temp.a $(VOBJ17)
@ar ru temp.a $(VOBJ18) @ar ruS temp.a $(VOBJ18)
@ar ru temp.a $(VOBJ19) @ar ruS temp.a $(VOBJ19)
@ar ru temp.a $(VOBJ20) @ar ruS temp.a $(VOBJ20)
@ar ru temp.a $(VOBJ21) @ar ruS temp.a $(VOBJ21)
@ar ru temp.a $(VOBJ22) @ar ruS temp.a $(VOBJ22)
@ar ru temp.a $(VOBJ23) @ar ruS temp.a $(VOBJ23)
@ar ru temp.a $(VOBJ24) @ar ruS temp.a $(VOBJ24)
@ar ru temp.a $(VOBJ25) @ar ruS temp.a $(VOBJ25)
@ar ru temp.a $(SOBJ) @ar ruS temp.a $(SOBJ)
@ar ru temp.a $(TILOBJ) @ar ruS temp.a $(TILOBJ)
@ar ru temp.a $(TILOBJ2) @ar ruS temp.a $(TILOBJ2)
@ar ru temp.a $(VVOBJ) @ar ruS temp.a $(VVOBJ)
ifeq "$(ADD_LUA)" "Y" ifeq "$(ADD_LUA)" "Y"
@ar ru temp.a $(LUAOBJ) @ar ruS temp.a $(LUAOBJ)
endif endif
ifeq "$(ADD_CURSES)" "Y" ifeq "$(ADD_CURSES)" "Y"
@ar ru temp.a $(CURSESOBJ) @ar ruS temp.a $(CURSESOBJ)
endif endif
@ranlib temp.a
$(LINK) $(LFLAGS) -o$(GAME).exe temp.a \ $(LINK) $(LFLAGS) -o$(GAME).exe temp.a \
$(PDCLIB) $(LUALIB) $(LIBRARIES) $(ZLIB) $(PDCLIB) $(LUALIB) $(LIBRARIES) $(ZLIB)
@$(subst /,\,stubedit $(GAME).exe minstack=2048K) @$(subst /,\,stubedit $(GAME).exe minstack=2048K)
@$(subst /,\,copy $(GAME).exe $(GAMEFILE)) @$(subst /,\,copy $(GAME).exe $(GAMEFILE))
@$(subst /,\,del $(GAME).exe) @$(subst /,\,del $(GAME).exe)
$(O)$(GAME).lnk: $(ALLOBJ)
echo $(VOBJ01) > $(subst /,\,$@)
echo $(VOBJ02) >> $(subst /,\,$@)
echo $(VOBJ03) >> $(subst /,\,$@)
echo $(VOBJ04) >> $(subst /,\,$@)
echo $(VOBJ05) >> $(subst /,\,$@)
echo $(VOBJ06) >> $(subst /,\,$@)
echo $(VOBJ07) >> $(subst /,\,$@)
echo $(VOBJ08) >> $(subst /,\,$@)
echo $(VOBJ09) >> $(subst /,\,$@)
echo $(VOBJ10) >> $(subst /,\,$@)
echo $(VOBJ11) >> $(subst /,\,$@)
echo $(VOBJ12) >> $(subst /,\,$@)
echo $(VOBJ13) >> $(subst /,\,$@)
echo $(VOBJ14) >> $(subst /,\,$@)
echo $(VOBJ15) >> $(subst /,\,$@)
echo $(VOBJ16) >> $(subst /,\,$@)
echo $(VOBJ17) >> $(subst /,\,$@)
echo $(VOBJ18) >> $(subst /,\,$@)
echo $(VOBJ19) >> $(subst /,\,$@)
echo $(VOBJ20) >> $(subst /,\,$@)
echo $(VOBJ21) >> $(subst /,\,$@)
echo $(VOBJ22) >> $(subst /,\,$@)
echo $(VOBJ23) >> $(subst /,\,$@)
echo $(VOBJ24) >> $(subst /,\,$@)
echo $(VOBJ25) >> $(subst /,\,$@)
echo $(SOBJ) >> $(subst /,\,$@)
echo $(TILOBJ) >> $(subst /,\,$@)
echo $(TILOBJ2) >> $(subst /,\,$@)
echo $(VVOBJ) >> $(subst /,\,$@)
ifeq "$(ADD_LUA)" "Y"
echo $(LUAOBJ) >> $(subst /,\,$@)
endif
ifeq "$(ADD_CURSES)" "Y"
echo $(CURSESOBJ) >> $(subst /,\,$@)
endif
#========================================== #==========================================
#=========== SECONDARY TARGETS ============ #=========== SECONDARY TARGETS ============
#========================================== #==========================================
@@ -732,9 +701,6 @@ $(INCL)/onames.h: $(U)makedefs.exe
$(INCL)/pm.h: $(U)makedefs.exe $(INCL)/pm.h: $(U)makedefs.exe
-$(subst /,\,$(U)makedefs -p) -$(subst /,\,$(U)makedefs -p)
monstr.c: $(U)makedefs.exe
-$(subst /,\,$(U)makedefs -m)
$(INCL)/vis_tab.h: $(U)makedefs.exe $(INCL)/vis_tab.h: $(U)makedefs.exe
-$(subst /,\,$(U)makedefs -z) -$(subst /,\,$(U)makedefs -z)
@@ -1030,11 +996,14 @@ $(O)sp_lev.tag: $(O)utility.tag
#note that dir below assumes bin/dir.exe from djgpp distribution #note that dir below assumes bin/dir.exe from djgpp distribution
# #
ifndef LUA_QTEXT_FILE
QUEST_DAT = $(DAT)/quest.dat
else
QUEST_DAT =
endif
$(DAT)/nhdat: $(U)dlb_main.exe $(DAT)/data $(DAT)/rumors \ $(DAT)/nhdat: $(U)dlb_main.exe $(DAT)/data $(DAT)/rumors \
$(DAT)/oracles \ $(DAT)/oracles \
ifndef LUA_QTEXT_FILE $(QUEST_DAT) \
$(DAT)/quest.dat \
endif
$(O)sp_lev.tag \ $(O)sp_lev.tag \
$(DAT)/bogusmon $(DAT)/engrave $(DAT)/epitaph $(DAT)/tribute $(DAT)/bogusmon $(DAT)/engrave $(DAT)/epitaph $(DAT)/tribute
@$(subst /,\,echo dat done >$(O)dat.tag) @$(subst /,\,echo dat done >$(O)dat.tag)
@@ -1135,7 +1104,9 @@ $(O)lua535.a: $(LUAOBJFILES)
-Wl,--add-stdcall-alias -o $@ $< -Wl,--add-stdcall-alias -o $@ $<
$(O)lua535s.a: $(LUAOBJFILES) $(O)lua535s.a: $(LUAOBJFILES)
ar rcs $@ $(LUAOBJFILES) ar rcS $@ $(LUAOBJFILES1)
ar rcS $@ $(LUAOBJFILES2)
ar rcs $@ $(LUAOBJFILES3)
$(O)lua.o: $(LUASRC)/lua.c $(O)lua.o: $(LUASRC)/lua.c
$(O)luac.o: $(LUASRC)/luac.c $(O)luac.o: $(LUASRC)/luac.c
@@ -1169,7 +1140,6 @@ spotless: clean
$(subst /,\,if exist $(INCL)/onames.h del $(INCL)/onames.h) $(subst /,\,if exist $(INCL)/onames.h del $(INCL)/onames.h)
$(subst /,\,if exist $(INCL)/pm.h del $(INCL)/pm.h) $(subst /,\,if exist $(INCL)/pm.h del $(INCL)/pm.h)
$(subst /,\,if exist $(INCL)/date.h del $(INCL)/date.h) $(subst /,\,if exist $(INCL)/date.h del $(INCL)/date.h)
$(subst /,\,if exist $(SRC)/monstr.c del $(SRC)/monstr.c)
$(subst /,\,if exist $(SRC)/vis_tab.c del $(SRC)/vis_tab.c) $(subst /,\,if exist $(SRC)/vis_tab.c del $(SRC)/vis_tab.c)
$(subst /,\,if exist $(SRC)/tile.c del $(SRC)/tile.c) $(subst /,\,if exist $(SRC)/tile.c del $(SRC)/tile.c)
$(subst /,\,if exist $(DAT)/options del $(DAT)/options) $(subst /,\,if exist $(DAT)/options del $(DAT)/options)
+6
View File
@@ -0,0 +1,6 @@
/* nhlua.h - generated by top Makefile */
#include "../lib/lua535/src/lua.h"
LUA_API int (lua_error) (lua_State *L) NORETURN;
#include "../lib/lua535/src/lualib.h"
#include "../lib/lua535/src/lauxlib.h"
/*nhlua.h*/
+2 -32
View File
@@ -1,5 +1,5 @@
# Makefile for NetHack's utility programs. # Makefile for NetHack's utility programs.
# NetHack 3.6 Makefile.utl $NHDT-Date: 1574646950 2019/11/25 01:55:50 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.44 $ # NetHack 3.6 Makefile.utl $NHDT-Date: 1576976264 2019/12/22 00:57:44 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.49 $
# Copyright (c) 2018 by Robert Patrick Rankin # Copyright (c) 2018 by Robert Patrick Rankin
# NetHack may be freely redistributed. See license for details. # NetHack may be freely redistributed. See license for details.
@@ -84,7 +84,6 @@ NHSROOT=..
# LFLAGS = -b i486-linuxaout -L/usr/X11R6/lib # LFLAGS = -b i486-linuxaout -L/usr/X11R6/lib
# flags for BeOS using the command line # flags for BeOS using the command line
# remember to uncomment flex and bison below
# BeOS on a Mac/BeBox: # BeOS on a Mac/BeBox:
#CC = mwcc #CC = mwcc
#CFLAGS = -I../include #CFLAGS = -I../include
@@ -97,7 +96,7 @@ NHSROOT=..
#CFLAGS = -O -I../include #CFLAGS = -O -I../include
#LFLAGS = #LFLAGS =
CFLAGS += -I../lib/lua-$(LUA_VERSION)/src # -lm required by lua
LFLAGS += -lm LFLAGS += -lm
# we specify C preprocessor flags via CFLAGS; files built with default rules # we specify C preprocessor flags via CFLAGS; files built with default rules
@@ -112,23 +111,6 @@ LIBS =
# otherwise, you can save a little bit of disk space with this: # otherwise, you can save a little bit of disk space with this:
OBJDIR = ../src OBJDIR = ../src
# yacc/lex programs to use to generate *_comp.h, *_lex.c, and *_yacc.c.
# if, instead of yacc/lex you have bison/flex, comment/uncomment the following.
YACC = yacc
LEX = lex
# YACC = bison -y
# YACC = byacc
# LEX = flex
# these are the names of the output files from YACC/LEX. Under MS-DOS
# and similar systems, they may differ
YTABC = y.tab.c
YTABH = y.tab.h
LEXYYC = lex.yy.c
# YTABC = y_tab.c
# YTABH = y_tab.h
# LEXYYC = lexyy.c
# if you change this to 1, feedback while building will omit -Dthis -Wthat # if you change this to 1, feedback while building will omit -Dthis -Wthat
# -Isomewhere so that each file being compiled is listed on one short line; # -Isomewhere so that each file being compiled is listed on one short line;
# it requires support for '$<' in rules with more than one prerequisite # it requires support for '$<' in rules with more than one prerequisite
@@ -204,18 +186,6 @@ RECOVOBJS = recover.o
# object files for the data librarian # object files for the data librarian
DLBOBJS = dlb_main.o $(OBJDIR)/dlb.o $(OALLOC) DLBOBJS = dlb_main.o $(OBJDIR)/dlb.o $(OALLOC)
# flags for creating distribution versions of sys/share/*_lex.c, using
# a more portable flex skeleton, which is not included in the distribution.
# hopefully keeping this out of the section to be edited will keep too
# many people from being confused by it...
# FLEXDIST = -L -S../sys/share/flexhack.skl
FLEXDIST =
#
# flags for creating distribution versions of sys/share/*_yacc.c, without
# line numbers so patches from version to version are practical
# YACCDIST = -l
YACCDIST =
# dependencies for makedefs # dependencies for makedefs
# #
+1 -1
View File
@@ -46,7 +46,7 @@ typedef struct mswin_nhmsg_add_menu {
CHAR_P group_accel; CHAR_P group_accel;
int attr; int attr;
const char *str; const char *str;
BOOLEAN_P presel; unsigned int itemflags;
} MSNHMsgAddMenu, *PMSNHMsgAddMenu; } MSNHMsgAddMenu, *PMSNHMsgAddMenu;
typedef struct mswin_nhmsg_cursor { typedef struct mswin_nhmsg_cursor {
+18 -16
View File
@@ -390,7 +390,7 @@ prompt_for_player_selection(void)
Strcpy(rolenamebuf, roles[i].name.m); Strcpy(rolenamebuf, roles[i].name.m);
} }
add_menu(win, NO_GLYPH, &any, thisch, 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, thisch, 0, ATR_NONE,
an(rolenamebuf), MENU_UNSELECTED); an(rolenamebuf), MENU_ITEMFLAGS_NONE);
lastch = thisch; lastch = thisch;
} }
} }
@@ -399,10 +399,10 @@ prompt_for_player_selection(void)
if (any.a_int == 0) /* must be non-zero */ if (any.a_int == 0) /* must be non-zero */
any.a_int = randrole(FALSE) + 1; any.a_int = randrole(FALSE) + 1;
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
any.a_int = i + 1; /* must be non-zero */ any.a_int = i + 1; /* must be non-zero */
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
Sprintf(pbuf, "Pick a role for your %s", plbuf); Sprintf(pbuf, "Pick a role for your %s", plbuf);
end_menu(win, pbuf); end_menu(win, pbuf);
n = select_menu(win, PICK_ONE, &selected); n = select_menu(win, PICK_ONE, &selected);
@@ -465,17 +465,17 @@ prompt_for_player_selection(void)
flags.initalign)) { flags.initalign)) {
any.a_int = i + 1; /* must be non-zero */ any.a_int = i + 1; /* must be non-zero */
add_menu(win, NO_GLYPH, &any, races[i].noun[0], 0, add_menu(win, NO_GLYPH, &any, races[i].noun[0], 0,
ATR_NONE, races[i].noun, MENU_UNSELECTED); ATR_NONE, races[i].noun, MENU_ITEMFLAGS_NONE);
} }
any.a_int = pick_race(flags.initrole, flags.initgend, any.a_int = pick_race(flags.initrole, flags.initgend,
flags.initalign, PICK_RANDOM) + 1; flags.initalign, PICK_RANDOM) + 1;
if (any.a_int == 0) /* must be non-zero */ if (any.a_int == 0) /* must be non-zero */
any.a_int = randrace(flags.initrole) + 1; any.a_int = randrace(flags.initrole) + 1;
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
any.a_int = i + 1; /* must be non-zero */ any.a_int = i + 1; /* must be non-zero */
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
Sprintf(pbuf, "Pick the race of your %s", plbuf); Sprintf(pbuf, "Pick the race of your %s", plbuf);
end_menu(win, pbuf); end_menu(win, pbuf);
n = select_menu(win, PICK_ONE, &selected); n = select_menu(win, PICK_ONE, &selected);
@@ -539,17 +539,17 @@ prompt_for_player_selection(void)
flags.initalign)) { flags.initalign)) {
any.a_int = i + 1; any.a_int = i + 1;
add_menu(win, NO_GLYPH, &any, genders[i].adj[0], 0, add_menu(win, NO_GLYPH, &any, genders[i].adj[0], 0,
ATR_NONE, genders[i].adj, MENU_UNSELECTED); ATR_NONE, genders[i].adj, MENU_ITEMFLAGS_NONE);
} }
any.a_int = pick_gend(flags.initrole, flags.initrace, any.a_int = pick_gend(flags.initrole, flags.initrace,
flags.initalign, PICK_RANDOM) + 1; flags.initalign, PICK_RANDOM) + 1;
if (any.a_int == 0) /* must be non-zero */ if (any.a_int == 0) /* must be non-zero */
any.a_int = randgend(flags.initrole, flags.initrace) + 1; any.a_int = randgend(flags.initrole, flags.initrace) + 1;
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
any.a_int = i + 1; /* must be non-zero */ any.a_int = i + 1; /* must be non-zero */
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
Sprintf(pbuf, "Pick the gender of your %s", plbuf); Sprintf(pbuf, "Pick the gender of your %s", plbuf);
end_menu(win, pbuf); end_menu(win, pbuf);
n = select_menu(win, PICK_ONE, &selected); n = select_menu(win, PICK_ONE, &selected);
@@ -612,17 +612,17 @@ prompt_for_player_selection(void)
flags.initgend, i)) { flags.initgend, i)) {
any.a_int = i + 1; any.a_int = i + 1;
add_menu(win, NO_GLYPH, &any, aligns[i].adj[0], 0, add_menu(win, NO_GLYPH, &any, aligns[i].adj[0], 0,
ATR_NONE, aligns[i].adj, MENU_UNSELECTED); ATR_NONE, aligns[i].adj, MENU_ITEMFLAGS_NONE);
} }
any.a_int = pick_align(flags.initrole, flags.initrace, any.a_int = pick_align(flags.initrole, flags.initrace,
flags.initgend, PICK_RANDOM) + 1; flags.initgend, PICK_RANDOM) + 1;
if (any.a_int == 0) /* must be non-zero */ if (any.a_int == 0) /* must be non-zero */
any.a_int = randalign(flags.initrole, flags.initrace) + 1; any.a_int = randalign(flags.initrole, flags.initrace) + 1;
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
any.a_int = i + 1; /* must be non-zero */ any.a_int = i + 1; /* must be non-zero */
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
Sprintf(pbuf, "Pick the alignment of your %s", plbuf); Sprintf(pbuf, "Pick the alignment of your %s", plbuf);
end_menu(win, pbuf); end_menu(win, pbuf);
n = select_menu(win, PICK_ONE, &selected); n = select_menu(win, PICK_ONE, &selected);
@@ -1026,7 +1026,7 @@ mswin_start_menu(winid wid)
/* /*
add_menu(windid window, int glyph, const anything identifier, add_menu(windid window, int glyph, const anything identifier,
char accelerator, char groupacc, char accelerator, char groupacc,
int attr, char *str, boolean preselected) int attr, char *str, unsigned int itemflags)
-- Add a text line str to the given menu window. If -- Add a text line str to the given menu window. If
identifier identifier
is 0, then the line cannot be selected (e.g. a title). is 0, then the line cannot be selected (e.g. a title).
@@ -1058,11 +1058,13 @@ identifier
void void
mswin_add_menu(winid wid, int glyph, const ANY_P *identifier, mswin_add_menu(winid wid, int glyph, const ANY_P *identifier,
CHAR_P accelerator, CHAR_P group_accel, int attr, CHAR_P accelerator, CHAR_P group_accel, int attr,
const char *str, BOOLEAN_P presel) const char *str, unsigned int itemflags)
{ {
logDebug("mswin_add_menu(%d, %d, %p, %c, %c, %d, %s, %d)\n", wid, glyph, boolean presel = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0);
logDebug("mswin_add_menu(%d, %d, %p, %c, %c, %d, %s, %u)\n", wid, glyph,
identifier, (char) accelerator, (char) group_accel, attr, str, identifier, (char) accelerator, (char) group_accel, attr, str,
presel); itemflags);
if ((wid >= 0) && (wid < MAXWINDOWS) if ((wid >= 0) && (wid < MAXWINDOWS)
&& (GetNHApp()->windowlist[wid].win != NULL)) { && (GetNHApp()->windowlist[wid].win != NULL)) {
MSNHMsgAddMenu data; MSNHMsgAddMenu data;
+1 -1
View File
@@ -131,7 +131,7 @@ void mswin_display_file(const char *filename, BOOLEAN_P must_exist);
void mswin_start_menu(winid wid); void mswin_start_menu(winid wid);
void mswin_add_menu(winid wid, int glyph, const ANY_P *identifier, void mswin_add_menu(winid wid, int glyph, const ANY_P *identifier,
CHAR_P accelerator, CHAR_P group_accel, int attr, CHAR_P accelerator, CHAR_P group_accel, int attr,
const char *str, BOOLEAN_P presel); const char *str, unsigned int itemflags);
void mswin_end_menu(winid wid, const char *prompt); void mswin_end_menu(winid wid, const char *prompt);
int mswin_select_menu(winid wid, int how, MENU_ITEM_P **selected); int mswin_select_menu(winid wid, int how, MENU_ITEM_P **selected);
void mswin_update_inventory(void); void mswin_update_inventory(void);
+12 -14
View File
@@ -270,9 +270,7 @@ U = $(UTIL)/
# Utility Objects. # Utility Objects.
# #
MAKESRC = $(U)makedefs.c MAKEDEFSOBJS = $(O)makedefs.o $(O)monst.o $(O)objects.o
MAKEOBJS = $(O)makedefs.o $(O)monst.o $(O)objects.o
RECOVOBJS = $(O)recover.o RECOVOBJS = $(O)recover.o
@@ -304,8 +302,8 @@ VOBJ05 = $(O)do_wear.o $(O)dog.o $(O)dogmove.o $(O)dokick.o
VOBJ06 = $(O)dothrow.o $(O)drawing.o $(O)dungeon.o $(O)eat.o VOBJ06 = $(O)dothrow.o $(O)drawing.o $(O)dungeon.o $(O)eat.o
VOBJ07 = $(O)end.o $(O)engrave.o $(O)exper.o $(O)explode.o VOBJ07 = $(O)end.o $(O)engrave.o $(O)exper.o $(O)explode.o
VOBJ08 = $(O)extralev.o $(O)files.o $(O)fountain.o $(O)hack.o VOBJ08 = $(O)extralev.o $(O)files.o $(O)fountain.o $(O)hack.o
VOBJ09 = $(O)hacklib.o $(O)invent.o $(O)light.o $(O)lock.o VOBJ09 = $(O)hacklib.o $(O)invent.o $(O)light.o $(O)lock.o
VOBJ10 = $(O)mail.o $(O)makemon.o $(O)mapglyph.o $(O)isaac64.o VOBJ10 = $(O)mail.o $(O)makemon.o $(O)mapglyph.o $(O)mdlib.o $(O)isaac64.o
VOBJ11 = $(O)mcastu.o $(O)mhitm.o $(O)mhitu.o $(O)minion.o VOBJ11 = $(O)mcastu.o $(O)mhitm.o $(O)mhitu.o $(O)minion.o
VOBJ12 = $(O)mklev.o $(O)mkmap.o $(O)mkmaze.o $(O)mkobj.o VOBJ12 = $(O)mklev.o $(O)mkmap.o $(O)mkmaze.o $(O)mkobj.o
VOBJ13 = $(O)mkroom.o $(O)mon.o $(O)mondata.o $(O)monmove.o VOBJ13 = $(O)mkroom.o $(O)mon.o $(O)mondata.o $(O)monmove.o
@@ -791,12 +789,12 @@ $(O)utility.tag: $(INCL)/date.h $(INCL)/onames.h $(INCL)/pm.h \
@echo utilities made. @echo utilities made.
$(INCL)/nhlua.h: $(INCL)/nhlua.h:
echo '/* nhlua.h - generated by top Makefile */' > $@ echo /* nhlua.h - generated by top Makefile */ > $@
@echo '#include "../lib/lua-$(LUA_VERSION)/src/lua.h"' >> $@ @echo #include "../lib/lua-$(LUA_VERSION)/src/lua.h" >> $@
@echo 'LUA_API int (lua_error) (lua_State *L) NORETURN;' >>$@ @echo LUA_API int (lua_error) (lua_State *L) NORETURN; >>$@
@echo '#include "../lib/lua-$(LUA_VERSION)/src/lualib.h"' >> $@ @echo #include "../lib/lua-$(LUA_VERSION)/src/lualib.h" >> $@
@echo '#include "../lib/lua-$(LUA_VERSION)/src/lauxlib.h"' >> $@ @echo #include "../lib/lua-$(LUA_VERSION)/src/lauxlib.h" >> $@
@echo '/*nhlua.h*/' >> $@ @echo /*nhlua.h*/ >> $@
tileutil: $(U)gif2txt.exe $(U)gif2tx32.exe $(U)txt2ppm.exe tileutil: $(U)gif2txt.exe $(U)gif2tx32.exe $(U)txt2ppm.exe
@echo Optional tile development utilities are up to date. @echo Optional tile development utilities are up to date.
@@ -894,12 +892,12 @@ objdir.tag:
# Makedefs Stuff # Makedefs Stuff
#========================================== #==========================================
$(U)makedefs.exe: $(MAKEOBJS) $(U)makedefs.exe: $(MAKEDEFSOBJS)
$(link) $(LFLAGSU) -o$@ $(MAKEOBJS) $(link) $(LFLAGSU) -o$@ $(MAKEDEFSOBJS)
$(O)makedefs.o: $(CONFIG_H) $(INCL)/monattk.h $(INCL)/monflag.h \ $(O)makedefs.o: $(CONFIG_H) $(INCL)/monattk.h $(INCL)/monflag.h \
$(INCL)/objclass.h $(INCL)/monsym.h \ $(INCL)/objclass.h $(INCL)/monsym.h \
$(INCL)/patchlevel.h $(U)makedefs.c $(INCL)/patchlevel.h $(U)makedefs.c $(SRC)\mdlib.c
$(cc) $(CFLAGSU) -o$@ $(U)makedefs.c $(cc) $(CFLAGSU) -o$@ $(U)makedefs.c
# #
+8
View File
@@ -0,0 +1,8 @@
set -x
mkdir -p lib
cd lib
git clone --depth 1 https://github.com/wmcbrine/PDCurses.git pdcurses
git clone --depth 1 https://github.com/universal-ctags/ctags.git ctags
curl -R -O http://www.lua.org/ftp/lua-5.3.5.tar.gz
tar zxf lua-5.3.5.tar.gz
cd ../
+2 -2
View File
@@ -376,12 +376,12 @@ void NetHackQtBind::qt_start_menu(winid wid)
void NetHackQtBind::qt_add_menu(winid wid, int glyph, void NetHackQtBind::qt_add_menu(winid wid, int glyph,
const ANY_P * identifier, CHAR_P ch, CHAR_P gch, int attr, const ANY_P * identifier, CHAR_P ch, CHAR_P gch, int attr,
const char *str, BOOLEAN_P presel) const char *str, unsigned itemflags)
{ {
NetHackQtWindow* window=id_to_window[(int)wid]; NetHackQtWindow* window=id_to_window[(int)wid];
window->AddMenu(glyph, identifier, ch, gch, attr, window->AddMenu(glyph, identifier, ch, gch, attr,
QString::fromLatin1(str), QString::fromLatin1(str),
presel); itemflags);
} }
void NetHackQtBind::qt_end_menu(winid wid, const char *prompt) void NetHackQtBind::qt_end_menu(winid wid, const char *prompt)
+1 -1
View File
@@ -54,7 +54,7 @@ public:
static void qt_start_menu(winid wid); static void qt_start_menu(winid wid);
static void qt_add_menu(winid wid, int glyph, static void qt_add_menu(winid wid, int glyph,
const ANY_P * identifier, CHAR_P ch, CHAR_P gch, int attr, const ANY_P * identifier, CHAR_P ch, CHAR_P gch, int attr,
const char *str, BOOLEAN_P presel); const char *str, unsigned int itemflags);
static void qt_end_menu(winid wid, const char *prompt); static void qt_end_menu(winid wid, const char *prompt);
static int qt_select_menu(winid wid, int how, MENU_ITEM_P **menu_list); static int qt_select_menu(winid wid, int how, MENU_ITEM_P **menu_list);
static void qt_update_inventory(); static void qt_update_inventory();
+9 -3
View File
@@ -160,8 +160,9 @@ NetHackQtMenuWindow::MenuItem::~MenuItem()
} }
void NetHackQtMenuWindow::AddMenu(int glyph, const ANY_P* identifier, void NetHackQtMenuWindow::AddMenu(int glyph, const ANY_P* identifier,
char ch, char gch, int attr, const QString& str, bool presel) char ch, char gch, int attr, const QString& str, unsigned itemflags)
{ {
bool presel = (itemflags & MENU_ITEMFLAGS_SELECTED) != 0;
if (!ch && identifier->a_void!=0) { if (!ch && identifier->a_void!=0) {
// Supply a keyboard accelerator. Limited supply. // Supply a keyboard accelerator. Limited supply.
static char accel[]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; static char accel[]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
@@ -180,6 +181,7 @@ void NetHackQtMenuWindow::AddMenu(int glyph, const ANY_P* identifier,
itemlist[itemcount].attr=attr; itemlist[itemcount].attr=attr;
itemlist[itemcount].str=str; itemlist[itemcount].str=str;
itemlist[itemcount].selected=presel; itemlist[itemcount].selected=presel;
itemlist[itemcount].itemflags=itemflags;
itemlist[itemcount].count=-1; itemlist[itemcount].count=-1;
itemlist[itemcount].color = -1; itemlist[itemcount].color = -1;
// Display the boulder symbol correctly // Display the boulder symbol correctly
@@ -532,6 +534,10 @@ void NetHackQtMenuWindow::Invert()
return; return;
for (int i=0; i<itemcount; i++) { for (int i=0; i<itemcount; i++) {
if (!menuitem_invert_test(0, itemlist[i].itemflags,
itemlist[i].selected))
continue;
QTableWidgetItem *count = table->item(i, 0); QTableWidgetItem *count = table->item(i, 0);
if (count != NULL) count->setText(""); if (count != NULL) count->setText("");
@@ -811,10 +817,10 @@ void NetHackQtMenuOrTextWindow::StartMenu()
actual->StartMenu(); actual->StartMenu();
} }
void NetHackQtMenuOrTextWindow::AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr, void NetHackQtMenuOrTextWindow::AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr,
const QString& str, bool presel) const QString& str, unsigned itemflags)
{ {
if (!actual) impossible("AddMenu called before we know if Menu or Text"); if (!actual) impossible("AddMenu called before we know if Menu or Text");
actual->AddMenu(glyph,identifier,ch,gch,attr,str,presel); actual->AddMenu(glyph,identifier,ch,gch,attr,str,itemflags);
} }
void NetHackQtMenuOrTextWindow::EndMenu(const QString& prompt) void NetHackQtMenuOrTextWindow::EndMenu(const QString& prompt)
{ {
+3 -2
View File
@@ -55,7 +55,7 @@ public:
virtual void StartMenu(); virtual void StartMenu();
virtual void AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr, virtual void AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr,
const QString& str, bool presel); const QString& str, unsigned itemflags);
virtual void EndMenu(const QString& prompt); virtual void EndMenu(const QString& prompt);
virtual int SelectMenu(int how, MENU_ITEM_P **menu_list); virtual int SelectMenu(int how, MENU_ITEM_P **menu_list);
@@ -85,6 +85,7 @@ private:
char ch; char ch;
char gch; char gch;
bool selected; bool selected;
unsigned itemflags;
unsigned color; unsigned color;
bool Selectable() const { return identifier.a_void!=0; } bool Selectable() const { return identifier.a_void!=0; }
@@ -172,7 +173,7 @@ public:
// Menu // Menu
virtual void StartMenu(); virtual void StartMenu();
virtual void AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr, virtual void AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr,
const QString& str, bool presel); const QString& str, unsigned itemflags);
virtual void EndMenu(const QString& prompt); virtual void EndMenu(const QString& prompt);
virtual int SelectMenu(int how, MENU_ITEM_P **menu_list); virtual int SelectMenu(int how, MENU_ITEM_P **menu_list);
+1 -1
View File
@@ -125,7 +125,7 @@ void NetHackQtWindow::CursorTo(int x,int y) { puts("unexpected CursorTo"); }
void NetHackQtWindow::PutStr(int attr, const QString& text) { puts("unexpected PutStr"); } void NetHackQtWindow::PutStr(int attr, const QString& text) { puts("unexpected PutStr"); }
void NetHackQtWindow::StartMenu() { puts("unexpected StartMenu"); } void NetHackQtWindow::StartMenu() { puts("unexpected StartMenu"); }
void NetHackQtWindow::AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr, void NetHackQtWindow::AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr,
const QString& str, bool presel) { puts("unexpected AddMenu"); } const QString& str, unsigned itemflags) { puts("unexpected AddMenu"); }
void NetHackQtWindow::EndMenu(const QString& prompt) { puts("unexpected EndMenu"); } void NetHackQtWindow::EndMenu(const QString& prompt) { puts("unexpected EndMenu"); }
int NetHackQtWindow::SelectMenu(int how, MENU_ITEM_P **menu_list) { puts("unexpected SelectMenu"); return 0; } int NetHackQtWindow::SelectMenu(int how, MENU_ITEM_P **menu_list) { puts("unexpected SelectMenu"); return 0; }
void NetHackQtWindow::ClipAround(int x,int y) { puts("unexpected ClipAround"); } void NetHackQtWindow::ClipAround(int x,int y) { puts("unexpected ClipAround"); }
+1 -1
View File
@@ -34,7 +34,7 @@ public:
} }
virtual void StartMenu(); virtual void StartMenu();
virtual void AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr, virtual void AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr,
const QString& str, bool presel); const QString& str, unsigned itemflags);
virtual void EndMenu(const QString& prompt); virtual void EndMenu(const QString& prompt);
virtual int SelectMenu(int how, MENU_ITEM_P **menu_list); virtual int SelectMenu(int how, MENU_ITEM_P **menu_list);
virtual void ClipAround(int x,int y); virtual void ClipAround(int x,int y);
+6 -3
View File
@@ -1447,7 +1447,7 @@ void NetHackQtWindow::CursorTo(int x,int y) { puts("unexpected CursorTo"); }
void NetHackQtWindow::PutStr(int attr, const char* text) { puts("unexpected PutStr"); } void NetHackQtWindow::PutStr(int attr, const char* text) { puts("unexpected PutStr"); }
void NetHackQtWindow::StartMenu() { puts("unexpected StartMenu"); } void NetHackQtWindow::StartMenu() { puts("unexpected StartMenu"); }
void NetHackQtWindow::AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr, void NetHackQtWindow::AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr,
const char* str, bool presel) { puts("unexpected AddMenu"); } const char* str, unsigned itemflags) { puts("unexpected AddMenu"); }
void NetHackQtWindow::EndMenu(const char* prompt) { puts("unexpected EndMenu"); } void NetHackQtWindow::EndMenu(const char* prompt) { puts("unexpected EndMenu"); }
int NetHackQtWindow::SelectMenu(int how, MENU_ITEM_P **menu_list) { puts("unexpected SelectMenu"); return 0; } int NetHackQtWindow::SelectMenu(int how, MENU_ITEM_P **menu_list) { puts("unexpected SelectMenu"); return 0; }
void NetHackQtWindow::ClipAround(int x,int y) { puts("unexpected ClipAround"); } void NetHackQtWindow::ClipAround(int x,int y) { puts("unexpected ClipAround"); }
@@ -2788,8 +2788,9 @@ NetHackQtMenuWindow::MenuItem::~MenuItem()
#define STR_MARGIN 4 #define STR_MARGIN 4
void NetHackQtMenuWindow::AddMenu(int glyph, const ANY_P* identifier, void NetHackQtMenuWindow::AddMenu(int glyph, const ANY_P* identifier,
char ch, char gch, int attr, const char* str, bool presel) char ch, char gch, int attr, const char* str, unsigned itemflags)
{ {
bool presel = (itemflags & MENU_ITEMFLAGS_SELECTED) != 0;
if (!ch && identifier->a_void!=0) { if (!ch && identifier->a_void!=0) {
// Supply a keyboard accelerator. Limited supply. // Supply a keyboard accelerator. Limited supply.
static char accel[]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; static char accel[]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
@@ -2807,6 +2808,7 @@ void NetHackQtMenuWindow::AddMenu(int glyph, const ANY_P* identifier,
item[itemcount].attr=attr; item[itemcount].attr=attr;
item[itemcount].str=strdup(str); item[itemcount].str=strdup(str);
item[itemcount].selected=presel; item[itemcount].selected=presel;
item[itemcount].itemflags=itemflags;
item[itemcount].count=-1; item[itemcount].count=-1;
++itemcount; ++itemcount;
@@ -4817,8 +4819,9 @@ void NetHackQtBind::qt_start_menu(winid wid)
void NetHackQtBind::qt_add_menu(winid wid, int glyph, void NetHackQtBind::qt_add_menu(winid wid, int glyph,
const ANY_P * identifier, CHAR_P ch, CHAR_P gch, int attr, const ANY_P * identifier, CHAR_P ch, CHAR_P gch, int attr,
const char *str, BOOLEAN_P presel) const char *str, unsigned int itemflags)
{ {
boolean presel = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0);
NetHackQtWindow* window=id_to_window[wid]; NetHackQtWindow* window=id_to_window[wid];
window->AddMenu(glyph, identifier, ch, gch, attr, str, presel); window->AddMenu(glyph, identifier, ch, gch, attr, str, presel);
} }
+4 -4
View File
@@ -258,7 +258,7 @@ class NetHackQtWindow
virtual void PutStr(int attr, const char *text); virtual void PutStr(int attr, const char *text);
virtual void StartMenu(); virtual void StartMenu();
virtual void AddMenu(int glyph, const ANY_P *identifier, char ch, virtual void AddMenu(int glyph, const ANY_P *identifier, char ch,
char gch, int attr, const char *str, bool presel); char gch, int attr, const char *str, unsigned itemflags);
virtual void EndMenu(const char *prompt); virtual void EndMenu(const char *prompt);
virtual int SelectMenu(int how, MENU_ITEM_P **menu_list); virtual int SelectMenu(int how, MENU_ITEM_P **menu_list);
virtual void ClipAround(int x, int y); virtual void ClipAround(int x, int y);
@@ -550,7 +550,7 @@ class NetHackQtMenuWindow : public QTableView, public NetHackQtWindow
virtual void StartMenu(); virtual void StartMenu();
virtual void AddMenu(int glyph, const ANY_P *identifier, char ch, virtual void AddMenu(int glyph, const ANY_P *identifier, char ch,
char gch, int attr, const char *str, bool presel); char gch, int attr, const char *str, unsigned itemflags);
virtual void EndMenu(const char *prompt); virtual void EndMenu(const char *prompt);
virtual int SelectMenu(int how, MENU_ITEM_P **menu_list); virtual int SelectMenu(int how, MENU_ITEM_P **menu_list);
@@ -699,7 +699,7 @@ class NetHackQtMenuOrTextWindow : public NetHackQtWindow
// Menu // Menu
virtual void StartMenu(); virtual void StartMenu();
virtual void AddMenu(int glyph, const ANY_P *identifier, char ch, virtual void AddMenu(int glyph, const ANY_P *identifier, char ch,
char gch, int attr, const char *str, bool presel); char gch, int attr, const char *str, unsigned itemflags);
virtual void EndMenu(const char *prompt); virtual void EndMenu(const char *prompt);
virtual int SelectMenu(int how, MENU_ITEM_P **menu_list); virtual int SelectMenu(int how, MENU_ITEM_P **menu_list);
}; };
@@ -854,7 +854,7 @@ class NetHackQtBind : NetHackQtBindBase
static void qt_start_menu(winid wid); static void qt_start_menu(winid wid);
static void qt_add_menu(winid wid, int glyph, const ANY_P *identifier, static void qt_add_menu(winid wid, int glyph, const ANY_P *identifier,
CHAR_P ch, CHAR_P gch, int attr, const char *str, CHAR_P ch, CHAR_P gch, int attr, const char *str,
BOOLEAN_P presel); unsigned itemflags);
static void qt_end_menu(winid wid, const char *prompt); static void qt_end_menu(winid wid, const char *prompt);
static int qt_select_menu(winid wid, int how, MENU_ITEM_P **menu_list); static int qt_select_menu(winid wid, int how, MENU_ITEM_P **menu_list);
static void qt_update_inventory(); static void qt_update_inventory();
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 winX.c $NHDT-Date: 1552441031 2019/03/13 01:37:11 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.73 $ */ /* NetHack 3.6 winX.c $NHDT-Date: 1577063125 2019/12/23 01:05:25 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.79 $ */
/* Copyright (c) Dean Luick, 1992 */ /* Copyright (c) Dean Luick, 1992 */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1965,7 +1965,7 @@ boolean complain;
any = cg.zeroany; any = cg.zeroany;
while (dlb_fgets(line, LLEN, fp)) { while (dlb_fgets(line, LLEN, fp)) {
X11_add_menu(newwin, NO_GLYPH, &any, 0, 0, ATR_NONE, X11_add_menu(newwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
line, MENU_UNSELECTED); line, MENU_ITEMFLAGS_NONE);
} }
(void) dlb_fclose(fp); (void) dlb_fclose(fp);
+9 -5
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 winmenu.c $NHDT-Date: 1542245161 2018/11/15 01:26:01 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.33 $ */ /* NetHack 3.6 winmenu.c $NHDT-Date: 1577063136 2019/12/23 01:05:36 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.35 $ */
/* Copyright (c) Dean Luick, 1992 */ /* Copyright (c) Dean Luick, 1992 */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -542,10 +542,12 @@ struct xwindow *wp;
reset_menu_count(wp->menu_information); reset_menu_count(wp->menu_information);
for (count = 0, curr = wp->menu_information->curr_menu.base; curr; for (count = 0, curr = wp->menu_information->curr_menu.base; curr;
curr = curr->next, count++) curr = curr->next, count++) {
if (!menuitem_invert_test(0, curr->itemflags, curr->selected))
continue;
if (curr->identifier.a_void != 0) if (curr->identifier.a_void != 0)
invert_line(wp, curr, count, -1L); invert_line(wp, curr, count, -1L);
}
} }
static void static void
@@ -628,7 +630,7 @@ winid window;
/*ARGSUSED*/ /*ARGSUSED*/
void void
X11_add_menu(window, glyph, identifier, ch, gch, attr, str, preselected) X11_add_menu(window, glyph, identifier, ch, gch, attr, str, itemflags)
winid window; winid window;
int glyph; /* unused (for now) */ int glyph; /* unused (for now) */
const anything *identifier; const anything *identifier;
@@ -636,10 +638,11 @@ char ch;
char gch; /* group accelerator (0 = no group) */ char gch; /* group accelerator (0 = no group) */
int attr; int attr;
const char *str; const char *str;
boolean preselected; unsigned itemflags;
{ {
x11_menu_item *item; x11_menu_item *item;
struct menu_info_t *menu_info; struct menu_info_t *menu_info;
boolean preselected = (itemflags & MENU_ITEMFLAGS_SELECTED) != 0;
nhUse(glyph); nhUse(glyph);
@@ -654,6 +657,7 @@ boolean preselected;
item->next = (x11_menu_item *) 0; item->next = (x11_menu_item *) 0;
item->identifier = *identifier; item->identifier = *identifier;
item->attr = attr; item->attr = attr;
item->itemflags = itemflags;
item->selected = item->preselected = preselected; item->selected = item->preselected = preselected;
item->pick_count = -1L; item->pick_count = -1L;
item->window = window; item->window = window;
+4 -3
View File
@@ -182,7 +182,7 @@ winid window;
} }
void void
chainin_add_menu(window, glyph, identifier, ch, gch, attr, str, preselected) chainin_add_menu(window, glyph, identifier, ch, gch, attr, str, itemflags)
winid window; /* window to use, must be of type NHW_MENU */ winid window; /* window to use, must be of type NHW_MENU */
int glyph; /* glyph to display with item (unused) */ int glyph; /* glyph to display with item (unused) */
const anything *identifier; /* what to return if selected */ const anything *identifier; /* what to return if selected */
@@ -190,10 +190,11 @@ char ch; /* keyboard accelerator (0 = pick our own) */
char gch; /* group accelerator (0 = no group) */ char gch; /* group accelerator (0 = no group) */
int attr; /* attribute for string (like tty_putstr()) */ int attr; /* attribute for string (like tty_putstr()) */
const char *str; /* menu string */ const char *str; /* menu string */
boolean preselected; /* item is marked as selected */ unsigned int itemflags; /* flags such as item is marked as selected
MENU_ITEMFLAGS_SELECTED */
{ {
(*cibase->nprocs->win_add_menu)(cibase->ndata, window, glyph, identifier, (*cibase->nprocs->win_add_menu)(cibase->ndata, window, glyph, identifier,
ch, gch, attr, str, preselected); ch, gch, attr, str, itemflags);
} }
void void
+3 -3
View File
@@ -224,7 +224,7 @@ winid window;
void void
chainout_add_menu(vp, window, glyph, identifier, ch, gch, attr, str, chainout_add_menu(vp, window, glyph, identifier, ch, gch, attr, str,
preselected) itemflags)
void *vp; void *vp;
winid window; /* window to use, must be of type NHW_MENU */ winid window; /* window to use, must be of type NHW_MENU */
int glyph; /* glyph to display with item (unused) */ int glyph; /* glyph to display with item (unused) */
@@ -233,12 +233,12 @@ char ch; /* keyboard accelerator (0 = pick our own) */
char gch; /* group accelerator (0 = no group) */ char gch; /* group accelerator (0 = no group) */
int attr; /* attribute for string (like tty_putstr()) */ int attr; /* attribute for string (like tty_putstr()) */
const char *str; /* menu string */ const char *str; /* menu string */
boolean preselected; /* item is marked as selected */ unsigned int itemflags; /* itemflags such as marked as selected */
{ {
struct chainout_data *tdp = vp; struct chainout_data *tdp = vp;
(*tdp->nprocs->win_add_menu)(window, glyph, identifier, ch, gch, attr, (*tdp->nprocs->win_add_menu)(window, glyph, identifier, ch, gch, attr,
str, preselected); str, itemflags);
} }
void void
+7 -7
View File
@@ -370,7 +370,7 @@ winid window;
} }
void void
trace_add_menu(vp, window, glyph, identifier, ch, gch, attr, str, preselected) trace_add_menu(vp, window, glyph, identifier, ch, gch, attr, str, itemflags)
void *vp; void *vp;
winid window; /* window to use, must be of type NHW_MENU */ winid window; /* window to use, must be of type NHW_MENU */
int glyph; /* glyph to display with item (unused) */ int glyph; /* glyph to display with item (unused) */
@@ -379,7 +379,7 @@ char ch; /* keyboard accelerator (0 = pick our own) */
char gch; /* group accelerator (0 = no group) */ char gch; /* group accelerator (0 = no group) */
int attr; /* attribute for string (like tty_putstr()) */ int attr; /* attribute for string (like tty_putstr()) */
const char *str; /* menu string */ const char *str; /* menu string */
boolean preselected; /* item is marked as selected */ unsigned int itemflags; /* itemflags such as marked as selected */
{ {
struct trace_data *tdp = vp; struct trace_data *tdp = vp;
@@ -400,19 +400,19 @@ boolean preselected; /* item is marked as selected */
if (str) { if (str) {
fprintf(wc_tracelogf, fprintf(wc_tracelogf,
"%sadd_menu(%d, %d, %p, %s, %s, %d, '%s'(%d), %d)\n", INDENT, "%sadd_menu(%d, %d, %p, %s, %s, %d, '%s'(%d), %u)\n", INDENT,
window, glyph, (void *) identifier, buf_ch, buf_gch, attr, window, glyph, (void *) identifier, buf_ch, buf_gch, attr,
str, (int) strlen(str), preselected); str, (int) strlen(str), itemflags);
} else { } else {
fprintf(wc_tracelogf, fprintf(wc_tracelogf,
"%sadd_menu(%d, %d, %p, %s, %s, %d, NULL, %d)\n", INDENT, "%sadd_menu(%d, %d, %p, %s, %s, %d, NULL, %u)\n", INDENT,
window, glyph, (void *) identifier, buf_ch, buf_gch, attr, window, glyph, (void *) identifier, buf_ch, buf_gch, attr,
preselected); itemflags);
} }
PRE; PRE;
(*tdp->nprocs->win_add_menu)(tdp->ndata, window, glyph, identifier, ch, (*tdp->nprocs->win_add_menu)(tdp->ndata, window, glyph, identifier, ch,
gch, attr, str, preselected); gch, attr, str, itemflags);
POST; POST;
} }
+9 -3
View File
@@ -66,6 +66,7 @@ typedef struct nhmi {
const char *str; /* Text of menu item */ const char *str; /* Text of menu item */
BOOLEAN_P presel; /* Whether menu item should be preselected */ BOOLEAN_P presel; /* Whether menu item should be preselected */
boolean selected; /* Whether item is currently selected */ boolean selected; /* Whether item is currently selected */
unsigned itemflags;
int page_num; /* Display page number for entry */ int page_num; /* Display page number for entry */
int line_num; /* Line number on page where entry begins */ int line_num; /* Line number on page where entry begins */
int num_lines; /* Number of lines entry uses on page */ int num_lines; /* Number of lines entry uses on page */
@@ -586,6 +587,7 @@ curs_new_menu_item(winid wid, const char *str)
new_item->str = new_str; new_item->str = new_str;
new_item->presel = FALSE; new_item->presel = FALSE;
new_item->selected = FALSE; new_item->selected = FALSE;
new_item->itemflags = MENU_ITEMFLAGS_NONE;
new_item->page_num = 0; new_item->page_num = 0;
new_item->line_num = 0; new_item->line_num = 0;
new_item->num_lines = 0; new_item->num_lines = 0;
@@ -598,10 +600,11 @@ curs_new_menu_item(winid wid, const char *str)
void void
curses_add_nhmenu_item(winid wid, int glyph, const ANY_P *identifier, curses_add_nhmenu_item(winid wid, int glyph, const ANY_P *identifier,
CHAR_P accelerator, CHAR_P group_accel, int attr, CHAR_P accelerator, CHAR_P group_accel, int attr,
const char *str, BOOLEAN_P presel) const char *str, unsigned itemflags)
{ {
nhmenu_item *new_item, *current_items, *menu_item_ptr; nhmenu_item *new_item, *current_items, *menu_item_ptr;
nhmenu *current_menu = get_menu(wid); nhmenu *current_menu = get_menu(wid);
boolean presel = (itemflags & MENU_ITEMFLAGS_SELECTED) != 0;
if (current_menu == NULL) { if (current_menu == NULL) {
impossible( impossible(
@@ -620,7 +623,7 @@ curses_add_nhmenu_item(winid wid, int glyph, const ANY_P *identifier,
new_item->group_accel = group_accel; new_item->group_accel = group_accel;
new_item->attr = attr; new_item->attr = attr;
new_item->presel = presel; new_item->presel = presel;
new_item->itemflags = itemflags;
current_items = current_menu->entries; current_items = current_menu->entries;
menu_item_ptr = current_items; menu_item_ptr = current_items;
@@ -1549,7 +1552,10 @@ menu_operation(WINDOW * win, nhmenu *menu, menu_op
} }
if (menu_item_ptr->identifier.a_void != NULL) { if (menu_item_ptr->identifier.a_void != NULL) {
menu_select_deselect(win, menu_item_ptr, operation, current_page); if (operation != INVERT
|| menuitem_invert_test(0, menu_item_ptr->itemflags,
menu_item_ptr->selected))
menu_select_deselect(win, menu_item_ptr, operation, current_page);
} }
menu_item_ptr = menu_item_ptr->next_item; menu_item_ptr = menu_item_ptr->next_item;
+1 -1
View File
@@ -15,7 +15,7 @@ int curses_ext_cmd(void);
void curses_create_nhmenu(winid wid); void curses_create_nhmenu(winid wid);
void curses_add_nhmenu_item(winid wid, int glyph, const ANY_P *identifier, void curses_add_nhmenu_item(winid wid, int glyph, const ANY_P *identifier,
CHAR_P accelerator, CHAR_P group_accel, int attr, CHAR_P accelerator, CHAR_P group_accel, int attr,
const char *str, BOOLEAN_P presel); const char *str, unsigned itemflags);
void curs_menu_set_bottom_heavy(winid); void curs_menu_set_bottom_heavy(winid);
void curses_finalize_nhmenu(winid wid, const char *prompt); void curses_finalize_nhmenu(winid wid, const char *prompt);
int curses_display_nhmenu(winid wid, int how, MENU_ITEM_P **_selected); int curses_display_nhmenu(winid wid, int how, MENU_ITEM_P **_selected);
+3 -3
View File
@@ -744,19 +744,19 @@ curses_character_dialog(const char **choices, const char *prompt)
identifier.a_int = (count + 1); /* Must be non-zero */ identifier.a_int = (count + 1); /* Must be non-zero */
curses_add_menu(wid, NO_GLYPH, &identifier, curletter, 0, curses_add_menu(wid, NO_GLYPH, &identifier, curletter, 0,
A_NORMAL, choices[count], FALSE); A_NORMAL, choices[count], MENU_ITEMFLAGS_NONE);
used_letters[count] = curletter; used_letters[count] = curletter;
} }
/* Random Selection */ /* Random Selection */
identifier.a_int = ROLE_RANDOM; identifier.a_int = ROLE_RANDOM;
curses_add_menu(wid, NO_GLYPH, &identifier, '*', 0, A_NORMAL, "Random", curses_add_menu(wid, NO_GLYPH, &identifier, '*', 0, A_NORMAL, "Random",
FALSE); MENU_ITEMFLAGS_NONE);
/* Quit prompt */ /* Quit prompt */
identifier.a_int = ROLE_NONE; identifier.a_int = ROLE_NONE;
curses_add_menu(wid, NO_GLYPH, &identifier, 'q', 0, A_NORMAL, "Quit", curses_add_menu(wid, NO_GLYPH, &identifier, 'q', 0, A_NORMAL, "Quit",
FALSE); MENU_ITEMFLAGS_NONE);
curses_end_menu(wid, prompt); curses_end_menu(wid, prompt);
ret = curses_select_menu(wid, PICK_ONE, &selected); ret = curses_select_menu(wid, PICK_ONE, &selected);
if (ret == 1) { if (ret == 1) {
+4 -4
View File
@@ -491,7 +491,7 @@ curses_start_menu(winid wid)
/* /*
add_menu(winid wid, int glyph, const anything identifier, add_menu(winid wid, int glyph, const anything identifier,
char accelerator, char groupacc, char accelerator, char groupacc,
int attr, char *str, boolean preselected) int attr, char *str, unsigned int itemflags)
-- Add a text line str to the given menu window. If identifier -- Add a text line str to the given menu window. If identifier
is 0, then the line cannot be selected (e.g. a title). is 0, then the line cannot be selected (e.g. a title).
Otherwise, identifier is the value returned if the line is Otherwise, identifier is the value returned if the line is
@@ -517,12 +517,12 @@ add_menu(winid wid, int glyph, const anything identifier,
The menu commands and aliases take care not to interfere The menu commands and aliases take care not to interfere
with the default object class symbols. with the default object class symbols.
-- If you want this choice to be preselected when the -- If you want this choice to be preselected when the
menu is displayed, set preselected to TRUE. menu is displayed, set bit MENU_ITEMFLAGS_SELECTED.
*/ */
void void
curses_add_menu(winid wid, int glyph, const ANY_P * identifier, curses_add_menu(winid wid, int glyph, const ANY_P * identifier,
CHAR_P accelerator, CHAR_P group_accel, int attr, CHAR_P accelerator, CHAR_P group_accel, int attr,
const char *str, BOOLEAN_P presel) const char *str, unsigned itemflags)
{ {
int curses_attr; int curses_attr;
@@ -536,7 +536,7 @@ curses_add_menu(winid wid, int glyph, const ANY_P * identifier,
} }
curses_add_nhmenu_item(wid, glyph, identifier, accelerator, group_accel, curses_add_nhmenu_item(wid, glyph, identifier, accelerator, group_accel,
curses_attr, str, presel); curses_attr, str, itemflags);
} }
/* /*
+6 -3
View File
@@ -373,14 +373,17 @@ curses_prev_mesg()
for (count = 0; count < num_messages; ++count) { for (count = 0; count < num_messages; ++count) {
mesg = get_msg_line(do_lifo, count); mesg = get_msg_line(do_lifo, count);
if (turn != mesg->turn && count != 0) { if (turn != mesg->turn && count != 0) {
curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL, "---", FALSE); curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL, "---",
MENU_ITEMFLAGS_NONE);
} }
curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL, mesg->str, FALSE); curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL, mesg->str,
MENU_ITEMFLAGS_NONE);
turn = mesg->turn; turn = mesg->turn;
} }
if (!count) if (!count)
curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL, curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL,
"[No past messages available.]", FALSE); "[No past messages available.]",
MENU_ITEMFLAGS_NONE);
curses_end_menu(wid, ""); curses_end_menu(wid, "");
if (!do_lifo) if (!do_lifo)
+2 -1
View File
@@ -509,7 +509,8 @@ curses_puts(winid wid, int attr, const char *text)
return; return;
} }
Id = cg.zeroany; Id = cg.zeroany;
curses_add_nhmenu_item(wid, NO_GLYPH, &Id, 0, 0, attr, text, FALSE); curses_add_nhmenu_item(wid, NO_GLYPH, &Id, 0, 0, attr, text,
MENU_ITEMFLAGS_NONE);
} else { } else {
waddstr(win, text); waddstr(win, text);
wnoutrefresh(win); wnoutrefresh(win);
+17 -15
View File
@@ -251,7 +251,7 @@ Gem_player_selection()
if (currch == lastch) if (currch == lastch)
currch = highc(currch); currch = highc(currch);
add_menu(win, roles[i].malenum, &any, currch, 0, ATR_NONE, add_menu(win, roles[i].malenum, &any, currch, 0, ATR_NONE,
an(roles[i].name.m), MENU_UNSELECTED); an(roles[i].name.m), MENU_ITEMFLAGS_NONE);
lastch = currch; lastch = currch;
} }
} }
@@ -260,10 +260,10 @@ Gem_player_selection()
if (any.a_int == 0) /* must be non-zero */ if (any.a_int == 0) /* must be non-zero */
any.a_int = randrole(FALSE) + 1; any.a_int = randrole(FALSE) + 1;
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
any.a_int = i + 1; /* must be non-zero */ any.a_int = i + 1; /* must be non-zero */
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
end_menu(win, "Pick a role"); end_menu(win, "Pick a role");
n = select_menu(win, PICK_ONE, &selected); n = select_menu(win, PICK_ONE, &selected);
destroy_nhwindow(win); destroy_nhwindow(win);
@@ -320,17 +320,17 @@ Gem_player_selection()
flags.initalign)) { flags.initalign)) {
any.a_int = i + 1; /* must be non-zero */ any.a_int = i + 1; /* must be non-zero */
add_menu(win, NO_GLYPH, &any, races[i].noun[0], 0, add_menu(win, NO_GLYPH, &any, races[i].noun[0], 0,
ATR_NONE, races[i].noun, MENU_UNSELECTED); ATR_NONE, races[i].noun, MENU_ITEMFLAGS_NONE);
} }
any.a_int = pick_race(flags.initrole, flags.initgend, any.a_int = pick_race(flags.initrole, flags.initgend,
flags.initalign, PICK_RANDOM) + 1; flags.initalign, PICK_RANDOM) + 1;
if (any.a_int == 0) /* must be non-zero */ if (any.a_int == 0) /* must be non-zero */
any.a_int = randrace(flags.initrole) + 1; any.a_int = randrace(flags.initrole) + 1;
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
any.a_int = i + 1; /* must be non-zero */ any.a_int = i + 1; /* must be non-zero */
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
Sprintf(pbuf, "Pick the race of your %s", Sprintf(pbuf, "Pick the race of your %s",
roles[flags.initrole].name.m); roles[flags.initrole].name.m);
end_menu(win, pbuf); end_menu(win, pbuf);
@@ -389,17 +389,17 @@ Gem_player_selection()
flags.initalign)) { flags.initalign)) {
any.a_int = i + 1; any.a_int = i + 1;
add_menu(win, NO_GLYPH, &any, genders[i].adj[0], 0, add_menu(win, NO_GLYPH, &any, genders[i].adj[0], 0,
ATR_NONE, genders[i].adj, MENU_UNSELECTED); ATR_NONE, genders[i].adj, MENU_ITEMFLAGS_NONE);
} }
any.a_int = pick_gend(flags.initrole, flags.initrace, any.a_int = pick_gend(flags.initrole, flags.initrace,
flags.initalign, PICK_RANDOM) + 1; flags.initalign, PICK_RANDOM) + 1;
if (any.a_int == 0) /* must be non-zero */ if (any.a_int == 0) /* must be non-zero */
any.a_int = randgend(flags.initrole, flags.initrace) + 1; any.a_int = randgend(flags.initrole, flags.initrace) + 1;
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
any.a_int = i + 1; /* must be non-zero */ any.a_int = i + 1; /* must be non-zero */
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
Sprintf(pbuf, "Pick the gender of your %s %s", Sprintf(pbuf, "Pick the gender of your %s %s",
races[flags.initrace].adj, races[flags.initrace].adj,
roles[flags.initrole].name.m); roles[flags.initrole].name.m);
@@ -458,17 +458,17 @@ Gem_player_selection()
flags.initgend, i)) { flags.initgend, i)) {
any.a_int = i + 1; any.a_int = i + 1;
add_menu(win, NO_GLYPH, &any, aligns[i].adj[0], 0, add_menu(win, NO_GLYPH, &any, aligns[i].adj[0], 0,
ATR_NONE, aligns[i].adj, MENU_UNSELECTED); ATR_NONE, aligns[i].adj, MENU_ITEMFLAGS_NONE);
} }
any.a_int = pick_align(flags.initrole, flags.initrace, any.a_int = pick_align(flags.initrole, flags.initrace,
flags.initgend, PICK_RANDOM) + 1; flags.initgend, PICK_RANDOM) + 1;
if (any.a_int == 0) /* must be non-zero */ if (any.a_int == 0) /* must be non-zero */
any.a_int = randalign(flags.initrole, flags.initrace) + 1; any.a_int = randalign(flags.initrole, flags.initrace) + 1;
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
any.a_int = i + 1; /* must be non-zero */ any.a_int = i + 1; /* must be non-zero */
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
Sprintf(pbuf, "Pick the alignment of your %s %s %s", Sprintf(pbuf, "Pick the alignment of your %s %s %s",
genders[flags.initgend].adj, genders[flags.initgend].adj,
races[flags.initrace].adj, races[flags.initrace].adj,
@@ -754,7 +754,7 @@ boolean complain;
* later. * later.
*/ */
void void
Gem_add_menu(window, glyph, identifier, ch, gch, attr, str, preselected) Gem_add_menu(window, glyph, identifier, ch, gch, attr, str, itemflags)
winid window; /* window to use, must be of type NHW_MENU */ winid window; /* window to use, must be of type NHW_MENU */
int glyph; /* glyph to display with item (unused) */ int glyph; /* glyph to display with item (unused) */
const anything *identifier; /* what to return if selected */ const anything *identifier; /* what to return if selected */
@@ -762,8 +762,9 @@ char ch; /* keyboard accelerator (0 = pick our own) */
char gch; /* group accelerator (0 = no group) */ char gch; /* group accelerator (0 = no group) */
int attr; /* attribute for string (like Gem_putstr()) */ int attr; /* attribute for string (like Gem_putstr()) */
const char *str; /* menu string */ const char *str; /* menu string */
boolean preselected; /* item is marked as selected */ unsigned int itemflags; /* itemflags such as marked as selected */
{ {
boolean preselected = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0);
Gem_menu_item *G_item; Gem_menu_item *G_item;
const char *newstr; const char *newstr;
char buf[QBUFSZ]; char buf[QBUFSZ];
@@ -787,6 +788,7 @@ boolean preselected; /* item is marked as selected */
G_item->Gmi_selected = preselected ? 1 : 0; G_item->Gmi_selected = preselected ? 1 : 0;
G_item->Gmi_accelerator = ch; G_item->Gmi_accelerator = ch;
G_item->Gmi_groupacc = gch; G_item->Gmi_groupacc = gch;
G_item->Gmi_itemflags = itemflags;
G_item->Gmi_attr = attr; G_item->Gmi_attr = attr;
G_item->Gmi_str = copy_of(newstr); G_item->Gmi_str = copy_of(newstr);
mar_add_menu(window, G_item); mar_add_menu(window, G_item);
@@ -1014,7 +1016,7 @@ Gem_get_ext_cmd()
too_much = FALSE; too_much = FALSE;
tmp_acc = *ptr; tmp_acc = *ptr;
Gem_add_menu(wind, NO_GLYPH, &any, accelerator, 0, ATR_NONE, ptr, Gem_add_menu(wind, NO_GLYPH, &any, accelerator, 0, ATR_NONE, ptr,
FALSE); MENU_ITEMFLAGS_NONE);
} }
Gem_end_menu(wind, "What extended command?"); Gem_end_menu(wind, "What extended command?");
count = Gem_select_menu(wind, PICK_ONE, &selected); count = Gem_select_menu(wind, PICK_ONE, &selected);
+5 -1
View File
@@ -1783,7 +1783,10 @@ char acc;
for (curr = invent_list; start-- && curr; curr = curr->Gmi_next) for (curr = invent_list; start-- && curr; curr = curr->Gmi_next)
; ;
for (; page-- && curr; curr = curr->Gmi_next) for (; page-- && curr; curr = curr->Gmi_next) {
if (!menuitem_invert_test(0, curr->Gmi_itemflags, curr->Gmi_selected)
continue;
if (curr->Gmi_identifier && (acc == 0 || curr->Gmi_groupacc == acc)) { if (curr->Gmi_identifier && (acc == 0 || curr->Gmi_groupacc == acc)) {
if (curr->Gmi_selected) { if (curr->Gmi_selected) {
curr->Gmi_selected = FALSE; curr->Gmi_selected = FALSE;
@@ -1791,6 +1794,7 @@ char acc;
} else } else
curr->Gmi_selected = TRUE; curr->Gmi_selected = TRUE;
} }
}
} }
/************************* Inv_Handler and Inv_Init /************************* Inv_Handler and Inv_Init
+6 -5
View File
@@ -681,10 +681,9 @@ gnome_start_menu(winid wid)
/* /*
add_menu(windid window, int glyph, const anything identifier, add_menu(windid window, int glyph, const anything identifier,
char accelerator, char groupacc, char accelerator, char groupacc,
int attr, char *str, boolean preselected) int attr, char *str, unsigned int itemflags)
-- Add a text line str to the given menu window. If -- Add a text line str to the given menu window. If
identifier identifier is 0, then the line cannot be selected (e.g. a title).
is 0, then the line cannot be selected (e.g. a title).
Otherwise, identifier is the value returned if the line is Otherwise, identifier is the value returned if the line is
selected. Accelerator is a keyboard key that can be used selected. Accelerator is a keyboard key that can be used
to select the line. If the accelerator of a selectable to select the line. If the accelerator of a selectable
@@ -708,13 +707,14 @@ identifier
The menu commands and aliases take care not to interfere The menu commands and aliases take care not to interfere
with the default object class symbols. with the default object class symbols.
-- If you want this choice to be preselected when the -- If you want this choice to be preselected when the
menu is displayed, set preselected to TRUE. menu is displayed, set bit MENU_ITEMFLAGS_SELECTED.
*/ */
void void
gnome_add_menu(winid wid, int glyph, const ANY_P *identifier, gnome_add_menu(winid wid, int glyph, const ANY_P *identifier,
CHAR_P accelerator, CHAR_P group_accel, int attr, CHAR_P accelerator, CHAR_P group_accel, int attr,
const char *str, BOOLEAN_P presel) const char *str, unsigned int itemflags)
{ {
boolean presel = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0);
GHackMenuItem item; GHackMenuItem item;
item.glyph = glyph; item.glyph = glyph;
item.identifier = identifier; item.identifier = identifier;
@@ -723,6 +723,7 @@ gnome_add_menu(winid wid, int glyph, const ANY_P *identifier,
item.attr = attr; item.attr = attr;
item.str = str; item.str = str;
item.presel = presel; item.presel = presel;
item.itemflags = itemflags;
if (wid != -1 && gnome_windowlist[wid].win != NULL) { if (wid != -1 && gnome_windowlist[wid].win != NULL) {
gtk_signal_emit(GTK_OBJECT(gnome_windowlist[wid].win), gtk_signal_emit(GTK_OBJECT(gnome_windowlist[wid].win),
+1
View File
@@ -18,6 +18,7 @@ struct _GHackMenuItem {
CHAR_P accelerator; CHAR_P accelerator;
CHAR_P group_accel; CHAR_P group_accel;
int attr; int attr;
unsigned itemflags;
const char *str; const char *str;
BOOLEAN_P presel; BOOLEAN_P presel;
}; };
+2 -2
View File
@@ -242,7 +242,7 @@ winid window;
* later. * later.
*/ */
void void
safe_add_menu(window, glyph, identifier, ch, gch, attr, str, preselected) safe_add_menu(window, glyph, identifier, ch, gch, attr, str, itemflags)
winid window; /* window to use, must be of type NHW_MENU */ winid window; /* window to use, must be of type NHW_MENU */
int glyph UNUSED; /* glyph to display with item (not used) */ int glyph UNUSED; /* glyph to display with item (not used) */
const anything *identifier; /* what to return if selected */ const anything *identifier; /* what to return if selected */
@@ -250,7 +250,7 @@ char ch; /* keyboard accelerator (0 = pick our own) */
char gch; /* group accelerator (0 = no group) */ char gch; /* group accelerator (0 = no group) */
int attr; /* attribute for string (like safe_putstr()) */ int attr; /* attribute for string (like safe_putstr()) */
const char *str; /* menu string */ const char *str; /* menu string */
boolean preselected; /* item is marked as selected */ unsigned int itemflags; /* itemflags such as marked as selected */
{ {
return; return;
} }
+42 -30
View File
@@ -578,7 +578,7 @@ tty_player_selection()
role_menu_extra(ROLE_RANDOM, win, TRUE); role_menu_extra(ROLE_RANDOM, win, TRUE);
any = cg.zeroany; /* separator, not a choice */ any = cg.zeroany; /* separator, not a choice */
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
role_menu_extra(RS_RACE, win, FALSE); role_menu_extra(RS_RACE, win, FALSE);
role_menu_extra(RS_GENDER, win, FALSE); role_menu_extra(RS_GENDER, win, FALSE);
role_menu_extra(RS_ALGNMNT, win, FALSE); role_menu_extra(RS_ALGNMNT, win, FALSE);
@@ -677,7 +677,7 @@ tty_player_selection()
role_menu_extra(ROLE_RANDOM, win, TRUE); role_menu_extra(ROLE_RANDOM, win, TRUE);
any.a_int = 0; /* separator, not a choice */ any.a_int = 0; /* separator, not a choice */
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
role_menu_extra(RS_ROLE, win, FALSE); role_menu_extra(RS_ROLE, win, FALSE);
role_menu_extra(RS_GENDER, win, FALSE); role_menu_extra(RS_GENDER, win, FALSE);
role_menu_extra(RS_ALGNMNT, win, FALSE); role_menu_extra(RS_ALGNMNT, win, FALSE);
@@ -770,7 +770,7 @@ tty_player_selection()
role_menu_extra(ROLE_RANDOM, win, TRUE); role_menu_extra(ROLE_RANDOM, win, TRUE);
any.a_int = 0; /* separator, not a choice */ any.a_int = 0; /* separator, not a choice */
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
role_menu_extra(RS_ROLE, win, FALSE); role_menu_extra(RS_ROLE, win, FALSE);
role_menu_extra(RS_RACE, win, FALSE); role_menu_extra(RS_RACE, win, FALSE);
role_menu_extra(RS_ALGNMNT, win, FALSE); role_menu_extra(RS_ALGNMNT, win, FALSE);
@@ -859,7 +859,7 @@ tty_player_selection()
role_menu_extra(ROLE_RANDOM, win, TRUE); role_menu_extra(ROLE_RANDOM, win, TRUE);
any.a_int = 0; /* separator, not a choice */ any.a_int = 0; /* separator, not a choice */
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
role_menu_extra(RS_ROLE, win, FALSE); role_menu_extra(RS_ROLE, win, FALSE);
role_menu_extra(RS_RACE, win, FALSE); role_menu_extra(RS_RACE, win, FALSE);
role_menu_extra(RS_GENDER, win, FALSE); role_menu_extra(RS_GENDER, win, FALSE);
@@ -947,25 +947,25 @@ tty_player_selection()
(GEND == 1 && roles[ROLE].name.f) ? roles[ROLE].name.f (GEND == 1 && roles[ROLE].name.f) ? roles[ROLE].name.f
: roles[ROLE].name.m); : roles[ROLE].name.m);
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, pbuf, add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, pbuf,
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
/* blank separator */ /* blank separator */
any.a_int = 0; any.a_int = 0;
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE);
/* [ynaq] menu choices */ /* [ynaq] menu choices */
any.a_int = 1; any.a_int = 1;
add_menu(win, NO_GLYPH, &any, 'y', 0, ATR_NONE, "Yes; start game", add_menu(win, NO_GLYPH, &any, 'y', 0, ATR_NONE, "Yes; start game",
MENU_SELECTED); MENU_ITEMFLAGS_SELECTED);
any.a_int = 2; any.a_int = 2;
add_menu(win, NO_GLYPH, &any, 'n', 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, 'n', 0, ATR_NONE,
"No; choose role again", MENU_UNSELECTED); "No; choose role again", MENU_ITEMFLAGS_NONE);
if (iflags.renameallowed) { if (iflags.renameallowed) {
any.a_int = 3; any.a_int = 3;
add_menu(win, NO_GLYPH, &any, 'a', 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, 'a', 0, ATR_NONE,
"Not yet; choose another name", MENU_UNSELECTED); "Not yet; choose another name", MENU_ITEMFLAGS_NONE);
} }
any.a_int = -1; any.a_int = -1;
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
Sprintf(pbuf, "Is this ok? [yn%sq]", iflags.renameallowed ? "a" : ""); Sprintf(pbuf, "Is this ok? [yn%sq]", iflags.renameallowed ? "a" : "");
end_menu(win, pbuf); end_menu(win, pbuf);
n = select_menu(win, PICK_ONE, &selected); n = select_menu(win, PICK_ONE, &selected);
@@ -1040,22 +1040,22 @@ reset_role_filtering()
/* no extra blank line preceding this entry; end_menu supplies one */ /* no extra blank line preceding this entry; end_menu supplies one */
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE,
"Unacceptable roles", MENU_UNSELECTED); "Unacceptable roles", MENU_ITEMFLAGS_NONE);
setup_rolemenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE); setup_rolemenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE);
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE);
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE,
"Unacceptable races", MENU_UNSELECTED); "Unacceptable races", MENU_ITEMFLAGS_NONE);
setup_racemenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE); setup_racemenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE);
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE);
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE,
"Unacceptable genders", MENU_UNSELECTED); "Unacceptable genders", MENU_ITEMFLAGS_NONE);
setup_gendmenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE); setup_gendmenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE);
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_ITEMFLAGS_NONE);
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE,
"Unacceptable alignments", MENU_UNSELECTED); "Unacceptable alignments", MENU_ITEMFLAGS_NONE);
setup_algnmenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE); setup_algnmenu(win, FALSE, ROLE_NONE, ROLE_NONE, ROLE_NONE);
end_menu(win, "Pick all that apply"); end_menu(win, "Pick all that apply");
@@ -1118,7 +1118,8 @@ int race, gend, algn; /* all ROLE_NONE for !filtering case */
/* !filtering implies reset_role_filtering() where we want to /* !filtering implies reset_role_filtering() where we want to
mark this role as preseleted if current filter excludes it */ mark this role as preseleted if current filter excludes it */
add_menu(win, NO_GLYPH, &any, thisch, 0, ATR_NONE, an(rolenamebuf), add_menu(win, NO_GLYPH, &any, thisch, 0, ATR_NONE, an(rolenamebuf),
(!filtering && !role_ok) ? MENU_SELECTED : MENU_UNSELECTED); (!filtering && !role_ok)
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
lastch = thisch; lastch = thisch;
} }
} }
@@ -1152,7 +1153,8 @@ int role, gend, algn;
filtering ? this_ch : highc(this_ch), filtering ? this_ch : highc(this_ch),
filtering ? highc(this_ch) : 0, filtering ? highc(this_ch) : 0,
ATR_NONE, races[i].noun, ATR_NONE, races[i].noun,
(!filtering && !race_ok) ? MENU_SELECTED : MENU_UNSELECTED); (!filtering && !race_ok)
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
} }
} }
@@ -1183,7 +1185,8 @@ int role, race, algn;
filtering ? this_ch : highc(this_ch), filtering ? this_ch : highc(this_ch),
filtering ? highc(this_ch) : 0, filtering ? highc(this_ch) : 0,
ATR_NONE, genders[i].adj, ATR_NONE, genders[i].adj,
(!filtering && !gend_ok) ? MENU_SELECTED : MENU_UNSELECTED); (!filtering && !gend_ok)
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
} }
} }
@@ -1214,7 +1217,8 @@ int role, race, gend;
filtering ? this_ch : highc(this_ch), filtering ? this_ch : highc(this_ch),
filtering ? highc(this_ch) : 0, filtering ? highc(this_ch) : 0,
ATR_NONE, aligns[i].adj, ATR_NONE, aligns[i].adj,
(!filtering && !algn_ok) ? MENU_SELECTED : MENU_UNSELECTED); (!filtering && !algn_ok)
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
} }
} }
@@ -1769,7 +1773,10 @@ char acc; /* group accelerator, 0 => all */
tty_menu_item *curr; tty_menu_item *curr;
int n; int n;
for (n = 0, curr = page_start; curr != page_end; n++, curr = curr->next) for (n = 0, curr = page_start; curr != page_end; n++, curr = curr->next) {
if (!menuitem_invert_test(0, curr->itemflags, curr->selected))
continue;
if (curr->identifier.a_void && (acc == 0 || curr->gselector == acc)) { if (curr->identifier.a_void && (acc == 0 || curr->gselector == acc)) {
if (curr->selected) { if (curr->selected) {
curr->selected = FALSE; curr->selected = FALSE;
@@ -1778,6 +1785,7 @@ char acc; /* group accelerator, 0 => all */
curr->selected = TRUE; curr->selected = TRUE;
set_item_state(window, n, curr); set_item_state(window, n, curr);
} }
}
} }
/* /*
@@ -1804,11 +1812,13 @@ char acc; /* group accelerator, 0 => all */
if (!on_curr_page && curr->identifier.a_void if (!on_curr_page && curr->identifier.a_void
&& (acc == 0 || curr->gselector == acc)) { && (acc == 0 || curr->gselector == acc)) {
if (curr->selected) { if (menuitem_invert_test(0, curr->itemflags, curr->selected)) {
curr->selected = FALSE; if (curr->selected) {
curr->count = -1; curr->selected = FALSE;
} else curr->count = -1;
} else
curr->selected = TRUE; curr->selected = TRUE;
}
} }
} }
} }
@@ -2900,7 +2910,7 @@ winid window;
* later. * later.
*/ */
void void
tty_add_menu(window, glyph, identifier, ch, gch, attr, str, preselected) tty_add_menu(window, glyph, identifier, ch, gch, attr, str, itemflags)
winid window; /* window to use, must be of type NHW_MENU */ winid window; /* window to use, must be of type NHW_MENU */
int glyph UNUSED; /* glyph to display with item (not used) */ int glyph UNUSED; /* glyph to display with item (not used) */
const anything *identifier; /* what to return if selected */ const anything *identifier; /* what to return if selected */
@@ -2908,8 +2918,9 @@ char ch; /* keyboard accelerator (0 = pick our own) */
char gch; /* group accelerator (0 = no group) */ char gch; /* group accelerator (0 = no group) */
int attr; /* attribute for string (like tty_putstr()) */ int attr; /* attribute for string (like tty_putstr()) */
const char *str; /* menu string */ const char *str; /* menu string */
boolean preselected; /* item is marked as selected */ unsigned int itemflags; /* itemflags such as MENU_ITEMFLAGS_SELECTED */
{ {
boolean preselected = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0);
register struct WinDesc *cw = 0; register struct WinDesc *cw = 0;
tty_menu_item *item; tty_menu_item *item;
const char *newstr; const char *newstr;
@@ -2944,6 +2955,7 @@ boolean preselected; /* item is marked as selected */
item->identifier = *identifier; item->identifier = *identifier;
item->count = -1L; item->count = -1L;
item->selected = preselected; item->selected = preselected;
item->itemflags = itemflags;
item->selector = ch; item->selector = ch;
item->gselector = gch; item->gselector = gch;
item->attr = attr; item->attr = attr;
@@ -2999,9 +3011,9 @@ const char *prompt; /* prompt to for menu */
any = cg.zeroany; /* not selectable */ any = cg.zeroany; /* not selectable */
tty_add_menu(window, NO_GLYPH, &any, 0, 0, ATR_NONE, "", tty_add_menu(window, NO_GLYPH, &any, 0, 0, ATR_NONE, "",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
tty_add_menu(window, NO_GLYPH, &any, 0, 0, ATR_NONE, prompt, tty_add_menu(window, NO_GLYPH, &any, 0, 0, ATR_NONE, prompt,
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
} }
/* 52: 'a'..'z' and 'A'..'Z'; avoids selector duplication within a page */ /* 52: 'a'..'z' and 'A'..'Z'; avoids selector duplication within a page */
+4
View File
@@ -308,6 +308,10 @@ mswin_map_stretch(HWND hWnd, LPSIZE map_size, BOOL redraw)
data->xFrontTile = (int) ((double) data->xBackTile * data->frontScale); data->xFrontTile = (int) ((double) data->xBackTile * data->frontScale);
data->yFrontTile = (int) ((double) data->yBackTile * data->frontScale); data->yFrontTile = (int) ((double) data->yBackTile * data->frontScale);
/* ensure front tile is non-zero in size */
data->xFrontTile = max(data->xFrontTile, 1);
data->yFrontTile = max(data->yFrontTile, 1);
/* calcuate ASCII cursor height */ /* calcuate ASCII cursor height */
data->yBlinkCursor = (int) ((double) CURSOR_HEIGHT * data->backScale); data->yBlinkCursor = (int) ((double) CURSOR_HEIGHT * data->backScale);
data->yNoBlinkCursor = data->yBackTile; data->yNoBlinkCursor = data->yBackTile;
+8 -2
View File
@@ -34,6 +34,7 @@ typedef struct mswin_menu_item {
int attr; int attr;
char str[NHMENU_STR_SIZE]; char str[NHMENU_STR_SIZE];
BOOLEAN_P presel; BOOLEAN_P presel;
unsigned int itemflags;
int count; int count;
BOOL has_focus; BOOL has_focus;
} NHMenuItem, *PNHMenuItem; } NHMenuItem, *PNHMenuItem;
@@ -627,6 +628,7 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
/* prevent & being interpreted as a mnemonic start */ /* prevent & being interpreted as a mnemonic start */
strNsubst(data->menu.items[new_item].str, "&", "&&", 0); strNsubst(data->menu.items[new_item].str, "&", "&&", 0);
data->menu.items[new_item].presel = msg_data->presel; data->menu.items[new_item].presel = msg_data->presel;
data->menu.items[new_item].itemflags = msg_data->itemflags;
/* calculate tabstop size */ /* calculate tabstop size */
hDC = GetDC(hWnd); hDC = GetDC(hWnd);
@@ -1304,7 +1306,9 @@ onListChar(HWND hWnd, HWND hwndList, WORD ch)
if (data->how == PICK_ANY) { if (data->how == PICK_ANY) {
reset_menu_count(hwndList, data); reset_menu_count(hwndList, data);
for (i = 0; i < data->menu.size; i++) { for (i = 0; i < data->menu.size; i++) {
SelectMenuItem(hwndList, data, i, if (menuitem_invert_test(0, data->menu.items[i].itemflags,
NHMENU_IS_SELECTED(data->menu.items[i])))
SelectMenuItem(hwndList, data, i,
NHMENU_IS_SELECTED(data->menu.items[i]) ? 0 NHMENU_IS_SELECTED(data->menu.items[i]) ? 0
: -1); : -1);
} }
@@ -1351,7 +1355,9 @@ onListChar(HWND hWnd, HWND hwndList, WORD ch)
from = max(0, topIndex); from = max(0, topIndex);
to = min(data->menu.size, from + pageSize); to = min(data->menu.size, from + pageSize);
for (i = from; i < to; i++) { for (i = from; i < to; i++) {
SelectMenuItem(hwndList, data, i, if (menuitem_invert_test(0, data->menu.items[i].itemflags,
NHMENU_IS_SELECTED(data->menu.items[i])))
SelectMenuItem(hwndList, data, i,
NHMENU_IS_SELECTED(data->menu.items[i]) ? 0 NHMENU_IS_SELECTED(data->menu.items[i]) ? 0
: -1); : -1);
} }
+1
View File
@@ -53,6 +53,7 @@ typedef struct mswin_nhmsg_add_menu {
int attr; int attr;
const char *str; const char *str;
BOOLEAN_P presel; BOOLEAN_P presel;
unsigned int itemflags;
} MSNHMsgAddMenu, *PMSNHMsgAddMenu; } MSNHMsgAddMenu, *PMSNHMsgAddMenu;
typedef struct mswin_nhmsg_cursor { typedef struct mswin_nhmsg_cursor {
+18 -16
View File
@@ -429,7 +429,7 @@ prompt_for_player_selection(void)
Strcpy(rolenamebuf, roles[i].name.m); Strcpy(rolenamebuf, roles[i].name.m);
} }
add_menu(win, NO_GLYPH, &any, thisch, 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, thisch, 0, ATR_NONE,
an(rolenamebuf), MENU_UNSELECTED); an(rolenamebuf), MENU_ITEMFLAGS_NONE);
lastch = thisch; lastch = thisch;
} }
} }
@@ -438,10 +438,10 @@ prompt_for_player_selection(void)
if (any.a_int == 0) /* must be non-zero */ if (any.a_int == 0) /* must be non-zero */
any.a_int = randrole(FALSE) + 1; any.a_int = randrole(FALSE) + 1;
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
any.a_int = i + 1; /* must be non-zero */ any.a_int = i + 1; /* must be non-zero */
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
Sprintf(pbuf, "Pick a role for your %s", plbuf); Sprintf(pbuf, "Pick a role for your %s", plbuf);
end_menu(win, pbuf); end_menu(win, pbuf);
n = select_menu(win, PICK_ONE, &selected); n = select_menu(win, PICK_ONE, &selected);
@@ -504,17 +504,17 @@ prompt_for_player_selection(void)
flags.initalign)) { flags.initalign)) {
any.a_int = i + 1; /* must be non-zero */ any.a_int = i + 1; /* must be non-zero */
add_menu(win, NO_GLYPH, &any, races[i].noun[0], 0, add_menu(win, NO_GLYPH, &any, races[i].noun[0], 0,
ATR_NONE, races[i].noun, MENU_UNSELECTED); ATR_NONE, races[i].noun, MENU_ITEMFLAGS_NONE);
} }
any.a_int = pick_race(flags.initrole, flags.initgend, any.a_int = pick_race(flags.initrole, flags.initgend,
flags.initalign, PICK_RANDOM) + 1; flags.initalign, PICK_RANDOM) + 1;
if (any.a_int == 0) /* must be non-zero */ if (any.a_int == 0) /* must be non-zero */
any.a_int = randrace(flags.initrole) + 1; any.a_int = randrace(flags.initrole) + 1;
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
any.a_int = i + 1; /* must be non-zero */ any.a_int = i + 1; /* must be non-zero */
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
Sprintf(pbuf, "Pick the race of your %s", plbuf); Sprintf(pbuf, "Pick the race of your %s", plbuf);
end_menu(win, pbuf); end_menu(win, pbuf);
n = select_menu(win, PICK_ONE, &selected); n = select_menu(win, PICK_ONE, &selected);
@@ -578,17 +578,17 @@ prompt_for_player_selection(void)
flags.initalign)) { flags.initalign)) {
any.a_int = i + 1; any.a_int = i + 1;
add_menu(win, NO_GLYPH, &any, genders[i].adj[0], 0, add_menu(win, NO_GLYPH, &any, genders[i].adj[0], 0,
ATR_NONE, genders[i].adj, MENU_UNSELECTED); ATR_NONE, genders[i].adj, MENU_ITEMFLAGS_NONE);
} }
any.a_int = pick_gend(flags.initrole, flags.initrace, any.a_int = pick_gend(flags.initrole, flags.initrace,
flags.initalign, PICK_RANDOM) + 1; flags.initalign, PICK_RANDOM) + 1;
if (any.a_int == 0) /* must be non-zero */ if (any.a_int == 0) /* must be non-zero */
any.a_int = randgend(flags.initrole, flags.initrace) + 1; any.a_int = randgend(flags.initrole, flags.initrace) + 1;
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
any.a_int = i + 1; /* must be non-zero */ any.a_int = i + 1; /* must be non-zero */
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
Sprintf(pbuf, "Pick the gender of your %s", plbuf); Sprintf(pbuf, "Pick the gender of your %s", plbuf);
end_menu(win, pbuf); end_menu(win, pbuf);
n = select_menu(win, PICK_ONE, &selected); n = select_menu(win, PICK_ONE, &selected);
@@ -651,17 +651,17 @@ prompt_for_player_selection(void)
flags.initgend, i)) { flags.initgend, i)) {
any.a_int = i + 1; any.a_int = i + 1;
add_menu(win, NO_GLYPH, &any, aligns[i].adj[0], 0, add_menu(win, NO_GLYPH, &any, aligns[i].adj[0], 0,
ATR_NONE, aligns[i].adj, MENU_UNSELECTED); ATR_NONE, aligns[i].adj, MENU_ITEMFLAGS_NONE);
} }
any.a_int = pick_align(flags.initrole, flags.initrace, any.a_int = pick_align(flags.initrole, flags.initrace,
flags.initgend, PICK_RANDOM) + 1; flags.initgend, PICK_RANDOM) + 1;
if (any.a_int == 0) /* must be non-zero */ if (any.a_int == 0) /* must be non-zero */
any.a_int = randalign(flags.initrole, flags.initrace) + 1; any.a_int = randalign(flags.initrole, flags.initrace) + 1;
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random", add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
any.a_int = i + 1; /* must be non-zero */ any.a_int = i + 1; /* must be non-zero */
add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit", add_menu(win, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
MENU_UNSELECTED); MENU_ITEMFLAGS_NONE);
Sprintf(pbuf, "Pick the alignment of your %s", plbuf); Sprintf(pbuf, "Pick the alignment of your %s", plbuf);
end_menu(win, pbuf); end_menu(win, pbuf);
n = select_menu(win, PICK_ONE, &selected); n = select_menu(win, PICK_ONE, &selected);
@@ -1095,7 +1095,7 @@ mswin_start_menu(winid wid)
/* /*
add_menu(windid window, int glyph, const anything identifier, add_menu(windid window, int glyph, const anything identifier,
char accelerator, char groupacc, char accelerator, char groupacc,
int attr, char *str, boolean preselected) int attr, char *str, unsigned int itemflags)
-- Add a text line str to the given menu window. If -- Add a text line str to the given menu window. If
identifier identifier
is 0, then the line cannot be selected (e.g. a title). is 0, then the line cannot be selected (e.g. a title).
@@ -1127,11 +1127,12 @@ identifier
void void
mswin_add_menu(winid wid, int glyph, const ANY_P *identifier, mswin_add_menu(winid wid, int glyph, const ANY_P *identifier,
CHAR_P accelerator, CHAR_P group_accel, int attr, CHAR_P accelerator, CHAR_P group_accel, int attr,
const char *str, BOOLEAN_P presel) const char *str, unsigned int itemflags)
{ {
logDebug("mswin_add_menu(%d, %d, %p, %c, %c, %d, %s, %d)\n", wid, glyph, boolean presel = ((itemflags & MENU_ITEMFLAGS_SELECTED) != 0);
logDebug("mswin_add_menu(%d, %d, %p, %c, %c, %d, %s, %u)\n", wid, glyph,
identifier, (char) accelerator, (char) group_accel, attr, str, identifier, (char) accelerator, (char) group_accel, attr, str,
presel); itemflags);
if ((wid >= 0) && (wid < MAXWINDOWS) if ((wid >= 0) && (wid < MAXWINDOWS)
&& (GetNHApp()->windowlist[wid].win != NULL)) { && (GetNHApp()->windowlist[wid].win != NULL)) {
MSNHMsgAddMenu data; MSNHMsgAddMenu data;
@@ -1143,6 +1144,7 @@ mswin_add_menu(winid wid, int glyph, const ANY_P *identifier,
data.attr = attr; data.attr = attr;
data.str = str; data.str = str;
data.presel = presel; data.presel = presel;
data.itemflags = itemflags;
SendMessage(GetNHApp()->windowlist[wid].win, WM_MSNH_COMMAND, SendMessage(GetNHApp()->windowlist[wid].win, WM_MSNH_COMMAND,
(WPARAM) MSNH_MSG_ADDMENU, (LPARAM) &data); (WPARAM) MSNH_MSG_ADDMENU, (LPARAM) &data);
+3 -1
View File
@@ -128,6 +128,7 @@
<ClCompile Include="$(SrcDir)makemon.c" /> <ClCompile Include="$(SrcDir)makemon.c" />
<ClCompile Include="$(SrcDir)mapglyph.c" /> <ClCompile Include="$(SrcDir)mapglyph.c" />
<ClCompile Include="$(SrcDir)mcastu.c" /> <ClCompile Include="$(SrcDir)mcastu.c" />
<ClCompile Include="$(SrcDir)mdlib.c" />
<ClCompile Include="$(SrcDir)mhitm.c" /> <ClCompile Include="$(SrcDir)mhitm.c" />
<ClCompile Include="$(SrcDir)mhitu.c" /> <ClCompile Include="$(SrcDir)mhitu.c" />
<ClCompile Include="$(SrcDir)minion.c" /> <ClCompile Include="$(SrcDir)minion.c" />
@@ -144,8 +145,9 @@
<ClCompile Include="$(SrcDir)mthrowu.c" /> <ClCompile Include="$(SrcDir)mthrowu.c" />
<ClCompile Include="$(SrcDir)muse.c" /> <ClCompile Include="$(SrcDir)muse.c" />
<ClCompile Include="$(SrcDir)music.c" /> <ClCompile Include="$(SrcDir)music.c" />
<ClCompile Include="$(SrcDir)nhlua.c" /> <ClCompile Include="$(SrcDir)nhlobj.c" />
<ClCompile Include="$(SrcDir)nhlsel.c" /> <ClCompile Include="$(SrcDir)nhlsel.c" />
<ClCompile Include="$(SrcDir)nhlua.c" />
<ClCompile Include="$(SrcDir)objects.c" /> <ClCompile Include="$(SrcDir)objects.c" />
<ClCompile Include="$(SrcDir)objnam.c" /> <ClCompile Include="$(SrcDir)objnam.c" />
<ClCompile Include="$(SrcDir)options.c" /> <ClCompile Include="$(SrcDir)options.c" />
+3 -1
View File
@@ -122,6 +122,7 @@
<ClCompile Include="$(SrcDir)makemon.c" /> <ClCompile Include="$(SrcDir)makemon.c" />
<ClCompile Include="$(SrcDir)mapglyph.c" /> <ClCompile Include="$(SrcDir)mapglyph.c" />
<ClCompile Include="$(SrcDir)mcastu.c" /> <ClCompile Include="$(SrcDir)mcastu.c" />
<ClCompile Include="$(SrcDir)mdlib.c" />
<ClCompile Include="$(SrcDir)mhitm.c" /> <ClCompile Include="$(SrcDir)mhitm.c" />
<ClCompile Include="$(SrcDir)mhitu.c" /> <ClCompile Include="$(SrcDir)mhitu.c" />
<ClCompile Include="$(SrcDir)minion.c" /> <ClCompile Include="$(SrcDir)minion.c" />
@@ -138,8 +139,9 @@
<ClCompile Include="$(SrcDir)mthrowu.c" /> <ClCompile Include="$(SrcDir)mthrowu.c" />
<ClCompile Include="$(SrcDir)muse.c" /> <ClCompile Include="$(SrcDir)muse.c" />
<ClCompile Include="$(SrcDir)music.c" /> <ClCompile Include="$(SrcDir)music.c" />
<ClCompile Include="$(SrcDir)nhlua.c" /> <ClCompile Include="$(SrcDir)nhlobj.c" />
<ClCompile Include="$(SrcDir)nhlsel.c" /> <ClCompile Include="$(SrcDir)nhlsel.c" />
<ClCompile Include="$(SrcDir)nhlua.c" />
<ClCompile Include="$(SrcDir)objects.c" /> <ClCompile Include="$(SrcDir)objects.c" />
<ClCompile Include="$(SrcDir)objnam.c" /> <ClCompile Include="$(SrcDir)objnam.c" />
<ClCompile Include="$(SrcDir)options.c" /> <ClCompile Include="$(SrcDir)options.c" />
+1 -1
View File
@@ -155,7 +155,7 @@ void mswin_display_file(const char *filename, BOOLEAN_P must_exist);
void mswin_start_menu(winid wid); void mswin_start_menu(winid wid);
void mswin_add_menu(winid wid, int glyph, const ANY_P *identifier, void mswin_add_menu(winid wid, int glyph, const ANY_P *identifier,
CHAR_P accelerator, CHAR_P group_accel, int attr, CHAR_P accelerator, CHAR_P group_accel, int attr,
const char *str, BOOLEAN_P presel); const char *str, unsigned int itemflags);
void mswin_end_menu(winid wid, const char *prompt); void mswin_end_menu(winid wid, const char *prompt);
int mswin_select_menu(winid wid, int how, MENU_ITEM_P **selected); int mswin_select_menu(winid wid, int how, MENU_ITEM_P **selected);
void mswin_update_inventory(void); void mswin_update_inventory(void);