#ifndef _GUNHEADER_
   #define _GUNHEADER_

   #define  BUF_MAX      34
   #define  PADMAX       2
   #define  PADBUFFLEN   86
   #define  PADID_GUN    0x31
   #define  PADID_CON    0x41
   #define  PADID_MOUSE  0x12

   typedef struct
   {
      char    result;
      char    id;
      char    data[6];
   } MDATA;

   typedef struct
   {
      unsigned short  v_count;
      unsigned short  h_count;
   } HV_CNT;

   typedef struct
   {
      char result;
      char id;
      char data[2];
      char mask;
      char count;
      HV_CNT hv[20];
   } GUN;

   typedef struct
   {
      u_short x, y;                        // current point
      u_short dx, dy;                      // velocity
   } POS;

   typedef struct
   {
      char         buff[PADMAX][PADBUFFLEN];
      char         Tbuf[PADMAX][PADBUFFLEN];
      u_short      id[PADMAX];
      u_short      data[PADMAX];
      u_short      trig[PADMAX];
      u_short      old[PADMAX];
      signed char  mouse_x[PADMAX];
      signed char  mouse_y[PADMAX];
   } PAD;

   u_long    ev0, ev1, ev2, ev3;
   u_long    ev10, ev11, ev12, ev13;

   u_char    Buf[2][BUF_MAX];
   PAD       p;
   MDATA     *mdata[2][4];
   int       card_ok[4], card_ng[4];
   int       card[4];
   char      card_buf[2][200];
   u_long    old_padd = 0;
   u_long    old_padd2 = 0;
   u_long    nbrbullet[2] = {0,0};
   u_long    bulletdelay[2] = {0,0};
   u_long    bulletshot[2] = {0,0};

   u_short   v_count;
   u_short   h_count;
   LINE_F2   line[2], line1[2];

   HV_CNT    *hv[2];
   u_short   pre_v_count, pre_h_count;
   char      *GunCount;
   long      flush_flag;

   extern "C"
   {
      void    SetGun (char *buff, char *buff1);
      u_short Read_Gun_x (void);
      u_short Read_Gun_y (void);
      void    StopGun (void);
      void    SelectGun (int ch, u_char mask);
      void    InitGun (char *buf0, char *buf1, long len);
      int     InitPAD (char *, int, char *, int);
      int     StartPAD (void);
      int     ChangeClearPAD (int);
      GUN     *gun[2];
   }
#endif
