1 /* header.h Larn is copyrighted 1986 by Noah Morgan. */
2 /* $DragonFly: src/games/larn/header.h,v 1.3 2004/11/24 12:49:27 joerg Exp $ */
11 /* max # levels in the dungeon */
13 /* max # of levels in the temple of the luran */
18 /* this is the number of people on a scoreboard max */
20 /* maximum player level allowed */
22 /* maximum # monsters in the dungeon */
24 /* maximum number of spells in existance */
26 /* maximum number of scrolls that are possible */
28 /* maximum number of potions that are possible */
29 #define TIMELIMIT 30000
30 /* the maximum number of moves before the game is called */
32 /* the tax rate for the LRS */
34 /* the maximum number of objects n < MAXOBJ */
36 /* 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 */
62 /* this is the structure that holds the entire dungeon specifications */
65 short hitp; /* monster's hit points */
66 char mitem; /* the monster ID */
67 char item; /* the object's ID */
68 short iarg; /* the object's argument */
69 char know; /* have we been here before*/
72 /* this is the structure for maintaining & moving the spheres of annihilation */
75 struct sphere *p; /* pointer to next structure */
76 char x,y,lev; /* location of the sphere */
77 char dir; /* direction sphere is going in */
78 char lifetime; /* duration of the sphere */
81 /* defines for the character attribute array c[] */
82 #define STRENGTH 0 /* characters physical strength not due to objects */
83 #define INTELLIGENCE 1
85 #define CONSTITUTION 3
96 #define BANKACCOUNT 14
101 #define MOREDEFENSES 19
103 #define PROTECTIONTIME 21
106 #define REGENCOUNTER 24
110 #define BLINDCOUNT 28
115 #define CHARMCOUNT 33
116 #define INVISIBILITY 34
117 #define CANCELLATION 35
124 #define NEGATESPIRIT 42
125 #define SCAREMONST 43
129 #define HASTEMONST 47
130 #define CUBEofUNDEAD 48
132 #define FIRERESISTANCE 50
140 #define MONSTKILLED 58
141 #define SPELLSCAST 59
142 #define LANCEDEATH 60
149 #define DRAINSTRENGTH 67
150 #define CLUMSINESS 68
151 #define INFEEBLEMENT 69
153 #define SEEINVISIBLE 71
155 #define RANDOMWALK 73
156 #define SPHCAST 74 /* nz if an active sphere of annihilation */
157 #define WTW 75 /* walk through walls */
158 #define STREXTRA 76 /* character strength due to objects or enchantments */
159 #define TMP 77 /* misc scratch space */
160 #define LIFEPROT 78 /* life protection counter */
162 /* defines for the objects in the game */
169 #define OELEVATORUP 6
172 #define OTELEPORTER 9
176 #define OSTAIRSDOWN 13
177 #define OELEVATORDOWN 14
180 #define ODEADFOUNTAIN 17
184 #define OCLOSEDDOOR 20
186 #define OTRAPARROW 66
187 #define OTRAPARROWIV 67
195 #define OSTUDLEATHER 61
197 #define OPLATEARMOR 63
200 #define OELVENCHAIN 92
202 #define OSWORDofSLASHING 26
208 #define OBATTLEAXE 57
209 #define OLONGSWORD 58
215 #define ORINGOFEXTRA 32
216 #define OREGENRING 33
218 #define OENERGYRING 35
221 #define OCLEVERRING 38
232 #define OORBOFDRAGON 46
233 #define OSPIRITSCARAB 47
234 #define OCUBEofUNDEAD 48
249 #define OIVDARTRAP 73
252 #define OIVTRAPDOOR 76
253 #define OTRADEPOST 77
254 #define OIVTELETRAP 78
255 #define ODEADTHRONE 79
256 #define OANNIHILATION 80 /* sphere of annihilation */
258 #define OLRS 82 /* Larn Revenue Service */
261 #define OBRASSLAMP 85
262 #define OHANDofFEAR 86 /* hand of fear */
263 #define OSPHTAILSMAN 87 /* tailsman of the sphere */
264 #define OWWAND 88 /* wand of wonder */
265 #define OPSTAFF 89 /* staff of power */
268 /* defines for the monsters as objects */
279 #define TROGLODYTE 10
282 #define LEPRECHAUN 13
285 #define RUSTMONSTER 16
287 #define ASSASSINBUG 18
294 #define WHITEDRAGON 25
300 #define VIOLETFUNGI 31
308 #define INVISIBLESTALKER 39
309 #define POLTERGEIST 40
310 #define DISENCHANTRESS 41
311 #define SHAMBLINGMOUND 42
312 #define YELLOWMOLD 43
317 #define BRONZEDRAGON 48
318 #define GREENDRAGON 49
319 #define PURPLEWORM 50
321 #define SPIRITNAGA 52
322 #define SILVERDRAGON 53
323 #define PLATINUMDRAGON 54
324 #define GREENURCHIN 55
327 #define DEMONPRINCE 64
330 #define BUFBIG 4096 /* size of the output buffer */
331 #define MAXIBUF 4096 /* size of the input buffer */
332 #define LOGNAMESIZE 40 /* max size of the players name */
333 #define PSNAMESIZE 40 /* max size of the process name */
336 extern char VERSION,SUBVERSION;
337 extern char aborted[],alpha[],beenhere[],boldon,cheat,ckpfile[],ckpflag;
338 extern char *class[],course[],diagfile[],fortfile[],helpfile[];
339 extern char *inbuffer,is_alpha[],is_digit[];
340 extern char item[MAXX][MAXY],iven[],know[MAXX][MAXY],larnlevels[],lastmonst[];
341 extern char level,*levelname[],logfile[],loginname[],logname[],*lpbuf,*lpend;
342 extern char *lpnt,moved[MAXX][MAXY],mitem[MAXX][MAXY],monstlevel[];
343 extern char monstnamelist[],nch[],ndgg[],nlpts[],nomove,nosignal,nowelcome;
344 extern char nplt[],nsw[],*objectname[];
345 extern char objnamelist[],optsfile[],*potionname[],playerids[],potprob[];
346 extern char predostuff,psname[],restorflag,savefilename[],scorefile[],scprob[];
347 extern char screen[MAXX][MAXY],*scrollname[],sex,*spelcode[],*speldescript[];
348 extern char spelknow[],*spelname[],*spelmes[],spelweird[MAXMONST+8][SPNUM];
349 extern char splev[],stealth[MAXX][MAXY],to_lower[],to_upper[],wizard;
350 extern short diroffx[],diroffy[],hitflag,hit2flag,hit3flag,hitp[MAXX][MAXY];
351 extern short iarg[MAXX][MAXY],ivenarg[],lasthx,lasthy,lastnum,lastpx,lastpy;
352 extern short nobeep,oldx,oldy,playerx,playery;
353 extern int dayplay,enable_scroll,srcount,yrepcount,userid,wisid,lfd,fd;
354 extern time_t initialtime;
355 extern long outstanding_taxes,skill[],gtime,c[],cbak[];
356 extern struct cel *cell;
357 extern struct monst monster[];
358 extern struct sphere *spheres;
359 extern struct _itm itm[];
361 char *fortune(),*lgetw(),*lgetl();
363 long paytaxes(),lgetc(),lrint_x();
364 unsigned long readnum();
366 /* macro to create scroll #'s with probability of occurrence */
367 #define newscroll() (scprob[rund(81)])
368 /* macro to return a potion # created with probability of occurrence */
369 #define newpotion() (potprob[rund(41)])
370 /* macro to return the + points on created leather armor */
371 #define newleather() (nlpts[rund(c[HARDGAME]?13:15)])
372 /* macro to return the + points on chain armor */
373 #define newchain() (nch[rund(10)])
374 /* macro to return + points on plate armor */
375 #define newplate() (nplt[rund(c[HARDGAME]?4:12)])
376 /* macro to return + points on new daggers */
377 #define newdagger() (ndgg[rund(13)])
378 /* macro to return + points on new swords */
379 #define newsword() (nsw[rund(c[HARDGAME]?6:13)])
380 /* macro to destroy object at present location */
381 #define forget() (item[playerx][playery]=know[playerx][playery]=0)
382 /* macro to wipe out a monster at a location */
383 #define disappear(x,y) (mitem[x][y]=know[x][y]=0)
386 /* macro to turn on bold display for the terminal */
387 #define setbold() (lprcat(boldon?"\33[1m":"\33[7m"))
388 /* macro to turn off bold display for the terminal */
389 #define resetbold() (lprcat("\33[m"))
390 /* macro to setup the scrolling region for the terminal */
391 #define setscroll() (lprcat("\33[20;24r"))
392 /* macro to clear the scrolling region for the terminal */
393 #define resetscroll() (lprcat("\33[;24r"))
394 /* macro to clear the screen and home the cursor */
395 #define clear() (lprcat("\33[2J\33[f"), cbak[SPELLS]= -50)
396 #define cltoeoln() lprcat("\33[K")
398 /* defines below are for use in the termcap mode only */
407 /* macro to turn on bold display for the terminal */
408 #define setbold() (*lpnt++ = ST_START)
409 /* macro to turn off bold display for the terminal */
410 #define resetbold() (*lpnt++ = ST_END)
411 /* macro to setup the scrolling region for the terminal */
412 #define setscroll() enable_scroll=1
413 /* macro to clear the scrolling region for the terminal */
414 #define resetscroll() enable_scroll=0
415 /* macro to clear the screen and home the cursor */
416 #define clear() (*lpnt++ =CLEAR, cbak[SPELLS]= -50)
417 /* macro to clear to end of line */
418 #define cltoeoln() (*lpnt++ = CL_LINE)
421 /* macro to output one byte to the output buffer */
422 #define lprc(ch) ((lpnt>=lpend)?(*lpnt++ =(ch), lflush()):(*lpnt++ =(ch)))
425 extern unsigned long randx;
426 /* macro to seed the random number generator */
427 #define srand(x) (randx=x)
428 /* macros to generate random numbers 1<=rnd(N)<=N 0<=rund(N)<=N-1 */
429 #define rnd(x) ((((randx=randx*1103515245+12345)>>7)%(x))+1)
430 #define rund(x) ((((randx=randx*1103515245+12345)>>7)%(x)) )
431 #endif /* MACRORND */
432 /* macros for miscellaneous data conversion */
433 #define min(x,y) (((x)>(y))?(y):(x))
434 #define max(x,y) (((x)>(y))?(x):(y))
435 #define isalpha(x) (is_alpha[x])
436 #define isdigit(x) (is_digit[x])
437 #define tolower(x) (to_lower[x])
438 #define toupper(x) (to_upper[x])
439 #define lcc(x) (to_lower[x])
440 #define ucc(x) (to_upper[x])