1 /* header.h Larn is copyrighted 1986 by Noah Morgan. */
2 /* $DragonFly: src/games/larn/header.h,v 1.5 2006/08/26 17: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 existence */
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 */
47 char intelligence
; /* monsters intelligence -- used to choose movement */
50 unsigned long experience
;
53 /* this is the structure definition for the items in the dnd store */
61 /* this is the structure that holds the entire dungeon specifications */
63 short hitp
; /* monster's hit points */
64 char mitem
; /* the monster ID */
65 char item
; /* the object's ID */
66 short iarg
; /* the object's argument */
67 char know
; /* have we been here before */
70 /* this is the structure for maintaining & moving the spheres of annihilation */
72 struct sphere
*p
; /* pointer to next structure */
73 char x
,y
,lev
; /* location of the sphere */
74 char dir
; /* direction sphere is going in */
75 char lifetime
; /* duration of the sphere */
78 /* defines for the character attribute array c[] */
79 #define STRENGTH 0 /* characters physical strength not due to objects */
80 #define INTELLIGENCE 1
82 #define CONSTITUTION 3
93 #define BANKACCOUNT 14
98 #define MOREDEFENSES 19
100 #define PROTECTIONTIME 21
103 #define REGENCOUNTER 24
107 #define BLINDCOUNT 28
112 #define CHARMCOUNT 33
113 #define INVISIBILITY 34
114 #define CANCELLATION 35
121 #define NEGATESPIRIT 42
122 #define SCAREMONST 43
126 #define HASTEMONST 47
127 #define CUBEofUNDEAD 48
129 #define FIRERESISTANCE 50
137 #define MONSTKILLED 58
138 #define SPELLSCAST 59
139 #define LANCEDEATH 60
146 #define DRAINSTRENGTH 67
147 #define CLUMSINESS 68
148 #define INFEEBLEMENT 69
150 #define SEEINVISIBLE 71
152 #define RANDOMWALK 73
153 #define SPHCAST 74 /* nz if an active sphere of annihilation */
154 #define WTW 75 /* walk through walls */
155 #define STREXTRA 76 /* character strength due to objects or enchantments */
156 #define TMP 77 /* misc scratch space */
157 #define LIFEPROT 78 /* life protection counter */
159 /* defines for the objects in the game */
166 #define OELEVATORUP 6
169 #define OTELEPORTER 9
173 #define OSTAIRSDOWN 13
174 #define OELEVATORDOWN 14
177 #define ODEADFOUNTAIN 17
181 #define OCLOSEDDOOR 20
183 #define OTRAPARROW 66
184 #define OTRAPARROWIV 67
192 #define OSTUDLEATHER 61
194 #define OPLATEARMOR 63
197 #define OELVENCHAIN 92
199 #define OSWORDofSLASHING 26
205 #define OBATTLEAXE 57
206 #define OLONGSWORD 58
212 #define ORINGOFEXTRA 32
213 #define OREGENRING 33
215 #define OENERGYRING 35
218 #define OCLEVERRING 38
229 #define OORBOFDRAGON 46
230 #define OSPIRITSCARAB 47
231 #define OCUBEofUNDEAD 48
246 #define OIVDARTRAP 73
249 #define OIVTRAPDOOR 76
250 #define OTRADEPOST 77
251 #define OIVTELETRAP 78
252 #define ODEADTHRONE 79
253 #define OANNIHILATION 80 /* sphere of annihilation */
255 #define OLRS 82 /* Larn Revenue Service */
258 #define OBRASSLAMP 85
259 #define OHANDofFEAR 86 /* hand of fear */
260 #define OSPHTAILSMAN 87 /* tailsman of the sphere */
261 #define OWWAND 88 /* wand of wonder */
262 #define OPSTAFF 89 /* staff of power */
265 /* defines for the monsters as objects */
276 #define TROGLODYTE 10
279 #define LEPRECHAUN 13
282 #define RUSTMONSTER 16
284 #define ASSASSINBUG 18
291 #define WHITEDRAGON 25
297 #define VIOLETFUNGI 31
305 #define INVISIBLESTALKER 39
306 #define POLTERGEIST 40
307 #define DISENCHANTRESS 41
308 #define SHAMBLINGMOUND 42
309 #define YELLOWMOLD 43
314 #define BRONZEDRAGON 48
315 #define GREENDRAGON 49
316 #define PURPLEWORM 50
318 #define SPIRITNAGA 52
319 #define SILVERDRAGON 53
320 #define PLATINUMDRAGON 54
321 #define GREENURCHIN 55
324 #define DEMONPRINCE 64
326 #define BUFBIG 4096 /* size of the output buffer */
327 #define MAXIBUF 4096 /* size of the input buffer */
328 #define LOGNAMESIZE 40 /* max size of the players name */
329 #define PSNAMESIZE 40 /* max size of the process name */
332 extern char VERSION
, SUBVERSION
;
333 extern char aborted
[], alpha
[], beenhere
[], boldon
, cheat
, ckpfile
[], ckpflag
;
334 extern char *class[], course
[], diagfile
[], fortfile
[], helpfile
[];
335 extern char *inbuffer
, is_alpha
[], is_digit
[];
336 extern char item
[MAXX
][MAXY
], iven
[], know
[MAXX
][MAXY
], larnlevels
[], lastmonst
[];
337 extern char level
, *levelname
[], logfile
[], loginname
[], logname
[], *lpbuf
, *lpend
;
338 extern char *lpnt
, moved
[MAXX
][MAXY
], mitem
[MAXX
][MAXY
], monstlevel
[];
339 extern char monstnamelist
[], nch
[], ndgg
[], nlpts
[], nomove
, nosignal
, nowelcome
;
340 extern char nplt
[], nsw
[], *objectname
[];
341 extern char objnamelist
[], optsfile
[], playerids
[], potprob
[];
342 extern char predostuff
, psname
[], restorflag
, savefilename
[], scorefile
[], scprob
[];
343 extern char screen
[MAXX
][MAXY
], sex
, *spelcode
[], *speldescript
[];
344 extern char spelknow
[], *spelname
[], *spelmes
[], spelweird
[MAXMONST
+ 8][SPNUM
];
345 extern char splev
[], stealth
[MAXX
][MAXY
], to_lower
[], to_upper
[], wizard
;
346 extern short diroffx
[], diroffy
[], hitflag
, hit2flag
, hit3flag
, hitp
[MAXX
][MAXY
];
347 extern short iarg
[MAXX
][MAXY
], ivenarg
[], lasthx
, lasthy
, lastnum
, lastpx
, lastpy
;
348 extern short nobeep
, oldx
, oldy
, playerx
, playery
;
349 extern int dayplay
, enable_scroll
, srcount
, yrepcount
, userid
, wisid
,
351 extern time_t initialtime
;
352 extern long outstanding_taxes
, skill
[], gtime
, c
[], cbak
[];
353 extern struct cel
*cell
;
354 extern struct monst monster
[];
355 extern struct sphere
*spheres
;
356 extern struct _itm itm_
[];
357 extern const char *potionhide
[], *potionname
[], *scrollhide
[], *scrollname
[];
363 void makeplayer(void);
364 void newcavelevel(int);
372 int savegame(char *);
373 void restoregame(char *);
376 void bottomline(void);
378 void bottomspell(void);
380 void bot_linex(void);
381 void bottomgold(void);
382 void draws(int, int, int, int);
383 void drawscreen(void);
384 void showcell(int, int);
385 void show1cell(int, int);
386 void showplayer(void);
391 const char *fortune(void);
394 void raiselevel(void);
395 void loselevel(void);
396 void raiseexperience(long);
397 void loseexperience(long);
402 void raisemspells(int);
403 void losemspells(int);
405 void positionplayer(void);
410 int drop_object(int);
411 void enchantarmor(void);
412 void enchweapon(void);
413 int pocketfull(void);
414 int nearbymonst(void);
415 int stealsomething(void);
416 int emptyhanded(void);
417 void creategem(void);
418 void adjustcvalues(int, int);
419 int getpassword(void);
421 int packweight(void);
432 void setupvt100(void);
433 void clearvt100(void);
438 void lprintf(const char *, ...);
440 void lwrite(char *, int);
443 void lrfill(char *, int);
451 void lprcat(const char *);
452 void cursor(int, int);
455 void init_term(void);
457 void cl_line(int, int);
458 void cl_up(int, int);
459 void cl_dn(int, int);
460 void standout(const char *);
461 void set_score_output(void);
464 char *tmcapcnv(char *, char *);
472 unsigned long readnum(long);
475 void createmonster(int);
476 void createitem(int, int);
478 void godirect(int, int, const char *, int, char);
479 int vxy(int *, int *);
480 void hitmonster(int, int);
481 int hitm(int, int, int);
482 void hitplayer(int, int);
485 int newobject(int, int *);
487 long annihilate(void);
488 long newsphere(int, int, int, int);
489 long rmsphere(int, int);
494 void odeadthrone(void);
496 void ofountain(void);
499 void movemonst(void);
505 void lookforobject(void);
507 void quaffpotion(int);
508 void larn_adjtime(long);
509 void read_scroll(int);
518 void savelevel(void);
525 void showscores(void);
526 void showallscores(void);
541 void ointerest(void);
542 void otradepost(void);
551 /* macro to create scroll #'s with probability of occurrence */
552 #define newscroll() (scprob[rund(81)])
553 /* macro to return a potion # created with probability of occurrence */
554 #define newpotion() (potprob[rund(41)])
555 /* macro to return the + points on created leather armor */
556 #define newleather() (nlpts[rund(c[HARDGAME]?13:15)])
557 /* macro to return the + points on chain armor */
558 #define newchain() (nch[rund(10)])
559 /* macro to return + points on plate armor */
560 #define newplate() (nplt[rund(c[HARDGAME]?4:12)])
561 /* macro to return + points on new daggers */
562 #define newdagger() (ndgg[rund(13)])
563 /* macro to return + points on new swords */
564 #define newsword() (nsw[rund(c[HARDGAME]?6:13)])
565 /* macro to destroy object at present location */
566 #define forget() (item[playerx][playery]=know[playerx][playery]=0)
567 /* macro to wipe out a monster at a location */
568 #define disappear(x,y) (mitem[x][y]=know[x][y]=0)
571 /* macro to turn on bold display for the terminal */
572 #define setbold() (lprcat(boldon?"\33[1m":"\33[7m"))
573 /* macro to turn off bold display for the terminal */
574 #define resetbold() (lprcat("\33[m"))
575 /* macro to setup the scrolling region for the terminal */
576 #define setscroll() (lprcat("\33[20;24r"))
577 /* macro to clear the scrolling region for the terminal */
578 #define resetscroll() (lprcat("\33[;24r"))
579 /* macro to clear the screen and home the cursor */
580 #define clear() (lprcat("\33[2J\33[f"), cbak[SPELLS]= -50)
581 #define cltoeoln() lprcat("\33[K")
583 /* defines below are for use in the termcap mode only */
592 /* macro to turn on bold display for the terminal */
593 #define setbold() (*lpnt++ = ST_START)
594 /* macro to turn off bold display for the terminal */
595 #define resetbold() (*lpnt++ = ST_END)
596 /* macro to setup the scrolling region for the terminal */
597 #define setscroll() enable_scroll=1
598 /* macro to clear the scrolling region for the terminal */
599 #define resetscroll() enable_scroll=0
600 /* macro to clear the screen and home the cursor */
601 #define clear() (*lpnt++ =CLEAR, cbak[SPELLS]= -50)
602 /* macro to clear to end of line */
603 #define cltoeoln() (*lpnt++ = CL_LINE)
606 /* macro to output one byte to the output buffer */
607 #define lprc(ch) ((lpnt>=lpend)?(*lpnt++ =(ch), lflush()):(*lpnt++ = (ch)))
610 extern unsigned long randx
;
611 /* macro to seed the random number generator */
612 #define srand(x) (randx=x)
613 /* macros to generate random numbers 1<=rnd(N)<=N 0<=rund(N)<=N-1 */
614 #define rnd(x) ((((randx=randx*1103515245+12345)>>7)%(x))+1)
615 #define rund(x) ((((randx=randx*1103515245+12345)>>7)%(x)) )
616 #endif /* MACRORND */
617 /* macros for miscellaneous data conversion */
618 #define min(x,y) (((x)>(y))?(y):(x))
619 #define max(x,y) (((x)>(y))?(x):(y))
620 #define isalpha(x) (is_alpha[x])
621 #define isdigit(x) (is_digit[x])
622 #define tolower(x) (to_lower[x])
623 #define toupper(x) (to_upper[x])
624 #define lcc(x) (to_lower[x])
625 #define ucc(x) (to_upper[x])