Merge branch 'NetHack-3.6.2-beta01' into NetHack-3.6.2

This commit is contained in:
nhmall
2018-10-25 17:53:31 -04:00
18 changed files with 1295 additions and 479 deletions

View File

@@ -1047,7 +1047,15 @@ used up all the letters, so this is a way to introduce the less frequently
used commands.
What extended commands are available depends on what features the game was
compiled with.
.lp #adjust
.\"
.\" Pad short entries out to 1+8 characters. This will make sure that
.\" the text description starts on its own line like long named entries
.\" instead of sometimes being on the same line for short name ones.
.\" The document will be longer, but mixing the two is harder to read.
.\" (For plain text output, the old 1+4 was sufficient. For Postscript,
.\" several need at least 1+7 due to narrow letters or ligatures.)
.\"
.lp "#adjust "
Adjust inventory letters (most useful when the
.op fixinv
option is \(lqon\(rq).
@@ -1089,7 +1097,7 @@ Autocompletes.
Default key is \(oqM-A\(cq, and also \(oq\(haN\(cq if
.op number_pad
is on.
.lp #apply
.lp "#apply "
Apply (use) a tool such as a pick-axe, a key, or a lamp.
Default key is \(oqa\(cq.
.lp ""
@@ -1107,70 +1115,70 @@ Toggle the
.op autopickup
option on/off.
Default key is \(oq@\(cq.
.lp #call
.lp "#call "
Call (name) a monster, or an object in inventory, on the floor,
or in the discoveries list, or add an annotation for the
current level (same as \(lq#annotate\(rq).
Default key is \(oqC\(cq.
.lp #cast
.lp "#cast "
Cast a spell.
Default key is \(oqZ\(cq.
.lp #chat
.lp "#chat "
Talk to someone.
Default key is \(oqM-c\)cq.
.lp #close
.lp "#close "
Close a door.
Default key is \(oqc\(cq.
.lp #conduct
.lp "#conduct "
List voluntary challenges you have maintained.
Autocompletes.
Default key is \(oqM-C\(cq.
.lp ""
See the section below entitled \(lqConduct\(rq for details.
.lp "#dip "
.lp "#dip "
Dip an object into something.
Autocompletes.
Default key is \(oqM-d\(cq.
.lp #down
.lp "#down "
Go down a staircase.
Default key is \(oq>\(cq.
.lp #drop
.lp "#drop "
Drop an item.
Default key is \(oqd\(cq.
.lp #droptype
Drop specific item types.
Default key is \(oqD\(cq.
.lp "#eat "
.lp "#eat "
Eat something.
Default key is \(oqe\(cq.
The \(oqm\(cq prefix skips eating items on the floor.
.lp #engrave
.lp "#engrave "
Engrave writing on the floor.
Default key is \(oqE\(cq.
.lp #enhance
.lp "#enhance "
Advance or check weapon and spell skills.
Autocompletes.
Default key is \(oqM-e\(cq.
.lp #exploremode
Enter the explore mode.
.lp #fire
.lp "#fire "
Fire ammunition from quiver.
Default key is \(oqf\(cq.
.lp #force
.lp "#force "
Force a lock.
Autocompletes.
Default key is \(oqM-f\(cq.
.lp #glance
.lp "#glance "
Show what type of thing a map symbol corresponds to.
Default key is \(oq;\(cq.
.lp #help
.lp "#help "
Show the help menu.
Default key is \(oq?\(cq, and also \(oqh\(cq if
.op number_pad
is on.
.lp #herecmdmenu
Show a menu of possible actions in your current location.
.lp #history
.lp "#history "
Show long version and game history.
Default key is \(oqV\(cq.
.lp #inventory
@@ -1179,22 +1187,22 @@ Default key is \(oqi\(cq.
.lp #inventtype
Inventory specific item types.
Default key is \(oqI\(cq.
.lp #invoke
.lp "#invoke "
Invoke an object's special powers.
Autocompletes.
Default key is \(oqM-i\(cq.
.lp #jump
.lp "#jump "
Jump to another location.
Autocompletes.
Default key is \(oqM-j\(cq, and also \(oqj\(cq if
.op number_pad
is on.
.lp #kick
.lp "#kick "
Kick something.
Default key is \(oq\(haD\(cq, and \(oqk\(cq if
.op number_pad
is on.
.lp #known
.lp "#known "
Show what object types have been discovered.
Default key is \(oq\\\(cq.
.lp #knownclass
@@ -1208,10 +1216,10 @@ Debug mode only.
Show mobile light sources.
Autocompletes.
Debug mode only.
.lp #look
.lp "#look "
Look at what is here, under you.
Default key is \(oq:\(cq.
.lp #loot
.lp "#loot "
Loot a box or bag on the floor beneath you, or the saddle
from a steed standing next to you.
Autocompletes.
@@ -1220,18 +1228,16 @@ and go directly to removing a saddle.
Default key is \(oqM-l\(cq, and also \(oql\(cq if
.op number_pad
is on.
.lp #monster
.lp "#monster "
Use a monster's special ability (when polymorphed into monster form).
Autocompletes.
Default key is \(oqM-m\(cq.
.lp #name
.lp "#name "
Name a monster, an individual object, or a type of object.
Same as \(lq#call\(rq.
Autocompletes.
Default keys are \(oqN\(cq, \(oqM-n\(cq, and \(oqM-N\(cq.
.\".lp #offer \" `ff' ligature is narrow enough that text fits on same line
.\" \" as #offer but that looks bad because it is too close to 'r'
.lp "#offer "
.lp "#offer " \" `ff' ligature is narrow
Offer a sacrifice to the gods.
Autocompletes.
Default key is \(oqM-o\(cq.
@@ -1240,11 +1246,10 @@ You'll need to find an altar to have any chance at success.
Corpses of recently killed monsters are the fodder of choice.
.lp ""
The \(oqm\(cq prefix skips offering any items which are on the altar.
.\".lp #open \" there's no ligature here, but text ends up too close to #open
.lp "#open "
.lp "#open "
Open a door.
Default key is \(oqo\(cq.
.lp #options
.lp "#options "
Show and change option settings.
Default key is \(oqO\(cq.
.lp #overview
@@ -1258,15 +1263,15 @@ level will be included regardless of annotations.
Autocompletes.
Default keys are \(oq\(haO\(cq, and \(oqM-O\(cq.
.\" DON'T PANIC!
.lp #panic
.lp "#panic "
Test the panic routine.
Terminates the current game.
Autocompletes.
Debug mode only.
.lp "#pay "
.lp "#pay "
Pay your shopping bill.
Default key is \(oqp\(cq.
.lp #pickup
.lp "#pickup "
Pick up things at the current location.
Default key is \(oq,\(cq.
The \(oqm\(cq prefix forces use of a menu.
@@ -1274,7 +1279,7 @@ The \(oqm\(cq prefix forces use of a menu.
Polymorph self.
Autocompletes.
Debug mode only.
.lp #pray
.lp "#pray "
Pray to the gods for help.
Autocompletes.
Default key is \(oqM-p\(cq.
@@ -1287,16 +1292,16 @@ option to make you confirm your intent before praying.
It is enabled by default, and you can reset the
.op paranoid_confirmation
option to disable it.
.lp #prevmsg
.lp "#prevmsg "
Show previously displayed game messages.
Default key is \(oq\(haP\(cq.
.lp #puton
.lp "#puton "
Put on an accessory (ring, amulet, etc).
Default key is \(oqP\(cq.
.lp #quaff
.lp "#quaff "
Quaff (drink) something.
Default key is \(oqq\(cq.
.lp #quit
.lp "#quit "
Quit the program without saving your game.
Autocompletes.
Default key is \(oqM-q\(cq.
@@ -1307,35 +1312,35 @@ By default a response of \(oqy\(cq acknowledges that intent.
You can set the
.op paranoid_confirmation
option to require a response of \(lqyes\(rq instead.
.lp #quiver
.lp "#quiver "
Select ammunition for quiver.
Default key is \(oqQ\(cq.
.lp #read
.lp "#read "
Read a scroll, a spellbook, or something else.
Default key is \(oqr\(cq.
.lp #redraw
.lp "#redraw "
Redraw the screen.
Default key is \(oq\(haR\(cq, and also \(oq\(haL\(cq if
.op number_pad
is on.
.lp #remove
.lp "#remove "
Remove an accessory (ring, amulet, etc).
Default key is \(oqR\(cq.
.lp #ride
.lp "#ride "
Ride (or stop riding) a saddled creature.
Autocompletes.
Default key is \(oqM-R\(cq.
.lp "#rub "
.lp "#rub "
Rub a lamp or a stone.
Autocompletes.
Default key is \(oqM-r\(cq.
.lp #save
.lp "#save "
Save the game and exit the program.
Default key is \(oqS\(cq.
.lp #search
.lp "#search "
Search for traps and secret doors around you.
Default key is \(oqs\(cq.
.lp #seeall
.lp "#seeall "
Show all equipment in use.
Default key is \(oq*\(cq.
.lp #seeamulet
@@ -1344,10 +1349,10 @@ Default key is \(oq\(dq\(cq. \" double quote
.lp #seearmor
Show the armor currently worn.
Default key is \(oq[\(cq.
.lp #seegold
.lp "#seegold "
Count your gold.
Default key is \(oq$\(cq.
.lp #seenv
.lp "#seenv "
Show seen vectors.
Autocompletes.
Debug mode only.
@@ -1360,30 +1365,30 @@ Default key is \(oq+\(cq.
.lp #seetools
Show the tools currently in use.
Default key is \(oq(\(cq.
.lp #seetrap
.lp "#seetrap "
Show the type of an adjacent trap.
Default key is \(oq\(ha\(cq. \" 'hat' (circumflex character)
.lp #seeweapon
Show the weapon currently wielded.
Default key is \(oq)\(cq.
.lp #shell
.lp "#shell "
Do a shell escape.
Default key is \(oq!\(cq.
.lp "#sit "
.lp "#sit "
Sit down.
Autocompletes.
Default key is \(oqM-s\(cq.
.lp #stats
.lp "#stats "
Show memory usage statistics.
Autocompletes.
Debug mode only.
.lp #suspend
.lp "#suspend "
Suspend the game.
Default key is \(oq\(haZ\(cq.
.lp #swap
.lp "#swap "
Swap wielded and secondary weapons.
Default key is \(oqx\(cq.
.lp #takeoff
.lp "#takeoff "
Take off one piece of armor.
Default key is \(oqT\(cq.
.lp #takeoffall
@@ -1392,24 +1397,24 @@ Default key is \(oqA\(cq.
.lp #teleport
Teleport around the level.
Default key is \(oq\(haT\(cq.
.lp #terrain
.lp "#terrain "
Show bare map without displaying monsters, objects, or traps.
Autocompletes.
.lp #therecmdmenu
Show a menu of possible actions in a location next to you.
.lp #throw
.lp "#throw "
Throw something.
Default key is \(oqt\(cq.
.lp #timeout
.lp "#timeout "
Look at the timeout queue.
Autocompletes.
Debug mode only.
.lp "#tip "
.lp "#tip "
Tip over a container (bag or box) to pour out its contents.
Autocompletes.
Default key is \(oqM-T\(cq.
The \(oqm\(cq prefix makes the command use a menu.
.lp #travel
.lp "#travel "
Travel to a specific location on the map.
Default key is \(oq_\(cq. \" underscore
Using the \(lqrequest menu\(rq prefix shows a menu of interesting targets
@@ -1418,7 +1423,7 @@ When picking a target with cursor and the
.op autodescribe
option is on, the top line will show \(lq(no travel path)\(rq if
your character does not know of a path to that location.
.lp #turn
.lp "#turn "
Turn undead away.
Autocompletes.
Default key is \(oqM-t\(cq.
@@ -1432,53 +1437,53 @@ is off.
Note that you must
use suitable weapons for this type of combat, or it will
be automatically turned off.
.lp #untrap
.lp "#untrap "
Untrap something (trap, door, or chest).
Default key is \(oqM-u\(cq, and \(oqu\(cq if
.op number_pad
is on.
.lp ""
In some circumstances it can also be used to rescue trapped monsters.
.lp "#up "
.lp "#up "
Go up a staircase.
Default key is \(oq<\(cq.
.lp #vanquished
List vanquished monsters.
Autocompletes.
Debug mode only.
.lp #version
.lp "#version "
Print compile time options for this version of NetHack.
Autocompletes.
Default key is \(oqM-v\(cq.
.lp #versionshort
Show version string.
Default key is \(oqv\(cq.
.lp #vision
.lp "#vision "
Show vision array.
Autocompletes.
Debug mode only.
.lp #wait
.lp "#wait "
Rest one move while doing nothing.
Default key is \(oq.\(cq, and also \(oq\ \(cq if
.op rest_on_space
is on.
.lp #wear
.lp "#wear "
Wear a piece of armor.
Default key is \(oqW\(cq.
.lp #whatdoes
Tell what a key does.
Default key is \(oq&\(cq.
.lp #whatis
.lp "#whatis "
Show what type of thing a symbol corresponds to.
Default key is \(oq/\(cq.
.lp #wield
.lp "#wield "
Wield a weapon.
Default key is \(oqw\(cq.
.lp #wipe
.lp "#wipe "
Wipe off your face.
Autocompletes.
Default key is \(oqM-w\(cq.
.lp #wizbury
.lp "#wizbury "
Bury objects under and around you.
Autocompletes.
Debug mode only.
@@ -1508,7 +1513,7 @@ Teleport to another level.
Autocompletes.
Debug mode only.
Default key is \(oq\(haV\(cq.
.lp #wizmap
.lp "#wizmap "
Map the level.
Autocompletes.
Debug mode only.
@@ -1525,19 +1530,19 @@ Debug mode only.
Show locations of special levels.
Autocompletes.
Debug mode only.
.lp #wizwish
.lp "#wizwish "
Wish for something.
Autocompletes.
Debug mode only.
Default key is \(oq\(haW\(cq.
.lp #wmode
.lp "#wmode "
Show wall modes.
Autocompletes.
Debug mode only.
.lp "#zap "
.lp "#zap "
Zap a wand.
Default key is \(oqz\(cq.
.lp "#? "
.lp "#? "
Help menu: get the list of available extended commands.
.lp ""
.pg

View File

@@ -1335,12 +1335,15 @@
#offer
Offer a sacrifice to the gods. Autocompletes. Default key
is `M-o'. The `m' prefix skips offering items on the altar.
is `M-o'.
You'll need to find an altar to have any chance at success.
Corpses of recently killed monsters are the fodder of
You'll need to find an altar to have any chance at success.
Corpses of recently killed monsters are the fodder of
choice.
The `m' prefix skips offering any items which are on the al-
tar.
#open
Open a door. Default key is `o'.
@@ -1375,9 +1378,6 @@
Pray to the gods for help. Autocompletes. Default key is
`M-p'.
Praying too soon after receiving prior help is a bad idea.
(Hint: entering the dungeon alive is treated as having re-
ceived help. You probably shouldn't start off a new game by
NetHack 3.6 October 16, 2018
@@ -1390,6 +1390,9 @@
Praying too soon after receiving prior help is a bad idea.
(Hint: entering the dungeon alive is treated as having re-
ceived help. You probably shouldn't start off a new game by
praying right away.) Since using this command by accident
can cause trouble, there is an option to make you confirm
your intent before praying. It is enabled by default, and
@@ -1440,9 +1443,6 @@
Rub a lamp or a stone. Autocompletes. Default key is `M-
r'.
#save
Save the game and exit the program. Default key is `S'.
@@ -1456,6 +1456,9 @@
#save
Save the game and exit the program. Default key is `S'.
#search
Search for traps and secret doors around you. Default key
is `s'.
@@ -1506,9 +1509,6 @@
#swap
Swap wielded and secondary weapons. Default key is `x'.
#takeoff
Take off one piece of armor. Default key is `T'.
@@ -1522,6 +1522,9 @@
#takeoff
Take off one piece of armor. Default key is `T'.
#takeoffall
Remove all armor. Default key is `A'.
@@ -1574,9 +1577,6 @@
#up
Go up a staircase. Default key is `<'.
#vanquished
List vanquished monsters. Autocompletes. Debug mode only.
NetHack 3.6 October 16, 2018
@@ -1588,6 +1588,9 @@
#vanquished
List vanquished monsters. Autocompletes. Debug mode only.
#version
Print compile time options for this version of NetHack. Au-
tocompletes. Default key is `M-v'.
@@ -1640,9 +1643,6 @@
Set one or more intrinsic attributes. Autocompletes. Debug
mode only.
#wizlevelport
Teleport to another level. Autocompletes. Debug mode only.
NetHack 3.6 October 16, 2018
@@ -1654,6 +1654,8 @@
#wizlevelport
Teleport to another level. Autocompletes. Debug mode only.
Default key is `^V'.
#wizmap
@@ -1705,8 +1707,6 @@
M-A #annotate
M-c #chat
@@ -1720,6 +1720,8 @@
M-c #chat
M-C #conduct
M-d #dip
@@ -1771,8 +1773,6 @@
j #jump
k #kick
@@ -1786,6 +1786,8 @@
k #kick
l #loot
N #name
@@ -1838,8 +1840,6 @@
There is a special pre-mapped branch of the dungeon based on
the classic computer game "Sokoban." The goal is to push the
boulders into the pits or holes. With careful foresight, it is
possible to complete all of the levels according to the
NetHack 3.6 October 16, 2018
@@ -1852,8 +1852,10 @@
traditional rules of Sokoban. Some allowances are permitted in
case the player gets stuck; however, they will lower your luck.
boulders into the pits or holes. With careful foresight, it is
possible to complete all of the levels according to the tradi-
tional rules of Sokoban. Some allowances are permitted in case
the player gets stuck; however, they will lower your luck.
5.3. Stairs and ladders (`<', `>')
@@ -1904,8 +1906,6 @@
floor while inside a shop. You will either be offered an amount
of gold and asked whether you're willing to sell, or you'll be
told that the shopkeeper isn't interested (generally, your item
needs to be compatible with the type of merchandise carried by
the shop).
NetHack 3.6 October 16, 2018
@@ -1918,6 +1918,9 @@
needs to be compatible with the type of merchandise carried by
the shop).
If you drop something in a shop by accident, the shopkeeper
will usually claim ownership without offering any compensation.
You'll have to buy it back if you want to reclaim it.
@@ -1970,9 +1973,6 @@
from another when multiple monsters are present. Assigning a
name which is just a space will remove any prior name.
The extended command "#chat" can be used to interact with an
adjacent monster. There is no actual dialog (in other words, you
NetHack 3.6 October 16, 2018
@@ -1984,6 +1984,8 @@
The extended command "#chat" can be used to interact with an
adjacent monster. There is no actual dialog (in other words, you
don't get to choose what you'll say), but chatting with some mon-
sters such as a shopkeeper or the Oracle of Delphi can produce
useful results.
@@ -2038,8 +2040,6 @@
with it even if adjacent at the time.
NetHack 3.6 October 16, 2018
@@ -4852,8 +4852,7 @@
and ride, and "all" for every condition.
Allowed behaviors are "always", "up", "down", "changed", a per-
centage or absolute number threshold, or a text to match
against.
centage or absolute number threshold, or text to match against.
* "always" will set the default attributes for that field.
@@ -4878,6 +4877,7 @@
points" fields.
NetHack 3.6 October 16, 2018

View File

@@ -171,6 +171,7 @@ overview information for former hero was not being set properly when bones
in Guidebook.mn and Guidebook.txt, the 'I' command mis-described `IX' as
displaying inventory items whose bless/curse state is "known"
(Guidebook.tex correctly had "unknown")
poison gas (stinking cloud) wasn't shown at drawbridge-up spot
Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository

View File

@@ -145,6 +145,7 @@ E int NDECL(getbones);
/* ### botl.c ### */
E const char *FDECL(bl_idx_to_fldname, (int));
E char *NDECL(do_statusline1);
E void NDECL(check_gold_symbol);
E char *NDECL(do_statusline2);

View File

@@ -153,12 +153,7 @@ struct menu_info_t {
struct menu curr_menu; /* Menu being displayed. */
struct menu new_menu; /* New menu being built. */
boolean nh_colors_inited;
XColor nh_colors[CLR_MAX];
XFontStruct *fs; /* Font for the window. */
XFontStruct *boldfs; /* Bold font */
Display *boldfs_dpy;
long menu_count; /* number entered by user */
Dimension line_height; /* Total height of a line of text. */
Dimension internal_height; /* Internal height between widget & border */
@@ -203,6 +198,11 @@ struct xwindow {
int prevx, cursx; /* Cursor position, only used by */
int prevy, cursy; /* map and "plain" status windows.*/
boolean nh_colors_inited;
XColor nh_colors[CLR_MAX];
XFontStruct *boldfs; /* Bold font */
Display *boldfs_dpy; /* Bold font display */
union {
struct map_info_t *Map_info; /* map window info */
struct mesg_info_t *Mesg_info; /* message window info */
@@ -254,6 +254,7 @@ E boolean plsel_ask_name;
typedef struct {
Boolean slow; /* issue prompts between map and message wins */
Boolean fancy_status; /* use "fancy" status vs. TTY-style status */
Boolean autofocus; /* grab pointer focus for popup windows */
Boolean message_line; /* separate current turn mesgs from prev ones */
Boolean highlight_prompt; /* if 'slow', highlight yn prompts */
@@ -297,6 +298,9 @@ E void FDECL(positionpopup, (Widget, BOOLEAN_P));
/* ### winX.c ### */
E struct xwindow *FDECL(find_widget, (Widget));
E XColor FDECL(get_nhcolor, (struct xwindow *, int));
E void FDECL(init_menu_nhcolors, (struct xwindow *));
E void FDECL(load_boldfont, (struct xwindow *, Widget));
E Boolean FDECL(nhApproxColor, (Screen *, Colormap, char *, XColor *));
E void FDECL(get_widget_window_geometry, (Widget, int *, int *, int *, int *));
E char *FDECL(fontname_boldify, (const char *));
@@ -394,6 +398,8 @@ E void FDECL(hilight_value, (Widget));
E void FDECL(swap_fg_bg, (Widget));
/* external declarations */
E char *FDECL(X11_getmsghistory, (BOOLEAN_P));
E void FDECL(X11_putmsghistory, (const char *, BOOLEAN_P));
E void FDECL(X11_init_nhwindows, (int *, char **));
E void NDECL(X11_player_selection);
E void NDECL(X11_askname);
@@ -431,6 +437,10 @@ E void FDECL(X11_getlin, (const char *, char *));
E int NDECL(X11_get_ext_cmd);
E void FDECL(X11_number_pad, (int));
E void NDECL(X11_delay_output);
E void NDECL(X11_status_init);
E void NDECL(X11_status_finish);
E void FDECL(X11_status_enablefield, (int, const char *, const char *, BOOLEAN_P));
E void FDECL(X11_status_update, (int, genericptr_t, int, int, int, unsigned long *));
/* other defs that really should go away (they're tty specific) */
E void NDECL(X11_start_screen);

View File

@@ -1248,6 +1248,16 @@ static struct fieldid_t {
static const char threshold_value[] = "hilite_status threshold ",
is_out_of_range[] = " is out of range";
const char *
bl_idx_to_fldname(idx)
int idx;
{
if (idx >= 0 && idx < MAXBLSTATS)
return initblstats[idx].fldname;
return (const char *) 0;
}
/* field name to bottom line index */
STATIC_OVL enum statusfields
fldname_to_bl_indx(name)

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 display.c $NHDT-Date: 1525056598 2018/04/30 02:49:58 $ $NHDT-Branch: master $:$NHDT-Revision: 1.92 $ */
/* NetHack 3.6 display.c $NHDT-Date: 1540502147 2018/10/25 21:15:47 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.94 $ */
/* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */
/* and Dave Cohrs, 1990. */
/* NetHack may be freely redistributed. See license for details. */
@@ -512,6 +512,7 @@ warning_of(mon)
struct monst *mon;
{
int wl = 0, tmp = 0;
if (mon_warning(mon)) {
tmp = (int) (mon->m_lev / 4); /* match display.h */
wl = (tmp > WARNCOUNT - 1) ? WARNCOUNT - 1 : tmp;
@@ -755,38 +756,36 @@ register int x, y;
/* normal region shown only on accessible positions, but poison clouds
* also shown above lava, pools and moats.
*/
if (reg != NULL && (ACCESSIBLE(lev->typ)
|| (reg->glyph == cmap_to_glyph(S_poisoncloud)
&& (lev->typ == LAVAPOOL || lev->typ == POOL
|| lev->typ == MOAT)))) {
if (reg && (ACCESSIBLE(lev->typ)
|| (reg->glyph == cmap_to_glyph(S_poisoncloud)
&& is_pool_or_lava(x, y)))) {
show_region(reg, x, y);
return;
}
if (x == u.ux && y == u.uy) {
if (canspotself()) {
_map_location(x, y, 0); /* map *under* self */
int see_self = canspotself();
/* update map information for <u.ux,u.uy> (remembered topology
and object/known trap/terrain glyph) but only display it if
hero can't see him/herself, then show self if appropriate */
_map_location(x, y, !see_self);
if (see_self)
display_self();
} else
/* we can see what is there */
_map_location(x, y, 1);
} else {
mon = m_at(x, y);
worm_tail = is_worm_tail(mon);
see_it =
mon && (worm_tail ? (!mon->minvis || See_invisible)
: (mon_visible(mon)) || tp_sensemon(mon)
|| MATCH_WARN_OF_MON(mon));
see_it = mon && (mon_visible(mon)
|| (!worm_tail && (tp_sensemon(mon)
|| MATCH_WARN_OF_MON(mon))));
if (mon && (see_it || (!worm_tail && Detect_monsters))) {
if (mon->mtrapped) {
struct trap *trap = t_at(x, y);
int tt = trap ? trap->ttyp : NO_TRAP;
/* if monster is in a physical trap, you see the trap too
*/
if (tt == BEAR_TRAP || is_pit(tt)
|| tt == WEB) {
trap->tseen = TRUE;
}
/* if monster is in a physical trap, you see trap too */
if (tt == BEAR_TRAP || is_pit(tt) || tt == WEB)
trap->tseen = 1;
}
_map_location(x, y, 0); /* map under the monster */
/* also gets rid of any invisibility glyph */
@@ -795,7 +794,7 @@ register int x, y;
worm_tail);
} else if (mon && mon_warning(mon) && !is_worm_tail(mon)) {
display_warning(mon);
} else if (glyph_is_invisible(levl[x][y].glyph)) {
} else if (glyph_is_invisible(lev->glyph)) {
map_invisible(x, y);
} else
_map_location(x, y, 1); /* map the location */\
@@ -808,19 +807,17 @@ register int x, y;
if (canspotself())
display_self();
} else if ((mon = m_at(x, y))
} else if ((mon = m_at(x, y)) != 0
&& ((see_it = (tp_sensemon(mon) || MATCH_WARN_OF_MON(mon)
|| (see_with_infrared(mon)
&& mon_visible(mon))))
&& mon_visible(mon)))) != 0
|| Detect_monsters)) {
/* Monsters are printed every time. */
/* This also gets rid of any invisibility glyph */
/* Seen or sensed monsters are printed every time.
This also gets rid of any invisibility glyph. */
display_monster(x, y, mon, see_it ? 0 : DETECTED,
is_worm_tail(mon) ? TRUE : FALSE);
} else if ((mon = m_at(x, y)) && mon_warning(mon)
&& !is_worm_tail(mon)) {
} else if (mon && mon_warning(mon) && !is_worm_tail(mon)) {
display_warning(mon);
}
/*
* If the location is remembered as being both dark (waslit is false)
@@ -828,7 +825,6 @@ register int x, y;
*
* (1) A dark location that the hero could see through night
* vision.
*
* (2) Darkened while out of the hero's sight. This can happen
* when cursed scroll of light is read.
*
@@ -844,7 +840,7 @@ register int x, y;
* These checks and changes must be here and not in back_to_glyph().
* They are dependent on the position being out of sight.
*/
else if (Is_rogue_level(&u.uz)) {
} else if (Is_rogue_level(&u.uz)) {
if (lev->glyph == cmap_to_glyph(S_litcorr) && lev->typ == CORR)
show_glyph(x, y, lev->glyph = cmap_to_glyph(S_corr));
else if (lev->glyph == cmap_to_glyph(S_room) && lev->typ == ROOM
@@ -852,8 +848,7 @@ register int x, y;
show_glyph(x, y, lev->glyph = cmap_to_glyph(S_stone));
else
goto show_mem;
}
else if (!lev->waslit || (flags.dark_room && iflags.use_color)) {
} else if (!lev->waslit || (flags.dark_room && iflags.use_color)) {
if (lev->glyph == cmap_to_glyph(S_litcorr) && lev->typ == CORR)
show_glyph(x, y, lev->glyph = cmap_to_glyph(S_corr));
else if (lev->glyph == cmap_to_glyph(S_room) && lev->typ == ROOM)

View File

@@ -354,12 +354,14 @@ register struct monst *mtmp;
Strcpy(buf, y_monnam(mtmp));
buf[0] = highc(buf[0]);
You("stop. %s is in the way!", buf);
context.travel = context.travel1 = context.mv = context.run = 0;
context.travel = context.travel1 = context.mv = context.run
= 0;
return TRUE;
} else if ((mtmp->mfrozen || (!mtmp->mcanmove)
|| (mtmp->data->mmove == 0)) && rn2(6)) {
pline("%s doesn't seem to move!", Monnam(mtmp));
context.travel = context.travel1 = context.mv = context.run = 0;
context.travel = context.travel1 = context.mv = context.run
= 0;
return TRUE;
} else
return FALSE;
@@ -423,7 +425,7 @@ register struct monst *mtmp;
(void) hitum(mtmp, youmonst.data->mattk);
mtmp->mstrategy &= ~STRAT_WAITMASK;
atk_done:
atk_done:
/* see comment in attack_checks() */
/* we only need to check for this if we did an attack_checks()
* and it returned 0 (it's okay to attack), and the monster didn't
@@ -807,7 +809,8 @@ int dieroll;
silvermsg = TRUE;
silverobj = TRUE;
}
if (artifact_light(obj) && obj->lamplit && mon_hates_light(mon))
if (artifact_light(obj) && obj->lamplit
&& mon_hates_light(mon))
lightobj = TRUE;
if (u.usteed && !thrown && tmp > 0
&& weapon_type(obj) == P_LANCE && mon != u.ustuck) {
@@ -1550,6 +1553,7 @@ register struct attack *mattk;
register struct permonst *pd = mdef->data;
int armpro, tmp = d((int) mattk->damn, (int) mattk->damd);
boolean negated;
struct obj *mongold;
armpro = magic_negation(mdef);
/* since hero can't be cancelled, only defender's armor applies */
@@ -1689,18 +1693,16 @@ register struct attack *mattk;
case AD_SGLD:
/* This you as a leprechaun, so steal
real gold only, no lesser coins */
{
struct obj *mongold = findgold(mdef->minvent);
if (mongold) {
obj_extract_self(mongold);
if (merge_choice(invent, mongold) || inv_cnt(FALSE) < 52) {
addinv(mongold);
Your("purse feels heavier.");
} else {
You("grab %s's gold, but find no room in your knapsack.",
mon_nam(mdef));
dropy(mongold);
}
mongold = findgold(mdef->minvent);
if (mongold) {
obj_extract_self(mongold);
if (merge_choice(invent, mongold) || inv_cnt(FALSE) < 52) {
addinv(mongold);
Your("purse feels heavier.");
} else {
You("grab %s's gold, but find no room in your knapsack.",
mon_nam(mdef));
dropy(mongold);
}
}
exercise(A_DEX, TRUE);
@@ -1711,8 +1713,9 @@ register struct attack *mattk;
tmp = 1;
if (!negated && tmp < mdef->mhp) {
char nambuf[BUFSZ];
boolean u_saw_mon =
canseemon(mdef) || (u.uswallow && u.ustuck == mdef);
boolean u_saw_mon = (canseemon(mdef)
|| (u.uswallow && u.ustuck == mdef));
/* record the name before losing sight of monster */
Strcpy(nambuf, Monnam(mdef));
if (u_teleport_mon(mdef, FALSE) && u_saw_mon
@@ -1794,9 +1797,9 @@ register struct attack *mattk;
case AD_DRCO:
if (!negated && !rn2(8)) {
Your("%s was poisoned!", mpoisons_subj(&youmonst, mattk));
if (resists_poison(mdef))
if (resists_poison(mdef)) {
pline_The("poison doesn't seem to affect %s.", mon_nam(mdef));
else {
} else {
if (!rn2(10)) {
Your("poison was deadly...");
tmp = mdef->mhp;
@@ -1941,12 +1944,11 @@ explum(mdef, mattk)
register struct monst *mdef;
register struct attack *mattk;
{
boolean resistance; /* only for cold/fire/elec */
register int tmp = d((int) mattk->damn, (int) mattk->damd);
You("explode!");
switch (mattk->adtyp) {
boolean resistance; /* only for cold/fire/elec */
case AD_BLND:
if (!resists_blnd(mdef)) {
pline("%s is blinded by your flash of light!", Monnam(mdef));

View File

@@ -64,7 +64,8 @@ STATIC_DCL void FDECL(dump_clear_nhwindow, (winid));
STATIC_DCL void FDECL(dump_display_nhwindow, (winid, BOOLEAN_P));
STATIC_DCL void FDECL(dump_destroy_nhwindow, (winid));
STATIC_DCL void FDECL(dump_start_menu, (winid));
STATIC_DCL void FDECL(dump_add_menu, (winid, int, const ANY_P *, CHAR_P, CHAR_P, int, const char *, BOOLEAN_P));
STATIC_DCL void FDECL(dump_add_menu, (winid, int, const ANY_P *, CHAR_P,
CHAR_P, int, const char *, BOOLEAN_P));
STATIC_DCL void FDECL(dump_end_menu, (winid, const char *));
STATIC_DCL int FDECL(dump_select_menu, (winid, int, MENU_ITEM_P **));
STATIC_DCL void FDECL(dump_putstr, (winid, int, const char *));
@@ -145,14 +146,22 @@ static struct winlink *chain = 0;
static struct winlink *
wl_new()
{
return calloc(1, sizeof(struct winlink));
struct winlink *wl = (struct winlink *) alloc(sizeof *wl);
wl->nextlink = 0;
wl->wincp = 0;
wl->linkdata = 0;
return wl;
}
static void
wl_addhead(struct winlink *wl)
{
wl->nextlink = chain;
chain = wl;
}
static void
wl_addtail(struct winlink *wl)
{
@@ -255,24 +264,28 @@ const char *s;
if (!winchoices[0].procs) {
raw_printf("No window types?");
exit(EXIT_FAILURE);
nh_terminate(EXIT_FAILURE);
}
if (!winchoices[1].procs) {
config_error_add("Window type %s not recognized. The only choice is: %s",
s, winchoices[0].procs->name);
config_error_add(
"Window type %s not recognized. The only choice is: %s",
s, winchoices[0].procs->name);
} else {
char buf[BUFSZ];
boolean first = TRUE;
buf[0] = '\0';
for (i = 0; winchoices[i].procs; i++) {
if ('+' == winchoices[i].procs->name[0])
continue;
if ('-' == winchoices[i].procs->name[0])
continue;
Sprintf(eos(buf), "%s%s", first ? "" : ",", winchoices[i].procs->name);
Sprintf(eos(buf), "%s%s",
first ? "" : ", ", winchoices[i].procs->name);
first = FALSE;
}
config_error_add("Window type %s not recognized. Choices are: %s", s, buf);
config_error_add("Window type %s not recognized. Choices are: %s",
s, buf);
}
if (windowprocs.win_raw_print == def_raw_print)
@@ -291,6 +304,7 @@ const char *s;
continue;
if (!strcmpi(s, winchoices[i].procs->name)) {
struct winlink *p = wl_new();
p->wincp = &winchoices[i];
wl_addtail(p);
/* NB: The ini_routine() will be called during commit. */
@@ -307,7 +321,7 @@ const char *s;
raw_printf(" %s", winchoices[i].procs->name);
}
exit(EXIT_FAILURE);
nh_terminate(EXIT_FAILURE);
}
void
@@ -494,7 +508,8 @@ static short FDECL(hup_set_font_name, (winid, char *));
#endif
static char *NDECL(hup_get_color_string);
#endif /* CHANGE_COLOR */
static void FDECL(hup_status_update, (int, genericptr_t, int, int, int, unsigned long *));
static void FDECL(hup_status_update, (int, genericptr_t, int, int, int,
unsigned long *));
static int NDECL(hup_int_ndecl);
static void NDECL(hup_void_ndecl);

View File

@@ -100,6 +100,10 @@ NetHack*highlight_prompt: False
! has a lot of popups and is almost unplayable without some kind of autofocus.
!NetHack*autofocus: True
!
! True, use a "fancy" style status area vs. TTY-style status lines
!NetHack*fancy_status: False
! Specify the number of rows and columns of the map window. The default
! is the standard 80x21 window. Note: this _does_not_ change nethack's
! level size, only what you see of it.
@@ -170,80 +174,80 @@ NetHack*player_selection_dialog*play.cornerRoundPercent: NETHACK_BTN_ROUND
! role selection window (OPTIONS=player_selection:prompts)
NetHack*player_selection*random.foreground: NETHACK_CLR_RANDOM
NetHack*player_selection*random.background: black
NetHack*player_selection*random.borderColor: NETHACK_CLR_RANDOM
NetHack*player_selection*random.borderWidth: 1
NetHack*player_selection*random.shapeStyle: NETHACK_BTN_SHAPE
NetHack*player_selection*random.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*player_selection*quit.foreground: NETHACK_CLR_QUIT
NetHack*player_selection*quit.borderColor: NETHACK_CLR_QUIT
NetHack*player_selection*quit.borderWidth: 1
NetHack*player_selection*quit.shapeStyle: NETHACK_BTN_SHAPE
NetHack*player_selection*quit.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*player_selection*btn_random.foreground: NETHACK_CLR_RANDOM
NetHack*player_selection*btn_random.background: black
NetHack*player_selection*btn_random.borderColor: NETHACK_CLR_RANDOM
NetHack*player_selection*btn_random.borderWidth: 1
NetHack*player_selection*btn_random.shapeStyle: NETHACK_BTN_SHAPE
NetHack*player_selection*btn_random.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*player_selection*btn_quit.foreground: NETHACK_CLR_QUIT
NetHack*player_selection*btn_quit.borderColor: NETHACK_CLR_QUIT
NetHack*player_selection*btn_quit.borderWidth: 1
NetHack*player_selection*btn_quit.shapeStyle: NETHACK_BTN_SHAPE
NetHack*player_selection*btn_quit.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*player_selection*Command.foreground: NETHACK_CLR_FG
NetHack*player_selection*Command.borderColor: NETHACK_CLR_FG
NetHack*player_selection*Command.borderWidth: NETHACK_CMD_BORDER
! race selection window
NetHack*race_selection*random.foreground: NETHACK_CLR_RANDOM
NetHack*race_selection*random.background: black
NetHack*race_selection*random.borderColor: NETHACK_CLR_RANDOM
NetHack*race_selection*random.borderWidth: 1
NetHack*race_selection*random.shapeStyle: NETHACK_BTN_SHAPE
NetHack*race_selection*random.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*race_selection*quit.foreground: NETHACK_CLR_QUIT
NetHack*race_selection*quit.borderColor: NETHACK_CLR_QUIT
NetHack*race_selection*quit.borderWidth: 1
NetHack*race_selection*quit.shapeStyle: NETHACK_BTN_SHAPE
NetHack*race_selection*quit.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*race_selection*btn_random.foreground: NETHACK_CLR_RANDOM
NetHack*race_selection*btn_random.background: black
NetHack*race_selection*btn_random.borderColor: NETHACK_CLR_RANDOM
NetHack*race_selection*btn_random.borderWidth: 1
NetHack*race_selection*btn_random.shapeStyle: NETHACK_BTN_SHAPE
NetHack*race_selection*btn_random.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*race_selection*btn_quit.foreground: NETHACK_CLR_QUIT
NetHack*race_selection*btn_quit.borderColor: NETHACK_CLR_QUIT
NetHack*race_selection*btn_quit.borderWidth: 1
NetHack*race_selection*btn_quit.shapeStyle: NETHACK_BTN_SHAPE
NetHack*race_selection*btn_quit.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*race_selection*Command.foreground: NETHACK_CLR_FG
NetHack*race_selection*Command.borderColor: NETHACK_CLR_FG
NetHack*race_selection*Command.borderWidth: NETHACK_CMD_BORDER
! gender selection window
NetHack*gender_selection*random.foreground: NETHACK_CLR_RANDOM
NetHack*gender_selection*random.background: black
NetHack*gender_selection*random.borderColor: NETHACK_CLR_RANDOM
NetHack*gender_selection*random.borderWidth: 1
NetHack*gender_selection*random.shapeStyle: NETHACK_BTN_SHAPE
NetHack*gender_selection*random.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*gender_selection*quit.foreground: NETHACK_CLR_QUIT
NetHack*gender_selection*quit.borderColor: NETHACK_CLR_QUIT
NetHack*gender_selection*quit.borderWidth: 1
NetHack*gender_selection*quit.shapeStyle: NETHACK_BTN_SHAPE
NetHack*gender_selection*quit.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*gender_selection*btn_random.foreground: NETHACK_CLR_RANDOM
NetHack*gender_selection*btn_random.background: black
NetHack*gender_selection*btn_random.borderColor: NETHACK_CLR_RANDOM
NetHack*gender_selection*btn_random.borderWidth: 1
NetHack*gender_selection*btn_random.shapeStyle: NETHACK_BTN_SHAPE
NetHack*gender_selection*btn_random.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*gender_selection*btn_quit.foreground: NETHACK_CLR_QUIT
NetHack*gender_selection*btn_quit.borderColor: NETHACK_CLR_QUIT
NetHack*gender_selection*btn_quit.borderWidth: 1
NetHack*gender_selection*btn_quit.shapeStyle: NETHACK_BTN_SHAPE
NetHack*gender_selection*btn_quit.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*gender_selection*Command.foreground: NETHACK_CLR_FG
NetHack*gender_selection*Command.borderColor: NETHACK_CLR_FG
NetHack*gender_selection*Command.borderWidth: NETHACK_CMD_BORDER
! alignment selection window
NetHack*alignment_selection*random.foreground: NETHACK_CLR_RANDOM
NetHack*alignment_selection*random.background: black
NetHack*alignment_selection*random.borderColor: NETHACK_CLR_RANDOM
NetHack*alignment_selection*random.borderWidth: 1
NetHack*alignment_selection*random.shapeStyle: NETHACK_BTN_SHAPE
NetHack*alignment_selection*random.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*alignment_selection*quit.foreground: NETHACK_CLR_QUIT
NetHack*alignment_selection*quit.borderColor: NETHACK_CLR_QUIT
NetHack*alignment_selection*quit.borderWidth: 1
NetHack*alignment_selection*quit.shapeStyle: NETHACK_BTN_SHAPE
NetHack*alignment_selection*quit.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*alignment_selection*btn_random.foreground: NETHACK_CLR_RANDOM
NetHack*alignment_selection*btn_random.background: black
NetHack*alignment_selection*btn_random.borderColor: NETHACK_CLR_RANDOM
NetHack*alignment_selection*btn_random.borderWidth: 1
NetHack*alignment_selection*btn_random.shapeStyle: NETHACK_BTN_SHAPE
NetHack*alignment_selection*btn_random.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*alignment_selection*btn_quit.foreground: NETHACK_CLR_QUIT
NetHack*alignment_selection*btn_quit.borderColor: NETHACK_CLR_QUIT
NetHack*alignment_selection*btn_quit.borderWidth: 1
NetHack*alignment_selection*btn_quit.shapeStyle: NETHACK_BTN_SHAPE
NetHack*alignment_selection*btn_quit.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*alignment_selection*Command.foreground: NETHACK_CLR_FG
NetHack*alignment_selection*Command.borderColor: NETHACK_CLR_FG
NetHack*alignment_selection*Command.borderWidth: NETHACK_CMD_BORDER
! extended commands window
NetHack*extended_commands*dismiss.foreground: NETHACK_CLR_QUIT
NetHack*extended_commands*dismiss.borderColor: NETHACK_CLR_QUIT
NetHack*extended_commands*dismiss.borderWidth: 1
NetHack*extended_commands*dismiss.shapeStyle: NETHACK_BTN_SHAPE
NetHack*extended_commands*dismiss.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*extended_commands*help.foreground: NETHACK_CLR_HELP
NetHack*extended_commands*help.borderColor: NETHACK_CLR_HELP
NetHack*extended_commands*help.borderWidth: 1
NetHack*extended_commands*help.shapeStyle: NETHACK_BTN_SHAPE
NetHack*extended_commands*help.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*extended_commands*btn_dismiss.foreground: NETHACK_CLR_QUIT
NetHack*extended_commands*btn_dismiss.borderColor: NETHACK_CLR_QUIT
NetHack*extended_commands*btn_dismiss.borderWidth: 1
NetHack*extended_commands*btn_dismiss.shapeStyle: NETHACK_BTN_SHAPE
NetHack*extended_commands*btn_dismiss.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*extended_commands*btn_help.foreground: NETHACK_CLR_HELP
NetHack*extended_commands*btn_help.borderColor: NETHACK_CLR_HELP
NetHack*extended_commands*btn_help.borderWidth: 1
NetHack*extended_commands*btn_help.shapeStyle: NETHACK_BTN_SHAPE
NetHack*extended_commands*btn_help.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*extended_commands*Command.foreground: NETHACK_CLR_FG
NetHack*extended_commands*Command.borderColor: NETHACK_CLR_FG
NetHack*extended_commands*Command.borderWidth: NETHACK_CMD_BORDER
@@ -302,13 +306,13 @@ NetHack*map*green: green3
NetHack*map*brown: DarkOrange3
NetHack*map*blue: blue3
NetHack*map*magenta: magenta3
NetHack*map*cyan: cyan3
NetHack*map*cyan: Dark cyan
NetHack*map*gray: gray50
NetHack*map*orange: yellow
NetHack*map*orange: orange
NetHack*map*bright_green: green
NetHack*map*yellow: yellow
NetHack*map*bright_blue: blue
NetHack*map*bright_magenta: magenta
NetHack*map*bright_blue: Royal blue
NetHack*map*bright_magenta: Fuchsia
NetHack*map*bright_cyan: cyan
NetHack*map*white: white
!

View File

@@ -49,6 +49,7 @@
#include "hack.h"
#include "winX.h"
#include "dlb.h"
#include "xwindow.h"
#ifndef NO_SIGNAL
#include <signal.h>
@@ -103,7 +104,7 @@ struct window_procs X11_procs = {
(WC_COLOR | WC_HILITE_PET | WC_ASCII_MAP | WC_TILED_MAP
| WC_PLAYER_SELECTION | WC_PERM_INVENT | WC_MOUSE_SUPPORT),
#if defined(STATUS_HILITES)
WC2_FLUSH_STATUS | WC2_RESET_STATUS |
WC2_FLUSH_STATUS | WC2_RESET_STATUS | WC2_HILITE_STATUS |
#endif
0L,
X11_init_nhwindows,
@@ -133,9 +134,9 @@ struct window_procs X11_procs = {
#else
genl_outrip,
#endif
X11_preference_update, genl_getmsghistory, genl_putmsghistory,
genl_status_init, genl_status_finish, genl_status_enablefield,
genl_status_update,
X11_preference_update, X11_getmsghistory, X11_putmsghistory,
X11_status_init, X11_status_finish, X11_status_enablefield,
X11_status_update,
genl_can_suspend_no, /* XXX may not always be correct */
};
@@ -181,6 +182,43 @@ static winid message_win = WIN_ERR, /* These are the winids of the message, */
status_win = WIN_ERR; /* are created in init_windows(). */
static Pixmap icon_pixmap = None; /* Pixmap for icon. */
void
X11_putmsghistory(msg, is_restoring)
const char *msg;
boolean is_restoring;
{
if (WIN_MESSAGE != WIN_ERR) {
struct xwindow *wp = &window_list[WIN_MESSAGE];
debugpline2("X11_putmsghistory('%s',%i)", msg, is_restoring);
if (msg)
append_message(wp, msg);
}
}
char *
X11_getmsghistory(init)
boolean init;
{
if (WIN_MESSAGE != WIN_ERR) {
static struct line_element *curr = (struct line_element *) 0;
static int numlines = 0;
struct xwindow *wp = &window_list[WIN_MESSAGE];
if (!curr) {
curr = wp->mesg_information->head;
numlines = 0;
}
if (numlines < wp->mesg_information->num_lines) {
curr = curr->next;
numlines++;
debugpline2("X11_getmsghistory(%i)='%s'", init, curr->line);
return curr->line;
}
}
return (char *) 0;
}
/*
* Find the window structure that corresponds to the given widget. Note
* that this is not the popup widget, nor the viewport, but the child.
@@ -226,6 +264,102 @@ find_free_window()
return (winid) windex;
}
XColor
get_nhcolor(wp, clr)
struct xwindow *wp;
int clr;
{
init_menu_nhcolors(wp);
/* FIXME: init_menu_nhcolors may fail */
if (clr >= 0 && clr < CLR_MAX)
return wp->nh_colors[clr];
return wp->nh_colors[0];
}
void
init_menu_nhcolors(wp)
struct xwindow *wp;
{
static const char *mapCLR_to_res[CLR_MAX] = {
XtNblack,
XtNred,
XtNgreen,
XtNbrown,
XtNblue,
XtNmagenta,
XtNcyan,
XtNgray,
XtNforeground,
XtNorange,
XtNbright_green,
XtNyellow,
XtNbright_blue,
XtNbright_magenta,
XtNbright_cyan,
XtNwhite,
};
Display *dpy;
Colormap screen_colormap;
XrmDatabase rDB;
XrmValue value;
Status rc;
int color;
char *ret_type[32];
char clr_name[BUFSZ];
char clrclass[BUFSZ];
const char *wintypenames[NHW_TEXT] = {
"message", "status", "map", "menu", "text"
};
const char *wtn;
char wtn_up[BUFSZ];
if (wp->nh_colors_inited || !wp->type)
return;
wtn = wintypenames[wp->type - 1];
Strcpy(wtn_up, wtn);
(void) upstart(wtn_up);
dpy = XtDisplay(wp->w);
screen_colormap = DefaultColormap(dpy, DefaultScreen(dpy));
rDB = XrmGetDatabase(dpy);
for (color = 0; color < CLR_MAX; color++) {
Sprintf(clr_name, "nethack.%s.%s", wtn, mapCLR_to_res[color]);
Sprintf(clrclass, "NetHack.%s.%s", wtn_up, mapCLR_to_res[color]);
if (!XrmGetResource(rDB, clr_name, clrclass, ret_type, &value)) {
Sprintf(clr_name, "nethack.map.%s", mapCLR_to_res[color]);
Sprintf(clrclass, "NetHack.Map.%s", mapCLR_to_res[color]);
}
if (!XrmGetResource(rDB, clr_name, clrclass, ret_type, &value)) {
impossible("XrmGetResource error (%s)", clr_name);
} else if (!strcmp(ret_type[0], "String")) {
char tmpbuf[256];
if (value.size >= sizeof tmpbuf)
value.size = sizeof tmpbuf - 1;
(void) strncpy(tmpbuf, (char *) value.addr, (int) value.size);
tmpbuf[value.size] = '\0';
/* tmpbuf now contains the color name from the named resource */
rc = XAllocNamedColor(dpy, screen_colormap, tmpbuf,
&wp->nh_colors[color],
&wp->nh_colors[color]);
if (rc == 0) {
impossible("XAllocNamedColor failed for color %i (%s)",
color, clr_name);
}
}
}
wp->nh_colors_inited = TRUE;
}
/*
* Color conversion. The default X11 color converters don't try very
* hard to find matching colors in PseudoColor visuals. If they can't
@@ -515,6 +649,31 @@ const char *fontname;
return buf;
}
void
load_boldfont(wp, w)
struct xwindow *wp;
Widget w;
{
Arg args[1];
XFontStruct *fs;
unsigned long ret;
char *fontname;
Display *dpy;
if (wp->boldfs)
return;
XtSetArg(args[0], nhStr(XtNfont), &fs);
XtGetValues(w, args, 1);
if (!XGetFontProperty(fs, XA_FONT, &ret))
return;
wp->boldfs_dpy = dpy = XtDisplay(w);
fontname = fontname_boldify(XGetAtomName(dpy, (Atom)ret));
wp->boldfs = XLoadQueryFont(dpy, fontname);
}
#ifdef TEXTCOLOR
/* ARGSUSED */
static void
@@ -790,9 +949,11 @@ const char *str;
toplines[TBUFSZ - 1] = 0;
append_message(wp, str);
break;
#ifndef STATUS_HILITES
case NHW_STATUS:
adjust_status(wp, str);
break;
#endif
case NHW_MAP:
impossible("putstr: called on map window \"%s\"", str);
break;
@@ -913,6 +1074,9 @@ int type;
wp->prevx = wp->prevy = wp->cursx = wp->cursy = wp->pixel_width =
wp->pixel_height = 0;
wp->keep_window = FALSE;
wp->nh_colors_inited = FALSE;
wp->boldfs = (XFontStruct *) 0;
wp->boldfs_dpy = (Display *) 0;
switch (type) {
case NHW_MAP:
@@ -1057,6 +1221,12 @@ winid window;
WIN_INVEN = WIN_ERR;
}
if (wp->boldfs) {
XFreeFont(wp->boldfs_dpy, wp->boldfs);
wp->boldfs = (XFontStruct *) 0;
wp->boldfs_dpy = (Display *) 0;
}
switch (wp->type) {
case NHW_MAP:
destroy_map_window(wp);
@@ -1230,6 +1400,8 @@ static XtActionsRec actions[] = {
static XtResource resources[] = {
{ nhStr("slow"), nhStr("Slow"), XtRBoolean, sizeof(Boolean),
XtOffset(AppResources *, slow), XtRString, nhStr("True") },
{ nhStr("fancy_status"), nhStr("Fancy_status"), XtRBoolean, sizeof(Boolean),
XtOffset(AppResources *, fancy_status), XtRString, nhStr("True") },
{ nhStr("autofocus"), nhStr("AutoFocus"), XtRBoolean, sizeof(Boolean),
XtOffset(AppResources *, autofocus), XtRString, nhStr("False") },
{ nhStr("message_line"), nhStr("Message_line"), XtRBoolean,
@@ -2214,7 +2386,7 @@ static int
input_event(exit_condition)
int exit_condition;
{
if (WIN_STATUS != WIN_ERR) /* hilighting on the fancy status window */
if (appResources.fancy_status && WIN_STATUS != WIN_ERR) /* hilighting on the fancy status window */
check_turn_events();
if (WIN_MAP != WIN_ERR) /* make sure cursor is not clipped */
check_cursor_visibility(&window_list[WIN_MAP]);
@@ -2484,7 +2656,8 @@ init_standard_windows()
* after the fancy status widget is realized (above, with the game popup),
* but before it is popped up.
*/
null_out_status();
if (appResources.fancy_status)
null_out_status();
/*
* Set the map size to its standard size. As with the message window
* above, the map window needs to be set to its constrained size until

View File

@@ -32,12 +32,9 @@
#undef PRESERVE_NO_SYSV
#endif
#include "xwindow.h"
#include "hack.h"
#include "winX.h"
XColor FDECL(get_nhcolor, (struct xwindow *, int));
static void FDECL(init_menu_nhcolors, (struct xwindow *));
static void FDECL(menu_size_change_handler, (Widget, XtPointer,
XEvent *, Boolean *));
static void FDECL(menu_select, (Widget, XtPointer, XtPointer));
@@ -55,7 +52,6 @@ static void FDECL(invert_all, (struct xwindow *));
static void FDECL(invert_match, (struct xwindow *, char *));
static void FDECL(menu_popdown, (struct xwindow *));
static Widget FDECL(menu_create_buttons, (struct xwindow *, Widget, Widget));
static void FDECL(load_boldfont, (struct xwindow *, Widget));
static void FDECL(menu_create_entries, (struct xwindow *, struct menu *));
static void FDECL(destroy_menu_entry_widgets, (struct xwindow *));
static void NDECL(create_menu_translation_tables);
@@ -1121,31 +1117,6 @@ Widget form,under;
return all;
}
static void
load_boldfont(wp, w)
struct xwindow *wp;
Widget w;
{
Arg args[1];
XFontStruct *fs;
unsigned long ret;
char *fontname;
Display *dpy;
if (wp->menu_information->boldfs)
return;
XtSetArg(args[0], nhStr(XtNfont), &fs);
XtGetValues(w, args, 1);
if (!XGetFontProperty(fs, XA_FONT, &ret))
return;
wp->menu_information->boldfs_dpy = dpy = XtDisplay(w);
fontname = fontname_boldify(XGetAtomName(dpy, (Atom)ret));
wp->menu_information->boldfs = XLoadQueryFont(dpy, fontname);
}
static void
menu_create_entries(wp, curr_menu)
struct xwindow *wp;
@@ -1185,7 +1156,7 @@ struct menu *curr_menu;
get_nhcolor(wp, color).pixel); num_args++;
}
/* TODO: ATR_BOLD, ATR_DIM, ATR_ULINE, ATR_BLINK */
/* TODO: ATR_DIM, ATR_ULINE, ATR_BLINK */
if (attr == ATR_INVERSE) {
XtSetArg(args[num_args], nhStr(XtNforeground),
@@ -1215,7 +1186,7 @@ struct menu *curr_menu;
load_boldfont(wp, curr->w);
num_args = 0;
XtSetArg(args[num_args], nhStr(XtNfont),
wp->menu_information->boldfs); num_args++;
wp->boldfs); num_args++;
XtSetValues(curr->w, args, num_args);
}
@@ -1315,91 +1286,6 @@ struct xwindow *wp;
}
}
XColor
get_nhcolor(wp, clr)
struct xwindow *wp;
int clr;
{
init_menu_nhcolors(wp);
if (clr >= 0 && clr < CLR_MAX)
return wp->menu_information->nh_colors[clr];
return wp->menu_information->nh_colors[0];
}
static void
init_menu_nhcolors(wp)
struct xwindow *wp;
{
static const char *mapCLR_to_res[CLR_MAX] = {
XtNblack,
XtNred,
XtNgreen,
XtNbrown,
XtNblue,
XtNmagenta,
XtNcyan,
XtNgray,
XtNforeground,
XtNorange,
XtNbright_green,
XtNyellow,
XtNbright_blue,
XtNbright_magenta,
XtNbright_cyan,
XtNwhite,
};
Display *dpy;
Colormap screen_colormap;
XrmDatabase rDB;
XrmValue value;
Status rc;
int color;
char *ret_type[32];
char clr_name[BUFSZ];
char clrclass[BUFSZ];
if (wp->menu_information->nh_colors_inited)
return;
dpy = XtDisplay(wp->w);
screen_colormap = DefaultColormap(dpy, DefaultScreen(dpy));
rDB = XrmGetDatabase(dpy);
for (color = 0; color < CLR_MAX; color++) {
Sprintf(clr_name, "nethack.menu.%s", mapCLR_to_res[color]);
Sprintf(clrclass, "NetHack.Menu.%s", mapCLR_to_res[color]);
if (!XrmGetResource(rDB, clr_name, clrclass, ret_type, &value)) {
Sprintf(clr_name, "nethack.map.%s", mapCLR_to_res[color]);
Sprintf(clrclass, "NetHack.Map.%s", mapCLR_to_res[color]);
}
if (!XrmGetResource(rDB, clr_name, clrclass, ret_type, &value)) {
impossible("XrmGetResource error (%s)", clr_name);
} else if (!strcmp(ret_type[0], "String")) {
char tmpbuf[256];
if (value.size >= sizeof tmpbuf)
value.size = sizeof tmpbuf - 1;
(void) strncpy(tmpbuf, (char *) value.addr, (int) value.size);
tmpbuf[value.size] = '\0';
/* tmpbuf now contains the color name from the named resource */
rc = XAllocNamedColor(dpy, screen_colormap, tmpbuf,
&wp->menu_information->nh_colors[color],
&wp->menu_information->nh_colors[color]);
if (rc == 0) {
impossible("XAllocNamedColor failed for color %i (%s)",
color, clr_name);
}
}
}
wp->menu_information->nh_colors_inited = TRUE;
}
void
create_menu_window(wp)
struct xwindow *wp;
@@ -1413,7 +1299,6 @@ struct xwindow *wp;
reset_menu_to_default(&wp->menu_information->new_menu);
reset_menu_count(wp->menu_information);
wp->w = wp->popup = (Widget) 0;
wp->menu_information->nh_colors_inited = FALSE;
wp->menu_information->permi_x = -1;
wp->menu_information->permi_y = -1;
wp->menu_information->permi_w = -1;
@@ -1425,9 +1310,6 @@ destroy_menu_window(wp)
struct xwindow *wp;
{
clear_old_menu(wp); /* this will also destroy the widgets */
if (wp->menu_information->boldfs)
XFreeFont(wp->menu_information->boldfs_dpy,
wp->menu_information->boldfs);
free((genericptr_t) wp->menu_information);
wp->menu_information = (struct menu_info_t *) 0;
wp->type = NHW_NONE; /* allow re-use */

View File

@@ -50,6 +50,8 @@ static char mesg_translations[] = "#override\n\
<Key>Right: scroll(6)\n\
<Key>Up: scroll(8)\n\
<Key>Down: scroll(2)\n\
<Btn4Down>: scroll(8)\n\
<Btn5Down>: scroll(2)\n\
<Key>: input()";
/* Move the message window's vertical scrollbar's slider to the bottom. */

View File

@@ -1247,11 +1247,10 @@ X11_player_selection_dialog()
} else {
ps_selected = -1;
nh_XtPopup(popup, (int) XtGrabExclusive, form);
/* The callback will enable the event loop exit. */
(void) x_event(EXIT_ON_EXIT);
}
/* The callback will enable the event loop exit. */
(void) x_event(flags.randomall ? EXIT_ON_SENT_EVENT : EXIT_ON_EXIT);
nh_XtPopdown(popup);
XtDestroyWidget(popup);
@@ -1994,11 +1993,12 @@ Widget *formp; /* return */
Widget popup, popform, form, label, above, left, right, view;
Widget *commands, *curr;
int i;
Arg args[8];
Arg args[12];
Cardinal num_args;
Dimension width, other_width, max_width, border_width,
height, cumulative_height, screen_height;
int distance, skip;
char btnname[BUFSZ];
commands = (Widget *) alloc((unsigned) num_names * sizeof (Widget));
@@ -2073,11 +2073,13 @@ Widget *formp; /* return */
*/
num_args = 0;
XtSetArg(args[num_args], nhStr(XtNfromVert), label); num_args++;
XtSetArg(args[num_args], nhStr(XtNlabel), left_name); num_args++;
#if 0
XtSetArg(args[num_args], nhStr(XtNshapeStyle),
XmuShapeRoundedRectangle); num_args++;
#endif
left = XtCreateManagedWidget(left_name, commandWidgetClass, form, args,
Sprintf(btnname, "btn_%s", left_name);
left = XtCreateManagedWidget(btnname, commandWidgetClass, form, args,
num_args);
XtAddCallback(left, XtNcallback, left_callback, (XtPointer) 0);
skip = (distance < 4) ? 8 : 2 * distance;
@@ -2094,11 +2096,13 @@ Widget *formp; /* return */
XtSetArg(args[num_args], nhStr(XtNfromHoriz), left); num_args++;
XtSetArg(args[num_args], nhStr(XtNhorizDistance), skip); num_args++;
XtSetArg(args[num_args], nhStr(XtNfromVert), label); num_args++;
XtSetArg(args[num_args], nhStr(XtNlabel), right_name); num_args++;
#if 0
XtSetArg(args[num_args], nhStr(XtNshapeStyle),
XmuShapeRoundedRectangle); num_args++;
#endif
right = XtCreateManagedWidget(right_name, commandWidgetClass, form, args,
Sprintf(btnname, "btn_%s", right_name);
right = XtCreateManagedWidget(btnname, commandWidgetClass, form, args,
num_args);
XtAddCallback(right, XtNcallback, right_callback, (XtPointer) 0);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 winstat.c $NHDT-Date: 1452920162 2016/01/16 04:56:02 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.16 $ */
/* NetHack 3.6 winstat.c $NHDT-Date: 1540247293 2018/10/22 22:28:13 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.18 $ */
/* Copyright (c) Dean Luick, 1992 */
/* NetHack may be freely redistributed. See license for details. */
@@ -15,6 +15,7 @@
#endif
#include <X11/Intrinsic.h>
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <X11/Shell.h>
#include <X11/Xaw/AsciiText.h>
@@ -22,6 +23,7 @@
#include <X11/Xaw/Form.h>
#include <X11/Xaw/Paned.h>
#include <X11/Xaw/Label.h>
#include <X11/Xaw/Viewport.h>
#include <X11/Xatom.h>
#ifdef PRESERVE_NO_SYSV
@@ -31,18 +33,754 @@
#undef PRESERVE_NO_SYSV
#endif
#include "xwindow.h"
#include "hack.h"
#include "winX.h"
/*
* Fancy status form entry storage indices.
*/
#define F_DUMMY 0
#define F_STR 1
#define F_DEX 2
#define F_CON 3
#define F_INT 4
#define F_WIS 5
#define F_CHA 6
#define F_NAME 7
#define F_DLEVEL 8
#define F_GOLD 9
#define F_HP 10
#define F_MAXHP 11
#define F_POWER 12
#define F_MAXPOWER 13
#define F_AC 14
#define F_LEVEL 15
#define F_EXP 16
#define F_ALIGN 17
#define F_TIME 18
#define F_SCORE 19
/* status conditions grouped by columns; tty orders these differently */
#define F_STONE 20
#define F_SLIME 21
#define F_STRNGL 22
#define F_FOODPOIS 23
#define F_TERMILL 24
#define F_HUNGER 25
#define F_ENCUMBER 26
#define F_LEV 27
#define F_FLY 28
#define F_RIDE 29
#define F_BLIND 30
#define F_DEAF 31
#define F_STUN 32
#define F_CONF 33
#define F_HALLU 34
#define NUM_STATS 35
static void FDECL(update_fancy_status, (struct xwindow *));
static void FDECL(update_fancy_status_field, (int));
static Widget FDECL(create_fancy_status, (Widget, Widget));
static void FDECL(destroy_fancy_status, (struct xwindow *));
static void FDECL(create_status_window_fancy, (struct xwindow *, BOOLEAN_P, Widget));
static void FDECL(create_status_window_tty, (struct xwindow *, BOOLEAN_P, Widget));
static void FDECL(destroy_status_window_fancy, (struct xwindow *));
static void FDECL(destroy_status_window_tty, (struct xwindow *));
static void FDECL(adjust_status_fancy, (struct xwindow *, const char *));
static void FDECL(adjust_status_tty, (struct xwindow *, const char *));
extern const char *status_fieldfmt[MAXBLSTATS];
extern char *status_vals[MAXBLSTATS];
extern boolean status_activefields[MAXBLSTATS];
static long X11_condition_bits;
static int X11_status_colors[MAXBLSTATS];
static int hpbar_percent, hpbar_color;
#define X11_NUM_STATUS_LINES 2
#define X11_NUM_STATUS_FIELD 15
static enum statusfields X11_fieldorder[X11_NUM_STATUS_LINES][X11_NUM_STATUS_FIELD] = {
{ BL_TITLE, BL_STR, BL_DX, BL_CO, BL_IN, BL_WI, BL_CH, BL_ALIGN,
BL_SCORE, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH,
BL_FLUSH },
{ BL_LEVELDESC, BL_GOLD, BL_HP, BL_HPMAX, BL_ENE, BL_ENEMAX,
BL_AC, BL_XP, BL_EXP, BL_HD, BL_TIME, BL_HUNGER,
BL_CAP, BL_CONDITION, BL_FLUSH }
};
static Widget X11_status_widget;
static Widget X11_status_labels[MAXBLSTATS];
static Widget X11_cond_labels[32]; /* Ugh */
struct xwindow *xw_status_win;
static Pixel X11_status_widget_fg, X11_status_widget_bg;
int
condcolor(bm, bmarray)
long bm;
unsigned long *bmarray;
{
int i;
if (bm && bmarray)
for (i = 0; i < CLR_MAX; ++i) {
if (bmarray[i] && (bm & bmarray[i]))
return i;
}
return NO_COLOR;
}
int
condattr(bm, bmarray)
long bm;
unsigned long *bmarray;
{
int attr = 0;
int i;
if (bm && bmarray) {
for (i = HL_ATTCLR_DIM; i < BL_ATTCLR_MAX; ++i) {
if (bmarray[i] && (bm & bmarray[i])) {
switch(i) {
case HL_ATTCLR_DIM:
attr |= HL_DIM;
break;
case HL_ATTCLR_BLINK:
attr |= HL_BLINK;
break;
case HL_ATTCLR_ULINE:
attr |= HL_ULINE;
break;
case HL_ATTCLR_INVERSE:
attr |= HL_INVERSE;
break;
case HL_ATTCLR_BOLD:
attr |= HL_BOLD;
break;
}
}
}
}
return attr;
}
void
X11_status_init()
{
#ifdef STATUS_HILITES
int i;
for (i = 0; i < MAXBLSTATS; ++i)
X11_status_colors[i] = NO_COLOR; /* no color */
X11_condition_bits = 0L;
hpbar_percent = 0, hpbar_color = NO_COLOR;
#endif /* STATUS_HILITES */
/* let genl_status_init do most of the initialization */
genl_status_init();
}
void
X11_status_finish()
{
/* nothing */
}
void
X11_status_enablefield(fieldidx, nm, fmt, enable)
int fieldidx;
const char *nm;
const char *fmt;
boolean enable;
{
genl_status_enablefield(fieldidx, nm, fmt, enable);
}
int
cond_bm2idx(bm)
unsigned long bm;
{
int i;
for (i = 0; i < 32; i++)
if ((1 << i) == bm)
return i;
return -1;
}
void
MaybeDisplayCond(bm, colormasks, text)
unsigned long bm;
unsigned long *colormasks;
const char *text;
{
int idx = cond_bm2idx(bm);
Widget label;
Arg args[10];
Cardinal num_args;
Pixel fg = X11_status_widget_fg, bg = X11_status_widget_bg;
Dimension lbl_wid;
Dimension lbl_hei;
Dimension lbl_border_wid;
Dimension lbl_iwidth;
if (idx < 0)
return;
label = X11_cond_labels[idx];
if ((X11_condition_bits & bm) != 0) {
int attrmask, coloridx;
XFontStruct *font;
Position lbl_x;
Position lbl_y;
#ifdef TEXTCOLOR
coloridx = condcolor(bm, colormasks);
#else
coloridx = NO_COLOR;
#endif
attrmask = condattr(bm, colormasks);
num_args = 0;
XtSetArg(args[num_args], nhStr(XtNfont), &font); num_args++;
XtSetArg(args[num_args], nhStr(XtNx), &lbl_x); num_args++;
XtSetArg(args[num_args], nhStr(XtNy), &lbl_y); num_args++;
XtSetArg(args[num_args], nhStr(XtNwidth), &lbl_wid); num_args++;
XtSetArg(args[num_args], nhStr(XtNheight), &lbl_hei); num_args++;
XtSetArg(args[num_args], nhStr(XtNinternalWidth), &lbl_iwidth); num_args++;
XtSetArg(args[num_args], nhStr(XtNborderWidth), &lbl_border_wid); num_args++;
XtGetValues(label, args, num_args);
if (text && *text)
lbl_wid = lbl_iwidth + font->max_bounds.width * strlen(text);
else
lbl_wid = 1;
num_args = 0;
XtSetArg(args[num_args], nhStr(XtNlabel), (text && *text) ? text : ""); num_args++;
XtSetArg(args[num_args], nhStr(XtNwidth), lbl_wid); num_args++;
fg = (coloridx != NO_COLOR) ? get_nhcolor(xw_status_win, coloridx).pixel
: X11_status_widget_fg;
if (attrmask & HL_INVERSE) {
Pixel tmppx = fg;
fg = bg;
bg = tmppx;
}
if (attrmask & HL_BOLD) {
load_boldfont(xw_status_win, label);
XtSetArg(args[num_args], nhStr(XtNfont),
xw_status_win->boldfs); num_args++;
}
if (fg == bg)
fg = get_nhcolor(xw_status_win, CLR_GRAY).pixel;
XtSetArg(args[num_args], nhStr(XtNforeground), fg); num_args++;
XtSetArg(args[num_args], nhStr(XtNbackground), bg); num_args++;
XtSetValues(label, args, num_args);
XtResizeWidget(label, lbl_wid, lbl_hei, lbl_border_wid);
} else {
num_args = 0;
XtSetArg(args[num_args], nhStr(XtNwidth), &lbl_wid); num_args++;
XtSetArg(args[num_args], nhStr(XtNheight), &lbl_hei); num_args++;
XtSetArg(args[num_args], nhStr(XtNinternalWidth), &lbl_iwidth); num_args++;
XtSetArg(args[num_args], nhStr(XtNborderWidth), &lbl_border_wid); num_args++;
XtGetValues(label, args, num_args);
num_args = 0;
XtSetArg(args[num_args], nhStr(XtNlabel), ""); num_args++;
XtSetArg(args[num_args], nhStr(XtNwidth), 1); num_args++;
XtSetArg(args[num_args], nhStr(XtNforeground), fg); num_args++;
XtSetArg(args[num_args], nhStr(XtNbackground), bg); num_args++;
XtSetValues(label, args, num_args);
XtResizeWidget(label, lbl_wid, lbl_hei, lbl_border_wid);
}
}
void
X11_status_update_tty(fld, ptr, chg, percent, color, colormasks)
int fld, chg UNUSED, percent, color;
genericptr_t ptr;
unsigned long *colormasks;
{
static boolean oncearound = FALSE; /* prevent premature partial display */
long *condptr = (long *) ptr;
int coloridx = NO_COLOR;
const char *text = (char *) ptr;
char tmpbuf[BUFSZ];
int attridx = 0;
XFontStruct *font;
Arg args[10];
Cardinal num_args;
Position lbl_x;
Position lbl_y;
Dimension lbl_wid;
Dimension lbl_hei;
Dimension lbl_border_wid;
Dimension lbl_iwidth;
Widget label;
Pixel fg = X11_status_widget_fg, bg = X11_status_widget_bg;
#ifndef TEXTCOLOR
color = NO_COLOR;
#endif
if (fld < BL_RESET || fld >= MAXBLSTATS)
return;
if ((fld >= 0 && fld < MAXBLSTATS) && !status_activefields[fld])
return;
if (fld != BL_FLUSH && fld != BL_RESET) {
if (!status_activefields[fld])
return;
switch (fld) {
case BL_CONDITION:
X11_condition_bits = *condptr;
oncearound = TRUE;
break;
default:
Sprintf(status_vals[fld],
(fld == BL_TITLE && iflags.wc2_hitpointbar) ? "%-30s" :
status_fieldfmt[fld] ? status_fieldfmt[fld] : "%s",
text);
X11_status_colors[fld] = color;
if (iflags.wc2_hitpointbar && fld == BL_HP) {
hpbar_percent = percent;
hpbar_color = color;
}
break;
}
if (fld == BL_CONDITION) {
MaybeDisplayCond(BL_MASK_STONE, colormasks, "Stone");
MaybeDisplayCond(BL_MASK_SLIME, colormasks, "Slime");
MaybeDisplayCond(BL_MASK_STRNGL, colormasks, "Strngl");
MaybeDisplayCond(BL_MASK_FOODPOIS, colormasks, "FoodPois");
MaybeDisplayCond(BL_MASK_TERMILL, colormasks, "TermIll");
MaybeDisplayCond(BL_MASK_BLIND, colormasks, "Blind");
MaybeDisplayCond(BL_MASK_DEAF, colormasks, "Deaf");
MaybeDisplayCond(BL_MASK_STUN, colormasks, "Stun");
MaybeDisplayCond(BL_MASK_CONF, colormasks, "Conf");
MaybeDisplayCond(BL_MASK_HALLU, colormasks, "Hallu");
MaybeDisplayCond(BL_MASK_LEV, colormasks, "Lev");
MaybeDisplayCond(BL_MASK_FLY, colormasks, "Fly");
MaybeDisplayCond(BL_MASK_RIDE, colormasks, "Ride");
} else {
label = X11_status_labels[fld];
text = status_vals[fld];
if (fld == BL_GOLD)
text = decode_mixed(tmpbuf, text);
#ifdef TEXTCOLOR
coloridx = X11_status_colors[fld] & 0x00FF;
#endif
attridx = (X11_status_colors[fld] & 0xFF00) >> 8;
num_args = 0;
XtSetArg(args[num_args], nhStr(XtNfont), &font); num_args++;
XtSetArg(args[num_args], nhStr(XtNx), &lbl_x); num_args++;
XtSetArg(args[num_args], nhStr(XtNy), &lbl_y); num_args++;
XtSetArg(args[num_args], nhStr(XtNwidth), &lbl_wid); num_args++;
XtSetArg(args[num_args], nhStr(XtNheight), &lbl_hei); num_args++;
XtSetArg(args[num_args], nhStr(XtNinternalWidth), &lbl_iwidth); num_args++;
XtSetArg(args[num_args], nhStr(XtNborderWidth), &lbl_border_wid); num_args++;
XtGetValues(label, args, num_args);
/*raw_printf("font: %i-%i",
font->min_bounds.width, font->max_bounds.width);*/
if (text && *text)
lbl_wid = lbl_iwidth + font->max_bounds.width * strlen(text);
else
lbl_wid = 1;
/*raw_printf("1:lbl_wid=%i('%s')", lbl_wid, text);*/
num_args = 0;
XtSetArg(args[num_args], nhStr(XtNlabel),
(text && *text) ? text : ""); num_args++;
XtSetArg(args[num_args], nhStr(XtNwidth), lbl_wid); num_args++;
fg = (coloridx != NO_COLOR) ? get_nhcolor(xw_status_win, coloridx).pixel
: X11_status_widget_fg;
if (attridx & HL_INVERSE) {
Pixel tmppx = fg;
fg = bg;
bg = tmppx;
}
if (attridx & HL_BOLD) {
load_boldfont(xw_status_win, label);
XtSetArg(args[num_args], nhStr(XtNfont),
xw_status_win->boldfs); num_args++;
}
if (fg == bg)
fg = get_nhcolor(xw_status_win, CLR_GRAY).pixel;
XtSetArg(args[num_args], nhStr(XtNforeground), fg); num_args++;
XtSetArg(args[num_args], nhStr(XtNbackground), bg); num_args++;
XtSetValues(label, args, num_args);
XtResizeWidget(label, lbl_wid, lbl_hei, lbl_border_wid);
}
} else {
int x, y;
for (y = 0; y < X11_NUM_STATUS_LINES; y++) {
Cardinal dx = 0;
for (x = 0; x < X11_NUM_STATUS_FIELD; x++) {
int f = X11_fieldorder[y][x];
if (f <= BL_FLUSH)
continue;
if (!status_activefields[f])
continue;
if (f == BL_CONDITION) {
int i;
for (i = 0; i < 32; i++) {
label = X11_cond_labels[i];
num_args = 0;
XtSetArg(args[num_args], nhStr(XtNx), &lbl_x); num_args++;
XtSetArg(args[num_args], nhStr(XtNy), &lbl_y); num_args++;
XtSetArg(args[num_args], nhStr(XtNwidth), &lbl_wid); num_args++;
XtSetArg(args[num_args], nhStr(XtNheight), &lbl_hei); num_args++;
XtSetArg(args[num_args], nhStr(XtNborderWidth),
&lbl_border_wid); num_args++;
XtGetValues(label, args, num_args);
lbl_x = dx;
num_args = 0;
XtSetArg(args[num_args], nhStr(XtNx), lbl_x); num_args++;
XtSetValues(label, args, num_args);
XtConfigureWidget(label, lbl_x, lbl_y,
lbl_wid, lbl_hei, lbl_border_wid);
if (lbl_wid > 1)
dx += lbl_wid;
}
continue;
}
label = X11_status_labels[f];
text = status_vals[f];
if (f == BL_GOLD)
text = decode_mixed(tmpbuf, text);
num_args = 0;
XtSetArg(args[num_args], nhStr(XtNx), &lbl_x); num_args++;
XtSetArg(args[num_args], nhStr(XtNy), &lbl_y); num_args++;
XtSetArg(args[num_args], nhStr(XtNwidth), &lbl_wid); num_args++;
XtSetArg(args[num_args], nhStr(XtNheight), &lbl_hei); num_args++;
XtSetArg(args[num_args], nhStr(XtNborderWidth),
&lbl_border_wid); num_args++;
XtGetValues(label, args, num_args);
lbl_x = dx;
/*raw_printf("2:lbl_wid=%i('%s')", lbl_wid, text);*/
num_args = 0;
XtSetArg(args[num_args], nhStr(XtNx), lbl_x); num_args++;
XtSetArg(args[num_args], nhStr(XtNlabel), text); num_args++;
XtSetValues(label, args, num_args);
XtConfigureWidget(label, lbl_x, lbl_y,
lbl_wid, lbl_hei, lbl_border_wid);
dx += lbl_wid;
}
}
}
}
/*ARGSUSED*/
void
X11_status_update_fancy(fld, ptr, chg, percent, color, colormasks)
int fld, chg UNUSED, percent UNUSED, color UNUSED;
genericptr_t ptr;
unsigned long *colormasks UNUSED;
{
static const struct {
int bl, ff;
} bl_to_fancyfield[] = {
{ BL_TITLE, F_NAME },
{ BL_STR, F_STR },
{ BL_DX, F_DEX },
{ BL_CO, F_CON },
{ BL_IN, F_INT },
{ BL_WI, F_WIS },
{ BL_CH, F_CHA },
{ BL_ALIGN, F_ALIGN },
{ BL_SCORE, F_SCORE },
{ BL_CAP, F_ENCUMBER },
{ BL_GOLD, F_GOLD },
{ BL_ENE, F_POWER },
{ BL_ENEMAX, F_MAXPOWER },
{ BL_XP, F_LEVEL },
{ BL_AC, F_AC },
/*{ BL_HD, F_ },*/
{ BL_TIME, F_TIME },
{ BL_HUNGER, F_HUNGER },
{ BL_HP, F_HP },
{ BL_HPMAX, F_MAXHP },
{ BL_LEVELDESC, F_DLEVEL },
{ BL_EXP, F_EXP }
};
static const struct {
unsigned long mask;
int ff;
} mask_to_fancyfield[] = {
{ BL_MASK_STONE, F_STONE },
{ BL_MASK_SLIME, F_SLIME },
{ BL_MASK_STRNGL, F_STRNGL },
{ BL_MASK_FOODPOIS, F_FOODPOIS },
{ BL_MASK_TERMILL, F_TERMILL },
{ BL_MASK_BLIND, F_BLIND },
{ BL_MASK_DEAF, F_DEAF },
{ BL_MASK_STUN, F_STUN },
{ BL_MASK_CONF, F_CONF },
{ BL_MASK_HALLU, F_HALLU },
{ BL_MASK_LEV, F_LEV },
{ BL_MASK_FLY, F_FLY },
{ BL_MASK_RIDE, F_RIDE }
};
int i;
if (fld == BL_RESET || fld == BL_FLUSH) {
if (WIN_STATUS != WIN_ERR) {
struct xwindow *wp = &window_list[WIN_STATUS];
update_fancy_status(wp);
}
return;
}
if (fld == BL_CONDITION) {
unsigned long mask = (unsigned long) ptr;
for (i = 0; i < SIZE(mask_to_fancyfield); i++)
if (mask_to_fancyfield[i].mask == mask)
update_fancy_status_field(mask_to_fancyfield[i].ff);
} else {
for (i = 0; i < SIZE(bl_to_fancyfield); i++)
if (bl_to_fancyfield[i].bl == fld)
update_fancy_status_field(bl_to_fancyfield[i].ff);
}
}
void
X11_status_update(fld, ptr, chg, percent, color, colormasks)
int fld, chg UNUSED, percent UNUSED, color;
genericptr_t ptr;
unsigned long *colormasks;
{
if (appResources.fancy_status)
X11_status_update_fancy(fld, ptr, chg, percent, color, colormasks);
else
X11_status_update_tty(fld, ptr, chg, percent, color, colormasks);
}
Widget
create_tty_status(parent, top)
Widget parent, top;
{
Widget form; /* The form that surrounds everything. */
Widget w;
Arg args[16];
Cardinal num_args;
int i, x, y;
num_args = 0;
if (top != (Widget) 0) {
XtSetArg(args[num_args], nhStr(XtNfromVert), top);
num_args++;
}
XtSetArg(args[num_args], nhStr(XtNdefaultDistance), 0);
num_args++;
XtSetArg(args[num_args], XtNborderWidth, 0);
num_args++;
XtSetArg(args[num_args], XtNwidth, 400); num_args++;
XtSetArg(args[num_args], XtNheight, 100); num_args++;
form = XtCreateManagedWidget("status_viewport", viewportWidgetClass,
parent, args, num_args);
num_args = 0;
XtSetArg(args[num_args], XtNwidth, 400); num_args++;
XtSetArg(args[num_args], XtNheight, 100); num_args++;
w = XtCreateManagedWidget("status_form", formWidgetClass,
form, args, num_args);
for (y = 0; y < X11_NUM_STATUS_LINES; y++) {
for (x = 0; x < X11_NUM_STATUS_FIELD; x++) {
int fld = X11_fieldorder[y][x];
char labelname[BUFSZ];
int prevfld;
if (fld <= BL_FLUSH)
continue;
Sprintf(labelname, "label_%s", bl_idx_to_fldname(fld));
num_args = 0;
if (y > 0) {
prevfld = X11_fieldorder[y-1][0];
XtSetArg(args[num_args], nhStr(XtNfromVert),
X11_status_labels[prevfld]); num_args++;
}
if (x > 0) {
prevfld = X11_fieldorder[y][x-1];
XtSetArg(args[num_args], nhStr(XtNfromHoriz),
X11_status_labels[prevfld]); num_args++;
}
XtSetArg(args[num_args], nhStr(XtNhorizDistance), 0); num_args++;
XtSetArg(args[num_args], nhStr(XtNvertDistance), 0); num_args++;
XtSetArg(args[num_args], nhStr(XtNtopMargin), 0); num_args++;
XtSetArg(args[num_args], nhStr(XtNbottomMargin), 0); num_args++;
XtSetArg(args[num_args], nhStr(XtNleftMargin), 0); num_args++;
XtSetArg(args[num_args], nhStr(XtNrightMargin), 0); num_args++;
XtSetArg(args[num_args], nhStr(XtNjustify), XtJustifyLeft); num_args++;
XtSetArg(args[num_args], nhStr(XtNborderWidth), 0); num_args++;
/*
XtSetArg(args[num_args], nhStr(XtNlabel),
bl_idx_to_fldname(fld)); num_args++;
*/
XtSetArg(args[num_args], nhStr(XtNlabel), ""); num_args++;
X11_status_labels[fld] = XtCreateManagedWidget(labelname,
labelWidgetClass, w,
args, num_args);
}
}
for (i = 0; i < 32; i++) {
char condname[BUFSZ];
int prevfld;
Sprintf(condname, "cond_%i", i);
num_args = 0;
prevfld = X11_fieldorder[0][0];
XtSetArg(args[num_args], nhStr(XtNfromVert),
X11_status_labels[prevfld]); num_args++;
XtSetArg(args[num_args], nhStr(XtNfromHoriz),
(i == 0) ? X11_status_labels[BL_CONDITION]
: X11_cond_labels[i-1]); num_args++;
XtSetArg(args[num_args], nhStr(XtNhorizDistance), 0); num_args++;
XtSetArg(args[num_args], nhStr(XtNvertDistance), 0); num_args++;
XtSetArg(args[num_args], nhStr(XtNtopMargin), 0); num_args++;
XtSetArg(args[num_args], nhStr(XtNbottomMargin), 0); num_args++;
XtSetArg(args[num_args], nhStr(XtNleftMargin), 0); num_args++;
XtSetArg(args[num_args], nhStr(XtNrightMargin), 0); num_args++;
XtSetArg(args[num_args], nhStr(XtNjustify), XtJustifyLeft); num_args++;
XtSetArg(args[num_args], nhStr(XtNborderWidth), 0); num_args++;
XtSetArg(args[num_args], nhStr(XtNlabel), ""); num_args++;
X11_cond_labels[i] = XtCreateManagedWidget(condname,
labelWidgetClass, w,
args, num_args);
}
return w;
}
/*ARGSUSED*/
void
create_status_window_tty(wp, create_popup, parent)
struct xwindow *wp; /* window pointer */
boolean create_popup UNUSED;
Widget parent;
{
Arg args[10];
Cardinal num_args;
wp->type = NHW_STATUS;
X11_status_widget = wp->w = create_tty_status(parent, (Widget) 0);
num_args = 0;
XtSetArg(args[num_args], nhStr(XtNforeground), &X11_status_widget_fg); num_args++;
XtSetArg(args[num_args], nhStr(XtNbackground), &X11_status_widget_bg); num_args++;
XtGetValues(X11_status_widget, args, num_args);
}
void
destroy_status_window_tty(wp)
struct xwindow *wp;
{
/* If status_information is defined, then it a "text" status window. */
if (wp->status_information) {
if (wp->popup) {
nh_XtPopdown(wp->popup);
if (!wp->keep_window)
XtDestroyWidget(wp->popup), wp->popup = (Widget) 0;
}
free((genericptr_t) wp->status_information);
wp->status_information = 0;
} else {
}
if (!wp->keep_window)
wp->type = NHW_NONE;
}
/*ARGSUSED*/
void
adjust_status_tty(wp, str)
struct xwindow *wp UNUSED;
const char *str UNUSED;
{
/* nothing */
}
void
create_status_window(wp, create_popup, parent)
struct xwindow *wp; /* window pointer */
boolean create_popup;
Widget parent;
{
xw_status_win = wp;
if (appResources.fancy_status)
create_status_window_fancy(wp, create_popup, parent);
else
create_status_window_tty(wp, create_popup, parent);
}
void
destroy_status_window(wp)
struct xwindow *wp;
{
if (appResources.fancy_status)
destroy_status_window_fancy(wp);
else
destroy_status_window_tty(wp);
}
void
adjust_status(wp, str)
struct xwindow *wp;
const char *str;
{
if (appResources.fancy_status)
adjust_status_fancy(wp, str);
else
adjust_status_tty(wp, str);
}
extern const char *hu_stat[]; /* from eat.c */
extern const char *enc_stat[]; /* from botl.c */
static void FDECL(update_fancy_status, (struct xwindow *));
static Widget FDECL(create_fancy_status, (Widget, Widget));
static void FDECL(destroy_fancy_status, (struct xwindow *));
void
create_status_window(wp, create_popup, parent)
create_status_window_fancy(wp, create_popup, parent)
struct xwindow *wp; /* window pointer */
boolean create_popup;
Widget parent;
@@ -60,7 +798,7 @@ Widget parent;
* window.
*/
if (!parent)
panic("create_status_window: no parent for fancy status");
panic("create_status_window_fancy: no parent for fancy status");
wp->status_information = 0;
wp->w = create_fancy_status(parent, (Widget) 0);
return;
@@ -133,7 +871,7 @@ Widget parent;
}
void
destroy_status_window(wp)
destroy_status_window_fancy(wp)
struct xwindow *wp;
{
/* If status_information is defined, then it a "text" status window. */
@@ -159,7 +897,7 @@ struct xwindow *wp;
* + We didn't set stringInPlace on the widget.
*/
void
adjust_status(wp, str)
adjust_status_fancy(wp, str)
struct xwindow *wp;
const char *str;
{
@@ -216,52 +954,6 @@ static Widget FDECL(init_column, (const char *, Widget, Widget, Widget,
static void NDECL(fixup_cond_widths);
static Widget FDECL(init_info_form, (Widget, Widget, Widget));
/*
* Form entry storage indices.
*/
#define F_DUMMY 0
#define F_STR 1
#define F_DEX 2
#define F_CON 3
#define F_INT 4
#define F_WIS 5
#define F_CHA 6
#define F_NAME 7
#define F_DLEVEL 8
#define F_GOLD 9
#define F_HP 10
#define F_MAXHP 11
#define F_POWER 12
#define F_MAXPOWER 13
#define F_AC 14
#define F_LEVEL 15
#define F_EXP 16
#define F_ALIGN 17
#define F_TIME 18
#define F_SCORE 19
/* status conditions grouped by columns; tty orders these differently */
#define F_STONE 20
#define F_SLIME 21
#define F_STRNGL 22
#define F_FOODPOIS 23
#define F_TERMILL 24
#define F_HUNGER 25
#define F_ENCUMBER 26
#define F_LEV 27
#define F_FLY 28
#define F_RIDE 29
#define F_BLIND 30
#define F_DEAF 31
#define F_STUN 32
#define F_CONF 33
#define F_HALLU 34
#define NUM_STATS 35
/*
* Notes:
* + Alignment needs a different init value, because -1 is an alignment.
@@ -583,18 +1275,13 @@ long new_value;
* [**] HD is shown instead of level and exp if Upolyd.
*/
static void
update_fancy_status(wp)
struct xwindow *wp;
update_fancy_status_field(i)
int i;
{
struct X_status_value *sv;
struct X_status_value *sv = &shown_stats[i];
long val;
int i;
if (wp->cursy != 0)
return; /* do a complete update when line 0 is done */
for (i = 0, sv = shown_stats; i < NUM_STATS; i++, sv++) {
switch (i) {
switch (i) {
case F_DUMMY:
val = 0L;
break;
@@ -734,11 +1421,25 @@ struct xwindow *wp;
val = 0L;
break;
} /* default */
} /* switch */
update_val(sv, val);
}
} /* switch */
update_val(sv, val);
}
/*ARGUSED*/
static void
update_fancy_status(wp)
struct xwindow *wp UNUSED;
{
int i;
/*if (wp->cursy != 0)
return;*/ /* do a complete update when line 0 is done */
for (i = 0; i < NUM_STATS; i++)
update_fancy_status_field(i);
}
/*
* Turn off hilighted status values after a certain amount of turns.
*/

View File

@@ -27,23 +27,26 @@ void *me;
void *nextprocs;
void *nextdata;
{
struct chainin_data *tdp = 0;
switch (cmd) {
case WINCHAIN_ALLOC: {
struct chainin_data *tdp = calloc(1, sizeof(struct chainin_data));
case WINCHAIN_ALLOC:
tdp = (struct chainin_data *) alloc(sizeof *tdp);
tdp->nprocs = 0;
tdp->ndata = 0;
tdp->linknum = n;
cibase = tdp;
return tdp;
}
case WINCHAIN_INIT: {
struct chainin_data *tdp = me;
cibase = 0;
break;
case WINCHAIN_INIT:
tdp = me;
tdp->nprocs = nextprocs;
tdp->ndata = nextdata;
return tdp;
}
break;
default:
raw_printf("chainin_procs_chain: bad cmd\n");
exit(EXIT_FAILURE);
panic("chainin_procs_chain: bad cmd\n");
/*NOTREACHED*/
}
return tdp;
}
/* XXX if we don't need this, take it out of the table */

View File

@@ -10,7 +10,7 @@
struct chainout_data {
struct window_procs *nprocs;
#if 0
void *ndata;
void *ndata;
#endif
int linknum;
@@ -24,21 +24,23 @@ void *me;
void *nextprocs;
void *nextdata UNUSED;
{
struct chainout_data *tdp = 0;
switch (cmd) {
case WINCHAIN_ALLOC: {
struct chainout_data *tdp = calloc(1, sizeof(struct chainout_data));
case WINCHAIN_ALLOC:
tdp = (struct chainout_data *) alloc(sizeof *tdp);
tdp->nprocs = 0;
tdp->linknum = n;
return tdp;
}
case WINCHAIN_INIT: {
struct chainout_data *tdp = me;
break;
case WINCHAIN_INIT:
tdp = me;
tdp->nprocs = nextprocs;
return tdp;
}
break;
default:
raw_printf("chainout_procs_chain: bad cmd\n");
exit(EXIT_FAILURE);
panic("chainout_procs_chain: bad cmd\n");
/*NOTREACHED*/
}
return tdp;
}
/* XXX if we don't need this, take it out of the table */

View File

@@ -48,22 +48,25 @@ void *me;
void *nextprocs;
void *nextdata;
{
struct trace_data *tdp = 0;
switch (cmd) {
case WINCHAIN_ALLOC: {
struct trace_data *tdp = calloc(1, sizeof(struct trace_data));
case WINCHAIN_ALLOC:
tdp = (struct trace_data *) alloc(sizeof *tdp);
tdp->nprocs = 0;
tdp->ndata = 0;
tdp->linknum = n;
return tdp;
}
case WINCHAIN_INIT: {
struct trace_data *tdp = me;
break;
case WINCHAIN_INIT:
tdp = me;
tdp->nprocs = nextprocs;
tdp->ndata = nextdata;
return tdp;
}
break;
default:
raw_printf("trace_procs_chain: bad cmd\n");
exit(EXIT_FAILURE);
panic("trace_procs_chain: bad cmd\n");
/*NOTREACHED*/
}
return tdp;
}
void
@@ -71,20 +74,22 @@ trace_procs_init(dir)
int dir;
{
char fname[200];
long pid;
/* processors shouldn't need this test, but just in case */
if (dir != WININIT)
return;
sprintf(fname, "%s/tlog.%d", HACKDIR, getpid());
pid = (long) getpid();
Sprintf(fname, "%s/tlog.%ld", HACKDIR, pid);
wc_tracelogf = fopen(fname, "w");
if (wc_tracelogf == NULL) {
if (!wc_tracelogf) {
fprintf(stderr, "Can't open trace log file %s: %s\n", fname,
strerror(errno));
exit(EXIT_FAILURE);
nh_terminate(EXIT_FAILURE);
}
setvbuf(wc_tracelogf, (char *) NULL, _IONBF, 0);
fprintf(wc_tracelogf, "Trace log started for pid %d\n", getpid());
setvbuf(wc_tracelogf, (char *) 0, _IONBF, 0);
fprintf(wc_tracelogf, "Trace log started for pid %ld\n", pid);
indent_level = 0;
}
@@ -769,7 +774,7 @@ char *bufp;
}
if (bufp) {
fprintf(wc_tracelogf, "%p)\n", bufp);
fprintf(wc_tracelogf, "%s)\n", fmt_ptr((genericptr_t) bufp));
} else {
fprintf(wc_tracelogf, "NULL)\n");
}
@@ -785,7 +790,7 @@ void *vp;
{
struct trace_data *tdp = vp;
int rv;
int ecl_size;
int ecl_size = 0;
/* this is ugly, but the size isn't exposed */
const struct ext_func_tab *efp;
@@ -1095,7 +1100,8 @@ unsigned long *colormasks;
ptr, chg, percent);
PRE;
(*tdp->nprocs->win_status_update)(tdp->ndata, idx, ptr, chg, percent, color, colormasks);
(*tdp->nprocs->win_status_update)(tdp->ndata, idx, ptr, chg, percent,
color, colormasks);
POST;
}