1 /* header.h Larn is copyrighted 1986 by Noah Morgan. */
12 /* max # levels in the dungeon */
14 /* max # of levels in the temple of the luran */
19 /* this is the number of people on a scoreboard max */
21 /* maximum player level allowed */
23 /* maximum # monsters in the dungeon */
25 /* maximum number of spells in existence */
27 /* maximum number of scrolls that are possible */
29 /* maximum number of potions that are possible */
30 #define TIMELIMIT 30000
31 /* the maximum number of moves before the game is called */
33 /* the tax rate for the LRS */
35 /* the maximum number of objects n < MAXOBJ */
37 /* this is the structure definition of the monster data */
46 char intelligence
; /* monsters intelligence -- used to choose movement */
49 unsigned long experience
;
52 /* this is the structure definition for the items in the dnd store */
60 /* this is the structure that holds the entire dungeon specifications */
62 short hitp
; /* monster's hit points */
63 char mitem
; /* the monster ID */
64 char item
; /* the object's ID */
65 short iarg
; /* the object's argument */
66 char know
; /* have we been here before */
69 /* this is the structure for maintaining & moving the spheres of annihilation */
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 */
77 /* defines for the character attribute array c[] */
78 #define STRENGTH 0 /* characters physical strength not due to objects */
79 #define INTELLIGENCE 1
81 #define CONSTITUTION 3
92 #define BANKACCOUNT 14
97 #define MOREDEFENSES 19
99 #define PROTECTIONTIME 21
102 #define REGENCOUNTER 24
106 #define BLINDCOUNT 28
111 #define CHARMCOUNT 33
112 #define INVISIBILITY 34
113 #define CANCELLATION 35
120 #define NEGATESPIRIT 42
121 #define SCAREMONST 43
125 #define HASTEMONST 47
126 #define CUBEofUNDEAD 48
128 #define FIRERESISTANCE 50
136 #define MONSTKILLED 58
137 #define SPELLSCAST 59
138 #define LANCEDEATH 60
145 #define DRAINSTRENGTH 67
146 #define CLUMSINESS 68
147 #define INFEEBLEMENT 69
149 #define SEEINVISIBLE 71
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 */
158 /* defines for the objects in the game */
165 #define OELEVATORUP 6
168 #define OTELEPORTER 9
172 #define OSTAIRSDOWN 13
173 #define OELEVATORDOWN 14
176 #define ODEADFOUNTAIN 17
180 #define OCLOSEDDOOR 20
182 #define OTRAPARROW 66
183 #define OTRAPARROWIV 67
191 #define OSTUDLEATHER 61
193 #define OPLATEARMOR 63
196 #define OELVENCHAIN 92
198 #define OSWORDofSLASHING 26
204 #define OBATTLEAXE 57
205 #define OLONGSWORD 58
211 #define ORINGOFEXTRA 32
212 #define OREGENRING 33
214 #define OENERGYRING 35
217 #define OCLEVERRING 38
228 #define OORBOFDRAGON 46
229 #define OSPIRITSCARAB 47
230 #define OCUBEofUNDEAD 48
245 #define OIVDARTRAP 73
248 #define OIVTRAPDOOR 76
249 #define OTRADEPOST 77
250 #define OIVTELETRAP 78
251 #define ODEADTHRONE 79
252 #define OANNIHILATION 80 /* sphere of annihilation */
254 #define OLRS 82 /* Larn Revenue Service */
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 */
264 /* defines for the monsters as objects */
275 #define TROGLODYTE 10
278 #define LEPRECHAUN 13
281 #define RUSTMONSTER 16
283 #define ASSASSINBUG 18
290 #define WHITEDRAGON 25
296 #define VIOLETFUNGI 31
304 #define INVISIBLESTALKER 39
305 #define POLTERGEIST 40
306 #define DISENCHANTRESS 41
307 #define SHAMBLINGMOUND 42
308 #define YELLOWMOLD 43
313 #define BRONZEDRAGON 48
314 #define GREENDRAGON 49
315 #define PURPLEWORM 50
317 #define SPIRITNAGA 52
318 #define SILVERDRAGON 53
319 #define PLATINUMDRAGON 54
320 #define GREENURCHIN 55
323 #define DEMONPRINCE 64
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 */
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
[];
340 extern char objnamelist
[], optsfile
[], playerids
[], potprob
[];
341 extern char predostuff
, psname
[], restorflag
, savefilename
[], scorefile
[], scprob
[];
342 extern char screen
[MAXX
][MAXY
], sex
, *spelcode
[], *speldescript
[];
343 extern char spelknow
[], *spelname
[], *spelmes
[], spelweird
[MAXMONST
+ 8][SPNUM
];
344 extern char splev
[], stealth
[MAXX
][MAXY
], to_lower
[], to_upper
[], wizard
;
345 extern short diroffx
[], diroffy
[], hitflag
, hit2flag
, hit3flag
, hitp
[MAXX
][MAXY
];
346 extern short iarg
[MAXX
][MAXY
], ivenarg
[], lasthx
, lasthy
, lastnum
, lastpx
, lastpy
;
347 extern short nobeep
, oldx
, oldy
, playerx
, playery
;
348 extern int dayplay
, enable_scroll
, srcount
, yrepcount
, userid
, wisid
,
350 extern time_t initialtime
;
351 extern long outstanding_taxes
, skill
[], gtime
, c
[], cbak
[];
352 extern struct cel
*cell
;
353 extern struct monst monster
[];
354 extern struct sphere
*spheres
;
355 extern struct _itm itm_
[];
356 extern const char *potionhide
[], *potionname
[], *scrollhide
[], *scrollname
[];
359 void mailbill(void) __dead2
;
362 void makeplayer(void);
363 void newcavelevel(int);
371 int savegame(char *);
372 void restoregame(char *);
375 void bottomline(void);
377 void bottomspell(void);
379 void bot_linex(void);
380 void bottomgold(void);
381 void draws(int, int, int, int);
382 void drawscreen(void);
383 void showcell(int, int);
384 void show1cell(int, int);
385 void showplayer(void);
390 const char *fortune(void);
393 void raiselevel(void);
394 void loselevel(void);
395 void raiseexperience(long);
396 void loseexperience(long);
401 void raisemspells(int);
402 void losemspells(int);
404 void positionplayer(void);
409 int drop_object(int);
410 void enchantarmor(void);
411 void enchweapon(void);
412 int pocketfull(void);
413 int nearbymonst(void);
414 int stealsomething(void);
415 int emptyhanded(void);
416 void creategem(void);
417 void adjustcvalues(int, int);
418 int getpassword(void);
420 int packweight(void);
431 void setupvt100(void);
432 void clearvt100(void);
437 void lprintf(const char *, ...);
439 void lwrite(char *, int);
442 void lrfill(char *, int);
450 void lprcat(const char *);
451 void cursor(int, int);
454 void init_term(void);
456 void cl_line(int, int);
457 void cl_up(int, int);
458 void cl_dn(int, int);
459 void standout(const char *);
460 void set_score_output(void);
463 char *tmcapcnv(char *, char *);
471 unsigned long readnum(long);
474 void createmonster(int);
475 void createitem(int, int);
477 void godirect(int, int, const char *, int, char);
478 int vxy(int *, int *);
479 void hitmonster(int, int);
480 int hitm(int, int, int);
481 void hitplayer(int, int);
484 int newobject(int, int *);
486 long annihilate(void);
487 long newsphere(int, int, int, int);
488 long rmsphere(int, int);
493 void odeadthrone(void);
495 void ofountain(void);
498 void movemonst(void);
504 void lookforobject(void);
506 void quaffpotion(int);
507 void larn_adjtime(long);
508 void read_scroll(int);
517 void savelevel(void);
524 void showscores(void);
525 void showallscores(void);
540 void ointerest(void);
541 void otradepost(void);
550 /* macro to create scroll #'s with probability of occurrence */
551 #define newscroll() (scprob[rund(81)])
552 /* macro to return a potion # created with probability of occurrence */
553 #define newpotion() (potprob[rund(41)])
554 /* macro to return the + points on created leather armor */
555 #define newleather() (nlpts[rund(c[HARDGAME]?13:15)])
556 /* macro to return the + points on chain armor */
557 #define newchain() (nch[rund(10)])
558 /* macro to return + points on plate armor */
559 #define newplate() (nplt[rund(c[HARDGAME]?4:12)])
560 /* macro to return + points on new daggers */
561 #define newdagger() (ndgg[rund(13)])
562 /* macro to return + points on new swords */
563 #define newsword() (nsw[rund(c[HARDGAME]?6:13)])
564 /* macro to destroy object at present location */
565 #define forget() (item[playerx][playery]=know[playerx][playery]=0)
566 /* macro to wipe out a monster at a location */
567 #define disappear(x,y) (mitem[x][y]=know[x][y]=0)
570 /* macro to turn on bold display for the terminal */
571 #define setbold() (lprcat(boldon?"\33[1m":"\33[7m"))
572 /* macro to turn off bold display for the terminal */
573 #define resetbold() (lprcat("\33[m"))
574 /* macro to setup the scrolling region for the terminal */
575 #define setscroll() (lprcat("\33[20;24r"))
576 /* macro to clear the scrolling region for the terminal */
577 #define resetscroll() (lprcat("\33[;24r"))
578 /* macro to clear the screen and home the cursor */
579 #define clear() (lprcat("\33[2J\33[f"), cbak[SPELLS]= -50)
580 #define cltoeoln() lprcat("\33[K")
582 /* defines below are for use in the termcap mode only */
591 /* macro to turn on bold display for the terminal */
592 #define setbold() (*lpnt++ = ST_START)
593 /* macro to turn off bold display for the terminal */
594 #define resetbold() (*lpnt++ = ST_END)
595 /* macro to setup the scrolling region for the terminal */
596 #define setscroll() enable_scroll=1
597 /* macro to clear the scrolling region for the terminal */
598 #define resetscroll() enable_scroll=0
599 /* macro to clear the screen and home the cursor */
600 #define clear() (*lpnt++ =CLEAR, cbak[SPELLS]= -50)
601 /* macro to clear to end of line */
602 #define cltoeoln() (*lpnt++ = CL_LINE)
605 /* macro to output one byte to the output buffer */
606 #define lprc(ch) ((lpnt>=lpend)?(*lpnt++ =(ch), lflush()):(*lpnt++ = (ch)))
609 extern unsigned long randx
;
610 /* macro to seed the random number generator */
611 #define srand(x) (randx=x)
612 /* macros to generate random numbers 1<=rnd(N)<=N 0<=rund(N)<=N-1 */
613 #define rnd(x) ((((randx=randx*1103515245+12345)>>7)%(x))+1)
614 #define rund(x) ((((randx=randx*1103515245+12345)>>7)%(x)) )
615 #endif /* MACRORND */
616 /* macros for miscellaneous data conversion */
617 #define min(x,y) (((x)>(y))?(y):(x))
618 #define max(x,y) (((x)>(y))?(x):(y))
619 #define isalpha(x) (is_alpha[x])
620 #define isdigit(x) (is_digit[x])
621 #define tolower(x) (to_lower[x])
622 #define toupper(x) (to_upper[x])
623 #define lcc(x) (to_lower[x])
624 #define ucc(x) (to_upper[x])