]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - larn/header.h
1 /* $NetBSD: header.h,v 1.11 1997/10/18 20:03:22 christos Exp $ */
3 /* header.h Larn is copyrighted 1986 by Noah Morgan. */
8 /* max # levels in the dungeon */
10 /* max # of levels in the temple of the luran */
15 /* this is the number of people on a scoreboard max */
17 /* maximum player level allowed */
19 /* maximum # monsters in the dungeon */
21 /* maximum number of spells in existance */
23 /* maximum number of scrolls that are possible */
25 /* maximum number of potions that are possible */
26 #define TIMELIMIT 30000
27 /* the maximum number of moves before the game is called */
29 /* the tax rate for the LRS */
31 /* the maximum number of objects n < MAXOBJ */
33 /* this is the structure definition of the monster data */
42 char intelligence
; /* monsters intelligence -- used to
46 unsigned long experience
;
49 /* this is the structure definition for the items in the dnd store */
57 /* this is the structure that holds the entire dungeon specifications */
59 short hitp
; /* monster's hit points */
60 char mitem
; /* the monster ID */
61 char item
; /* the object's ID */
62 short iarg
; /* the object's argument */
63 char know
; /* have we been here before */
66 /* this is the structure for maintaining & moving the spheres of annihilation */
68 struct sphere
*p
; /* pointer to next structure */
69 char x
, y
, lev
; /* location of the sphere */
70 char dir
; /* direction sphere is going in */
71 short lifetime
; /* duration of the sphere */
74 /* defines for the character attribute array c[] */
75 #define STRENGTH 0 /* characters physical strength not due to
77 #define INTELLIGENCE 1
79 #define CONSTITUTION 3
90 #define BANKACCOUNT 14
95 #define MOREDEFENSES 19
97 #define PROTECTIONTIME 21
100 #define REGENCOUNTER 24
104 #define BLINDCOUNT 28
109 #define CHARMCOUNT 33
110 #define INVISIBILITY 34
111 #define CANCELLATION 35
118 #define NEGATESPIRIT 42
119 #define SCAREMONST 43
123 #define HASTEMONST 47
124 #define CUBEofUNDEAD 48
126 #define FIRERESISTANCE 50
134 #define MONSTKILLED 58
135 #define SPELLSCAST 59
136 #define LANCEDEATH 60
143 #define DRAINSTRENGTH 67
144 #define CLUMSINESS 68
145 #define INFEEBLEMENT 69
147 #define SEEINVISIBLE 71
149 #define RANDOMWALK 73
150 #define SPHCAST 74 /* nz if an active sphere of annihilation */
151 #define WTW 75 /* walk through walls */
152 #define STREXTRA 76 /* character strength due to objects or
154 #define TMP 77 /* misc scratch space */
155 #define LIFEPROT 78 /* life protection counter */
157 /* defines for the objects in the game */
164 #define OELEVATORUP 6
167 #define OTELEPORTER 9
171 #define OSTAIRSDOWN 13
172 #define OELEVATORDOWN 14
175 #define ODEADFOUNTAIN 17
179 #define OCLOSEDDOOR 20
181 #define OTRAPARROW 66
182 #define OTRAPARROWIV 67
190 #define OSTUDLEATHER 61
192 #define OPLATEARMOR 63
195 #define OELVENCHAIN 92
197 #define OSWORDofSLASHING 26
203 #define OBATTLEAXE 57
204 #define OLONGSWORD 58
210 #define ORINGOFEXTRA 32
211 #define OREGENRING 33
213 #define OENERGYRING 35
216 #define OCLEVERRING 38
227 #define OORBOFDRAGON 46
228 #define OSPIRITSCARAB 47
229 #define OCUBEofUNDEAD 48
244 #define OIVDARTRAP 73
247 #define OIVTRAPDOOR 76
248 #define OTRADEPOST 77
249 #define OIVTELETRAP 78
250 #define ODEADTHRONE 79
251 #define OANNIHILATION 80 /* sphere of annihilation */
253 #define OLRS 82 /* Larn Revenue Service */
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 */
263 /* defines for the monsters as objects */
274 #define TROGLODYTE 10
277 #define LEPRECHAUN 13
280 #define RUSTMONSTER 16
282 #define ASSASSINBUG 18
289 #define WHITEDRAGON 25
295 #define VIOLETFUNGI 31
303 #define INVISIBLESTALKER 39
304 #define POLTERGEIST 40
305 #define DISENCHANTRESS 41
306 #define SHAMBLINGMOUND 42
307 #define YELLOWMOLD 43
312 #define BRONZEDRAGON 48
313 #define GREENDRAGON 49
314 #define PURPLEWORM 50
316 #define SPIRITNAGA 52
317 #define SILVERDRAGON 53
318 #define PLATINUMDRAGON 54
319 #define GREENURCHIN 55
322 #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 u_char alpha
[], beenhere
[], boldon
, cheat
, ckpflag
;
333 extern u_char
*class[], course
[];
334 extern char diagfile
[], helpfile
[], ckpfile
[], larnlevels
[],
335 playerids
[], optsfile
[], psname
[], savefilename
[],
337 extern u_char
*inbuffer
, is_alpha
[], is_digit
[];
338 extern u_char item
[MAXX
][MAXY
], iven
[], know
[MAXX
][MAXY
];
339 extern char *levelname
[], logfile
[], loginname
[], logname
[],
341 extern u_char
*lpbuf
, *lpend
;
342 extern u_char
*lpnt
, moved
[MAXX
][MAXY
], mitem
[MAXX
][MAXY
], monstlevel
[];
343 extern char monstnamelist
[], objnamelist
[];
344 extern u_char nch
[], ndgg
[], nlpts
[], nomove
, nosignal
, nowelcome
;
345 extern u_char nplt
[], nsw
[];
346 extern char *objectname
[], *potionhide
[], *potionname
[],
347 *spelcode
[], *spelname
[], *spelmes
[], aborted
[],
348 spelweird
[MAXMONST
+ 8][SPNUM
];
349 extern u_char potprob
[];
350 extern u_char predostuff
, restorflag
, scprob
[];
351 extern u_char screen
[MAXX
][MAXY
], sex
;
352 extern char *speldescript
[], *scrollhide
[], *scrollname
[];
353 extern u_char spelknow
[];
354 extern u_char splev
[], stealth
[MAXX
][MAXY
], to_lower
[], to_upper
[], wizard
;
355 extern short diroffx
[], diroffy
[], hitflag
, hit2flag
, hit3flag
, hitp
[MAXX
][MAXY
];
356 extern short iarg
[MAXX
][MAXY
], ivenarg
[], lasthx
, lasthy
, lastnum
, lastpx
,
358 extern short nobeep
, oldx
, oldy
, playerx
, playery
, level
;
359 extern int dayplay
, enable_scroll
, srcount
, yrepcount
, userid
, wisid
,
361 extern uid_t uid
, euid
;
362 extern long initialtime
, outstanding_taxes
, skill
[], gltime
, c
[], cbak
[];
363 extern unsigned long randx
;
364 extern struct cel
*cell
;
365 extern struct monst monster
[];
366 extern struct sphere
*spheres
;
367 extern struct _itm itm
[];
368 extern long initialtime
;
369 extern int rmst
, maxitm
, lasttime
;
371 /* macro to create scroll #'s with probability of occurrence */
372 #define newscroll() (scprob[rund(81)])
373 /* macro to return a potion # created with probability of occurrence */
374 #define newpotion() (potprob[rund(41)])
375 /* macro to return the + points on created leather armor */
376 #define newleather() (nlpts[rund(c[HARDGAME]?13:15)])
377 /* macro to return the + points on chain armor */
378 #define newchain() (nch[rund(10)])
379 /* macro to return + points on plate armor */
380 #define newplate() (nplt[rund(c[HARDGAME]?4:12)])
381 /* macro to return + points on new daggers */
382 #define newdagger() (ndgg[rund(13)])
383 /* macro to return + points on new swords */
384 #define newsword() (nsw[rund(c[HARDGAME]?6:13)])
385 /* macro to destroy object at present location */
386 #define forget() (item[playerx][playery]=know[playerx][playery]=0)
387 /* macro to wipe out a monster at a location */
388 #define disappear(x,y) (mitem[x][y]=know[x][y]=0)
391 /* macro to turn on bold display for the terminal */
392 #define setbold() (lprcat(boldon?"\33[1m":"\33[7m"))
393 /* macro to turn off bold display for the terminal */
394 #define resetbold() (lprcat("\33[m"))
395 /* macro to setup the scrolling region for the terminal */
396 #define setscroll() (lprcat("\33[20;24r"))
397 /* macro to clear the scrolling region for the terminal */
398 #define resetscroll() (lprcat("\33[;24r"))
399 /* macro to clear the screen and home the cursor */
400 #define clear() (lprcat("\33[2J\33[f"), cbak[SPELLS]= -50)
401 #define cltoeoln() lprcat("\33[K")
403 /* defines below are for use in the termcap mode only */
412 /* macro to turn on bold display for the terminal */
413 #define setbold() (*lpnt++ = ST_START)
414 /* macro to turn off bold display for the terminal */
415 #define resetbold() (*lpnt++ = ST_END)
416 /* macro to setup the scrolling region for the terminal */
417 #define setscroll() enable_scroll=1
418 /* macro to clear the scrolling region for the terminal */
419 #define resetscroll() enable_scroll=0
420 /* macro to clear the screen and home the cursor */
421 #define clear() (*lpnt++ =CLEAR, cbak[SPELLS]= -50)
422 /* macro to clear to end of line */
423 #define cltoeoln() (*lpnt++ = CL_LINE)
426 /* macro to output one byte to the output buffer */
427 #define lprc(ch) ((lpnt>=lpend)?(*lpnt++ =(ch), lflush()):(*lpnt++ =(ch)))
429 /* macro to seed the random number generator */
430 #define srand(x) (randx=x)
432 /* macros to generate random numbers 1<=rnd(N)<=N 0<=rund(N)<=N-1 */
433 #define rnd(x) ((((randx=randx*1103515245+12345)>>7)%(x))+1)
434 #define rund(x) ((((randx=randx*1103515245+12345)>>7)%(x)) )
435 #endif /* MACRORND */
436 /* macros for miscellaneous data conversion */
437 #define min(x,y) (((x)>(y))?(y):(x))
438 #define max(x,y) (((x)>(y))?(x):(y))
439 #define isalpha(x) (is_alpha[x])
440 #define isdigit(x) (is_digit[x])
441 #define tolower(x) (to_lower[x])
442 #define toupper(x) (to_upper[x])
443 #define lcc(x) (to_lower[x])
444 #define ucc(x) (to_upper[x])