home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / TOP / USR / SRC / larn.t.Z / larn.t / header.h < prev    next >
Text File  |  1988-11-13  |  13KB  |  460 lines

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