blindness overhaul

I was working on this at the time 3.6.0 was released and set it aside
until later.  Later has finally arrived.  Redo the Blind, Blinded,
Blindfolded,&c macros to make more complete use of intrinsic property
handling.  Blinded was being treated as a number which could be added
to or subtracted from; now that has to be done via TIMEOUT mask
because it has FROMOUTSIDE (OPTIONS:blind) and FROMFORM (poly'd into
!haseyes() form) bits included.  Object definitions for blindfold and
towel now specify the BLINDED property; overriding blindness via the
Eyes of the Overworld is accomplished via props[BLINDED].blocked.

Code generated for the scores of Blind and !Blind tests throughout
the program should be smaller.

One bug that has been fixed is that putting on the Eyes of the
Overworld cured permanent blindness (from OPTIONS:blind).  The
u.uroleplay.blind flag was cleared and stayed so after taking them
off.  Putting the Eyes on still breaks blind-from-birth conduct but
now blindness will resume when they are removed.

This was untested at the time it was set aside and is only lightly
tested now.  A large number of the changes here are just to switch
from Blinded to BlindedTimeout for current timed value and to call
set_itimeout() for setting a new value.
This commit is contained in:
PatR
2023-04-27 14:53:28 -07:00
parent 57ff993352
commit 1c94bdac89
26 changed files with 142 additions and 85 deletions

View File

@@ -850,10 +850,16 @@ MARKER(LAST_AMULET, AMULET_OF_YENDOR)
OBJECT(OBJ(name, desc), \
BITS(kn, 0, chg, 1, mgc, chg, 0, 0, 0, 0, 0, P_NONE, mat), \
0, TOOL_CLASS, prob, 0, wt, cost, 0, 0, 0, 0, wt, color, sn)
#define WEPTOOL(name,desc,kn,mgc,bi,prob,wt,cost,sdam,ldam,hitbon,sub,mat,clr,sn)\
#define EYEWEAR(name,desc,kn,prop,prob,wt,cost,mat,color,sn) \
OBJECT(OBJ(name, desc), \
BITS(kn, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, P_NONE, mat), \
prop, TOOL_CLASS, prob, 0, wt, cost, 0, 0, 0, 0, wt, color, sn)
#define WEPTOOL(name,desc,kn,mgc,bi,prob,wt,cost,sdam,ldam,hitbon,sub, \
mat,clr,sn) \
OBJECT(OBJ(name, desc), \
BITS(kn, 0, 1, 0, mgc, 1, 0, 0, bi, 0, hitbon, sub, mat), \
0, TOOL_CLASS, prob, 0, wt, cost, sdam, ldam, hitbon, 0, wt, clr, sn)
0, TOOL_CLASS, prob, 0, wt, cost, sdam, ldam, hitbon, 0, wt, \
clr, sn)
/* containers */
CONTAINER("large box", NoDes, 1, 0, 0, 40, 350, 8, WOOD, HI_WOOD,
LARGE_BOX),
@@ -891,17 +897,24 @@ TOOL("magic lamp", "lamp", 0, 0, 1, 0, 15, 20, 50, COPPER, CLR_YELLOW,
MAGIC_LAMP),
/* other tools */
TOOL("expensive camera", NoDes, 1, 0, 0, 1, 15, 12,200, PLASTIC, CLR_BLACK,
EXPENSIVE_CAMERA),
EXPENSIVE_CAMERA),
TOOL("mirror", "looking glass", 0, 0, 0, 0, 45, 13, 10, GLASS, HI_SILVER,
MIRROR),
TOOL("crystal ball", "glass orb", 0, 0, 1, 1, 15,150, 60, GLASS, HI_GLASS,
CRYSTAL_BALL),
TOOL("lenses", NoDes, 1, 0, 0, 0, 5, 3, 80, GLASS, HI_GLASS,
/* eyewear - tools which can be worn on the face; (!mrg, !chg, !mgc)
worn lenses don't confer the Blinded property, blindfolds and towels do;
wet towel can be used as a weapon but is not a weptool and uses obj->spe
differently from weapons and weptools */
EYEWEAR("lenses", NoDes, 1, 0, 5, 3, 80, GLASS, HI_GLASS,
LENSES),
TOOL("blindfold", NoDes, 1, 0, 0, 0, 50, 2, 20, CLOTH, CLR_BLACK,
EYEWEAR("blindfold", NoDes, 1, BLINDED, 50, 2, 20, CLOTH, CLR_BLACK,
BLINDFOLD),
TOOL("towel", NoDes, 1, 0, 0, 0, 50, 5, 50, CLOTH, CLR_MAGENTA,
EYEWEAR("towel", NoDes, 1, BLINDED, 50, 2, 50, CLOTH, CLR_MAGENTA,
TOWEL),
#undef EYEWEAR
/* still other tools */
TOOL("saddle", NoDes, 1, 0, 0, 0, 5,200,150, LEATHER, HI_LEATHER,
SADDLE),
TOOL("leash", NoDes, 1, 0, 0, 0, 65, 12, 20, LEATHER, HI_LEATHER,
@@ -1540,7 +1553,7 @@ ROCK("luckstone", "gray", 0, 10, 10, 60, 3, 3, 1, 10, 7, MINERAL, CLR_GRAY,
ROCK("loadstone", "gray", 0, 10, 500, 1, 3, 3, 1, 10, 6, MINERAL, CLR_GRAY,
LOADSTONE),
ROCK("touchstone", "gray", 0, 8, 10, 45, 3, 3, 1, 10, 6, MINERAL, CLR_GRAY,
TOUCHSTONE),
TOUCHSTONE),
ROCK("flint", "gray", 0, 10, 10, 1, 6, 6, 0, 10, 7, MINERAL, CLR_GRAY,
FLINT),
ROCK("rock", NoDes, 1, 100, 10, 0, 3, 3, 0, 10, 7, MINERAL, CLR_GRAY,