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
+84 -79
View File
@@ -1047,7 +1047,15 @@ used up all the letters, so this is a way to introduce the less frequently
used commands. used commands.
What extended commands are available depends on what features the game was What extended commands are available depends on what features the game was
compiled with. 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 Adjust inventory letters (most useful when the
.op fixinv .op fixinv
option is \(lqon\(rq). option is \(lqon\(rq).
@@ -1089,7 +1097,7 @@ Autocompletes.
Default key is \(oqM-A\(cq, and also \(oq\(haN\(cq if Default key is \(oqM-A\(cq, and also \(oq\(haN\(cq if
.op number_pad .op number_pad
is on. is on.
.lp #apply .lp "#apply "
Apply (use) a tool such as a pick-axe, a key, or a lamp. Apply (use) a tool such as a pick-axe, a key, or a lamp.
Default key is \(oqa\(cq. Default key is \(oqa\(cq.
.lp "" .lp ""
@@ -1107,70 +1115,70 @@ Toggle the
.op autopickup .op autopickup
option on/off. option on/off.
Default key is \(oq@\(cq. Default key is \(oq@\(cq.
.lp #call .lp "#call "
Call (name) a monster, or an object in inventory, on the floor, Call (name) a monster, or an object in inventory, on the floor,
or in the discoveries list, or add an annotation for the or in the discoveries list, or add an annotation for the
current level (same as \(lq#annotate\(rq). current level (same as \(lq#annotate\(rq).
Default key is \(oqC\(cq. Default key is \(oqC\(cq.
.lp #cast .lp "#cast "
Cast a spell. Cast a spell.
Default key is \(oqZ\(cq. Default key is \(oqZ\(cq.
.lp #chat .lp "#chat "
Talk to someone. Talk to someone.
Default key is \(oqM-c\)cq. Default key is \(oqM-c\)cq.
.lp #close .lp "#close "
Close a door. Close a door.
Default key is \(oqc\(cq. Default key is \(oqc\(cq.
.lp #conduct .lp "#conduct "
List voluntary challenges you have maintained. List voluntary challenges you have maintained.
Autocompletes. Autocompletes.
Default key is \(oqM-C\(cq. Default key is \(oqM-C\(cq.
.lp "" .lp ""
See the section below entitled \(lqConduct\(rq for details. See the section below entitled \(lqConduct\(rq for details.
.lp "#dip " .lp "#dip "
Dip an object into something. Dip an object into something.
Autocompletes. Autocompletes.
Default key is \(oqM-d\(cq. Default key is \(oqM-d\(cq.
.lp #down .lp "#down "
Go down a staircase. Go down a staircase.
Default key is \(oq>\(cq. Default key is \(oq>\(cq.
.lp #drop .lp "#drop "
Drop an item. Drop an item.
Default key is \(oqd\(cq. Default key is \(oqd\(cq.
.lp #droptype .lp #droptype
Drop specific item types. Drop specific item types.
Default key is \(oqD\(cq. Default key is \(oqD\(cq.
.lp "#eat " .lp "#eat "
Eat something. Eat something.
Default key is \(oqe\(cq. Default key is \(oqe\(cq.
The \(oqm\(cq prefix skips eating items on the floor. The \(oqm\(cq prefix skips eating items on the floor.
.lp #engrave .lp "#engrave "
Engrave writing on the floor. Engrave writing on the floor.
Default key is \(oqE\(cq. Default key is \(oqE\(cq.
.lp #enhance .lp "#enhance "
Advance or check weapon and spell skills. Advance or check weapon and spell skills.
Autocompletes. Autocompletes.
Default key is \(oqM-e\(cq. Default key is \(oqM-e\(cq.
.lp #exploremode .lp #exploremode
Enter the explore mode. Enter the explore mode.
.lp #fire .lp "#fire "
Fire ammunition from quiver. Fire ammunition from quiver.
Default key is \(oqf\(cq. Default key is \(oqf\(cq.
.lp #force .lp "#force "
Force a lock. Force a lock.
Autocompletes. Autocompletes.
Default key is \(oqM-f\(cq. Default key is \(oqM-f\(cq.
.lp #glance .lp "#glance "
Show what type of thing a map symbol corresponds to. Show what type of thing a map symbol corresponds to.
Default key is \(oq;\(cq. Default key is \(oq;\(cq.
.lp #help .lp "#help "
Show the help menu. Show the help menu.
Default key is \(oq?\(cq, and also \(oqh\(cq if Default key is \(oq?\(cq, and also \(oqh\(cq if
.op number_pad .op number_pad
is on. is on.
.lp #herecmdmenu .lp #herecmdmenu
Show a menu of possible actions in your current location. Show a menu of possible actions in your current location.
.lp #history .lp "#history "
Show long version and game history. Show long version and game history.
Default key is \(oqV\(cq. Default key is \(oqV\(cq.
.lp #inventory .lp #inventory
@@ -1179,22 +1187,22 @@ Default key is \(oqi\(cq.
.lp #inventtype .lp #inventtype
Inventory specific item types. Inventory specific item types.
Default key is \(oqI\(cq. Default key is \(oqI\(cq.
.lp #invoke .lp "#invoke "
Invoke an object's special powers. Invoke an object's special powers.
Autocompletes. Autocompletes.
Default key is \(oqM-i\(cq. Default key is \(oqM-i\(cq.
.lp #jump .lp "#jump "
Jump to another location. Jump to another location.
Autocompletes. Autocompletes.
Default key is \(oqM-j\(cq, and also \(oqj\(cq if Default key is \(oqM-j\(cq, and also \(oqj\(cq if
.op number_pad .op number_pad
is on. is on.
.lp #kick .lp "#kick "
Kick something. Kick something.
Default key is \(oq\(haD\(cq, and \(oqk\(cq if Default key is \(oq\(haD\(cq, and \(oqk\(cq if
.op number_pad .op number_pad
is on. is on.
.lp #known .lp "#known "
Show what object types have been discovered. Show what object types have been discovered.
Default key is \(oq\\\(cq. Default key is \(oq\\\(cq.
.lp #knownclass .lp #knownclass
@@ -1208,10 +1216,10 @@ Debug mode only.
Show mobile light sources. Show mobile light sources.
Autocompletes. Autocompletes.
Debug mode only. Debug mode only.
.lp #look .lp "#look "
Look at what is here, under you. Look at what is here, under you.
Default key is \(oq:\(cq. Default key is \(oq:\(cq.
.lp #loot .lp "#loot "
Loot a box or bag on the floor beneath you, or the saddle Loot a box or bag on the floor beneath you, or the saddle
from a steed standing next to you. from a steed standing next to you.
Autocompletes. Autocompletes.
@@ -1220,18 +1228,16 @@ and go directly to removing a saddle.
Default key is \(oqM-l\(cq, and also \(oql\(cq if Default key is \(oqM-l\(cq, and also \(oql\(cq if
.op number_pad .op number_pad
is on. is on.
.lp #monster .lp "#monster "
Use a monster's special ability (when polymorphed into monster form). Use a monster's special ability (when polymorphed into monster form).
Autocompletes. Autocompletes.
Default key is \(oqM-m\(cq. Default key is \(oqM-m\(cq.
.lp #name .lp "#name "
Name a monster, an individual object, or a type of object. Name a monster, an individual object, or a type of object.
Same as \(lq#call\(rq. Same as \(lq#call\(rq.
Autocompletes. Autocompletes.
Default keys are \(oqN\(cq, \(oqM-n\(cq, and \(oqM-N\(cq. 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 .lp "#offer " \" `ff' ligature is narrow
.\" \" as #offer but that looks bad because it is too close to 'r'
.lp "#offer "
Offer a sacrifice to the gods. Offer a sacrifice to the gods.
Autocompletes. Autocompletes.
Default key is \(oqM-o\(cq. 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. Corpses of recently killed monsters are the fodder of choice.
.lp "" .lp ""
The \(oqm\(cq prefix skips offering any items which are on the altar. 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. Open a door.
Default key is \(oqo\(cq. Default key is \(oqo\(cq.
.lp #options .lp "#options "
Show and change option settings. Show and change option settings.
Default key is \(oqO\(cq. Default key is \(oqO\(cq.
.lp #overview .lp #overview
@@ -1258,15 +1263,15 @@ level will be included regardless of annotations.
Autocompletes. Autocompletes.
Default keys are \(oq\(haO\(cq, and \(oqM-O\(cq. Default keys are \(oq\(haO\(cq, and \(oqM-O\(cq.
.\" DON'T PANIC! .\" DON'T PANIC!
.lp #panic .lp "#panic "
Test the panic routine. Test the panic routine.
Terminates the current game. Terminates the current game.
Autocompletes. Autocompletes.
Debug mode only. Debug mode only.
.lp "#pay " .lp "#pay "
Pay your shopping bill. Pay your shopping bill.
Default key is \(oqp\(cq. Default key is \(oqp\(cq.
.lp #pickup .lp "#pickup "
Pick up things at the current location. Pick up things at the current location.
Default key is \(oq,\(cq. Default key is \(oq,\(cq.
The \(oqm\(cq prefix forces use of a menu. The \(oqm\(cq prefix forces use of a menu.
@@ -1274,7 +1279,7 @@ The \(oqm\(cq prefix forces use of a menu.
Polymorph self. Polymorph self.
Autocompletes. Autocompletes.
Debug mode only. Debug mode only.
.lp #pray .lp "#pray "
Pray to the gods for help. Pray to the gods for help.
Autocompletes. Autocompletes.
Default key is \(oqM-p\(cq. 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 It is enabled by default, and you can reset the
.op paranoid_confirmation .op paranoid_confirmation
option to disable it. option to disable it.
.lp #prevmsg .lp "#prevmsg "
Show previously displayed game messages. Show previously displayed game messages.
Default key is \(oq\(haP\(cq. Default key is \(oq\(haP\(cq.
.lp #puton .lp "#puton "
Put on an accessory (ring, amulet, etc). Put on an accessory (ring, amulet, etc).
Default key is \(oqP\(cq. Default key is \(oqP\(cq.
.lp #quaff .lp "#quaff "
Quaff (drink) something. Quaff (drink) something.
Default key is \(oqq\(cq. Default key is \(oqq\(cq.
.lp #quit .lp "#quit "
Quit the program without saving your game. Quit the program without saving your game.
Autocompletes. Autocompletes.
Default key is \(oqM-q\(cq. Default key is \(oqM-q\(cq.
@@ -1307,35 +1312,35 @@ By default a response of \(oqy\(cq acknowledges that intent.
You can set the You can set the
.op paranoid_confirmation .op paranoid_confirmation
option to require a response of \(lqyes\(rq instead. option to require a response of \(lqyes\(rq instead.
.lp #quiver .lp "#quiver "
Select ammunition for quiver. Select ammunition for quiver.
Default key is \(oqQ\(cq. Default key is \(oqQ\(cq.
.lp #read .lp "#read "
Read a scroll, a spellbook, or something else. Read a scroll, a spellbook, or something else.
Default key is \(oqr\(cq. Default key is \(oqr\(cq.
.lp #redraw .lp "#redraw "
Redraw the screen. Redraw the screen.
Default key is \(oq\(haR\(cq, and also \(oq\(haL\(cq if Default key is \(oq\(haR\(cq, and also \(oq\(haL\(cq if
.op number_pad .op number_pad
is on. is on.
.lp #remove .lp "#remove "
Remove an accessory (ring, amulet, etc). Remove an accessory (ring, amulet, etc).
Default key is \(oqR\(cq. Default key is \(oqR\(cq.
.lp #ride .lp "#ride "
Ride (or stop riding) a saddled creature. Ride (or stop riding) a saddled creature.
Autocompletes. Autocompletes.
Default key is \(oqM-R\(cq. Default key is \(oqM-R\(cq.
.lp "#rub " .lp "#rub "
Rub a lamp or a stone. Rub a lamp or a stone.
Autocompletes. Autocompletes.
Default key is \(oqM-r\(cq. Default key is \(oqM-r\(cq.
.lp #save .lp "#save "
Save the game and exit the program. Save the game and exit the program.
Default key is \(oqS\(cq. Default key is \(oqS\(cq.
.lp #search .lp "#search "
Search for traps and secret doors around you. Search for traps and secret doors around you.
Default key is \(oqs\(cq. Default key is \(oqs\(cq.
.lp #seeall .lp "#seeall "
Show all equipment in use. Show all equipment in use.
Default key is \(oq*\(cq. Default key is \(oq*\(cq.
.lp #seeamulet .lp #seeamulet
@@ -1344,10 +1349,10 @@ Default key is \(oq\(dq\(cq. \" double quote
.lp #seearmor .lp #seearmor
Show the armor currently worn. Show the armor currently worn.
Default key is \(oq[\(cq. Default key is \(oq[\(cq.
.lp #seegold .lp "#seegold "
Count your gold. Count your gold.
Default key is \(oq$\(cq. Default key is \(oq$\(cq.
.lp #seenv .lp "#seenv "
Show seen vectors. Show seen vectors.
Autocompletes. Autocompletes.
Debug mode only. Debug mode only.
@@ -1360,30 +1365,30 @@ Default key is \(oq+\(cq.
.lp #seetools .lp #seetools
Show the tools currently in use. Show the tools currently in use.
Default key is \(oq(\(cq. Default key is \(oq(\(cq.
.lp #seetrap .lp "#seetrap "
Show the type of an adjacent trap. Show the type of an adjacent trap.
Default key is \(oq\(ha\(cq. \" 'hat' (circumflex character) Default key is \(oq\(ha\(cq. \" 'hat' (circumflex character)
.lp #seeweapon .lp #seeweapon
Show the weapon currently wielded. Show the weapon currently wielded.
Default key is \(oq)\(cq. Default key is \(oq)\(cq.
.lp #shell .lp "#shell "
Do a shell escape. Do a shell escape.
Default key is \(oq!\(cq. Default key is \(oq!\(cq.
.lp "#sit " .lp "#sit "
Sit down. Sit down.
Autocompletes. Autocompletes.
Default key is \(oqM-s\(cq. Default key is \(oqM-s\(cq.
.lp #stats .lp "#stats "
Show memory usage statistics. Show memory usage statistics.
Autocompletes. Autocompletes.
Debug mode only. Debug mode only.
.lp #suspend .lp "#suspend "
Suspend the game. Suspend the game.
Default key is \(oq\(haZ\(cq. Default key is \(oq\(haZ\(cq.
.lp #swap .lp "#swap "
Swap wielded and secondary weapons. Swap wielded and secondary weapons.
Default key is \(oqx\(cq. Default key is \(oqx\(cq.
.lp #takeoff .lp "#takeoff "
Take off one piece of armor. Take off one piece of armor.
Default key is \(oqT\(cq. Default key is \(oqT\(cq.
.lp #takeoffall .lp #takeoffall
@@ -1392,24 +1397,24 @@ Default key is \(oqA\(cq.
.lp #teleport .lp #teleport
Teleport around the level. Teleport around the level.
Default key is \(oq\(haT\(cq. Default key is \(oq\(haT\(cq.
.lp #terrain .lp "#terrain "
Show bare map without displaying monsters, objects, or traps. Show bare map without displaying monsters, objects, or traps.
Autocompletes. Autocompletes.
.lp #therecmdmenu .lp #therecmdmenu
Show a menu of possible actions in a location next to you. Show a menu of possible actions in a location next to you.
.lp #throw .lp "#throw "
Throw something. Throw something.
Default key is \(oqt\(cq. Default key is \(oqt\(cq.
.lp #timeout .lp "#timeout "
Look at the timeout queue. Look at the timeout queue.
Autocompletes. Autocompletes.
Debug mode only. Debug mode only.
.lp "#tip " .lp "#tip "
Tip over a container (bag or box) to pour out its contents. Tip over a container (bag or box) to pour out its contents.
Autocompletes. Autocompletes.
Default key is \(oqM-T\(cq. Default key is \(oqM-T\(cq.
The \(oqm\(cq prefix makes the command use a menu. The \(oqm\(cq prefix makes the command use a menu.
.lp #travel .lp "#travel "
Travel to a specific location on the map. Travel to a specific location on the map.
Default key is \(oq_\(cq. \" underscore Default key is \(oq_\(cq. \" underscore
Using the \(lqrequest menu\(rq prefix shows a menu of interesting targets 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 .op autodescribe
option is on, the top line will show \(lq(no travel path)\(rq if 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. your character does not know of a path to that location.
.lp #turn .lp "#turn "
Turn undead away. Turn undead away.
Autocompletes. Autocompletes.
Default key is \(oqM-t\(cq. Default key is \(oqM-t\(cq.
@@ -1432,53 +1437,53 @@ is off.
Note that you must Note that you must
use suitable weapons for this type of combat, or it will use suitable weapons for this type of combat, or it will
be automatically turned off. be automatically turned off.
.lp #untrap .lp "#untrap "
Untrap something (trap, door, or chest). Untrap something (trap, door, or chest).
Default key is \(oqM-u\(cq, and \(oqu\(cq if Default key is \(oqM-u\(cq, and \(oqu\(cq if
.op number_pad .op number_pad
is on. is on.
.lp "" .lp ""
In some circumstances it can also be used to rescue trapped monsters. In some circumstances it can also be used to rescue trapped monsters.
.lp "#up " .lp "#up "
Go up a staircase. Go up a staircase.
Default key is \(oq<\(cq. Default key is \(oq<\(cq.
.lp #vanquished .lp #vanquished
List vanquished monsters. List vanquished monsters.
Autocompletes. Autocompletes.
Debug mode only. Debug mode only.
.lp #version .lp "#version "
Print compile time options for this version of NetHack. Print compile time options for this version of NetHack.
Autocompletes. Autocompletes.
Default key is \(oqM-v\(cq. Default key is \(oqM-v\(cq.
.lp #versionshort .lp #versionshort
Show version string. Show version string.
Default key is \(oqv\(cq. Default key is \(oqv\(cq.
.lp #vision .lp "#vision "
Show vision array. Show vision array.
Autocompletes. Autocompletes.
Debug mode only. Debug mode only.
.lp #wait .lp "#wait "
Rest one move while doing nothing. Rest one move while doing nothing.
Default key is \(oq.\(cq, and also \(oq\ \(cq if Default key is \(oq.\(cq, and also \(oq\ \(cq if
.op rest_on_space .op rest_on_space
is on. is on.
.lp #wear .lp "#wear "
Wear a piece of armor. Wear a piece of armor.
Default key is \(oqW\(cq. Default key is \(oqW\(cq.
.lp #whatdoes .lp #whatdoes
Tell what a key does. Tell what a key does.
Default key is \(oq&\(cq. Default key is \(oq&\(cq.
.lp #whatis .lp "#whatis "
Show what type of thing a symbol corresponds to. Show what type of thing a symbol corresponds to.
Default key is \(oq/\(cq. Default key is \(oq/\(cq.
.lp #wield .lp "#wield "
Wield a weapon. Wield a weapon.
Default key is \(oqw\(cq. Default key is \(oqw\(cq.
.lp #wipe .lp "#wipe "
Wipe off your face. Wipe off your face.
Autocompletes. Autocompletes.
Default key is \(oqM-w\(cq. Default key is \(oqM-w\(cq.
.lp #wizbury .lp "#wizbury "
Bury objects under and around you. Bury objects under and around you.
Autocompletes. Autocompletes.
Debug mode only. Debug mode only.
@@ -1508,7 +1513,7 @@ Teleport to another level.
Autocompletes. Autocompletes.
Debug mode only. Debug mode only.
Default key is \(oq\(haV\(cq. Default key is \(oq\(haV\(cq.
.lp #wizmap .lp "#wizmap "
Map the level. Map the level.
Autocompletes. Autocompletes.
Debug mode only. Debug mode only.
@@ -1525,19 +1530,19 @@ Debug mode only.
Show locations of special levels. Show locations of special levels.
Autocompletes. Autocompletes.
Debug mode only. Debug mode only.
.lp #wizwish .lp "#wizwish "
Wish for something. Wish for something.
Autocompletes. Autocompletes.
Debug mode only. Debug mode only.
Default key is \(oq\(haW\(cq. Default key is \(oq\(haW\(cq.
.lp #wmode .lp "#wmode "
Show wall modes. Show wall modes.
Autocompletes. Autocompletes.
Debug mode only. Debug mode only.
.lp "#zap " .lp "#zap "
Zap a wand. Zap a wand.
Default key is \(oqz\(cq. Default key is \(oqz\(cq.
.lp "#? " .lp "#? "
Help menu: get the list of available extended commands. Help menu: get the list of available extended commands.
.lp "" .lp ""
.pg .pg
+35 -35
View File
@@ -1335,12 +1335,15 @@
#offer #offer
Offer a sacrifice to the gods. Autocompletes. Default key 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. You'll need to find an altar to have any chance at success.
Corpses of recently killed monsters are the fodder of Corpses of recently killed monsters are the fodder of
choice. choice.
The `m' prefix skips offering any items which are on the al-
tar.
#open #open
Open a door. Default key is `o'. Open a door. Default key is `o'.
@@ -1375,9 +1378,6 @@
Pray to the gods for help. Autocompletes. Default key is Pray to the gods for help. Autocompletes. Default key is
`M-p'. `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 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 praying right away.) Since using this command by accident
can cause trouble, there is an option to make you confirm can cause trouble, there is an option to make you confirm
your intent before praying. It is enabled by default, and 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- Rub a lamp or a stone. Autocompletes. Default key is `M-
r'. 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
Search for traps and secret doors around you. Default key Search for traps and secret doors around you. Default key
is `s'. is `s'.
@@ -1506,9 +1509,6 @@
#swap #swap
Swap wielded and secondary weapons. Default key is `x'. 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 #takeoffall
Remove all armor. Default key is `A'. Remove all armor. Default key is `A'.
@@ -1574,9 +1577,6 @@
#up #up
Go up a staircase. Default key is `<'. Go up a staircase. Default key is `<'.
#vanquished
List vanquished monsters. Autocompletes. Debug mode only.
NetHack 3.6 October 16, 2018 NetHack 3.6 October 16, 2018
@@ -1588,6 +1588,9 @@
#vanquished
List vanquished monsters. Autocompletes. Debug mode only.
#version #version
Print compile time options for this version of NetHack. Au- Print compile time options for this version of NetHack. Au-
tocompletes. Default key is `M-v'. tocompletes. Default key is `M-v'.
@@ -1640,9 +1643,6 @@
Set one or more intrinsic attributes. Autocompletes. Debug Set one or more intrinsic attributes. Autocompletes. Debug
mode only. mode only.
#wizlevelport
Teleport to another level. Autocompletes. Debug mode only.
NetHack 3.6 October 16, 2018 NetHack 3.6 October 16, 2018
@@ -1654,6 +1654,8 @@
#wizlevelport
Teleport to another level. Autocompletes. Debug mode only.
Default key is `^V'. Default key is `^V'.
#wizmap #wizmap
@@ -1705,8 +1707,6 @@
M-A #annotate M-A #annotate
M-c #chat
@@ -1720,6 +1720,8 @@
M-c #chat
M-C #conduct M-C #conduct
M-d #dip M-d #dip
@@ -1771,8 +1773,6 @@
j #jump j #jump
k #kick
@@ -1786,6 +1786,8 @@
k #kick
l #loot l #loot
N #name N #name
@@ -1838,8 +1840,6 @@
There is a special pre-mapped branch of the dungeon based on There is a special pre-mapped branch of the dungeon based on
the classic computer game "Sokoban." The goal is to push the 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 NetHack 3.6 October 16, 2018
@@ -1852,8 +1852,10 @@
traditional rules of Sokoban. Some allowances are permitted in boulders into the pits or holes. With careful foresight, it is
case the player gets stuck; however, they will lower your luck. 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 (`<', `>') 5.3. Stairs and ladders (`<', `>')
@@ -1904,8 +1906,6 @@
floor while inside a shop. You will either be offered an amount 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 of gold and asked whether you're willing to sell, or you'll be
told that the shopkeeper isn't interested (generally, your item 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 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 If you drop something in a shop by accident, the shopkeeper
will usually claim ownership without offering any compensation. will usually claim ownership without offering any compensation.
You'll have to buy it back if you want to reclaim it. 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 from another when multiple monsters are present. Assigning a
name which is just a space will remove any prior name. 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 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- 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 sters such as a shopkeeper or the Oracle of Delphi can produce
useful results. useful results.
@@ -2038,8 +2040,6 @@
with it even if adjacent at the time. with it even if adjacent at the time.
NetHack 3.6 October 16, 2018 NetHack 3.6 October 16, 2018
@@ -4852,8 +4852,7 @@
and ride, and "all" for every condition. and ride, and "all" for every condition.
Allowed behaviors are "always", "up", "down", "changed", a per- Allowed behaviors are "always", "up", "down", "changed", a per-
centage or absolute number threshold, or a text to match centage or absolute number threshold, or text to match against.
against.
* "always" will set the default attributes for that field. * "always" will set the default attributes for that field.
@@ -4878,6 +4877,7 @@
points" fields. points" fields.
NetHack 3.6 October 16, 2018 NetHack 3.6 October 16, 2018
+1
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 in Guidebook.mn and Guidebook.txt, the 'I' command mis-described `IX' as
displaying inventory items whose bless/curse state is "known" displaying inventory items whose bless/curse state is "known"
(Guidebook.tex correctly had "unknown") (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 Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository
+1
View File
@@ -145,6 +145,7 @@ E int NDECL(getbones);
/* ### botl.c ### */ /* ### botl.c ### */
E const char *FDECL(bl_idx_to_fldname, (int));
E char *NDECL(do_statusline1); E char *NDECL(do_statusline1);
E void NDECL(check_gold_symbol); E void NDECL(check_gold_symbol);
E char *NDECL(do_statusline2); E char *NDECL(do_statusline2);
+15 -5
View File
@@ -153,12 +153,7 @@ struct menu_info_t {
struct menu curr_menu; /* Menu being displayed. */ struct menu curr_menu; /* Menu being displayed. */
struct menu new_menu; /* New menu being built. */ struct menu new_menu; /* New menu being built. */
boolean nh_colors_inited;
XColor nh_colors[CLR_MAX];
XFontStruct *fs; /* Font for the window. */ XFontStruct *fs; /* Font for the window. */
XFontStruct *boldfs; /* Bold font */
Display *boldfs_dpy;
long menu_count; /* number entered by user */ long menu_count; /* number entered by user */
Dimension line_height; /* Total height of a line of text. */ Dimension line_height; /* Total height of a line of text. */
Dimension internal_height; /* Internal height between widget & border */ Dimension internal_height; /* Internal height between widget & border */
@@ -203,6 +198,11 @@ struct xwindow {
int prevx, cursx; /* Cursor position, only used by */ int prevx, cursx; /* Cursor position, only used by */
int prevy, cursy; /* map and "plain" status windows.*/ 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 { union {
struct map_info_t *Map_info; /* map window info */ struct map_info_t *Map_info; /* map window info */
struct mesg_info_t *Mesg_info; /* message window info */ struct mesg_info_t *Mesg_info; /* message window info */
@@ -254,6 +254,7 @@ E boolean plsel_ask_name;
typedef struct { typedef struct {
Boolean slow; /* issue prompts between map and message wins */ 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 autofocus; /* grab pointer focus for popup windows */
Boolean message_line; /* separate current turn mesgs from prev ones */ Boolean message_line; /* separate current turn mesgs from prev ones */
Boolean highlight_prompt; /* if 'slow', highlight yn prompts */ Boolean highlight_prompt; /* if 'slow', highlight yn prompts */
@@ -297,6 +298,9 @@ E void FDECL(positionpopup, (Widget, BOOLEAN_P));
/* ### winX.c ### */ /* ### winX.c ### */
E struct xwindow *FDECL(find_widget, (Widget)); 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 Boolean FDECL(nhApproxColor, (Screen *, Colormap, char *, XColor *));
E void FDECL(get_widget_window_geometry, (Widget, int *, int *, int *, int *)); E void FDECL(get_widget_window_geometry, (Widget, int *, int *, int *, int *));
E char *FDECL(fontname_boldify, (const char *)); E char *FDECL(fontname_boldify, (const char *));
@@ -394,6 +398,8 @@ E void FDECL(hilight_value, (Widget));
E void FDECL(swap_fg_bg, (Widget)); E void FDECL(swap_fg_bg, (Widget));
/* external declarations */ /* 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 FDECL(X11_init_nhwindows, (int *, char **));
E void NDECL(X11_player_selection); E void NDECL(X11_player_selection);
E void NDECL(X11_askname); 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 int NDECL(X11_get_ext_cmd);
E void FDECL(X11_number_pad, (int)); E void FDECL(X11_number_pad, (int));
E void NDECL(X11_delay_output); 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) */ /* other defs that really should go away (they're tty specific) */
E void NDECL(X11_start_screen); E void NDECL(X11_start_screen);
+10
View File
@@ -1248,6 +1248,16 @@ static struct fieldid_t {
static const char threshold_value[] = "hilite_status threshold ", static const char threshold_value[] = "hilite_status threshold ",
is_out_of_range[] = " is out of range"; 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 */ /* field name to bottom line index */
STATIC_OVL enum statusfields STATIC_OVL enum statusfields
fldname_to_bl_indx(name) fldname_to_bl_indx(name)
+27 -32
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 */ /* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */
/* and Dave Cohrs, 1990. */ /* and Dave Cohrs, 1990. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -512,6 +512,7 @@ warning_of(mon)
struct monst *mon; struct monst *mon;
{ {
int wl = 0, tmp = 0; int wl = 0, tmp = 0;
if (mon_warning(mon)) { if (mon_warning(mon)) {
tmp = (int) (mon->m_lev / 4); /* match display.h */ tmp = (int) (mon->m_lev / 4); /* match display.h */
wl = (tmp > WARNCOUNT - 1) ? WARNCOUNT - 1 : tmp; 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 /* normal region shown only on accessible positions, but poison clouds
* also shown above lava, pools and moats. * also shown above lava, pools and moats.
*/ */
if (reg != NULL && (ACCESSIBLE(lev->typ) if (reg && (ACCESSIBLE(lev->typ)
|| (reg->glyph == cmap_to_glyph(S_poisoncloud) || (reg->glyph == cmap_to_glyph(S_poisoncloud)
&& (lev->typ == LAVAPOOL || lev->typ == POOL && is_pool_or_lava(x, y)))) {
|| lev->typ == MOAT)))) {
show_region(reg, x, y); show_region(reg, x, y);
return; return;
} }
if (x == u.ux && y == u.uy) { if (x == u.ux && y == u.uy) {
if (canspotself()) { int see_self = canspotself();
_map_location(x, y, 0); /* map *under* self */
/* 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(); display_self();
} else
/* we can see what is there */
_map_location(x, y, 1);
} else { } else {
mon = m_at(x, y); mon = m_at(x, y);
worm_tail = is_worm_tail(mon); worm_tail = is_worm_tail(mon);
see_it = see_it = mon && (mon_visible(mon)
mon && (worm_tail ? (!mon->minvis || See_invisible) || (!worm_tail && (tp_sensemon(mon)
: (mon_visible(mon)) || tp_sensemon(mon) || MATCH_WARN_OF_MON(mon))));
|| MATCH_WARN_OF_MON(mon));
if (mon && (see_it || (!worm_tail && Detect_monsters))) { if (mon && (see_it || (!worm_tail && Detect_monsters))) {
if (mon->mtrapped) { if (mon->mtrapped) {
struct trap *trap = t_at(x, y); struct trap *trap = t_at(x, y);
int tt = trap ? trap->ttyp : NO_TRAP; int tt = trap ? trap->ttyp : NO_TRAP;
/* if monster is in a physical trap, you see the trap too /* if monster is in a physical trap, you see trap too */
*/ if (tt == BEAR_TRAP || is_pit(tt) || tt == WEB)
if (tt == BEAR_TRAP || is_pit(tt) trap->tseen = 1;
|| tt == WEB) {
trap->tseen = TRUE;
}
} }
_map_location(x, y, 0); /* map under the monster */ _map_location(x, y, 0); /* map under the monster */
/* also gets rid of any invisibility glyph */ /* also gets rid of any invisibility glyph */
@@ -795,7 +794,7 @@ register int x, y;
worm_tail); worm_tail);
} else if (mon && mon_warning(mon) && !is_worm_tail(mon)) { } else if (mon && mon_warning(mon) && !is_worm_tail(mon)) {
display_warning(mon); display_warning(mon);
} else if (glyph_is_invisible(levl[x][y].glyph)) { } else if (glyph_is_invisible(lev->glyph)) {
map_invisible(x, y); map_invisible(x, y);
} else } else
_map_location(x, y, 1); /* map the location */\ _map_location(x, y, 1); /* map the location */\
@@ -808,19 +807,17 @@ register int x, y;
if (canspotself()) if (canspotself())
display_self(); 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_it = (tp_sensemon(mon) || MATCH_WARN_OF_MON(mon)
|| (see_with_infrared(mon) || (see_with_infrared(mon)
&& mon_visible(mon)))) && mon_visible(mon)))) != 0
|| Detect_monsters)) { || Detect_monsters)) {
/* Monsters are printed every time. */ /* Seen or sensed monsters are printed every time.
/* This also gets rid of any invisibility glyph */ This also gets rid of any invisibility glyph. */
display_monster(x, y, mon, see_it ? 0 : DETECTED, display_monster(x, y, mon, see_it ? 0 : DETECTED,
is_worm_tail(mon) ? TRUE : FALSE); is_worm_tail(mon) ? TRUE : FALSE);
} else if ((mon = m_at(x, y)) && mon_warning(mon) } else if (mon && mon_warning(mon) && !is_worm_tail(mon)) {
&& !is_worm_tail(mon)) {
display_warning(mon); display_warning(mon);
}
/* /*
* If the location is remembered as being both dark (waslit is false) * 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 * (1) A dark location that the hero could see through night
* vision. * vision.
*
* (2) Darkened while out of the hero's sight. This can happen * (2) Darkened while out of the hero's sight. This can happen
* when cursed scroll of light is read. * 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(). * These checks and changes must be here and not in back_to_glyph().
* They are dependent on the position being out of sight. * 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) if (lev->glyph == cmap_to_glyph(S_litcorr) && lev->typ == CORR)
show_glyph(x, y, lev->glyph = cmap_to_glyph(S_corr)); show_glyph(x, y, lev->glyph = cmap_to_glyph(S_corr));
else if (lev->glyph == cmap_to_glyph(S_room) && lev->typ == ROOM 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)); show_glyph(x, y, lev->glyph = cmap_to_glyph(S_stone));
else else
goto show_mem; 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) if (lev->glyph == cmap_to_glyph(S_litcorr) && lev->typ == CORR)
show_glyph(x, y, lev->glyph = cmap_to_glyph(S_corr)); show_glyph(x, y, lev->glyph = cmap_to_glyph(S_corr));
else if (lev->glyph == cmap_to_glyph(S_room) && lev->typ == ROOM) else if (lev->glyph == cmap_to_glyph(S_room) && lev->typ == ROOM)
+24 -22
View File
@@ -354,12 +354,14 @@ register struct monst *mtmp;
Strcpy(buf, y_monnam(mtmp)); Strcpy(buf, y_monnam(mtmp));
buf[0] = highc(buf[0]); buf[0] = highc(buf[0]);
You("stop. %s is in the way!", buf); 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; return TRUE;
} else if ((mtmp->mfrozen || (!mtmp->mcanmove) } else if ((mtmp->mfrozen || (!mtmp->mcanmove)
|| (mtmp->data->mmove == 0)) && rn2(6)) { || (mtmp->data->mmove == 0)) && rn2(6)) {
pline("%s doesn't seem to move!", Monnam(mtmp)); 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; return TRUE;
} else } else
return FALSE; return FALSE;
@@ -423,7 +425,7 @@ register struct monst *mtmp;
(void) hitum(mtmp, youmonst.data->mattk); (void) hitum(mtmp, youmonst.data->mattk);
mtmp->mstrategy &= ~STRAT_WAITMASK; mtmp->mstrategy &= ~STRAT_WAITMASK;
atk_done: atk_done:
/* see comment in attack_checks() */ /* see comment in attack_checks() */
/* we only need to check for this if we did an 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 * and it returned 0 (it's okay to attack), and the monster didn't
@@ -807,7 +809,8 @@ int dieroll;
silvermsg = TRUE; silvermsg = TRUE;
silverobj = 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; lightobj = TRUE;
if (u.usteed && !thrown && tmp > 0 if (u.usteed && !thrown && tmp > 0
&& weapon_type(obj) == P_LANCE && mon != u.ustuck) { && weapon_type(obj) == P_LANCE && mon != u.ustuck) {
@@ -1550,6 +1553,7 @@ register struct attack *mattk;
register struct permonst *pd = mdef->data; register struct permonst *pd = mdef->data;
int armpro, tmp = d((int) mattk->damn, (int) mattk->damd); int armpro, tmp = d((int) mattk->damn, (int) mattk->damd);
boolean negated; boolean negated;
struct obj *mongold;
armpro = magic_negation(mdef); armpro = magic_negation(mdef);
/* since hero can't be cancelled, only defender's armor applies */ /* since hero can't be cancelled, only defender's armor applies */
@@ -1689,18 +1693,16 @@ register struct attack *mattk;
case AD_SGLD: case AD_SGLD:
/* This you as a leprechaun, so steal /* This you as a leprechaun, so steal
real gold only, no lesser coins */ real gold only, no lesser coins */
{ mongold = findgold(mdef->minvent);
struct obj *mongold = findgold(mdef->minvent); if (mongold) {
if (mongold) { obj_extract_self(mongold);
obj_extract_self(mongold); if (merge_choice(invent, mongold) || inv_cnt(FALSE) < 52) {
if (merge_choice(invent, mongold) || inv_cnt(FALSE) < 52) { addinv(mongold);
addinv(mongold); Your("purse feels heavier.");
Your("purse feels heavier."); } else {
} else { You("grab %s's gold, but find no room in your knapsack.",
You("grab %s's gold, but find no room in your knapsack.", mon_nam(mdef));
mon_nam(mdef)); dropy(mongold);
dropy(mongold);
}
} }
} }
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
@@ -1711,8 +1713,9 @@ register struct attack *mattk;
tmp = 1; tmp = 1;
if (!negated && tmp < mdef->mhp) { if (!negated && tmp < mdef->mhp) {
char nambuf[BUFSZ]; char nambuf[BUFSZ];
boolean u_saw_mon = boolean u_saw_mon = (canseemon(mdef)
canseemon(mdef) || (u.uswallow && u.ustuck == mdef); || (u.uswallow && u.ustuck == mdef));
/* record the name before losing sight of monster */ /* record the name before losing sight of monster */
Strcpy(nambuf, Monnam(mdef)); Strcpy(nambuf, Monnam(mdef));
if (u_teleport_mon(mdef, FALSE) && u_saw_mon if (u_teleport_mon(mdef, FALSE) && u_saw_mon
@@ -1794,9 +1797,9 @@ register struct attack *mattk;
case AD_DRCO: case AD_DRCO:
if (!negated && !rn2(8)) { if (!negated && !rn2(8)) {
Your("%s was poisoned!", mpoisons_subj(&youmonst, mattk)); 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)); pline_The("poison doesn't seem to affect %s.", mon_nam(mdef));
else { } else {
if (!rn2(10)) { if (!rn2(10)) {
Your("poison was deadly..."); Your("poison was deadly...");
tmp = mdef->mhp; tmp = mdef->mhp;
@@ -1941,12 +1944,11 @@ explum(mdef, mattk)
register struct monst *mdef; register struct monst *mdef;
register struct attack *mattk; register struct attack *mattk;
{ {
boolean resistance; /* only for cold/fire/elec */
register int tmp = d((int) mattk->damn, (int) mattk->damd); register int tmp = d((int) mattk->damn, (int) mattk->damd);
You("explode!"); You("explode!");
switch (mattk->adtyp) { switch (mattk->adtyp) {
boolean resistance; /* only for cold/fire/elec */
case AD_BLND: case AD_BLND:
if (!resists_blnd(mdef)) { if (!resists_blnd(mdef)) {
pline("%s is blinded by your flash of light!", Monnam(mdef)); pline("%s is blinded by your flash of light!", Monnam(mdef));
+24 -9
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_display_nhwindow, (winid, BOOLEAN_P));
STATIC_DCL void FDECL(dump_destroy_nhwindow, (winid)); STATIC_DCL void FDECL(dump_destroy_nhwindow, (winid));
STATIC_DCL void FDECL(dump_start_menu, (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 void FDECL(dump_end_menu, (winid, const char *));
STATIC_DCL int FDECL(dump_select_menu, (winid, int, MENU_ITEM_P **)); STATIC_DCL int FDECL(dump_select_menu, (winid, int, MENU_ITEM_P **));
STATIC_DCL void FDECL(dump_putstr, (winid, int, const char *)); STATIC_DCL void FDECL(dump_putstr, (winid, int, const char *));
@@ -145,14 +146,22 @@ static struct winlink *chain = 0;
static struct winlink * static struct winlink *
wl_new() 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 static void
wl_addhead(struct winlink *wl) wl_addhead(struct winlink *wl)
{ {
wl->nextlink = chain; wl->nextlink = chain;
chain = wl; chain = wl;
} }
static void static void
wl_addtail(struct winlink *wl) wl_addtail(struct winlink *wl)
{ {
@@ -255,24 +264,28 @@ const char *s;
if (!winchoices[0].procs) { if (!winchoices[0].procs) {
raw_printf("No window types?"); raw_printf("No window types?");
exit(EXIT_FAILURE); nh_terminate(EXIT_FAILURE);
} }
if (!winchoices[1].procs) { if (!winchoices[1].procs) {
config_error_add("Window type %s not recognized. The only choice is: %s", config_error_add(
s, winchoices[0].procs->name); "Window type %s not recognized. The only choice is: %s",
s, winchoices[0].procs->name);
} else { } else {
char buf[BUFSZ]; char buf[BUFSZ];
boolean first = TRUE; boolean first = TRUE;
buf[0] = '\0'; buf[0] = '\0';
for (i = 0; winchoices[i].procs; i++) { for (i = 0; winchoices[i].procs; i++) {
if ('+' == winchoices[i].procs->name[0]) if ('+' == winchoices[i].procs->name[0])
continue; continue;
if ('-' == winchoices[i].procs->name[0]) if ('-' == winchoices[i].procs->name[0])
continue; continue;
Sprintf(eos(buf), "%s%s", first ? "" : ",", winchoices[i].procs->name); Sprintf(eos(buf), "%s%s",
first ? "" : ", ", winchoices[i].procs->name);
first = FALSE; 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) if (windowprocs.win_raw_print == def_raw_print)
@@ -291,6 +304,7 @@ const char *s;
continue; continue;
if (!strcmpi(s, winchoices[i].procs->name)) { if (!strcmpi(s, winchoices[i].procs->name)) {
struct winlink *p = wl_new(); struct winlink *p = wl_new();
p->wincp = &winchoices[i]; p->wincp = &winchoices[i];
wl_addtail(p); wl_addtail(p);
/* NB: The ini_routine() will be called during commit. */ /* NB: The ini_routine() will be called during commit. */
@@ -307,7 +321,7 @@ const char *s;
raw_printf(" %s", winchoices[i].procs->name); raw_printf(" %s", winchoices[i].procs->name);
} }
exit(EXIT_FAILURE); nh_terminate(EXIT_FAILURE);
} }
void void
@@ -494,7 +508,8 @@ static short FDECL(hup_set_font_name, (winid, char *));
#endif #endif
static char *NDECL(hup_get_color_string); static char *NDECL(hup_get_color_string);
#endif /* CHANGE_COLOR */ #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 int NDECL(hup_int_ndecl);
static void NDECL(hup_void_ndecl); static void NDECL(hup_void_ndecl);
+62 -58
View File
@@ -100,6 +100,10 @@ NetHack*highlight_prompt: False
! has a lot of popups and is almost unplayable without some kind of autofocus. ! has a lot of popups and is almost unplayable without some kind of autofocus.
!NetHack*autofocus: True !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 ! 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 ! is the standard 80x21 window. Note: this _does_not_ change nethack's
! level size, only what you see of it. ! 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) ! role selection window (OPTIONS=player_selection:prompts)
NetHack*player_selection*random.foreground: NETHACK_CLR_RANDOM NetHack*player_selection*btn_random.foreground: NETHACK_CLR_RANDOM
NetHack*player_selection*random.background: black NetHack*player_selection*btn_random.background: black
NetHack*player_selection*random.borderColor: NETHACK_CLR_RANDOM NetHack*player_selection*btn_random.borderColor: NETHACK_CLR_RANDOM
NetHack*player_selection*random.borderWidth: 1 NetHack*player_selection*btn_random.borderWidth: 1
NetHack*player_selection*random.shapeStyle: NETHACK_BTN_SHAPE NetHack*player_selection*btn_random.shapeStyle: NETHACK_BTN_SHAPE
NetHack*player_selection*random.cornerRoundPercent: NETHACK_BTN_ROUND NetHack*player_selection*btn_random.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*player_selection*quit.foreground: NETHACK_CLR_QUIT NetHack*player_selection*btn_quit.foreground: NETHACK_CLR_QUIT
NetHack*player_selection*quit.borderColor: NETHACK_CLR_QUIT NetHack*player_selection*btn_quit.borderColor: NETHACK_CLR_QUIT
NetHack*player_selection*quit.borderWidth: 1 NetHack*player_selection*btn_quit.borderWidth: 1
NetHack*player_selection*quit.shapeStyle: NETHACK_BTN_SHAPE NetHack*player_selection*btn_quit.shapeStyle: NETHACK_BTN_SHAPE
NetHack*player_selection*quit.cornerRoundPercent: NETHACK_BTN_ROUND NetHack*player_selection*btn_quit.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*player_selection*Command.foreground: NETHACK_CLR_FG NetHack*player_selection*Command.foreground: NETHACK_CLR_FG
NetHack*player_selection*Command.borderColor: NETHACK_CLR_FG NetHack*player_selection*Command.borderColor: NETHACK_CLR_FG
NetHack*player_selection*Command.borderWidth: NETHACK_CMD_BORDER NetHack*player_selection*Command.borderWidth: NETHACK_CMD_BORDER
! race selection window ! race selection window
NetHack*race_selection*random.foreground: NETHACK_CLR_RANDOM NetHack*race_selection*btn_random.foreground: NETHACK_CLR_RANDOM
NetHack*race_selection*random.background: black NetHack*race_selection*btn_random.background: black
NetHack*race_selection*random.borderColor: NETHACK_CLR_RANDOM NetHack*race_selection*btn_random.borderColor: NETHACK_CLR_RANDOM
NetHack*race_selection*random.borderWidth: 1 NetHack*race_selection*btn_random.borderWidth: 1
NetHack*race_selection*random.shapeStyle: NETHACK_BTN_SHAPE NetHack*race_selection*btn_random.shapeStyle: NETHACK_BTN_SHAPE
NetHack*race_selection*random.cornerRoundPercent: NETHACK_BTN_ROUND NetHack*race_selection*btn_random.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*race_selection*quit.foreground: NETHACK_CLR_QUIT NetHack*race_selection*btn_quit.foreground: NETHACK_CLR_QUIT
NetHack*race_selection*quit.borderColor: NETHACK_CLR_QUIT NetHack*race_selection*btn_quit.borderColor: NETHACK_CLR_QUIT
NetHack*race_selection*quit.borderWidth: 1 NetHack*race_selection*btn_quit.borderWidth: 1
NetHack*race_selection*quit.shapeStyle: NETHACK_BTN_SHAPE NetHack*race_selection*btn_quit.shapeStyle: NETHACK_BTN_SHAPE
NetHack*race_selection*quit.cornerRoundPercent: NETHACK_BTN_ROUND NetHack*race_selection*btn_quit.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*race_selection*Command.foreground: NETHACK_CLR_FG NetHack*race_selection*Command.foreground: NETHACK_CLR_FG
NetHack*race_selection*Command.borderColor: NETHACK_CLR_FG NetHack*race_selection*Command.borderColor: NETHACK_CLR_FG
NetHack*race_selection*Command.borderWidth: NETHACK_CMD_BORDER NetHack*race_selection*Command.borderWidth: NETHACK_CMD_BORDER
! gender selection window ! gender selection window
NetHack*gender_selection*random.foreground: NETHACK_CLR_RANDOM NetHack*gender_selection*btn_random.foreground: NETHACK_CLR_RANDOM
NetHack*gender_selection*random.background: black NetHack*gender_selection*btn_random.background: black
NetHack*gender_selection*random.borderColor: NETHACK_CLR_RANDOM NetHack*gender_selection*btn_random.borderColor: NETHACK_CLR_RANDOM
NetHack*gender_selection*random.borderWidth: 1 NetHack*gender_selection*btn_random.borderWidth: 1
NetHack*gender_selection*random.shapeStyle: NETHACK_BTN_SHAPE NetHack*gender_selection*btn_random.shapeStyle: NETHACK_BTN_SHAPE
NetHack*gender_selection*random.cornerRoundPercent: NETHACK_BTN_ROUND NetHack*gender_selection*btn_random.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*gender_selection*quit.foreground: NETHACK_CLR_QUIT NetHack*gender_selection*btn_quit.foreground: NETHACK_CLR_QUIT
NetHack*gender_selection*quit.borderColor: NETHACK_CLR_QUIT NetHack*gender_selection*btn_quit.borderColor: NETHACK_CLR_QUIT
NetHack*gender_selection*quit.borderWidth: 1 NetHack*gender_selection*btn_quit.borderWidth: 1
NetHack*gender_selection*quit.shapeStyle: NETHACK_BTN_SHAPE NetHack*gender_selection*btn_quit.shapeStyle: NETHACK_BTN_SHAPE
NetHack*gender_selection*quit.cornerRoundPercent: NETHACK_BTN_ROUND NetHack*gender_selection*btn_quit.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*gender_selection*Command.foreground: NETHACK_CLR_FG NetHack*gender_selection*Command.foreground: NETHACK_CLR_FG
NetHack*gender_selection*Command.borderColor: NETHACK_CLR_FG NetHack*gender_selection*Command.borderColor: NETHACK_CLR_FG
NetHack*gender_selection*Command.borderWidth: NETHACK_CMD_BORDER NetHack*gender_selection*Command.borderWidth: NETHACK_CMD_BORDER
! alignment selection window ! alignment selection window
NetHack*alignment_selection*random.foreground: NETHACK_CLR_RANDOM NetHack*alignment_selection*btn_random.foreground: NETHACK_CLR_RANDOM
NetHack*alignment_selection*random.background: black NetHack*alignment_selection*btn_random.background: black
NetHack*alignment_selection*random.borderColor: NETHACK_CLR_RANDOM NetHack*alignment_selection*btn_random.borderColor: NETHACK_CLR_RANDOM
NetHack*alignment_selection*random.borderWidth: 1 NetHack*alignment_selection*btn_random.borderWidth: 1
NetHack*alignment_selection*random.shapeStyle: NETHACK_BTN_SHAPE NetHack*alignment_selection*btn_random.shapeStyle: NETHACK_BTN_SHAPE
NetHack*alignment_selection*random.cornerRoundPercent: NETHACK_BTN_ROUND NetHack*alignment_selection*btn_random.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*alignment_selection*quit.foreground: NETHACK_CLR_QUIT NetHack*alignment_selection*btn_quit.foreground: NETHACK_CLR_QUIT
NetHack*alignment_selection*quit.borderColor: NETHACK_CLR_QUIT NetHack*alignment_selection*btn_quit.borderColor: NETHACK_CLR_QUIT
NetHack*alignment_selection*quit.borderWidth: 1 NetHack*alignment_selection*btn_quit.borderWidth: 1
NetHack*alignment_selection*quit.shapeStyle: NETHACK_BTN_SHAPE NetHack*alignment_selection*btn_quit.shapeStyle: NETHACK_BTN_SHAPE
NetHack*alignment_selection*quit.cornerRoundPercent: NETHACK_BTN_ROUND NetHack*alignment_selection*btn_quit.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*alignment_selection*Command.foreground: NETHACK_CLR_FG NetHack*alignment_selection*Command.foreground: NETHACK_CLR_FG
NetHack*alignment_selection*Command.borderColor: NETHACK_CLR_FG NetHack*alignment_selection*Command.borderColor: NETHACK_CLR_FG
NetHack*alignment_selection*Command.borderWidth: NETHACK_CMD_BORDER NetHack*alignment_selection*Command.borderWidth: NETHACK_CMD_BORDER
! extended commands window ! extended commands window
NetHack*extended_commands*dismiss.foreground: NETHACK_CLR_QUIT NetHack*extended_commands*btn_dismiss.foreground: NETHACK_CLR_QUIT
NetHack*extended_commands*dismiss.borderColor: NETHACK_CLR_QUIT NetHack*extended_commands*btn_dismiss.borderColor: NETHACK_CLR_QUIT
NetHack*extended_commands*dismiss.borderWidth: 1 NetHack*extended_commands*btn_dismiss.borderWidth: 1
NetHack*extended_commands*dismiss.shapeStyle: NETHACK_BTN_SHAPE NetHack*extended_commands*btn_dismiss.shapeStyle: NETHACK_BTN_SHAPE
NetHack*extended_commands*dismiss.cornerRoundPercent: NETHACK_BTN_ROUND NetHack*extended_commands*btn_dismiss.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*extended_commands*help.foreground: NETHACK_CLR_HELP NetHack*extended_commands*btn_help.foreground: NETHACK_CLR_HELP
NetHack*extended_commands*help.borderColor: NETHACK_CLR_HELP NetHack*extended_commands*btn_help.borderColor: NETHACK_CLR_HELP
NetHack*extended_commands*help.borderWidth: 1 NetHack*extended_commands*btn_help.borderWidth: 1
NetHack*extended_commands*help.shapeStyle: NETHACK_BTN_SHAPE NetHack*extended_commands*btn_help.shapeStyle: NETHACK_BTN_SHAPE
NetHack*extended_commands*help.cornerRoundPercent: NETHACK_BTN_ROUND NetHack*extended_commands*btn_help.cornerRoundPercent: NETHACK_BTN_ROUND
NetHack*extended_commands*Command.foreground: NETHACK_CLR_FG NetHack*extended_commands*Command.foreground: NETHACK_CLR_FG
NetHack*extended_commands*Command.borderColor: NETHACK_CLR_FG NetHack*extended_commands*Command.borderColor: NETHACK_CLR_FG
NetHack*extended_commands*Command.borderWidth: NETHACK_CMD_BORDER NetHack*extended_commands*Command.borderWidth: NETHACK_CMD_BORDER
@@ -302,13 +306,13 @@ NetHack*map*green: green3
NetHack*map*brown: DarkOrange3 NetHack*map*brown: DarkOrange3
NetHack*map*blue: blue3 NetHack*map*blue: blue3
NetHack*map*magenta: magenta3 NetHack*map*magenta: magenta3
NetHack*map*cyan: cyan3 NetHack*map*cyan: Dark cyan
NetHack*map*gray: gray50 NetHack*map*gray: gray50
NetHack*map*orange: yellow NetHack*map*orange: orange
NetHack*map*bright_green: green NetHack*map*bright_green: green
NetHack*map*yellow: yellow NetHack*map*yellow: yellow
NetHack*map*bright_blue: blue NetHack*map*bright_blue: Royal blue
NetHack*map*bright_magenta: magenta NetHack*map*bright_magenta: Fuchsia
NetHack*map*bright_cyan: cyan NetHack*map*bright_cyan: cyan
NetHack*map*white: white NetHack*map*white: white
! !
+179 -6
View File
@@ -49,6 +49,7 @@
#include "hack.h" #include "hack.h"
#include "winX.h" #include "winX.h"
#include "dlb.h" #include "dlb.h"
#include "xwindow.h"
#ifndef NO_SIGNAL #ifndef NO_SIGNAL
#include <signal.h> #include <signal.h>
@@ -103,7 +104,7 @@ struct window_procs X11_procs = {
(WC_COLOR | WC_HILITE_PET | WC_ASCII_MAP | WC_TILED_MAP (WC_COLOR | WC_HILITE_PET | WC_ASCII_MAP | WC_TILED_MAP
| WC_PLAYER_SELECTION | WC_PERM_INVENT | WC_MOUSE_SUPPORT), | WC_PLAYER_SELECTION | WC_PERM_INVENT | WC_MOUSE_SUPPORT),
#if defined(STATUS_HILITES) #if defined(STATUS_HILITES)
WC2_FLUSH_STATUS | WC2_RESET_STATUS | WC2_FLUSH_STATUS | WC2_RESET_STATUS | WC2_HILITE_STATUS |
#endif #endif
0L, 0L,
X11_init_nhwindows, X11_init_nhwindows,
@@ -133,9 +134,9 @@ struct window_procs X11_procs = {
#else #else
genl_outrip, genl_outrip,
#endif #endif
X11_preference_update, genl_getmsghistory, genl_putmsghistory, X11_preference_update, X11_getmsghistory, X11_putmsghistory,
genl_status_init, genl_status_finish, genl_status_enablefield, X11_status_init, X11_status_finish, X11_status_enablefield,
genl_status_update, X11_status_update,
genl_can_suspend_no, /* XXX may not always be correct */ 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(). */ status_win = WIN_ERR; /* are created in init_windows(). */
static Pixmap icon_pixmap = None; /* Pixmap for icon. */ 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 * Find the window structure that corresponds to the given widget. Note
* that this is not the popup widget, nor the viewport, but the child. * that this is not the popup widget, nor the viewport, but the child.
@@ -226,6 +264,102 @@ find_free_window()
return (winid) windex; 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 * Color conversion. The default X11 color converters don't try very
* hard to find matching colors in PseudoColor visuals. If they can't * hard to find matching colors in PseudoColor visuals. If they can't
@@ -515,6 +649,31 @@ const char *fontname;
return buf; 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 #ifdef TEXTCOLOR
/* ARGSUSED */ /* ARGSUSED */
static void static void
@@ -790,9 +949,11 @@ const char *str;
toplines[TBUFSZ - 1] = 0; toplines[TBUFSZ - 1] = 0;
append_message(wp, str); append_message(wp, str);
break; break;
#ifndef STATUS_HILITES
case NHW_STATUS: case NHW_STATUS:
adjust_status(wp, str); adjust_status(wp, str);
break; break;
#endif
case NHW_MAP: case NHW_MAP:
impossible("putstr: called on map window \"%s\"", str); impossible("putstr: called on map window \"%s\"", str);
break; break;
@@ -913,6 +1074,9 @@ int type;
wp->prevx = wp->prevy = wp->cursx = wp->cursy = wp->pixel_width = wp->prevx = wp->prevy = wp->cursx = wp->cursy = wp->pixel_width =
wp->pixel_height = 0; wp->pixel_height = 0;
wp->keep_window = FALSE; wp->keep_window = FALSE;
wp->nh_colors_inited = FALSE;
wp->boldfs = (XFontStruct *) 0;
wp->boldfs_dpy = (Display *) 0;
switch (type) { switch (type) {
case NHW_MAP: case NHW_MAP:
@@ -1057,6 +1221,12 @@ winid window;
WIN_INVEN = WIN_ERR; 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) { switch (wp->type) {
case NHW_MAP: case NHW_MAP:
destroy_map_window(wp); destroy_map_window(wp);
@@ -1230,6 +1400,8 @@ static XtActionsRec actions[] = {
static XtResource resources[] = { static XtResource resources[] = {
{ nhStr("slow"), nhStr("Slow"), XtRBoolean, sizeof(Boolean), { nhStr("slow"), nhStr("Slow"), XtRBoolean, sizeof(Boolean),
XtOffset(AppResources *, slow), XtRString, nhStr("True") }, 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), { nhStr("autofocus"), nhStr("AutoFocus"), XtRBoolean, sizeof(Boolean),
XtOffset(AppResources *, autofocus), XtRString, nhStr("False") }, XtOffset(AppResources *, autofocus), XtRString, nhStr("False") },
{ nhStr("message_line"), nhStr("Message_line"), XtRBoolean, { nhStr("message_line"), nhStr("Message_line"), XtRBoolean,
@@ -2214,7 +2386,7 @@ static int
input_event(exit_condition) input_event(exit_condition)
int 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(); check_turn_events();
if (WIN_MAP != WIN_ERR) /* make sure cursor is not clipped */ if (WIN_MAP != WIN_ERR) /* make sure cursor is not clipped */
check_cursor_visibility(&window_list[WIN_MAP]); 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), * after the fancy status widget is realized (above, with the game popup),
* but before it is popped up. * 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 * 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 * above, the map window needs to be set to its constrained size until
+2 -120
View File
@@ -32,12 +32,9 @@
#undef PRESERVE_NO_SYSV #undef PRESERVE_NO_SYSV
#endif #endif
#include "xwindow.h"
#include "hack.h" #include "hack.h"
#include "winX.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, static void FDECL(menu_size_change_handler, (Widget, XtPointer,
XEvent *, Boolean *)); XEvent *, Boolean *));
static void FDECL(menu_select, (Widget, XtPointer, XtPointer)); 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(invert_match, (struct xwindow *, char *));
static void FDECL(menu_popdown, (struct xwindow *)); static void FDECL(menu_popdown, (struct xwindow *));
static Widget FDECL(menu_create_buttons, (struct xwindow *, Widget, Widget)); 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(menu_create_entries, (struct xwindow *, struct menu *));
static void FDECL(destroy_menu_entry_widgets, (struct xwindow *)); static void FDECL(destroy_menu_entry_widgets, (struct xwindow *));
static void NDECL(create_menu_translation_tables); static void NDECL(create_menu_translation_tables);
@@ -1121,31 +1117,6 @@ Widget form,under;
return all; 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 static void
menu_create_entries(wp, curr_menu) menu_create_entries(wp, curr_menu)
struct xwindow *wp; struct xwindow *wp;
@@ -1185,7 +1156,7 @@ struct menu *curr_menu;
get_nhcolor(wp, color).pixel); num_args++; 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) { if (attr == ATR_INVERSE) {
XtSetArg(args[num_args], nhStr(XtNforeground), XtSetArg(args[num_args], nhStr(XtNforeground),
@@ -1215,7 +1186,7 @@ struct menu *curr_menu;
load_boldfont(wp, curr->w); load_boldfont(wp, curr->w);
num_args = 0; num_args = 0;
XtSetArg(args[num_args], nhStr(XtNfont), XtSetArg(args[num_args], nhStr(XtNfont),
wp->menu_information->boldfs); num_args++; wp->boldfs); num_args++;
XtSetValues(curr->w, args, 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 void
create_menu_window(wp) create_menu_window(wp)
struct xwindow *wp; struct xwindow *wp;
@@ -1413,7 +1299,6 @@ struct xwindow *wp;
reset_menu_to_default(&wp->menu_information->new_menu); reset_menu_to_default(&wp->menu_information->new_menu);
reset_menu_count(wp->menu_information); reset_menu_count(wp->menu_information);
wp->w = wp->popup = (Widget) 0; wp->w = wp->popup = (Widget) 0;
wp->menu_information->nh_colors_inited = FALSE;
wp->menu_information->permi_x = -1; wp->menu_information->permi_x = -1;
wp->menu_information->permi_y = -1; wp->menu_information->permi_y = -1;
wp->menu_information->permi_w = -1; wp->menu_information->permi_w = -1;
@@ -1425,9 +1310,6 @@ destroy_menu_window(wp)
struct xwindow *wp; struct xwindow *wp;
{ {
clear_old_menu(wp); /* this will also destroy the widgets */ 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); free((genericptr_t) wp->menu_information);
wp->menu_information = (struct menu_info_t *) 0; wp->menu_information = (struct menu_info_t *) 0;
wp->type = NHW_NONE; /* allow re-use */ wp->type = NHW_NONE; /* allow re-use */
+2
View File
@@ -50,6 +50,8 @@ static char mesg_translations[] = "#override\n\
<Key>Right: scroll(6)\n\ <Key>Right: scroll(6)\n\
<Key>Up: scroll(8)\n\ <Key>Up: scroll(8)\n\
<Key>Down: scroll(2)\n\ <Key>Down: scroll(2)\n\
<Btn4Down>: scroll(8)\n\
<Btn5Down>: scroll(2)\n\
<Key>: input()"; <Key>: input()";
/* Move the message window's vertical scrollbar's slider to the bottom. */ /* Move the message window's vertical scrollbar's slider to the bottom. */
+10 -6
View File
@@ -1247,11 +1247,10 @@ X11_player_selection_dialog()
} else { } else {
ps_selected = -1; ps_selected = -1;
nh_XtPopup(popup, (int) XtGrabExclusive, form); 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); nh_XtPopdown(popup);
XtDestroyWidget(popup); XtDestroyWidget(popup);
@@ -1994,11 +1993,12 @@ Widget *formp; /* return */
Widget popup, popform, form, label, above, left, right, view; Widget popup, popform, form, label, above, left, right, view;
Widget *commands, *curr; Widget *commands, *curr;
int i; int i;
Arg args[8]; Arg args[12];
Cardinal num_args; Cardinal num_args;
Dimension width, other_width, max_width, border_width, Dimension width, other_width, max_width, border_width,
height, cumulative_height, screen_height; height, cumulative_height, screen_height;
int distance, skip; int distance, skip;
char btnname[BUFSZ];
commands = (Widget *) alloc((unsigned) num_names * sizeof (Widget)); commands = (Widget *) alloc((unsigned) num_names * sizeof (Widget));
@@ -2073,11 +2073,13 @@ Widget *formp; /* return */
*/ */
num_args = 0; num_args = 0;
XtSetArg(args[num_args], nhStr(XtNfromVert), label); num_args++; XtSetArg(args[num_args], nhStr(XtNfromVert), label); num_args++;
XtSetArg(args[num_args], nhStr(XtNlabel), left_name); num_args++;
#if 0 #if 0
XtSetArg(args[num_args], nhStr(XtNshapeStyle), XtSetArg(args[num_args], nhStr(XtNshapeStyle),
XmuShapeRoundedRectangle); num_args++; XmuShapeRoundedRectangle); num_args++;
#endif #endif
left = XtCreateManagedWidget(left_name, commandWidgetClass, form, args, Sprintf(btnname, "btn_%s", left_name);
left = XtCreateManagedWidget(btnname, commandWidgetClass, form, args,
num_args); num_args);
XtAddCallback(left, XtNcallback, left_callback, (XtPointer) 0); XtAddCallback(left, XtNcallback, left_callback, (XtPointer) 0);
skip = (distance < 4) ? 8 : 2 * distance; 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(XtNfromHoriz), left); num_args++;
XtSetArg(args[num_args], nhStr(XtNhorizDistance), skip); 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(XtNfromVert), label); num_args++;
XtSetArg(args[num_args], nhStr(XtNlabel), right_name); num_args++;
#if 0 #if 0
XtSetArg(args[num_args], nhStr(XtNshapeStyle), XtSetArg(args[num_args], nhStr(XtNshapeStyle),
XmuShapeRoundedRectangle); num_args++; XmuShapeRoundedRectangle); num_args++;
#endif #endif
right = XtCreateManagedWidget(right_name, commandWidgetClass, form, args, Sprintf(btnname, "btn_%s", right_name);
right = XtCreateManagedWidget(btnname, commandWidgetClass, form, args,
num_args); num_args);
XtAddCallback(right, XtNcallback, right_callback, (XtPointer) 0); XtAddCallback(right, XtNcallback, right_callback, (XtPointer) 0);
+768 -67
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 */ /* Copyright (c) Dean Luick, 1992 */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -15,6 +15,7 @@
#endif #endif
#include <X11/Intrinsic.h> #include <X11/Intrinsic.h>
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h> #include <X11/StringDefs.h>
#include <X11/Shell.h> #include <X11/Shell.h>
#include <X11/Xaw/AsciiText.h> #include <X11/Xaw/AsciiText.h>
@@ -22,6 +23,7 @@
#include <X11/Xaw/Form.h> #include <X11/Xaw/Form.h>
#include <X11/Xaw/Paned.h> #include <X11/Xaw/Paned.h>
#include <X11/Xaw/Label.h> #include <X11/Xaw/Label.h>
#include <X11/Xaw/Viewport.h>
#include <X11/Xatom.h> #include <X11/Xatom.h>
#ifdef PRESERVE_NO_SYSV #ifdef PRESERVE_NO_SYSV
@@ -31,18 +33,754 @@
#undef PRESERVE_NO_SYSV #undef PRESERVE_NO_SYSV
#endif #endif
#include "xwindow.h"
#include "hack.h" #include "hack.h"
#include "winX.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 *hu_stat[]; /* from eat.c */
extern const char *enc_stat[]; /* from botl.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 void
create_status_window(wp, create_popup, parent) create_status_window_fancy(wp, create_popup, parent)
struct xwindow *wp; /* window pointer */ struct xwindow *wp; /* window pointer */
boolean create_popup; boolean create_popup;
Widget parent; Widget parent;
@@ -60,7 +798,7 @@ Widget parent;
* window. * window.
*/ */
if (!parent) 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->status_information = 0;
wp->w = create_fancy_status(parent, (Widget) 0); wp->w = create_fancy_status(parent, (Widget) 0);
return; return;
@@ -133,7 +871,7 @@ Widget parent;
} }
void void
destroy_status_window(wp) destroy_status_window_fancy(wp)
struct xwindow *wp; struct xwindow *wp;
{ {
/* If status_information is defined, then it a "text" status window. */ /* 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. * + We didn't set stringInPlace on the widget.
*/ */
void void
adjust_status(wp, str) adjust_status_fancy(wp, str)
struct xwindow *wp; struct xwindow *wp;
const char *str; const char *str;
{ {
@@ -216,52 +954,6 @@ static Widget FDECL(init_column, (const char *, Widget, Widget, Widget,
static void NDECL(fixup_cond_widths); static void NDECL(fixup_cond_widths);
static Widget FDECL(init_info_form, (Widget, Widget, Widget)); 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: * Notes:
* + Alignment needs a different init value, because -1 is an alignment. * + 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. * [**] HD is shown instead of level and exp if Upolyd.
*/ */
static void static void
update_fancy_status(wp) update_fancy_status_field(i)
struct xwindow *wp; int i;
{ {
struct X_status_value *sv; struct X_status_value *sv = &shown_stats[i];
long val; long val;
int i;
if (wp->cursy != 0) switch (i) {
return; /* do a complete update when line 0 is done */
for (i = 0, sv = shown_stats; i < NUM_STATS; i++, sv++) {
switch (i) {
case F_DUMMY: case F_DUMMY:
val = 0L; val = 0L;
break; break;
@@ -734,11 +1421,25 @@ struct xwindow *wp;
val = 0L; val = 0L;
break; break;
} /* default */ } /* default */
} /* switch */ } /* switch */
update_val(sv, val); 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. * Turn off hilighted status values after a certain amount of turns.
*/ */
+14 -11
View File
@@ -27,23 +27,26 @@ void *me;
void *nextprocs; void *nextprocs;
void *nextdata; void *nextdata;
{ {
struct chainin_data *tdp = 0;
switch (cmd) { switch (cmd) {
case WINCHAIN_ALLOC: { case WINCHAIN_ALLOC:
struct chainin_data *tdp = calloc(1, sizeof(struct chainin_data)); tdp = (struct chainin_data *) alloc(sizeof *tdp);
tdp->nprocs = 0;
tdp->ndata = 0;
tdp->linknum = n; tdp->linknum = n;
cibase = tdp; cibase = 0;
return tdp; break;
} case WINCHAIN_INIT:
case WINCHAIN_INIT: { tdp = me;
struct chainin_data *tdp = me;
tdp->nprocs = nextprocs; tdp->nprocs = nextprocs;
tdp->ndata = nextdata; tdp->ndata = nextdata;
return tdp; break;
}
default: default:
raw_printf("chainin_procs_chain: bad cmd\n"); panic("chainin_procs_chain: bad cmd\n");
exit(EXIT_FAILURE); /*NOTREACHED*/
} }
return tdp;
} }
/* XXX if we don't need this, take it out of the table */ /* XXX if we don't need this, take it out of the table */
+13 -11
View File
@@ -10,7 +10,7 @@
struct chainout_data { struct chainout_data {
struct window_procs *nprocs; struct window_procs *nprocs;
#if 0 #if 0
void *ndata; void *ndata;
#endif #endif
int linknum; int linknum;
@@ -24,21 +24,23 @@ void *me;
void *nextprocs; void *nextprocs;
void *nextdata UNUSED; void *nextdata UNUSED;
{ {
struct chainout_data *tdp = 0;
switch (cmd) { switch (cmd) {
case WINCHAIN_ALLOC: { case WINCHAIN_ALLOC:
struct chainout_data *tdp = calloc(1, sizeof(struct chainout_data)); tdp = (struct chainout_data *) alloc(sizeof *tdp);
tdp->nprocs = 0;
tdp->linknum = n; tdp->linknum = n;
return tdp; break;
} case WINCHAIN_INIT:
case WINCHAIN_INIT: { tdp = me;
struct chainout_data *tdp = me;
tdp->nprocs = nextprocs; tdp->nprocs = nextprocs;
return tdp; break;
}
default: default:
raw_printf("chainout_procs_chain: bad cmd\n"); panic("chainout_procs_chain: bad cmd\n");
exit(EXIT_FAILURE); /*NOTREACHED*/
} }
return tdp;
} }
/* XXX if we don't need this, take it out of the table */ /* XXX if we don't need this, take it out of the table */
+24 -18
View File
@@ -48,22 +48,25 @@ void *me;
void *nextprocs; void *nextprocs;
void *nextdata; void *nextdata;
{ {
struct trace_data *tdp = 0;
switch (cmd) { switch (cmd) {
case WINCHAIN_ALLOC: { case WINCHAIN_ALLOC:
struct trace_data *tdp = calloc(1, sizeof(struct trace_data)); tdp = (struct trace_data *) alloc(sizeof *tdp);
tdp->nprocs = 0;
tdp->ndata = 0;
tdp->linknum = n; tdp->linknum = n;
return tdp; break;
} case WINCHAIN_INIT:
case WINCHAIN_INIT: { tdp = me;
struct trace_data *tdp = me;
tdp->nprocs = nextprocs; tdp->nprocs = nextprocs;
tdp->ndata = nextdata; tdp->ndata = nextdata;
return tdp; break;
}
default: default:
raw_printf("trace_procs_chain: bad cmd\n"); panic("trace_procs_chain: bad cmd\n");
exit(EXIT_FAILURE); /*NOTREACHED*/
} }
return tdp;
} }
void void
@@ -71,20 +74,22 @@ trace_procs_init(dir)
int dir; int dir;
{ {
char fname[200]; char fname[200];
long pid;
/* processors shouldn't need this test, but just in case */ /* processors shouldn't need this test, but just in case */
if (dir != WININIT) if (dir != WININIT)
return; return;
sprintf(fname, "%s/tlog.%d", HACKDIR, getpid()); pid = (long) getpid();
Sprintf(fname, "%s/tlog.%ld", HACKDIR, pid);
wc_tracelogf = fopen(fname, "w"); wc_tracelogf = fopen(fname, "w");
if (wc_tracelogf == NULL) { if (!wc_tracelogf) {
fprintf(stderr, "Can't open trace log file %s: %s\n", fname, fprintf(stderr, "Can't open trace log file %s: %s\n", fname,
strerror(errno)); strerror(errno));
exit(EXIT_FAILURE); nh_terminate(EXIT_FAILURE);
} }
setvbuf(wc_tracelogf, (char *) NULL, _IONBF, 0); setvbuf(wc_tracelogf, (char *) 0, _IONBF, 0);
fprintf(wc_tracelogf, "Trace log started for pid %d\n", getpid()); fprintf(wc_tracelogf, "Trace log started for pid %ld\n", pid);
indent_level = 0; indent_level = 0;
} }
@@ -769,7 +774,7 @@ char *bufp;
} }
if (bufp) { if (bufp) {
fprintf(wc_tracelogf, "%p)\n", bufp); fprintf(wc_tracelogf, "%s)\n", fmt_ptr((genericptr_t) bufp));
} else { } else {
fprintf(wc_tracelogf, "NULL)\n"); fprintf(wc_tracelogf, "NULL)\n");
} }
@@ -785,7 +790,7 @@ void *vp;
{ {
struct trace_data *tdp = vp; struct trace_data *tdp = vp;
int rv; int rv;
int ecl_size; int ecl_size = 0;
/* this is ugly, but the size isn't exposed */ /* this is ugly, but the size isn't exposed */
const struct ext_func_tab *efp; const struct ext_func_tab *efp;
@@ -1095,7 +1100,8 @@ unsigned long *colormasks;
ptr, chg, percent); ptr, chg, percent);
PRE; 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; POST;
} }