Annotation of early-roguelike/srogue/rogue.h, Revision 1.1
1.1 ! rubenllo 1: /*
! 2: * Rogue definitions and variable declarations
! 3: *
! 4: * @(#)rogue.h 9.0 (rdk) 7/17/84
! 5: *
! 6: * Super-Rogue
! 7: * Copyright (C) 1984 Robert D. Kindelberger
! 8: * All rights reserved.
! 9: *
! 10: * Based on "Rogue: Exploring the Dungeons of Doom"
! 11: * Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman
! 12: * All rights reserved.
! 13: *
! 14: * See the file LICENSE.TXT for full copyright and licensing information.
! 15: */
! 16:
! 17: #ifdef BSD
! 18: #include "cx.h"
! 19: #endif
! 20:
! 21:
! 22: #include <ctype.h>
! 23: #include <curses.h>
! 24:
! 25: #ifdef ATT
! 26: #define CBREAK FALSE
! 27: #define _IOSTRG 01
! 28: #endif
! 29:
! 30: #ifdef HAVE_CONFIG_H
! 31: #include "config.h"
! 32: #elif defined(_WIN32) && defined(__PDCURSES__)
! 33: #define HAVE_ERASECHAR
! 34: #define HAVE_KILLCHAR
! 35: #endif
! 36:
! 37: /* mdport functions */
! 38: #ifdef HAVE_SYS_TYPES_H
! 39: #include <sys/types.h>
! 40: #endif
! 41:
! 42: #ifndef uid_t
! 43: typedef unsigned int uid_t;
! 44: #endif
! 45: #ifndef gid_t
! 46: typedef unsigned int gid_t;
! 47: #endif
! 48:
! 49: int md_chmod(const char *filename, int mode);
! 50: char *md_crypt(const char *key, const char *salt);
! 51: int md_dsuspchar(void);
! 52: int md_erasechar(void);
! 53: FILE * md_fdopen(int fd, char *mode);
! 54: char *md_gethomedir(void);
! 55: char *md_getusername(void);
! 56: uid_t md_getuid(void);
! 57: gid_t md_getgid(void);
! 58: char *md_getpass(char *prompt);
! 59: char *md_getrealname(uid_t uid);
! 60: void md_init(void);
! 61: int md_killchar(void);
! 62: void md_normaluser(void);
! 63: void md_raw_standout(void);
! 64: void md_raw_standend(void);
! 65: int md_readchar(WINDOW *win);
! 66: int md_setdsuspchar(int c);
! 67: int md_shellescape(void);
! 68: void md_sleep(int s);
! 69: int md_suspchar(void);
! 70: int md_unlink(char *file);
! 71: int md_unlink_open_file(const char *file, FILE *inf);
! 72: void md_tstpsignal(void);
! 73: void md_tstphold(void);
! 74: void md_tstpresume(void);
! 75: void md_ignoreallsignals(void);
! 76: void md_onsignal_autosave(void);
! 77: void md_onsignal_exit(void);
! 78: void md_onsignal_default(void);
! 79: int md_issymlink(char *sp);
! 80: long md_memused(void);
! 81: int md_random(void);
! 82: void md_srandom(unsigned int seed);
! 83: unsigned int md_random_seed(void);
! 84: char *xcrypt(const char *key, const char *setting);
! 85:
! 86: #define reg register /* register abbr. */
! 87:
! 88: /*
! 89: * Maximum number of different things
! 90: */
! 91:
! 92: #define NCOLORS 32
! 93: #define NSYLS 159
! 94: #define NSTONES 35
! 95: #define NWOOD 24
! 96: #define NMETAL 15
! 97:
! 98: #define MAXDAEMONS 20
! 99:
! 100: #define TYPETRAPS 9 /* max types of traps */
! 101: #define MAXROOMS 9 /* max rooms per level */
! 102: #define MAXTHINGS 9 /* max things on each level */
! 103: #define MAXOBJ 9 /* max goodies on each level */
! 104: #define MAXPACK 23 /* max things this hero can carry */
! 105: #define MAXTRAPS 10 /* max traps per level */
! 106: #define MAXMONS 52 /* max available monsters */
! 107: #define MONRANGE 20 /* max # of monsters avail each level */
! 108: #define AMLEVEL 35 /* earliest level that amulet can appear */
! 109: #define MAXPURCH 4 /* max purchases in trading post */
! 110: #define MINABIL 3 /* minimum for any ability */
! 111: #define MAXSTR 24 /* maximum strength */
! 112: #define MAXOTHER 18 /* maximum wis, dex, con */
! 113: #define NORMAC 10 /* normal hero armor class (no armor) */
! 114: #define MONWIS 10 /* monsters standard wisdom */
! 115:
! 116: #define NORMLEV 0 /* normal level */
! 117: #define POSTLEV 1 /* trading post level */
! 118: #define MAZELEV 2 /* maze level */
! 119:
! 120: #define NORMFOOD 0 /* normal food's group no. */
! 121: #define FRUITFOOD 1 /* fruit's group no. */
! 122: #define NEWGROUP 2 /* start of group no. other than food */
! 123:
! 124: #define NUMTHINGS 8 /* types of goodies for hero */
! 125: #define TYP_POTION 0
! 126: #define TYP_SCROLL 1
! 127: #define TYP_FOOD 2
! 128: #define TYP_WEAPON 3
! 129: #define TYP_ARMOR 4
! 130: #define TYP_RING 5
! 131: #define TYP_STICK 6
! 132: #define TYP_AMULET 7
! 133:
! 134: #define V_PACK 3600 /* max volume in pack */
! 135: #define V_POTION 50 /* volume of potion */
! 136: #define V_SCROLL 80 /* volume of scroll */
! 137: #define V_FOOD 35 /* volume of food */
! 138: #define V_WEAPON 0 /* volume of weapon (depends on wep) */
! 139: #define V_ARMOR 0 /* volume of armor (depends on armor) */
! 140: #define V_RING 20 /* volume of ring */
! 141: #define V_STICK 0 /* volume of stick (depends on staff/wand) */
! 142: #define V_AMULET 30 /* volume of amulet */
! 143:
! 144: #define V_WS_STAFF 200 /* volume of a staff */
! 145: #define V_WS_WAND 110 /* volume of a wand */
! 146: #define W_WS_STAFF 100 /* weight of a staff */
! 147: #define W_WS_WAND 60 /* weight of a wand */
! 148:
! 149: #define FROMRING 2
! 150: #define DONTCARE -1
! 151: #define ANYTHING -1,-1 /* DONTCARE, DONTCARE */
! 152:
! 153: #define K_ARROW 240 /* killed by an arrow */
! 154: #define K_DART 241 /* killed by a dart */
! 155: #define K_BOLT 242 /* killed by a bolt */
! 156: #define K_POOL 243 /* killed by drowning */
! 157: #define K_ROD 244 /* killed by an exploding rod */
! 158: #define K_SCROLL 245 /* killed by a burning scroll */
! 159: #define K_STONE 246 /* killed by materializing in rock */
! 160: #define K_STARVE 247 /* killed by starvation */
! 161: /*
! 162: * return values for get functions
! 163: */
! 164:
! 165: #define NORM 0 /* normal exit */
! 166: #define QUIT 1 /* quit option setting */
! 167: #define MINUS 2 /* back up one option */
! 168:
! 169: /*
! 170: * Return values for games end
! 171: */
! 172: #define KILLED 0 /* hero was killed */
! 173: #define CHICKEN 1 /* hero chickened out (quit) */
! 174: #define WINNER 2 /* hero was a total winner */
! 175:
! 176: /*
! 177: * return values for chase routines
! 178: */
! 179: #define CHASE 0 /* continue chasing hero */
! 180: #define FIGHT 1 /* fight the hero */
! 181: #define GONER 2 /* chaser fell into a trap */
! 182:
! 183: /*
! 184: * All the fun defines
! 185: */
! 186: #define next(ptr) (*ptr).l_next
! 187: #define prev(ptr) (*ptr).l_prev
! 188: #define ldata(ptr) (*ptr).l_data
! 189: #define OBJPTR(what) (struct object *)((*what).l_data)
! 190: #define THINGPTR(what) (struct thing *)((*what).l_data)
! 191:
! 192: #define inroom(rp, cp) (\
! 193: (cp)->x <= (rp)->r_pos.x + ((rp)->r_max.x - 1) && \
! 194: (rp)->r_pos.x <= (cp)->x && (cp)->y <= (rp)->r_pos.y + \
! 195: ((rp)->r_max.y - 1) && (rp)->r_pos.y <= (cp)->y)
! 196:
! 197: #define unc(cp) (cp).y, (cp).x
! 198: #define cmov(xy) move((xy).y, (xy).x)
! 199: #define DISTANCE(y1,x1,y2,x2) ((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1))
! 200: #define when break;case
! 201: #define otherwise break;default
! 202: #define until(expr) while(!(expr))
! 203:
! 204: #define ce(a, b) ((a).x == (b).x && (a).y == (b).y)
! 205: #define draw(window) wrefresh(window)
! 206:
! 207: #define hero player.t_pos
! 208: #define pstats player.t_stats
! 209: #define pack player.t_pack
! 210:
! 211: #define herowis() (getpwis(him))
! 212: #define herodex() (getpdex(him,FALSE))
! 213: #define herostr() (pstats.s_ef.a_str)
! 214: #define herocon() (pstats.s_ef.a_con)
! 215:
! 216: #define attach(a,b) _attach(&a,b)
! 217: #define detach(a,b) _detach(&a,b)
! 218: #define free_list(a) _free_list(&a)
! 219: #ifndef max
! 220: #define max(a, b) ((a) > (b) ? (a) : (b))
! 221: #endif
! 222: #define goingup() (level < max_level)
! 223:
! 224: #define on(thing, flag) (((thing).t_flags & flag) != 0)
! 225: #define off(thing, flag) (((thing).t_flags & flag) == 0)
! 226: #undef CTRL
! 227: #define CTRL(ch) (ch & 0x1F)
! 228:
! 229: #define ALLOC(x) malloc((unsigned int) x)
! 230: #define FREE(x) free((char *) x)
! 231: #define EQSTR(a, b, c) (strncmp(a, b, c) == 0)
! 232: #define GOLDCALC (rnd(50 + 10 * level) + 2)
! 233: #define ISMULT(type) (type == POTION || type == SCROLL || type == FOOD)
! 234:
! 235: #define newgrp() ++group
! 236: #define o_charges o_ac
! 237:
! 238:
! 239: /*
! 240: * Things that appear on the screens
! 241: */
! 242: #define PASSAGE '#'
! 243: #define DOOR '+'
! 244: #define FLOOR '.'
! 245: #define PLAYER '@'
! 246: #define POST '^'
! 247: #define MAZETRAP '\\'
! 248: #define TRAPDOOR '>'
! 249: #define ARROWTRAP '{'
! 250: #define SLEEPTRAP '$'
! 251: #define BEARTRAP '}'
! 252: #define TELTRAP '~'
! 253: #define DARTTRAP '`'
! 254: #define POOL '"'
! 255: #define SECRETDOOR '&'
! 256: #define STAIRS '%'
! 257: #define GOLD '*'
! 258: #define POTION '!'
! 259: #define SCROLL '?'
! 260: #define MAGIC '$'
! 261: #define FOOD ':'
! 262: #define WEAPON ')'
! 263: #define ARMOR ']'
! 264: #define AMULET ','
! 265: #define RING '='
! 266: #define STICK '/'
! 267: #define CALLABLE -1
! 268:
! 269:
! 270: /*
! 271: * stuff to do with encumberence
! 272: */
! 273: #define NORMENCB 1500 /* normal encumberence */
! 274: #define SOMTHERE 5 /* something is in the way for dropping */
! 275: #define CANTDROP 6 /* cant drop it cause its cursed */
! 276: #define F_OKAY 0 /* have plenty of food in stomach */
! 277: #define F_HUNGRY 1 /* player is hungry */
! 278: #define F_WEAK 2 /* weak from lack of food */
! 279: #define F_FAINT 3 /* fainting from lack of food */
! 280:
! 281:
! 282: /*
! 283: * Various constants
! 284: */
! 285: #define PASSWD "mTuZ7WUV9RWkQ"
! 286: #define BEARTIME 3
! 287: #define SLEEPTIME 5
! 288: #define HEALTIME 30
! 289: #define HOLDTIME 2
! 290: #define STPOS 0
! 291: #define WANDERTIME 70
! 292: #define BEFORE 1
! 293: #define AFTER 2
! 294: #define HUHDURATION 20
! 295: #define SEEDURATION 850
! 296: #define HUNGERTIME 1300
! 297: #define WEAKTIME 150
! 298: #define HUNGTIME 300 /* 2 * WEAKTIME */
! 299: #define STOMACHSIZE 2000
! 300: #define ESCAPE 27
! 301: #define LEFT 0
! 302: #define RIGHT 1
! 303: #define BOLT_LENGTH 6
! 304:
! 305: #define STR 1
! 306: #define DEX 2
! 307: #define CON 3
! 308: #define WIS 4
! 309:
! 310: /*
! 311: * Save against things
! 312: */
! 313: #define VS_POISON 00
! 314: #define VS_PARALYZATION 00
! 315: #define VS_DEATH 00
! 316: #define VS_PETRIFICATION 01
! 317: #define VS_BREATH 02
! 318: #define VS_MAGIC 03
! 319:
! 320:
! 321: /*
! 322: * Various flag bits
! 323: */
! 324: #define ISSTUCK 0000001 /* monster can't run (violet fungi) */
! 325: #define ISDARK 0000001 /* room is dark */
! 326: #define ISCURSED 000001 /* object is cursed */
! 327: #define ISBLIND 0000001 /* hero is blind */
! 328: #define ISPARA 0000002 /* monster is paralyzed */
! 329: #define ISGONE 0000002 /* room is gone */
! 330: #define ISKNOW 0000002 /* object is known */
! 331: #define ISRUN 0000004 /* Hero & monsters are running */
! 332: #define ISTREAS 0000004 /* room is a treasure room */
! 333: #define ISPOST 0000004 /* object is in a trading post */
! 334: #define ISFOUND 0000010 /* trap is found */
! 335: #define ISINVINC 000010 /* player is invincible */
! 336: #define ISINVIS 0000020 /* monster is invisible */
! 337: #define ISPROT 0000020 /* object is protected somehow */
! 338: #define ISMEAN 0000040 /* monster is mean */
! 339: #define ISBLESS 0000040 /* object is blessed */
! 340: #define ISGREED 0000100 /* monster is greedy */
! 341: #define ISWOUND 0000200 /* monster is wounded */
! 342: #define ISHELD 0000400 /* hero is held fast */
! 343: #define ISHUH 0001000 /* hero | monster is confused */
! 344: #define ISREGEN 0002000 /* monster is regenerative */
! 345: #define CANHUH 0004000 /* hero can confuse monsters */
! 346: #define CANSEE 0010000 /* hero can see invisible monsters */
! 347: #define WASHIT 0010000 /* hero has hit monster at least once */
! 348: #define ISMISL 0020000 /* object is normally thrown in attacks */
! 349: #define ISCANC 0020000 /* monsters special attacks are canceled */
! 350: #define ISMANY 0040000 /* objects are found in a group (> 1) */
! 351: #define ISSLOW 0040000 /* hero | monster is slow */
! 352: #define ISHASTE 0100000 /* hero | monster is fast */
! 353: #define ISETHER 0200000 /* hero is thin as air */
! 354: #define NONE 100 /* equal to 'd' (used for weaps) */
! 355:
! 356:
! 357: /*
! 358: * Potion types
! 359: */
! 360: #define P_CONFUSE 0 /* confusion */
! 361: #define P_PARALYZE 1 /* paralysis */
! 362: #define P_POISON 2 /* poison */
! 363: #define P_STRENGTH 3 /* gain strength */
! 364: #define P_SEEINVIS 4 /* see invisible */
! 365: #define P_HEALING 5 /* healing */
! 366: #define P_MFIND 6 /* monster detection */
! 367: #define P_TFIND 7 /* magic detection */
! 368: #define P_RAISE 8 /* raise level */
! 369: #define P_XHEAL 9 /* extra healing */
! 370: #define P_HASTE 10 /* haste self */
! 371: #define P_RESTORE 11 /* restore strength */
! 372: #define P_BLIND 12 /* blindness */
! 373: #define P_NOP 13 /* thirst quenching */
! 374: #define P_DEX 14 /* increase dexterity */
! 375: #define P_ETH 15 /* etherealness */
! 376: #define P_SMART 16 /* wisdom */
! 377: #define P_REGEN 17 /* regeneration */
! 378: #define P_SUPHERO 18 /* super ability */
! 379: #define P_DECREP 19 /* decrepedness */
! 380: #define P_INVINC 20 /* invicibility */
! 381: #define MAXPOTIONS 21 /* types of potions */
! 382:
! 383:
! 384: /*
! 385: * Scroll types
! 386: */
! 387: #define S_CONFUSE 0 /* monster confusion */
! 388: #define S_MAP 1 /* magic mapping */
! 389: #define S_LIGHT 2 /* light */
! 390: #define S_HOLD 3 /* hold monster */
! 391: #define S_SLEEP 4 /* sleep */
! 392: #define S_ARMOR 5 /* enchant armor */
! 393: #define S_IDENT 6 /* identify */
! 394: #define S_SCARE 7 /* scare monster */
! 395: #define S_GFIND 8 /* gold detection */
! 396: #define S_TELEP 9 /* teleportation */
! 397: #define S_ENCH 10 /* enchant weapon */
! 398: #define S_CREATE 11 /* create monster */
! 399: #define S_REMOVE 12 /* remove curse */
! 400: #define S_AGGR 13 /* aggravate monster */
! 401: #define S_NOP 14 /* blank paper */
! 402: #define S_GENOCIDE 15 /* genocide */
! 403: #define S_KNOWALL 16 /* item knowledge */
! 404: #define S_PROTECT 17 /* item protection */
! 405: #define S_DCURSE 18 /* demons curse */
! 406: #define S_DLEVEL 19 /* transport */
! 407: #define S_ALLENCH 20 /* enchantment */
! 408: #define S_BLESS 21 /* gods blessing */
! 409: #define S_MAKEIT 22 /* aquirement */
! 410: #define S_BAN 23 /* banishment */
! 411: #define S_CWAND 24 /* charge wands */
! 412: #define S_LOCTRAP 25 /* locate traps */
! 413: #define MAXSCROLLS 26 /* types of scrolls */
! 414:
! 415:
! 416: /*
! 417: * Weapon types
! 418: */
! 419: #define MACE 0 /* mace */
! 420: #define SWORD 1 /* long sword */
! 421: #define BOW 2 /* short bow */
! 422: #define ARROW 3 /* arrow */
! 423: #define DAGGER 4 /* dagger */
! 424: #define ROCK 5 /* rocks */
! 425: #define TWOSWORD 6 /* two-handed sword */
! 426: #define SLING 7 /* sling */
! 427: #define DART 8 /* darts */
! 428: #define CROSSBOW 9 /* crossbow */
! 429: #define BOLT 10 /* crossbow bolt */
! 430: #define SPEAR 11 /* spear */
! 431: #define TRIDENT 12 /* trident */
! 432: #define SPETUM 13 /* spetum */
! 433: #define BARDICHE 14 /* bardiche */
! 434: #define PIKE 15 /* pike */
! 435: #define BASWORD 16 /* bastard sword */
! 436: #define HALBERD 17 /* halberd */
! 437: #define MAXWEAPONS 18 /* types of weapons */
! 438:
! 439:
! 440: /*
! 441: * Armor types
! 442: */
! 443: #define LEATHER 0 /* leather */
! 444: #define RINGMAIL 1 /* ring */
! 445: #define STUDDED 2 /* studded leather */
! 446: #define SCALE 3 /* scale */
! 447: #define PADDED 4 /* padded */
! 448: #define CHAIN 5 /* chain */
! 449: #define SPLINT 6 /* splint */
! 450: #define BANDED 7 /* banded */
! 451: #define PLATEMAIL 8 /* plate mail */
! 452: #define PLATEARMOR 9 /* plate armor */
! 453: #define MAXARMORS 10 /* types of armor */
! 454:
! 455:
! 456: /*
! 457: * Ring types
! 458: */
! 459: #define R_PROTECT 0 /* protection */
! 460: #define R_ADDSTR 1 /* add strength */
! 461: #define R_SUSTSTR 2 /* sustain strength */
! 462: #define R_SEARCH 3 /* searching */
! 463: #define R_SEEINVIS 4 /* see invisible */
! 464: #define R_CONST 5 /* constitution */
! 465: #define R_AGGR 6 /* aggravate monster */
! 466: #define R_ADDHIT 7 /* agility */
! 467: #define R_ADDDAM 8 /* increase damage */
! 468: #define R_REGEN 9 /* regeneration */
! 469: #define R_DIGEST 10 /* slow digestion */
! 470: #define R_TELEPORT 11 /* teleportation */
! 471: #define R_STEALTH 12 /* stealth */
! 472: #define R_SPEED 13 /* speed */
! 473: #define R_FTRAPS 14 /* find traps */
! 474: #define R_DELUS 15 /* delusion */
! 475: #define R_SUSAB 16 /* sustain ability */
! 476: #define R_BLIND 17 /* blindness */
! 477: #define R_SLOW 18 /* lethargy */
! 478: #define R_GIANT 19 /* ogre strength */
! 479: #define R_SAPEM 20 /* enfeeblement */
! 480: #define R_HEAVY 21 /* burden */
! 481: #define R_LIGHT 22 /* illumination */
! 482: #define R_BREATH 23 /* fire protection */
! 483: #define R_KNOW 24 /* wisdom */
! 484: #define R_DEX 25 /* dexterity */
! 485: #define MAXRINGS 26 /* types of rings */
! 486:
! 487:
! 488: /*
! 489: * Rod/Wand/Staff types
! 490: */
! 491:
! 492: #define WS_LIGHT 0 /* light */
! 493: #define WS_HIT 1 /* striking */
! 494: #define WS_ELECT 2 /* lightning */
! 495: #define WS_FIRE 3 /* fire */
! 496: #define WS_COLD 4 /* cold */
! 497: #define WS_POLYM 5 /* polymorph */
! 498: #define WS_MISSILE 6 /* magic missile */
! 499: #define WS_HASTE_M 7 /* haste monster */
! 500: #define WS_SLOW_M 8 /* slow monster */
! 501: #define WS_DRAIN 9 /* drain life */
! 502: #define WS_NOP 10 /* nothing */
! 503: #define WS_TELAWAY 11 /* teleport away */
! 504: #define WS_TELTO 12 /* teleport to */
! 505: #define WS_CANCEL 13 /* cancellation */
! 506: #define WS_SAPLIFE 14 /* sap life */
! 507: #define WS_CURE 15 /* curing */
! 508: #define WS_PYRO 16 /* pyromania */
! 509: #define WS_ANNIH 17 /* annihilate monster */
! 510: #define WS_PARZ 18 /* paralyze monster */
! 511: #define WS_HUNGER 19 /* food absorption */
! 512: #define WS_MREG 20 /* regenerate monster */
! 513: #define WS_MINVIS 21 /* hide monster */
! 514: #define WS_ANTIM 22 /* anti-matter */
! 515: #define WS_MOREMON 23 /* clone monster */
! 516: #define WS_CONFMON 24 /* confuse monster */
! 517: #define WS_MDEG 25 /* degenerate monster */
! 518: #define MAXSTICKS 26 /* max types of sticks */
! 519:
! 520: #define MAXAMULETS 1 /* types of amulets */
! 521: #define MAXFOODS 1 /* types of food */
! 522:
! 523:
! 524: /*
! 525: * Now we define the structures and types
! 526: */
! 527:
! 528: struct delayed_action {
! 529: int d_type;
! 530: void (*d_func)();
! 531: int d_arg;
! 532: int d_time;
! 533: };
! 534:
! 535: /*
! 536: * Help list
! 537: */
! 538: struct h_list {
! 539: char h_ch;
! 540: char *h_desc;
! 541: };
! 542:
! 543:
! 544: /*
! 545: * Coordinate data type
! 546: */
! 547: struct coord {
! 548: int x; /* column position */
! 549: int y; /* row position */
! 550: };
! 551:
! 552: struct monlev {
! 553: int l_lev; /* lowest level for a monster */
! 554: int h_lev; /* highest level for a monster */
! 555: bool d_wand; /* TRUE if monster wanders */
! 556: };
! 557:
! 558: /*
! 559: * Linked list data type
! 560: */
! 561: struct linked_list {
! 562: struct linked_list *l_next;
! 563: struct linked_list *l_prev;
! 564: void *l_data; /* Various structure pointers */
! 565: };
! 566:
! 567:
! 568: /*
! 569: * Stuff about magic items
! 570: */
! 571: #define mi_wght mi_worth
! 572: struct magic_item {
! 573: char *mi_name; /* name of item */
! 574: int mi_prob; /* probability of getting item */
! 575: int mi_worth; /* worth of item */
! 576: };
! 577:
! 578: struct magic_info {
! 579: int mf_max; /* max # of this type */
! 580: int mf_vol; /* volume of this item */
! 581: char mf_show; /* appearance on screen */
! 582: struct magic_item *mf_magic; /* pointer to magic tables */
! 583: };
! 584:
! 585: /*
! 586: * staff/wand stuff
! 587: */
! 588: struct rod {
! 589: char *ws_type; /* either "staff" or "wand" */
! 590: char *ws_made; /* "mahogany", etc */
! 591: int ws_vol; /* volume of this type stick */
! 592: int ws_wght; /* weight of this type stick */
! 593: };
! 594:
! 595: /*
! 596: * armor structure
! 597: */
! 598: struct init_armor {
! 599: int a_class; /* normal armor class */
! 600: int a_wght; /* weight of armor */
! 601: int a_vol; /* volume of armor */
! 602: };
! 603:
! 604: /*
! 605: * weapon structure
! 606: */
! 607: struct init_weps {
! 608: char *w_dam; /* hit damage */
! 609: char *w_hrl; /* hurl damage */
! 610: int w_flags; /* flags */
! 611: int w_wght; /* weight of weapon */
! 612: int w_vol; /* volume of weapon */
! 613: char w_launch; /* need to launch it */
! 614: };
! 615:
! 616:
! 617: /*
! 618: * Room structure
! 619: */
! 620: struct room {
! 621: struct coord r_pos; /* Upper left corner */
! 622: struct coord r_max; /* Size of room */
! 623: struct coord r_gold; /* Where the gold is */
! 624: struct coord r_exit[4]; /* Where the exits are */
! 625: struct room *r_ptr[4]; /* this exits' link to next rm */
! 626: int r_goldval; /* How much the gold is worth */
! 627: int r_flags; /* Info about the room */
! 628: int r_nexits; /* Number of exits */
! 629: };
! 630:
! 631: /*
! 632: * Array of all traps on this level
! 633: */
! 634: struct trap {
! 635: struct coord tr_pos; /* Where trap is */
! 636: struct coord tr_goto; /* where trap tranports to (if any) */
! 637: int tr_flags; /* Info about trap */
! 638: char tr_type; /* What kind of trap */
! 639: };
! 640:
! 641: /*
! 642: * structure for describing true abilities
! 643: */
! 644: struct real {
! 645: int a_str; /* strength (3-24) */
! 646: int a_dex; /* dexterity (3-18) */
! 647: int a_wis; /* wisdom (3-18) */
! 648: int a_con; /* constitution (3-18) */
! 649: };
! 650:
! 651: /*
! 652: * Structure describing a fighting being
! 653: */
! 654: struct stats {
! 655: struct real s_re; /* True ability */
! 656: struct real s_ef; /* Effective ability */
! 657: long s_exp; /* Experience */
! 658: int s_lvl; /* Level of mastery */
! 659: int s_arm; /* Armor class */
! 660: int s_hpt; /* Hit points */
! 661: int s_maxhp; /* max value of hit points */
! 662: int s_pack; /* current weight of his pack */
! 663: int s_carry; /* max weight he can carry */
! 664: char s_dmg[16]; /* String describing damage done */
! 665: };
! 666:
! 667: /*
! 668: * Structure for monsters and player
! 669: */
! 670: struct thing {
! 671: struct stats t_stats; /* Physical description */
! 672: struct coord t_pos; /* Position */
! 673: struct coord t_oldpos; /* last spot of it */
! 674: struct coord *t_dest; /* Where it is running to */
! 675: struct linked_list *t_pack; /* What the thing is carrying */
! 676: struct room *t_room; /* Room this thing is in */
! 677: long t_flags; /* State word */
! 678: int t_indx; /* Index into monster structure */
! 679: int t_nomove; /* # turns you cant move */
! 680: int t_nocmd; /* # turns you cant do anything */
! 681: bool t_turn; /* If slow, is it a turn to move */
! 682: char t_type; /* What it is */
! 683: char t_disguise; /* What mimic looks like */
! 684: char t_oldch; /* Char that was where it was */
! 685: char t_reserved;
! 686: };
! 687:
! 688: /*
! 689: * Array containing information on all the various types of mosnters
! 690: */
! 691: struct monster {
! 692: char *m_name; /* What to call the monster */
! 693: char m_show; /* char that monster shows */
! 694: short m_carry; /* Probability of having an item */
! 695: struct monlev m_lev; /* level stuff */
! 696: long m_flags; /* Things about the monster */
! 697: struct stats m_stats; /* Initial stats */
! 698: };
! 699:
! 700: /*
! 701: * Structure for a thing that the rogue can carry
! 702: */
! 703: struct object {
! 704: struct coord o_pos; /* Where it lives on the screen */
! 705: char o_damage[8]; /* Damage if used like sword */
! 706: char o_hurldmg[8]; /* Damage if thrown */
! 707: char *o_typname; /* name this thing is called */
! 708: int o_type; /* What kind of object it is */
! 709: int o_count; /* Count for plural objects */
! 710: int o_which; /* Which object of a type it is */
! 711: int o_hplus; /* Plusses to hit */
! 712: int o_dplus; /* Plusses to damage */
! 713: int o_ac; /* Armor class or charges */
! 714: int o_flags; /* Information about objects */
! 715: int o_group; /* Group number for this object */
! 716: int o_weight; /* weight of this object */
! 717: int o_vol; /* volume of this object */
! 718: char o_launch; /* What you need to launch it */
! 719: };
! 720:
! 721: extern WINDOW *cw, *hw, *mw;
! 722:
! 723: #define LINLEN 80 /* length of buffers */
! 724:
! 725: #define EXTLKL extern struct linked_list
! 726: #define EXTTHG extern struct thing
! 727: #define EXTOBJ extern struct object
! 728: #define EXTSTAT extern struct stats
! 729: #define EXTCORD extern struct coord
! 730: #define EXTMON extern struct monster
! 731: #define EXTARM extern struct init_armor
! 732: #define EXTWEP extern struct init_weps
! 733: #define EXTMAG extern struct magic_item
! 734: #define EXTROOM extern struct room
! 735: #define EXTTRAP extern struct trap
! 736: #define EXTINT extern int
! 737: #define EXTBOOL extern bool
! 738: #define EXTCHAR extern char
! 739:
! 740: #ifdef BSD
! 741: #define flushout() ioctl(_tty_ch, TIOCFLUSH, 0)
! 742: #endif
! 743:
! 744: #ifdef ATT
! 745:
! 746: struct sgttyb {
! 747: char sg_ispeed; /* input speed */
! 748: char sg_ospeed; /* output speed */
! 749: char sg_erase; /* erase character */
! 750: char sg_kill; /* kill character */
! 751: int sg_flags; /* mode flags */
! 752: };
! 753:
! 754: struct sgttyb _tty;
! 755: #define flushout() ioctl(2, TCFLSH, 0)
! 756:
! 757: #endif
CVSweb