1 /* header.h Larn is copyrighted 1986 by Noah Morgan. */
2 /* $DragonFly: src/games/larn/header.h,v 1.5 2006/08/26 19:05:05 pavalos Exp $ */
13 /* max # levels in the dungeon */
15 /* max # of levels in the temple of the luran */
20 /* this is the number of people on a scoreboard max */
22 /* maximum player level allowed */
24 /* maximum # monsters in the dungeon */
26 /* maximum number of spells in existance */
28 /* maximum number of scrolls that are possible */
30 /* maximum number of potions that are possible */
31 #define TIMELIMIT 30000
32 /* the maximum number of moves before the game is called */
34 /* the tax rate for the LRS */
36 /* the maximum number of objects n < MAXOBJ */
38 /* this is the structure definition of the monster data */
48 char intelligence
; /* monsters intelligence -- used to choose movement */
51 unsigned long experience
;
54 /* this is the structure definition for the items in the dnd store */
63 /* this is the structure that holds the entire dungeon specifications */
66 short hitp
; /* monster's hit points */
67 char mitem
; /* the monster ID */
68 char item
; /* the object's ID */
69 short iarg
; /* the object's argument */
70 char know
; /* have we been here before*/
73 /* this is the structure for maintaining & moving the spheres of annihilation */
76 struct sphere
*p
; /* pointer to next structure */
77 char x
,y
,lev
; /* location of the sphere */
78 char dir
; /* direction sphere is going in */
79 char lifetime
; /* duration of the sphere */
82 /* defines for the character attribute array c[] */
83 #define STRENGTH 0 /* characters physical strength not due to objects */
84 #define INTELLIGENCE 1
86 #define CONSTITUTION 3
97 #define BANKACCOUNT 14
102 #define MOREDEFENSES 19
104 #define PROTECTIONTIME 21
107 #define REGENCOUNTER 24
111 #define BLINDCOUNT 28
116 #define CHARMCOUNT 33
117 #define INVISIBILITY 34
118 #define CANCELLATION 35
125 #define NEGATESPIRIT 42
126 #define SCAREMONST 43
130 #define HASTEMONST 47
131 #define CUBEofUNDEAD 48
133 #define FIRERESISTANCE 50
141 #define MONSTKILLED 58
142 #define SPELLSCAST 59
143 #define LANCEDEATH 60
150 #define DRAINSTRENGTH 67
151 #define CLUMSINESS 68
152 #define INFEEBLEMENT 69
154 #define SEEINVISIBLE 71
156 #define RANDOMWALK 73
157 #define SPHCAST 74 /* nz if an active sphere of annihilation */
158 #define WTW 75 /* walk through walls */
159 #define STREXTRA 76 /* character strength due to objects or enchantments */
160 #define TMP 77 /* misc scratch space */
161 #define LIFEPROT 78 /* life protection counter */
163 /* defines for the objects in the game */
170 #define OELEVATORUP 6
173 #define OTELEPORTER 9
177 #define OSTAIRSDOWN 13
178 #define OELEVATORDOWN 14
181 #define ODEADFOUNTAIN 17
185 #define OCLOSEDDOOR 20
187 #define OTRAPARROW 66
188 #define OTRAPARROWIV 67
196 #define OSTUDLEATHER 61
198 #define OPLATEARMOR 63
201 #define OELVENCHAIN 92
203 #define OSWORDofSLASHING 26
209 #define OBATTLEAXE 57
210 #define OLONGSWORD 58
216 #define ORINGOFEXTRA 32
217 #define OREGENRING 33
219 #define OENERGYRING 35
222 #define OCLEVERRING 38
233 #define OORBOFDRAGON 46
234 #define OSPIRITSCARAB 47
235 #define OCUBEofUNDEAD 48
250 #define OIVDARTRAP 73
253 #define OIVTRAPDOOR 76
254 #define OTRADEPOST 77
255 #define OIVTELETRAP 78
256 #define ODEADTHRONE 79
257 #define OANNIHILATION 80 /* sphere of annihilation */
259 #define OLRS 82 /* Larn Revenue Service */
262 #define OBRASSLAMP 85
263 #define OHANDofFEAR 86 /* hand of fear */
264 #define OSPHTAILSMAN 87 /* tailsman of the sphere */
265 #define OWWAND 88 /* wand of wonder */
266 #define OPSTAFF 89 /* staff of power */
269 /* defines for the monsters as objects */
280 #define TROGLODYTE 10
283 #define LEPRECHAUN 13
286 #define RUSTMONSTER 16
288 #define ASSASSINBUG 18
295 #define WHITEDRAGON 25
301 #define VIOLETFUNGI 31
309 #define INVISIBLESTALKER 39
310 #define POLTERGEIST 40
311 #define DISENCHANTRESS 41
312 #define SHAMBLINGMOUND 42
313 #define YELLOWMOLD 43
318 #define BRONZEDRAGON 48
319 #define GREENDRAGON 49
320 #define PURPLEWORM 50
322 #define SPIRITNAGA 52
323 #define SILVERDRAGON 53
324 #define PLATINUMDRAGON 54
325 #define GREENURCHIN 55
328 #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
[],playerids
[],potprob
[];
346 extern char predostuff
,psname
[],restorflag
,savefilename
[],scorefile
[],scprob
[];
347 extern char screen
[MAXX
][MAXY
],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_
[];
360 extern const char *potionhide
[],*potionname
[],*scrollhide
[],*scrollname
[];
366 void makeplayer(void);
367 void newcavelevel(int);
375 int savegame(char *);
376 void restoregame(char *);
379 void bottomline(void);
381 void bottomspell(void);
383 void bot_linex(void);
384 void bottomgold(void);
385 void draws(int, int, int, int);
386 void drawscreen(void);
387 void showcell(int, int);
388 void show1cell(int, int);
389 void showplayer(void);
394 const char *fortune(void);
397 void raiselevel(void);
398 void loselevel(void);
399 void raiseexperience(long);
400 void loseexperience(long);
405 void raisemspells(int);
406 void losemspells(int);
408 void positionplayer(void);
413 int drop_object(int);
414 void enchantarmor(void);
415 void enchweapon(void);
416 int pocketfull(void);
417 int nearbymonst(void);
418 int stealsomething(void);
419 int emptyhanded(void);
420 void creategem(void);
421 void adjustcvalues(int, int);
422 int getpassword(void);
424 int packweight(void);
435 void setupvt100(void);
436 void clearvt100(void);
441 void lprintf(const char *, ...);
443 void lwrite(char *, int);
446 void lrfill(char *, int);
454 void lprcat(const char *);
455 void cursor(int, int);
458 void init_term(void);
460 void cl_line(int, int);
461 void cl_up(int, int);
462 void cl_dn(int, int);
463 void standout(const char *);
464 void set_score_output(void);
467 char *tmcapcnv(char *, char *);
475 unsigned long readnum(long);
478 void createmonster(int);
479 void createitem(int, int);
481 void godirect(int, int, const char *, int, char);
482 int vxy(int *, int *);
483 void hitmonster(int, int);
484 int hitm(int, int, int);
485 void hitplayer(int, int);
488 int newobject(int, int *);
490 long annihilate(void);
491 long newsphere(int, int, int, int);
492 long rmsphere(int, int);
497 void odeadthrone(void);
499 void ofountain(void);
502 void movemonst(void);
508 void lookforobject(void);
510 void quaffpotion(int);
511 void larn_adjtime(long);
512 void read_scroll(int);
521 void savelevel(void);
528 void showscores(void);
529 void showallscores(void);
544 void ointerest(void);
545 void otradepost(void);
554 /* macro to create scroll #'s with probability of occurrence */
555 #define newscroll() (scprob[rund(81)])
556 /* macro to return a potion # created with probability of occurrence */
557 #define newpotion() (potprob[rund(41)])
558 /* macro to return the + points on created leather armor */
559 #define newleather() (nlpts[rund(c[HARDGAME]?13:15)])
560 /* macro to return the + points on chain armor */
561 #define newchain() (nch[rund(10)])
562 /* macro to return + points on plate armor */
563 #define newplate() (nplt[rund(c[HARDGAME]?4:12)])
564 /* macro to return + points on new daggers */
565 #define newdagger() (ndgg[rund(13)])
566 /* macro to return + points on new swords */
567 #define newsword() (nsw[rund(c[HARDGAME]?6:13)])
568 /* macro to destroy object at present location */
569 #define forget() (item[playerx][playery]=know[playerx][playery]=0)
570 /* macro to wipe out a monster at a location */
571 #define disappear(x,y) (mitem[x][y]=know[x][y]=0)
574 /* macro to turn on bold display for the terminal */
575 #define setbold() (lprcat(boldon?"\33[1m":"\33[7m"))
576 /* macro to turn off bold display for the terminal */
577 #define resetbold() (lprcat("\33[m"))
578 /* macro to setup the scrolling region for the terminal */
579 #define setscroll() (lprcat("\33[20;24r"))
580 /* macro to clear the scrolling region for the terminal */
581 #define resetscroll() (lprcat("\33[;24r"))
582 /* macro to clear the screen and home the cursor */
583 #define clear() (lprcat("\33[2J\33[f"), cbak[SPELLS]= -50)
584 #define cltoeoln() lprcat("\33[K")
586 /* defines below are for use in the termcap mode only */
595 /* macro to turn on bold display for the terminal */
596 #define setbold() (*lpnt++ = ST_START)
597 /* macro to turn off bold display for the terminal */
598 #define resetbold() (*lpnt++ = ST_END)
599 /* macro to setup the scrolling region for the terminal */
600 #define setscroll() enable_scroll=1
601 /* macro to clear the scrolling region for the terminal */
602 #define resetscroll() enable_scroll=0
603 /* macro to clear the screen and home the cursor */
604 #define clear() (*lpnt++ =CLEAR, cbak[SPELLS]= -50)
605 /* macro to clear to end of line */
606 #define cltoeoln() (*lpnt++ = CL_LINE)
609 /* macro to output one byte to the output buffer */
610 #define lprc(ch) ((lpnt>=lpend)?(*lpnt++ =(ch), lflush()):(*lpnt++ =(ch)))
613 extern unsigned long randx
;
614 /* macro to seed the random number generator */
615 #define srand(x) (randx=x)
616 /* macros to generate random numbers 1<=rnd(N)<=N 0<=rund(N)<=N-1 */
617 #define rnd(x) ((((randx=randx*1103515245+12345)>>7)%(x))+1)
618 #define rund(x) ((((randx=randx*1103515245+12345)>>7)%(x)) )
619 #endif /* MACRORND */
620 /* macros for miscellaneous data conversion */
621 #define min(x,y) (((x)>(y))?(y):(x))
622 #define max(x,y) (((x)>(y))?(x):(y))
623 #define isalpha(x) (is_alpha[x])
624 #define isdigit(x) (is_digit[x])
625 #define tolower(x) (to_lower[x])
626 #define toupper(x) (to_upper[x])
627 #define lcc(x) (to_lower[x])
628 #define ucc(x) (to_upper[x])