]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - larn/header.h
1 /* header.h Larn is copyrighted 1986 by Noah Morgan. */
4 /* max # levels in the dungeon */
6 /* max # of levels in the temple of the luran */
11 /* this is the number of people on a scoreboard max */
13 /* maximum player level allowed */
15 /* maximum # monsters in the dungeon */
17 /* maximum number of spells in existance */
19 /* maximum number of scrolls that are possible */
21 /* maximum number of potions that are possible */
22 #define TIMELIMIT 30000
23 /* the maximum number of moves before the game is called */
25 /* the tax rate for the LRS */
27 /* the maximum number of objects n < MAXOBJ */
29 /* this is the structure definition of the monster data */
39 char intelligence
; /* monsters intelligence -- used to choose movement */
42 unsigned long experience
;
45 /* this is the structure definition for the items in the dnd store */
55 /* this is the structure that holds the entire dungeon specifications */
58 short hitp
; /* monster's hit points */
59 char mitem
; /* the monster ID */
60 char item
; /* the object's ID */
61 short iarg
; /* the object's argument */
62 char know
; /* have we been here before*/
65 /* 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 char lifetime
; /* duration of the sphere */
74 /* defines for the character attribute array c[] */
75 #define STRENGTH 0 /* characters physical strength not due to objects */
76 #define INTELLIGENCE 1
78 #define CONSTITUTION 3
89 #define BANKACCOUNT 14
94 #define MOREDEFENSES 19
96 #define PROTECTIONTIME 21
99 #define REGENCOUNTER 24
103 #define BLINDCOUNT 28
108 #define CHARMCOUNT 33
109 #define INVISIBILITY 34
110 #define CANCELLATION 35
117 #define NEGATESPIRIT 42
118 #define SCAREMONST 43
122 #define HASTEMONST 47
123 #define CUBEofUNDEAD 48
125 #define FIRERESISTANCE 50
133 #define MONSTKILLED 58
134 #define SPELLSCAST 59
135 #define LANCEDEATH 60
142 #define DRAINSTRENGTH 67
143 #define CLUMSINESS 68
144 #define INFEEBLEMENT 69
146 #define SEEINVISIBLE 71
148 #define RANDOMWALK 73
149 #define SPHCAST 74 /* nz if an active sphere of annihilation */
150 #define WTW 75 /* walk through walls */
151 #define STREXTRA 76 /* character strength due to objects or enchantments */
152 #define TMP 77 /* misc scratch space */
153 #define LIFEPROT 78 /* life protection counter */
155 /* defines for the objects in the game */
162 #define OELEVATORUP 6
165 #define OTELEPORTER 9
169 #define OSTAIRSDOWN 13
170 #define OELEVATORDOWN 14
173 #define ODEADFOUNTAIN 17
177 #define OCLOSEDDOOR 20
179 #define OTRAPARROW 66
180 #define OTRAPARROWIV 67
188 #define OSTUDLEATHER 61
190 #define OPLATEARMOR 63
193 #define OELVENCHAIN 92
195 #define OSWORDofSLASHING 26
201 #define OBATTLEAXE 57
202 #define OLONGSWORD 58
208 #define ORINGOFEXTRA 32
209 #define OREGENRING 33
211 #define OENERGYRING 35
214 #define OCLEVERRING 38
225 #define OORBOFDRAGON 46
226 #define OSPIRITSCARAB 47
227 #define OCUBEofUNDEAD 48
242 #define OIVDARTRAP 73
245 #define OIVTRAPDOOR 76
246 #define OTRADEPOST 77
247 #define OIVTELETRAP 78
248 #define ODEADTHRONE 79
249 #define OANNIHILATION 80 /* sphere of annihilation */
251 #define OLRS 82 /* Larn Revenue Service */
254 #define OBRASSLAMP 85
255 #define OHANDofFEAR 86 /* hand of fear */
256 #define OSPHTAILSMAN 87 /* tailsman of the sphere */
257 #define OWWAND 88 /* wand of wonder */
258 #define OPSTAFF 89 /* staff of power */
261 /* defines for the monsters as objects */
272 #define TROGLODYTE 10
275 #define LEPRECHAUN 13
278 #define RUSTMONSTER 16
280 #define ASSASSINBUG 18
287 #define WHITEDRAGON 25
293 #define VIOLETFUNGI 31
301 #define INVISIBLESTALKER 39
302 #define POLTERGEIST 40
303 #define DISENCHANTRESS 41
304 #define SHAMBLINGMOUND 42
305 #define YELLOWMOLD 43
310 #define BRONZEDRAGON 48
311 #define GREENDRAGON 49
312 #define PURPLEWORM 50
314 #define SPIRITNAGA 52
315 #define SILVERDRAGON 53
316 #define PLATINUMDRAGON 54
317 #define GREENURCHIN 55
320 #define DEMONPRINCE 64
323 #define BUFBIG 4096 /* size of the output buffer */
324 #define MAXIBUF 4096 /* size of the input buffer */
325 #define LOGNAMESIZE 40 /* max size of the players name */
326 #define PSNAMESIZE 40 /* max size of the process name */
329 extern char VERSION
,SUBVERSION
;
330 extern char aborted
[],alpha
[],beenhere
[],boldon
,cheat
,ckpfile
[],ckpflag
;
331 extern char *class[],course
[],diagfile
[],fortfile
[],helpfile
[];
332 extern char *inbuffer
,is_alpha
[],is_digit
[];
333 extern char item
[MAXX
][MAXY
],iven
[],know
[MAXX
][MAXY
],larnlevels
[],lastmonst
[];
334 extern char level
,*levelname
[],logfile
[],loginname
[],logname
[],*lpbuf
,*lpend
;
335 extern char *lpnt
,moved
[MAXX
][MAXY
],mitem
[MAXX
][MAXY
],monstlevel
[];
336 extern char monstnamelist
[],nch
[],ndgg
[],nlpts
[],nomove
,nosignal
,nowelcome
;
337 extern char nplt
[],nsw
[],*objectname
[];
338 extern char objnamelist
[],optsfile
[],*potionname
[],playerids
[],potprob
[];
339 extern char predostuff
,psname
[],restorflag
,savefilename
[],scorefile
[],scprob
[];
340 extern char screen
[MAXX
][MAXY
],*scrollname
[],sex
,*spelcode
[],*speldescript
[];
341 extern char spelknow
[],*spelname
[],*spelmes
[],spelweird
[MAXMONST
+8][SPNUM
];
342 extern char splev
[],stealth
[MAXX
][MAXY
],to_lower
[],to_upper
[],wizard
;
343 extern short diroffx
[],diroffy
[],hitflag
,hit2flag
,hit3flag
,hitp
[MAXX
][MAXY
];
344 extern short iarg
[MAXX
][MAXY
],ivenarg
[],lasthx
,lasthy
,lastnum
,lastpx
,lastpy
;
345 extern short nobeep
,oldx
,oldy
,playerx
,playery
;
346 extern int dayplay
,enable_scroll
,srcount
,yrepcount
,userid
,wisid
,lfd
,fd
;
347 extern long initialtime
,outstanding_taxes
,skill
[],gtime
,c
[],cbak
[];
348 extern unsigned long randx
;
349 extern struct cel
*cell
;
350 extern struct monst monster
[];
351 extern struct sphere
*spheres
;
352 extern struct _itm itm
[];
354 char *fortune(),*malloc(),*getenv(),*getlogin(),*lgetw(),*lgetl(),*ctime();
355 char *tmcapcnv(),*tgetstr(),*tgoto();
356 long paytaxes(),lgetc(),lrint(),time();
357 unsigned long readnum();
359 /* macro to create scroll #'s with probability of occurrence */
360 #define newscroll() (scprob[rund(81)])
361 /* macro to return a potion # created with probability of occurrence */
362 #define newpotion() (potprob[rund(41)])
363 /* macro to return the + points on created leather armor */
364 #define newleather() (nlpts[rund(c[HARDGAME]?13:15)])
365 /* macro to return the + points on chain armor */
366 #define newchain() (nch[rund(10)])
367 /* macro to return + points on plate armor */
368 #define newplate() (nplt[rund(c[HARDGAME]?4:12)])
369 /* macro to return + points on new daggers */
370 #define newdagger() (ndgg[rund(13)])
371 /* macro to return + points on new swords */
372 #define newsword() (nsw[rund(c[HARDGAME]?6:13)])
373 /* macro to destroy object at present location */
374 #define forget() (item[playerx][playery]=know[playerx][playery]=0)
375 /* macro to wipe out a monster at a location */
376 #define disappear(x,y) (mitem[x][y]=know[x][y]=0)
379 /* macro to turn on bold display for the terminal */
380 #define setbold() (lprcat(boldon?"\33[1m":"\33[7m"))
381 /* macro to turn off bold display for the terminal */
382 #define resetbold() (lprcat("\33[m"))
383 /* macro to setup the scrolling region for the terminal */
384 #define setscroll() (lprcat("\33[20;24r"))
385 /* macro to clear the scrolling region for the terminal */
386 #define resetscroll() (lprcat("\33[;24r"))
387 /* macro to clear the screen and home the cursor */
388 #define clear() (lprcat("\33[2J\33[f"), cbak[SPELLS]= -50)
389 #define cltoeoln() lprcat("\33[K")
391 /* defines below are for use in the termcap mode only */
400 /* macro to turn on bold display for the terminal */
401 #define setbold() (*lpnt++ = ST_START)
402 /* macro to turn off bold display for the terminal */
403 #define resetbold() (*lpnt++ = ST_END)
404 /* macro to setup the scrolling region for the terminal */
405 #define setscroll() enable_scroll=1
406 /* macro to clear the scrolling region for the terminal */
407 #define resetscroll() enable_scroll=0
408 /* macro to clear the screen and home the cursor */
409 #define clear() (*lpnt++ =CLEAR, cbak[SPELLS]= -50)
410 /* macro to clear to end of line */
411 #define cltoeoln() (*lpnt++ = CL_LINE)
414 /* macro to output one byte to the output buffer */
415 #define lprc(ch) ((lpnt>=lpend)?(*lpnt++ =(ch), lflush()):(*lpnt++ =(ch)))
417 /* macro to seed the random number generator */
418 #define srand(x) (randx=x)
420 /* macros to generate random numbers 1<=rnd(N)<=N 0<=rund(N)<=N-1 */
421 #define rnd(x) ((((randx=randx*1103515245+12345)>>7)%(x))+1)
422 #define rund(x) ((((randx=randx*1103515245+12345)>>7)%(x)) )
424 /* macros for miscellaneous data conversion */
425 #define min(x,y) (((x)>(y))?(y):(x))
426 #define max(x,y) (((x)>(y))?(x):(y))
427 #define isalpha(x) (is_alpha[x])
428 #define isdigit(x) (is_digit[x])
429 #define tolower(x) (to_lower[x])
430 #define toupper(x) (to_upper[x])
431 #define lcc(x) (to_lower[x])
432 #define ucc(x) (to_upper[x])