#include "main.h"

/*
Constructor for the T29 class.
*/
T29::T29( int _x, int _y) {
  id = ID_29;
  x = _x;
  y = _y;
  size = 64;
  scale = (size / 64.0);
  frame = 0;
  angle = 0;//random()%256;
  tbmp = create_bitmap(size,size);
  remove = false;
}

/*
Destructor for the T29 class.
*/
T29::~T29() {
  destroy_bitmap(tbmp);
}

/*
Draws the T29.
*/
void T29::draw() {
  int f = MIN((frame/2), 11);
  drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
  clear(tbmp);
  rotate_scaled_sprite(tbmp, _twentynine(f), 0, 0, itofix(angle), ftofix(scale));
  draw_trans_sprite(buffer, tbmp, x-(size>>1), y-(size>>1));
  drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0);
}

/*
Performs any needed calculations.
*/
void T29::move() {
  frame++;
  if (frame > 30) {
    angle+=5;
    size -=2;
    scale = (size / 64.0);
  }
  if (frame > 50) {
    remove = true;
    frame = 50;
  }
}

/*
Returns true when the entity can be removed from the list.
*/
bool T29::done() {
  return remove;
}

/*
Explosions need no collision detection.
*/
void T29::collide(ENTITY *other) {
}

/*
Get functions to allow access to private data inside the class.
*/
int T29::get_x() {
  return x;
}

int T29::get_y() {
  return y;
}

int T29::get_id() {
  return id;
}

int T29::get_va() {
  return 0;
}

float T29::get_xa() {
  return 0;
}

float T29::get_ya() {
  return 0;
}

int T29::get_owner() {
  return -1;
}

/* END */
