#define DOS_PASCAL_CALLING
#include "dddware.h"
typedef struct WAYPOINT
{
 float x,y,z;
};

typedef struct CRASHZONE                                // The crash zone of cap ship
{
 int x,y,z;                             // X,Y,Z coords relative to ship
 int size;                              // Size of zone
};
typedef struct TEMPCRASHZONE                            // The crash zone of cap ship
{
 float x,y,z;                           // X,Y,Z coords relative to ship
 float size;                            // Size of zone
};
typedef struct HANGERZONE
{
 VtkObj object;
 int type; // The turret shape and type
 int frame1; // The turrets fireframe
 float cx,cy,cz; // Center X,Y,Z relative to ship
 float dx[3],dy[3],dz[3]; // The three normals of the hangar
 int rx,ry,rz;                          // The hangers heading
};

typedef struct TURRET      // Turret structure
{
 VtkObj object;
 VtkObj gun;
 int shape,type;           // The turret shape and type
 int fireframe;            // The turrets fireframe
 int target;               // The turrets target
 float cx,cy,cz;           // Center X,Y,Z relative to ship
 float dx[3],dy[3],dz[3];  // The three normals of the turret
 int rx,ry,rz;             // The turrets heading
 float sx,sy,sz;           // The turrets pointing direction
 float sx2,sy2,sz2;        // The turrets pointing direction
 int srx,sry,srz;          // And a normal for it
 int hits,damage,deadframe;
};

typedef struct GUN         // Gun structure
{
 int type;                 // The gun type.
 int selected;                                                          // If it is selected or not; 0 or 1
 int fireframe;                                                 // The guns fireframe
 int fireflag;                                                          // The guns fireflag
 int left;                                                                      // How many shots are left
 float gun,gunz,guny;      // X Y and Z coords relative to ship
};

typedef struct OBJECT                                           // The object structure
{
 VtkObj object;
 VtkObj farobject;
 VtkObj spark;
 VtkObj thingy[20];
 int thingytype[20];
 int thingys;
 int shape;                // The shape
 int type,frame1,frame2,frame3; // Ship type, and frame counters
 int doing,smoking,sparking; // Some misk useful vars
 int side,target;                                       // The side and target
 float speed,topspeed,toprevs,currentrevs; // Speed calculation variables
 float shields,maxshields,armour,maxarmour; // Sheilds and armour vars
 float sparkx,sparky,sparkz;                    // When hit, the ship sparks here
 float cx,cy,cz;                                                        // Center coords of the object
 float sx,sy,sz;                                        // Speed coords of object
 float dx[3],dy[3],dz[3];                               // Direction coords of object
 int rx,ry,rz;                                          // Rotation coords of object
 float rsx,rsy,rsz;                                             // The rotation speeds
 int turrets,guns,crashzones,hangerzones;       // Number of guns, turrets and crashs
 int stubborn,wingleader,wingtype;      // Stubborn; wont give up target;
                                        // 0=normal
                                        // 1=stubborn
                                        // 2=pathological
                                        // wingleader is ship that it protects
                                        // wingtype 0 = loyal, 1 = disloyal,
                                        // 2 = attack wingleaders target,
                                        // 3 = free spirit during combat,
                                        // 4 = free spirit but loyal
                                        // 5 Formation only.
 float wingx,wingy,wingz;  // The wingleaders coords
 int destination;                                               // Waypoint destination (1 to 10)
 char name[40];
 int rank;
 int mother,motherhangerzone;
 int dpt;
 struct GUN *g;
 struct TURRET *t;
 struct CRASHZONE *c;
 struct HANGERZONE *h;
};

typedef struct STAR                                                     // The starfield map
{
 VtkObj object;
 float x,y,z;                                                   // XY and Z coords for each star
 int c;                                                                         // The starfield color
};

typedef struct SHAPEDATA              // Data for each shape
{
 float scale;                                                           // The scale of the ship
 char name[19];                     // Its name
 char type[19];                     // Its type
 char filename[19];
};

typedef struct COMMUNICATION                    // The communication structure
{
 int from;                                                                      // The originaters number
 int type;                                                                      // The communication type
 int newcomm;                                                           // If there is a new communication
                                                                                                        // This is set to 1
 int side;                                                                      // The communication side
 char msg[80];                                                  // The actual message
};

typedef struct PROJECTILE
{
 VtkObj object;
 VtkObj farobject;
 int shape;                             // The shape
 int type,frame1,frame2,frame3;     // Ship type, and frame counters
 int side,target;                       // The side and target
 float speed,topspeed,toprevs,currentrevs; // Speed calculation variables
 float cx,cy,cz;                                // Center coords of the object
 float sx,sy,sz;                                // Speed coords of object
 float dx[3],dy[3],dz[3];               // Direction coords of object
 int rx,ry,rz;                          // Rotation coords of object
 float rsx,rsy,rsz;                     // The rotation speeds
 int owner;
};

typedef struct CREATEOBJECT                                                     // The object structure
{
 VtkObj object;
 long time;
 int no;
 int shape;                                                             // The shape
 int type;                                                                                         // Ship type, and frame counters
 int side,target;                                                               // The side and target
 float cx,cy,cz;                                                                                // Center coords of the object
 float sx,sy,sz;                                                                // Speed coords of object
 float dx[3],dy[3],dz[3];                                                       // Direction coords of object
 int rx,ry,rz;                                                                  // Rotation coords of object
 float rsx,rsy,rsz;                                                                     // The rotation speeds
 int stubborn,wingleader,wingtype;                              // Stubborn; wont give up target;
 float wingx,wingy,wingz;                                                       // The wingleaders coords
 int destination;                                                                       // Waypoint destination (1 to 10)
 char name[20];
 int rank;
 int mother,motherhangerzone;
 int createtype;
 int dpt;
};

typedef struct OBJECTEVENT                                                      // The object structure
{
 long time;
 int no;
 int type,doing;                                                                        // Ship type, and frame counters
 int side,target;                                                               // The side and target
 float topspeed,toprevs;                                                        // Speed calculation variables
 float shields,maxshields,armour,maxarmour;  // Sheilds and armour vars
 int stubborn,wingleader,wingtype;                              // Stubborn; wont give up target;
 float wingx,wingy,wingz;                                                       // The wingleaders coords
 int destination;                                                                       // Waypoint destination (1 to 10)
 int rank;
};

typedef struct COMMUNICATIONEVENT                                       // The communication structure
{
 long time;
 int from;                                                                                              // The originaters number
 int side;                                                                                              // The communication side
 char msg[80];                                                                          // The actual message
};

typedef struct MOUSE
{
 char lmb;              /* Left mouse button is currently down */
 char rmb;              /* Right mouse button is currently down */
 char lmr;              /* Left mouse button has been released since last call */
 char rmr;              /* Right mouse button has been released since last call */
 int mx;                /* X-axis position of mouse in pixels, 0 to 320 */
 int my;                /* Y-axis position of mouse in pixels, 0 to 200 */
 int px;                /* Previous X-axis position of mouse in pixels */
 int py;                /* Previous Y-axis position of mouse in pixels */
};

typedef struct GUIOBJECT
{
 VtkObj object;
 int shape;                             // The shape
 int type;                              // Ship type, and frame counters
 float speed,topspeed,toprevs,currentrevs; // Speed calculation variables
 float cx,cy,cz;                           // Center coords of the object
 float sx,sy,sz;                           // Speed coords of object
 int rx,ry,rz;                          // Rotation coords of object
 float rsx,rsy,rsz;                     // The rotation speeds
 float dx[3],dy[3],dz[3];                                                       // Direction coords of object
};

typedef struct JOY
{
  int xpos, ypos;
  int sw1, sw2;
};

typedef struct PILOTSTRUCT
{
  int campaign,side,mission;
  int missions,kills,rank;
  char sirname[25];
  char firstname[25];
  int deaths,restarts,score;
  int campaignstatus,enemyhits,friendlyhits,inmisfriendlyhits,spare5,spare6;
};

typedef struct DEBRIS
{
  float x,y,z;
  float dx[3],dy[3],dz[3];
  int rx,ry,rz;
  float rsx,rsy,rsz;
  int shape;
  VtkObj object;
};

typedef struct GROUND
{
  float cx,cy,cz;
  float dx[3],dy[3],dz[3];
  int rx,ry,rz;
  int shape;
  VtkObj object;
  VtkObj thingy[20];
  int thingytype[20];
  int thingys;
  int height[10][10];
};

struct jjjtar_mainheader
{
  char identifier[11];
  unsigned long size;
  unsigned long files;
  unsigned long datastartpos;
};

struct jjjtar_filepointer
{
  char name[13];
  unsigned long size;
  unsigned long offset;
  unsigned short time;
  unsigned short date;
};
