Annotation of 42BSD/games/mpu/routines, revision 1.1.1.1

1.1       root        1: ROUTINE VisP;
                      2: VisP =                          { (Visp List Propno) => True IFF an object }
                      3: (($eq %1 0) : ($rtrn FALSE))   {       is visible on List that has Propno }
                      4: (($prop %1 INVIS) :
                      5:        ($rtrn (VisP ($link %1) %2)))   { Ignore this object }
                      6: (($prop %1 %2) :
                      7:        ($rtrn TRUE))                   { Found one! }
                      8: (($or ($prop %1 OPEN)
                      9:       ($prop %1 TRANS)):                { Look inside...}
                     10:        ( (VisP ($cont %1) %2): ($rtrn TRUE) ))
                     11: ($rtrn (VisP ($link %1) %2))
                     12: ;
                     13: 
                     14: ROUTINE Reach;                  { (Reach obj loc) => True IFF the obj   }
                     15: Reach =                         {       IS the loc or can be reached    }
                     16: (($eq %2 0) : ($rtrn FALSE))    {       by the loc }
                     17: (($eq %1 %2): ($rtrn TRUE))
                     18:                        { Still explore inside }
                     19: (($prop %2 OPEN):
                     20:        ((Reach %1 ($cont %2)): ($rtrn TRUE))
                     21: )
                     22: ($rtrn  (Reach %1 ($link %2)))
                     23: 
                     24: ;
                     25: 
                     26: ROUTINE See;                  { (See obj loc) => True IFF the obj   }
                     27: See   =                         {       IS the loc or can be seen       }
                     28: (($prop %1 INVIS): ($rtrn FALSE))
                     29: (($eq %2 0) : ($rtrn FALSE))
                     30: (($eq %1 %2): ($rtrn TRUE))
                     31: (($or  ($prop %2 TRANS)                 { Still explore inside }
                     32:        ($prop %2 OPEN)):
                     33:        ((See   %1 ($cont %2)): ($rtrn TRUE))
                     34: )
                     35: ($rtrn  (See   %1 ($link %2)))
                     36: ;
                     37: 
                     38: Avail =
                     39:        (($not %1):($say "The what?\n")($exit 1))
                     40:        (($not (See %1 ($cont ($loc .ME)))):
                     41:                ($say "I can't see that item here.\n")
                     42:                ($exit 1)
                     43:          )
                     44:        (($not (Reach %1 ($cont ($loc .ME)))):
                     45:                ($say "I can't get at that item.\n")
                     46:                ($exit 1)
                     47:          )
                     48:        (($and ($prop .ME SHRNK)
                     49:               ($not ($prop %1 SHRNK))  ):
                     50:                       (($ne ($loc %1) .ME):
                     51:                                ($say
                     52: "Right now, ")(($sdisc %1))($say " is too big for you to deal with.\n")
                     53:                                ($exit 1)
                     54:                        )
                     55:          )
                     56:        ($rtrn TRUE)
                     57: ;
                     58: 
                     59: ROUTINE LitP;
                     60: LitP =                          { (LitP Room) => True IFF Room is lit }
                     61: (($prop %1 LIGHT) : ($rtrn TRUE))
                     62: (($or (VisP ($cont %1) LIGHT)
                     63:       (VisP ($cont %1) FLAME)): ($rtrn TRUE))
                     64: 
                     65: (($or (VisP ($cont .ME) LIGHT)                  { Check .ME 'cause invisibl }
                     66:       (VisP ($cont .ME) FLAME)): ($rtrn TRUE))
                     67: ($rtrn FALSE)
                     68: ;
                     69: 
                     70: ROUTINE Blank;
                     71: Blank =                         { Blank n => Type n blanks }
                     72: (($gt %1 0):
                     73:        ($say "  ")
                     74:        (Blank ($minus %1 1)));
                     75: 
                     76: ROUTINE Llook; ROUTINE Slook;
                     77: Llook =                         { (Llook Level Object) describes Object }
                     78: (($eq %2 0) : ($exit 0))
                     79: (($eq %1 0) :                   { Level 0 == This is a room.  Check lighting }
                     80:        ((LitP %2):
                     81:                ($setg DARKG FALSE)
                     82:                (($ldisc %2))           { Talk about the room }
                     83:                (($not @DARKG):
                     84:                        (Llook 1 ($cont %2))    { Talk about its contents }
                     85:                )
                     86:        {else}:
                     87:                ($say "It's mighty dark in here!\n")
                     88:                ($setg DARKG TRUE)
                     89:        )
                     90: 
                     91: {else} :                        { Level > 0 == This is a list of objs }
                     92:        ( ($ldisc %2)   :       { Talk (only) about the visible }
                     93:                (Blank %1)                      { Indent }
                     94:                (($ldisc %2))           { Blurb the object }
                     95: 
                     96:                ( ($cont %2):      { something inside it...}
                     97:                        (($or ($prop %2 OPEN)($prop %2 TRANS)):
                     98:                                (Blank %1)
                     99:                                ($say "It contains:\n")
                    100:                                ($setp %2 CONTS TRUE)
                    101:                                (Slook ($plus %1 1) ($cont %2))
                    102:                                        { Short descriptions for contents }
                    103:                        )
                    104:                )
                    105:         )
                    106:        (Llook %1 ($link %2))
                    107: );
                    108: 
                    109: 
                    110: Slook =                         { (Llook Level Object) describes Object }
                    111: (($eq %2 0) : ($exit 0))
                    112: (($eq %1 0) :                   { Level 0 == This is a room.  Check lighting }
                    113:        ((LitP %2):
                    114:                ($setg DARKG FALSE)
                    115:                (($sdisc %2))           { Talk about the room }
                    116:                (($not @DARKG):
                    117:                        ($setp %2 CONTS FALSE)
                    118:                        (Slook 1 ($cont %2))    { Talk about its contents }
                    119:                )
                    120:        {else}:
                    121:                ($say "It's mighty dark in here!\n")
                    122:                ($setg DARKG TRUE)
                    123:        )
                    124: 
                    125: {else} :                        { Level > 0 == This is a list of objs }
                    126:        (($sdisc %2) :          { Talk (only) about the visible }
                    127:                (($not ($prop ($loc %2) CONTS)):
                    128:                        (Blank ($minus %1 1))
                    129:                        ($say "You can see:\n")
                    130:                        ($setp ($loc %2) CONTS TRUE)
                    131:                )
                    132:                (Blank %1)                      { Indent }
                    133:                (($sdisc %2))           { Blurb the object }
                    134:                (($and ($ne ($cont %2) 0)       { something inside it...}
                    135:                       ($or ($prop %2 OPEN)     {...and you can see it }
                    136:                            ($prop %2 TRANS)
                    137:                        )
                    138:                  ):
                    139: 
                    140:                        ($setp %2 CONTS TRUE)
                    141:                        ($say ", containing:\n")
                    142:                        (Slook ($plus %1 1) ($cont %2))
                    143:                                        { Short descriptions for contents }
                    144:                   :    ($say "\n")
                    145: 
                    146:                )
                    147:        )
                    148:        ( Slook %1 ($link %2))
                    149: 
                    150: );
                    151: 
                    152: 
                    153: 
                    154: 
                    155: LOOK =
                    156: 
                    157: 
                    158: 
                    159:        ($setg WASDK @DARKG)
                    160:        (@LOOKP :
                    161:                (($prop ($loc .ME) VISIT):
                    162:                        (Slook 0 ($loc .ME))
                    163:                 {else} :
                    164:                        (Llook 0 ($loc .ME))
                    165:                        ($setp ($loc .ME) VISIT TRUE)
                    166:                )
                    167:                (@DARKG : ($setp ($loc .ME) VISIT FALSE))
                    168:        )
                    169:        ($setg LOOKP FALSE)
                    170:        ($itun)
                    171:        ($say "\n> ")
                    172: ;
                    173: 
                    174: ROUTINE GrowX; ROUTINE ShrnX;
                    175: GrowX = (($prop %1 SHRNK):
                    176:                ($setp %1 SHRNK FALSE)
                    177:                (($cont %1):
                    178:                        (GrowX ($cont %1)))
                    179:                (($link %1):
                    180:                        (GrowX ($link %1)))
                    181:        )
                    182:        ;
                    183: 
                    184: Grow = (($prop .ME SHRNK):
                    185:                ($setp .ME SHRNK FALSE)
                    186:                (($cont .ME):
                    187:                        (GrowX ($cont .ME)))
                    188:        )
                    189: ;
                    190: 
                    191: ShrnX = (($not ($prop %1 SHRNK)):
                    192:                ($setp %1 SHRNK TRUE)
                    193:                (($cont %1):
                    194:                        (ShrnX ($cont %1)))
                    195:                (($link %1):
                    196:                        (ShrnX ($link %1)))
                    197: {else}  :
                    198:                ($say "You hear a tiny POP as ")(($sdisc %1))
                    199:                ($say " vanishes completely!\n")
                    200:                (($link %1):
                    201:                        (ShrnX ($link %1)))
                    202:                ($move %1 .ALL)
                    203:        )
                    204: 
                    205: ;
                    206: 
                    207: Shrin= (($not ($prop .ME SHRNK)):
                    208:                ($setp .ME SHRNK TRUE)
                    209:                (($cont .ME):
                    210:                        (ShrnX ($cont .ME)))
                    211:        )
                    212: ;

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.