Home | History | Annotate | Line # | Download | only in battlestar
      1  1.20  dholland /*	$NetBSD: globals.c,v 1.20 2020/12/06 11:35:27 dholland Exp $	*/
      2   1.3       cgd 
      3   1.1       cgd /*
      4   1.3       cgd  * Copyright (c) 1983, 1993
      5   1.3       cgd  *	The Regents of the University of California.  All rights reserved.
      6   1.1       cgd  *
      7   1.1       cgd  * Redistribution and use in source and binary forms, with or without
      8   1.1       cgd  * modification, are permitted provided that the following conditions
      9   1.1       cgd  * are met:
     10   1.1       cgd  * 1. Redistributions of source code must retain the above copyright
     11   1.1       cgd  *    notice, this list of conditions and the following disclaimer.
     12   1.1       cgd  * 2. Redistributions in binary form must reproduce the above copyright
     13   1.1       cgd  *    notice, this list of conditions and the following disclaimer in the
     14   1.1       cgd  *    documentation and/or other materials provided with the distribution.
     15  1.19       agc  * 3. Neither the name of the University nor the names of its contributors
     16   1.1       cgd  *    may be used to endorse or promote products derived from this software
     17   1.1       cgd  *    without specific prior written permission.
     18   1.1       cgd  *
     19   1.1       cgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     20   1.1       cgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     21   1.1       cgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     22   1.1       cgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     23   1.1       cgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     24   1.1       cgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     25   1.1       cgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     26   1.1       cgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     27   1.1       cgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     28   1.1       cgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     29   1.1       cgd  * SUCH DAMAGE.
     30   1.1       cgd  */
     31   1.1       cgd 
     32   1.5     lukem #include <sys/cdefs.h>
     33   1.1       cgd #ifndef lint
     34   1.3       cgd #if 0
     35   1.4       tls static char sccsid[] = "@(#)globals.c	8.2 (Berkeley) 4/28/95";
     36   1.3       cgd #else
     37  1.20  dholland __RCSID("$NetBSD: globals.c,v 1.20 2020/12/06 11:35:27 dholland Exp $");
     38   1.3       cgd #endif
     39   1.6     lukem #endif				/* not lint */
     40   1.1       cgd 
     41   1.4       tls #include "extern.h"
     42   1.1       cgd 
     43   1.6     lukem int     WEIGHT = MAXWEIGHT;
     44   1.6     lukem int     CUMBER = MAXCUMBER;
     45   1.1       cgd 
     46   1.7   hubertf const char   *const objdes[NUMOFOBJECTS] = {
     47  1.10       jsm 	"There is a knife here.",
     48  1.10       jsm 	"There are an exquisitely crafted sword and scabbard here.",
     49  1.15       jsm 	NULL,			/* Can land from here. */
     50   1.1       cgd 	"There is a fierce woodsman here brandishing a heavy mallet.",
     51   1.8   hubertf 	"There is an unwieldy two-handed sword here.",
     52   1.1       cgd 	"There is a bloody meat cleaver here.",
     53   1.1       cgd 	"A rusty broadsword is lying here.",
     54   1.1       cgd 	"There is an ancient coat of finely woven mail here.",
     55   1.1       cgd 	"There is a old dented helmet with an ostrich plume here.",
     56   1.1       cgd 	"There is a shield of some native tribe here.",
     57   1.1       cgd 	"The maid's body is lying here. She was murdered!",
     58   1.1       cgd 	"There is a Viper ready for launch here.",
     59   1.1       cgd 	"A kerosene lantern is burning luridly here.",
     60   1.1       cgd 	"An old pair of shoes has been discarded here.",
     61  1.15       jsm 	NULL,			/* Cylon. */
     62   1.1       cgd 	"There is a pair of pajamas here.",
     63   1.1       cgd 	"A kingly robe of royal purple and spun gold is draped here.",
     64   1.1       cgd 	"There is a strange golden amulet on the floor here.",
     65   1.1       cgd 	"A medallion of solid gold shimmers on the ground nearby.",
     66   1.1       cgd 	"A talisman of gold is lying here.",
     67   1.1       cgd 	"A dead woodsman has fallen here. He was savagely murdered.",
     68   1.1       cgd 	"A heavy wooden mallet lies nearby.",
     69   1.1       cgd 	"There is a laser pistol here.",
     70  1.20  dholland 	"A flower-like young goddess is bathing in the hot mineral pools. She "
     71  1.20  dholland 		"is \nwatching you, but continues to steep and sing softly.",
     72   1.1       cgd 	"The goddess is reclining on a bed of ferns and studying you intently.",
     73  1.10       jsm 	"There is a grenade here.",
     74   1.1       cgd 	"There is a length of heavy chain here.",
     75   1.1       cgd 	"There is a stout rope here.",
     76   1.1       cgd 	"There is a pair of Levi's here.",
     77   1.1       cgd 	"A bloody mace is lying on the ground here.",
     78   1.1       cgd 	"There is a shovel here.",
     79   1.1       cgd 	"A long, sharp halberd is propped up here.",
     80  1.10       jsm 	"There is a compass here.",
     81   1.1       cgd 	"Wreckage and smoldering debris from a crash litter the ground here.",
     82  1.20  dholland 	"A woodland Elf armed with a shield and deadly halberd lunges toward "
     83  1.20  dholland 		"you!",
     84   1.1       cgd 	"I think I hear footsteps behind us.",
     85   1.1       cgd 	"There are a few coins here.",
     86   1.1       cgd 	"There are some matches here.",
     87   1.6     lukem 	"An unctuous man in a white suit and a dwarf are standing here.",
     88   1.6     lukem 	"There are some ripe papayas here.",
     89   1.6     lukem 	"There is a ripe pineapple here.",
     90   1.6     lukem 	"There are some kiwi fruit here.",
     91   1.6     lukem 	"There are some coconuts here.",
     92   1.6     lukem 	"There is a ripe mango here.",
     93   1.6     lukem 	"There is a sparkling diamond ring here.",
     94   1.6     lukem 	"There is a colorful pink potion in a small crystal vial here.",
     95   1.6     lukem 	"A gold bracelet is on the ground here.",
     96  1.20  dholland 	"A swarthy woman with stern features pulls you aside from the crowd,\n"
     97  1.20  dholland 		"'I must talk to you -- but not here.  "
     98  1.20  dholland 		"Meet me at midnight in the gardens.'",
     99  1.20  dholland 	"The swarthy woman has been awaiting you anxiously. 'I must warn you "
    100  1.20  dholland 		"that the\nIsland has anticipated your Quest.  You will not be "
    101  1.20  dholland 		"welcomed. The Darkness is\nstrong where you must search.  Seek"
    102  1.20  dholland 		" not the shadows save only at night, for\nthen are they the "
    103  1.20  dholland 		"weakest.  In the mountains far from here a canyon winds\nwith "
    104  1.20  dholland 		"ferns and streams and forgotten vines.  There you must go. "
    105  1.20  dholland 		"Take this\nrope.'",
    106  1.20  dholland 	"Out from the shadows a figure leaps!  His black cape swirls around,"
    107  1.20  dholland 		" and he\nholds a laser sword at your chest.  'So, you have"
    108  1.20  dholland 		" come to fulfill the Quest.\nHa! Your weapons are no match for"
    109  1.20  dholland 		" me!'",
    110  1.20  dholland 	"An old-timer with one eye missing and no money for a drink sits at the"
    111  1.20  dholland 		" bar.",
    112   1.6     lukem 	"You are flying through an asteroid field!",
    113   1.6     lukem 	"A planet is nearby.",
    114   1.6     lukem 	"The ground is charred here.",
    115   1.6     lukem 	"There is a thermonuclear warhead here.",
    116  1.20  dholland 	"The fragile, beautiful young goddess lies here.  You murdered her "
    117  1.20  dholland 		"horribly.",
    118  1.10       jsm 	"The old-timer is lying here.  He is dead.",
    119   1.6     lukem 	"The native girl's body is lying here.",
    120   1.6     lukem 	"A native girl is sitting here.",
    121   1.6     lukem 	"A gorgeous white stallion is standing here.",
    122   1.6     lukem 	"The keys are in the ignition.",
    123   1.6     lukem 	"A pot of pearls and jewels is sitting here.",
    124   1.6     lukem 	"A bar of solid gold is here.",
    125   1.6     lukem 	"There is a 10 kilogram diamond block here."
    126   1.1       cgd 
    127   1.1       cgd };
    128   1.1       cgd 
    129   1.7   hubertf const char   *const objsht[NUMOFOBJECTS] = {
    130   1.1       cgd 	"knife",
    131   1.1       cgd 	"fine sword",
    132  1.15       jsm 	NULL,			/* Can land from here. */
    133   1.1       cgd 	"Woodsman",
    134   1.1       cgd 	"two-handed sword",
    135   1.1       cgd 	"meat cleaver",
    136   1.1       cgd 	"broadsword",
    137   1.1       cgd 	"coat of mail",
    138   1.1       cgd 	"plumed helmet",
    139   1.1       cgd 	"shield",
    140   1.1       cgd 	"maid's body",
    141   1.1       cgd 	"viper",
    142   1.1       cgd 	"lantern",
    143   1.1       cgd 	"shoes",
    144  1.15       jsm 	NULL,			/* Cylon. */
    145   1.1       cgd 	"pajamas",
    146   1.1       cgd 	"robe",
    147   1.1       cgd 	"amulet",
    148   1.1       cgd 	"medallion",
    149   1.1       cgd 	"talisman",
    150   1.1       cgd 	"woodsman's body",
    151   1.1       cgd 	"wooden mallet",
    152   1.1       cgd 	"laser",
    153  1.15       jsm 	NULL,			/* Bathing goddess. */
    154  1.15       jsm 	NULL,			/* Goddess. */
    155   1.1       cgd 	"grenade",
    156   1.1       cgd 	"chain",
    157   1.1       cgd 	"rope",
    158   1.1       cgd 	"levis",
    159   1.1       cgd 	"mace",
    160   1.1       cgd 	"shovel",
    161   1.1       cgd 	"halberd",
    162   1.1       cgd 	"compass",
    163  1.15       jsm 	NULL,			/* Crash debris. */
    164   1.1       cgd 	"Elf",
    165  1.15       jsm 	NULL,			/* Footsteps. */
    166   1.1       cgd 	"coins",
    167   1.1       cgd 	"match book",
    168  1.15       jsm 	NULL,			/* Man and dwarf. */
    169   1.1       cgd 	"papayas",
    170   1.1       cgd 	"pineapple",
    171   1.1       cgd 	"kiwi",
    172   1.1       cgd 	"coconuts",
    173   1.1       cgd 	"mango",
    174   1.1       cgd 	"ring",
    175   1.1       cgd 	"potion",
    176   1.1       cgd 	"bracelet",
    177  1.15       jsm 	NULL,			/* Swarthy woman. */
    178  1.15       jsm 	NULL,			/* Swarthy woman (with message). */
    179   1.1       cgd 	"Dark Lord",
    180  1.15       jsm 	NULL,			/* Old-timer. */
    181  1.15       jsm 	NULL,			/* Asteroid field. */
    182  1.15       jsm 	NULL,			/* Planet nearby. */
    183  1.15       jsm 	NULL,			/* Charred ground. */
    184   1.1       cgd 	"warhead",
    185   1.1       cgd 	"goddess's body",
    186  1.10       jsm 	"old-timer's body",
    187   1.1       cgd 	"girl's body",
    188  1.15       jsm 	NULL,			/* Native girl. */
    189   1.1       cgd 	"stallion",
    190   1.1       cgd 	"car",
    191   1.1       cgd 	"pot of jewels",
    192   1.1       cgd 	"bar of gold",
    193   1.1       cgd 	"diamond block"
    194   1.1       cgd };
    195   1.1       cgd 
    196   1.7   hubertf const char   *const ouch[NUMOFINJURIES] = {
    197   1.1       cgd 	"some minor abrasions",
    198   1.1       cgd 	"some minor lacerations",
    199   1.1       cgd 	"a minor puncture wound",
    200   1.1       cgd 	"a minor amputation",
    201   1.1       cgd 	"a sprained wrist",
    202   1.1       cgd 	"a fractured ankle and shattered kneecap",
    203   1.1       cgd 	"a broken arm and dislocated shoulder",
    204   1.1       cgd 	"a few broken ribs",
    205   1.1       cgd 	"a broken leg and torn ligaments",
    206   1.1       cgd 	"a broken back and ruptured spleen",
    207   1.6     lukem 	"some deep incisions and a loss of blood",
    208   1.1       cgd 	"a fractured skull and mashed face",
    209   1.1       cgd 	"a broken neck"
    210   1.1       cgd };
    211   1.1       cgd 
    212   1.7   hubertf const int     objwt[NUMOFOBJECTS] = {
    213   1.6     lukem 	1, 5, 0, 10, 15, 2, 10, 10,
    214   1.6     lukem 	3, 5, 50, 2500, 2, 1, 100, 1,
    215   1.6     lukem 	2, 1, 1, 1, 60, 10, 5, 0,
    216   1.6     lukem 	50, 5, 15, 5, 1, 20, 10, 10,
    217   1.6     lukem 	0, 0, 0, 0, 1, 0, 0, 1,
    218   1.6     lukem 	1, 1, 2, 1, 0, 0, 0, 0,
    219   1.6     lukem 	0, 0, 100, 0, 0, 0, 55, 47,
    220   1.6     lukem 	50, 45, 45, 100, 2000, 30, 20, 10
    221   1.1       cgd };
    222   1.1       cgd 
    223   1.7   hubertf const int     objcumber[NUMOFOBJECTS] = {
    224   1.6     lukem 	1, 5, 0, 150, 10, 1, 5, 2,
    225   1.6     lukem 	2, 1, 5, 10, 1, 1, 10, 1,
    226   1.6     lukem 	1, 1, 1, 1, 7, 5, 4, 0,
    227   1.6     lukem 	0, 1, 1, 1, 1, 5, 4, 4,
    228   1.6     lukem 	1, 0, 0, 0, 1, 0, 0, 1,
    229   1.6     lukem 	1, 1, 3, 1, 0, 0, 1, 0,
    230   1.6     lukem 	0, 0, 10, 0, 0, 0, 7, 8,
    231   1.6     lukem 	10, 8, 8, 10, 10, 3, 1, 2
    232  1.14       jsm };
    233  1.14       jsm 
    234  1.14       jsm const int objflags[NUMOFOBJECTS] = {
    235  1.18       jsm 	0,		0,	    OBJ_NONOBJ,	    OBJ_PERSON,
    236  1.18       jsm 	0,		0,		0,		0,
    237  1.18       jsm 	0,		0,		0,		0,
    238  1.18       jsm 	0,	    OBJ_PLURAL,	    OBJ_NONOBJ,	    OBJ_PLURAL,
    239  1.18       jsm 	0,	      OBJ_AN,		0,		0,
    240  1.18       jsm 	0,		0,		0,	    OBJ_PERSON,
    241  1.18       jsm     OBJ_PERSON,		0,		0,		0,
    242  1.18       jsm     OBJ_PLURAL,		0,		0,		0,
    243  1.18       jsm 	0,		0,	OBJ_AN|OBJ_PERSON,  OBJ_NONOBJ,
    244  1.18       jsm     OBJ_PLURAL,		0,	    OBJ_PERSON,	    OBJ_PLURAL,
    245  1.18       jsm 	0,		0,	    OBJ_PLURAL,		0,
    246  1.18       jsm 	0,		0,		0,	    OBJ_PERSON,
    247  1.18       jsm     OBJ_PERSON,	    OBJ_PERSON,	    OBJ_PERSON,	    OBJ_NONOBJ,
    248  1.18       jsm     OBJ_NONOBJ,	    OBJ_NONOBJ,		0,		0,
    249  1.18       jsm       OBJ_AN,		0,	    OBJ_PERSON,		0,
    250  1.18       jsm 	0,		0,		0,		0
    251   1.1       cgd };
    252   1.1       cgd 
    253   1.6     lukem int     win = 1;
    254   1.6     lukem int     matchcount = 20;
    255   1.6     lukem int     followgod = -1;
    256   1.6     lukem int     followfight = -1;
    257   1.9       jsm 
    258   1.9       jsm struct room *location;
    259   1.9       jsm 
    260   1.9       jsm  /* current input line */
    261  1.13       jsm char    words[NWORD][WORDLEN];
    262   1.9       jsm int     wordvalue[NWORD];
    263   1.9       jsm int     wordtype[NWORD];
    264   1.9       jsm int     wordcount, wordnumber;
    265   1.9       jsm 
    266   1.9       jsm  /* state of the game */
    267   1.9       jsm int     ourtime;
    268   1.9       jsm int     position;
    269   1.9       jsm int     direction;
    270   1.9       jsm int     left, right, ahead, back;
    271   1.9       jsm int     fuel, torps;
    272   1.9       jsm int     carrying, encumber;
    273   1.9       jsm int     rythmn;
    274   1.9       jsm int     ate;
    275   1.9       jsm int     snooze;
    276   1.9       jsm int     meetgirl;
    277   1.9       jsm int     godready;
    278   1.9       jsm int     wintime;
    279   1.9       jsm int     wiz;
    280   1.9       jsm int     tempwiz;
    281   1.9       jsm int     matchlight;
    282   1.9       jsm int     loved;
    283   1.9       jsm int     pleasure, power, ego;
    284   1.9       jsm int     notes[NUMOFNOTES];
    285   1.9       jsm unsigned int inven[NUMOFWORDS];
    286   1.9       jsm unsigned int wear[NUMOFWORDS];
    287   1.9       jsm char    beenthere[NUMOFROOMS + 1];
    288   1.9       jsm char    injuries[NUMOFINJURIES];
    289  1.12       jsm int     verbose = 0;
    290   1.9       jsm 
    291  1.11       jsm const char *username;
    292