Merge remote-tracking branch 'origin/NetHack-3.6.0'

This commit is contained in:
keni
2017-10-01 17:19:23 -04:00
53 changed files with 3458 additions and 1640 deletions
+70 -6
View File
@@ -2567,6 +2567,9 @@ The behavior of this option depends on the type of windowing you use.
In text windowing, text highlighting or inverse video is often used; In text windowing, text highlighting or inverse video is often used;
with tiles, generally displays a small plus-symbol beside the object with tiles, generally displays a small plus-symbol beside the object
on the top of the pile. on the top of the pile.
.lp hitpointbar
Show a hit point bar graph behind your name and title.
Only available for TTY and Windows GUI, and only when statushilites is on.
.lp horsename .lp horsename
Name your starting horse (ex. ``horsename:Trigger''). Name your starting horse (ex. ``horsename:Trigger'').
Cannot be set with the `O' command. Cannot be set with the `O' command.
@@ -2910,7 +2913,8 @@ attack to which it is resistant (default on). Persistent.
.lp standout .lp standout
Boldface monsters and ``\fB--More--\fP'' (default off). Persistent. Boldface monsters and ``\fB--More--\fP'' (default off). Persistent.
.lp statushilites .lp statushilites
Enable coloring of status fields (default off). Controls how many turns status hilite behaviors highlight
the field. If negated or set to zero, disables status hiliting.
See ``Configuring Status Hilites'' for further information. See ``Configuring Status Hilites'' for further information.
.lp status_updates .lp status_updates
Allow updates to the status lines at the bottom of the screen (default true). Allow updates to the status lines at the bottom of the screen (default true).
@@ -3479,17 +3483,22 @@ Your copy of NetHack may have been compiled with support for ``Status Hilites''.
If so, you can customize your game display by setting thresholds to If so, you can customize your game display by setting thresholds to
change the color or appearance of fields in the status display. change the color or appearance of fields in the status display.
.pg .pg
The format for defining status colors is:
.si
.lp "OPTION=hilite_status: field-name/behavior/color&attributes"
.ei
.pg
For example, the following line in your config file will cause For example, the following line in your config file will cause
the hitpoints field to display in the color red if your hitpoints the hitpoints field to display in the color red if your hitpoints
drop to or below a threshold of 30%: drop to or below a threshold of 30%:
.si .si
.lp "OPTION=hilite_status: hitpoints/30%/red/normal" .lp "OPTION=hilite_status: hitpoints/<30%/red/normal"
.ei .ei
.pg .pg
For another example, the following line in your config file will cause For another example, the following line in your config file will cause
wisdom to be displayed red if it drops and green if it rises. wisdom to be displayed red if it drops and green if it rises.
.si .si
.lp "OPTION=hilite_status: wisdom/updown/red/green" .lp "OPTION=hilite_status: wisdom/down/red/up/green"
.ei .ei
.pg .pg
You can adjust the display of the following status fields: You can adjust the display of the following status fields:
@@ -3508,18 +3517,73 @@ experience condition
.\"TABLE_END Do not delete this line. .\"TABLE_END Do not delete this line.
.TE .TE
.lp "" .lp ""
The pseudo-field `characteristics' can be used to set all six
of Str, Dex, Con, Int, Wis, and Cha at once. `HD' is `hit dice',
an approximation of experience level displayed when polymorphed.
`experience', `time', and `score' are conditionally displayed
depending upon your other option settings.
.lp ""
Instead of a behavior, `condition' takes the following condition flags:
stone, slime, strngl, foodpois, termill, blind, deaf, stun, conf, hallu,
lev, fly, and ride. You can use `major_troubles' as an alias
for stone through termill, `minor_troubles' for blind through hallu,
`movement' for lev, fly, and ride, and `all' for every condition.
.lp ""
Allowed behaviors are "always", "up", "down", "changed", a
percentage or absolute number threshold, or a text to match against.
.si
.lp "*"
"always" will set the default attributes for that field.
.lp "*"
"up" and "down" set the field attributes for when the field
value changes upwards or downwards. This attribute times out after
statushilites turns.
.lp "*"
"changed" sets the field attribute for when the field value
changes. This attribute times out after statushilites turns.
.lp "*"
percentage sets the field attribute when the field value
matches the percentage. If the percentage is prefixed with '<'
or '>', it also matches when value is below or above the percentage.
Only valid for `power' and `hitpoints' fields.
.lp "*"
absolute value sets the attribute when the field value
matches that number. If the number is prefixed with '<'
or '>', it also matches when value is below or above.
.lp "*"
text match sets the attribute when the field value
matches the text. Text matches can only be used for `alignment',
`carrying-capacity', and `dungeon-level'.
.ei
.lp ""
Allowed colors are black, red, green, brown, blue, magenta, cyan, gray, Allowed colors are black, red, green, brown, blue, magenta, cyan, gray,
orange, lightgreen, yellow, lightblue, lightmagenta, lightcyan, and white. orange, lightgreen, yellow, lightblue, lightmagenta, lightcyan, and white.
.lp "" .lp ""
Allowed attributes are bold, inverse, normal. Allowed attributes are bold, inverse, underline, blink, dim, and normal.
Note that the platform used may interpret the attributes any way it Note that the platform used may interpret the attributes any way it
wants. wants.
.lp "" .lp ""
Behaviours can occur based on percentage thresholds, updown, or absolute values.
The in-game options menu can help you determine the correct syntax for a The in-game options menu can help you determine the correct syntax for a
config file. config file.
.lp "" .lp ""
The whole feature can be disabled by setting option statushilites off. The whole feature can be disabled by setting option
statushilites to 0.
.lp ""
Example hilites:
.sd
.si
OPTION=hilite_status: gold/up/yellow/down/brown
OPTION=hilite_status: characteristics/up/green/down/red
OPTION=hilite_status: hitpoints/100%/gray&normal
OPTION=hilite_status: hitpoints/<100%/green&normal
OPTION=hilite_status: hitpoints/<66%/yellow&normal
OPTION=hilite_status: hitpoints/<50%/orange&normal
OPTION=hilite_status: hitpoints/<33%/red&bold
OPTION=hilite_status: hitpoints/<15%/red&inverse
OPTION=hilite_status: condition/major/orange&inverse
OPTION=hilite_status: condition/lev+fly/red&inverse
.ei
.ed
.pg .pg
.hn 2 .hn 2
Modifying NetHack Symbols Modifying NetHack Symbols
+86 -6
View File
@@ -3141,6 +3141,10 @@ on the top of the pile.
Name your starting horse (ex.\ ``{\tt horsename:Trigger}''). Name your starting horse (ex.\ ``{\tt horsename:Trigger}'').
Cannot be set with the `{\tt O}' command. Cannot be set with the `{\tt O}' command.
%.lp %.lp
\item[\ib{hitpointbar}]
Show a hit point bar graph behind your name and title.
Only available for TTY and Windows GUI, and only when statushilites is on.
%.lp
\item[\ib{ignintr}] \item[\ib{ignintr}]
Ignore interrupt signals, including breaks (default off). Persistent. Ignore interrupt signals, including breaks (default off). Persistent.
%.lp %.lp
@@ -3535,7 +3539,8 @@ attack to which it is resistant (default on). Persistent.
Boldface monsters and ``{\tt --More--}'' (default off). Persistent. Boldface monsters and ``{\tt --More--}'' (default off). Persistent.
%.lp %.lp
\item[\ib{statushilites}] \item[\ib{statushilites}]
Enable coloring of status fields (default off). Controls how many turns status hilite behaviors highlight
the field. If negated or set to zero, disables status hiliting.
See ``{\it Configuring Status Hilites\/}'' for further information. See ``{\it Configuring Status Hilites\/}'' for further information.
%.lp %.lp
\item[\ib{status\verb+_+updates}] \item[\ib{status\verb+_+updates}]
@@ -4271,18 +4276,23 @@ The pattern should be a regular expression.
Your copy of NetHack may have been compiled with support for {\it Status Hilites}. Your copy of NetHack may have been compiled with support for {\it Status Hilites}.
If so, you can customize your game display by setting thresholds to If so, you can customize your game display by setting thresholds to
change the color or appearance of fields in the status display. change the color or appearance of fields in the status display.
%.pg
The format for defining status colors is:
\begin{verbatim}
OPTION=hilite_status: field-name/behavior/color&attributes
\end{verbatim}
%.pg
For example, the following line in your config file will cause For example, the following line in your config file will cause
the hitpoints field to display in the color red if your hitpoints the hitpoints field to display in the color red if your hitpoints
drop to or below a threshold of 30%: drop to or below a threshold of 30%:
\begin{verbatim} \begin{verbatim}
OPTION=hilite_status: hitpoints/30%/red/normal OPTION=hilite_status: hitpoints/<30%/red/normal
\end{verbatim} \end{verbatim}
%.pg %.pg
For another example, the following line in your config file will cause For another example, the following line in your config file will cause
wisdom to be displayed red if it drops and green if it rises. wisdom to be displayed red if it drops and green if it rises.
\begin{verbatim} \begin{verbatim}
OPTION=hilite_status: wisdom/updown/red/green OPTION=hilite_status: wisdom/down/red/up/green
\end{verbatim} \end{verbatim}
You can adjust the display of the following status fields: You can adjust the display of the following status fields:
%.sd %.sd
@@ -4301,6 +4311,56 @@ experience & condition\\
\end{tabular} \end{tabular}
\end{center} \end{center}
%.ed %.ed
%.lp ""
The pseudo-field `characteristics' can be used to set all six
of Str, Dex, Con, Int, Wis, and Cha at once. `HD' is `hit dice',
an approximation of experience level displayed when polymorphed.
`experience', `time', and `score' are conditionally displayed
depending upon your other option settings.
%.lp ""
Instead of a behavior, `condition' takes the following condition flags:
{\it stone}, {\it slime}, {\it strngl}, {\it foodpois}, {\it termill},
{\it blind}, {\it deaf}, {\it stun}, {\it conf}, {\it hallu},
{\it lev}, {\it fly}, and {\it ride}. You can use `major\_troubles' as an alias
for stone through termill, `minor\_troubles' for blind through hallu,
`movement' for lev, fly, and ride, and `all' for every condition.
%.lp ""
Allowed behaviors are "always", "up", "down", "changed", a
percentage or absolute number threshold, or a text to match against.
\blist{}
%.lp "*"
\item{\bb{}}
"always" will set the default attributes for that field.
%.lp "*"
\item{\bb{}}
"up" and "down" set the field attributes for when the field
value changes upwards or downwards. This attribute times out after
statushilites turns.
%.lp "*"
\item{\bb{}}
"changed" sets the field attribute for when the field value
changes. This attribute times out after statushilites turns.
%.lp "*"
\item{\bb{}}
percentage sets the field attribute when the field value
matches the percentage. If the percentage is prefixed with `{\tt <}'
or `{\tt >}', it also matches when value is below or above the percentage.
Only valid for `power' and `hitpoints' fields.
%.lp "*"
\item{\bb{}}
absolute value sets the attribute when the field value
matches that number. If the number is prefixed with `{\tt <}'
or `{\tt >}', it also matches when value is below or above.
%.lp "*"
\item{\bb{}}
text match sets the attribute when the field value
matches the text. Text matches can only be used for `alignment',
`carrying-capacity', and `dungeon-level'.
%.ei
\elist
%.lp "" %.lp ""
Allowed colors are {\it black}, {\it red}, {\it green}, {\it brown}, Allowed colors are {\it black}, {\it red}, {\it green}, {\it brown},
@@ -4309,12 +4369,32 @@ Allowed colors are {\it black}, {\it red}, {\it green}, {\it brown},
{\it lightcyan}, and {\it white}. {\it lightcyan}, and {\it white}.
%.lp "" %.lp ""
Behaviours can occur based on percentage thresholds, updown, or absolute values. Allowed attributes are {\it bold}, {\it inverse}, {\it underline},
{\it blink}, {\it dim}, and {\it normal}.
Note that the platform used may interpret the attributes any way it
wants.
%.lp ""
The in-game options menu can help you determine the correct syntax for a The in-game options menu can help you determine the correct syntax for a
config file. config file.
%.lp "" %.lp ""
The whole feature can be disable by setting option {\it statushilites} off. The whole feature can be disable by setting option {\it statushilites} to 0.
%.lp ""
Example hilites:
\begin{verbatim}
OPTION=hilite_status: gold/up/yellow/down/brown
OPTION=hilite_status: characteristics/up/green/down/red
OPTION=hilite_status: hitpoints/100%/gray&normal
OPTION=hilite_status: hitpoints/<100%/green&normal
OPTION=hilite_status: hitpoints/<66%/yellow&normal
OPTION=hilite_status: hitpoints/<50%/orange&normal
OPTION=hilite_status: hitpoints/<33%/red&bold
OPTION=hilite_status: hitpoints/<15%/red&inverse
OPTION=hilite_status: condition/major/orange&inverse
OPTION=hilite_status: condition/lev+fly/red&inverse
\end{verbatim}
%.lp %.lp
%.hn 2 %.hn 2
+10 -1
View File
@@ -443,9 +443,16 @@ fix buffer overflow in wizard mode for '#' command when 'extmenu' option is on
"you suddenly vomit" was given two turns before actually vomiting, so you "you suddenly vomit" was given two turns before actually vomiting, so you
could get that message, move a bit, then get "you can move again" could get that message, move a bit, then get "you can move again"
after the 2 turn freeze applied along with the actual vomit after the 2 turn freeze applied along with the actual vomit
fix mention_walls reporting secret doors as solid walls
corpses and other flammable items not subject to direct burning or fire-based corpses and other flammable items not subject to direct burning or fire-based
erosion which were thrown or dropped into lava remained intact erosion which were thrown or dropped into lava remained intact
if a potion on the floor survived a land mine explosion and got propelled at
the hero, it didn't behave like a potion if it hit
adjust candelabrum's weight when candles are attached
when lit candelabrum burned out, persistent inventory window showed that it
was no longer lit but still showed phantom candles attached
improve hilite_status, allowing multiple stops per field, and temporarily or
permanently hilited fields
give feedback when released from a bear trap
Fixes to Post-3.6.0 Problems that Were Exposed Via git Repository Fixes to Post-3.6.0 Problems that Were Exposed Via git Repository
@@ -502,6 +509,7 @@ hero poly'd into vampire could drain monster down to 0 HP without killing it,
triggering impossible "dmonsfree: 1 removed doesn't match 0 pending" triggering impossible "dmonsfree: 1 removed doesn't match 0 pending"
"you observe a fog cloud where a vampire/bat was" if an unseen vampire on the "you observe a fog cloud where a vampire/bat was" if an unseen vampire on the
far side of a closed door shifted shape to pass under that door far side of a closed door shifted shape to pass under that door
fix mention_walls reporting secret doors as solid stone
Platform- and/or Interface-Specific Fixes Platform- and/or Interface-Specific Fixes
@@ -666,6 +674,7 @@ new paranoid_confirm settings: wand-break to require "yes" rather than 'y'
than 'y' when hero inflicted with lycanthropy has polymorph control than 'y' when hero inflicted with lycanthropy has polymorph control
option force_invmenu to make commands asking for inventory items always option force_invmenu to make commands asking for inventory items always
use a menu instead of a text line query use a menu instead of a text line query
option hitpointbar to show a bar graph of hit points behind title field
Platform- and/or Interface-Specific New Features Platform- and/or Interface-Specific New Features
+113 -45
View File
@@ -401,7 +401,7 @@ status_enablefield(int fldindex, char fldname, char fieldfmt, boolean enable)
BL_XP, BL_AC, BL_HD, BL_TIME, BL_HUNGER, BL_HP, BL_HPMAX, BL_XP, BL_AC, BL_HD, BL_TIME, BL_HUNGER, BL_HP, BL_HPMAX,
BL_LEVELDESC, BL_EXP, BL_CONDITION BL_LEVELDESC, BL_EXP, BL_CONDITION
-- There are MAXBLSTATS status fields (from botl.h) -- There are MAXBLSTATS status fields (from botl.h)
status_update(int fldindex, genericptr_t ptr, int chg, int percentage) status_update(int fldindex, genericptr_t ptr, int chg, int percentage, int color, long *colormasks)
-- update the value of a status field. -- update the value of a status field.
-- the fldindex identifies which field is changing and -- the fldindex identifies which field is changing and
is an integer index value from botl.h is an integer index value from botl.h
@@ -417,58 +417,124 @@ status_update(int fldindex, genericptr_t ptr, int chg, int percentage)
-- ptr is usually a "char *", unless fldindex is BL_CONDITION. -- ptr is usually a "char *", unless fldindex is BL_CONDITION.
If fldindex is BL_CONDITION, then ptr is a long value with If fldindex is BL_CONDITION, then ptr is a long value with
any or none of the following bits set (from botl.h): any or none of the following bits set (from botl.h):
BL_MASK_BLIND 0x00000001L BL_MASK_STONE 0x00000001L
BL_MASK_CONF 0x00000002L BL_MASK_SLIME 0x00000002L
BL_MASK_FOODPOIS 0x00000004L BL_MASK_STRNGL 0x00000004L
BL_MASK_ILL 0x00000008L BL_MASK_FOODPOIS 0x00000008L
BL_MASK_HALLU 0x00000010L BL_MASK_TERMILL 0x00000010L
BL_MASK_STUNNED 0x00000020L BL_MASK_BLIND 0x00000020L
BL_MASK_SLIMED 0x00000040L BL_MASK_DEAF 0x00000040L
BL_MASK_STUN 0x00000080L
BL_MASK_CONF 0x00000100L
BL_MASK_HALLU 0x00000200L
BL_MASK_LEV 0x00000400L
BL_MASK_FLY 0x00000800L
BL_MASK_RIDE 0x00001000L
-- The value passed for BL_GOLD includes a leading -- The value passed for BL_GOLD includes a leading
symbol for GOLD "$:nnn". If the window port needs to use symbol for GOLD "$:nnn". If the window port needs to use
the textual gold amount without the leading "$:" the port the textual gold amount without the leading "$:" the port
will have to add 2 to the passed "ptr" for the BL_GOLD case. will have to add 2 to the passed "ptr" for the BL_GOLD case.
-- color is an unsigned int.
int & 0x00FF = color CLR_*
int >> 8 = attribute (if any)
This contains the color and attribute that the field should
be displayed in.
This is relevant for everything except BL_CONDITION fldindex.
If fldindex is BL_CONDITION, this parameter should be ignored,
as condition hilighting is done via the next colormasks
parameter instead.
-- colormasks - pointer to cond_hilites[] array of colormasks.
Only relevant for BL_CONDITION fldindex. The window port
should ignore this parameter for other fldindex values.
Each condition bit must only ever appear in one of the
CLR_ array members, but can appear in multiple HL_ATTCLR_
offsets (because more than one attribute can co-exist).
For the user's chosen set of BL_MASK_ condition bits,
They are stored internally in the cond_hilites[] array,
at the array offset aligned to the color those condtion
bits should display in.
For example, if the user has chosen to display strngl
and stone and termill in red and inverse,
BL_MASK_SLIME 0x00000002
BL_MASK_STRNGL 0x00000004
BL_MASK_TERMILL 0x00000010
The bitmask corresponding to those conditions is
0x00000016 (or 00010110 in binary) and the color
is at offset 1 (CLR_RED).
Here is how that is stored in the cond_hilites[] array:
+------+----------------------+--------------------+
|array | | |
|offset| macro for indexing | bitmask |
|------+----------------------+--------------------+
| 0 | CLR_BLACK | |
+------+----------------------+--------------------+
| 1 | CLR_RED | 00010110 |
+------+----------------------+--------------------+
| 2 | CLR_GREEN | |
+------+----------------------+--------------------+
| 3 | CLR_BROWN | |
+------+----------------------+--------------------+
| 4 | CLR_BLUE | |
+------+----------------------+--------------------+
| 5 | CLR_MAGENTA | |
+------+----------------------+--------------------+
| 6 | CLR_CYAN | |
+------+----------------------+--------------------+
| 7 | CLR_GRAY | |
+------+----------------------+--------------------+
| 8 | NO_COLOR | |
+------+----------------------+--------------------+
| 9 | CLR_ORANGE | |
+------+----------------------+--------------------+
| 10 | CLR_BRIGHT_GREEN | |
+------+----------------------+--------------------+
| 11 | CLR_BRIGHT_YELLOW | |
+------+----------------------+--------------------+
| 12 | CLR_BRIGHT_BLUE | |
+------+----------------------+--------------------+
| 13 | CLR_BRIGHT_MAGENTA | |
+------+----------------------+--------------------+
| 14 | CLR_BRIGHT_CYAN | |
+------+----------------------+--------------------+
| 15 | CLR_WHITE | |
+------+----------------------+--------------------+
| 16 | HL_ATTCLR_DIM | | CLR_MAX
+------+----------------------+--------------------+
| 17 | HL_ATTCLR_BLINK | |
+------+----------------------+--------------------+
| 18 | HL_ATTCLR_ULINE | |
+------+----------------------+--------------------+
| 19 | HL_ATTCLR_INVERSE | 00010110 |
+------+----------------------+--------------------+
| 20 | HL_ATTCLR_BOLD | |
+------+----------------------+--------------------+
| 21 | beyond array boundary | BL_ATTCLR_MAX
The window port can AND (&) the bits passed in the
ptr argument to status_update() with any non-zero
entries in the cond_hilites[] array to determine
the color and attributes for displaying the
condition on the screen for the user.
If the bit for a particular condition does not
appear in any of the cond_hilites[] array offsets,
that condition should be displayed in the default
color and attributes.
status_finish() -- called when it is time for the window port to tear down status_finish() -- called when it is time for the window port to tear down
the status display and free allocated memory, etc. the status display and free allocated memory, etc.
status_threshold(int fldidx, int threshholdtype, anything threshold,
int behavior, int under, int over)
-- called when a hiliting preference is added, changed, or
removed.
-- the fldindex identifies which field is having its hiliting
preference set. It is an integer index value from botl.h
-- fldindex could be any one of the following from botl.h:
BL_TITLE, BL_STR, BL_DX, BL_CO, BL_IN, BL_WI, BL_CH,
BL_ALIGN, BL_SCORE, BL_CAP, BL_GOLD, BL_ENE, BL_ENEMAX,
BL_XP, BL_AC, BL_HD, BL_TIME, BL_HUNGER, BL_HP, BL_HPMAX,
BL_LEVELDESC, BL_EXP, BL_CONDITION
-- datatype is P_INT, P_UINT, P_LONG, or P_MASK.
-- threshold is an "anything" union which can contain the
datatype value.
-- behavior is used to define how threshold is used and can
be BL_TH_NONE, BL_TH_VAL_PERCENTAGE, BL_TH_VAL_ABSOLUTE,
or BL_TH_UPDOWN. BL_TH_NONE means don't do anything above
or below the threshold. BL_TH_VAL_PERCENTAGE treats the
threshold value as a precentage of the maximum possible
value. BL_TH_VAL_ABSOLUTE means that the threshold is an
actual value. BL_TH_UPDOWN means that threshold is not
used, and the two below/above hilite values indicate how
to display something going down (under) or rising (over).
-- under is the hilite attribute used if value is below the
threshold. The attribute can be BL_HILITE_NONE,
BL_HILITE_INVERSE, BL_HILITE_BOLD (-1, -2, or -3), or one
of the color indexes of CLR_BLACK, CLR_RED, CLR_GREEN,
CLR_BROWN, CLR_BLUE, CLR_MAGENTA, CLR_CYAN, CLR_GRAY,
CLR_ORANGE, CLR_BRIGHT_GREEN, CLR_YELLOW, CLR_BRIGHT_BLUE,
CLR_BRIGHT_MAGENTA, CLR_BRIGHT_CYAN, or CLR_WHITE (0 - 15).
-- over is the hilite attribute used if value is at or above
the threshold. The attribute can be BL_HILITE_NONE,
BL_HILITE_INVERSE, BL_HILITE_BOLD (-1, -2, or -3), or one
of the color indexes of CLR_BLACK, CLR_RED, CLR_GREEN,
CLR_BROWN, CLR_BLUE, CLR_MAGENTA, CLR_CYAN, CLR_GRAY,
CLR_ORANGE, CLR_BRIGHT_GREEN, CLR_YELLOW, CLR_BRIGHT_BLUE,
CLR_BRIGHT_MAGENTA, CLR_BRIGHT_CYAN, or CLR_WHITE (0 - 15).
E. Misc. Routines E. Misc. Routines
@@ -703,6 +769,7 @@ to support:
| softkeyboard | WC2_SOFTKEYBOARD | wc2_softkeyboard |boolean | | softkeyboard | WC2_SOFTKEYBOARD | wc2_softkeyboard |boolean |
| wraptext | WC2_WRAPTEXT | wc2_wraptext |boolean | | wraptext | WC2_WRAPTEXT | wc2_wraptext |boolean |
| selectsaved | WC2_SELECTSAVED | wc2_selectsaved |boolean | | selectsaved | WC2_SELECTSAVED | wc2_selectsaved |boolean |
| hitpointbar | WC2_HITPOINTBAR | wc2_hitpointbar |boolean |
+--------------------+--------------------+--------------------+--------+ +--------------------+--------------------+--------------------+--------+
align_message -- where to place message window (top, bottom, left, right) align_message -- where to place message window (top, bottom, left, right)
@@ -723,6 +790,7 @@ font_status -- port should use a font by this name for status display.
font_text -- port should use a font by this name for text windows. font_text -- port should use a font by this name for text windows.
fullscreen -- port should try to use the whole screen. fullscreen -- port should try to use the whole screen.
hilite_pet -- port should mark pets in some special way on the map. hilite_pet -- port should mark pets in some special way on the map.
hitpointbar -- port should show a graphical bar representing hit points
map_mode -- port should display the map in the manner specified. map_mode -- port should display the map in the manner specified.
player_selection player_selection
-- dialog or prompts for choosing character. -- dialog or prompts for choosing character.
+31 -38
View File
@@ -27,42 +27,18 @@ Astral Plane \GXXXXNNNN:123456 HP:1234(1234) Pw:1234(1234) AC:-127
#define MAXCO (COLNO + 40) #define MAXCO (COLNO + 40)
#endif #endif
#ifdef STATUS_VIA_WINDOWPORT enum statusfields {
#if 0 BL_CHARACTERISTICS = -2, /* alias for BL_STR..BL_CH */
/* clang-format off */ BL_FLUSH = -1, BL_TITLE = 0,
#define BL_FLUSH -1 BL_STR, BL_DX, BL_CO, BL_IN, BL_WI, BL_CH, /* 1..6 */
#define BL_TITLE 0 BL_ALIGN, BL_SCORE, BL_CAP, BL_GOLD, BL_ENE, BL_ENEMAX, /* 7..12 */
#define BL_STR 1 BL_XP, BL_AC, BL_HD, BL_TIME, BL_HUNGER, BL_HP, BL_HPMAX, BL_LEVELDESC, /* 13..20 */
#define BL_DX 2 BL_EXP, BL_CONDITION
#define BL_CO 3 };
#define BL_IN 4
#define BL_WI 5
#define BL_CH 6
#define BL_ALIGN 7
#define BL_SCORE 8
#define BL_CAP 9
#define BL_GOLD 10
#define BL_ENE 11
#define BL_ENEMAX 12
#define BL_XP 13
#define BL_AC 14
#define BL_HD 15
#define BL_TIME 16
#define BL_HUNGER 17
#define BL_HP 18
#define BL_HPMAX 19
#define BL_LEVELDESC 20
#define BL_EXP 21
#define BL_CONDITION 22
/* clang-format on */
#else enum relationships { LT_VALUE = -1, EQ_VALUE, GT_VALUE, TXT_VALUE };
enum statusfields { BL_FLUSH = -1, BL_TITLE = 0, BL_STR, BL_DX, BL_CO, BL_IN,
BL_WI, BL_CH, BL_ALIGN, BL_SCORE, BL_CAP, BL_GOLD, BL_ENE, BL_ENEMAX, #define MAXBLSTATS (BL_CONDITION + 1)
BL_XP, BL_AC, BL_HD, BL_TIME, BL_HUNGER, BL_HP, BL_HPMAX, BL_LEVELDESC,
BL_EXP, BL_CONDITION };
#endif
#define MAXBLSTATS BL_CONDITION+1
#define BEFORE 0 #define BEFORE 0
#define NOW 1 #define NOW 1
@@ -87,7 +63,7 @@ BL_EXP, BL_CONDITION };
#define REASSESS_ONLY TRUE #define REASSESS_ONLY TRUE
#ifdef STATUS_HILITES /* #ifdef STATUS_HILITES */
/* hilite status field behavior - coloridx values */ /* hilite status field behavior - coloridx values */
#define BL_HILITE_NONE -1 /* no hilite of this field */ #define BL_HILITE_NONE -1 /* no hilite of this field */
#define BL_HILITE_INVERSE -2 /* inverse hilite */ #define BL_HILITE_INVERSE -2 /* inverse hilite */
@@ -98,9 +74,26 @@ BL_EXP, BL_CONDITION };
#define BL_TH_VAL_ABSOLUTE 101 /* threshold is particular value */ #define BL_TH_VAL_ABSOLUTE 101 /* threshold is particular value */
#define BL_TH_UPDOWN 102 /* threshold is up or down change */ #define BL_TH_UPDOWN 102 /* threshold is up or down change */
#define BL_TH_CONDITION 103 /* threshold is bitmask of conditions */ #define BL_TH_CONDITION 103 /* threshold is bitmask of conditions */
#endif #define BL_TH_TEXTMATCH 104 /* threshold text value to match against */
#define BL_TH_ALWAYS_HILITE 105 /* highlight regardless of value */
#define HL_ATTCLR_DIM CLR_MAX + 0
#define HL_ATTCLR_BLINK CLR_MAX + 1
#define HL_ATTCLR_ULINE CLR_MAX + 2
#define HL_ATTCLR_INVERSE CLR_MAX + 3
#define HL_ATTCLR_BOLD CLR_MAX + 4
#define BL_ATTCLR_MAX CLR_MAX + 5
enum hlattribs { HL_UNDEF = 0x00,
HL_NONE = 0x01,
HL_BOLD = 0x02,
HL_INVERSE = 0x04,
HL_ULINE = 0x08,
HL_BLINK = 0x10,
HL_DIM = 0x20 };
/* #endif STATUS_HILITES */
extern const char *status_fieldnames[]; /* in botl.c */ extern const char *status_fieldnames[]; /* in botl.c */
#endif
#endif /* BOTL_H */ #endif /* BOTL_H */
+1 -3
View File
@@ -498,9 +498,7 @@ typedef unsigned char uchar;
* Only available with POSIX_TYPES or GNU C */ * Only available with POSIX_TYPES or GNU C */
/* #define MSGHANDLER */ /* #define MSGHANDLER */
/* #define STATUS_VIA_WINDOWPORT */ /* re-work of the status line #define STATUS_HILITES /* support hilites of status fields */
updating process */
/* #define STATUS_HILITES */ /* support hilites of status fields */
/* #define WINCHAIN */ /* stacked window systems */ /* #define WINCHAIN */ /* stacked window systems */
-2
View File
@@ -325,9 +325,7 @@ E NEARDATA char **viz_array; /* could see/in sight row pointers */
/* Window system stuff */ /* Window system stuff */
E NEARDATA winid WIN_MESSAGE; E NEARDATA winid WIN_MESSAGE;
#ifndef STATUS_VIA_WINDOWPORT
E NEARDATA winid WIN_STATUS; E NEARDATA winid WIN_STATUS;
#endif
E NEARDATA winid WIN_MAP, WIN_INVEN; E NEARDATA winid WIN_MAP, WIN_INVEN;
/* pline (et al) for a single string argument (suppress compiler warning) */ /* pline (et al) for a single string argument (suppress compiler warning) */
+13 -14
View File
@@ -153,17 +153,17 @@ E long NDECL(botl_score);
E int FDECL(describe_level, (char *)); E int FDECL(describe_level, (char *));
E const char *FDECL(rank_of, (int, SHORT_P, BOOLEAN_P)); E const char *FDECL(rank_of, (int, SHORT_P, BOOLEAN_P));
E void NDECL(bot); E void NDECL(bot);
#ifdef STATUS_VIA_WINDOWPORT
E void FDECL(status_initialize, (BOOLEAN_P)); E void FDECL(status_initialize, (BOOLEAN_P));
E void NDECL(status_finish); E void NDECL(status_finish);
E void FDECL(status_notify_windowport, (BOOLEAN_P)); E void FDECL(status_notify_windowport, (BOOLEAN_P));
E void NDECL(status_eval_next_unhilite);
#ifdef STATUS_HILITES #ifdef STATUS_HILITES
E boolean FDECL(set_status_hilites, (char *op, BOOLEAN_P)); E boolean FDECL(parse_status_hl1, (char *op, BOOLEAN_P));
E void FDECL(clear_status_hilites, (BOOLEAN_P)); E void NDECL(clear_status_hilites);
E char *FDECL(get_status_hilites, (char *, int)); E void NDECL(reset_status_hilites);
E int NDECL(count_status_hilites);
E boolean NDECL(status_hilite_menu); E boolean NDECL(status_hilite_menu);
#endif #endif
#endif
/* ### cmd.c ### */ /* ### cmd.c ### */
@@ -869,6 +869,7 @@ E char *FDECL(upstart, (char *));
E char *FDECL(mungspaces, (char *)); E char *FDECL(mungspaces, (char *));
E char *FDECL(trimspaces, (char *)); E char *FDECL(trimspaces, (char *));
E char *FDECL(strip_newline, (char *)); E char *FDECL(strip_newline, (char *));
E char *FDECL(stripchars, (char *, const char *, const char *));
E char *FDECL(eos, (char *)); E char *FDECL(eos, (char *));
E boolean FDECL(str_end_is, (const char *, const char *)); E boolean FDECL(str_end_is, (const char *, const char *));
E char *FDECL(strkitten, (char *, CHAR_P)); E char *FDECL(strkitten, (char *, CHAR_P));
@@ -1536,7 +1537,7 @@ E void FDECL(Delay, (int));
/* ### mthrowu.c ### */ /* ### mthrowu.c ### */
E int FDECL(thitu, (int, int, struct obj *, const char *)); E int FDECL(thitu, (int, int, struct obj **, const char *));
E int FDECL(ohitmon, (struct monst *, struct obj *, int, BOOLEAN_P)); E int FDECL(ohitmon, (struct monst *, struct obj *, int, BOOLEAN_P));
E void FDECL(thrwmu, (struct monst *)); E void FDECL(thrwmu, (struct monst *));
E int FDECL(spitmu, (struct monst *, struct attack *)); E int FDECL(spitmu, (struct monst *, struct attack *));
@@ -1714,8 +1715,11 @@ E boolean FDECL(parsesymbols, (char *));
E struct symparse *FDECL(match_sym, (char *)); E struct symparse *FDECL(match_sym, (char *));
E void NDECL(set_playmode); E void NDECL(set_playmode);
E int FDECL(sym_val, (const char *)); E int FDECL(sym_val, (const char *));
E int FDECL(query_color, (const char *));
E int FDECL(query_attr, (const char *));
E const char *FDECL(clr2colorname, (int)); E const char *FDECL(clr2colorname, (int));
E int FDECL(match_str2clr, (char *)); E int FDECL(match_str2clr, (char *));
E int FDECL(match_str2attr, (const char *, BOOLEAN_P));
E boolean FDECL(add_menu_coloring, (char *)); E boolean FDECL(add_menu_coloring, (char *));
E boolean FDECL(get_menu_coloring, (char *, int *, int *)); E boolean FDECL(get_menu_coloring, (char *, int *, int *));
E void NDECL(free_menu_coloring); E void NDECL(free_menu_coloring);
@@ -1886,7 +1890,7 @@ E int FDECL(dopotion, (struct obj *));
E int FDECL(peffects, (struct obj *)); E int FDECL(peffects, (struct obj *));
E void FDECL(healup, (int, int, BOOLEAN_P, BOOLEAN_P)); E void FDECL(healup, (int, int, BOOLEAN_P, BOOLEAN_P));
E void FDECL(strange_feeling, (struct obj *, const char *)); E void FDECL(strange_feeling, (struct obj *, const char *));
E void FDECL(potionhit, (struct monst *, struct obj *, BOOLEAN_P)); E void FDECL(potionhit, (struct monst *, struct obj *, int));
E void FDECL(potionbreathe, (struct obj *)); E void FDECL(potionbreathe, (struct obj *));
E int NDECL(dodip); E int NDECL(dodip);
E void FDECL(mongrantswish, (struct monst **)); E void FDECL(mongrantswish, (struct monst **));
@@ -2458,7 +2462,7 @@ E void FDECL(check_caitiff, (struct monst *));
E int FDECL(find_roll_to_hit, E int FDECL(find_roll_to_hit,
(struct monst *, UCHAR_P, struct obj *, int *, int *)); (struct monst *, UCHAR_P, struct obj *, int *, int *));
E boolean FDECL(attack, (struct monst *)); E boolean FDECL(attack, (struct monst *));
E boolean FDECL(hmon, (struct monst *, struct obj *, int)); E boolean FDECL(hmon, (struct monst *, struct obj *, int, int));
E int FDECL(damageum, (struct monst *, struct attack *)); E int FDECL(damageum, (struct monst *, struct attack *));
E void FDECL(missum, (struct monst *, struct attack *, BOOLEAN_P)); E void FDECL(missum, (struct monst *, struct attack *, BOOLEAN_P));
E int FDECL(passive, (struct monst *, BOOLEAN_P, int, UCHAR_P, BOOLEAN_P)); E int FDECL(passive, (struct monst *, BOOLEAN_P, int, UCHAR_P, BOOLEAN_P));
@@ -2739,16 +2743,11 @@ E void FDECL(genl_putmsghistory, (const char *, BOOLEAN_P));
#ifdef HANGUPHANDLING #ifdef HANGUPHANDLING
E void NDECL(nhwindows_hangup); E void NDECL(nhwindows_hangup);
#endif #endif
#ifdef STATUS_VIA_WINDOWPORT
E void NDECL(genl_status_init); E void NDECL(genl_status_init);
E void NDECL(genl_status_finish); E void NDECL(genl_status_finish);
E void FDECL(genl_status_enablefield, E void FDECL(genl_status_enablefield,
(int, const char *, const char *, BOOLEAN_P)); (int, const char *, const char *, BOOLEAN_P));
E void FDECL(genl_status_update, (int, genericptr_t, int, int)); E void FDECL(genl_status_update, (int, genericptr_t, int, int, int, unsigned long *));
#ifdef STATUS_HILITES
E void FDECL(genl_status_threshold, (int, int, anything, int, int, int));
#endif
#endif
E void FDECL(dump_open_log, (time_t)); E void FDECL(dump_open_log, (time_t));
E void NDECL(dump_close_log); E void NDECL(dump_close_log);
+5 -1
View File
@@ -251,7 +251,10 @@ struct instance_flags {
boolean toptenwin; /* ending list in window instead of stdout */ boolean toptenwin; /* ending list in window instead of stdout */
boolean use_background_glyph; /* use background glyph when appropriate */ boolean use_background_glyph; /* use background glyph when appropriate */
boolean use_menu_color; /* use color in menus; only if wc_color */ boolean use_menu_color; /* use color in menus; only if wc_color */
boolean use_status_hilites; /* use color in status line */ #ifdef STATUS_HILITES
long hilite_delta; /* number of moves to leave a temp hilite lit */
long unhilite_deadline; /* time when oldest temp hilite should be unlit */
#endif
boolean zerocomp; /* write zero-compressed save files */ boolean zerocomp; /* write zero-compressed save files */
boolean rlecomp; /* alternative to zerocomp; run-length encoding boolean rlecomp; /* alternative to zerocomp; run-length encoding
* compression of levels when writing savefile */ * compression of levels when writing savefile */
@@ -360,6 +363,7 @@ struct instance_flags {
boolean wc2_wraptext; /* wrap text */ boolean wc2_wraptext; /* wrap text */
boolean wc2_selectsaved; /* display a menu of user's saved games */ boolean wc2_selectsaved; /* display a menu of user's saved games */
boolean wc2_darkgray; /* try to use dark-gray color for black glyphs */ boolean wc2_darkgray; /* try to use dark-gray color for black glyphs */
boolean wc2_hitpointbar; /* show graphical bar representing hit points */
boolean cmdassist; /* provide detailed assistance for some commands */ boolean cmdassist; /* provide detailed assistance for some commands */
boolean clicklook; /* allow right-clicking for look */ boolean clicklook; /* allow right-clicking for look */
boolean obsolete; /* obsolete options can point at this, it isn't used */ boolean obsolete; /* obsolete options can point at this, it isn't used */
+8 -1
View File
@@ -40,8 +40,9 @@ struct obj {
unsigned owt; unsigned owt;
long quan; /* number of items */ long quan; /* number of items */
schar spe; /* quality of weapon, armor or ring (+ or -); schar spe; /* quality of weapon, weptool, armor or ring (+ or -);
number of charges for wand or charged tool ( >= -1 ); number of charges for wand or charged tool ( >= -1 );
number of candles attached to candelabrum;
marks your eggs, tin variety and spinach tins; marks your eggs, tin variety and spinach tins;
Schroedinger's Box (1) or royal coffers for a court (2); Schroedinger's Box (1) or royal coffers for a court (2);
tells which fruit a fruit is; tells which fruit a fruit is;
@@ -373,6 +374,12 @@ struct obj {
#define ER_DAMAGED 2 /* object was damaged in some way */ #define ER_DAMAGED 2 /* object was damaged in some way */
#define ER_DESTROYED 3 /* object was destroyed */ #define ER_DESTROYED 3 /* object was destroyed */
/* propeller method for potionhit() */
#define POTHIT_HERO_BASH 0 /* wielded by hero */
#define POTHIT_HERO_THROW 1 /* thrown by hero */
#define POTHIT_MONST_THROW 2 /* thrown by a monster */
#define POTHIT_OTHER_THROW 3 /* propelled by some other means [scatter()] */
/* /*
* Notes for adding new oextra structures: * Notes for adding new oextra structures:
* *
+6 -19
View File
@@ -73,16 +73,11 @@ struct window_procs {
void FDECL((*win_preference_update), (const char *)); void FDECL((*win_preference_update), (const char *));
char *FDECL((*win_getmsghistory), (BOOLEAN_P)); char *FDECL((*win_getmsghistory), (BOOLEAN_P));
void FDECL((*win_putmsghistory), (const char *, BOOLEAN_P)); void FDECL((*win_putmsghistory), (const char *, BOOLEAN_P));
#ifdef STATUS_VIA_WINDOWPORT
void NDECL((*win_status_init)); void NDECL((*win_status_init));
void NDECL((*win_status_finish)); void NDECL((*win_status_finish));
void FDECL((*win_status_enablefield), void FDECL((*win_status_enablefield),
(int, const char *, const char *, BOOLEAN_P)); (int, const char *, const char *, BOOLEAN_P));
void FDECL((*win_status_update), (int, genericptr_t, int, int)); void FDECL((*win_status_update), (int, genericptr_t, int, int, int, unsigned long *));
#ifdef STATUS_HILITES
void FDECL((*win_status_threshold), (int, int, anything, int, int, int));
#endif
#endif
boolean NDECL((*win_can_suspend)); boolean NDECL((*win_can_suspend));
}; };
@@ -160,16 +155,11 @@ extern
#define preference_update (*windowprocs.win_preference_update) #define preference_update (*windowprocs.win_preference_update)
#define getmsghistory (*windowprocs.win_getmsghistory) #define getmsghistory (*windowprocs.win_getmsghistory)
#define putmsghistory (*windowprocs.win_putmsghistory) #define putmsghistory (*windowprocs.win_putmsghistory)
#ifdef STATUS_VIA_WINDOWPORT
/* there is a status_initialize() in botl.c, /* there is a status_initialize() in botl.c,
* which calls win_status_init() directly; same with status_finish. * which calls win_status_init() directly; same with status_finish.
*/ */
#define status_enablefield (*windowprocs.win_status_enablefield) #define status_enablefield (*windowprocs.win_status_enablefield)
#define status_update (*windowprocs.win_status_update) #define status_update (*windowprocs.win_status_update)
#ifdef STATUS_HILITES
#define status_threshold (*windowprocs.win_status_threshold)
#endif
#endif
/* /*
* WINCAP * WINCAP
@@ -221,7 +211,10 @@ extern
#define WC2_HILITE_STATUS 0x0008L /* 04 hilite fields in status */ #define WC2_HILITE_STATUS 0x0008L /* 04 hilite fields in status */
#define WC2_SELECTSAVED 0x0010L /* 05 saved game selection menu */ #define WC2_SELECTSAVED 0x0010L /* 05 saved game selection menu */
#define WC2_DARKGRAY 0x0020L /* 06 use bold black for black glyphs */ #define WC2_DARKGRAY 0x0020L /* 06 use bold black for black glyphs */
/* 26 free bits */ #define WC2_HITPOINTBAR 0x0040L /* 07 show bar representing hit points */
#define WC2_FLUSH_STATUS 0x0080L /* 08 call status_update(BL_FLUSH)
after updating status window fields */
/* 24 free bits */
#define ALIGN_LEFT 1 #define ALIGN_LEFT 1
#define ALIGN_RIGHT 2 #define ALIGN_RIGHT 2
@@ -362,17 +355,11 @@ struct chain_procs {
void FDECL((*win_preference_update), (CARGS, const char *)); void FDECL((*win_preference_update), (CARGS, const char *));
char *FDECL((*win_getmsghistory), (CARGS, BOOLEAN_P)); char *FDECL((*win_getmsghistory), (CARGS, BOOLEAN_P));
void FDECL((*win_putmsghistory), (CARGS, const char *, BOOLEAN_P)); void FDECL((*win_putmsghistory), (CARGS, const char *, BOOLEAN_P));
#ifdef STATUS_VIA_WINDOWPORT
void FDECL((*win_status_init), (CARGS)); void FDECL((*win_status_init), (CARGS));
void FDECL((*win_status_finish), (CARGS)); void FDECL((*win_status_finish), (CARGS));
void FDECL((*win_status_enablefield), void FDECL((*win_status_enablefield),
(CARGS, int, const char *, const char *, BOOLEAN_P)); (CARGS, int, const char *, const char *, BOOLEAN_P));
void FDECL((*win_status_update), (CARGS, int, genericptr_t, int, int)); void FDECL((*win_status_update), (CARGS, int, genericptr_t, int, int, int, unsigned long));
#ifdef STATUS_HILITES
void FDECL((*win_status_threshold),
(CARGS, int, int, anything, int, int, int));
#endif
#endif
boolean FDECL((*win_can_suspend), (CARGS)); boolean FDECL((*win_can_suspend), (CARGS));
}; };
#endif /* WINCHAIN */ #endif /* WINCHAIN */
+1 -6
View File
@@ -215,13 +215,8 @@ E short FDECL(set_tty_font_name, (winid, char *));
#endif #endif
E char *NDECL(tty_get_color_string); E char *NDECL(tty_get_color_string);
#endif #endif
#ifdef STATUS_VIA_WINDOWPORT
E void NDECL(tty_status_init); E void NDECL(tty_status_init);
E void FDECL(tty_status_update, (int, genericptr_t, int, int)); E void FDECL(tty_status_update, (int, genericptr_t, int, int, int, unsigned long *));
#ifdef STATUS_HILITES
E void FDECL(tty_status_threshold, (int, int, anything, int, int, int));
#endif
#endif
/* 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(tty_start_screen); E void NDECL(tty_start_screen);
+7 -9
View File
@@ -59,15 +59,12 @@ boolean resuming;
context.rndencode = rnd(9000); context.rndencode = rnd(9000);
set_wear((struct obj *) 0); /* for side-effects of starting gear */ set_wear((struct obj *) 0); /* for side-effects of starting gear */
(void) pickup(1); /* autopickup at initial location */ (void) pickup(1); /* autopickup at initial location */
} else { /* restore old game */ }
#ifndef WIN32 context.botlx = TRUE; /* for STATUS_HILITES */
update_inventory(); /* for perm_invent */ update_inventory(); /* for perm_invent */
#endif if (resuming) { /* restoring old game */
read_engr_at(u.ux, u.uy); /* subset of pickup() */ read_engr_at(u.ux, u.uy); /* subset of pickup() */
} }
#ifdef WIN32
update_inventory(); /* for perm_invent */
#endif
(void) encumber_msg(); /* in case they auto-picked up something */ (void) encumber_msg(); /* in case they auto-picked up something */
if (defer_see_monsters) { if (defer_see_monsters) {
@@ -325,6 +322,7 @@ boolean resuming;
/* once-per-hero-took-time things go here */ /* once-per-hero-took-time things go here */
/******************************************/ /******************************************/
status_eval_next_unhilite();
if (context.bypasses) if (context.bypasses)
clear_bypasses(); clear_bypasses();
if ((u.uhave.amulet || Clairvoyant) && !In_endgame(&u.uz) if ((u.uhave.amulet || Clairvoyant) && !In_endgame(&u.uz)
@@ -537,7 +535,7 @@ void
display_gamewindows() display_gamewindows()
{ {
WIN_MESSAGE = create_nhwindow(NHW_MESSAGE); WIN_MESSAGE = create_nhwindow(NHW_MESSAGE);
#ifdef STATUS_VIA_WINDOWPORT #ifdef STATUS_HILITES
status_initialize(0); status_initialize(0);
#else #else
WIN_STATUS = create_nhwindow(NHW_STATUS); WIN_STATUS = create_nhwindow(NHW_STATUS);
@@ -561,7 +559,7 @@ display_gamewindows()
* The mac port is not DEPENDENT on the order of these * The mac port is not DEPENDENT on the order of these
* displays, but it looks a lot better this way... * displays, but it looks a lot better this way...
*/ */
#ifndef STATUS_VIA_WINDOWPORT #ifndef STATUS_HILITES
display_nhwindow(WIN_STATUS, FALSE); display_nhwindow(WIN_STATUS, FALSE);
#endif #endif
display_nhwindow(WIN_MESSAGE, FALSE); display_nhwindow(WIN_MESSAGE, FALSE);
+5 -3
View File
@@ -1224,6 +1224,9 @@ struct obj **optr;
end_burn(obj, TRUE); end_burn(obj, TRUE);
/* candles are now gone */ /* candles are now gone */
useupall(obj); useupall(obj);
/* candelabrum's weight is changing */
otmp->owt = weight(otmp);
update_inventory();
} }
} }
@@ -2786,9 +2789,8 @@ struct obj *obj;
int hitu, hitvalu; int hitu, hitvalu;
hitvalu = 8 + otmp->spe; hitvalu = 8 + otmp->spe;
hitu = thitu(hitvalu, hitu = thitu(hitvalu, dmgval(otmp, &youmonst),
dmgval(otmp, &youmonst), &otmp, (char *)0);
otmp, (char *)0);
if (hitu) { if (hitu) {
pline_The("%s hits you as you try to snatch it!", pline_The("%s hits you as you try to snatch it!",
the(onambuf)); the(onambuf));
+4 -2
View File
@@ -610,11 +610,13 @@ drag:
You("are jerked back by the iron ball!"); You("are jerked back by the iron ball!");
if ((victim = m_at(uchain->ox, uchain->oy)) != 0) { if ((victim = m_at(uchain->ox, uchain->oy)) != 0) {
int tmp; int tmp;
int dieroll = rnd(20);
tmp = -2 + Luck + find_mac(victim); tmp = -2 + Luck + find_mac(victim);
tmp += omon_adj(victim, uball, TRUE); tmp += omon_adj(victim, uball, TRUE);
if (tmp >= rnd(20))
(void) hmon(victim, uball, HMON_DRAGGED); if (tmp >= dieroll)
(void) hmon(victim, uball, HMON_DRAGGED, dieroll);
else else
miss(xname(uball), victim); miss(xname(uball), victim);
+2355 -752
View File
File diff suppressed because it is too large Load Diff
-2
View File
@@ -264,9 +264,7 @@ NEARDATA char **viz_array = 0; /* used in cansee() and couldsee() macros */
/* Global windowing data, defined here for multi-window-system support */ /* Global windowing data, defined here for multi-window-system support */
NEARDATA winid WIN_MESSAGE = WIN_ERR; NEARDATA winid WIN_MESSAGE = WIN_ERR;
#ifndef STATUS_VIA_WINDOWPORT
NEARDATA winid WIN_STATUS = WIN_ERR; NEARDATA winid WIN_STATUS = WIN_ERR;
#endif
NEARDATA winid WIN_MAP = WIN_ERR, WIN_INVEN = WIN_ERR; NEARDATA winid WIN_MAP = WIN_ERR, WIN_INVEN = WIN_ERR;
char toplines[TBUFSZ]; char toplines[TBUFSZ];
/* Windowing stuff that's really tty oriented, but present for all ports */ /* Windowing stuff that's really tty oriented, but present for all ports */
+4 -1
View File
@@ -158,7 +158,10 @@ const char *verb;
(mtmp) ? "" : " with you"); (mtmp) ? "" : " with you");
if (mtmp) { if (mtmp) {
if (!passes_walls(mtmp->data) && !throws_rocks(mtmp->data)) { if (!passes_walls(mtmp->data) && !throws_rocks(mtmp->data)) {
if (hmon(mtmp, obj, TRUE) && !is_whirly(mtmp->data)) int dieroll = rnd(20);
if (hmon(mtmp, obj, HMON_THROWN, dieroll)
&& !is_whirly(mtmp->data))
return FALSE; /* still alive */ return FALSE; /* still alive */
} }
mtmp->mtrapped = 0; mtmp->mtrapped = 0;
+13 -10
View File
@@ -884,7 +884,7 @@ boolean hitsroof;
/* object now hits you */ /* object now hits you */
if (obj->oclass == POTION_CLASS) { if (obj->oclass == POTION_CLASS) {
potionhit(&youmonst, obj, TRUE); potionhit(&youmonst, obj, POTHIT_HERO_THROW);
} else if (breaktest(obj)) { } else if (breaktest(obj)) {
int otyp = obj->otyp; int otyp = obj->otyp;
int blindinc; int blindinc;
@@ -1086,7 +1086,7 @@ boolean
&& rn2(6)) { && rn2(6)) {
/* alternative to prayer or wand of opening/spell of knock /* alternative to prayer or wand of opening/spell of knock
for dealing with cursed saddle: throw holy water > */ for dealing with cursed saddle: throw holy water > */
potionhit(u.usteed, obj, TRUE); potionhit(u.usteed, obj, POTHIT_HERO_THROW);
} else { } else {
hitfloor(obj); hitfloor(obj);
} }
@@ -1386,6 +1386,7 @@ register struct obj *obj; /* thrownobj or kickedobj or uwep */
register int disttmp; /* distance modifier */ register int disttmp; /* distance modifier */
int otyp = obj->otyp, hmode; int otyp = obj->otyp, hmode;
boolean guaranteed_hit = (u.uswallow && mon == u.ustuck); boolean guaranteed_hit = (u.uswallow && mon == u.ustuck);
int dieroll;
hmode = (obj == uwep) ? HMON_APPLIED hmode = (obj == uwep) ? HMON_APPLIED
: (obj == kickedobj) ? HMON_KICKED : (obj == kickedobj) ? HMON_KICKED
@@ -1493,6 +1494,8 @@ register struct obj *obj; /* thrownobj or kickedobj or uwep */
return 0; return 0;
} }
dieroll = rnd(20);
if (obj->oclass == WEAPON_CLASS || is_weptool(obj) if (obj->oclass == WEAPON_CLASS || is_weptool(obj)
|| obj->oclass == GEM_CLASS) { || obj->oclass == GEM_CLASS) {
if (hmode == HMON_KICKED) { if (hmode == HMON_KICKED) {
@@ -1533,13 +1536,13 @@ register struct obj *obj; /* thrownobj or kickedobj or uwep */
tmp += weapon_hit_bonus(obj); tmp += weapon_hit_bonus(obj);
} }
if (tmp >= rnd(20)) { if (tmp >= dieroll) {
boolean wasthrown = (thrownobj != 0); boolean wasthrown = (thrownobj != 0);
/* attack hits mon */ /* attack hits mon */
if (hmode == HMON_APPLIED) if (hmode == HMON_APPLIED)
u.uconduct.weaphit++; u.uconduct.weaphit++;
if (hmon(mon, obj, hmode)) { /* mon still alive */ if (hmon(mon, obj, hmode, dieroll)) { /* mon still alive */
cutworm(mon, bhitpos.x, bhitpos.y, obj); cutworm(mon, bhitpos.x, bhitpos.y, obj);
} }
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
@@ -1585,11 +1588,11 @@ register struct obj *obj; /* thrownobj or kickedobj or uwep */
} else if (otyp == HEAVY_IRON_BALL) { } else if (otyp == HEAVY_IRON_BALL) {
exercise(A_STR, TRUE); exercise(A_STR, TRUE);
if (tmp >= rnd(20)) { if (tmp >= dieroll) {
int was_swallowed = guaranteed_hit; int was_swallowed = guaranteed_hit;
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
if (!hmon(mon, obj, hmode)) { /* mon killed */ if (!hmon(mon, obj, hmode, dieroll)) { /* mon killed */
if (was_swallowed && !u.uswallow && obj == uball) if (was_swallowed && !u.uswallow && obj == uball)
return 1; /* already did placebc() */ return 1; /* already did placebc() */
} }
@@ -1599,9 +1602,9 @@ register struct obj *obj; /* thrownobj or kickedobj or uwep */
} else if (otyp == BOULDER) { } else if (otyp == BOULDER) {
exercise(A_STR, TRUE); exercise(A_STR, TRUE);
if (tmp >= rnd(20)) { if (tmp >= dieroll) {
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
(void) hmon(mon, obj, hmode); (void) hmon(mon, obj, hmode, dieroll);
} else { } else {
tmiss(obj, mon, TRUE); tmiss(obj, mon, TRUE);
} }
@@ -1609,12 +1612,12 @@ register struct obj *obj; /* thrownobj or kickedobj or uwep */
} else if ((otyp == EGG || otyp == CREAM_PIE || otyp == BLINDING_VENOM } else if ((otyp == EGG || otyp == CREAM_PIE || otyp == BLINDING_VENOM
|| otyp == ACID_VENOM) || otyp == ACID_VENOM)
&& (guaranteed_hit || ACURR(A_DEX) > rnd(25))) { && (guaranteed_hit || ACURR(A_DEX) > rnd(25))) {
(void) hmon(mon, obj, hmode); (void) hmon(mon, obj, hmode, dieroll);
return 1; /* hmon used it up */ return 1; /* hmon used it up */
} else if (obj->oclass == POTION_CLASS } else if (obj->oclass == POTION_CLASS
&& (guaranteed_hit || ACURR(A_DEX) > rnd(25))) { && (guaranteed_hit || ACURR(A_DEX) > rnd(25))) {
potionhit(mon, obj, TRUE); potionhit(mon, obj, POTHIT_HERO_THROW);
return 1; return 1;
} else if (befriend_with_obj(mon->data, obj) } else if (befriend_with_obj(mon->data, obj)
+1 -1
View File
@@ -1277,7 +1277,7 @@ int how;
destroy_nhwindow(WIN_INVEN), WIN_INVEN = WIN_ERR; destroy_nhwindow(WIN_INVEN), WIN_INVEN = WIN_ERR;
display_nhwindow(WIN_MESSAGE, TRUE); display_nhwindow(WIN_MESSAGE, TRUE);
destroy_nhwindow(WIN_MAP), WIN_MAP = WIN_ERR; destroy_nhwindow(WIN_MAP), WIN_MAP = WIN_ERR;
#ifndef STATUS_VIA_WINDOWPORT #ifndef STATUS_HILITES
destroy_nhwindow(WIN_STATUS), WIN_STATUS = WIN_ERR; destroy_nhwindow(WIN_STATUS), WIN_STATUS = WIN_ERR;
#endif #endif
destroy_nhwindow(WIN_MESSAGE), WIN_MESSAGE = WIN_ERR; destroy_nhwindow(WIN_MESSAGE), WIN_MESSAGE = WIN_ERR;
+8 -7
View File
@@ -570,7 +570,7 @@ struct obj *obj; /* only scatter this obj */
struct scatter_chain *schain = (struct scatter_chain *) 0; struct scatter_chain *schain = (struct scatter_chain *) 0;
long total = 0L; long total = 0L;
while ((otmp = individual_object ? obj : level.objects[sx][sy]) != 0) { while ((otmp = (individual_object ? obj : level.objects[sx][sy])) != 0) {
if (otmp->quan > 1L) { if (otmp->quan > 1L) {
qtmp = otmp->quan - 1L; qtmp = otmp->quan - 1L;
if (qtmp > LARGEST_INT) if (qtmp > LARGEST_INT)
@@ -584,8 +584,8 @@ struct obj *obj; /* only scatter this obj */
used_up = FALSE; used_up = FALSE;
/* 9 in 10 chance of fracturing boulders or statues */ /* 9 in 10 chance of fracturing boulders or statues */
if ((scflags & MAY_FRACTURE) if ((scflags & MAY_FRACTURE) != 0
&& ((otmp->otyp == BOULDER) || (otmp->otyp == STATUE)) && (otmp->otyp == BOULDER || otmp->otyp == STATUE)
&& rn2(10)) { && rn2(10)) {
if (otmp->otyp == BOULDER) { if (otmp->otyp == BOULDER) {
if (cansee(sx, sy)) if (cansee(sx, sy))
@@ -614,7 +614,7 @@ struct obj *obj; /* only scatter this obj */
used_up = TRUE; used_up = TRUE;
/* 1 in 10 chance of destruction of obj; glass, egg destruction */ /* 1 in 10 chance of destruction of obj; glass, egg destruction */
} else if ((scflags & MAY_DESTROY) } else if ((scflags & MAY_DESTROY) != 0
&& (!rn2(10) || (objects[otmp->otyp].oc_material == GLASS && (!rn2(10) || (objects[otmp->otyp].oc_material == GLASS
|| otmp->otyp == EGG))) { || otmp->otyp == EGG))) {
if (breaks(otmp, (xchar) sx, (xchar) sy)) if (breaks(otmp, (xchar) sx, (xchar) sy))
@@ -622,8 +622,7 @@ struct obj *obj; /* only scatter this obj */
} }
if (!used_up) { if (!used_up) {
stmp = (struct scatter_chain *) stmp = (struct scatter_chain *) alloc(sizeof *stmp);
alloc(sizeof (struct scatter_chain));
stmp->next = (struct scatter_chain *) 0; stmp->next = (struct scatter_chain *) 0;
stmp->obj = otmp; stmp->obj = otmp;
stmp->ox = sx; stmp->ox = sx;
@@ -679,7 +678,9 @@ struct obj *obj; /* only scatter this obj */
if (bigmonst(youmonst.data)) if (bigmonst(youmonst.data))
hitvalu++; hitvalu++;
hitu = thitu(hitvalu, dmgval(stmp->obj, &youmonst), hitu = thitu(hitvalu, dmgval(stmp->obj, &youmonst),
stmp->obj, (char *) 0); &stmp->obj, (char *) 0);
if (!stmp->obj)
stmp->stopped = TRUE;
if (hitu) { if (hitu) {
stmp->range -= 3; stmp->range -= 3;
stop_occupation(); stop_occupation();
+5
View File
@@ -2540,6 +2540,11 @@ char *origbuf;
} else if (match_varname(buf, "MENUCOLOR", 9)) { } else if (match_varname(buf, "MENUCOLOR", 9)) {
if (!add_menu_coloring(bufp)) if (!add_menu_coloring(bufp))
retval = FALSE; retval = FALSE;
} else if (match_varname(buf, "HILITE_STATUS", 6)) {
#ifdef STATUS_HILITES
if (!parse_status_hl1(bufp, TRUE))
retval = FALSE;
#endif
} else if (match_varname(buf, "WARNINGS", 5)) { } else if (match_varname(buf, "WARNINGS", 5)) {
(void) get_uchars(bufp, translate, FALSE, WARNCOUNT, (void) get_uchars(bufp, translate, FALSE, WARNCOUNT,
"WARNINGS"); "WARNINGS");
+4 -1
View File
@@ -1161,7 +1161,7 @@ trapmove(x, y, desttrap)
int x, y; /* targetted destination, <u.ux+u.dx,u.uy+u.dy> */ int x, y; /* targetted destination, <u.ux+u.dx,u.uy+u.dy> */
struct trap *desttrap; /* nonnull if another trap at <x,y> */ struct trap *desttrap; /* nonnull if another trap at <x,y> */
{ {
boolean anchored; boolean anchored = FALSE;
const char *predicament, *culprit; const char *predicament, *culprit;
char *steedname = !u.usteed ? (char *) 0 : y_monnam(u.usteed); char *steedname = !u.usteed ? (char *) 0 : y_monnam(u.usteed);
@@ -1180,6 +1180,8 @@ struct trap *desttrap; /* nonnull if another trap at <x,y> */
/* [why does diagonal movement give quickest escape?] */ /* [why does diagonal movement give quickest escape?] */
if ((u.dx && u.dy) || !rn2(5)) if ((u.dx && u.dy) || !rn2(5))
u.utrap--; u.utrap--;
if (!u.utrap)
goto wriggle_free;
break; break;
case TT_PIT: case TT_PIT:
if (desttrap && desttrap->tseen if (desttrap && desttrap->tseen
@@ -1271,6 +1273,7 @@ struct trap *desttrap; /* nonnull if another trap at <x,y> */
Norep("You are %s %s.", predicament, culprit); Norep("You are %s %s.", predicament, culprit);
} }
} else { } else {
wriggle_free:
if (u.usteed) if (u.usteed)
pline("%s finally %s free.", upstart(steedname), pline("%s finally %s free.", upstart(steedname),
!anchored ? "lurches" : "wrenches the ball"); !anchored ? "lurches" : "wrenches the ball");
+26
View File
@@ -20,6 +20,7 @@
char * mungspaces (char *) char * mungspaces (char *)
char * trimspaces (char *) char * trimspaces (char *)
char * strip_newline (char *) char * strip_newline (char *)
char * stripchars (char *, const char *, const char *)
char * eos (char *) char * eos (char *)
boolean str_end_is (const char *, const char *) boolean str_end_is (const char *, const char *)
char * strkitten (char *,char) char * strkitten (char *,char)
@@ -433,6 +434,31 @@ char c;
return ccc; return ccc;
} }
/* strip all the chars in stuff_to_strip from orig */
/* caller is responsible for ensuring that bp is a
valid pointer to a BUFSZ buffer */
char *
stripchars(bp, stuff_to_strip, orig)
char *bp;
const char *stuff_to_strip, *orig;
{
int i = 0;
char *s = bp;
if (s) {
while (s && *orig && i < (BUFSZ - 1)) {
if (!index(stuff_to_strip, *orig)) {
*s++ = *orig;
i++;
}
orig++;
}
*s = '\0';
} else
impossible("no output buf in stripchars");
return bp;
}
/* substitute a word or phrase in a string (in place) */ /* substitute a word or phrase in a string (in place) */
/* caller is responsible for ensuring that bp points to big enough buffer */ /* caller is responsible for ensuring that bp points to big enough buffer */
char * char *
+3 -1
View File
@@ -1339,7 +1339,7 @@ int
weight(obj) weight(obj)
register struct obj *obj; register struct obj *obj;
{ {
int wt = objects[obj->otyp].oc_weight; int wt = (int) objects[obj->otyp].oc_weight;
/* glob absorpsion means that merging globs accumulates weight while /* glob absorpsion means that merging globs accumulates weight while
quantity stays 1, so update 'wt' to reflect that, unless owt is 0, quantity stays 1, so update 'wt' to reflect that, unless owt is 0,
@@ -1390,6 +1390,8 @@ register struct obj *obj;
return (int) ((obj->quan + 50L) / 100L); return (int) ((obj->quan + 50L) / 100L);
} else if (obj->otyp == HEAVY_IRON_BALL && obj->owt != 0) { } else if (obj->otyp == HEAVY_IRON_BALL && obj->owt != 0) {
return (int) obj->owt; /* kludge for "very" heavy iron ball */ return (int) obj->owt; /* kludge for "very" heavy iron ball */
} else if (obj->otyp == CANDELABRUM_OF_INVOCATION && obj->spe) {
return wt + obj->spe * (int) objects[TALLOW_CANDLE].oc_weight;
} }
return (wt ? wt * (int) obj->quan : ((int) obj->quan + 1) >> 1); return (wt ? wt * (int) obj->quan : ((int) obj->quan + 1) >> 1);
} }
+27 -18
View File
@@ -29,11 +29,12 @@ extern boolean notonhead; /* for long worms */
/* hero is hit by something other than a monster */ /* hero is hit by something other than a monster */
int int
thitu(tlev, dam, obj, name) thitu(tlev, dam, objp, name)
int tlev, dam; int tlev, dam;
struct obj *obj; struct obj **objp;
const char *name; /* if null, then format `obj' */ const char *name; /* if null, then format `*objp' */
{ {
struct obj *obj = objp ? *objp : 0;
const char *onm, *knm; const char *onm, *knm;
boolean is_acid; boolean is_acid;
int kprefix = KILLED_BY_AN; int kprefix = KILLED_BY_AN;
@@ -42,8 +43,8 @@ const char *name; /* if null, then format `obj' */
if (!name) { if (!name) {
if (!obj) if (!obj)
panic("thitu: name & obj both null?"); panic("thitu: name & obj both null?");
name = name = strcpy(onmbuf,
strcpy(onmbuf, (obj->quan > 1L) ? doname(obj) : mshot_xname(obj)); (obj->quan > 1L) ? doname(obj) : mshot_xname(obj));
knm = strcpy(knmbuf, killer_xname(obj)); knm = strcpy(knmbuf, killer_xname(obj));
kprefix = KILLED_BY; /* killer_name supplies "an" if warranted */ kprefix = KILLED_BY; /* killer_name supplies "an" if warranted */
} else { } else {
@@ -70,14 +71,20 @@ const char *name; /* if null, then format `obj' */
else else
You("are hit by %s%s", onm, exclam(dam)); You("are hit by %s%s", onm, exclam(dam));
if (obj && objects[obj->otyp].oc_material == SILVER && Hate_silver) {
/* extra damage already applied by dmgval() */
pline_The("silver sears your flesh!");
exercise(A_CON, FALSE);
}
if (is_acid && Acid_resistance) { if (is_acid && Acid_resistance) {
pline("It doesn't seem to hurt you."); pline("It doesn't seem to hurt you.");
} else if (obj && obj->oclass == POTION_CLASS) {
/* an explosion which scatters objects might hit hero with one
(potions deliberately thrown at hero are handled by m_throw) */
potionhit(&youmonst, obj, POTHIT_OTHER_THROW);
*objp = obj = 0; /* potionhit() uses up the potion */
} else { } else {
if (obj && objects[obj->otyp].oc_material == SILVER
&& Hate_silver) {
/* extra damage already applied by dmgval() */
pline_The("silver sears your flesh!");
exercise(A_CON, FALSE);
}
if (is_acid) if (is_acid)
pline("It burns!"); pline("It burns!");
losehp(dam, knm, kprefix); /* acid damage */ losehp(dam, knm, kprefix); /* acid damage */
@@ -110,9 +117,9 @@ int x, y;
else else
create = 1; create = 1;
if (create if (create && !((mtmp = m_at(x, y)) != 0 && mtmp->mtrapped
&& !((mtmp = m_at(x, y)) && (mtmp->mtrapped) && (t = t_at(x, y)) && (t = t_at(x, y)) != 0
&& ((t->ttyp == PIT) || (t->ttyp == SPIKED_PIT)))) { && (t->ttyp == PIT || t->ttyp == SPIKED_PIT))) {
int objgone = 0; int objgone = 0;
if (down_gate(x, y) != -1) if (down_gate(x, y) != -1)
@@ -329,7 +336,9 @@ boolean verbose; /* give message(s) even when you can't see what happened */
mtmp->msleeping = 0; mtmp->msleeping = 0;
if (vis) if (vis)
otmp->dknown = 1; otmp->dknown = 1;
potionhit(mtmp, otmp, FALSE); /* probably thrown by a monster rather than 'other', but the
distinction only matters when hitting the hero */
potionhit(mtmp, otmp, POTHIT_OTHER_THROW);
return 1; return 1;
} else { } else {
damage = dmgval(otmp, mtmp); damage = dmgval(otmp, mtmp);
@@ -549,7 +558,7 @@ struct obj *obj; /* missile (or stack providing it) */
if (singleobj->oclass == POTION_CLASS) { if (singleobj->oclass == POTION_CLASS) {
if (!Blind) if (!Blind)
singleobj->dknown = 1; singleobj->dknown = 1;
potionhit(&youmonst, singleobj, FALSE); potionhit(&youmonst, singleobj, POTHIT_MONST_THROW);
break; break;
} }
oldumort = u.umortality; oldumort = u.umortality;
@@ -565,7 +574,7 @@ struct obj *obj; /* missile (or stack providing it) */
/* fall through */ /* fall through */
case CREAM_PIE: case CREAM_PIE:
case BLINDING_VENOM: case BLINDING_VENOM:
hitu = thitu(8, 0, singleobj, (char *) 0); hitu = thitu(8, 0, &singleobj, (char *) 0);
break; break;
default: default:
dam = dmgval(singleobj, &youmonst); dam = dmgval(singleobj, &youmonst);
@@ -585,7 +594,7 @@ struct obj *obj; /* missile (or stack providing it) */
hitv += 8 + singleobj->spe; hitv += 8 + singleobj->spe;
if (dam < 1) if (dam < 1)
dam = 1; dam = 1;
hitu = thitu(hitv, dam, singleobj, (char *) 0); hitu = thitu(hitv, dam, &singleobj, (char *) 0);
} }
if (hitu && singleobj->opoisoned && is_poisonable(singleobj)) { if (hitu && singleobj->opoisoned && is_poisonable(singleobj)) {
char onmbuf[BUFSZ], knmbuf[BUFSZ]; char onmbuf[BUFSZ], knmbuf[BUFSZ];
@@ -888,7 +897,7 @@ struct monst *mtmp;
if (dam < 1) if (dam < 1)
dam = 1; dam = 1;
(void) thitu(hitv, dam, otmp, (char *) 0); (void) thitu(hitv, dam, &otmp, (char *) 0);
stop_occupation(); stop_occupation();
return; return;
} }
+4 -1
View File
@@ -1106,8 +1106,11 @@ unsigned doname_flags;
"corpse" is already in the buffer returned by xname() */ "corpse" is already in the buffer returned by xname() */
unsigned cxarg = (((obj->quan != 1L) ? 0 : CXN_ARTICLE) unsigned cxarg = (((obj->quan != 1L) ? 0 : CXN_ARTICLE)
| CXN_NOCORPSE); | CXN_NOCORPSE);
char *cxstr = corpse_xname(obj, prefix, cxarg);
Sprintf(prefix, "%s ", corpse_xname(obj, prefix, cxarg)); Sprintf(prefix, "%s ", cxstr);
/* avoid having doname(corpse) consume an extra obuf */
releaseobuf(cxstr);
} else if (obj->otyp == EGG) { } else if (obj->otyp == EGG) {
#if 0 /* corpses don't tell if they're stale either */ #if 0 /* corpses don't tell if they're stale either */
if (known && stale_egg(obj)) if (known && stale_egg(obj))
+80 -52
View File
@@ -131,6 +131,9 @@ static struct Bool_Opt {
{ "help", &flags.help, TRUE, SET_IN_GAME }, { "help", &flags.help, TRUE, SET_IN_GAME },
{ "hilite_pet", &iflags.wc_hilite_pet, FALSE, SET_IN_GAME }, /*WC*/ { "hilite_pet", &iflags.wc_hilite_pet, FALSE, SET_IN_GAME }, /*WC*/
{ "hilite_pile", &iflags.hilite_pile, FALSE, SET_IN_GAME }, { "hilite_pile", &iflags.hilite_pile, FALSE, SET_IN_GAME },
#ifdef STATUS_HILITES
{ "hitpointbar", &iflags.wc2_hitpointbar, FALSE, SET_IN_GAME }, /*WC2*/
#endif
#ifndef MAC #ifndef MAC
{ "ignintr", &flags.ignintr, FALSE, SET_IN_GAME }, { "ignintr", &flags.ignintr, FALSE, SET_IN_GAME },
#else #else
@@ -205,11 +208,6 @@ static struct Bool_Opt {
{ "sparkle", &flags.sparkle, TRUE, SET_IN_GAME }, { "sparkle", &flags.sparkle, TRUE, SET_IN_GAME },
{ "splash_screen", &iflags.wc_splash_screen, TRUE, DISP_IN_GAME }, /*WC*/ { "splash_screen", &iflags.wc_splash_screen, TRUE, DISP_IN_GAME }, /*WC*/
{ "standout", &flags.standout, FALSE, SET_IN_GAME }, { "standout", &flags.standout, FALSE, SET_IN_GAME },
#if defined(STATUS_VIA_WINDOWPORT) && defined(STATUS_HILITES)
{ "statushilites", &iflags.use_status_hilites, TRUE, SET_IN_GAME },
#else
{ "statushilites", &iflags.use_status_hilites, FALSE, DISP_IN_GAME },
#endif
{ "status_updates", &iflags.status_updates, TRUE, DISP_IN_GAME }, { "status_updates", &iflags.status_updates, TRUE, DISP_IN_GAME },
{ "tiled_map", &iflags.wc_tiled_map, PREFER_TILED, DISP_IN_GAME }, /*WC*/ { "tiled_map", &iflags.wc_tiled_map, PREFER_TILED, DISP_IN_GAME }, /*WC*/
{ "time", &flags.time, FALSE, SET_IN_GAME }, { "time", &flags.time, FALSE, SET_IN_GAME },
@@ -375,6 +373,13 @@ static struct Comp_Opt {
SET_IN_GAME }, SET_IN_GAME },
#ifdef MSDOS #ifdef MSDOS
{ "soundcard", "type of sound card to use", 20, SET_IN_FILE }, { "soundcard", "type of sound card to use", 20, SET_IN_FILE },
#endif
#ifdef STATUS_HILITES
{ "statushilites",
"0=no status highlighting, N=show highlights for N turns",
20, SET_IN_GAME },
#else
{ "statushilites", "highlight control", 20, SET_IN_FILE },
#endif #endif
{ "symset", "load a set of display symbols from the symbols file", 70, { "symset", "load a set of display symbols from the symbols file", 70,
SET_IN_GAME }, SET_IN_GAME },
@@ -516,10 +521,7 @@ STATIC_DCL int FDECL(feature_alert_opts, (char *, const char *));
STATIC_DCL boolean FDECL(duplicate_opt_detection, (const char *, int)); STATIC_DCL boolean FDECL(duplicate_opt_detection, (const char *, int));
STATIC_DCL void FDECL(complain_about_duplicate, (const char *, int)); STATIC_DCL void FDECL(complain_about_duplicate, (const char *, int));
STATIC_DCL int FDECL(match_str2attr, (const char *));
STATIC_DCL const char *FDECL(attr2attrname, (int)); STATIC_DCL const char *FDECL(attr2attrname, (int));
STATIC_DCL int NDECL(query_color);
STATIC_DCL int FDECL(query_attr, (const char *));
STATIC_DCL const char * FDECL(msgtype2name, (int)); STATIC_DCL const char * FDECL(msgtype2name, (int));
STATIC_DCL int NDECL(query_msgtype); STATIC_DCL int NDECL(query_msgtype);
STATIC_DCL boolean FDECL(msgtype_add, (int, char *)); STATIC_DCL boolean FDECL(msgtype_add, (int, char *));
@@ -1279,9 +1281,9 @@ static const struct {
{ "light magenta", CLR_BRIGHT_MAGENTA }, { "light magenta", CLR_BRIGHT_MAGENTA },
{ "light cyan", CLR_BRIGHT_CYAN }, { "light cyan", CLR_BRIGHT_CYAN },
{ "white", CLR_WHITE }, { "white", CLR_WHITE },
{ "no color", NO_COLOR },
{ NULL, CLR_BLACK }, /* everything after this is an alias */ { NULL, CLR_BLACK }, /* everything after this is an alias */
{ "transparent", NO_COLOR }, { "transparent", NO_COLOR },
{ "nocolor", NO_COLOR },
{ "purple", CLR_MAGENTA }, { "purple", CLR_MAGENTA },
{ "light purple", CLR_BRIGHT_MAGENTA }, { "light purple", CLR_BRIGHT_MAGENTA },
{ "bright purple", CLR_BRIGHT_MAGENTA }, { "bright purple", CLR_BRIGHT_MAGENTA },
@@ -1302,7 +1304,10 @@ static const struct {
{ "dim", ATR_DIM }, { "dim", ATR_DIM },
{ "underline", ATR_ULINE }, { "underline", ATR_ULINE },
{ "blink", ATR_BLINK }, { "blink", ATR_BLINK },
{ "inverse", ATR_INVERSE } { "inverse", ATR_INVERSE },
{ NULL, ATR_NONE }, /* everything after this is an alias */
{ "normal", ATR_NONE },
{ "uline", ATR_ULINE }
}; };
const char * const char *
@@ -1321,7 +1326,7 @@ int
match_str2clr(str) match_str2clr(str)
char *str; char *str;
{ {
int i, c = NO_COLOR; int i, c = CLR_MAX;
/* allow "lightblue", "light blue", and "light-blue" to match "light blue" /* allow "lightblue", "light blue", and "light-blue" to match "light blue"
(also junk like "_l i-gh_t---b l u e" but we won't worry about that); (also junk like "_l i-gh_t---b l u e" but we won't worry about that);
@@ -1353,9 +1358,10 @@ int attr;
return (char *) 0; return (char *) 0;
} }
STATIC_OVL int int
match_str2attr(str) match_str2attr(str, complain)
const char *str; const char *str;
boolean complain;
{ {
int i, a = -1; int i, a = -1;
@@ -1366,14 +1372,15 @@ const char *str;
break; break;
} }
if (a == -1) if (a == -1 && complain)
config_error_add("Unknown text attribute '%s'", str); config_error_add("Unknown text attribute '%s'", str);
return a; return a;
} }
STATIC_OVL int int
query_color() query_color(prompt)
const char *prompt;
{ {
winid tmpwin; winid tmpwin;
anything any; anything any;
@@ -1390,7 +1397,7 @@ query_color()
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, colornames[i].name, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, colornames[i].name,
MENU_UNSELECTED); MENU_UNSELECTED);
} }
end_menu(tmpwin, "Pick a color"); end_menu(tmpwin, (prompt && *prompt) ? prompt : "Pick a color");
pick_cnt = select_menu(tmpwin, PICK_ONE, &picks); pick_cnt = select_menu(tmpwin, PICK_ONE, &picks);
destroy_nhwindow(tmpwin); destroy_nhwindow(tmpwin);
if (pick_cnt > 0) { if (pick_cnt > 0) {
@@ -1401,7 +1408,7 @@ query_color()
return -1; return -1;
} }
STATIC_OVL int int
query_attr(prompt) query_attr(prompt)
const char *prompt; const char *prompt;
{ {
@@ -1420,7 +1427,7 @@ const char *prompt;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, attrnames[i].attr, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, attrnames[i].attr,
attrnames[i].name, MENU_UNSELECTED); attrnames[i].name, MENU_UNSELECTED);
} }
end_menu(tmpwin, prompt ? prompt : "Pick an attribute"); end_menu(tmpwin, (prompt && *prompt) ? prompt : "Pick an attribute");
pick_cnt = select_menu(tmpwin, PICK_ONE, &picks); pick_cnt = select_menu(tmpwin, PICK_ONE, &picks);
destroy_nhwindow(tmpwin); destroy_nhwindow(tmpwin);
if (pick_cnt > 0) { if (pick_cnt > 0) {
@@ -1706,7 +1713,7 @@ char *tmpstr;
if (amp) { if (amp) {
tmps = amp + 1; /* advance past '&' */ tmps = amp + 1; /* advance past '&' */
a = match_str2attr(tmps); a = match_str2attr(tmps, TRUE);
if (a == -1) if (a == -1)
return FALSE; return FALSE;
} }
@@ -3427,7 +3434,7 @@ boolean tinitial, tfrom_file;
} else if (!(opts = string_for_env_opt(fullname, opts, FALSE))) { } else if (!(opts = string_for_env_opt(fullname, opts, FALSE))) {
return FALSE; return FALSE;
} }
tmpattr = match_str2attr(opts); tmpattr = match_str2attr(opts, TRUE);
if (tmpattr == -1) if (tmpattr == -1)
return FALSE; return FALSE;
else else
@@ -3458,23 +3465,39 @@ boolean tinitial, tfrom_file;
return retval; return retval;
} }
} }
#if defined(STATUS_VIA_WINDOWPORT) && defined(STATUS_HILITES) #ifdef STATUS_HILITES
/* hilite fields in status prompt */ /* hilite fields in status prompt */
if (match_optname(opts, "hilite_status", 13, TRUE)) { if (match_optname(opts, "hilite_status", 13, TRUE)) {
if (duplicate) if (duplicate)
complain_about_duplicate(opts, 1); complain_about_duplicate(opts, 1);
op = string_for_opt(opts, TRUE); op = string_for_opt(opts, TRUE);
if (op && negated) { if (op && negated) {
clear_status_hilites(tfrom_file); clear_status_hilites();
return retval; return retval;
} else if (!op) { } else if (!op) {
config_error_add("Value is mandatory for hilite_status"); config_error_add("Value is mandatory for hilite_status");
return FALSE; return FALSE;
} }
if (!set_status_hilites(op, tfrom_file)) /* TODO: error msg? */ if (!parse_status_hl1(op, tfrom_file))
return FALSE; return FALSE;
return retval; return retval;
} }
/* control over whether highlights should be displayed, and for how long */
fullname = "statushilites";
if (match_optname(opts, fullname, 9, TRUE)) {
if (negated) {
iflags.hilite_delta = 0L;
} else {
op = string_for_opt(opts, TRUE);
iflags.hilite_delta = (!op || !*op) ? 3L : atol(op);
if (iflags.hilite_delta < 0L)
iflags.hilite_delta = 1L;
}
if (!tfrom_file)
reset_status_hilites();
return retval;
}
#endif #endif
#if defined(BACKWARD_COMPAT) #if defined(BACKWARD_COMPAT)
@@ -3624,7 +3647,7 @@ boolean tinitial, tfrom_file;
|| boolopt[i].addr == &flags.showscore || boolopt[i].addr == &flags.showscore
#endif #endif
|| boolopt[i].addr == &flags.showexp) { || boolopt[i].addr == &flags.showexp) {
#ifdef STATUS_VIA_WINDOWPORT #ifdef STATUS_HILITES
status_initialize(REASSESS_ONLY); status_initialize(REASSESS_ONLY);
#endif #endif
context.botl = TRUE; context.botl = TRUE;
@@ -3650,6 +3673,9 @@ boolean tinitial, tfrom_file;
|| boolopt[i].addr == &iflags.hilite_pile || boolopt[i].addr == &iflags.hilite_pile
|| boolopt[i].addr == &iflags.hilite_pet) { || boolopt[i].addr == &iflags.hilite_pet) {
need_redraw = TRUE; need_redraw = TRUE;
} else if ((boolopt[i].addr) == &iflags.wc2_hitpointbar) {
status_initialize(REASSESS_ONLY);
need_redraw = TRUE;
#ifdef TEXTCOLOR #ifdef TEXTCOLOR
} else if (boolopt[i].addr == &iflags.use_color) { } else if (boolopt[i].addr == &iflags.use_color) {
need_redraw = TRUE; need_redraw = TRUE;
@@ -3937,6 +3963,12 @@ int nset;
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED); add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED);
} }
int
count_apes()
{
return count_ape_maps((int *) 0, (int *) 0);
}
enum opt_other_enums { enum opt_other_enums {
OPT_OTHER_MSGTYPE = -4, OPT_OTHER_MSGTYPE = -4,
OPT_OTHER_MENUCOLOR = -3, OPT_OTHER_MENUCOLOR = -3,
@@ -3945,19 +3977,18 @@ enum opt_other_enums {
/* these must be < 0 */ /* these must be < 0 */
}; };
/* presently only used when determining longest option name */
static struct other_opts { static struct other_opts {
const char *name; const char *name;
int optflags; int optflags;
enum opt_other_enums code; enum opt_other_enums code;
int NDECL((*othr_count_func));
} othropt[] = { } othropt[] = {
{ "autopickup exceptions", SET_IN_GAME, OPT_OTHER_APEXC }, { "autopickup exceptions", SET_IN_GAME, OPT_OTHER_APEXC, count_apes },
{ "menucolors", SET_IN_GAME, OPT_OTHER_MENUCOLOR }, { "menucolors", SET_IN_GAME, OPT_OTHER_MENUCOLOR, count_menucolors },
{ "message types", SET_IN_GAME, OPT_OTHER_MSGTYPE }, { "message types", SET_IN_GAME, OPT_OTHER_MSGTYPE, msgtype_count },
#ifdef STATUS_VIA_WINDOWPORT
#ifdef STATUS_HILITES #ifdef STATUS_HILITES
{ "status_hilites", SET_IN_GAME, OPT_OTHER_STATHILITE }, { "status hilite rules", SET_IN_GAME, OPT_OTHER_STATHILITE,
#endif count_status_hilites },
#endif #endif
{ (char *) 0, 0, (enum opt_other_enums) 0 }, { (char *) 0, 0, (enum opt_other_enums) 0 },
}; };
@@ -4086,20 +4117,10 @@ doset() /* changing options via menu by Per Liboriussen */
"Other settings:", "Other settings:",
MENU_UNSELECTED); MENU_UNSELECTED);
opts_add_others(tmpwin, "autopickup exceptions", OPT_OTHER_APEXC, for (i = 0; othropt[i].name; i++)
NULL, count_ape_maps((int *) 0, (int *) 0)); opts_add_others(tmpwin, othropt[i].name, othropt[i].code,
opts_add_others(tmpwin, "menucolors", OPT_OTHER_MENUCOLOR, NULL, othropt[i].othr_count_func());
NULL, count_menucolors());
opts_add_others(tmpwin, "message types", OPT_OTHER_MSGTYPE,
NULL, msgtype_count());
#ifdef STATUS_VIA_WINDOWPORT
#ifdef STATUS_HILITES
get_status_hilites(buf2, 60);
if (!*buf2)
Sprintf(buf2, "%s", "(none)");
opts_add_others(tmpwin, "status_hilites", OPT_OTHER_STATHILITE, buf2, 0);
#endif
#endif
#ifdef PREFIXES_IN_USE #ifdef PREFIXES_IN_USE
any = zeroany; any = zeroany;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED);
@@ -4123,16 +4144,14 @@ doset() /* changing options via menu by Per Liboriussen */
if (opt_indx == OPT_OTHER_APEXC) { if (opt_indx == OPT_OTHER_APEXC) {
(void) special_handling("autopickup_exception", setinitial, (void) special_handling("autopickup_exception", setinitial,
fromfile); fromfile);
#ifdef STATUS_VIA_WINDOWPORT
#ifdef STATUS_HILITES #ifdef STATUS_HILITES
} else if (opt_indx == OPT_OTHER_STATHILITE) { } else if (opt_indx == OPT_OTHER_STATHILITE) {
if (!status_hilite_menu()) { if (!status_hilite_menu()) {
pline("Bad status hilite(s) specified."); pline("Bad status hilite(s) specified.");
} else { } else {
if (wc2_supported("status_hilites")) if (wc2_supported("hilite_status"))
preference_update("status_hilites"); preference_update("hilite_status");
} }
#endif
#endif #endif
} else if (opt_indx == OPT_OTHER_MENUCOLOR) { } else if (opt_indx == OPT_OTHER_MENUCOLOR) {
(void) special_handling("menucolors", setinitial, (void) special_handling("menucolors", setinitial,
@@ -4728,7 +4747,7 @@ boolean setinitial, setfromfile;
return TRUE; return TRUE;
if (*mcbuf if (*mcbuf
&& test_regex_pattern(mcbuf, (const char *)0) && test_regex_pattern(mcbuf, (const char *)0)
&& (mcclr = query_color()) != -1 && (mcclr = query_color((char *) 0)) != -1
&& (mcattr = query_attr((char *) 0)) != -1 && (mcattr = query_attr((char *) 0)) != -1
&& !add_menu_coloring_parsed(mcbuf, mcclr, mcattr)) { && !add_menu_coloring_parsed(mcbuf, mcclr, mcattr)) {
pline("Error adding the menu color."); pline("Error adding the menu color.");
@@ -5305,6 +5324,14 @@ char *buf;
#ifdef MSDOS #ifdef MSDOS
} else if (!strcmp(optname, "soundcard")) { } else if (!strcmp(optname, "soundcard")) {
Sprintf(buf, "%s", to_be_done); Sprintf(buf, "%s", to_be_done);
#endif
#ifdef STATUS_HILITES
} else if (!strcmp("statushilites", optname)) {
if (!iflags.hilite_delta)
Strcpy(buf, "0 (off: don't highlight status fields)");
else
Sprintf(buf, "%ld (on: highlight status for %ld turns)",
iflags.hilite_delta, iflags.hilite_delta);
#endif #endif
} else if (!strcmp(optname, "suppress_alert")) { } else if (!strcmp(optname, "suppress_alert")) {
if (flags.suppress_alert == 0L) if (flags.suppress_alert == 0L)
@@ -6010,7 +6037,8 @@ struct wc_Opt wc2_options[] = { { "fullscreen", WC2_FULLSCREEN },
{ "softkeyboard", WC2_SOFTKEYBOARD }, { "softkeyboard", WC2_SOFTKEYBOARD },
{ "wraptext", WC2_WRAPTEXT }, { "wraptext", WC2_WRAPTEXT },
{ "use_darkgray", WC2_DARKGRAY }, { "use_darkgray", WC2_DARKGRAY },
#ifdef STATUS_VIA_WINDOWPORT #ifdef STATUS_HILITES
{ "hitpointbar", WC2_HITPOINTBAR },
{ "hilite_status", WC2_HILITE_STATUS }, { "hilite_status", WC2_HILITE_STATUS },
#endif #endif
{ (char *) 0, 0L } }; { (char *) 0, 0L } };
+3 -1
View File
@@ -107,9 +107,11 @@ set_uasmon()
youmonst.movement = new_speed * youmonst.movement / old_speed; youmonst.movement = new_speed * youmonst.movement / old_speed;
} }
#ifdef STATUS_VIA_WINDOWPORT #ifdef STATUS_HILITES
status_initialize(REASSESS_ONLY); status_initialize(REASSESS_ONLY);
#endif #endif
polysense();
} }
/* Levitation overrides Flying; set or clear BFlying|I_SPECIAL */ /* Levitation overrides Flying; set or clear BFlying|I_SPECIAL */
+11 -6
View File
@@ -1243,24 +1243,28 @@ const char *objphrase; /* "Your widget glows" or "Steed's saddle glows" */
return res; return res;
} }
/* potion obj hits monster mon, which might be youmonst; obj always use up */
void void
potionhit(mon, obj, your_fault) potionhit(mon, obj, how)
register struct monst *mon; struct monst *mon;
register struct obj *obj; struct obj *obj;
boolean your_fault; int how;
{ {
const char *botlnam = bottlename(); const char *botlnam = bottlename();
boolean isyou = (mon == &youmonst); boolean isyou = (mon == &youmonst);
int distance, tx, ty; int distance, tx, ty;
struct obj *saddle = (struct obj *) 0; struct obj *saddle = (struct obj *) 0;
boolean hit_saddle = FALSE; boolean hit_saddle = FALSE, your_fault = (how <= POTHIT_HERO_THROW);
if (isyou) { if (isyou) {
tx = u.ux, ty = u.uy; tx = u.ux, ty = u.uy;
distance = 0; distance = 0;
pline_The("%s crashes on your %s and breaks into shards.", botlnam, pline_The("%s crashes on your %s and breaks into shards.", botlnam,
body_part(HEAD)); body_part(HEAD));
losehp(Maybe_Half_Phys(rnd(2)), "thrown potion", KILLED_BY_AN); losehp(Maybe_Half_Phys(rnd(2)),
(how == POTHIT_OTHER_THROW) ? "propelled potion" /* scatter */
: "thrown potion",
KILLED_BY_AN);
} else { } else {
tx = mon->mx, ty = mon->my; tx = mon->mx, ty = mon->my;
/* sometimes it hits the saddle */ /* sometimes it hits the saddle */
@@ -1314,6 +1318,7 @@ boolean your_fault;
case POT_ACID: case POT_ACID:
if (!Acid_resistance) { if (!Acid_resistance) {
int dmg; int dmg;
pline("This burns%s!", pline("This burns%s!",
obj->blessed ? " a little" obj->blessed ? " a little"
: obj->cursed ? " a lot" : ""); : obj->cursed ? " a lot" : "");
+1 -1
View File
@@ -1413,7 +1413,7 @@ freedynamicdata()
/* free_pickinv_cache(); -- now done from really_done()... */ /* free_pickinv_cache(); -- now done from really_done()... */
free_symsets(); free_symsets();
#endif /* FREE_ALL_MEMORY */ #endif /* FREE_ALL_MEMORY */
#ifdef STATUS_VIA_WINDOWPORT #ifdef STATUS_HILITES
status_finish(); status_finish();
#endif #endif
#ifdef DUMPLOG #ifdef DUMPLOG
+21 -9
View File
@@ -203,7 +203,7 @@ vomiting_dialogue()
countdown, and it was still possible to move around between countdown, and it was still possible to move around between
that message and "You can move again." (from vomit()'s that message and "You can move again." (from vomit()'s
nomul(-2)) with no intervening message; give one here to nomul(-2)) with no intervening message; give one here to
have a more specific at which hero became unable to move have more specific point at which hero became unable to move
[vomit() issues its own message for the cantvomit() case] */ [vomit() issues its own message for the cantvomit() case] */
You("%s!", !Hallucination ? "vomit" : "hurl chunks"); You("%s!", !Hallucination ? "vomit" : "hurl chunks");
} }
@@ -966,7 +966,7 @@ anything *arg;
long timeout; long timeout;
{ {
struct obj *obj = arg->a_obj; struct obj *obj = arg->a_obj;
boolean canseeit, many, menorah, need_newsym; boolean canseeit, many, menorah, need_newsym, need_invupdate;
xchar x, y; xchar x, y;
char whose[BUFSZ]; char whose[BUFSZ];
@@ -983,6 +983,7 @@ long timeout;
if (menorah) { if (menorah) {
obj->spe = 0; /* no more candles */ obj->spe = 0; /* no more candles */
obj->owt = weight(obj);
} else if (Is_candle(obj) || obj->otyp == POT_OIL) { } else if (Is_candle(obj) || obj->otyp == POT_OIL) {
/* get rid of candles and burning oil potions; /* get rid of candles and burning oil potions;
we know this object isn't carried by hero, we know this object isn't carried by hero,
@@ -1007,7 +1008,7 @@ long timeout;
} else { } else {
canseeit = FALSE; canseeit = FALSE;
} }
need_newsym = FALSE; need_newsym = need_invupdate = FALSE;
/* obj->age is the age remaining at this point. */ /* obj->age is the age remaining at this point. */
switch (obj->otyp) { switch (obj->otyp) {
@@ -1016,6 +1017,8 @@ long timeout;
if (canseeit) { if (canseeit) {
switch (obj->where) { switch (obj->where) {
case OBJ_INVENT: case OBJ_INVENT:
need_invupdate = TRUE;
/*FALLTHRU*/
case OBJ_MINVENT: case OBJ_MINVENT:
pline("%spotion of oil has burnt away.", whose); pline("%spotion of oil has burnt away.", whose);
break; break;
@@ -1077,6 +1080,8 @@ long timeout;
if (canseeit || obj->where == OBJ_INVENT) { if (canseeit || obj->where == OBJ_INVENT) {
switch (obj->where) { switch (obj->where) {
case OBJ_INVENT: case OBJ_INVENT:
need_invupdate = TRUE;
/*FALLTHRU*/
case OBJ_MINVENT: case OBJ_MINVENT:
if (obj->otyp == BRASS_LANTERN) if (obj->otyp == BRASS_LANTERN)
pline("%slantern has run out of power.", whose); pline("%slantern has run out of power.", whose);
@@ -1154,6 +1159,8 @@ long timeout;
if (menorah) { if (menorah) {
switch (obj->where) { switch (obj->where) {
case OBJ_INVENT: case OBJ_INVENT:
need_invupdate = TRUE;
/*FALLTHRU*/
case OBJ_MINVENT: case OBJ_MINVENT:
pline("%scandelabrum's flame%s.", whose, pline("%scandelabrum's flame%s.", whose,
many ? "s die" : " dies"); many ? "s die" : " dies");
@@ -1166,15 +1173,18 @@ long timeout;
} else { } else {
switch (obj->where) { switch (obj->where) {
case OBJ_INVENT: case OBJ_INVENT:
/* no need_invupdate for update_inventory() necessary;
useupall() -> freeinv() handles it */
/*FALLTHRU*/
case OBJ_MINVENT: case OBJ_MINVENT:
pline("%s %s consumed!", Yname2(obj), pline("%s %s consumed!", Yname2(obj),
many ? "are" : "is"); many ? "are" : "is");
break; break;
case OBJ_FLOOR: case OBJ_FLOOR:
/* /*
You see some wax candles consumed! You see some wax candles consumed!
You see a wax candle consumed! You see a wax candle consumed!
*/ */
You_see("%s%s consumed!", many ? "some " : "", You_see("%s%s consumed!", many ? "some " : "",
many ? xname(obj) : an(xname(obj))); many ? xname(obj) : an(xname(obj)));
need_newsym = TRUE; need_newsym = TRUE;
@@ -1192,6 +1202,7 @@ long timeout;
if (menorah) { if (menorah) {
obj->spe = 0; obj->spe = 0;
obj->owt = weight(obj);
} else { } else {
if (carried(obj)) { if (carried(obj)) {
useupall(obj); useupall(obj);
@@ -1205,7 +1216,7 @@ long timeout;
} }
obj = (struct obj *) 0; obj = (struct obj *) 0;
} }
break; break; /* case [age ==] 0 */
default: default:
/* /*
@@ -1218,8 +1229,7 @@ long timeout;
if (obj && obj->age) if (obj && obj->age)
begin_burn(obj, TRUE); begin_burn(obj, TRUE);
break; /* case [otyp ==] candelabrum|tallow_candle|wax_candle */
break;
default: default:
impossible("burn_object: unexpeced obj %s", xname(obj)); impossible("burn_object: unexpeced obj %s", xname(obj));
@@ -1227,6 +1237,8 @@ long timeout;
} }
if (need_newsym) if (need_newsym)
newsym(x, y); newsym(x, y);
if (need_invupdate)
update_inventory();
} }
/* /*
+14 -11
View File
@@ -844,7 +844,7 @@ register struct trap *trap;
unsigned trflags; unsigned trflags;
{ {
register int ttype = trap->ttyp; register int ttype = trap->ttyp;
register struct obj *otmp; struct obj *otmp;
boolean already_seen = trap->tseen, boolean already_seen = trap->tseen,
forcetrap = (trflags & FORCETRAP) != 0, forcetrap = (trflags & FORCETRAP) != 0,
webmsgok = (trflags & NOWEBMSG) == 0, webmsgok = (trflags & NOWEBMSG) == 0,
@@ -915,8 +915,9 @@ unsigned trflags;
otmp->opoisoned = 0; otmp->opoisoned = 0;
if (u.usteed && !rn2(2) && steedintrap(trap, otmp)) { /* nothing */ if (u.usteed && !rn2(2) && steedintrap(trap, otmp)) { /* nothing */
; ;
} else if (thitu(8, dmgval(otmp, &youmonst), otmp, "arrow")) { } else if (thitu(8, dmgval(otmp, &youmonst), &otmp, "arrow")) {
obfree(otmp, (struct obj *) 0); if (otmp)
obfree(otmp, (struct obj *) 0);
} else { } else {
place_object(otmp, u.ux, u.uy); place_object(otmp, u.ux, u.uy);
if (!Blind) if (!Blind)
@@ -944,13 +945,15 @@ unsigned trflags;
oldumort = u.umortality; oldumort = u.umortality;
if (u.usteed && !rn2(2) && steedintrap(trap, otmp)) { /* nothing */ if (u.usteed && !rn2(2) && steedintrap(trap, otmp)) { /* nothing */
; ;
} else if (thitu(7, dmgval(otmp, &youmonst), otmp, "little dart")) { } else if (thitu(7, dmgval(otmp, &youmonst), &otmp, "little dart")) {
if (otmp->opoisoned) if (otmp) {
poisoned("dart", A_CON, "little dart", if (otmp->opoisoned)
/* if damage triggered life-saving, poisoned("dart", A_CON, "little dart",
poison is limited to attrib loss */ /* if damage triggered life-saving,
(u.umortality > oldumort) ? 0 : 10, TRUE); poison is limited to attrib loss */
obfree(otmp, (struct obj *) 0); (u.umortality > oldumort) ? 0 : 10, TRUE);
obfree(otmp, (struct obj *) 0);
}
} else { } else {
place_object(otmp, u.ux, u.uy); place_object(otmp, u.ux, u.uy);
if (!Blind) if (!Blind)
@@ -1802,7 +1805,7 @@ int style;
if (multi) if (multi)
nomul(0); nomul(0);
if (thitu(9 + singleobj->spe, dmgval(singleobj, &youmonst), if (thitu(9 + singleobj->spe, dmgval(singleobj, &youmonst),
singleobj, (char *) 0)) &singleobj, (char *) 0))
stop_occupation(); stop_occupation();
} }
if (style == ROLL) { if (style == ROLL) {
+28 -17
View File
@@ -5,11 +5,12 @@
#include "hack.h" #include "hack.h"
STATIC_DCL boolean FDECL(known_hitum, (struct monst *, struct obj *, int *, STATIC_DCL boolean FDECL(known_hitum, (struct monst *, struct obj *, int *,
int, int, struct attack *)); int, int, struct attack *, int));
STATIC_DCL boolean FDECL(theft_petrifies, (struct obj *)); STATIC_DCL boolean FDECL(theft_petrifies, (struct obj *));
STATIC_DCL void FDECL(steal_it, (struct monst *, struct attack *)); STATIC_DCL void FDECL(steal_it, (struct monst *, struct attack *));
STATIC_DCL boolean FDECL(hitum, (struct monst *, struct attack *)); STATIC_DCL boolean FDECL(hitum, (struct monst *, struct attack *));
STATIC_DCL boolean FDECL(hmon_hitmon, (struct monst *, struct obj *, int)); STATIC_DCL boolean FDECL(hmon_hitmon, (struct monst *, struct obj *, int,
int));
STATIC_DCL int FDECL(joust, (struct monst *, struct obj *)); STATIC_DCL int FDECL(joust, (struct monst *, struct obj *));
STATIC_DCL void NDECL(demonpet); STATIC_DCL void NDECL(demonpet);
STATIC_DCL boolean FDECL(m_slips_free, (struct monst * mtmp, STATIC_DCL boolean FDECL(m_slips_free, (struct monst * mtmp,
@@ -23,8 +24,7 @@ STATIC_DCL void FDECL(nohandglow, (struct monst *));
STATIC_DCL boolean FDECL(shade_aware, (struct obj *)); STATIC_DCL boolean FDECL(shade_aware, (struct obj *));
extern boolean notonhead; /* for long worms */ extern boolean notonhead; /* for long worms */
/* The below might become a parameter instead if we use it a lot */
static int dieroll;
/* Used to flag attacks caused by Stormbringer's maliciousness. */ /* Used to flag attacks caused by Stormbringer's maliciousness. */
static boolean override_confirmation = FALSE; static boolean override_confirmation = FALSE;
@@ -434,12 +434,13 @@ atk_done:
/* really hit target monster; returns TRUE if it still lives */ /* really hit target monster; returns TRUE if it still lives */
STATIC_OVL boolean STATIC_OVL boolean
known_hitum(mon, weapon, mhit, rollneeded, armorpenalty, uattk) known_hitum(mon, weapon, mhit, rollneeded, armorpenalty, uattk, dieroll)
register struct monst *mon; register struct monst *mon;
struct obj *weapon; struct obj *weapon;
int *mhit; int *mhit;
int rollneeded, armorpenalty; /* for monks */ int rollneeded, armorpenalty; /* for monks */
struct attack *uattk; struct attack *uattk;
int dieroll;
{ {
register boolean malive = TRUE; register boolean malive = TRUE;
@@ -463,7 +464,7 @@ struct attack *uattk;
/* we hit the monster; be careful: it might die or /* we hit the monster; be careful: it might die or
be knocked into a different location */ be knocked into a different location */
notonhead = (mon->mx != x || mon->my != y); notonhead = (mon->mx != x || mon->my != y);
malive = hmon(mon, weapon, HMON_MELEE); malive = hmon(mon, weapon, HMON_MELEE, dieroll);
if (malive) { if (malive) {
/* monster still alive */ /* monster still alive */
if (!rn2(25) && mon->mhp < mon->mhpmax / 2 if (!rn2(25) && mon->mhp < mon->mhpmax / 2
@@ -499,19 +500,22 @@ struct attack *uattk;
int armorpenalty, attknum = 0, x = u.ux + u.dx, y = u.uy + u.dy, int armorpenalty, attknum = 0, x = u.ux + u.dx, y = u.uy + u.dy,
tmp = find_roll_to_hit(mon, uattk->aatyp, uwep, tmp = find_roll_to_hit(mon, uattk->aatyp, uwep,
&attknum, &armorpenalty); &attknum, &armorpenalty);
int mhit = (tmp > (dieroll = rnd(20)) || u.uswallow); int dieroll = rnd(20);
int mhit = (tmp > dieroll || u.uswallow);
if (tmp > dieroll) if (tmp > dieroll)
exercise(A_DEX, TRUE); exercise(A_DEX, TRUE);
malive = known_hitum(mon, uwep, &mhit, tmp, armorpenalty, uattk); malive = known_hitum(mon, uwep, &mhit, tmp, armorpenalty, uattk, dieroll);
/* second attack for two-weapon combat; won't occur if Stormbringer /* second attack for two-weapon combat; won't occur if Stormbringer
overrode confirmation (assumes Stormbringer is primary weapon) overrode confirmation (assumes Stormbringer is primary weapon)
or if the monster was killed or knocked to different location */ or if the monster was killed or knocked to different location */
if (u.twoweap && !override_confirmation && malive && m_at(x, y) == mon) { if (u.twoweap && !override_confirmation && malive && m_at(x, y) == mon) {
tmp = find_roll_to_hit(mon, uattk->aatyp, uswapwep, &attknum, tmp = find_roll_to_hit(mon, uattk->aatyp, uswapwep, &attknum,
&armorpenalty); &armorpenalty);
mhit = (tmp > (dieroll = rnd(20)) || u.uswallow); dieroll = rnd(20);
malive = known_hitum(mon, uswapwep, &mhit, tmp, armorpenalty, uattk); mhit = (tmp > dieroll || u.uswallow);
malive = known_hitum(mon, uswapwep, &mhit, tmp, armorpenalty, uattk,
dieroll);
} }
if (wepbefore && !uwep) if (wepbefore && !uwep)
wep_was_destroyed = TRUE; wep_was_destroyed = TRUE;
@@ -521,16 +525,17 @@ struct attack *uattk;
/* general "damage monster" routine; return True if mon still alive */ /* general "damage monster" routine; return True if mon still alive */
boolean boolean
hmon(mon, obj, thrown) hmon(mon, obj, thrown, dieroll)
struct monst *mon; struct monst *mon;
struct obj *obj; struct obj *obj;
int thrown; /* HMON_xxx (0 => hand-to-hand, other => ranged) */ int thrown; /* HMON_xxx (0 => hand-to-hand, other => ranged) */
int dieroll;
{ {
boolean result, anger_guards; boolean result, anger_guards;
anger_guards = (mon->mpeaceful anger_guards = (mon->mpeaceful
&& (mon->ispriest || mon->isshk || is_watch(mon->data))); && (mon->ispriest || mon->isshk || is_watch(mon->data)));
result = hmon_hitmon(mon, obj, thrown); result = hmon_hitmon(mon, obj, thrown, dieroll);
if (mon->ispriest && !rn2(2)) if (mon->ispriest && !rn2(2))
ghod_hitsu(mon); ghod_hitsu(mon);
if (anger_guards) if (anger_guards)
@@ -540,10 +545,11 @@ int thrown; /* HMON_xxx (0 => hand-to-hand, other => ranged) */
/* guts of hmon() */ /* guts of hmon() */
STATIC_OVL boolean STATIC_OVL boolean
hmon_hitmon(mon, obj, thrown) hmon_hitmon(mon, obj, thrown, dieroll)
struct monst *mon; struct monst *mon;
struct obj *obj; struct obj *obj;
int thrown; /* HMON_xxx (0 => hand-to-hand, other => ranged) */ int thrown; /* HMON_xxx (0 => hand-to-hand, other => ranged) */
int dieroll;
{ {
int tmp; int tmp;
struct permonst *mdat = mon->data; struct permonst *mdat = mon->data;
@@ -731,7 +737,8 @@ int thrown; /* HMON_xxx (0 => hand-to-hand, other => ranged) */
else else
setuwep((struct obj *) 0); setuwep((struct obj *) 0);
freeinv(obj); freeinv(obj);
potionhit(mon, obj, TRUE); potionhit(mon, obj,
hand_to_hand ? POTHIT_HERO_BASH : POTHIT_HERO_THROW);
if (mon->mhp <= 0) if (mon->mhp <= 0)
return FALSE; /* killed */ return FALSE; /* killed */
hittxt = TRUE; hittxt = TRUE;
@@ -2114,6 +2121,7 @@ register struct monst *mon;
struct obj *weapon; struct obj *weapon;
boolean altwep = FALSE, weapon_used = FALSE; boolean altwep = FALSE, weapon_used = FALSE;
int i, tmp, armorpenalty, sum[NATTK], nsum = 0, dhit = 0, attknum = 0; int i, tmp, armorpenalty, sum[NATTK], nsum = 0, dhit = 0, attknum = 0;
int dieroll;
for (i = 0; i < NATTK; i++) { for (i = 0; i < NATTK; i++) {
sum[i] = 0; sum[i] = 0;
@@ -2137,9 +2145,11 @@ register struct monst *mon;
altwep = !altwep; /* toggle for next attack */ altwep = !altwep; /* toggle for next attack */
tmp = find_roll_to_hit(mon, AT_WEAP, weapon, &attknum, tmp = find_roll_to_hit(mon, AT_WEAP, weapon, &attknum,
&armorpenalty); &armorpenalty);
dhit = (tmp > (dieroll = rnd(20)) || u.uswallow); dieroll = rnd(20);
dhit = (tmp > dieroll || u.uswallow);
/* Enemy dead, before any special abilities used */ /* Enemy dead, before any special abilities used */
if (!known_hitum(mon, weapon, &dhit, tmp, armorpenalty, mattk)) { if (!known_hitum(mon, weapon, &dhit, tmp, armorpenalty, mattk,
dieroll)) {
sum[i] = 2; sum[i] = 2;
break; break;
} else } else
@@ -2168,7 +2178,8 @@ register struct monst *mon;
case AT_TENT: case AT_TENT:
tmp = find_roll_to_hit(mon, mattk->aatyp, (struct obj *) 0, tmp = find_roll_to_hit(mon, mattk->aatyp, (struct obj *) 0,
&attknum, &armorpenalty); &attknum, &armorpenalty);
dhit = (tmp > (dieroll = rnd(20)) || u.uswallow); dieroll = rnd(20);
dhit = (tmp > dieroll || u.uswallow);
if (dhit) { if (dhit) {
int compat; int compat;
+16 -29
View File
@@ -474,9 +474,7 @@ 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 */
#ifdef STATUS_VIA_WINDOWPORT 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));
#endif
static int NDECL(hup_int_ndecl); static int NDECL(hup_int_ndecl);
static void NDECL(hup_void_ndecl); static void NDECL(hup_void_ndecl);
@@ -526,14 +524,9 @@ static struct window_procs hup_procs = {
hup_void_ndecl, /* end_screen */ hup_void_ndecl, /* end_screen */
hup_outrip, genl_preference_update, genl_getmsghistory, hup_outrip, genl_preference_update, genl_getmsghistory,
genl_putmsghistory, genl_putmsghistory,
#ifdef STATUS_VIA_WINDOWPORT
hup_void_ndecl, /* status_init */ hup_void_ndecl, /* status_init */
hup_void_ndecl, /* status_finish */ hup_void_ndecl, /* status_finish */
genl_status_enablefield, hup_status_update, genl_status_enablefield, hup_status_update,
#ifdef STATUS_HILITES
genl_status_threshold,
#endif
#endif /* STATUS_VIA_WINDOWPORT */
genl_can_suspend_no, genl_can_suspend_no,
}; };
@@ -762,17 +755,17 @@ hup_get_color_string(VOID_ARGS)
} }
#endif /* CHANGE_COLOR */ #endif /* CHANGE_COLOR */
#ifdef STATUS_VIA_WINDOWPORT
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
hup_status_update(idx, ptr, chg, percent) hup_status_update(idx, ptr, chg, pc, color, colormasks)
int idx UNUSED; int idx UNUSED;
genericptr_t ptr UNUSED; genericptr_t ptr UNUSED;
int chg UNUSED, percent UNUSED; int chg UNUSED, pc UNUSED, color UNUSED;
unsigned long *colormasks UNUSED;
{ {
return; return;
} }
#endif /* STATUS_VIA_WINDOWPORT */
/* /*
* Non-specific stubs. * Non-specific stubs.
@@ -816,7 +809,6 @@ const char *string UNUSED;
#endif /* HANGUPHANDLING */ #endif /* HANGUPHANDLING */
#ifdef STATUS_VIA_WINDOWPORT
/****************************************************************************/ /****************************************************************************/
/* genl backward compat stuff */ /* genl backward compat stuff */
@@ -871,10 +863,11 @@ boolean enable;
/* call once for each field, then call with BL_FLUSH to output the result */ /* call once for each field, then call with BL_FLUSH to output the result */
void void
genl_status_update(idx, ptr, chg, percent) genl_status_update(idx, ptr, chg, percent, color, colormasks)
int idx; int idx;
genericptr_t ptr; genericptr_t ptr;
int chg UNUSED, percent UNUSED; int chg UNUSED, percent UNUSED, color UNUSED;
unsigned long *colormasks UNUSED;
{ {
char newbot1[MAXCO], newbot2[MAXCO]; char newbot1[MAXCO], newbot2[MAXCO];
long cond, *condptr = (long *) ptr; long cond, *condptr = (long *) ptr;
@@ -912,12 +905,17 @@ int chg UNUSED, percent UNUSED;
BL_LEVELDESC, BL_GOLD, BL_XP, BL_EXP, BL_HD, BL_TIME, BL_FLUSH }, BL_LEVELDESC, BL_GOLD, BL_XP, BL_EXP, BL_HD, BL_TIME, BL_FLUSH },
}; };
/* in case interface is using genl_status_update() but has not
specified WC2_FLUSH_STATUS (status_update() for field values
is buffered so final BL_FLUSH is needed to produce output) */
windowprocs.wincap2 |= WC2_FLUSH_STATUS;
if (idx != BL_FLUSH) { if (idx != BL_FLUSH) {
if (!status_activefields[idx]) if (!status_activefields[idx])
return; return;
switch (idx) { switch (idx) {
case BL_CONDITION: case BL_CONDITION:
cond = *condptr; cond = condptr ? *condptr : 0L;
nb = status_vals[idx]; nb = status_vals[idx];
*nb = '\0'; *nb = '\0';
if (cond & BL_MASK_STONE) if (cond & BL_MASK_STONE)
@@ -949,7 +947,8 @@ int chg UNUSED, percent UNUSED;
break; break;
default: default:
Sprintf(status_vals[idx], Sprintf(status_vals[idx],
status_fieldfmt[idx] ? status_fieldfmt[idx] : "%s", text); status_fieldfmt[idx] ? status_fieldfmt[idx] : "%s",
text ? text : "");
break; break;
} }
return; /* processed one field other than BL_FLUSH */ return; /* processed one field other than BL_FLUSH */
@@ -1035,18 +1034,6 @@ int chg UNUSED, percent UNUSED;
putmixed(WIN_STATUS, 0, newbot2); /* putmixed() due to GOLD glyph */ putmixed(WIN_STATUS, 0, newbot2); /* putmixed() due to GOLD glyph */
} }
#ifdef STATUS_HILITES
void
genl_status_threshold(fldidx, thresholdtype, threshold, behavior, under, over)
int fldidx UNUSED, thresholdtype UNUSED;
anything threshold UNUSED;
int behavior UNUSED, under UNUSED, over UNUSED;
{
return;
}
#endif /* STATUS_HILITES */
#endif /* STATUS_VIA_WINDOWPORT */
STATIC_VAR struct window_procs dumplog_windowprocs_backup; STATIC_VAR struct window_procs dumplog_windowprocs_backup;
STATIC_VAR FILE *dumplog_file; STATIC_VAR FILE *dumplog_file;
+1 -1
View File
@@ -3429,7 +3429,7 @@ int dx, dy;
if (bhitpos.x == u.ux && bhitpos.y == u.uy) { /* ct == 9 */ if (bhitpos.x == u.ux && bhitpos.y == u.uy) { /* ct == 9 */
if (Fumbling || rn2(20) >= ACURR(A_DEX)) { if (Fumbling || rn2(20) >= ACURR(A_DEX)) {
/* we hit ourselves */ /* we hit ourselves */
(void) thitu(10 + obj->spe, dmgval(obj, &youmonst), obj, (void) thitu(10 + obj->spe, dmgval(obj, &youmonst), &obj,
"boomerang"); "boomerang");
endmultishot(TRUE); endmultishot(TRUE);
break; break;
-10
View File
@@ -51,13 +51,8 @@ struct window_procs amii_procs = {
/* other defs that really should go away (they're tty specific) */ /* other defs that really should go away (they're tty specific) */
amii_delay_output, amii_delay_output, amii_outrip, genl_preference_update, amii_delay_output, amii_delay_output, amii_outrip, genl_preference_update,
genl_getmsghistory, genl_putmsghistory, genl_getmsghistory, genl_putmsghistory,
#ifdef STATUS_VIA_WINDOWPORT
genl_status_init, genl_status_finish, genl_status_enablefield, genl_status_init, genl_status_finish, genl_status_enablefield,
genl_status_update, genl_status_update,
#ifdef STATUS_HILITES
genl_status_threshold,
#endif
#endif
genl_can_suspend_yes, genl_can_suspend_yes,
}; };
@@ -88,13 +83,8 @@ struct window_procs amiv_procs = {
/* other defs that really should go away (they're tty specific) */ /* other defs that really should go away (they're tty specific) */
amii_delay_output, amii_delay_output, amii_outrip, genl_preference_update, amii_delay_output, amii_delay_output, amii_outrip, genl_preference_update,
genl_getmsghistory, genl_putmsghistory, genl_getmsghistory, genl_putmsghistory,
#ifdef STATUS_VIA_WINDOWPORT
genl_status_init, genl_status_finish, genl_status_enablefield, genl_status_init, genl_status_finish, genl_status_enablefield,
genl_status_update, genl_status_update,
#ifdef STATUS_HILITES
genl_status_threshold,
#endif
#endif
genl_can_suspend_yes, genl_can_suspend_yes,
}; };
-5
View File
@@ -73,13 +73,8 @@ struct window_procs mswin_procs = {
/* other defs that really should go away (they're tty specific) */ /* other defs that really should go away (they're tty specific) */
mswin_start_screen, mswin_end_screen, mswin_outrip, mswin_start_screen, mswin_end_screen, mswin_outrip,
mswin_preference_update, genl_getmsghistory, genl_putmsghistory, mswin_preference_update, genl_getmsghistory, genl_putmsghistory,
#ifdef STATUS_VIA_WINDOWPORT
genl_status_init, genl_status_finish, genl_status_enablefield, genl_status_init, genl_status_finish, genl_status_enablefield,
genl_status_update, genl_status_update,
#ifdef STATUS_HILITES
genl_status_threshold,
#endif
#endif
genl_can_suspend_no, genl_can_suspend_no,
}; };
+42 -3
View File
@@ -66,9 +66,6 @@ MENUCOLOR=" cursed .* (being worn)" = orange&underline
# Turn off all status hilites.
#OPTIONS=!statushilites
#
# General options. You might also set "silent" so as not to attract # General options. You might also set "silent" so as not to attract
# the boss's attention. # the boss's attention.
# #
@@ -185,3 +182,45 @@ OPTIONS=vary_msgcount:1
#OPTIONS=palette:bright cyan-0-255-255 #OPTIONS=palette:bright cyan-0-255-255
#OPTIONS=palette:white-255-255-255 #OPTIONS=palette:white-255-255-255
# Status hilites
OPTIONS=statushilites
# HP
OPTIONS=hitpointbar
OPTIONS=hilite_status:hitpoints/100%/gray&normal
OPTIONS=hilite_status:hitpoints/<100%/green&normal
OPTIONS=hilite_status:hitpoints/<66%/yellow&normal
OPTIONS=hilite_status:hitpoints/<50%/orange&normal
OPTIONS=hilite_status:hitpoints/<33%/red&bold
OPTIONS=hilite_status:hitpoints/<15%/red&inverse
## Pw
OPTIONS=hilite_status:power/100%/gray&normal
OPTIONS=hilite_status:power/<100%/green&normal
OPTIONS=hilite_status:power/<66%/yellow&normal
OPTIONS=hilite_status:power/<50%/orange&normal
OPTIONS=hilite_status:power/<33%/red&bold
## Carry
OPTIONS=hilite_status:cap/burdened/yellow/stressed/orange/strained/red&bold/overtaxed/red&inverse/overloaded/red&inverse&blink
## Hunger
OPTIONS=hilite_status:hunger/satiated/yellow/hungry/orange/weak/red&bold/fainting/red&inverse/fainted/red&inverse&blink
## Mental
OPTIONS=hilite_status:condition/hallu/yellow
OPTIONS=hilite_status:condition/conf/orange
OPTIONS=hilite_status:condition/stun/red&bold
## Health
OPTIONS=hilite_status:condition/termill/red&inverse
OPTIONS=hilite_status:condition/foodpois/red&inverse
OPTIONS=hilite_status:condition/slime/red&inverse
# gold
OPTIONS=hilite_status:gold/up/yellow/down/brown
# St, Dx, Co, In, Wi, Ch
OPTIONS=hilite_status:characteristics/up/green/down/red
+15 -5
View File
@@ -42,9 +42,7 @@ void FDECL(cmov, (int, int));
void FDECL(nocmov, (int, int)); void FDECL(nocmov, (int, int));
int FDECL(process_keystroke, int FDECL(process_keystroke,
(INPUT_RECORD *, boolean *, BOOLEAN_P numberpad, int portdebug)); (INPUT_RECORD *, boolean *, BOOLEAN_P numberpad, int portdebug));
#ifdef TEXTCOLOR
static void NDECL(init_ttycolor); static void NDECL(init_ttycolor);
#endif
static void NDECL(really_move_cursor); static void NDECL(really_move_cursor);
/* Win32 Console handles for input and output */ /* Win32 Console handles for input and output */
@@ -111,8 +109,10 @@ static DWORD ccount, acount;
#ifndef CLR_MAX #ifndef CLR_MAX
#define CLR_MAX 16 #define CLR_MAX 16
#endif #endif
int ttycolors[CLR_MAX]; int ttycolors[CLR_MAX];
int ttycolors_inv[CLR_MAX]; int ttycolors_inv[CLR_MAX];
#define MAX_OVERRIDES 256 #define MAX_OVERRIDES 256
unsigned char key_overrides[MAX_OVERRIDES]; unsigned char key_overrides[MAX_OVERRIDES];
static char nullstr[] = ""; static char nullstr[] = "";
@@ -158,7 +158,7 @@ gettty()
init_ttycolor(); init_ttycolor();
#else #else
for (k = 0; k < CLR_MAX; ++k) for (k = 0; k < CLR_MAX; ++k)
ttycolors[k] = 7; ttycolors[k] = NO_COLOR;
#endif #endif
} }
@@ -692,6 +692,7 @@ tty_delay_output()
static void static void
init_ttycolor() init_ttycolor()
{ {
#ifdef TEXTCOLOR
ttycolors[CLR_BLACK] = FOREGROUND_INTENSITY; /* fix by Quietust */ ttycolors[CLR_BLACK] = FOREGROUND_INTENSITY; /* fix by Quietust */
ttycolors[CLR_RED] = FOREGROUND_RED; ttycolors[CLR_RED] = FOREGROUND_RED;
ttycolors[CLR_GREEN] = FOREGROUND_GREEN; ttycolors[CLR_GREEN] = FOREGROUND_GREEN;
@@ -728,6 +729,15 @@ init_ttycolor()
ttycolors_inv[CLR_BRIGHT_CYAN] = BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY; ttycolors_inv[CLR_BRIGHT_CYAN] = BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY;
ttycolors_inv[CLR_WHITE] = BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_RED ttycolors_inv[CLR_WHITE] = BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_RED
| BACKGROUND_INTENSITY; | BACKGROUND_INTENSITY;
#else
int k;
ttycolors[0] = FOREGROUND_INTENSITY;
ttycolors_inv[0] = BACKGROUND_INTENSITY;
for (k = 1; k < SIZE(ttycolors); ++k) {
ttycolors[k] = FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED;
ttycolors_inv[k] = BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_RED;
}
#endif
init_ttycolor_completed = TRUE; init_ttycolor_completed = TRUE;
} }
#endif /* TEXTCOLOR */ #endif /* TEXTCOLOR */
@@ -739,7 +749,7 @@ has_color(int color)
if ((color >= 0) && (color < CLR_MAX)) if ((color >= 0) && (color < CLR_MAX))
return 1; return 1;
#else #else
if ((color == CLR_BLACK) || (color == CLR_WHITE)) if ((color == CLR_BLACK) || (color == CLR_WHITE) || (color == NO_COLOR))
return 1; return 1;
#endif #endif
else else
@@ -794,7 +804,7 @@ term_start_color(int color)
console.current_nhcolor = color; console.current_nhcolor = color;
} else } else
#endif #endif
console.current_nhcolor = color; console.current_nhcolor = NO_COLOR;
} }
void void
+4 -7
View File
@@ -1515,14 +1515,11 @@ static const char *build_opts[] = {
#ifdef SHELL #ifdef SHELL
"shell command", "shell command",
#endif #endif
#ifdef STATUS_VIA_WINDOWPORT
# ifdef STATUS_HILITES
"status via windowport with highlighting",
# else
"status via windowport without highlighting",
# endif
#else
"traditional status display", "traditional status display",
#ifdef STATUS_HILITES
"status via windowport with highlighting",
#else
"status via windowport without highlighting",
#endif #endif
#ifdef SUSPEND #ifdef SUSPEND
"suspend command", "suspend command",
+1 -5
View File
@@ -5286,15 +5286,11 @@ struct window_procs Qt_procs = {
genl_preference_update, genl_preference_update,
genl_getmsghistory, genl_getmsghistory,
genl_putmsghistory, genl_putmsghistory,
#ifdef STATUS_VIA_WINDOWPORT
genl_status_init, genl_status_init,
genl_status_finish, genl_status_finish,
genl_status_enablefield, genl_status_enablefield,
genl_status_update, genl_status_update,
# ifdef STATUS_HILITES genl_can_suspend_yes,
genl_status_threshold,
# endif
#endif
}; };
extern "C" void play_usersound(const char* filename, int volume) extern "C" void play_usersound(const char* filename, int volume)
-5
View File
@@ -125,13 +125,8 @@ struct window_procs X11_procs = {
genl_outrip, genl_outrip,
#endif #endif
X11_preference_update, genl_getmsghistory, genl_putmsghistory, X11_preference_update, genl_getmsghistory, genl_putmsghistory,
#ifdef STATUS_VIA_WINDOWPORT
genl_status_init, genl_status_finish, genl_status_enablefield, genl_status_init, genl_status_finish, genl_status_enablefield,
genl_status_update, genl_status_update,
#ifdef STATUS_HILITES
genl_status_threshold,
#endif
#endif
genl_can_suspend_no, /* XXX may not always be correct */ genl_can_suspend_no, /* XXX may not always be correct */
}; };
+4 -24
View File
@@ -462,7 +462,6 @@ boolean is_restoring;
(*cibase->nprocs->win_putmsghistory)(cibase->ndata, msg, is_restoring); (*cibase->nprocs->win_putmsghistory)(cibase->ndata, msg, is_restoring);
} }
#ifdef STATUS_VIA_WINDOWPORT
void void
chainin_status_init() chainin_status_init()
{ {
@@ -487,29 +486,15 @@ boolean enable;
} }
void void
chainin_status_update(idx, ptr, chg, percent) chainin_status_update(idx, ptr, chg, percent, color, colormasks)
int idx, chg, percent; int idx, chg, percent, color;
genericptr_t ptr; genericptr_t ptr;
unsigned long *colormasks;
{ {
(*cibase->nprocs->win_status_update)(cibase->ndata, idx, ptr, chg, (*cibase->nprocs->win_status_update)(cibase->ndata, idx, ptr, chg,
percent); percent, color, colormasks);
} }
#ifdef STATUS_HILITES
void
chainin_status_threshold(fldidx, thresholdtype, threshold, behavior, under,
over)
int fldidx, thresholdtype;
int behavior, under, over;
anything threshold;
{
(*cibase->nprocs->win_status_threshold)(cibase->ndata, fldidx,
thresholdtype, threshold,
behavior, under, over);
}
#endif
#endif
boolean boolean
chainin_can_suspend() chainin_can_suspend()
{ {
@@ -561,12 +546,7 @@ struct window_procs chainin_procs = {
chainin_outrip, chainin_preference_update, chainin_getmsghistory, chainin_outrip, chainin_preference_update, chainin_getmsghistory,
chainin_putmsghistory, chainin_putmsghistory,
#ifdef STATUS_VIA_WINDOWPORT
chainin_status_init, chainin_status_finish, chainin_status_enablefield, chainin_status_init, chainin_status_finish, chainin_status_enablefield,
chainin_status_update, chainin_status_update,
#ifdef STATUS_HILITES
chainin_status_threshold,
#endif
#endif
chainin_can_suspend, chainin_can_suspend,
}; };
+3 -25
View File
@@ -586,7 +586,6 @@ boolean is_restoring;
(*tdp->nprocs->win_putmsghistory)(msg, is_restoring); (*tdp->nprocs->win_putmsghistory)(msg, is_restoring);
} }
#ifdef STATUS_VIA_WINDOWPORT
void void
chainout_status_init(vp) chainout_status_init(vp)
void *vp; void *vp;
@@ -619,33 +618,17 @@ boolean enable;
} }
void void
chainout_status_update(vp, idx, ptr, chg, percent) chainout_status_update(vp, idx, ptr, chg, percent, color, colormasks)
void *vp; void *vp;
int idx, chg, percent; int idx, chg, percent;
genericptr_t ptr; genericptr_t ptr;
unsigned long *colormasks;
{ {
struct chainout_data *tdp = vp; struct chainout_data *tdp = vp;
(*tdp->nprocs->win_status_update)(idx, ptr, chg, percent); (*tdp->nprocs->win_status_update)(idx, ptr, chg, percent, color, colormasks);
} }
#ifdef STATUS_HILITES
void
chainout_status_threshold(vp, fldidx, thresholdtype, threshold, behavior,
under, over)
void *vp;
int fldidx, thresholdtype;
int behavior, under, over;
anything threshold;
{
struct chainout_data *tdp = vp;
(*tdp->nprocs->win_status_threshold)(fldidx, thresholdtype, threshold,
behavior, under, over);
}
#endif
#endif
boolean boolean
chainout_can_suspend(vp) chainout_can_suspend(vp)
void *vp; void *vp;
@@ -700,12 +683,7 @@ struct chain_procs chainout_procs = {
chainout_outrip, chainout_preference_update, chainout_getmsghistory, chainout_outrip, chainout_preference_update, chainout_getmsghistory,
chainout_putmsghistory, chainout_putmsghistory,
#ifdef STATUS_VIA_WINDOWPORT
chainout_status_init, chainout_status_finish, chainout_status_enablefield, chainout_status_init, chainout_status_finish, chainout_status_enablefield,
chainout_status_update, chainout_status_update,
#ifdef STATUS_HILITES
chainout_status_threshold,
#endif
#endif
chainout_can_suspend, chainout_can_suspend,
}; };
+3 -31
View File
@@ -1027,7 +1027,6 @@ boolean is_restoring;
POST; POST;
} }
#ifdef STATUS_VIA_WINDOWPORT
void void
trace_status_init(vp) trace_status_init(vp)
void *vp; void *vp;
@@ -1084,10 +1083,11 @@ boolean enable;
} }
void void
trace_status_update(vp, idx, ptr, chg, percent) trace_status_update(vp, idx, ptr, chg, color, colormasks)
void *vp; void *vp;
int idx, chg, percent; int idx, chg, percent;
genericptr_t ptr; genericptr_t ptr;
unsigned long *colormasks;
{ {
struct trace_data *tdp = vp; struct trace_data *tdp = vp;
@@ -1095,33 +1095,10 @@ genericptr_t ptr;
ptr, chg, percent); ptr, chg, percent);
PRE; PRE;
(*tdp->nprocs->win_status_update)(tdp->ndata, idx, ptr, chg, percent); (*tdp->nprocs->win_status_update)(tdp->ndata, idx, ptr, chg, color colormasks);
POST; POST;
} }
#ifdef STATUS_HILITES
void
trace_status_threshold(vp, fldidx, thresholdtype, threshold, behavior, under,
over)
void *vp;
int fldidx, thresholdtype;
int behavior, under, over;
anything threshold;
{
struct trace_data *tdp = vp;
/* XXX how do we print an anything? We don't. */
fprintf(wc_tracelogf, "%sstatus_threshold(%d, %d, -, %d, %d, %d)\n",
INDENT, fldidx, thresholdtype, behavior, under, over);
PRE;
(*tdp->nprocs->win_status_threshold)(tdp->ndata, fldidx, thresholdtype,
threshold, behavior, under, over);
POST;
}
#endif
#endif
boolean boolean
trace_can_suspend(vp) trace_can_suspend(vp)
void *vp; void *vp;
@@ -1179,12 +1156,7 @@ struct chain_procs trace_procs = {
trace_outrip, trace_preference_update, trace_getmsghistory, trace_outrip, trace_preference_update, trace_getmsghistory,
trace_putmsghistory, trace_putmsghistory,
#ifdef STATUS_VIA_WINDOWPORT
trace_status_init, trace_status_finish, trace_status_enablefield, trace_status_init, trace_status_finish, trace_status_enablefield,
trace_status_update, trace_status_update,
#ifdef STATUS_HILITES
trace_status_threshold,
#endif
#endif
trace_can_suspend, trace_can_suspend,
}; };
-5
View File
@@ -70,13 +70,8 @@ struct window_procs Gem_procs = {
/* other defs that really should go away (they're tty specific) */ /* other defs that really should go away (they're tty specific) */
Gem_start_screen, Gem_end_screen, Gem_outrip, Gem_preference_update, Gem_start_screen, Gem_end_screen, Gem_outrip, Gem_preference_update,
genl_getmsghistory, genl_putmsghistory genl_getmsghistory, genl_putmsghistory
#ifdef STATUS_VIA_WINDOWPORT
genl_status_init, genl_status_init,
genl_status_finish, genl_status_enablefield, genl_status_update, genl_status_finish, genl_status_enablefield, genl_status_update,
#ifdef STATUS_HILITES
genl_status_threshold,
#endif
#endif
genl_can_suspend_no, genl_can_suspend_no,
}; };
-5
View File
@@ -48,13 +48,8 @@ struct window_procs Gnome_procs = {
/* other defs that really should go away (they're tty specific) */ /* other defs that really should go away (they're tty specific) */
gnome_start_screen, gnome_end_screen, gnome_outrip, gnome_start_screen, gnome_end_screen, gnome_outrip,
genl_preference_update, genl_getmsghistory, genl_putmsghistory, genl_preference_update, genl_getmsghistory, genl_putmsghistory,
#ifdef STATUS_VIA_WINDOWPORT
genl_status_init, genl_status_finish, genl_status_enablefield, genl_status_init, genl_status_finish, genl_status_enablefield,
genl_status_update, genl_status_update,
#ifdef STATUS_HILITES
genl_status_threshold,
#endif
#endif
genl_can_suspend_yes, genl_can_suspend_yes,
}; };
+307 -264
View File
@@ -62,6 +62,9 @@ struct window_procs tty_procs = {
WC_COLOR | WC_HILITE_PET | WC_INVERSE | WC_EIGHT_BIT_IN, WC_COLOR | WC_HILITE_PET | WC_INVERSE | WC_EIGHT_BIT_IN,
#if defined(SELECTSAVED) #if defined(SELECTSAVED)
WC2_SELECTSAVED | WC2_SELECTSAVED |
#endif
#if defined(STATUS_HILITES)
WC2_HITPOINTBAR | WC2_FLUSH_STATUS |
#endif #endif
WC2_DARKGRAY, WC2_DARKGRAY,
tty_init_nhwindows, tty_player_selection, tty_askname, tty_get_nh_event, tty_init_nhwindows, tty_player_selection, tty_askname, tty_get_nh_event,
@@ -96,13 +99,12 @@ struct window_procs tty_procs = {
genl_preference_update, genl_preference_update,
#endif #endif
tty_getmsghistory, tty_putmsghistory, tty_getmsghistory, tty_putmsghistory,
#ifdef STATUS_VIA_WINDOWPORT
tty_status_init, tty_status_init,
genl_status_finish, genl_status_enablefield, genl_status_finish, genl_status_enablefield,
tty_status_update,
#ifdef STATUS_HILITES #ifdef STATUS_HILITES
tty_status_threshold, tty_status_update,
#endif #else
genl_status_update,
#endif #endif
genl_can_suspend_yes, genl_can_suspend_yes,
}; };
@@ -1293,9 +1295,7 @@ const char *str;
} }
} }
WIN_MAP = WIN_MESSAGE = WIN_INVEN = WIN_ERR; /* these are all gone now */ WIN_MAP = WIN_MESSAGE = WIN_INVEN = WIN_ERR; /* these are all gone now */
#ifndef STATUS_VIA_WINDOWPORT
WIN_STATUS = WIN_ERR; WIN_STATUS = WIN_ERR;
#endif
#ifdef FREE_ALL_MEMORY #ifdef FREE_ALL_MEMORY
if (BASE_WINDOW != WIN_ERR && wins[BASE_WINDOW]) { if (BASE_WINDOW != WIN_ERR && wins[BASE_WINDOW]) {
free_window_info(wins[BASE_WINDOW], TRUE); free_window_info(wins[BASE_WINDOW], TRUE);
@@ -2520,14 +2520,32 @@ const char *str;
nb = str; nb = str;
for (i = cw->curx + 1, n0 = cw->cols; i < n0; i++, nb++) { for (i = cw->curx + 1, n0 = cw->cols; i < n0; i++, nb++) {
if (!*nb) { if (!*nb) {
#ifndef STATUS_HILITES
if (*ob || context.botlx) { if (*ob || context.botlx) {
#else
/* STATUS_HILITES will call cl_end() when finished
* its sequence of putstr's. We don't want to call
* cl_end() with each putstr() which may cause flashing
* in the Windows port
*/
if (context.botlx) {
#endif
/* last char printed may be in middle of line */ /* last char printed may be in middle of line */
tty_curs(WIN_STATUS, i, cw->cury); tty_curs(WIN_STATUS, i, cw->cury);
cl_end(); cl_end();
} }
break; break;
} }
#ifdef STATUS_HILITES
/* Don't optimize the putsym away, in case it happens
to be the same character but different color/attr.
We don't optimize on iflags.use_status_hilites either,
in case old chars were written with highlighting and
that option has just now been toggled off. [We could
do better by tracking color/attr more closely.] */
#else
if (*ob != *nb) if (*ob != *nb)
#endif
tty_putsym(WIN_STATUS, i, cw->cury, *nb); tty_putsym(WIN_STATUS, i, cw->cury, *nb);
if (*ob) if (*ob)
ob++; ob++;
@@ -2535,13 +2553,9 @@ const char *str;
(void) strncpy(&cw->data[cw->cury][j], str, cw->cols - j - 1); (void) strncpy(&cw->data[cw->cury][j], str, cw->cols - j - 1);
cw->data[cw->cury][cw->cols - 1] = '\0'; /* null terminate */ cw->data[cw->cury][cw->cols - 1] = '\0'; /* null terminate */
#ifdef STATUS_VIA_WINDOWPORT #ifndef STATUS_HILITES
if (!iflags.use_status_hilites) { cw->cury = (cw->cury + 1) % 2;
#endif cw->curx = 0;
cw->cury = (cw->cury + 1) % 2;
cw->curx = 0;
#ifdef STATUS_VIA_WINDOWPORT
}
#endif #endif
break; break;
case NHW_MAP: case NHW_MAP:
@@ -3402,40 +3416,26 @@ char *posbar;
} }
#endif #endif
#ifdef STATUS_VIA_WINDOWPORT
/* /*
* The following data structures come from the genl_ routines in * The following data structures come from the genl_ routines in
* src/windows.c and as such are considered to be on the window-port * src/windows.c and as such are considered to be on the window-port
* "side" of things, rather than the NetHack-core "side" of things. * "side" of things, rather than the NetHack-core "side" of things.
*/ */
extern const char *status_fieldnm[MAXBLSTATS];
extern const char *status_fieldfmt[MAXBLSTATS]; extern const char *status_fieldfmt[MAXBLSTATS];
extern char *status_vals[MAXBLSTATS]; extern char *status_vals[MAXBLSTATS];
extern boolean status_activefields[MAXBLSTATS]; extern boolean status_activefields[MAXBLSTATS];
extern winid WIN_STATUS; extern winid WIN_STATUS;
#ifdef STATUS_HILITES #ifdef STATUS_HILITES
typedef struct hilite_data_struct { static long tty_condition_bits;
int thresholdtype;
anything threshold;
int behavior;
int under;
int over;
} hilite_data_t;
static hilite_data_t tty_status_hilites[MAXBLSTATS];
static int tty_status_colors[MAXBLSTATS]; static int tty_status_colors[MAXBLSTATS];
int hpbar_percent, hpbar_color;
#endif /* STATUS_HILITES */
struct color_option { static int FDECL(condcolor, (long, unsigned long *));
int color; static int FDECL(condattr, (long, unsigned long *));
int attr_bits;
};
static void FDECL(start_color_option, (struct color_option));
static void FDECL(end_color_option, (struct color_option));
static void FDECL(apply_color_option, (struct color_option, const char *));
static void FDECL(add_colored_text, (const char *, char *));
#endif
void void
tty_status_init() tty_status_init()
@@ -3445,15 +3445,11 @@ tty_status_init()
/* let genl_status_init do most of the initialization */ /* let genl_status_init do most of the initialization */
genl_status_init(); genl_status_init();
for (i = 0; i < MAXBLSTATS; ++i) {
#ifdef STATUS_HILITES #ifdef STATUS_HILITES
for (i = 0; i < MAXBLSTATS; ++i) {
tty_status_colors[i] = NO_COLOR; /* no color */ tty_status_colors[i] = NO_COLOR; /* no color */
tty_status_hilites[i].thresholdtype = 0;
tty_status_hilites[i].behavior = BL_TH_NONE;
tty_status_hilites[i].under = BL_HILITE_NONE;
tty_status_hilites[i].over = BL_HILITE_NONE;
#endif /* STATUS_HILITES */
} }
#endif /* STATUS_HILITES */
} }
/* /*
@@ -3490,22 +3486,102 @@ tty_status_init()
* symbol for GOLD "\GXXXXNNNN:nnn". If the window port needs to use * symbol for GOLD "\GXXXXNNNN:nnn". If the window port needs to use
* the textual gold amount without the leading "$:" the port will * the textual gold amount without the leading "$:" the port will
* have to skip past ':' in the passed "ptr" for the BL_GOLD case. * have to skip past ':' in the passed "ptr" for the BL_GOLD case.
* -- color is an unsigned int.
* color_index = color & 0x00FF; CLR_* value
* attribute = color & 0xFF00 >> 8; BL_* values
* This holds the color and attribute that the field should
* be displayed in.
* This is relevant for everything except BL_CONDITION fldindex.
* If fldindex is BL_CONDITION, this parameter should be ignored,
* as condition hilighting is done via the next colormasks
* parameter instead.
*
* -- colormasks - pointer to cond_hilites[] array of colormasks.
* Only relevant for BL_CONDITION fldindex. The window port
* should ignore this parameter for other fldindex values.
* Each condition bit must only ever appear in one of the
* CLR_ array members, but can appear in multiple HL_ATTCLR_
* offsets (because more than one attribute can co-exist).
* See doc/window.doc for more details.
*/ */
/* new approach through status_update() only */
#define Begin_Attr(m) \
if (m) { \
if ((m) & HL_BOLD) \
term_start_attr(ATR_BOLD); \
if ((m) & HL_INVERSE) \
term_start_attr(ATR_INVERSE); \
if ((m) & HL_ULINE) \
term_start_attr(ATR_ULINE); \
if ((m) & HL_BLINK) \
term_start_attr(ATR_BLINK); \
if ((m) & HL_DIM) \
term_start_attr(ATR_DIM); \
}
#define End_Attr(m) \
if (m) { \
if ((m) & HL_DIM) \
term_end_attr(ATR_DIM); \
if ((m) & HL_BLINK) \
term_end_attr(ATR_BLINK); \
if ((m) & HL_ULINE) \
term_end_attr(ATR_ULINE); \
if ((m) & HL_INVERSE) \
term_end_attr(ATR_INVERSE); \
if ((m) & HL_BOLD) \
term_end_attr(ATR_BOLD); \
}
#ifdef STATUS_HILITES
#ifdef TEXTCOLOR
#define MaybeDisplayCond(bm,txt) \
if (tty_condition_bits & (bm)) { \
putstr(WIN_STATUS, 0, " "); \
if (iflags.hilite_delta) { \
attrmask = condattr(bm, colormasks); \
Begin_Attr(attrmask); \
if ((coloridx = condcolor(bm, colormasks)) != NO_COLOR) \
term_start_color(coloridx); \
} \
putstr(WIN_STATUS, 0, txt); \
if (iflags.hilite_delta) { \
if (coloridx != NO_COLOR) \
term_end_color(); \
End_Attr(attrmask); \
} \
}
#else
#define MaybeDisplayCond(bm,txt) \
if (tty_condition_bits & (bm)) { \
putstr(WIN_STATUS, 0, " "); \
if (iflags.hilite_delta) { \
attrmask = condattr(bm, colormasks); \
Begin_Attr(attrmask); \
} \
putstr(WIN_STATUS, 0, txt); \
if (iflags.hilite_delta) { \
End_Attr(attrmask); \
} \
}
#endif
void void
tty_status_update(fldidx, ptr, chg, percent) tty_status_update(fldidx, ptr, chg, percent, color, colormasks)
int fldidx, chg, percent; int fldidx, chg UNUSED, percent UNUSED, color;
genericptr_t ptr; genericptr_t ptr;
unsigned long *colormasks;
{ {
long cond, *condptr = (long *) ptr; long *condptr = (long *) ptr;
register int i; int i, attrmask = 0;
#ifdef TEXTCOLOR
int coloridx = NO_COLOR;
#endif
char *text = (char *) ptr; char *text = (char *) ptr;
/* Mapping BL attributes to tty attributes static boolean oncearound = FALSE; /* prevent premature partial status display */
* BL_HILITE_NONE -1 + 3 = 2 (statusattr[2])
* BL_HILITE_INVERSE -2 + 3 = 1 (statusattr[1])
* BL_HILITE_BOLD -3 + 3 = 0 (statusattr[0])
*/
long value = -1L;
static boolean beenhere = FALSE;
enum statusfields fieldorder[2][15] = { enum statusfields fieldorder[2][15] = {
{ BL_TITLE, BL_STR, BL_DX, BL_CO, BL_IN, BL_WI, BL_CH, BL_ALIGN, { 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_SCORE, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH,
@@ -3514,269 +3590,236 @@ genericptr_t ptr;
BL_AC, BL_XP, BL_EXP, BL_HD, BL_TIME, BL_HUNGER, BL_AC, BL_XP, BL_EXP, BL_HD, BL_TIME, BL_HUNGER,
BL_CAP, BL_CONDITION, BL_FLUSH } BL_CAP, BL_CONDITION, BL_FLUSH }
}; };
#ifdef STATUS_HILITES
static int statusattr[] = { ATR_BOLD, ATR_INVERSE, ATR_NONE };
int attridx = 0; int attridx = 0;
#else
nhUse(chg);
nhUse(percent);
#endif
if (fldidx != BL_FLUSH) { if (fldidx != BL_FLUSH) {
if (!status_activefields[fldidx]) if (!status_activefields[fldidx])
return; return;
switch (fldidx) { switch (fldidx) {
case BL_CONDITION: case BL_CONDITION:
cond = *condptr; tty_condition_bits = *condptr;
*status_vals[fldidx] = '\0'; oncearound = TRUE;
if (cond & BL_MASK_STONE)
Strcat(status_vals[fldidx], " Stone");
if (cond & BL_MASK_SLIME)
Strcat(status_vals[fldidx], " Slime");
if (cond & BL_MASK_STRNGL)
Strcat(status_vals[fldidx], " Strngl");
if (cond & BL_MASK_FOODPOIS)
Strcat(status_vals[fldidx], " FoodPois");
if (cond & BL_MASK_TERMILL)
Strcat(status_vals[fldidx], " TermIll");
if (cond & BL_MASK_BLIND)
Strcat(status_vals[fldidx], " Blind");
if (cond & BL_MASK_DEAF)
Strcat(status_vals[fldidx], " Deaf");
if (cond & BL_MASK_STUN)
Strcat(status_vals[fldidx], " Stun");
if (cond & BL_MASK_CONF)
Strcat(status_vals[fldidx], " Conf");
if (cond & BL_MASK_HALLU)
Strcat(status_vals[fldidx], " Hallu");
if (cond & BL_MASK_LEV)
Strcat(status_vals[fldidx], " Lev");
if (cond & BL_MASK_FLY)
Strcat(status_vals[fldidx], " Fly");
if (cond & BL_MASK_RIDE)
Strcat(status_vals[fldidx], " Ride");
value = cond;
break; break;
default: default:
value = atol(text);
Sprintf(status_vals[fldidx], Sprintf(status_vals[fldidx],
(fldidx == BL_TITLE && iflags.wc2_hitpointbar) ? "%-30s" :
status_fieldfmt[fldidx] ? status_fieldfmt[fldidx] : "%s", status_fieldfmt[fldidx] ? status_fieldfmt[fldidx] : "%s",
text); text);
break; #ifdef TEXTCOLOR
} tty_status_colors[fldidx] = color;
#else
#ifdef STATUS_HILITES
switch (tty_status_hilites[fldidx].behavior) {
case BL_TH_NONE:
tty_status_colors[fldidx] = NO_COLOR; tty_status_colors[fldidx] = NO_COLOR;
break; #endif
case BL_TH_UPDOWN: if (iflags.wc2_hitpointbar && fldidx == BL_HP) {
if (chg > 0) hpbar_percent = percent;
tty_status_colors[fldidx] = tty_status_hilites[fldidx].over; #ifdef TEXTCOLOR
else if (chg < 0) hpbar_color = color;
tty_status_colors[fldidx] = tty_status_hilites[fldidx].under; #else
else hpbar_color = NO_COLOR;
tty_status_colors[fldidx] = NO_COLOR; #endif
break;
case BL_TH_VAL_PERCENTAGE: {
int pct_th = 0;
if (tty_status_hilites[fldidx].thresholdtype != ANY_INT) {
impossible(
"tty_status_update: unsupported percentage threshold type %d",
tty_status_hilites[fldidx].thresholdtype);
} else {
pct_th = tty_status_hilites[fldidx].threshold.a_int;
tty_status_colors[fldidx] = (percent >= pct_th)
? tty_status_hilites[fldidx].over
: tty_status_hilites[fldidx].under;
} }
break; break;
} }
case BL_TH_VAL_ABSOLUTE: {
int c = NO_COLOR;
int o = tty_status_hilites[fldidx].over;
int u = tty_status_hilites[fldidx].under;
anything *t = &tty_status_hilites[fldidx].threshold;
switch (tty_status_hilites[fldidx].thresholdtype) {
case ANY_LONG:
c = (value >= t->a_long) ? o : u;
break;
case ANY_INT:
c = (value >= t->a_int) ? o : u;
break;
case ANY_UINT:
c = ((unsigned long) value >= t->a_uint) ? o : u;
break;
case ANY_ULONG:
c = ((unsigned long) value >= t->a_ulong) ? o : u;
break;
case ANY_MASK32:
c = (value & t->a_ulong) ? o : u;
break;
default:
impossible(
"tty_status_update: unsupported absolute threshold type %d\n",
tty_status_hilites[fldidx].thresholdtype);
break;
}
tty_status_colors[fldidx] = c;
break;
} /* case */
} /* switch */
#endif /* STATUS_HILITES */
} }
/* For now, this version copied from the genl_ version currently if (!oncearound) return;
* updates everything on the display, everytime
*/
if (!beenhere || !iflags.use_status_hilites) {
char newbot1[MAXCO], newbot2[MAXCO];
newbot1[0] = '\0';
for (i = 0; fieldorder[0][i] >= 0; ++i) {
int idx1 = fieldorder[0][i];
if (status_activefields[idx1])
Strcat(newbot1, status_vals[idx1]);
}
newbot2[0] = '\0';
for (i = 0; fieldorder[1][i] >= 0; ++i) {
int idx2 = fieldorder[1][i];
if (status_activefields[idx2])
Strcat(newbot2, status_vals[idx2]);
}
curs(WIN_STATUS, 1, 0);
putstr(WIN_STATUS, 0, newbot1);
curs(WIN_STATUS, 1, 1);
putmixed(WIN_STATUS, 0, newbot2); /* putmixed() due to GOLD glyph */
beenhere = TRUE;
return;
}
curs(WIN_STATUS, 1, 0); curs(WIN_STATUS, 1, 0);
for (i = 0; fieldorder[0][i] != BL_FLUSH; ++i) { for (i = 0; fieldorder[0][i] != BL_FLUSH; ++i) {
int fldidx1 = fieldorder[0][i]; int fldidx1 = fieldorder[0][i];
if (status_activefields[fldidx1]) { if (status_activefields[fldidx1]) {
#ifdef STATUS_HILITES if (fldidx1 != BL_TITLE || !iflags.wc2_hitpointbar) {
if (tty_status_colors[fldidx1] < 0
&& tty_status_colors[fldidx1] >= -3) {
/* attribute, not a color */
attridx = tty_status_colors[fldidx1] + 3;
term_start_attr(statusattr[attridx]);
putstr(WIN_STATUS, 0, status_vals[fldidx1]);
term_end_attr(statusattr[attridx]);
} else
#ifdef TEXTCOLOR #ifdef TEXTCOLOR
if (tty_status_colors[fldidx1] != CLR_MAX) { coloridx = tty_status_colors[fldidx1] & 0x00FF;
if (tty_status_colors[fldidx1] != NO_COLOR)
term_start_color(tty_status_colors[fldidx1]);
putstr(WIN_STATUS, 0, status_vals[fldidx1]);
if (tty_status_colors[fldidx1] != NO_COLOR)
term_end_color();
} else
#endif #endif
#endif /* STATUS_HILITES */ attridx = (tty_status_colors[fldidx1] & 0xFF00) >> 8;
putstr(WIN_STATUS, 0, status_vals[fldidx1]); text = status_vals[fldidx1];
if (iflags.hilite_delta) {
if (*text == ' ') {
putstr(WIN_STATUS, 0, " ");
text++;
}
/* multiple attributes can be in effect concurrently */
Begin_Attr(attridx);
#ifdef TEXTCOLOR
if (coloridx != NO_COLOR && coloridx != CLR_MAX)
term_start_color(coloridx);
#endif
}
putstr(WIN_STATUS, 0, text);
if (iflags.hilite_delta) {
#ifdef TEXTCOLOR
if (coloridx != NO_COLOR)
term_end_color();
#endif
End_Attr(attridx);
}
} else {
/* hitpointbar using hp percent calculation */
int bar_pos, bar_len;
char *bar2 = (char *)0;
char bar[MAXCO], savedch;
boolean twoparts = FALSE;
text = status_vals[fldidx1];
bar_len = strlen(text);
if (bar_len < MAXCO-1) {
Strcpy(bar, text);
bar_pos = (bar_len * hpbar_percent) / 100;
if (bar_pos < 1 && hpbar_percent > 0)
bar_pos = 1;
if (bar_pos >= bar_len && hpbar_percent < 100)
bar_pos = bar_len - 1;
if (bar_pos > 0 && bar_pos < bar_len) {
twoparts = TRUE;
bar2 = &bar[bar_pos];
savedch = *bar2;
*bar2 = '\0';
}
}
if (iflags.hilite_delta && iflags.wc2_hitpointbar) {
putstr(WIN_STATUS, 0, "[");
#ifdef TEXTCOLOR
coloridx = hpbar_color & 0x00FF;
/* attridx = (hpbar_color & 0xFF00) >> 8; */
if (coloridx != NO_COLOR)
term_start_color(coloridx);
#endif
term_start_attr(ATR_INVERSE);
putstr(WIN_STATUS, 0, bar);
term_end_attr(ATR_INVERSE);
#ifdef TEXTCOLOR
if (coloridx != NO_COLOR)
term_end_color();
#endif
if (twoparts) {
*bar2 = savedch;
putstr(WIN_STATUS, 0, bar2);
}
putstr(WIN_STATUS, 0, "]");
} else
putstr(WIN_STATUS, 0, text);
}
} }
} }
cl_end();
curs(WIN_STATUS, 1, 1); curs(WIN_STATUS, 1, 1);
for (i = 0; fieldorder[1][i] != BL_FLUSH; ++i) { for (i = 0; fieldorder[1][i] != BL_FLUSH; ++i) {
int fldidx2 = fieldorder[1][i]; int fldidx2 = fieldorder[1][i];
if (status_activefields[fldidx2]) { if (status_activefields[fldidx2]) {
#ifdef STATUS_HILITES if (fldidx2 != BL_CONDITION) {
if (tty_status_colors[fldidx2] < 0
&& tty_status_colors[fldidx2] >= -3) {
/* attribute, not a color */
attridx = tty_status_colors[fldidx2] + 3;
term_start_attr(statusattr[attridx]);
putstr(WIN_STATUS, 0, status_vals[fldidx2]);
term_end_attr(statusattr[attridx]);
} else
#ifdef TEXTCOLOR #ifdef TEXTCOLOR
if (tty_status_colors[fldidx2] != CLR_MAX) { coloridx = tty_status_colors[fldidx2] & 0x00FF;
if (tty_status_colors[fldidx2] != NO_COLOR) #endif
term_start_color(tty_status_colors[fldidx2]); attridx = (tty_status_colors[fldidx2] & 0xFF00) >> 8;
text = status_vals[fldidx2];
if (iflags.hilite_delta) {
if (*text == ' ') {
putstr(WIN_STATUS, 0, " ");
text++;
}
/* multiple attributes can be in effect concurrently */
Begin_Attr(attridx);
#ifdef TEXTCOLOR
if (coloridx != NO_COLOR && coloridx != CLR_MAX)
term_start_color(coloridx);
#endif
}
if (fldidx2 == BL_GOLD) { if (fldidx2 == BL_GOLD) {
/* putmixed() due to GOLD glyph */ /* putmixed() due to GOLD glyph */
putmixed(WIN_STATUS, 0, status_vals[fldidx2]); putmixed(WIN_STATUS, 0, text);
} else { } else {
putstr(WIN_STATUS, 0, status_vals[fldidx2]); putstr(WIN_STATUS, 0, text);
} }
if (tty_status_colors[fldidx2] != NO_COLOR)
term_end_color(); if (iflags.hilite_delta) {
} else #ifdef TEXTCOLOR
if (coloridx != NO_COLOR)
term_end_color();
#endif #endif
#endif /* STATUS_HILITES */ End_Attr(attridx);
putstr(WIN_STATUS, 0, status_vals[fldidx2]); }
} else {
MaybeDisplayCond(BL_MASK_STONE, "Stone");
MaybeDisplayCond(BL_MASK_SLIME, "Slime");
MaybeDisplayCond(BL_MASK_STRNGL, "Strngl");
MaybeDisplayCond(BL_MASK_FOODPOIS, "FoodPois");
MaybeDisplayCond(BL_MASK_TERMILL, "TermIll");
MaybeDisplayCond(BL_MASK_BLIND, "Blind");
MaybeDisplayCond(BL_MASK_DEAF, "Deaf");
MaybeDisplayCond(BL_MASK_STUN, "Stun");
MaybeDisplayCond(BL_MASK_CONF, "Conf");
MaybeDisplayCond(BL_MASK_HALLU, "Hallu");
MaybeDisplayCond(BL_MASK_LEV, "Lev");
MaybeDisplayCond(BL_MASK_FLY, "Fly");
MaybeDisplayCond(BL_MASK_RIDE, "Ride");
}
} }
} }
cl_end();
return; return;
} }
#ifdef STATUS_HILITES #ifdef TEXTCOLOR
/* /*
* status_threshold(int fldidx, int threshholdtype, anything threshold, * Return what color this condition should
* int behavior, int under, int over) * be displayed in based on user settings.
*
* -- called when a hiliting preference is added, changed, or
* removed.
* -- the fldindex identifies which field is having its hiliting
* preference set. It is an integer index value from botl.h
* -- fldindex could be any one of the following from botl.h:
* BL_TITLE, BL_STR, BL_DX, BL_CO, BL_IN, BL_WI, BL_CH,
* BL_ALIGN, BL_SCORE, BL_CAP, BL_GOLD, BL_ENE, BL_ENEMAX,
* BL_XP, BL_AC, BL_HD, BL_TIME, BL_HUNGER, BL_HP, BL_HPMAX,
* BL_LEVELDESC, BL_EXP, BL_CONDITION
* -- datatype is P_INT, P_UINT, P_LONG, or P_MASK.
* -- threshold is an "anything" union which can contain the
* datatype value.
* -- behavior is used to define how threshold is used and can
* be BL_TH_NONE, BL_TH_VAL_PERCENTAGE, BL_TH_VAL_ABSOLUTE,
* or BL_TH_UPDOWN. BL_TH_NONE means don't do anything above
* or below the threshold. BL_TH_VAL_PERCENTAGE treats the
* threshold value as a precentage of the maximum possible
* value. BL_TH_VAL_ABSOLUTE means that the threshold is an
* actual value. BL_TH_UPDOWN means that threshold is not
* used, and the two below/above hilite values indicate how
* to display something going down (under) or rising (over).
* -- under is the hilite attribute used if value is below the
* threshold. The attribute can be BL_HILITE_NONE,
* BL_HILITE_INVERSE, BL_HILITE_BOLD (-1, -2, or -3), or one
* of the color indexes of CLR_BLACK, CLR_RED, CLR_GREEN,
* CLR_BROWN, CLR_BLUE, CLR_MAGENTA, CLR_CYAN, CLR_GRAY,
* CLR_ORANGE, CLR_BRIGHT_GREEN, CLR_YELLOW, CLR_BRIGHT_BLUE,
* CLR_BRIGHT_MAGENTA, CLR_BRIGHT_CYAN, or CLR_WHITE (0 - 15).
* -- over is the hilite attribute used if value is at or above
* the threshold. The attribute can be BL_HILITE_NONE,
* BL_HILITE_INVERSE, BL_HILITE_BOLD (-1, -2, or -3), or one
* of the color indexes of CLR_BLACK, CLR_RED, CLR_GREEN,
* CLR_BROWN, CLR_BLUE, CLR_MAGENTA, CLR_CYAN, CLR_GRAY,
* CLR_ORANGE, CLR_BRIGHT_GREEN, CLR_YELLOW, CLR_BRIGHT_BLUE,
* CLR_BRIGHT_MAGENTA, CLR_BRIGHT_CYAN, or CLR_WHITE (0 - 15).
*/ */
void int condcolor(bm, bmarray)
tty_status_threshold(fldidx, thresholdtype, threshold, behavior, under, over) long bm;
int fldidx, thresholdtype; unsigned long *bmarray;
int behavior, under, over;
anything threshold;
{ {
tty_status_hilites[fldidx].thresholdtype = thresholdtype; #ifdef STATUS_HILITES
tty_status_hilites[fldidx].threshold = threshold; int i;
tty_status_hilites[fldidx].behavior = behavior;
tty_status_hilites[fldidx].under = under;
tty_status_hilites[fldidx].over = over;
return;
}
if (bm && bmarray)
for (i = 0; i < CLR_MAX; ++i) {
if (bmarray[i] && (bm & bmarray[i]))
return i;
}
#endif
return NO_COLOR;
}
#endif /* TEXTCOLOR */
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;
}
#endif /* STATUS_HILITES */ #endif /* STATUS_HILITES */
#endif /*STATUS_VIA_WINDOWPORT*/
#endif /* TTY_GRAPHICS */ #endif /* TTY_GRAPHICS */
+1
View File
@@ -72,6 +72,7 @@ typedef struct mswin_nhmsg_update_status {
int n_fields; int n_fields;
const char **vals; const char **vals;
boolean *activefields; boolean *activefields;
int *percents;
int *colors; int *colors;
} MSNHMsgUpdateStatus, *PMSNHMsgUpdateStatus; } MSNHMsgUpdateStatus, *PMSNHMsgUpdateStatus;
+76 -35
View File
@@ -18,10 +18,10 @@ typedef struct mswin_nethack_status_window {
int n_fields; int n_fields;
const char **vals; const char **vals;
boolean *activefields; boolean *activefields;
int *percents;
int *colors; int *colors;
} NHStatusWindow, *PNHStatusWindow; } NHStatusWindow, *PNHStatusWindow;
#ifdef STATUS_VIA_WINDOWPORT
static int fieldorder1[] = { BL_TITLE, BL_STR, BL_DX, BL_CO, BL_IN, static int fieldorder1[] = { BL_TITLE, BL_STR, BL_DX, BL_CO, BL_IN,
BL_WI, BL_CH, BL_ALIGN, BL_SCORE, -1 }; BL_WI, BL_CH, BL_ALIGN, BL_SCORE, -1 };
static int fieldorder2[] = { BL_LEVELDESC, BL_GOLD, BL_HP, BL_HPMAX, static int fieldorder2[] = { BL_LEVELDESC, BL_GOLD, BL_HP, BL_HPMAX,
@@ -29,7 +29,6 @@ static int fieldorder2[] = { BL_LEVELDESC, BL_GOLD, BL_HP, BL_HPMAX,
BL_EXP, BL_HD, BL_TIME, BL_HUNGER, BL_EXP, BL_HD, BL_TIME, BL_HUNGER,
BL_CAP, BL_CONDITION, -1 }; BL_CAP, BL_CONDITION, -1 };
static int *fieldorders[] = { fieldorder1, fieldorder2, NULL }; static int *fieldorders[] = { fieldorder1, fieldorder2, NULL };
#endif /* STATUS_VIA_WINDOWPORT */
static TCHAR szStatusWindowClass[] = TEXT("MSNHStatusWndClass"); static TCHAR szStatusWindowClass[] = TEXT("MSNHStatusWndClass");
LRESULT CALLBACK StatusWndProc(HWND, UINT, WPARAM, LPARAM); LRESULT CALLBACK StatusWndProc(HWND, UINT, WPARAM, LPARAM);
@@ -133,9 +132,10 @@ StatusWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case MSNH_MSG_GETTEXT: { case MSNH_MSG_GETTEXT: {
PMSNHMsgGetText msg_data = (PMSNHMsgGetText) lParam; PMSNHMsgGetText msg_data = (PMSNHMsgGetText) lParam;
#ifdef STATUS_VIA_WINDOWPORT #ifdef STATUS_HILITES
int **fop; int **fop;
int *f; int *f;
msg_data->buffer[0] = '\0'; msg_data->buffer[0] = '\0';
if (data->n_fields > 0) { if (data->n_fields > 0) {
for (fop = fieldorders; *fop; fop++) { for (fop = fieldorders; *fop; fop++) {
@@ -143,20 +143,20 @@ StatusWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
if (data->activefields[*f]) if (data->activefields[*f])
strncat(msg_data->buffer, data->vals[*f], strncat(msg_data->buffer, data->vals[*f],
msg_data->max_size msg_data->max_size
- strlen(msg_data->buffer)); - strlen(msg_data->buffer));
} }
strncat(msg_data->buffer, "\r\n", strncat(msg_data->buffer, "\r\n",
msg_data->max_size - strlen(msg_data->buffer)); msg_data->max_size - strlen(msg_data->buffer));
} }
} }
#else /* STATUS_VIA_WINDOWPORT */ #else
strncpy(msg_data->buffer, data->window_text[0], strncpy(msg_data->buffer, data->window_text[0],
msg_data->max_size); msg_data->max_size);
strncat(msg_data->buffer, "\r\n", strncat(msg_data->buffer, "\r\n",
msg_data->max_size - strlen(msg_data->buffer)); msg_data->max_size - strlen(msg_data->buffer));
strncat(msg_data->buffer, data->window_text[1], strncat(msg_data->buffer, data->window_text[1],
msg_data->max_size - strlen(msg_data->buffer)); msg_data->max_size - strlen(msg_data->buffer));
#endif /* STATUS_VIA_WINDOWPORT */ #endif
} break; } break;
case MSNH_MSG_UPDATE_STATUS: { case MSNH_MSG_UPDATE_STATUS: {
@@ -164,6 +164,7 @@ StatusWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
data->n_fields = msg_data->n_fields; data->n_fields = msg_data->n_fields;
data->vals = msg_data->vals; data->vals = msg_data->vals;
data->activefields = msg_data->activefields; data->activefields = msg_data->activefields;
data->percents = msg_data->percents;
data->colors = msg_data->colors; data->colors = msg_data->colors;
InvalidateRect(hWnd, NULL, TRUE); InvalidateRect(hWnd, NULL, TRUE);
} break; } break;
@@ -206,10 +207,12 @@ StatusWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
return 0; return 0;
} }
#ifdef STATUS_VIA_WINDOWPORT #ifdef STATUS_HILITES
static LRESULT static LRESULT
onWMPaint(HWND hWnd, WPARAM wParam, LPARAM lParam) onWMPaint(HWND hWnd, WPARAM wParam, LPARAM lParam)
{ {
int hpbar_percent = 100;
int hpbar_color = NO_COLOR;
int *f; int *f;
int **fop; int **fop;
SIZE sz; SIZE sz;
@@ -238,45 +241,83 @@ onWMPaint(HWND hWnd, WPARAM wParam, LPARAM lParam)
: (COLORREF) GetSysColor(DEFAULT_COLOR_FG_STATUS); : (COLORREF) GetSysColor(DEFAULT_COLOR_FG_STATUS);
OldFg = SetTextColor(hdc, Fg); OldFg = SetTextColor(hdc, Fg);
if (iflags.wc2_hitpointbar && BL_HP < data->n_fields
&& data->activefields[BL_HP]) {
hpbar_percent = data->percents[BL_HP];
hpbar_color = data->colors[BL_HP] & 0x00ff;
}
for (fop = fieldorders; *fop; fop++) { for (fop = fieldorders; *fop; fop++) {
LONG left = rt.left; LONG left = rt.left;
LONG cy = 0; LONG cy = 0;
int vlen; int vlen;
for (f = *fop; *f != -1; f++) { for (f = *fop; *f != -1; f++) {
int clr, atr;
int fntatr = ATR_NONE;
HGDIOBJ fnt;
COLORREF nFg, nBg;
if (((*f) >= data->n_fields) || (!data->activefields[*f])) if (((*f) >= data->n_fields) || (!data->activefields[*f]))
continue; continue;
clr = data->colors[*f] & 0x00ff;
atr = (data->colors[*f] & 0xff00) >> 8;
vlen = strlen(data->vals[*f]); vlen = strlen(data->vals[*f]);
NH_A2W(data->vals[*f], wbuf, SIZE(wbuf)); NH_A2W(data->vals[*f], wbuf, SIZE(wbuf));
if (!iflags.use_status_hilites) { if (atr & HL_BOLD)
SelectObject(hdc, normalFont); fntatr = ATR_BOLD;
SetBkColor(hdc, Bg); else if (atr & HL_INVERSE)
SetTextColor(hdc, Fg); fntatr = ATR_INVERSE;
} else if (data->colors[*f] == CLR_MAX else if (atr & HL_ULINE)
|| data->colors[*f] == BL_HILITE_NONE) { fntatr = ATR_ULINE;
SelectObject(hdc, normalFont); else if (atr & HL_BLINK)
SetBkColor(hdc, Bg); fntatr = ATR_BLINK;
SetTextColor(hdc, Fg); else if (atr & HL_DIM)
} else if (data->colors[*f] > 0) { fntatr = ATR_DIM;
SelectObject(hdc, normalFont); fnt = mswin_get_font(NHW_STATUS, fntatr, hdc, FALSE);
SetBkColor(hdc, Bg); nFg = (clr >= 0 && clr < CLR_MAX) ? nhcolor_to_RGB(clr) : Fg;
SetTextColor(hdc, nhcolor_to_RGB(data->colors[*f])); nBg = Bg;
} else if (data->colors[*f] == BL_HILITE_INVERSE) {
SelectObject(hdc, normalFont);
SetBkColor(hdc, Fg);
SetTextColor(hdc, Bg);
} else if (data->colors[*f] == BL_HILITE_BOLD) {
SelectObject(hdc, boldFont);
SetBkColor(hdc, Bg);
SetTextColor(hdc, Fg);
} else {
SelectObject(hdc, normalFont);
SetBkColor(hdc, Bg);
SetTextColor(hdc, Fg);
}
GetTextExtentPoint32(hdc, wbuf, vlen, &sz); GetTextExtentPoint32(hdc, wbuf, vlen, &sz);
DrawText(hdc, wbuf, vlen, &rt, DT_LEFT); if (*f == BL_TITLE && iflags.wc2_hitpointbar) {
HBRUSH back_brush = CreateSolidBrush(nhcolor_to_RGB(hpbar_color));
RECT barrect;
/* first draw title normally */
SelectObject(hdc, fnt);
SetBkMode(hdc, OPAQUE);
SetBkColor(hdc, Bg);
SetTextColor(hdc, nhcolor_to_RGB(hpbar_color));
DrawText(hdc, wbuf, vlen, &rt, DT_LEFT);
/* calc bar length */
barrect.left = rt.left;
barrect.top = rt.top;
barrect.bottom = sz.cy;
if (hpbar_percent > 0)
barrect.right = (int)((hpbar_percent * sz.cx) / 100);
else
barrect.right = sz.cx;
/* then draw hpbar on top of title */
FillRect(hdc, &barrect, back_brush);
SetBkMode(hdc, TRANSPARENT);
SetTextColor(hdc, nBg);
DrawText(hdc, wbuf, vlen, &barrect, DT_LEFT);
DeleteObject(back_brush);
} else {
if (atr & HL_INVERSE) {
COLORREF tmp = nFg;
nFg = nBg;
nBg = tmp;
}
SelectObject(hdc, fnt);
SetBkMode(hdc, OPAQUE);
SetBkColor(hdc, nBg);
SetTextColor(hdc, nFg);
DrawText(hdc, wbuf, vlen, &rt, DT_LEFT);
}
rt.left += sz.cx; rt.left += sz.cx;
cy = max(cy, sz.cy); cy = max(cy, sz.cy);
@@ -336,7 +377,7 @@ onWMPaint(HWND hWnd, WPARAM wParam, LPARAM lParam)
return 0; return 0;
} }
#endif /*STATUS_VIA_WINDOWPORT*/ #endif /* !STATUS_HILITES */
void void
mswin_status_window_size(HWND hWnd, LPSIZE sz) mswin_status_window_size(HWND hWnd, LPSIZE sz)
+16 -126
View File
@@ -85,6 +85,9 @@ struct window_procs mswin_procs = {
| WC_FONTSIZ_TEXT | WC_TILE_WIDTH | WC_TILE_HEIGHT | WC_TILE_FILE | WC_FONTSIZ_TEXT | WC_TILE_WIDTH | WC_TILE_HEIGHT | WC_TILE_FILE
| WC_VARY_MSGCOUNT | WC_WINDOWCOLORS | WC_PLAYER_SELECTION | WC_VARY_MSGCOUNT | WC_WINDOWCOLORS | WC_PLAYER_SELECTION
| WC_SPLASH_SCREEN | WC_POPUP_DIALOG | WC_MOUSE_SUPPORT, | WC_SPLASH_SCREEN | WC_POPUP_DIALOG | WC_MOUSE_SUPPORT,
#ifdef STATUS_HILITES
WC2_HITPOINTBAR | WC2_FLUSH_STATUS |
#endif
0L, mswin_init_nhwindows, mswin_player_selection, mswin_askname, 0L, mswin_init_nhwindows, mswin_player_selection, mswin_askname,
mswin_get_nh_event, mswin_exit_nhwindows, mswin_suspend_nhwindows, mswin_get_nh_event, mswin_exit_nhwindows, mswin_suspend_nhwindows,
mswin_resume_nhwindows, mswin_create_nhwindow, mswin_clear_nhwindow, mswin_resume_nhwindows, mswin_create_nhwindow, mswin_clear_nhwindow,
@@ -108,13 +111,8 @@ struct window_procs mswin_procs = {
/* other defs that really should go away (they're tty specific) */ /* other defs that really should go away (they're tty specific) */
mswin_start_screen, mswin_end_screen, mswin_outrip, mswin_start_screen, mswin_end_screen, mswin_outrip,
mswin_preference_update, mswin_getmsghistory, mswin_putmsghistory, mswin_preference_update, mswin_getmsghistory, mswin_putmsghistory,
#ifdef STATUS_VIA_WINDOWPORT
mswin_status_init, mswin_status_finish, mswin_status_enablefield, mswin_status_init, mswin_status_finish, mswin_status_enablefield,
mswin_status_update, mswin_status_update,
#ifdef STATUS_HILITES
mswin_status_threshold,
#endif
#endif
genl_can_suspend_yes, genl_can_suspend_yes,
}; };
@@ -2713,18 +2711,18 @@ NHMessageBox(HWND hWnd, LPCTSTR text, UINT type)
return MessageBox(hWnd, text, title, type); return MessageBox(hWnd, text, title, type);
} }
#ifdef STATUS_VIA_WINDOWPORT
static const char *_status_fieldnm[MAXBLSTATS]; static const char *_status_fieldnm[MAXBLSTATS];
static const char *_status_fieldfmt[MAXBLSTATS]; static const char *_status_fieldfmt[MAXBLSTATS];
static char *_status_vals[MAXBLSTATS]; static char *_status_vals[MAXBLSTATS];
static int _status_colors[MAXBLSTATS]; static int _status_colors[MAXBLSTATS];
static int _status_percents[MAXBLSTATS];
static boolean _status_activefields[MAXBLSTATS]; static boolean _status_activefields[MAXBLSTATS];
extern winid WIN_STATUS; extern winid WIN_STATUS;
#ifdef STATUS_HILITES #ifdef STATUS_HILITES
typedef struct hilite_data_struct { typedef struct hilite_data_struct {
int thresholdtype; int thresholdtype;
anything threshold; anything value;
int behavior; int behavior;
int under; int under;
int over; int over;
@@ -2747,6 +2745,7 @@ mswin_status_init(void)
_status_activefields[i] = FALSE; _status_activefields[i] = FALSE;
_status_fieldfmt[i] = (const char *) 0; _status_fieldfmt[i] = (const char *) 0;
_status_colors[i] = CLR_MAX; /* no color */ _status_colors[i] = CLR_MAX; /* no color */
_status_percents[i] = 0;
#ifdef STATUS_HILITES #ifdef STATUS_HILITES
_status_hilites[i].thresholdtype = 0; _status_hilites[i].thresholdtype = 0;
_status_hilites[i].behavior = BL_TH_NONE; _status_hilites[i].behavior = BL_TH_NONE;
@@ -2804,64 +2803,9 @@ mswin_status_enablefield(int fieldidx, const char *nm, const char *fmt,
_status_activefields[fieldidx] = enable; _status_activefields[fieldidx] = enable;
} }
#ifdef STATUS_HILITES
/*
status_threshold(int fldidx, int threshholdtype, anything threshold,
int behavior, int under, int over)
-- called when a hiliting preference is added, changed, or
removed.
-- the fldindex identifies which field is having its hiliting
preference set. It is an integer index value from botl.h
-- fldindex could be any one of the following from botl.h:
BL_TITLE, BL_STR, BL_DX, BL_CO, BL_IN, BL_WI, BL_CH,
BL_ALIGN, BL_SCORE, BL_CAP, BL_GOLD, BL_ENE, BL_ENEMAX,
BL_XP, BL_AC, BL_HD, BL_TIME, BL_HUNGER, BL_HP, BL_HPMAX,
BL_LEVELDESC, BL_EXP, BL_CONDITION
-- datatype is P_INT, P_UINT, P_LONG, or P_MASK.
-- threshold is an "anything" union which can contain the
datatype value.
-- behavior is used to define how threshold is used and can
be BL_TH_NONE, BL_TH_VAL_PERCENTAGE, BL_TH_VAL_ABSOLUTE,
or BL_TH_UPDOWN. BL_TH_NONE means don't do anything above
or below the threshold. BL_TH_VAL_PERCENTAGE treats the
threshold value as a precentage of the maximum possible
value. BL_TH_VAL_ABSOLUTE means that the threshold is an
actual value. BL_TH_UPDOWN means that threshold is not
used, and the two below/above hilite values indicate how
to display something going down (under) or rising (over).
-- under is the hilite attribute used if value is below the
threshold. The attribute can be BL_HILITE_NONE,
BL_HILITE_INVERSE, BL_HILITE_BOLD (-1, -2, or -3), or one
of the color indexes of CLR_BLACK, CLR_RED, CLR_GREEN,
CLR_BROWN, CLR_BLUE, CLR_MAGENTA, CLR_CYAN, CLR_GRAY,
CLR_ORANGE, CLR_BRIGHT_GREEN, CLR_YELLOW, CLR_BRIGHT_BLUE,
CLR_BRIGHT_MAGENTA, CLR_BRIGHT_CYAN, or CLR_WHITE (0 - 15).
-- over is the hilite attribute used if value is at or above
the threshold. The attribute can be BL_HILITE_NONE,
BL_HILITE_INVERSE, BL_HILITE_BOLD (-1, -2, or -3), or one
of the color indexes of CLR_BLACK, CLR_RED, CLR_GREEN,
CLR_BROWN, CLR_BLUE, CLR_MAGENTA, CLR_CYAN, CLR_GRAY,
CLR_ORANGE, CLR_BRIGHT_GREEN, CLR_YELLOW, CLR_BRIGHT_BLUE,
CLR_BRIGHT_MAGENTA, CLR_BRIGHT_CYAN, or CLR_WHITE (0 - 15).
*/
void
mswin_status_threshold(int fldidx, int thresholdtype, anything threshold,
int behavior, int under, int over)
{
logDebug("mswin_status_threshold(%d, %d, %d, %d, %d)\n", fldidx,
thresholdtype, behavior, under, over);
assert(fldidx >= 0 && fldidx < MAXBLSTATS);
_status_hilites[fldidx].thresholdtype = thresholdtype;
_status_hilites[fldidx].threshold = threshold;
_status_hilites[fldidx].behavior = behavior;
_status_hilites[fldidx].under = under;
_status_hilites[fldidx].over = over;
}
#endif /* STATUS_HILITES */
/* /*
status_update(int fldindex, genericptr_t ptr, int chg, int percentage) status_update(int fldindex, genericptr_t ptr, int chg, int percent, int color, unsigned long *colormasks)
-- update the value of a status field. -- update the value of a status field.
-- the fldindex identifies which field is changing and -- the fldindex identifies which field is changing and
is an integer index value from botl.h is an integer index value from botl.h
@@ -2894,9 +2838,13 @@ status_update(int fldindex, genericptr_t ptr, int chg, int percentage)
symbol for GOLD "\GXXXXNNNN:nnn". If window port needs symbol for GOLD "\GXXXXNNNN:nnn". If window port needs
textual gold amount without the leading "$:" the port will textual gold amount without the leading "$:" the port will
have to skip past ':' in passed "ptr" for the BL_GOLD case. have to skip past ':' in passed "ptr" for the BL_GOLD case.
-- color is the color that the NetHack core is telling you to
use to display the text.
-- colormasks is a pointer to a set of CLR_MAX unsigned longs
telling you which fields should be displayed in each color.
*/ */
void void
mswin_status_update(int idx, genericptr_t ptr, int chg, int percent) mswin_status_update(int idx, genericptr_t ptr, int chg, int percent, int color, unsigned long *colormasks)
{ {
long cond, *condptr = (long *) ptr; long cond, *condptr = (long *) ptr;
char *text = (char *) ptr; char *text = (char *) ptr;
@@ -2905,11 +2853,12 @@ mswin_status_update(int idx, genericptr_t ptr, int chg, int percent)
unsigned ospecial; unsigned ospecial;
long value = -1; long value = -1;
logDebug("mswin_status_update(%d, %p, %d, %d)\n", idx, ptr, chg, percent); logDebug("mswin_status_update(%d, %p, %d, %d, %x, %p)\n", idx, ptr, chg, percent, color, colormasks);
if (idx != BL_FLUSH) { if (idx != BL_FLUSH) {
if (!_status_activefields[idx]) if (!_status_activefields[idx])
return; return;
_status_percents[idx] = percent;
switch (idx) { switch (idx) {
case BL_CONDITION: { case BL_CONDITION: {
cond = *condptr; cond = *condptr;
@@ -2971,75 +2920,16 @@ mswin_status_update(int idx, genericptr_t ptr, int chg, int percent)
} }
} }
#ifdef STATUS_HILITES _status_colors[idx] = color;
switch (_status_hilites[idx].behavior) {
case BL_TH_NONE: {
_status_colors[idx] = CLR_MAX;
} break;
case BL_TH_UPDOWN: {
if (chg > 0)
_status_colors[idx] = _status_hilites[idx].over;
else if (chg < 0)
_status_colors[idx] = _status_hilites[idx].under;
else
_status_colors[idx] = CLR_MAX;
} break;
case BL_TH_VAL_PERCENTAGE: {
int pct_th = 0;
if (_status_hilites[idx].thresholdtype != ANY_INT) {
impossible("mswin_status_update: unsupported percentage "
"threshold type %d",
_status_hilites[idx].thresholdtype);
break;
}
pct_th = _status_hilites[idx].threshold.a_int;
_status_colors[idx] = (percent >= pct_th)
? _status_hilites[idx].over
: _status_hilites[idx].under;
} break;
case BL_TH_VAL_ABSOLUTE: {
int c = CLR_MAX;
int o = _status_hilites[idx].over;
int u = _status_hilites[idx].under;
anything *t = &_status_hilites[idx].threshold;
switch (_status_hilites[idx].thresholdtype) {
case ANY_LONG:
c = (value >= t->a_long) ? o : u;
break;
case ANY_INT:
c = (value >= t->a_int) ? o : u;
break;
case ANY_UINT:
c = ((unsigned long) value >= t->a_uint) ? o : u;
break;
case ANY_ULONG:
c = ((unsigned long) value >= t->a_ulong) ? o : u;
break;
case ANY_MASK32:
c = (value & t->a_ulong) ? o : u;
break;
default:
impossible("mswin_status_update: unsupported absolute threshold "
"type %d\n",
_status_hilites[idx].thresholdtype);
break;
}
_status_colors[idx] = c;
} break;
}
#endif /* STATUS_HILITES */
/* send command to status window */ /* send command to status window */
ZeroMemory(&update_cmd_data, sizeof(update_cmd_data)); ZeroMemory(&update_cmd_data, sizeof(update_cmd_data));
update_cmd_data.n_fields = MAXBLSTATS; update_cmd_data.n_fields = MAXBLSTATS;
update_cmd_data.vals = _status_vals; update_cmd_data.vals = _status_vals;
update_cmd_data.activefields = _status_activefields; update_cmd_data.activefields = _status_activefields;
update_cmd_data.percents = _status_percents;
update_cmd_data.colors = _status_colors; update_cmd_data.colors = _status_colors;
SendMessage(mswin_hwnd_from_winid(WIN_STATUS), WM_MSNH_COMMAND, SendMessage(mswin_hwnd_from_winid(WIN_STATUS), WM_MSNH_COMMAND,
(WPARAM) MSNH_MSG_UPDATE_STATUS, (LPARAM) &update_cmd_data); (WPARAM) MSNH_MSG_UPDATE_STATUS, (LPARAM) &update_cmd_data);
} }
#endif /*STATUS_VIA_WINDOWPORT*/
+1 -8
View File
@@ -182,18 +182,11 @@ void mswin_preference_update(const char *pref);
char *mswin_getmsghistory(BOOLEAN_P init); char *mswin_getmsghistory(BOOLEAN_P init);
void mswin_putmsghistory(const char *msg, BOOLEAN_P); void mswin_putmsghistory(const char *msg, BOOLEAN_P);
#ifdef STATUS_VIA_WINDOWPORT
void mswin_status_init(void); void mswin_status_init(void);
void mswin_status_finish(void); void mswin_status_finish(void);
void mswin_status_enablefield(int fieldidx, const char *nm, const char *fmt, void mswin_status_enablefield(int fieldidx, const char *nm, const char *fmt,
boolean enable); boolean enable);
void mswin_status_update(int idx, genericptr_t ptr, int chg, int percent); void mswin_status_update(int idx, genericptr_t ptr, int chg, int percent, int color, unsigned long *colormasks);
#ifdef STATUS_HILITES
void mswin_status_threshold(int fldidx, int thresholdtype, anything threshold,
int behavior, int under, int over);
#endif /* STATUS_HILITES */
#endif /*STATUS_VIA_WINDOWPORT*/
/* helper function */ /* helper function */
HWND mswin_hwnd_from_winid(winid wid); HWND mswin_hwnd_from_winid(winid wid);