home *** CD-ROM | disk | FTP | other *** search
/ Adventures in Heaven 2 / adventuresinheaven2powergamesfordosandwindows.iso / windows / arcade / cbzone / c_struct.h < prev    next >
C/C++ Source or Header  |  1992-05-27  |  5KB  |  143 lines

  1. /*
  2.  * cbzone_structs.h
  3.  *  -- Todd W Mummert, December 1990, CMU
  4.  *
  5.  * This file contains the two major structures that we use in
  6.  * the game.  Every object is of type Generic...while we have an
  7.  * Option type in order to allow us to pass options easily and
  8.  * quickly.
  9.  *
  10.  * The most hazardous piece of this code is assuming that
  11.  * XSegments and XPoints continue to be made of shorts.  However,
  12.  * I don't want to address the drawing elements by their
  13.  * structure names, so I'm betting on them remaining shorts.
  14.  */
  15.  
  16. typedef struct {
  17.   int delay;                    /* the true delay will be delay * 0.012 */
  18.   int mblocks;
  19.   int mlanders;
  20.   int mmissiles;
  21.   int msalvos;
  22.   int mtanks;
  23.   int menemies;
  24.   int mobjects;
  25.   int estart;                   /* indices into the object array */
  26.   int lstart;
  27.   int sstart;
  28.   int bstart;
  29.   Bool copters;              /* just helicopters        */
  30.   Bool loud;                 /* to beep, or not to beep */
  31.   Bool practice;             /* valid score?            */
  32.   Bool output;               /* print messages to tty?  */
  33.   Bool scores;
  34.   Bool version;
  35.   Bool help;
  36.   Bool original;
  37.   Bool cursor;
  38.  
  39.   /* Now pick up the color options...pick up the color as a string first */
  40.   /* This will later be a pixel value after we set up the colormap */
  41.   char* cname[MAX_COLORS];
  42.   int cpi[MAX_COLORS];
  43.  
  44.   Bool mono;
  45.   Bool fullscreen;
  46.   Bool defaultcolormap;
  47.   int fading_colors;
  48.   int max_colors;
  49. } Option, *Optionp;
  50.  
  51. typedef struct {
  52.   short x, y, z;
  53. } Coord3d, *Coord3dp;
  54.  
  55. typedef struct {
  56.   short x, y;
  57. } Coord2d, *Coord2dp;
  58.  
  59. typedef struct {
  60.   float x, y;
  61. } Float2d, *Float2dp;
  62.  
  63. typedef struct {
  64.   float x, y, z;
  65. } Float3d, *Float3dp;
  66.  
  67. typedef struct {
  68.   int num;
  69.   void (*calc)();
  70.   float* vars;
  71. } Method, *Methodp;
  72.  
  73. typedef struct {                /* in the drawing contexts */
  74.   Coord3dp object;              /* this information will   */
  75.   int *pnum, *mnum;             /* not change, therefore   */
  76.   Methodp methods;              /* we just need a pointer  */
  77.   int basecolor;                /* to the correct info     */
  78. } StaticDC, *StaticDCp;
  79.  
  80. typedef struct {                /* the information in this */
  81.   StaticDCp s;                  /* block may change during */
  82.   int basecolor;                /* a call to drawobject or */
  83.   Bool fades;                /* explode object          */
  84.   Coord2d points[60];
  85.   Float3d pos;
  86.   Float3d vel;
  87.   float cta, sta, ctp, stp;
  88.   Bool seen;
  89.   Bool last;
  90. } DC, *DCp;
  91.  
  92. typedef struct generic_s Generic;
  93. typedef Generic* Genericp;
  94. struct generic_s {
  95.   int type;                    /* uses the defines in */
  96.   int lntype;
  97.   int attr;                    /* cbzone_defs.h       */
  98.  
  99.   float x;                      /* coordinates in 3 space */
  100.   float y;
  101.   float z;
  102.   float prox;                   /* projection into player-centric */
  103.   float proy;                   /* coordinates                    */
  104.   float azm;                    /* direction we are pointing      */
  105.   float ca;                     /* typically the sin and cos of   */
  106.   float sa;                     /* the object's azm               */
  107.   float speed;                  /* current speed                  */
  108.   float rotate;                 /* current rotational speed       */
  109.   float range;                  /* range from player */
  110.   float criticalx;              /* critical distance */
  111.   float criticaly;              /* critical distance */
  112.   float orientation;
  113.  
  114.   int ecount;                   /* explosion or existance count   */
  115.   int ccount;                   /* cycle count (lander explosion) */
  116.   int pcount;                   /* plan count for movement plans  */
  117.   int bcount;                   /* how long we've been blocked    */
  118.   int fcount;                   /* how long since we've fired     */
  119.  
  120.   int pieces;                   /* # of pieces in the drawable    */
  121.   DC dc[5];                     /* the drawing context            */
  122.  
  123.   /* now we need a method for associating a salvo with an object */
  124.   /* since a salvo is another generic item, we just create a     */
  125.   /* pointer to the first salvo owned by this object             */
  126.   Genericp salvo;
  127.   int nsalvos;                  /* how many salvos do he have */
  128. };
  129.  
  130. typedef struct {
  131.   int x, y;
  132. } Position_t;
  133.  
  134. typedef struct {
  135.   unsigned int x, y;
  136. } Offset_t;
  137.  
  138. typedef struct {
  139.   Position_t base;
  140.   Offset_t size;
  141. } Window_t;
  142.                                       /* Now some useful globals */
  143.