#ifndef _ENTITY_H_
#define _ENTITY_H_

#include <allegro.h>

/*
Identification codes. These are required for entities to interact with
each other correctly with regard to collision detection.
*/
#define ID_BUGGY        1
#define ID_BULLET       2
#define ID_EXPLO        3
#define ID_SMOKE        4
#define ID_29           5
#define ID_PART         6


/*
Control codes, specifies where the intelligence for the player is coming from.
*/
#define AI_LOCAL        1
#define AI_NETWORK      2
#define AI_CPU          3

/*
Abstract base class for all objects.
*/
class ENTITY {
 public:
  ENTITY() {};
  virtual void draw() = 0;
  virtual void move() = 0;
  bool virtual done() = 0;
  virtual void collide(ENTITY *other) = 0;
  virtual int get_x() = 0;
  virtual int get_y() = 0;
  virtual int get_id() = 0;
  virtual int get_va() = 0;
  virtual float get_xa() = 0;
  virtual float get_ya() = 0;
  virtual int get_owner() = 0;
};


/*
Buggy class.
*/
class BUGGY : public ENTITY {
 private:
  short id;
  float fx, fy, xa, ya, thrust, nxa, nya;
  short x, y, va, ammo, aicount, ccount, icount, power;
  unsigned short type, spower, firetime, scount, kills;
  unsigned char ai, pcount, powerup, weapon, dcount;
  bool remove, kl, kr, ku, kd, kf, cloaked, invuln, dead;
  char callsign[11], frame, mframe;
  ENTITY *target;
  BITMAP *tbmp;
 public:
  BUGGY(int x, int y, int type, int ai, char callsign[]);
  ~BUGGY();
  int AI_find_mission();
  int AI_face_target();
  void get_action();
  void add_kill();
  int get_kills();
  char *get_callsign();
  virtual void draw();
  virtual void move();
  virtual bool done();
  virtual void collide(ENTITY *other);
  virtual int get_x();
  virtual int get_y();
  virtual int get_id();
  virtual int get_va();
  virtual float get_xa();
  virtual float get_ya();
  virtual int get_owner();
};


/*
Bullet class :
*/
class BULLET : public ENTITY {
 protected:
  int id;
  float fx, fy, xa, ya;
  int x, y, va, life, color, damage;
  bool remove, pressure;
 public:
  BULLET(int x, int y, int va, int color);
  ~BULLET();
  bool get_pressure();
  int get_damage();
  virtual void draw();
  virtual void move();
  virtual bool done();
  virtual void collide(ENTITY *other);
  virtual int get_x();
  virtual int get_y();
  virtual int get_id();
  virtual int get_va();
  virtual float get_xa();
  virtual float get_ya();
  virtual int get_owner();
};

/*
Explosion class :
*/
class EXPLO : public ENTITY {
 private:
  int id;
  int x, y, frame, angle, size;
  float scale;
  BITMAP *tbmp;
  bool remove;
 public:
  EXPLO(int x, int y, int size, bool sound = true);
  ~EXPLO();
  virtual void draw();
  virtual void move();
  virtual bool done();
  virtual void collide(ENTITY *other);
  virtual int get_x();
  virtual int get_y();
  virtual int get_id();
  virtual int get_va();
  virtual float get_xa();
  virtual float get_ya();
  virtual int get_owner();
};

/*
Part class. I love this... bouncing wheels and stuff. :o)
*/
class PART : public ENTITY {
 private:
  int id;
  float fx, fy, xa, ya, thrust;
  int x, y, z, va, life, color;
  bool remove;
 public:
  PART(int x, int y, int va, float thrust, int color);
  ~PART();
  virtual void draw();
  virtual void move();
  virtual bool done();
  virtual void collide(ENTITY *other);
  virtual int get_x();
  virtual int get_y();
  virtual int get_id();
  virtual int get_va();
  virtual float get_xa();
  virtual float get_ya();
  virtual int get_owner();
};


/*
29 class :
*/
class T29 : public ENTITY {
 private:
  int id;
  int x, y, frame, angle, size;
  float scale;
  BITMAP *tbmp;
  bool remove;
 public:
  T29(int x, int y);
  ~T29();
  virtual void draw();
  virtual void move();
  virtual bool done();
  virtual void collide(ENTITY *other);
  virtual int get_x();
  virtual int get_y();
  virtual int get_id();
  virtual int get_va();
  virtual float get_xa();
  virtual float get_ya();
  virtual int get_owner();
};


#endif

/* END */
