1 /* header.h Larn is copyrighted 1986 by Noah Morgan. */
10 /* max # levels in the dungeon */
12 /* max # of levels in the temple of the luran */
17 /* this is the number of people on a scoreboard max */
19 /* maximum player level allowed */
21 /* maximum # monsters in the dungeon */
23 /* maximum number of spells in existance */
25 /* maximum number of scrolls that are possible */
27 /* maximum number of potions that are possible */
28 #define TIMELIMIT 30000
29 /* the maximum number of moves before the game is called */
31 /* the tax rate for the LRS */
33 /* the maximum number of objects n < MAXOBJ */
35 /* this is the structure definition of the monster data */
45 char intelligence; /* monsters intelligence -- used to choose movement */
48 unsigned long experience;
51 /* this is the structure definition for the items in the dnd store */
61 /* this is the structure that holds the entire dungeon specifications */
64 short hitp; /* monster's hit points */
65 char mitem; /* the monster ID */
66 char item; /* the object's ID */
67 short iarg; /* the object's argument */
68 char know; /* have we been here before*/
71 /* this is the structure for maintaining & moving the spheres of annihilation */
74 struct sphere *p; /* pointer to next structure */
75 char x,y,lev; /* location of the sphere */
76 char dir; /* direction sphere is going in */
77 char lifetime; /* duration of the sphere */
80 /* defines for the character attribute array c[] */
81 #define STRENGTH 0 /* characters physical strength not due to objects */
82 #define INTELLIGENCE 1
84 #define CONSTITUTION 3
95 #define BANKACCOUNT 14
100 #define MOREDEFENSES 19
102 #define PROTECTIONTIME 21
105 #define REGENCOUNTER 24
109 #define BLINDCOUNT 28
114 #define CHARMCOUNT 33
115 #define INVISIBILITY 34
116 #define CANCELLATION 35
123 #define NEGATESPIRIT 42
124 #define SCAREMONST 43
128 #define HASTEMONST 47
129 #define CUBEofUNDEAD 48
131 #define FIRERESISTANCE 50
139 #define MONSTKILLED 58
140 #define SPELLSCAST 59
141 #define LANCEDEATH 60
148 #define DRAINSTRENGTH 67
149 #define CLUMSINESS 68
150 #define INFEEBLEMENT 69
152 #define SEEINVISIBLE 71
154 #define RANDOMWALK 73
155 #define SPHCAST 74 /* nz if an active sphere of annihilation */
156 #define WTW 75 /* walk through walls */
157 #define STREXTRA 76 /* character strength due to objects or enchantments */
158 #define TMP 77 /* misc scratch space */
159 #define LIFEPROT 78 /* life protection counter */
161 /* defines for the objects in the game */
168 #define OELEVATORUP 6
171 #define OTELEPORTER 9
175 #define OSTAIRSDOWN 13
176 #define OELEVATORDOWN 14
179 #define ODEADFOUNTAIN 17
183 #define OCLOSEDDOOR 20
185 #define OTRAPARROW 66
186 #define OTRAPARROWIV 67
194 #define OSTUDLEATHER 61
196 #define OPLATEARMOR 63
199 #define OELVENCHAIN 92
201 #define OSWORDofSLASHING 26
207 #define OBATTLEAXE 57
208 #define OLONGSWORD 58
214 #define ORINGOFEXTRA 32
215 #define OREGENRING 33
217 #define OENERGYRING 35
220 #define OCLEVERRING 38
231 #define OORBOFDRAGON 46
232 #define OSPIRITSCARAB 47
233 #define OCUBEofUNDEAD 48
248 #define OIVDARTRAP 73
251 #define OIVTRAPDOOR 76
252 #define OTRADEPOST 77
253 #define OIVTELETRAP 78
254 #define ODEADTHRONE 79
255 #define OANNIHILATION 80 /* sphere of annihilation */
257 #define OLRS 82 /* Larn Revenue Service */
260 #define OBRASSLAMP 85
261 #define OHANDofFEAR 86 /* hand of fear */
262 #define OSPHTAILSMAN 87 /* tailsman of the sphere */
263 #define OWWAND 88 /* wand of wonder */
264 #define OPSTAFF 89 /* staff of power */
267 /* defines for the monsters as objects */
278 #define TROGLODYTE 10
281 #define LEPRECHAUN 13
284 #define RUSTMONSTER 16
286 #define ASSASSINBUG 18
293 #define WHITEDRAGON 25
299 #define VIOLETFUNGI 31
307 #define INVISIBLESTALKER 39
308 #define POLTERGEIST 40
309 #define DISENCHANTRESS 41
310 #define SHAMBLINGMOUND 42
311 #define YELLOWMOLD 43
316 #define BRONZEDRAGON 48
317 #define GREENDRAGON 49
318 #define PURPLEWORM 50
320 #define SPIRITNAGA 52
321 #define SILVERDRAGON 53
322 #define PLATINUMDRAGON 54
323 #define GREENURCHIN 55
326 #define DEMONPRINCE 64
329 #define BUFBIG 4096 /* size of the output buffer */
330 #define MAXIBUF 4096 /* size of the input buffer */
331 #define LOGNAMESIZE 40 /* max size of the players name */
332 #define PSNAMESIZE 40 /* max size of the process name */
335 extern char VERSION,SUBVERSION;
336 extern char aborted[],alpha[],beenhere[],boldon,cheat,ckpfile[],ckpflag;
337 extern char *class[],course[],diagfile[],fortfile[],helpfile[];
338 extern char *inbuffer,is_alpha[],is_digit[];
339 extern char item[MAXX][MAXY],iven[],know[MAXX][MAXY],larnlevels[],lastmonst[];
340 extern char level,*levelname[],logfile[],loginname[],logname[],*lpbuf,*lpend;
341 extern char *lpnt,moved[MAXX][MAXY],mitem[MAXX][MAXY],monstlevel[];
342 extern char monstnamelist[],nch[],ndgg[],nlpts[],nomove,nosignal,nowelcome;
343 extern char nplt[],nsw[],*objectname[];
344 extern char objnamelist[],optsfile[],*potionname[],playerids[],potprob[];
345 extern char predostuff,psname[],restorflag,savefilename[],scorefile[],scprob[];
346 extern char screen[MAXX][MAXY],*scrollname[],sex,*spelcode[],*speldescript[];
347 extern char spelknow[],*spelname[],*spelmes[],spelweird[MAXMONST+8][SPNUM];
348 extern char splev[],stealth[MAXX][MAXY],to_lower[],to_upper[],wizard;
349 extern short diroffx[],diroffy[],hitflag,hit2flag,hit3flag,hitp[MAXX][MAXY];
350 extern short iarg[MAXX][MAXY],ivenarg[],lasthx,lasthy,lastnum,lastpx,lastpy;
351 extern short nobeep,oldx,oldy,playerx,playery;
352 extern int dayplay,enable_scroll,srcount,yrepcount,userid,wisid,lfd,fd;
353 extern time_t initialtime;
354 extern long outstanding_taxes,skill[],gtime,c[],cbak[];
355 extern struct cel *cell;
356 extern struct monst monster[];
357 extern struct sphere *spheres;
358 extern struct _itm itm[];
360 char *fortune(),*lgetw(),*lgetl();
362 long paytaxes(),lgetc(),lrint();
363 unsigned long readnum();
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)
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")
397 /* defines below are for use in the termcap mode only */
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)
420 /* macro to output one byte to the output buffer */
421 #define lprc(ch) ((lpnt>=lpend)?(*lpnt++ =(ch), lflush()):(*lpnt++ =(ch)))
424 extern unsigned long randx;
425 /* macro to seed the random number generator */
426 #define srand(x) (randx=x)
427 /* macros to generate random numbers 1<=rnd(N)<=N 0<=rund(N)<=N-1 */
428 #define rnd(x) ((((randx=randx*1103515245+12345)>>7)%(x))+1)
429 #define rund(x) ((((randx=randx*1103515245+12345)>>7)%(x)) )
431 /* macros for miscellaneous data conversion */
432 #define min(x,y) (((x)>(y))?(y):(x))
433 #define max(x,y) (((x)>(y))?(x):(y))
434 #define isalpha(x) (is_alpha[x])
435 #define isdigit(x) (is_digit[x])
436 #define tolower(x) (to_lower[x])
437 #define toupper(x) (to_upper[x])
438 #define lcc(x) (to_lower[x])
439 #define ucc(x) (to_upper[x])