Example #1
0
void eat_fruit(int eactor, int pcount)
{
  switch(pickup[pcount].contains)
  {
    case FRUITS_CHERRY:
    case FRUITS_BLUEBERRY:
    case FRUITS_FIG:
    case FRUITS_STRAWBERRY:
    score_event(eactor, SCORE_SFRUIT, pickup[pcount].contains);
    create_cloud(CLOUD_1_POINT, pickup[pcount].x, pickup[pcount].y, 0, -20, 65, 1, 0, 0);
    break;
    case FRUITM_PEACH:
    case FRUITM_RAPPLE:
    case FRUITM_PEAR:
    score_event(eactor, SCORE_MFRUIT, pickup[pcount].contains);
    create_cloud(CLOUD_3_POINTS, pickup[pcount].x, pickup[pcount].y, 0, -20, 65, 1, 0, 0);
    break;
    case FRUITL_DURIAN:
    case FRUITL_PINEAPPLE:
    score_event(eactor, SCORE_LFRUIT, pickup[pcount].contains);
    create_cloud(CLOUD_5_POINTS, pickup[pcount].x, pickup[pcount].y, 0, -20, 65, 1, 0, 0);
    break;
  }

}
int main(int argc, char** argv)
{
   if (argc != 9 )
   {
      std::cerr << "Usage: " << argv[0] << " rgb_image1 depth_image1 rgb_image2 depth_image2 fx fy cx cy.\n";
      return(1);
   }

   // loading images and depth information
   cv::Mat rgb1 = cv::imread( argv[1], CV_LOAD_IMAGE_GRAYSCALE );
   cv::Mat depth1 = cv::imread( argv[2], CV_LOAD_IMAGE_ANYDEPTH );

   cv::Mat rgb2 = cv::imread( argv[3], CV_LOAD_IMAGE_GRAYSCALE );
   cv::Mat depth2 = cv::imread( argv[4], CV_LOAD_IMAGE_ANYDEPTH );

   // intrinsics parameters
   float fx = atof(argv[5]);
   float fy = atof(argv[6]);
   float cx = atof(argv[7]);
   float cy = atof(argv[8]);

   // detect keypoint using rgb images
   cv::Ptr<cv::FeatureDetector> detector = cv::FeatureDetector::create( "STAR" );

   std::vector<cv::KeyPoint> keypoints1;
   detector->detect( rgb1, keypoints1 );
 
   std::vector<cv::KeyPoint> keypoints2;
   detector->detect( rgb2, keypoints2 );

   // create point cloud and compute normal
   cv::Mat cloud1, normals1;
   create_cloud( depth1, fx, fy, cx, cy, cloud1 );
   compute_normals( cloud1, normals1 );
   
   cv::Mat cloud2, normals2;
   create_cloud( depth2, fx, fy, cx, cy, cloud2 );
   compute_normals( cloud2, normals2 );

   // extract descriptors
   BrandDescriptorExtractor brand;

   cv::Mat desc1;
   brand.compute( rgb1, cloud1, normals1, keypoints1, desc1 );

   cv::Mat desc2;
   brand.compute( rgb2, cloud2, normals2, keypoints2, desc2 );

   // matching descriptors
   std::vector<cv::DMatch> matches; 
   crossCheckMatching(desc2, desc1, matches);

   cv::Mat outimg;
   cv::drawMatches(rgb2, keypoints2, rgb1, keypoints1, matches, outimg, cv::Scalar::all(-1), cv::Scalar::all(-1));
   cv::imshow("matches", outimg);
   cv::waitKey();

   return 0;
}
Example #3
0
void place_burstlet_burst(int x, int y, int xs, int ys, int burstlets, int min_timeout, int random_timeout, int burst, int random_burst, int pretravel, int colours [5])
{

int i, xs2, ys2, x2, y2;

  for (i = 0; i < burstlets; i ++)
  {
   xs2 = burst + grand(random_burst);
   ys2 = burst + grand(random_burst);
   if (grand(2) == 0)
    xs2 *= -1;
   if (grand(2) == 0)
    ys2 *= -1;
   xs2 += xs;
   ys2 += ys;
   x2 = x + xs2 * pretravel; // or it will just be masked by the main
   y2 = y + ys2 * pretravel; //  explosion

   create_cloud(CLOUD_BURSTLET,
    x2, y2, 0,0, xs2, ys2,
    min_timeout + random_timeout,1,0, 0, 0, 0, colours);
  }


}
Example #4
0
void teleport_team_base(int bteam)
{

 int i = 0;
 int bpick;


 for (i = 0; i < MAX_PICKUPS; i ++)
 {
  if (pickup[i].pickup_type == PICKUP_BASE
   && pickup[i].contains == bteam)
   {
    bpick = i;
    break;
   }
 }

 create_cloud(CLOUD_COL_EXPLOSION, pickup[bpick].x, pickup[bpick].y, 0, 0, 2000, 40, team_colours(bteam), 10);

 destroy_pickup(bpick);

 bpick = drop_pickups(PICKUP_BASE, bteam);
 team[bteam].base_x = pickup[bpick].x;
 team[bteam].base_y = pickup[bpick].x;

}
Example #5
0
void place_explosion_with_smoke(int x, int y, int xs, int ys, int size, int colours [5])
{

   int passing_colours [5];

   passing_colours [0] = TRANS_GREY;

   create_cloud(CLOUD_MED_TRANS_CIRCLE,
    x,
    y,
    0, 0,
    xs,
    ys,
    size,-30,1, 0, 0, 0, passing_colours);


   passing_colours [0] = colours [0];
   
   create_cloud(CLOUD_MED_TRANS_CIRCLE,
    x,
    y,
    0, 0,
    xs,
    ys,
    size,-100,10, 0, 0, 0, passing_colours);

   passing_colours [0] = colours [1];

   create_cloud(CLOUD_MED_TRANS_CIRCLE,
    x,
    y,
    0, 0,
    xs,
    ys,
    size,-105,15, 0, 0, 0, passing_colours);

   passing_colours [0] = colours [2];

   create_cloud(CLOUD_MED_TRANS_CIRCLE,
    x,
    y,
    0, 0,
    xs,
    ys,
    size,-110,20, 0, 0, 0, passing_colours);

}
Example #6
0
void drop_porkball(int pactor)
{

 if (arena[0].who_has_porkball != -1)
 {
  actor[arena[0].who_has_porkball].has_porkball = -1;
  arena[0].who_has_porkball = -1;
 }

 int px = 0;
 int py = 0;

 int tries = 0;

 do
 {
  px = prand(arena[0].max_x - 40) + 10;
  py = prand(arena[0].max_y - 40) + 20;
  tries ++;
  if (tries == 50000)
  {
       set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
       allegro_message("Fatal Error: Can't find empty space in map. Aborting.");
       exit(1);
  }
 } while(!check_free_area(px - actor[pactor].width, py - actor[pactor].height, px + actor[pactor].width, py + actor[pactor].height));

 actor[pactor].x = px * GRAIN;
 actor[pactor].y = py * GRAIN;
 actor[pactor].x_speed = 0;
 actor[pactor].y_speed = 0;

 blast_dirt(actor[pactor].x, actor[pactor].y, 8, 1);

 arena[0].porkball_x = actor[pactor].x;
 arena[0].porkball_y = actor[pactor].y;
 arena[0].porkball_state = -1;
 
   create_cloud(CLOUD_ORANGE_EXPLOSION, arena[0].porkball_x, arena[0].porkball_y, 0, 0, 500, 3, 0, 20);
   create_cloud(CLOUD_ORANGE_EXPLOSION, arena[0].porkball_x - 10 * GRAIN, arena[0].porkball_y, 0, 0, 300, 5, 0, 20);
   create_cloud(CLOUD_ORANGE_EXPLOSION, arena[0].porkball_x + 10 * GRAIN, arena[0].porkball_y, 0, 0, 300, 5, 0, 20);
   create_cloud(CLOUD_ORANGE_EXPLOSION, arena[0].porkball_x, arena[0].porkball_y - 10 * GRAIN, 0, 0, 300, 5, 0, 20);
   create_cloud(CLOUD_ORANGE_EXPLOSION, arena[0].porkball_x, arena[0].porkball_y + 10 * GRAIN, 0, 0, 300, 5, 0, 20);

}
Example #7
0
void place_rocket_trail(int x, int y, int xs, int ys, int size, int colours [5])
{

   int passing_colours [5];


   passing_colours [0] = colours [0];
   
   create_cloud(CLOUD_MED_TRANS_CIRCLE,
    x,
    y,
    0, 0,
    xs,
    ys,
    size,-6,1, 0, 0, 0, passing_colours);

   passing_colours [0] = colours [1];

   create_cloud(CLOUD_MED_TRANS_CIRCLE,
    x,
    y,
    0, 0,
    xs,
    ys,
    size,-15,6, 0, 0, 0, passing_colours);

   passing_colours [0] = colours [2];

   create_cloud(CLOUD_MED_TRANS_CIRCLE,
    x,
    y,
    0, 0,
    xs,
    ys,
    size,-20,15, 0, 0, 0, passing_colours);

}
Example #8
0
void place_explosion(int x, int y, int xs, int ys, int size, int colours [5])
{

   int passing_colours [5];


   passing_colours [0] = colours [0];
   
   create_cloud(CLOUD_MED_TRANS_CIRCLE,
    x,
    y,
    0, 0,
    xs,
    ys,
    size,-100,10, 0, 0, 0, passing_colours);

   passing_colours [0] = colours [1];

   create_cloud(CLOUD_MED_TRANS_CIRCLE,
    x,
    y,
    0, 0,
    xs,
    ys,
    size,-120,15, 0, 0, 0, passing_colours);

   passing_colours [0] = colours [2];

   create_cloud(CLOUD_MED_TRANS_CIRCLE,
    x,
    y,
    0, 0,
    xs,
    ys,
    size,-140,20, 0, 0, 0, passing_colours);

}
Example #9
0
void place_speck_burst(int x, int y, int xs, int ys, int specks, int min_timeout, int random_timeout, int scatter, int colours [5])
{

  int i;

  for (i = 0; i < specks; i ++)
  {
   create_cloud(CLOUD_SPECK,
    x,
    y,
    0, 0,
    xs + grand(scatter * 2 + 1) - scatter,
    ys + grand(scatter * 2 + 1) - scatter,
    min_timeout + grand(random_timeout), 1,0,0, 0, 0, colours);
  }

}
Example #10
0
void teleport_th_base(int th)
{

// int i = 0;
 int bpick = arena[0].th_base_pickup [th];

 create_cloud(CLOUD_COL_EXPLOSION, pickup[bpick].x, pickup[bpick].y, 0, 0, 2000, 40, 15, 10);

 destroy_pickup(bpick);

 bpick = drop_pickups(PICKUP_TH_BASE, 0);
 arena[0].th_base_x [th] = pickup[bpick].x;
 arena[0].th_base_y [th] = pickup[bpick].y;
 arena[0].th_base_pickup [th] = bpick;
 pickup[bpick].th_index = th;

}
Example #11
0
void simple_cloud_trans(int colour, int x, int y, int xs, int ys, int size)
{

   int passing_colours [5];

   passing_colours [0] = colour;
   
   create_cloud(CLOUD_MED_TRANS_CIRCLE,
    x,
    y,
    0, 0,
    xs,
    ys,
    size,-30,10, 0, 0, 0, passing_colours);


}
Example #12
0
void place_line_burst(int x, int y, int xs, int ys, int specks, int min_timeout, int random_timeout, int burst, int random_burst, int colours [5])
{

  int i, angle, xsp, ysp, burst_speed;

  for (i = 0; i < specks; i ++)
  {
   angle = grand(ANGLE_FULL);
   burst_speed = burst + grand(burst);
   xsp = xs + cos(angle_to_radians(angle)) * burst_speed;
   ysp = ys + sin(angle_to_radians(angle)) * burst_speed;
   x += xsp;
   y += ysp;
   create_cloud(CLOUD_SHRINKING_LINE,
    x,
    y,
    0, 0,
    xsp,
    ysp,
    (min_timeout + grand(random_timeout)) * 10, 10 + grand(6),0,angle, 0, 0, colours);
  }

}
Example #13
0
void manage_cloud(int c)
{

 int passing_colours [5];

//   int x_gain = 0;
//   int y_gain = 0;
//   char angle_change;

//   if (cloud[c].timeout > 0)
//   {
    cloud[c].timeout -= cloud[c].tickrate;
    cloud[c].tickrate += cloud[c].delta_tickrate;
//   }

   if (cloud[c].timeout <= 0)
   {
    destroy_cloud(c);
    return;
   }

   switch(cloud[c].type)
   {
    case CLOUD_BURSTLET:
//     place_explosion(cloud[c].x, cloud[c].y, 0, 0, , cloud[c].colours);
     passing_colours [0] = cloud[c].colour [1]; // was [0]
   
     create_cloud(CLOUD_MED_TRANS_CIRCLE,
      cloud[c].x, cloud[c].y, 0, 0, 0, 0,
      50 + grand(300),0,3, 0, 0, 0, passing_colours);
//     passing_colours [0] = cloud[c].colour [1];

//     create_cloud(CLOUD_MED_TRANS_CIRCLE,
//      cloud[c].x, cloud[c].y, 0, 0, 0, 0, size,-40,15, 0, 0, 0, passing_colours);

     passing_colours [0] = cloud[c].colour [2];

     create_cloud(CLOUD_MED_TRANS_CIRCLE,
      cloud[c].x, cloud[c].y, 0, 0, 0, 0,
      50 + grand(300),0,6, 0, 0, 0, passing_colours);
     break;
    case CLOUD_SPAWNER:
     if (cloud[c].timeout % 2 == 0)
     {
       int cangle = grand(ANGLE_FULL);
       int cx = cloud[c].x + cos(angle_to_radians(cangle)) * grand(cloud[c].status * 100);
       int cy = cloud[c].y + sin(angle_to_radians(cangle)) * grand(cloud[c].status * 100);
//       create_cloud(CLOUD_MED_TRANS_CIRCLE,
//        cloud[c].x, cloud[c].y, 0, 0, 0, 0,
//        50 + grand(300),0,3, 0, 0, 0, passing_colours);
       place_explosion_with_smoke(
//        cloud[c].x - cloud[c].status * 100 + grand(cloud[c].status * 200),
//        cloud[c].y - cloud[c].status * 100 + grand(cloud[c].status * 200),
          cx, cy,
          0, 0, grand(cloud[c].status) + 250, cloud[c].colour);
       if (cloud[c].timeout % 8 == 0)
        play_sound_pos(WAV_MINEBANG, 200 + grand(200), 200, cx, cy);

     }
     break;
   }

   if (move_cloud(c, 1) == 0)
    return;

 drag_cloud(c);

}
Example #14
0
void actor_sidekicks(int a)
{

 int i, xcos2, ysin2;

 int passing_colours [5];

 if (actor[a].sidekick_recycle > 0)
  actor[a].sidekick_recycle --;

 int xcos = cos(angle_to_radians(actor[a].angle)) * GRAIN;
 int ysin = sin(angle_to_radians(actor[a].angle)) * GRAIN;
// int xcos2;// = cos(angle_to_radians(actor[a].angle)) * GRAIN;
// int ysin2;// = sin(angle_to_radians(actor[a].angle)) * GRAIN;

// if (actor[a].sidekicks >= 2)
// {
//  xcos2 = cos(angle_to_radians(actor[a].angle)) * GRAIN;
//  ysin2 = sin(angle_to_radians(actor[a].angle)) * GRAIN;
// }
 
 int target_x, target_y;
 float speed_mult;
 int accel = 0;

 for (i = 0; i < actor[a].sidekicks; i ++)
 {
  switch(i)
  {
   case 0:
    target_x = actor[a].x + (cos(angle_to_radians(actor[a].angle - ANGLE_1_EIGHTH)) * GRAIN * 40);
    target_y = actor[a].y + (sin(angle_to_radians(actor[a].angle - ANGLE_1_EIGHTH)) * GRAIN * 40);
    accel = 22;
    passing_colours [0] = COLOUR_YELLOW8;
    passing_colours [1] = COLOUR_GREEN8;
    passing_colours [2] = COLOUR_GREEN6;
    passing_colours [3] = COLOUR_GREEN4;
    passing_colours [4] = COLOUR_GREEN2;
    break;
   case 1:
    target_x = actor[a].x + (cos(angle_to_radians(actor[a].angle - ANGLE_QUARTER - ANGLE_1_EIGHTH)) * GRAIN * 40);
    target_y = actor[a].y + (sin(angle_to_radians(actor[a].angle - ANGLE_QUARTER - ANGLE_1_EIGHTH)) * GRAIN * 40);
//    target_x = actor[a].x - xcos * 20;
//    target_y = actor[a].y - ysin * 20;
    accel = 22;
    break;
   case 2:
    target_x = actor[a].x + xcos * 40;
    target_y = actor[a].y + ysin * 40;
    accel = 12;
    passing_colours [0] = COLOUR_YELLOW8;
    passing_colours [1] = COLOUR_YELLOW6;
    passing_colours [2] = COLOUR_YELLOW4;
    passing_colours [3] = COLOUR_YELLOW3;
    passing_colours [4] = COLOUR_YELLOW2;
    break;
   case 3:
    target_x = actor[a].x - xcos * 40;
    target_y = actor[a].y - ysin * 40;
    accel = 12;
    break;
  }

  speed_mult = hypot(actor[a].sidekick_y [i] - target_y, actor[a].sidekick_x [i] - target_x) / 600;

  if (speed_mult > 200)
   speed_mult = 200;
   
  speed_mult *= accel;
  speed_mult /= 10;
/*  if (speed_mult < 20 && abs(actor[a].sidekick_x_speed [i]) + abs(actor[a].sidekick_y_speed [i]) < 2000)
  {
   actor[a].sidekick_angle [i] = turn_towards_angle(actor[a].sidekick_angle [i], actor[a].angle + ANGLE_QUARTER, 8);
   actor[a].sidekick_x_speed [i] = 0;
   actor[a].sidekick_y_speed [i] = 0;
  }
   else*/
   {
    actor[a].sidekick_angle [i] = turn_towards_xy(actor[a].sidekick_x [i], actor[a].sidekick_y [i], target_x, target_y, actor[a].sidekick_angle [i], 16);

//  actor[a].sidekick_x_speed [i] = cos(angle_to_radians(actor[a].sidekick_angle [i])) * speed_mult;
//  actor[a].sidekick_y_speed [i] = sin(angle_to_radians(actor[a].sidekick_angle [i])) * speed_mult;

//  actor[a].sidekick_x_speed [i] += cos(angle_to_radians(actor[a].sidekick_angle [i])) * speed_mult;
//  actor[a].sidekick_y_speed [i] += sin(angle_to_radians(actor[a].sidekick_angle [i])) * speed_mult;
    xcos2 = cos(angle_to_radians(actor[a].sidekick_angle [i])) * speed_mult;
    ysin2 = sin(angle_to_radians(actor[a].sidekick_angle [i])) * speed_mult;
    actor[a].sidekick_x_speed [i] += xcos2;
    actor[a].sidekick_y_speed [i] += ysin2;
   }

  actor[a].sidekick_x_speed [i] *= 0.97;
  actor[a].sidekick_y_speed [i] *= 0.97;

  actor[a].sidekick_x [i] += actor[a].sidekick_x_speed [i];
  actor[a].sidekick_y [i] += actor[a].sidekick_y_speed [i];

  if (grand(12) == 0 && abs(actor[a].sidekick_x_speed [i]) + abs(actor[a].sidekick_y_speed [i]) > 1000)
  {
   create_cloud(CLOUD_SPECK,
    actor[a].sidekick_x [i] - xcos2 * 37,
    actor[a].sidekick_y [i] - ysin2 * 37,
    0, 0,
    actor[a].sidekick_x_speed [i] - (xcos2 * 10) + (100 - grand(51)),
    actor[a].sidekick_y_speed [i] - (ysin2 * 10) + (100 - grand(51)),
    10 + grand(11),1,0, 0, 0, 0, passing_colours);
  }
  

 }


}
Example #15
0
void drag_actor(int i)
{

// int drag_x, drag_y;
// int new_x_speed, new_y_speed;

/* float drag_mult = 0.015 - (actor[i].ability [ABILITY_DRIVE] [SYMBOL_TRIANGLE] * 0.0015);//game.drag;
 if (actor[i].dragging > 0)
 {
  drag_mult *= (float) actor[i].brake_strength * actor[i].dragging / 20;
 }*/
 //float drag_mult = 0.020 - (actor[i].ability [ABILITY_DRIVE] [SYMBOL_TRIANGLE] * 0.0020);//game.drag;
 
 float drag_mult = 0.025 - (actor[i].ability [ABILITY_DRIVE] [SYMBOL_TRIANGLE] * 0.0025);//game.drag;

 if (actor[i].dragging > 0)
 {
  drag_mult *= (float) actor[i].brake_strength * actor[i].dragging / 23;
 }

 int angle = radians_to_angle(atan2(actor[i].y_speed, actor[i].x_speed));
 actor[i].moving_angle = angle;
 float dragged = hypot(abs(actor[i].x_speed), abs(actor[i].y_speed)) * drag_mult;

 if (actor[i].dragging == 0 && actor[i].ability [ABILITY_DRIVE] [SYMBOL_TRIANGLE] != 0)
 {
  if (dragged < 10 + actor[i].ability [ABILITY_DRIVE] [SYMBOL_TRIANGLE] * 5)
  {
   dragged /= 5 + actor[i].ability [ABILITY_DRIVE] [SYMBOL_TRIANGLE];
  }
 }

 float change = cos(angle_to_radians(angle)) * dragged;
 actor[i].x_speed -= change;// * game[0].drag;

 change = sin(angle_to_radians(angle)) * dragged;
 actor[i].y_speed -= change;// * game[0].drag;

 if (actor[i].dragging == 20)
 {
  if (abs(actor[i].x_speed) < 20 && abs(actor[i].y_speed) < 20)
  {
   actor[i].x_speed = 0;
   actor[i].y_speed = 0;
  }
 }


 if (actor[i].dragging == 20 && grand(100) + 70 < dragged)
 {
  int passing_colours [5] = {COLOUR_YELLOW8, COLOUR_ORANGE8, COLOUR_RED8, COLOUR_RED6, COLOUR_RED4};
  create_cloud(CLOUD_SPECK,
  actor[i].x + grand(10001) - 5000,
  actor[i].y + grand(10001) - 5000,
   0, 0,
//   actor[a].x_speed + x_accel * 20 + (300 - grand(601)),
//   actor[a].y_speed + y_accel * 20 + (300 - grand(601)),
   0, 0,
   10 + grand(11),1,0, 0, 0, 0, passing_colours);
 }

 if (dragged > 250 - (actor[i].dragging == 20) * 150)
 {
   player[actor[i].controller].screen_shake_x += grand((dragged - 100) * 60) - ((dragged - 100) * 30);
   player[actor[i].controller].screen_shake_y += grand((dragged - 100) * 60) - ((dragged - 100) * 30);
//   player[actor[i].controller].screen_shake_x += grand(3500) - 1750;
//   player[actor[i].controller].screen_shake_y += grand(3500) - 1750;
//  if (dragged > 60)
// {
   
// }
 }

 actor[i].drag_amount = dragged;// * game[0].drag;
/*
 if (actor[i].drag_amount < 2)
  return;


 actor[i].x_speed = new_x_speed;
 actor[i].y_speed = new_y_speed;
*/
}
Example #16
0
// called when an actor spawns after being destroyed
void spawn_actor(int a)
{

 actor[a].in_play = 1;
// actor[a].x = arena.max_x / 2; //grand(arena.max_x - 100000) + 50000;
// actor[a].y = arena.max_y / 2; //grand(arena.max_y - 100000) + 50000;
 actor[a].x = actor[a].next_spawn_x;
 actor[a].y = actor[a].next_spawn_y;

      int passing_colours [5];

      passing_colours [0] = COLOUR_WHITE;

      create_cloud(CLOUD_SHRINKING_CIRCLE,
       actor[a].x,
       actor[a].y,
       0, 0,
       0, 0,
       500, -300, 10, 0, 0, 0, passing_colours);
       
      passing_colours [0] = TRANS_DBLUE;
      passing_colours [1] = TRANS_LBLUE;
      passing_colours [2] = TRANS_WHITE;
  
      place_explosion(actor[a].x, actor[a].y, 0,0,
       700 + crandom(250), passing_colours);


/* actor[a].x_speed = 0;
 actor[a].y_speed = 0;
 actor[a].angle = 0;
 actor[a].base_angle = 0;
 actor[a].dragging = 0;
 actor[a].drag_amount = 0;
// actor[a].in_play = 0;
 actor[a].moving_angle = actor[0].angle;
 actor[a].just_collided = 0;
 
// actor[a].recharge = ships[ship].recharge;
 actor[a].just_upgraded = 0;
 actor[a].just_upgraded_timeout = 0;
 actor[a].shield_pulse = 0;
 actor[a].recycle1 = 0;
 actor[a].recycle2 = 0;
 actor[a].heavy_recycle = 0;
 actor[a].turret_recycle = 0;
 actor[a].backfire_recycle = 0;
 actor[a].cannon_status = 0;
 actor[a].orbital_angle = 0;
 actor[a].bomb_status = 0;
 actor[a].upgrade_slot = 0;
 actor[a].spawn_delay = 0;
 actor[a].grace_period = 169;
 actor[a].armour = actor[a].max_armour;
 actor[a].max_shield = 0;
 actor[a].shield = 0;
 actor[a].lock = -1;
 actor[a].turret_lock = -1;*/

 reset_actor(a);

 actor[a].secondary = SECOND_NONE; // not in reset_actor as we want to retain this between levels.

 actor[a].sidekicks = 0;
// if (actor[a].upgraded_system [UPG_SIDEKICK] > 0)
//  upgrade_sidekicks(a);
 
 play_wavf(NWAV_SPAWN, 800);

 if (game.type == GAME_TIME_ATTACK || game.type == GAME_TIME_ATTACK_COOP || game.type == GAME_DUEL)
 {
  calculate_beat();
 }

 if (game.type != GAME_DUEL && game.type != GAME_TIME_ATTACK && game.type != GAME_TIME_ATTACK_COOP)
  game.ships_left --;
}
Example #17
0
void spawn_actor(int sactor, char async)
{

//int i;

 if (async == 0 && serial[0].game_type == SERIAL_CLIENT
  && user[actor[sactor].user].player > 0)
 {
  //async_spawn(sactor, actor[sactor].soldier);
 }

 user[actor[sactor].user].resting_time = 329;

init_actor(sactor, 1);

/*    actor[sactor].firing_laser = LASER_NONE;
    actor[sactor].laser_strength = 0;
    actor[sactor].remote_control = REMOTE_NONE;
    actor[sactor].health = actor[sactor].max_health;
    actor[sactor].x_speed = 0;
    actor[sactor].y_speed = 0;

   actor [sactor].armour = 0;
   actor [sactor].shield = 0;
   actor [sactor].shield_visible = 0;
   actor [sactor].cloak = 0;
   actor [sactor].uncloaked = 0;
   actor [sactor].current_weapon = 0;
   for (i = 0; i < 4; i ++)
   {
    actor [sactor].weapon [i] = user[actor[sactor].user].weapon [i];
    actor [sactor].ammunition [i] = wlist[actor [sactor].weapon [i]].ammunition;
    if (actor[sactor].weapon [i] != WPN_NONE)
     actor [sactor].clips [i] = actor[sactor].max_clips;
      else
      {
       actor [sactor].clips [i] = 0;
       actor [sactor].ammunition [i] = 0;
      }
    actor [sactor].reload [i] = 0;
   }
*/

// start place_actor function

 int px = 0;
 int py = 0;

 int tries = 0;

 if (!async)
 {
  do
  {
   px = prand(arena[0].max_x - 40) + 10;
   py = prand(arena[0].max_y - 40) + 20;
   tries ++;
   if (tries == 50000)
   {
        set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
        allegro_message("Fatal Error: Can't find empty space in map. Aborting.");
        exit(1);
   }
  } while(!check_free_area(px - actor[sactor].width, py - actor[sactor].height, px + actor[sactor].width, py + actor[sactor].height));

  actor[sactor].x = px * GRAIN;
  actor[sactor].y = py * GRAIN;

  blast_dirt(actor[sactor].x, actor[sactor].y, 15, 1);
 }

      display_actor_health(sactor, 0);
      display_actor_ammunition(sactor);
      if (actor[sactor].player > 0)
       init_stat_disp2(actor[sactor].player);
      display_actor_clips(sactor);
      display_actor_armour(sactor);

 if (actor[sactor].incarnation == 0)
  actor[sactor].incarnation = 1;
   else
    actor[sactor].incarnation = 0;

//   textprintf(screen, large_font, 140, 190, arena[0].counter, "A %i H %i MH %i", sactor, actor[sactor].health, actor[sactor].max_health);

 create_cloud(CLOUD_SPAWN, actor[sactor].x, actor[sactor].y,
  0, 0, actor[sactor].circle_radius * 100, 1, actor[sactor].soldier, 3);
 create_cloud(CLOUD_BIGLIGHT, actor[sactor].x, actor[sactor].y,
  0, 0, actor[sactor].circle_radius * 100, 1, 0, 3);



}