|
|
1.1 root 1: /* header.h Larn is copyrighted 1986 by Noah Morgan. */
2:
3: #define MAXLEVEL 11
4: /* max # levels in the dungeon */
5: #define MAXVLEVEL 3
6: /* max # of levels in the temple of the luran */
7: #define MAXX 67
8: #define MAXY 17
9:
10: #define SCORESIZE 10
11: /* this is the number of people on a scoreboard max */
12: #define MAXPLEVEL 100
13: /* maximum player level allowed */
14: #define MAXMONST 56
15: /* maximum # monsters in the dungeon */
16: #define SPNUM 38
17: /* maximum number of spells in existance */
18: #define MAXSCROLL 28
19: /* maximum number of scrolls that are possible */
20: #define MAXPOTION 35
21: /* maximum number of potions that are possible */
22: #define TIMELIMIT 30000
23: /* the maximum number of moves before the game is called */
24: #define TAXRATE 1/20
25: /* the tax rate for the LRS */
26: #define MAXOBJ 93
27: /* the maximum number of objects n < MAXOBJ */
28:
29: /* this is the structure definition of the monster data */
30: struct monst
31: {
32: char *name;
33: char level;
34: short armorclass;
35: char damage;
36: char attack;
37: char defense;
38: char genocided;
39: char intelligence; /* monsters intelligence -- used to choose movement */
40: short gold;
41: short hitpoints;
42: unsigned long experience;
43: };
44:
45: /* this is the structure definition for the items in the dnd store */
46: struct _itm
47: {
48: short price;
49: char **mem;
50: char obj;
51: char arg;
52: char qty;
53: };
54:
55: /* this is the structure that holds the entire dungeon specifications */
56: struct cel
57: {
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*/
63: };
64:
65: /* this is the structure for maintaining & moving the spheres of annihilation */
66: struct sphere
67: {
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 */
72: };
73:
74: /* defines for the character attribute array c[] */
75: #define STRENGTH 0 /* characters physical strength not due to objects */
76: #define INTELLIGENCE 1
77: #define WISDOM 2
78: #define CONSTITUTION 3
79: #define DEXTERITY 4
80: #define CHARISMA 5
81: #define HPMAX 6
82: #define HP 7
83: #define GOLD 8
84: #define EXPERIENCE 9
85: #define LEVEL 10
86: #define REGEN 11
87: #define WCLASS 12
88: #define AC 13
89: #define BANKACCOUNT 14
90: #define SPELLMAX 15
91: #define SPELLS 16
92: #define ENERGY 17
93: #define ECOUNTER 18
94: #define MOREDEFENSES 19
95: #define WEAR 20
96: #define PROTECTIONTIME 21
97: #define WIELD 22
98: #define AMULET 23
99: #define REGENCOUNTER 24
100: #define MOREDAM 25
101: #define DEXCOUNT 26
102: #define STRCOUNT 27
103: #define BLINDCOUNT 28
104: #define CAVELEVEL 29
105: #define CONFUSE 30
106: #define ALTPRO 31
107: #define HERO 32
108: #define CHARMCOUNT 33
109: #define INVISIBILITY 34
110: #define CANCELLATION 35
111: #define HASTESELF 36
112: #define EYEOFLARN 37
113: #define AGGRAVATE 38
114: #define GLOBE 39
115: #define TELEFLAG 40
116: #define SLAYING 41
117: #define NEGATESPIRIT 42
118: #define SCAREMONST 43
119: #define AWARENESS 44
120: #define HOLDMONST 45
121: #define TIMESTOP 46
122: #define HASTEMONST 47
123: #define CUBEofUNDEAD 48
124: #define GIANTSTR 49
125: #define FIRERESISTANCE 50
126: #define BESSMANN 51
127: #define NOTHEFT 52
128: #define HARDGAME 53
129: #define CPUTIME 54
130: #define BYTESIN 55
131: #define BYTESOUT 56
132: #define MOVESMADE 57
133: #define MONSTKILLED 58
134: #define SPELLSCAST 59
135: #define LANCEDEATH 60
136: #define SPIRITPRO 61
137: #define UNDEADPRO 62
138: #define SHIELD 63
139: #define STEALTH 64
140: #define ITCHING 65
141: #define LAUGHING 66
142: #define DRAINSTRENGTH 67
143: #define CLUMSINESS 68
144: #define INFEEBLEMENT 69
145: #define HALFDAM 70
146: #define SEEINVISIBLE 71
147: #define FILLROOM 72
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 */
154:
155: /* defines for the objects in the game */
156:
157: #define OALTAR 1
158: #define OTHRONE 2
159: #define OORB 3
160: #define OPIT 4
161: #define OSTAIRSUP 5
162: #define OELEVATORUP 6
163: #define OFOUNTAIN 7
164: #define OSTATUE 8
165: #define OTELEPORTER 9
166: #define OSCHOOL 10
167: #define OMIRROR 11
168: #define ODNDSTORE 12
169: #define OSTAIRSDOWN 13
170: #define OELEVATORDOWN 14
171: #define OBANK2 15
172: #define OBANK 16
173: #define ODEADFOUNTAIN 17
174: #define OMAXGOLD 70
175: #define OGOLDPILE 18
176: #define OOPENDOOR 19
177: #define OCLOSEDDOOR 20
178: #define OWALL 21
179: #define OTRAPARROW 66
180: #define OTRAPARROWIV 67
181:
182: #define OLARNEYE 22
183:
184: #define OPLATE 23
185: #define OCHAIN 24
186: #define OLEATHER 25
187: #define ORING 60
188: #define OSTUDLEATHER 61
189: #define OSPLINT 62
190: #define OPLATEARMOR 63
191: #define OSSPLATE 64
192: #define OSHIELD 68
193: #define OELVENCHAIN 92
194:
195: #define OSWORDofSLASHING 26
196: #define OHAMMER 27
197: #define OSWORD 28
198: #define O2SWORD 29
199: #define OSPEAR 30
200: #define ODAGGER 31
201: #define OBATTLEAXE 57
202: #define OLONGSWORD 58
203: #define OFLAIL 59
204: #define OLANCE 65
205: #define OVORPAL 90
206: #define OSLAYER 91
207:
208: #define ORINGOFEXTRA 32
209: #define OREGENRING 33
210: #define OPROTRING 34
211: #define OENERGYRING 35
212: #define ODEXRING 36
213: #define OSTRRING 37
214: #define OCLEVERRING 38
215: #define ODAMRING 39
216:
217: #define OBELT 40
218:
219: #define OSCROLL 41
220: #define OPOTION 42
221: #define OBOOK 43
222: #define OCHEST 44
223: #define OAMULET 45
224:
225: #define OORBOFDRAGON 46
226: #define OSPIRITSCARAB 47
227: #define OCUBEofUNDEAD 48
228: #define ONOTHEFT 49
229:
230: #define ODIAMOND 50
231: #define ORUBY 51
232: #define OEMERALD 52
233: #define OSAPPHIRE 53
234:
235: #define OENTRANCE 54
236: #define OVOLDOWN 55
237: #define OVOLUP 56
238: #define OHOME 69
239:
240: #define OKGOLD 71
241: #define ODGOLD 72
242: #define OIVDARTRAP 73
243: #define ODARTRAP 74
244: #define OTRAPDOOR 75
245: #define OIVTRAPDOOR 76
246: #define OTRADEPOST 77
247: #define OIVTELETRAP 78
248: #define ODEADTHRONE 79
249: #define OANNIHILATION 80 /* sphere of annihilation */
250: #define OTHRONE2 81
251: #define OLRS 82 /* Larn Revenue Service */
252: #define OCOOKIE 83
253: #define OURN 84
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 */
259: /* used up to 92 */
260:
261: /* defines for the monsters as objects */
262:
263: #define BAT 1
264: #define GNOME 2
265: #define HOBGOBLIN 3
266: #define JACKAL 4
267: #define KOBOLD 5
268: #define ORC 6
269: #define SNAKE 7
270: #define CENTIPEDE 8
271: #define JACULI 9
272: #define TROGLODYTE 10
273: #define ANT 11
274: #define EYE 12
275: #define LEPRECHAUN 13
276: #define NYMPH 14
277: #define QUASIT 15
278: #define RUSTMONSTER 16
279: #define ZOMBIE 17
280: #define ASSASSINBUG 18
281: #define BUGBEAR 19
282: #define HELLHOUND 20
283: #define ICELIZARD 21
284: #define CENTAUR 22
285: #define TROLL 23
286: #define YETI 24
287: #define WHITEDRAGON 25
288: #define ELF 26
289: #define CUBE 27
290: #define METAMORPH 28
291: #define VORTEX 29
292: #define ZILLER 30
293: #define VIOLETFUNGI 31
294: #define WRAITH 32
295: #define FORVALAKA 33
296: #define LAMANOBE 34
297: #define OSEQUIP 35
298: #define ROTHE 36
299: #define XORN 37
300: #define VAMPIRE 38
301: #define INVISIBLESTALKER 39
302: #define POLTERGEIST 40
303: #define DISENCHANTRESS 41
304: #define SHAMBLINGMOUND 42
305: #define YELLOWMOLD 43
306: #define UMBERHULK 44
307: #define GNOMEKING 45
308: #define MIMIC 46
309: #define WATERLORD 47
310: #define BRONZEDRAGON 48
311: #define GREENDRAGON 49
312: #define PURPLEWORM 50
313: #define XVART 51
314: #define SPIRITNAGA 52
315: #define SILVERDRAGON 53
316: #define PLATINUMDRAGON 54
317: #define GREENURCHIN 55
318: #define REDDRAGON 56
319: #define DEMONLORD 57
320: #define DEMONPRINCE 64
321:
322: #define NULL 0
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 */
327:
328: #ifndef NODEFS
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[];
353:
354: char *fortune(),*malloc(),*getenv(),*getlogin(),*lgetw(),*lgetl(),*ctime();
355: char *tmcapcnv(),*tgetstr(),*tgoto();
356: long paytaxes(),lgetc(),lrint(),time();
357: unsigned long readnum();
358:
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)
377:
378: #ifdef VT100
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")
390: #else VT100
391: /* defines below are for use in the termcap mode only */
392: #define ST_START 1
393: #define ST_END 2
394: #define BOLD 3
395: #define END_BOLD 4
396: #define CLEAR 5
397: #define CL_LINE 6
398: #define CL_DOWN 14
399: #define CURSOR 15
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)
412: #endif VT100
413:
414: /* macro to output one byte to the output buffer */
415: #define lprc(ch) ((lpnt>=lpend)?(*lpnt++ =(ch), lflush()):(*lpnt++ =(ch)))
416:
417: /* macro to seed the random number generator */
418: #define srand(x) (randx=x)
419: #ifdef MACRORND
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)) )
423: #endif MACRORND
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])
433: #endif NODEFS
434:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.