1: /*
   2:  * phant.h	Include file for Phantasia
   3:  */
   4: 
   5: #include <setjmp.h>
   6: #include <curses.h>
   7: #include <time.h>
   8: #include <pwd.h>
   9: #include <signal.h>
  10: #include <math.h>
  11: 
  12: /* ring constants */
  13: #define NONE    0
  14: #define NAZBAD  1
  15: #define NAZREG  2
  16: #define DLREG   3
  17: #define DLBAD   4
  18: #define SPOILED 5
  19: 
  20: /* some functions and pseudo-functions */
  21: #define toupper(CH) ((CH) > 96 ? (CH) ^ 32 : (CH))  /* may be upper or lower */
  22: #define tolower(CH) ((CH) | 32)         /* must be upper */
  23: #define rnd()       (((double) rand()) / RAND)
  24: #define roll(BASE,INTERVAL) floor((BASE) + (INTERVAL) * rnd())
  25: #define sgn(x)  (-(x < 0) + (x > 0))
  26: #define abs(x)  ((x) < 0 ? -(x) : (x))
  27: #define circ(x,y)   floor(sqrt((double) ((x) * (x) + (y) * (y))) / 125 + 1)
  28: #define max(A,B)    ((A) > (B) ? (A) : (B))
  29: #define min(A,B)    ((A) < (B) ? (A) : (B))
  30: #define valarstuff(ARG) decree(ARG)
  31: #define illcmd()    mvaddstr(6,0,"Illegal command.\n")
  32: #define maxmove     floor(charac.lvl * 1.5 + 1)
  33: #define illmove()   mvaddstr(6,0,"Too far.\n")
  34: #define rndattack() if (rnd() < 0.2 && charac.status == PLAYING && !throne) \
  35:                 fight(&charac,-1)
  36: #define strcalc(STR,SICK)   max(0,min(0.9 * STR, SICK * STR/20))
  37: #define spdcalc(LVL,GLD,GEM)    max(0,((GLD + GEM/2) - 1000)/200.0 - LVL)
  38: #define illspell()  mvaddstr(6,0,"Illegal spell.\n")
  39: #define nomanna()   mvaddstr(6,0,"Not enough manna for that spell.\n")
  40: #define somebetter()    addstr("But you already have something better.\n")
  41: 
  42: /* status constants */
  43: #define OFF 0
  44: #define PLAYING 1
  45: #define CLOAKED 2
  46: #define INBATTLE    3
  47: #define DIE 4
  48: #define QUIT    5
  49: 
  50: /* tampered constants */
  51: #define NRGVOID 1
  52: #define GRAIL   2
  53: #define TRANSPORT   3
  54: #define GOLD    4
  55: #define CURSED  5
  56: #define MONSTER 6
  57: #define BLESS   7
  58: #define MOVED   8
  59: #define HEAL    9
  60: #define VAPORIZED   10
  61: #define STOLEN  11
  62: 
  63: /* structure definitions */
  64: struct  stats       /* player stats */
  65:     {
  66:     char    name[21];   /* name */
  67:     char    pswd[9];    /* password */
  68:     char    login[10];  /* login */
  69:     double  x;      /* x coord */
  70:     double  y;      /* y coord */
  71:     double  exp;        /* experience */
  72:     int lvl;        /* level */
  73:     short   quk;        /* quick */
  74:     double  str;        /* strength */
  75:     double  sin;        /* sin */
  76:     double  man;        /* manna */
  77:     double  gld;        /* gold */
  78:     double  nrg;        /* energy */
  79:     double  mxn;        /* max. energy */
  80:     double  mag;        /* magic level */
  81:     double  brn;        /* brains */
  82:     short   crn;        /* crowns */
  83:     struct
  84:         {
  85:         short   type;
  86:         short   duration;
  87:         }   rng;    /* ring stuff */
  88:     bool    pal;        /* palantir */
  89:     double  psn;        /* poison */
  90:     short   hw;     /* holy water */
  91:     short   amu;        /* amulets */
  92:     bool    bls;        /* blessing */
  93:     short   chm;        /* charms */
  94:     double  gem;        /* gems */
  95:     short   quks;       /* quicksilver */
  96:     double  swd;        /* sword */
  97:     double  shd;        /* shield */
  98:     short   typ;        /* character type */
  99:     bool    vrg;        /* virgin */
 100:     short   lastused;   /* day of year last used */
 101:     short   status;     /* playing, cloaked, etc. */
 102:     short   tampered;   /* decree'd, etc. flag */
 103:     double  scratch1, scratch2; /* var's for above */
 104:     bool    blind;      /* blindness */
 105:     int wormhole;   /* # of wormhole, 0 = none */
 106:     long    age;        /* age in seconds */
 107:     short   degen;      /* age/2500 last degenerated */
 108:     };
 109: 
 110: struct  mstats      /* monster stats */
 111:     {
 112:     char    name[26];   /* name */
 113:     double  str;        /* strength */
 114:     double  brn;        /* brains */
 115:     double  spd;        /* speed */
 116:     double  hit;        /* hits (energy) */
 117:     double  exp;        /* experience */
 118:     int trs;        /* treasure type */
 119:     int typ;        /* special type */
 120:     int flk;        /* % flock */
 121:     };
 122: 
 123: struct  nrgvoid     /* energy void */
 124:     {
 125:     bool    active;     /* active or not */
 126:     double  x,y;        /* coordinates */
 127:     };
 128: 
 129: struct  worm_hole   /* worm hole */
 130:     {
 131:     char    f, b, l, r; /* forward, back, left, right */
 132:     };
 133: 
 134: /* files */
 135: #define monsterfile PATH/monsters"
 136: #define peoplefile  PATH/characs"
 137: #define gameprog    PATH/phantasia"
 138: #define messfile    PATH/mess"
 139: #define lastdead    PATH/lastdead"
 140: #define helpfile    PATH/phant.help"
 141: #define motd        PATH/motd"
 142: #define goldfile    PATH/gold"
 143: #define voidfile    PATH/void"
 144: #define enemyfile   PATH/enemy"
 145: 
 146: /* library functions and system calls */
 147: unsigned sleep();
 148: long    time(), ftell();
 149: char    *getlogin(), *getpass(), *ctime();
 150: struct  passwd  *getpwuid();
 151: char    *strcpy(), *strncpy();
 152: 
 153: /* function and global variable declarations */
 154: void    adjuststats(), callmonster(), checkinterm(), checkmov(), checktampered(),
 155:     cstat(), death(), decree(), exit1(), fight(), genchar(), getstring(), init1(),
 156:     initchar(), interm(), kingstuff(), leave(), movelvl(), neatstuf(),
 157:     paws(), printhelp(), printmonster(), printplayers(), printstats(), purge(),
 158:     showall(), showusers(), statread(), talk(), tampered(), titlestuff(),
 159:     trade(), treasure(), trunc(), update(), voidupdate();
 160: int allocvoid(), findchar(), findspace(), gch(), interrupt(), rgetch(), rngcalc();
 161: unsigned level();
 162: double  inflt();
 163: char    *printloc();
 164: bool    findname();
 165: #ifdef  OK_TO_PLAY
 166: bool    ok_to_play();
 167: #endif
 168: 
 169: extern  jmp_buf fightenv, mainenv;
 170: extern  double  strength, speed;
 171: extern  bool    beyond, marsh, throne, valhala, changed, fghting, su, wmhl;
 172: extern  struct worm_hole    w_h[];
 173: extern  long    secs;
 174: extern  int fileloc, users;

Defined struct's

mstats defined in line 110; used 4 times
nrgvoid defined in line 123; used 14 times
stats defined in line 64; used 82 times
worm_hole defined in line 129; used 4 times

Defined macros

BLESS defined in line 57; used 1 times
CURSED defined in line 55; used 1 times
DIE defined in line 47; used 1 times
DLBAD defined in line 17; used 1 times
DLREG defined in line 16; used 2 times
GOLD defined in line 54; used 1 times
GRAIL defined in line 52; used 1 times
HEAL defined in line 59; used 1 times
INBATTLE defined in line 46; used 3 times
MONSTER defined in line 56; used 1 times
MOVED defined in line 58; used 1 times
NAZBAD defined in line 14; used 1 times
NAZREG defined in line 15; used 1 times
NRGVOID defined in line 51; used 1 times
PLAYING defined in line 44; used 8 times
QUIT defined in line 48; used 1 times
SPOILED defined in line 18; used 2 times
STOLEN defined in line 61; used 1 times
TRANSPORT defined in line 53; used 1 times
VAPORIZED defined in line 60; used 1 times
enemyfile defined in line 144; used 3 times
gameprog defined in line 137; used 1 times
helpfile defined in line 140; used 1 times
illcmd defined in line 31; used 5 times
illmove defined in line 33; used 2 times
illspell defined in line 38; used 9 times
lastdead defined in line 139; used 5 times
maxmove defined in line 32; used 5 times
motd defined in line 141; used 4 times
nomanna defined in line 39; used 7 times
rnd defined in line 23; used 71 times
rndattack defined in line 34; used 2 times
roll defined in line 24; used 82 times
somebetter defined in line 40; used 7 times
spdcalc defined in line 37; used 2 times
strcalc defined in line 36; used 1 times
tolower defined in line 22; never used
valarstuff defined in line 30; used 1 times

Usage of this include

Last modified: 1986-05-20
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 4794
Valid CSS Valid XHTML 1.0 Strict