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