]> git.cameronkatri.com Git - bsdgames-darwin.git/blob - larn/header.h
Don't redefine NULL
[bsdgames-darwin.git] / larn / header.h
1 /* $NetBSD: header.h,v 1.14 2003/10/21 07:26:39 agc Exp $ */
2
3 /* header.h Larn is copyrighted 1986 by Noah Morgan. */
4
5 #include <sys/types.h>
6
7 #define MAXLEVEL 11
8 /* max # levels in the dungeon */
9 #define MAXVLEVEL 3
10 /* max # of levels in the temple of the luran */
11 #define MAXX 67
12 #define MAXY 17
13
14 #define SCORESIZE 10
15 /* this is the number of people on a scoreboard max */
16 #define MAXPLEVEL 100
17 /* maximum player level allowed */
18 #define MAXMONST 56
19 /* maximum # monsters in the dungeon */
20 #define SPNUM 38
21 /* maximum number of spells in existance */
22 #define MAXSCROLL 28
23 /* maximum number of scrolls that are possible */
24 #define MAXPOTION 35
25 /* maximum number of potions that are possible */
26 #define TIMELIMIT 30000
27 /* the maximum number of moves before the game is called */
28 #define TAXRATE 1/20
29 /* the tax rate for the LRS */
30 #define MAXOBJ 93
31 /* the maximum number of objects n < MAXOBJ */
32
33 /* this is the structure definition of the monster data */
34 struct monst {
35 char *name;
36 char level;
37 short armorclass;
38 char damage;
39 char attack;
40 char defense;
41 char genocided;
42 char intelligence; /* monsters intelligence -- used to
43 * choose movement */
44 short gold;
45 short hitpoints;
46 unsigned long experience;
47 };
48
49 /* this is the structure definition for the items in the dnd store */
50 struct _itm {
51 short price;
52 u_char obj;
53 u_char arg;
54 char qty;
55 };
56
57 /* this is the structure that holds the entire dungeon specifications */
58 struct cel {
59 short hitp; /* monster's hit points */
60 char mitem; /* the monster ID */
61 char item; /* the object's ID */
62 short iarg; /* the object's argument */
63 char know; /* have we been here before */
64 };
65
66 /* this is the structure for maintaining & moving the spheres of annihilation */
67 struct sphere {
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 short 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
76 * objects */
77 #define INTELLIGENCE 1
78 #define WISDOM 2
79 #define CONSTITUTION 3
80 #define DEXTERITY 4
81 #define CHARISMA 5
82 #define HPMAX 6
83 #define HP 7
84 #define GOLD 8
85 #define EXPERIENCE 9
86 #define LEVEL 10
87 #define REGEN 11
88 #define WCLASS 12
89 #define AC 13
90 #define BANKACCOUNT 14
91 #define SPELLMAX 15
92 #define SPELLS 16
93 #define ENERGY 17
94 #define ECOUNTER 18
95 #define MOREDEFENSES 19
96 #define WEAR 20
97 #define PROTECTIONTIME 21
98 #define WIELD 22
99 #define AMULET 23
100 #define REGENCOUNTER 24
101 #define MOREDAM 25
102 #define DEXCOUNT 26
103 #define STRCOUNT 27
104 #define BLINDCOUNT 28
105 #define CAVELEVEL 29
106 #define CONFUSE 30
107 #define ALTPRO 31
108 #define HERO 32
109 #define CHARMCOUNT 33
110 #define INVISIBILITY 34
111 #define CANCELLATION 35
112 #define HASTESELF 36
113 #define EYEOFLARN 37
114 #define AGGRAVATE 38
115 #define GLOBE 39
116 #define TELEFLAG 40
117 #define SLAYING 41
118 #define NEGATESPIRIT 42
119 #define SCAREMONST 43
120 #define AWARENESS 44
121 #define HOLDMONST 45
122 #define TIMESTOP 46
123 #define HASTEMONST 47
124 #define CUBEofUNDEAD 48
125 #define GIANTSTR 49
126 #define FIRERESISTANCE 50
127 #define BESSMANN 51
128 #define NOTHEFT 52
129 #define HARDGAME 53
130 #define CPUTIME 54
131 #define BYTESIN 55
132 #define BYTESOUT 56
133 #define MOVESMADE 57
134 #define MONSTKILLED 58
135 #define SPELLSCAST 59
136 #define LANCEDEATH 60
137 #define SPIRITPRO 61
138 #define UNDEADPRO 62
139 #define SHIELD 63
140 #define STEALTH 64
141 #define ITCHING 65
142 #define LAUGHING 66
143 #define DRAINSTRENGTH 67
144 #define CLUMSINESS 68
145 #define INFEEBLEMENT 69
146 #define HALFDAM 70
147 #define SEEINVISIBLE 71
148 #define FILLROOM 72
149 #define RANDOMWALK 73
150 #define SPHCAST 74 /* nz if an active sphere of annihilation */
151 #define WTW 75 /* walk through walls */
152 #define STREXTRA 76 /* character strength due to objects or
153 * enchantments */
154 #define TMP 77 /* misc scratch space */
155 #define LIFEPROT 78 /* life protection counter */
156
157 /* defines for the objects in the game */
158
159 #define OALTAR 1
160 #define OTHRONE 2
161 #define OORB 3
162 #define OPIT 4
163 #define OSTAIRSUP 5
164 #define OELEVATORUP 6
165 #define OFOUNTAIN 7
166 #define OSTATUE 8
167 #define OTELEPORTER 9
168 #define OSCHOOL 10
169 #define OMIRROR 11
170 #define ODNDSTORE 12
171 #define OSTAIRSDOWN 13
172 #define OELEVATORDOWN 14
173 #define OBANK2 15
174 #define OBANK 16
175 #define ODEADFOUNTAIN 17
176 #define OMAXGOLD 70
177 #define OGOLDPILE 18
178 #define OOPENDOOR 19
179 #define OCLOSEDDOOR 20
180 #define OWALL 21
181 #define OTRAPARROW 66
182 #define OTRAPARROWIV 67
183
184 #define OLARNEYE 22
185
186 #define OPLATE 23
187 #define OCHAIN 24
188 #define OLEATHER 25
189 #define ORING 60
190 #define OSTUDLEATHER 61
191 #define OSPLINT 62
192 #define OPLATEARMOR 63
193 #define OSSPLATE 64
194 #define OSHIELD 68
195 #define OELVENCHAIN 92
196
197 #define OSWORDofSLASHING 26
198 #define OHAMMER 27
199 #define OSWORD 28
200 #define O2SWORD 29
201 #define OSPEAR 30
202 #define ODAGGER 31
203 #define OBATTLEAXE 57
204 #define OLONGSWORD 58
205 #define OFLAIL 59
206 #define OLANCE 65
207 #define OVORPAL 90
208 #define OSLAYER 91
209
210 #define ORINGOFEXTRA 32
211 #define OREGENRING 33
212 #define OPROTRING 34
213 #define OENERGYRING 35
214 #define ODEXRING 36
215 #define OSTRRING 37
216 #define OCLEVERRING 38
217 #define ODAMRING 39
218
219 #define OBELT 40
220
221 #define OSCROLL 41
222 #define OPOTION 42
223 #define OBOOK 43
224 #define OCHEST 44
225 #define OAMULET 45
226
227 #define OORBOFDRAGON 46
228 #define OSPIRITSCARAB 47
229 #define OCUBEofUNDEAD 48
230 #define ONOTHEFT 49
231
232 #define ODIAMOND 50
233 #define ORUBY 51
234 #define OEMERALD 52
235 #define OSAPPHIRE 53
236
237 #define OENTRANCE 54
238 #define OVOLDOWN 55
239 #define OVOLUP 56
240 #define OHOME 69
241
242 #define OKGOLD 71
243 #define ODGOLD 72
244 #define OIVDARTRAP 73
245 #define ODARTRAP 74
246 #define OTRAPDOOR 75
247 #define OIVTRAPDOOR 76
248 #define OTRADEPOST 77
249 #define OIVTELETRAP 78
250 #define ODEADTHRONE 79
251 #define OANNIHILATION 80 /* sphere of annihilation */
252 #define OTHRONE2 81
253 #define OLRS 82 /* Larn Revenue Service */
254 #define OCOOKIE 83
255 #define OURN 84
256 #define OBRASSLAMP 85
257 #define OHANDofFEAR 86 /* hand of fear */
258 #define OSPHTAILSMAN 87 /* tailsman of the sphere */
259 #define OWWAND 88 /* wand of wonder */
260 #define OPSTAFF 89 /* staff of power */
261 /* used up to 92 */
262
263 /* defines for the monsters as objects */
264
265 #define BAT 1
266 #define GNOME 2
267 #define HOBGOBLIN 3
268 #define JACKAL 4
269 #define KOBOLD 5
270 #define ORC 6
271 #define SNAKE 7
272 #define CENTIPEDE 8
273 #define JACULI 9
274 #define TROGLODYTE 10
275 #define ANT 11
276 #define EYE 12
277 #define LEPRECHAUN 13
278 #define NYMPH 14
279 #define QUASIT 15
280 #define RUSTMONSTER 16
281 #define ZOMBIE 17
282 #define ASSASSINBUG 18
283 #define BUGBEAR 19
284 #define HELLHOUND 20
285 #define ICELIZARD 21
286 #define CENTAUR 22
287 #define TROLL 23
288 #define YETI 24
289 #define WHITEDRAGON 25
290 #define ELF 26
291 #define CUBE 27
292 #define METAMORPH 28
293 #define VORTEX 29
294 #define ZILLER 30
295 #define VIOLETFUNGI 31
296 #define WRAITH 32
297 #define FORVALAKA 33
298 #define LAMANOBE 34
299 #define OSEQUIP 35
300 #define ROTHE 36
301 #define XORN 37
302 #define VAMPIRE 38
303 #define INVISIBLESTALKER 39
304 #define POLTERGEIST 40
305 #define DISENCHANTRESS 41
306 #define SHAMBLINGMOUND 42
307 #define YELLOWMOLD 43
308 #define UMBERHULK 44
309 #define GNOMEKING 45
310 #define MIMIC 46
311 #define WATERLORD 47
312 #define BRONZEDRAGON 48
313 #define GREENDRAGON 49
314 #define PURPLEWORM 50
315 #define XVART 51
316 #define SPIRITNAGA 52
317 #define SILVERDRAGON 53
318 #define PLATINUMDRAGON 54
319 #define GREENURCHIN 55
320 #define REDDRAGON 56
321 #define DEMONLORD 57
322 #define DEMONPRINCE 64
323
324 #ifndef NULL
325 #define NULL 0
326 #endif
327 #define BUFBIG 4096 /* size of the output buffer */
328 #define MAXIBUF 4096 /* size of the input buffer */
329 #define LOGNAMESIZE 40 /* max size of the players name */
330 #define PSNAMESIZE 40 /* max size of the process name */
331
332 #ifndef NODEFS
333 extern char VERSION, SUBVERSION;
334 extern u_char alpha[], beenhere[], boldon, cheat, ckpflag;
335 extern u_char *class[], course[];
336 extern char diagfile[], helpfile[], ckpfile[], larnlevels[],
337 playerids[], optsfile[1024], psname[], savefilename[],
338 scorefile[];
339 extern u_char *inbuffer, is_alpha[], is_digit[];
340 extern u_char item[MAXX][MAXY], iven[], know[MAXX][MAXY];
341 extern char *levelname[], logfile[], loginname[], logname[],
342 lastmonst[];
343 extern u_char *lpbuf, *lpend;
344 extern u_char *lpnt, moved[MAXX][MAXY], mitem[MAXX][MAXY], monstlevel[];
345 extern char monstnamelist[], objnamelist[];
346 extern u_char nch[], ndgg[], nlpts[], nomove, nosignal, nowelcome;
347 extern u_char nplt[], nsw[];
348 extern char *objectname[], *potionhide[], *potionname[],
349 *spelcode[], *spelname[], *spelmes[], aborted[],
350 spelweird[MAXMONST + 8][SPNUM];
351 extern u_char potprob[];
352 extern u_char predostuff, restorflag, scprob[];
353 extern u_char screen[MAXX][MAXY], sex;
354 extern char *speldescript[], *scrollhide[], *scrollname[];
355 extern u_char spelknow[];
356 extern u_char splev[], stealth[MAXX][MAXY], to_lower[], to_upper[], wizard;
357 extern short diroffx[], diroffy[], hitflag, hit2flag, hit3flag, hitp[MAXX][MAXY];
358 extern short iarg[MAXX][MAXY], ivenarg[], lasthx, lasthy, lastnum, lastpx,
359 lastpy;
360 extern short nobeep, oldx, oldy, playerx, playery, level;
361 extern int dayplay, enable_scroll, srcount, yrepcount, userid, wisid,
362 lfd, fd;
363 extern uid_t uid, euid;
364 extern long outstanding_taxes, skill[], gltime, c[], cbak[];
365 extern time_t initialtime;
366 extern unsigned long randx;
367 extern struct cel *cell;
368 extern struct monst monster[];
369 extern struct sphere *spheres;
370 extern struct _itm itm[];
371 extern int rmst, maxitm, lasttime;
372
373 /* macro to create scroll #'s with probability of occurrence */
374 #define newscroll() (scprob[rund(81)])
375 /* macro to return a potion # created with probability of occurrence */
376 #define newpotion() (potprob[rund(41)])
377 /* macro to return the + points on created leather armor */
378 #define newleather() (nlpts[rund(c[HARDGAME]?13:15)])
379 /* macro to return the + points on chain armor */
380 #define newchain() (nch[rund(10)])
381 /* macro to return + points on plate armor */
382 #define newplate() (nplt[rund(c[HARDGAME]?4:12)])
383 /* macro to return + points on new daggers */
384 #define newdagger() (ndgg[rund(13)])
385 /* macro to return + points on new swords */
386 #define newsword() (nsw[rund(c[HARDGAME]?6:13)])
387 /* macro to destroy object at present location */
388 #define forget() (item[playerx][playery]=know[playerx][playery]=0)
389 /* macro to wipe out a monster at a location */
390 #define disappear(x,y) (mitem[x][y]=know[x][y]=0)
391
392 #ifdef VT100
393 /* macro to turn on bold display for the terminal */
394 #define setbold() (lprcat(boldon?"\33[1m":"\33[7m"))
395 /* macro to turn off bold display for the terminal */
396 #define resetbold() (lprcat("\33[m"))
397 /* macro to setup the scrolling region for the terminal */
398 #define setscroll() (lprcat("\33[20;24r"))
399 /* macro to clear the scrolling region for the terminal */
400 #define resetscroll() (lprcat("\33[;24r"))
401 /* macro to clear the screen and home the cursor */
402 #define clear() (lprcat("\33[2J\33[f"), cbak[SPELLS]= -50)
403 #define cltoeoln() lprcat("\33[K")
404 #else /* VT100 */
405 /* defines below are for use in the termcap mode only */
406 #define ST_START 1
407 #define ST_END 2
408 #define BOLD 3
409 #define END_BOLD 4
410 #define CLEAR 5
411 #define CL_LINE 6
412 #define CL_DOWN 14
413 #define CURSOR 15
414 /* macro to turn on bold display for the terminal */
415 #define setbold() (*lpnt++ = ST_START)
416 /* macro to turn off bold display for the terminal */
417 #define resetbold() (*lpnt++ = ST_END)
418 /* macro to setup the scrolling region for the terminal */
419 #define setscroll() enable_scroll=1
420 /* macro to clear the scrolling region for the terminal */
421 #define resetscroll() enable_scroll=0
422 /* macro to clear the screen and home the cursor */
423 #define clear() (*lpnt++ =CLEAR, cbak[SPELLS]= -50)
424 /* macro to clear to end of line */
425 #define cltoeoln() (*lpnt++ = CL_LINE)
426 #endif /* VT100 */
427
428 /* macro to output one byte to the output buffer */
429 #define lprc(ch) ((lpnt>=lpend)?(*lpnt++ =(ch), lflush()):(*lpnt++ =(ch)))
430
431 /* macro to seed the random number generator */
432 #define srand(x) (randx=x)
433 #ifdef MACRORND
434 /* macros to generate random numbers 1<=rnd(N)<=N 0<=rund(N)<=N-1 */
435 #define rnd(x) ((((randx=randx*1103515245+12345)>>7)%(x))+1)
436 #define rund(x) ((((randx=randx*1103515245+12345)>>7)%(x)) )
437 #endif /* MACRORND */
438 /* macros for miscellaneous data conversion */
439 #define min(x,y) (((x)>(y))?(y):(x))
440 #define max(x,y) (((x)>(y))?(x):(y))
441 #define isalpha(x) (is_alpha[x])
442 #define isdigit(x) (is_digit[x])
443 #define tolower(x) (to_lower[x])
444 #define toupper(x) (to_upper[x])
445 #define lcc(x) (to_lower[x])
446 #define ucc(x) (to_upper[x])
447 #endif /* NODEFS */