xref: /csrg-svn/games/larn/header.h (revision 51010)
136977Sbostic /*	header.h		Larn is copyrighted 1986 by Noah Morgan. */
236977Sbostic 
336977Sbostic #define MAXLEVEL 11
436977Sbostic 	/*	max # levels in the dungeon			*/
536977Sbostic #define MAXVLEVEL 3
636977Sbostic 	/*	max # of levels in the temple of the luran	*/
736977Sbostic #define MAXX 67
836977Sbostic #define MAXY 17
936977Sbostic 
1036977Sbostic #define SCORESIZE 10
1136977Sbostic 	/*	this is the number of people on a scoreboard max */
1236977Sbostic #define MAXPLEVEL 100
1336977Sbostic 	/*	maximum player level allowed		*/
1436977Sbostic #define MAXMONST 56
1536977Sbostic 	/*	maximum # monsters in the dungeon	*/
1636977Sbostic #define SPNUM 38
1736977Sbostic 	/*	maximum number of spells in existance	*/
1836977Sbostic #define MAXSCROLL 28
1936977Sbostic 	/*	maximum number of scrolls that are possible	*/
2036977Sbostic #define MAXPOTION 35
2136977Sbostic 	/*	maximum number of potions that are possible	*/
2236977Sbostic #define TIMELIMIT 30000
2336977Sbostic 	/*	the maximum number of moves before the game is called */
2436977Sbostic #define TAXRATE 1/20
2536977Sbostic 	/*	the tax rate for the LRS */
2636977Sbostic #define MAXOBJ 93
2736977Sbostic 	/* the maximum number of objects   n < MAXOBJ */
2836977Sbostic 
2936977Sbostic /*	this is the structure definition of the monster data	*/
3036977Sbostic struct monst
3136977Sbostic 	{
3236977Sbostic 	char	*name;
3336977Sbostic 	char	level;
3436977Sbostic 	short	armorclass;
3536977Sbostic 	char	damage;
3636977Sbostic 	char	attack;
3736977Sbostic 	char	defense;
3836977Sbostic 	char	genocided;
3936977Sbostic 	char 	intelligence; /* monsters intelligence -- used to choose movement */
4036977Sbostic 	short	gold;
4136977Sbostic 	short	hitpoints;
4236977Sbostic 	unsigned long experience;
4336977Sbostic 	};
4436977Sbostic 
4536977Sbostic /*	this is the structure definition for the items in the dnd store */
4636977Sbostic struct _itm
4736977Sbostic 	{
4836977Sbostic 	short	price;
4936977Sbostic 	char	**mem;
5036977Sbostic 	char	obj;
5136977Sbostic 	char	arg;
5236977Sbostic 	char	qty;
5336977Sbostic 	};
5436977Sbostic 
5536977Sbostic /*	this is the structure that holds the entire dungeon specifications	*/
5636977Sbostic struct cel
5736977Sbostic 	{
5836977Sbostic 	short	hitp;	/*	monster's hit points	*/
5936977Sbostic 	char	mitem;	/*	the monster ID			*/
6036977Sbostic 	char	item;	/*	the object's ID			*/
6136977Sbostic 	short	iarg;	/*	the object's argument	*/
6236977Sbostic 	char	know;	/*	have we been here before*/
6336977Sbostic 	};
6436977Sbostic 
6536977Sbostic /* this is the structure for maintaining & moving the spheres of annihilation */
6636977Sbostic struct sphere
6736977Sbostic 	{
6836977Sbostic 	struct sphere *p;	/* pointer to next structure */
6936977Sbostic 	char x,y,lev;		/* location of the sphere */
7036977Sbostic 	char dir;			/* direction sphere is going in */
7136977Sbostic 	char lifetime;		/* duration of the sphere */
7236977Sbostic 	};
7336977Sbostic 
7436977Sbostic /*	defines for the character attribute array	c[]	*/
7536977Sbostic #define STRENGTH 0		/* characters physical strength not due to objects */
7636977Sbostic #define INTELLIGENCE 1
7736977Sbostic #define WISDOM 2
7836977Sbostic #define CONSTITUTION 3
7936977Sbostic #define DEXTERITY 4
8036977Sbostic #define CHARISMA 5
8136977Sbostic #define HPMAX 6
8236977Sbostic #define HP 7
8336977Sbostic #define GOLD 8
8436977Sbostic #define EXPERIENCE 9
8536977Sbostic #define LEVEL 10
8636977Sbostic #define REGEN 11
8736977Sbostic #define WCLASS 12
8836977Sbostic #define AC 13
8936977Sbostic #define BANKACCOUNT 14
9036977Sbostic #define SPELLMAX 15
9136977Sbostic #define SPELLS 16
9236977Sbostic #define ENERGY 17
9336977Sbostic #define ECOUNTER 18
9436977Sbostic #define MOREDEFENSES 19
9536977Sbostic #define WEAR 20
9636977Sbostic #define PROTECTIONTIME 21
9736977Sbostic #define WIELD 22
9836977Sbostic #define AMULET 23
9936977Sbostic #define REGENCOUNTER 24
10036977Sbostic #define MOREDAM 25
10136977Sbostic #define DEXCOUNT 26
10236977Sbostic #define STRCOUNT 27
10336977Sbostic #define BLINDCOUNT 28
10436977Sbostic #define CAVELEVEL 29
10536977Sbostic #define CONFUSE 30
10636977Sbostic #define ALTPRO 31
10736977Sbostic #define HERO 32
10836977Sbostic #define CHARMCOUNT 33
10936977Sbostic #define INVISIBILITY 34
11036977Sbostic #define CANCELLATION 35
11136977Sbostic #define HASTESELF 36
11236977Sbostic #define EYEOFLARN 37
11336977Sbostic #define AGGRAVATE 38
11436977Sbostic #define GLOBE 39
11536977Sbostic #define TELEFLAG 40
11636977Sbostic #define SLAYING 41
11736977Sbostic #define NEGATESPIRIT 42
11836977Sbostic #define SCAREMONST 43
11936977Sbostic #define AWARENESS 44
12036977Sbostic #define HOLDMONST 45
12136977Sbostic #define TIMESTOP 46
12236977Sbostic #define HASTEMONST 47
12336977Sbostic #define CUBEofUNDEAD 48
12436977Sbostic #define GIANTSTR 49
12536977Sbostic #define FIRERESISTANCE 50
12636977Sbostic #define BESSMANN 51
12736977Sbostic #define NOTHEFT 52
12836977Sbostic #define HARDGAME 53
12936977Sbostic #define CPUTIME 54
13036977Sbostic #define BYTESIN 55
13136977Sbostic #define BYTESOUT 56
13236977Sbostic #define MOVESMADE 57
13336977Sbostic #define MONSTKILLED 58
13436977Sbostic #define SPELLSCAST 59
13536977Sbostic #define LANCEDEATH 60
13636977Sbostic #define SPIRITPRO 61
13736977Sbostic #define UNDEADPRO 62
13836977Sbostic #define SHIELD 63
13936977Sbostic #define STEALTH 64
14036977Sbostic #define ITCHING 65
14136977Sbostic #define LAUGHING 66
14236977Sbostic #define DRAINSTRENGTH 67
14336977Sbostic #define CLUMSINESS 68
14436977Sbostic #define INFEEBLEMENT 69
14536977Sbostic #define HALFDAM 70
14636977Sbostic #define SEEINVISIBLE 71
14736977Sbostic #define FILLROOM 72
14836977Sbostic #define RANDOMWALK 73
14936977Sbostic #define SPHCAST 74	/* nz if an active sphere of annihilation */
15036977Sbostic #define WTW 75		/* walk through walls */
15136977Sbostic #define STREXTRA 76	/* character strength due to objects or enchantments */
15236977Sbostic #define TMP 77	/* misc scratch space */
15336977Sbostic #define LIFEPROT 78 /* life protection counter */
15436977Sbostic 
15536977Sbostic /*	defines for the objects in the game		*/
15636977Sbostic 
15736977Sbostic #define OALTAR 1
15836977Sbostic #define OTHRONE 2
15936977Sbostic #define OORB 3
16036977Sbostic #define OPIT 4
16136977Sbostic #define OSTAIRSUP 5
16236977Sbostic #define OELEVATORUP 6
16336977Sbostic #define OFOUNTAIN 7
16436977Sbostic #define OSTATUE 8
16536977Sbostic #define OTELEPORTER 9
16636977Sbostic #define OSCHOOL 10
16736977Sbostic #define OMIRROR 11
16836977Sbostic #define ODNDSTORE 12
16936977Sbostic #define OSTAIRSDOWN 13
17036977Sbostic #define OELEVATORDOWN 14
17136977Sbostic #define OBANK2 15
17236977Sbostic #define OBANK 16
17336977Sbostic #define ODEADFOUNTAIN 17
17436977Sbostic #define OMAXGOLD 70
17536977Sbostic #define OGOLDPILE 18
17636977Sbostic #define OOPENDOOR 19
17736977Sbostic #define OCLOSEDDOOR 20
17836977Sbostic #define OWALL 21
17936977Sbostic #define OTRAPARROW 66
18036977Sbostic #define OTRAPARROWIV 67
18136977Sbostic 
18236977Sbostic #define OLARNEYE 22
18336977Sbostic 
18436977Sbostic #define OPLATE 23
18536977Sbostic #define OCHAIN 24
18636977Sbostic #define OLEATHER 25
18736977Sbostic #define ORING 60
18836977Sbostic #define OSTUDLEATHER 61
18936977Sbostic #define OSPLINT 62
19036977Sbostic #define OPLATEARMOR 63
19136977Sbostic #define OSSPLATE 64
19236977Sbostic #define OSHIELD 68
19336977Sbostic #define OELVENCHAIN 92
19436977Sbostic 
19536977Sbostic #define OSWORDofSLASHING 26
19636977Sbostic #define OHAMMER 27
19736977Sbostic #define OSWORD 28
19836977Sbostic #define O2SWORD 29
19936977Sbostic #define OSPEAR 30
20036977Sbostic #define ODAGGER 31
20136977Sbostic #define OBATTLEAXE 57
20236977Sbostic #define OLONGSWORD 58
20336977Sbostic #define OFLAIL 59
20436977Sbostic #define OLANCE 65
20536977Sbostic #define OVORPAL 90
20636977Sbostic #define OSLAYER 91
20736977Sbostic 
20836977Sbostic #define ORINGOFEXTRA 32
20936977Sbostic #define OREGENRING 33
21036977Sbostic #define OPROTRING 34
21136977Sbostic #define OENERGYRING 35
21236977Sbostic #define ODEXRING 36
21336977Sbostic #define OSTRRING 37
21436977Sbostic #define OCLEVERRING 38
21536977Sbostic #define ODAMRING 39
21636977Sbostic 
21736977Sbostic #define OBELT 40
21836977Sbostic 
21936977Sbostic #define OSCROLL 41
22036977Sbostic #define OPOTION 42
22136977Sbostic #define OBOOK 43
22236977Sbostic #define OCHEST 44
22336977Sbostic #define OAMULET 45
22436977Sbostic 
22536977Sbostic #define OORBOFDRAGON 46
22636977Sbostic #define OSPIRITSCARAB 47
22736977Sbostic #define OCUBEofUNDEAD 48
22836977Sbostic #define ONOTHEFT 49
22936977Sbostic 
23036977Sbostic #define ODIAMOND 50
23136977Sbostic #define ORUBY 51
23236977Sbostic #define OEMERALD 52
23336977Sbostic #define OSAPPHIRE 53
23436977Sbostic 
23536977Sbostic #define OENTRANCE 54
23636977Sbostic #define OVOLDOWN 55
23736977Sbostic #define OVOLUP 56
23836977Sbostic #define OHOME 69
23936977Sbostic 
24036977Sbostic #define OKGOLD 71
24136977Sbostic #define ODGOLD 72
24236977Sbostic #define OIVDARTRAP 73
24336977Sbostic #define ODARTRAP 74
24436977Sbostic #define OTRAPDOOR 75
24536977Sbostic #define OIVTRAPDOOR 76
24636977Sbostic #define OTRADEPOST 77
24736977Sbostic #define OIVTELETRAP 78
24836977Sbostic #define ODEADTHRONE 79
24936977Sbostic #define OANNIHILATION 80		/* sphere of annihilation */
25036977Sbostic #define OTHRONE2 81
25136977Sbostic #define OLRS 82				/* Larn Revenue Service */
25236977Sbostic #define OCOOKIE 83
25336977Sbostic #define OURN 84
25436977Sbostic #define OBRASSLAMP 85
25536977Sbostic #define OHANDofFEAR 86		/* hand of fear */
25636977Sbostic #define OSPHTAILSMAN 87		/* tailsman of the sphere */
25736977Sbostic #define OWWAND 88			/* wand of wonder */
25836977Sbostic #define OPSTAFF 89			/* staff of power */
25936977Sbostic /* used up to 92 */
26036977Sbostic 
26136977Sbostic /*	defines for the monsters as objects		*/
26236977Sbostic 
26336977Sbostic #define BAT 1
26436977Sbostic #define GNOME 2
26536977Sbostic #define HOBGOBLIN 3
26636977Sbostic #define JACKAL 4
26736977Sbostic #define KOBOLD 5
26836977Sbostic #define ORC 6
26936977Sbostic #define SNAKE 7
27036977Sbostic #define CENTIPEDE 8
27136977Sbostic #define JACULI 9
27236977Sbostic #define TROGLODYTE 10
27336977Sbostic #define ANT 11
27436977Sbostic #define EYE 12
27536977Sbostic #define LEPRECHAUN 13
27636977Sbostic #define NYMPH 14
27736977Sbostic #define QUASIT 15
27836977Sbostic #define RUSTMONSTER 16
27936977Sbostic #define ZOMBIE 17
28036977Sbostic #define ASSASSINBUG 18
28136977Sbostic #define BUGBEAR 19
28236977Sbostic #define HELLHOUND 20
28336977Sbostic #define ICELIZARD 21
28436977Sbostic #define CENTAUR 22
28536977Sbostic #define TROLL 23
28636977Sbostic #define YETI 24
28736977Sbostic #define WHITEDRAGON 25
28836977Sbostic #define ELF 26
28936977Sbostic #define CUBE 27
29036977Sbostic #define METAMORPH 28
29136977Sbostic #define VORTEX 29
29236977Sbostic #define ZILLER 30
29336977Sbostic #define VIOLETFUNGI 31
29436977Sbostic #define WRAITH 32
29536977Sbostic #define FORVALAKA 33
29636977Sbostic #define LAMANOBE 34
29736977Sbostic #define OSEQUIP 35
29836977Sbostic #define ROTHE 36
29936977Sbostic #define XORN 37
30036977Sbostic #define VAMPIRE 38
30136977Sbostic #define INVISIBLESTALKER 39
30236977Sbostic #define POLTERGEIST 40
30336977Sbostic #define DISENCHANTRESS 41
30436977Sbostic #define SHAMBLINGMOUND 42
30536977Sbostic #define YELLOWMOLD 43
30636977Sbostic #define UMBERHULK 44
30736977Sbostic #define GNOMEKING 45
30836977Sbostic #define MIMIC 46
30936977Sbostic #define WATERLORD 47
31036977Sbostic #define BRONZEDRAGON 48
31136977Sbostic #define GREENDRAGON 49
31236977Sbostic #define PURPLEWORM 50
31336977Sbostic #define XVART 51
31436977Sbostic #define SPIRITNAGA 52
31536977Sbostic #define SILVERDRAGON 53
31636977Sbostic #define PLATINUMDRAGON 54
31736977Sbostic #define GREENURCHIN 55
31836977Sbostic #define REDDRAGON 56
31936977Sbostic #define DEMONLORD 57
32036977Sbostic #define DEMONPRINCE 64
32136977Sbostic 
32236977Sbostic #define NULL 0
32336977Sbostic #define BUFBIG	4096			/* size of the output buffer */
32436977Sbostic #define MAXIBUF	4096			/* size of the input buffer */
32536977Sbostic #define LOGNAMESIZE 40			/* max size of the players name */
32636977Sbostic #define PSNAMESIZE 40			/* max size of the process name */
32736977Sbostic 
32836977Sbostic #ifndef NODEFS
32936977Sbostic extern char VERSION,SUBVERSION;
33036977Sbostic extern char aborted[],alpha[],beenhere[],boldon,cheat,ckpfile[],ckpflag;
33141289Sbostic extern char *class[],course[],diagfile[],fortfile[],helpfile[];
33236977Sbostic extern char *inbuffer,is_alpha[],is_digit[];
33336977Sbostic extern char item[MAXX][MAXY],iven[],know[MAXX][MAXY],larnlevels[],lastmonst[];
33436977Sbostic extern char level,*levelname[],logfile[],loginname[],logname[],*lpbuf,*lpend;
33536977Sbostic extern char *lpnt,moved[MAXX][MAXY],mitem[MAXX][MAXY],monstlevel[];
33636977Sbostic extern char monstnamelist[],nch[],ndgg[],nlpts[],nomove,nosignal,nowelcome;
33736977Sbostic extern char nplt[],nsw[],*objectname[];
33836977Sbostic extern char objnamelist[],optsfile[],*potionname[],playerids[],potprob[];
33936977Sbostic extern char predostuff,psname[],restorflag,savefilename[],scorefile[],scprob[];
34036977Sbostic extern char screen[MAXX][MAXY],*scrollname[],sex,*spelcode[],*speldescript[];
34136977Sbostic extern char spelknow[],*spelname[],*spelmes[],spelweird[MAXMONST+8][SPNUM];
34236977Sbostic extern char splev[],stealth[MAXX][MAXY],to_lower[],to_upper[],wizard;
34336977Sbostic extern short diroffx[],diroffy[],hitflag,hit2flag,hit3flag,hitp[MAXX][MAXY];
34436977Sbostic extern short iarg[MAXX][MAXY],ivenarg[],lasthx,lasthy,lastnum,lastpx,lastpy;
34536977Sbostic extern short nobeep,oldx,oldy,playerx,playery;
34636977Sbostic extern int dayplay,enable_scroll,srcount,yrepcount,userid,wisid,lfd,fd;
34736977Sbostic extern long initialtime,outstanding_taxes,skill[],gtime,c[],cbak[];
34836977Sbostic extern unsigned long randx;
34936977Sbostic extern struct cel *cell;
35036977Sbostic extern struct monst monster[];
35136977Sbostic extern struct sphere *spheres;
35236977Sbostic extern struct _itm itm[];
35336977Sbostic 
354*51010Ssellgren char *fortune(),*getenv(),*getlogin(),*lgetw(),*lgetl(),*ctime();
35536977Sbostic char *tmcapcnv(),*tgetstr(),*tgoto();
35636977Sbostic long paytaxes(),lgetc(),lrint(),time();
35736977Sbostic unsigned long readnum();
358*51010Ssellgren void *malloc();
35936977Sbostic 
36036977Sbostic 	/* macro to create scroll #'s with probability of occurrence */
36136977Sbostic #define newscroll() (scprob[rund(81)])
36236977Sbostic 	/* macro to return a potion # created with probability of occurrence */
36336977Sbostic #define newpotion() (potprob[rund(41)])
36436977Sbostic 	/* macro to return the + points on created leather armor */
36536977Sbostic #define newleather() (nlpts[rund(c[HARDGAME]?13:15)])
36636977Sbostic 	/* macro to return the + points on chain armor */
36736977Sbostic #define newchain() (nch[rund(10)])
36836977Sbostic 	/* macro to return + points on plate armor */
36936977Sbostic #define newplate() (nplt[rund(c[HARDGAME]?4:12)])
37036977Sbostic 	/* macro to return + points on new daggers */
37136977Sbostic #define newdagger() (ndgg[rund(13)])
37236977Sbostic 	/* macro to return + points on new swords */
37336977Sbostic #define newsword() (nsw[rund(c[HARDGAME]?6:13)])
37436977Sbostic 	/* macro to destroy object at present location */
37536977Sbostic #define forget() (item[playerx][playery]=know[playerx][playery]=0)
37636977Sbostic 	/* macro to wipe out a monster at a location */
37736977Sbostic #define disappear(x,y) (mitem[x][y]=know[x][y]=0)
37836977Sbostic 
37936977Sbostic #ifdef VT100
38036977Sbostic 	/* macro to turn on bold display for the terminal */
38136977Sbostic #define setbold() (lprcat(boldon?"\33[1m":"\33[7m"))
38236977Sbostic 	/* macro to turn off bold display for the terminal */
38336977Sbostic #define resetbold() (lprcat("\33[m"))
38436977Sbostic 	/* macro to setup the scrolling region for the terminal */
38536977Sbostic #define setscroll() (lprcat("\33[20;24r"))
38636977Sbostic 	/* macro to clear the scrolling region for the terminal */
38736977Sbostic #define resetscroll() (lprcat("\33[;24r"))
38836977Sbostic 	/* macro to clear the screen and home the cursor */
38936977Sbostic #define clear() (lprcat("\33[2J\33[f"), cbak[SPELLS]= -50)
39036977Sbostic #define cltoeoln() lprcat("\33[K")
39136977Sbostic #else VT100
39236977Sbostic 	/* defines below are for use in the termcap mode only */
39336977Sbostic #define ST_START 1
39436977Sbostic #define ST_END   2
39536977Sbostic #define BOLD     3
39636977Sbostic #define END_BOLD 4
39736977Sbostic #define CLEAR    5
39836977Sbostic #define CL_LINE  6
39936977Sbostic #define CL_DOWN 14
40036977Sbostic #define CURSOR  15
40136977Sbostic 	/* macro to turn on bold display for the terminal */
40236977Sbostic #define setbold() (*lpnt++ = ST_START)
40336977Sbostic 	/* macro to turn off bold display for the terminal */
40436977Sbostic #define resetbold() (*lpnt++ = ST_END)
40536977Sbostic 	/* macro to setup the scrolling region for the terminal */
40636977Sbostic #define setscroll() enable_scroll=1
40736977Sbostic 	/* macro to clear the scrolling region for the terminal */
40836977Sbostic #define resetscroll() enable_scroll=0
40936977Sbostic 	/* macro to clear the screen and home the cursor */
41036977Sbostic #define clear() (*lpnt++ =CLEAR, cbak[SPELLS]= -50)
41136977Sbostic 	/* macro to clear to end of line */
41236977Sbostic #define cltoeoln() (*lpnt++ = CL_LINE)
41336977Sbostic #endif VT100
41436977Sbostic 
41536977Sbostic 	/* macro to output one byte to the output buffer */
41636977Sbostic #define lprc(ch) ((lpnt>=lpend)?(*lpnt++ =(ch), lflush()):(*lpnt++ =(ch)))
41736977Sbostic 
41836977Sbostic 	/* macro to seed the random number generator */
41936977Sbostic #define srand(x) (randx=x)
42036977Sbostic #ifdef MACRORND
42136977Sbostic 	/* macros to generate random numbers   1<=rnd(N)<=N   0<=rund(N)<=N-1 */
42236977Sbostic #define rnd(x)  ((((randx=randx*1103515245+12345)>>7)%(x))+1)
42336977Sbostic #define rund(x) ((((randx=randx*1103515245+12345)>>7)%(x))  )
42436977Sbostic #endif MACRORND
42536977Sbostic 	/* macros for miscellaneous data conversion */
42636977Sbostic #define min(x,y) (((x)>(y))?(y):(x))
42736977Sbostic #define max(x,y) (((x)>(y))?(x):(y))
42836977Sbostic #define isalpha(x) (is_alpha[x])
42936977Sbostic #define isdigit(x) (is_digit[x])
43036977Sbostic #define tolower(x) (to_lower[x])
43136977Sbostic #define toupper(x) (to_upper[x])
43236977Sbostic #define lcc(x) (to_lower[x])
43336977Sbostic #define ucc(x) (to_upper[x])
43436977Sbostic #endif NODEFS
43536977Sbostic 
436