//---------------------------------------------------------------------------
// Background class
//---------------------------------------------------------------------------

#define  BKDMAXSPR    100
#define  BKDMAXIMAGE  10
#define  SCREENWIDTH  320
#define  SCREENHEIGHT 240

#ifndef __point
   #define __point
   typedef struct
   {
      int x;
      int y;
   } point;
#endif

//-------------------------------------
// Class definition
//-------------------------------------
class Background
{
   private:
   int      SourceX, SourceY;
   int      BkdX, BkdY;
   int      BkdAngle;
   int      DestX, DestY;
   int      DestStep;
   int      DestTotalStep;
   int      NbrSpr;
   int      NbrImage;
   u_short  ActualClut[BKDMAXIMAGE][256];
   u_short  DestClut[BKDMAXIMAGE][256];
   u_short  *OriginalClut[BKDMAXIMAGE];
   int      BWChangeComplete[BKDMAXIMAGE];
   int      BkdWidth, BkdHeight;
   int      ImageWidth[BKDMAXIMAGE], ImageHeight[BKDMAXIMAGE];
   u_char   SprW[BKDMAXSPR];
   u_char   SprH[BKDMAXSPR];
   u_short  SprX[BKDMAXSPR];
   u_short  SprY[BKDMAXSPR];
   u_short  SprU[BKDMAXSPR];
   u_char   SprV[BKDMAXSPR];
   u_short  SprXTP[BKDMAXSPR];
   u_short  SprYTP[BKDMAXSPR];
   u_char   SprLayer[BKDMAXSPR];
   u_char   SprImage[BKDMAXSPR];
   u_long   *Address[BKDMAXIMAGE];
   point    VramSpace[BKDMAXIMAGE];
   short    VramMemHandle[BKDMAXIMAGE];
   int      ClutY[BKDMAXIMAGE];
   u_char   *HitMapAddr[3];
   u_short  HitMapW, HitMapH;
   u_short  RicochetW, RicochetH;
   char     *Ricochet;
   char     filnam[80];
   int      BKDType;
   int      StreetX;
   int      ColumnX;
   int      Acceler;
   int      DeltaX;
   int      BackX;
   int      FrontX;
   int      FrontY;
   int      MiddleX;
   int      BarrierX;
   int      BarrierY;
   int      Shaking;

   public:
   Background ();
   void Draw (DoubleBuffer *db, int pause);
   int  Load (char filename[], u_long *memptr);
   int  ChangeClut (void);
   int  Clear (void);
   int  ScrollTo (int coorx, int coory, int step);
   void SetLocation (int coorx, int coory);
   int  Bkd_X ();
   int  Bkd_Y ();
   int  GetHit (int level, int coorx, int coory, int *sfx, int *vab);
   void DumpData (void);
   int  LoadRicochetMap (char filename[], u_long *memptr);
   void SetBKDType (int bkdtype, u_long *memptr);
   void BuildDestClut (int typeclut);
   void Shake (void);
   void DrawStreet (DoubleBuffer *db, int pause);
   void DrawCalibration (DoubleBuffer *db);
   void DrawHighway (DoubleBuffer *db, int pause);
   void DrawSubway (DoubleBuffer *db, int pause);
   void DrawConveyer (DoubleBuffer *db, int pause);
   void DrawAirport3 (DoubleBuffer *db);
   void DrawAirport4 (DoubleBuffer *db, int pause);
   void DrawStage2 (DoubleBuffer *db, int pause);
   void DrawTrain (DoubleBuffer *db, int pause);
};
