home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 7 Games / 07-Games.zip / VTREK.ZIP / VTREK.H < prev    next >
C/C++ Source or Header  |  1989-12-26  |  5KB  |  150 lines

  1. /* vtrek.h -- header file for visual star trek */
  2.  
  3. #ifdef    HI_TECH_C    /* The Hi-Tech C compiler provides sufficient
  4.                environmental information that we do not have
  5.                to depend on user-supplied #defines */
  6. #ifdef    DOS
  7. #define    OS2
  8. #endif
  9.  
  10. #else    /* not Hi-Tech C */
  11.  
  12. /* Select an operating system by enabling one and only one of the
  13. /* following #defines.  (Choose OS2 if you are compiling for MSDOS) */
  14.  
  15. #define    OS2
  16. /* #define    UNIX    */
  17. /* #define    CPM    */
  18.  
  19. /* and select a compiler by enabling one of the following */
  20.  
  21. #ifndef    UNIX
  22.  
  23. #define    MSC        /* Microsoft C (5.1 for MSDOS & OS/2) */
  24. #undef AZTEC        /* Aztec C (for CP/M.  The MSDOS one is untested) */
  25.  
  26. #endif    /* not UNIX */
  27. #endif    /* not Hi-Tech C */
  28.  
  29. #ifdef AZTEC
  30. #include "libc.h"
  31. #include "math.h"
  32. #else
  33. #include <stdio.h>
  34. #include <math.h>
  35. #include <ctype.h>
  36. #endif
  37.  
  38. #define VTREKINS    "vtrek.hlp"    /* instructions */
  39.  
  40. #ifndef ERROR
  41. #define ERROR        -1
  42. #endif
  43.  
  44. #ifndef PI
  45. #define PI        3.1415926
  46. #endif
  47.  
  48. #define Toupper(x)    (islower(x) ? toupper(x) : x)
  49.  
  50. #ifndef abs
  51. #define abs(x)        (x < 0 ? -x : x)
  52. #endif
  53.  
  54. /* used for damaging klingon */
  55. #define AUTOKILL    9999
  56.  
  57. /* used for fixing/damaging devices */
  58. #define ABS        0        /* absolute fix */
  59. #define REL        1        /* relative fix */
  60. #define RND        -1        /* pick a random device */
  61.  
  62. /* status of a ship */
  63. #define ALIVE        0        /* ship is still here */
  64. #define DEAD        1        /* ship has been destroyed */
  65.  
  66. /* used for replot calls */
  67. #define TEXT        1        /* replot text portion */
  68. #define INFO        2        /* replot information portion */
  69. #define ELEMENT        4        /* replot individual element */
  70. #define ALL        (TEXT | INFO)    /* replot all */
  71.  
  72. /* legal condition values */
  73. #define GREEN        0        /* everything OK */
  74. #define YELLOW        1        /* reason to be cautious */
  75. #define RED        2        /* imminent danger */
  76. #define DOCKED        3        /* docked at base (no danger) */
  77.  
  78. /* legal quadrant values (used in s.r.s) */
  79. #define EMPTY        0        /* sector is empty */
  80. #define KLINGON        1        /* sector contains klingon */
  81. #define STARBASE    2        /* sector contains star base */
  82. #define STAR        3        /* sector contains star */
  83. #define PLAYER        4        /* sector contains player */
  84. #define TBLAST        5        /* torpedo */
  85.  
  86. /* legal damage control indices */
  87. #define WARP        0        /* warp drive */
  88. #define SRS        1        /* short range sensors */
  89. #define LRS        2        /* long range sensors */
  90. #define PHASER        3        /* phaser control */
  91. #define DAMAGE        4        /* damage control */
  92. #define DEFENSE        5        /* defense control (shields) */
  93. #define COMPUTER    6        /* computer (galaxy map, calculations) */
  94. #define TUBES        7        /* torpedo tubes */
  95.  
  96. /* legal status items */
  97. #define STARDATE    0
  98. #define CONDITION    1
  99. #define QUADRANT    2
  100. #define SECTOR        3
  101. #define ENERGY        4
  102. #define TORPS        5
  103. #define SHIELDS        6
  104.  
  105. /* used for readout calls */
  106. #define CLEAR        0        /* clear readout */
  107. #define ADDLINE        1        /* add line to readout */
  108.  
  109. /* sructure used to store quandrant information */
  110. typedef struct {
  111.     char nkling;    /* number of klingons in quadrant */
  112.     char nbase;    /* number of bases in quadrant */
  113.     char nstar;    /* number of stars in quadrant */
  114.     char known;    /* tells if info is known to player */
  115. } QUADINFO;
  116.  
  117. /* structure used to store klingon information */
  118. typedef struct {
  119.     int xs, ys;    /* sector coordinates */
  120.     int sh;        /* shield level */
  121. } KLINGINFO;
  122.  
  123. extern KLINGINFO  klingon[3];
  124. extern QUADINFO galaxy[8][8];    /* galaxy */
  125. extern int numbases;        /* number of bases in galaxy */
  126. extern int numkling;        /* number of klingons in galaxy */
  127. extern int begkling;        /* beginning number of klingons */
  128. extern int condition;        /* current condition (GREEN,YELLOW,RED,DOCKED) */
  129. extern int xquad, yquad;    /* current quadrant */
  130. extern int xsect, ysect;    /* current sector */
  131. extern int old_xquad, old_yquad; /* quadrant before last movement */
  132. extern int old_xsect, old_ysect; /* sector before last movement */
  133. extern int energy;        /* energy level */
  134. extern int shields;        /* shield level */
  135. extern int torps;        /* number of torps left */
  136. extern int quadrant[8][8];    /* current quadrant picture (EMPTY,KLINGON,STARBASE,STAR,PLAYER) */
  137. extern int rolines;        /* number of lines used in current readout */
  138. extern int damage[8];        /* % effectiveness of devices, normal range
  139.                    is 0-100 */
  140.                 /* if < 0 then device is damaged beyond use */
  141. extern char playership[];     /* image of player's ship for s.r.s */
  142. extern char captain[11];    /* captain's name */
  143. extern char shipname[11];    /* ship's name */
  144. extern float stardate;        /* current star date */
  145. extern float lastdate;        /* last star date before federation is conquered */
  146. extern float begdate;        /* beginning star date */
  147. extern int base_xsect, base_ysect; /* starbase sector, if one is present */
  148. extern int numkmove;        /* number of klingon moves allowed */
  149. extern int skill;        /* skill level */
  150.