Home | History | Annotate | Line # | Download | only in larn
header.h revision 1.8
      1 /*	$NetBSD: header.h,v 1.8 1996/05/22 00:36:04 mrg Exp $	*/
      2 
      3 /*	header.h		Larn is copyrighted 1986 by Noah Morgan. */
      4 
      5 #include <sys/types.h>
      6 
      7 #define MAXLEVEL 11
      8 	/*	max # levels in the dungeon			*/
      9 #define MAXVLEVEL 3
     10 	/*	max # of levels in the temple of the luran	*/
     11 #define MAXX 67
     12 #define MAXY 17
     13 
     14 #define SCORESIZE 10
     15 	/*	this is the number of people on a scoreboard max */
     16 #define MAXPLEVEL 100
     17 	/*	maximum player level allowed		*/
     18 #define MAXMONST 56
     19 	/*	maximum # monsters in the dungeon	*/
     20 #define SPNUM 38
     21 	/*	maximum number of spells in existance	*/
     22 #define MAXSCROLL 28
     23 	/*	maximum number of scrolls that are possible	*/
     24 #define MAXPOTION 35
     25 	/*	maximum number of potions that are possible	*/
     26 #define TIMELIMIT 30000
     27 	/*	the maximum number of moves before the game is called */
     28 #define TAXRATE 1/20
     29 	/*	the tax rate for the LRS */
     30 #define MAXOBJ 93
     31 	/* the maximum number of objects   n < MAXOBJ */
     32 
     33 /*	this is the structure definition of the monster data	*/
     34 struct monst
     35 	{
     36 	char	*name;
     37 	char	level;
     38 	short	armorclass;
     39 	char	damage;
     40 	char	attack;
     41 	char	defense;
     42 	char	genocided;
     43 	char 	intelligence; /* monsters intelligence -- used to choose movement */
     44 	short	gold;
     45 	short	hitpoints;
     46 	unsigned long experience;
     47 	};
     48 
     49 /*	this is the structure definition for the items in the dnd store */
     50 struct _itm
     51 	{
     52 	short	price;
     53 	char	obj;
     54 	char	arg;
     55 	char	qty;
     56 	};
     57 
     58 /*	this is the structure that holds the entire dungeon specifications	*/
     59 struct cel
     60 	{
     61 	short	hitp;	/*	monster's hit points	*/
     62 	char	mitem;	/*	the monster ID			*/
     63 	char	item;	/*	the object's ID			*/
     64 	short	iarg;	/*	the object's argument	*/
     65 	char	know;	/*	have we been here before*/
     66 	};
     67 
     68 /* this is the structure for maintaining & moving the spheres of annihilation */
     69 struct sphere
     70 	{
     71 	struct sphere *p;	/* pointer to next structure */
     72 	char x,y,lev;		/* location of the sphere */
     73 	char dir;			/* direction sphere is going in */
     74 	char lifetime;		/* duration of the sphere */
     75 	};
     76 
     77 /*	defines for the character attribute array	c[]	*/
     78 #define STRENGTH 0		/* characters physical strength not due to objects */
     79 #define INTELLIGENCE 1
     80 #define WISDOM 2
     81 #define CONSTITUTION 3
     82 #define DEXTERITY 4
     83 #define CHARISMA 5
     84 #define HPMAX 6
     85 #define HP 7
     86 #define GOLD 8
     87 #define EXPERIENCE 9
     88 #define LEVEL 10
     89 #define REGEN 11
     90 #define WCLASS 12
     91 #define AC 13
     92 #define BANKACCOUNT 14
     93 #define SPELLMAX 15
     94 #define SPELLS 16
     95 #define ENERGY 17
     96 #define ECOUNTER 18
     97 #define MOREDEFENSES 19
     98 #define WEAR 20
     99 #define PROTECTIONTIME 21
    100 #define WIELD 22
    101 #define AMULET 23
    102 #define REGENCOUNTER 24
    103 #define MOREDAM 25
    104 #define DEXCOUNT 26
    105 #define STRCOUNT 27
    106 #define BLINDCOUNT 28
    107 #define CAVELEVEL 29
    108 #define CONFUSE 30
    109 #define ALTPRO 31
    110 #define HERO 32
    111 #define CHARMCOUNT 33
    112 #define INVISIBILITY 34
    113 #define CANCELLATION 35
    114 #define HASTESELF 36
    115 #define EYEOFLARN 37
    116 #define AGGRAVATE 38
    117 #define GLOBE 39
    118 #define TELEFLAG 40
    119 #define SLAYING 41
    120 #define NEGATESPIRIT 42
    121 #define SCAREMONST 43
    122 #define AWARENESS 44
    123 #define HOLDMONST 45
    124 #define TIMESTOP 46
    125 #define HASTEMONST 47
    126 #define CUBEofUNDEAD 48
    127 #define GIANTSTR 49
    128 #define FIRERESISTANCE 50
    129 #define BESSMANN 51
    130 #define NOTHEFT 52
    131 #define HARDGAME 53
    132 #define CPUTIME 54
    133 #define BYTESIN 55
    134 #define BYTESOUT 56
    135 #define MOVESMADE 57
    136 #define MONSTKILLED 58
    137 #define SPELLSCAST 59
    138 #define LANCEDEATH 60
    139 #define SPIRITPRO 61
    140 #define UNDEADPRO 62
    141 #define SHIELD 63
    142 #define STEALTH 64
    143 #define ITCHING 65
    144 #define LAUGHING 66
    145 #define DRAINSTRENGTH 67
    146 #define CLUMSINESS 68
    147 #define INFEEBLEMENT 69
    148 #define HALFDAM 70
    149 #define SEEINVISIBLE 71
    150 #define FILLROOM 72
    151 #define RANDOMWALK 73
    152 #define SPHCAST 74	/* nz if an active sphere of annihilation */
    153 #define WTW 75		/* walk through walls */
    154 #define STREXTRA 76	/* character strength due to objects or enchantments */
    155 #define TMP 77	/* misc scratch space */
    156 #define LIFEPROT 78 /* life protection counter */
    157 
    158 /*	defines for the objects in the game		*/
    159 
    160 #define OALTAR 1
    161 #define OTHRONE 2
    162 #define OORB 3
    163 #define OPIT 4
    164 #define OSTAIRSUP 5
    165 #define OELEVATORUP 6
    166 #define OFOUNTAIN 7
    167 #define OSTATUE 8
    168 #define OTELEPORTER 9
    169 #define OSCHOOL 10
    170 #define OMIRROR 11
    171 #define ODNDSTORE 12
    172 #define OSTAIRSDOWN 13
    173 #define OELEVATORDOWN 14
    174 #define OBANK2 15
    175 #define OBANK 16
    176 #define ODEADFOUNTAIN 17
    177 #define OMAXGOLD 70
    178 #define OGOLDPILE 18
    179 #define OOPENDOOR 19
    180 #define OCLOSEDDOOR 20
    181 #define OWALL 21
    182 #define OTRAPARROW 66
    183 #define OTRAPARROWIV 67
    184 
    185 #define OLARNEYE 22
    186 
    187 #define OPLATE 23
    188 #define OCHAIN 24
    189 #define OLEATHER 25
    190 #define ORING 60
    191 #define OSTUDLEATHER 61
    192 #define OSPLINT 62
    193 #define OPLATEARMOR 63
    194 #define OSSPLATE 64
    195 #define OSHIELD 68
    196 #define OELVENCHAIN 92
    197 
    198 #define OSWORDofSLASHING 26
    199 #define OHAMMER 27
    200 #define OSWORD 28
    201 #define O2SWORD 29
    202 #define OSPEAR 30
    203 #define ODAGGER 31
    204 #define OBATTLEAXE 57
    205 #define OLONGSWORD 58
    206 #define OFLAIL 59
    207 #define OLANCE 65
    208 #define OVORPAL 90
    209 #define OSLAYER 91
    210 
    211 #define ORINGOFEXTRA 32
    212 #define OREGENRING 33
    213 #define OPROTRING 34
    214 #define OENERGYRING 35
    215 #define ODEXRING 36
    216 #define OSTRRING 37
    217 #define OCLEVERRING 38
    218 #define ODAMRING 39
    219 
    220 #define OBELT 40
    221 
    222 #define OSCROLL 41
    223 #define OPOTION 42
    224 #define OBOOK 43
    225 #define OCHEST 44
    226 #define OAMULET 45
    227 
    228 #define OORBOFDRAGON 46
    229 #define OSPIRITSCARAB 47
    230 #define OCUBEofUNDEAD 48
    231 #define ONOTHEFT 49
    232 
    233 #define ODIAMOND 50
    234 #define ORUBY 51
    235 #define OEMERALD 52
    236 #define OSAPPHIRE 53
    237 
    238 #define OENTRANCE 54
    239 #define OVOLDOWN 55
    240 #define OVOLUP 56
    241 #define OHOME 69
    242 
    243 #define OKGOLD 71
    244 #define ODGOLD 72
    245 #define OIVDARTRAP 73
    246 #define ODARTRAP 74
    247 #define OTRAPDOOR 75
    248 #define OIVTRAPDOOR 76
    249 #define OTRADEPOST 77
    250 #define OIVTELETRAP 78
    251 #define ODEADTHRONE 79
    252 #define OANNIHILATION 80		/* sphere of annihilation */
    253 #define OTHRONE2 81
    254 #define OLRS 82				/* Larn Revenue Service */
    255 #define OCOOKIE 83
    256 #define OURN 84
    257 #define OBRASSLAMP 85
    258 #define OHANDofFEAR 86		/* hand of fear */
    259 #define OSPHTAILSMAN 87		/* tailsman of the sphere */
    260 #define OWWAND 88			/* wand of wonder */
    261 #define OPSTAFF 89			/* staff of power */
    262 /* used up to 92 */
    263 
    264 /*	defines for the monsters as objects		*/
    265 
    266 #define BAT 1
    267 #define GNOME 2
    268 #define HOBGOBLIN 3
    269 #define JACKAL 4
    270 #define KOBOLD 5
    271 #define ORC 6
    272 #define SNAKE 7
    273 #define CENTIPEDE 8
    274 #define JACULI 9
    275 #define TROGLODYTE 10
    276 #define ANT 11
    277 #define EYE 12
    278 #define LEPRECHAUN 13
    279 #define NYMPH 14
    280 #define QUASIT 15
    281 #define RUSTMONSTER 16
    282 #define ZOMBIE 17
    283 #define ASSASSINBUG 18
    284 #define BUGBEAR 19
    285 #define HELLHOUND 20
    286 #define ICELIZARD 21
    287 #define CENTAUR 22
    288 #define TROLL 23
    289 #define YETI 24
    290 #define WHITEDRAGON 25
    291 #define ELF 26
    292 #define CUBE 27
    293 #define METAMORPH 28
    294 #define VORTEX 29
    295 #define ZILLER 30
    296 #define VIOLETFUNGI 31
    297 #define WRAITH 32
    298 #define FORVALAKA 33
    299 #define LAMANOBE 34
    300 #define OSEQUIP 35
    301 #define ROTHE 36
    302 #define XORN 37
    303 #define VAMPIRE 38
    304 #define INVISIBLESTALKER 39
    305 #define POLTERGEIST 40
    306 #define DISENCHANTRESS 41
    307 #define SHAMBLINGMOUND 42
    308 #define YELLOWMOLD 43
    309 #define UMBERHULK 44
    310 #define GNOMEKING 45
    311 #define MIMIC 46
    312 #define WATERLORD 47
    313 #define BRONZEDRAGON 48
    314 #define GREENDRAGON 49
    315 #define PURPLEWORM 50
    316 #define XVART 51
    317 #define SPIRITNAGA 52
    318 #define SILVERDRAGON 53
    319 #define PLATINUMDRAGON 54
    320 #define GREENURCHIN 55
    321 #define REDDRAGON 56
    322 #define DEMONLORD 57
    323 #define DEMONPRINCE 64
    324 
    325 #define NULL 0
    326 #define BUFBIG	4096			/* size of the output buffer */
    327 #define MAXIBUF	4096			/* size of the input buffer */
    328 #define LOGNAMESIZE 40			/* max size of the players name */
    329 #define PSNAMESIZE 40			/* max size of the process name */
    330 
    331 #ifndef NODEFS
    332 extern char VERSION,SUBVERSION;
    333 extern char aborted[],alpha[],beenhere[],boldon,cheat,ckpfile[],ckpflag;
    334 extern char *class[],course[],diagfile[],helpfile[];
    335 extern char *inbuffer,is_alpha[],is_digit[];
    336 extern char item[MAXX][MAXY],iven[],know[MAXX][MAXY],larnlevels[],lastmonst[];
    337 extern char level,*levelname[],logfile[],loginname[],logname[],*lpbuf,*lpend;
    338 extern char *lpnt,moved[MAXX][MAXY],mitem[MAXX][MAXY],monstlevel[];
    339 extern char monstnamelist[],nch[],ndgg[],nlpts[],nomove,nosignal,nowelcome;
    340 extern char nplt[],nsw[],*objectname[],objnamelist[],optsfile[];
    341 extern char *potionhide[],*potionname[],playerids[],potprob[];
    342 extern char predostuff,psname[],restorflag,savefilename[],scorefile[],scprob[];
    343 extern char screen[MAXX][MAXY],*scrollhide[],*scrollname[],sex,*spelcode[];
    344 extern char *speldescript[];
    345 extern char spelknow[],*spelname[],*spelmes[],spelweird[MAXMONST+8][SPNUM];
    346 extern char splev[],stealth[MAXX][MAXY],to_lower[],to_upper[],wizard;
    347 extern short diroffx[],diroffy[],hitflag,hit2flag,hit3flag,hitp[MAXX][MAXY];
    348 extern short iarg[MAXX][MAXY],ivenarg[],lasthx,lasthy,lastnum,lastpx,lastpy;
    349 extern short nobeep,oldx,oldy,playerx,playery;
    350 extern int dayplay,enable_scroll,srcount,yrepcount,userid,wisid,lfd,fd;
    351 extern uid_t uid, euid;
    352 extern long initialtime,outstanding_taxes,skill[],gtime,c[],cbak[];
    353 extern unsigned long randx;
    354 extern struct cel *cell;
    355 extern struct monst monster[];
    356 extern struct sphere *spheres;
    357 extern struct _itm itm[];
    358 
    359 char *fortune(),*getenv(),*getlogin(),*lgetw(),*lgetl(),*ctime();
    360 char *tmcapcnv(),*tgetstr(),*tgoto();
    361 long paytaxes(),lgetc(),lrint();
    362 unsigned long readnum();
    363 void *malloc();
    364 
    365 	/* macro to create scroll #'s with probability of occurrence */
    366 #define newscroll() (scprob[rund(81)])
    367 	/* macro to return a potion # created with probability of occurrence */
    368 #define newpotion() (potprob[rund(41)])
    369 	/* macro to return the + points on created leather armor */
    370 #define newleather() (nlpts[rund(c[HARDGAME]?13:15)])
    371 	/* macro to return the + points on chain armor */
    372 #define newchain() (nch[rund(10)])
    373 	/* macro to return + points on plate armor */
    374 #define newplate() (nplt[rund(c[HARDGAME]?4:12)])
    375 	/* macro to return + points on new daggers */
    376 #define newdagger() (ndgg[rund(13)])
    377 	/* macro to return + points on new swords */
    378 #define newsword() (nsw[rund(c[HARDGAME]?6:13)])
    379 	/* macro to destroy object at present location */
    380 #define forget() (item[playerx][playery]=know[playerx][playery]=0)
    381 	/* macro to wipe out a monster at a location */
    382 #define disappear(x,y) (mitem[x][y]=know[x][y]=0)
    383 
    384 #ifdef VT100
    385 	/* macro to turn on bold display for the terminal */
    386 #define setbold() (lprcat(boldon?"\33[1m":"\33[7m"))
    387 	/* macro to turn off bold display for the terminal */
    388 #define resetbold() (lprcat("\33[m"))
    389 	/* macro to setup the scrolling region for the terminal */
    390 #define setscroll() (lprcat("\33[20;24r"))
    391 	/* macro to clear the scrolling region for the terminal */
    392 #define resetscroll() (lprcat("\33[;24r"))
    393 	/* macro to clear the screen and home the cursor */
    394 #define clear() (lprcat("\33[2J\33[f"), cbak[SPELLS]= -50)
    395 #define cltoeoln() lprcat("\33[K")
    396 #else VT100
    397 	/* defines below are for use in the termcap mode only */
    398 #define ST_START 1
    399 #define ST_END   2
    400 #define BOLD     3
    401 #define END_BOLD 4
    402 #define CLEAR    5
    403 #define CL_LINE  6
    404 #define CL_DOWN 14
    405 #define CURSOR  15
    406 	/* macro to turn on bold display for the terminal */
    407 #define setbold() (*lpnt++ = ST_START)
    408 	/* macro to turn off bold display for the terminal */
    409 #define resetbold() (*lpnt++ = ST_END)
    410 	/* macro to setup the scrolling region for the terminal */
    411 #define setscroll() enable_scroll=1
    412 	/* macro to clear the scrolling region for the terminal */
    413 #define resetscroll() enable_scroll=0
    414 	/* macro to clear the screen and home the cursor */
    415 #define clear() (*lpnt++ =CLEAR, cbak[SPELLS]= -50)
    416 	/* macro to clear to end of line */
    417 #define cltoeoln() (*lpnt++ = CL_LINE)
    418 #endif VT100
    419 
    420 	/* macro to output one byte to the output buffer */
    421 #define lprc(ch) ((lpnt>=lpend)?(*lpnt++ =(ch), lflush()):(*lpnt++ =(ch)))
    422 
    423 	/* macro to seed the random number generator */
    424 #define srand(x) (randx=x)
    425 #ifdef MACRORND
    426 	/* macros to generate random numbers   1<=rnd(N)<=N   0<=rund(N)<=N-1 */
    427 #define rnd(x)  ((((randx=randx*1103515245+12345)>>7)%(x))+1)
    428 #define rund(x) ((((randx=randx*1103515245+12345)>>7)%(x))  )
    429 #endif MACRORND
    430 	/* macros for miscellaneous data conversion */
    431 #define min(x,y) (((x)>(y))?(y):(x))
    432 #define max(x,y) (((x)>(y))?(x):(y))
    433 #define isalpha(x) (is_alpha[x])
    434 #define isdigit(x) (is_digit[x])
    435 #define tolower(x) (to_lower[x])
    436 #define toupper(x) (to_upper[x])
    437 #define lcc(x) (to_lower[x])
    438 #define ucc(x) (to_upper[x])
    439 #endif NODEFS
    440 
    441