Beispiel #1
0
static bool
test_olc(int n_wind, Contest olc_type)
{
  GlidePolar glide_polar(fixed_two);
  Waypoints waypoints;
  SetupWaypoints(waypoints);

  if (verbose)
    PrintDistanceCounts();

  TaskBehaviour task_behaviour;
  task_behaviour.SetDefaults();
  task_behaviour.DisableAll();
  if (!verbose)
    task_behaviour.enable_trace = false;

  TaskManager task_manager(task_behaviour, waypoints);

  TaskEventsPrint default_events(verbose);
  task_manager.SetTaskEvents(default_events);

  task_manager.SetGlidePolar(glide_polar);
  test_task(task_manager, waypoints, 1);

  waypoints.Clear(); // clear waypoints so abort wont do anything

  autopilot_parms.goto_target = true;
  return run_flight(task_manager, autopilot_parms, n_wind);
}
Beispiel #2
0
static bool
test_null()
{
  GlidePolar glide_polar(fixed(2));
  Waypoints waypoints;
  SetupWaypoints(waypoints);

  if (verbose)
    PrintDistanceCounts();

  TaskBehaviour task_behaviour;
  task_behaviour.SetDefaults();
  task_behaviour.DisableAll();
  task_behaviour.enable_trace = false;

  TaskManager task_manager(task_behaviour, waypoints);

  TaskEventsPrint default_events(verbose);
  task_manager.SetTaskEvents(default_events);

  task_manager.SetGlidePolar(glide_polar);

  task_report(task_manager, "null");

  waypoints.Clear(); // clear waypoints so abort wont do anything

  autopilot_parms.goto_target = true;
  return run_flight(task_manager, autopilot_parms, 0);
}
Beispiel #3
0
TestFlightResult
run_flight(TaskManager &task_manager, const AutopilotParameters &parms,
           const int n_wind, const double speed_factor)
{
  return run_flight(TestFlightComponents(), task_manager, parms, n_wind,
                    speed_factor);
}
Beispiel #4
0
static bool
test_goto(int n_wind, unsigned id, bool auto_mc)
{
  GlidePolar glide_polar(fixed(2));
  Waypoints waypoints;
  SetupWaypoints(waypoints);

  if (verbose)
    PrintDistanceCounts();

  TaskBehaviour task_behaviour;
  task_behaviour.SetDefaults();
  task_behaviour.DisableAll();
  task_behaviour.auto_mc = auto_mc;
  task_behaviour.enable_trace = false;

  TaskManager task_manager(task_behaviour, waypoints);

  TaskEventsPrint default_events(verbose);
  task_manager.SetTaskEvents(default_events);

  task_manager.SetGlidePolar(glide_polar);

  test_task(task_manager, waypoints, 1);

  task_manager.DoGoto(*waypoints.LookupId(id));
  task_report(task_manager, "goto");

  waypoints.Clear(); // clear waypoints so abort wont do anything

  autopilot_parms.goto_target = true;
  return run_flight(task_manager, autopilot_parms, n_wind);
}
Beispiel #5
0
static bool
test_abort(int n_wind)
{
  GlidePolar glide_polar(fixed(2));
  Waypoints waypoints;
  SetupWaypoints(waypoints);

  if (verbose)
    PrintDistanceCounts();

  TaskBehaviour task_behaviour;
  task_behaviour.SetDefaults();
  task_behaviour.DisableAll();
  task_behaviour.enable_trace = false;

  TaskManager task_manager(task_behaviour, waypoints);

  TaskEventsPrint default_events(verbose);
  task_manager.SetTaskEvents(default_events);

  task_manager.SetGlidePolar(glide_polar);

  test_task(task_manager, waypoints, 1);

  task_manager.Abort();
  task_report(task_manager, "abort");

  autopilot_parms.goto_target = true;
  return run_flight(task_manager, autopilot_parms, n_wind);
}
Beispiel #6
0
TestFlightResult
test_flight(TestFlightComponents components, int test_num, int n_wind,
            const double speed_factor, const bool auto_mc)
{
  // multipurpose flight test

  GlidePolar glide_polar(fixed(2));
  Waypoints waypoints;
  SetupWaypoints(waypoints);

  if (verbose)
    PrintDistanceCounts();

  TaskBehaviour task_behaviour;
  task_behaviour.SetDefaults();
  task_behaviour.enable_trace = false;
  task_behaviour.auto_mc = auto_mc;
  task_behaviour.calc_glide_required = false;
  if ((test_num == 0) || (test_num == 2))
    task_behaviour.optimise_targets_bearing = false;

  TaskManager task_manager(task_behaviour, waypoints);

  TaskEventsPrint default_events(verbose);
  task_manager.SetTaskEvents(default_events);
  task_manager.SetGlidePolar(glide_polar);

  OrderedTaskSettings otb = task_manager.GetOrderedTask().GetOrderedTaskSettings();
  otb.aat_min_time = aat_min_time(test_num);
  task_manager.SetOrderedTaskSettings(otb);

  bool goto_target = false;

  switch (test_num) {
  case 0:
  case 2:
  case 7:
    goto_target = true;
    break;
  };
  autopilot_parms.goto_target = goto_target;
  test_task(task_manager, waypoints, test_num);

  waypoints.Clear(); // clear waypoints so abort wont do anything

  return run_flight(components, task_manager, autopilot_parms, n_wind,
                    speed_factor);
}
Beispiel #7
0
bool
test_flight(int test_num, int n_wind, const double speed_factor,
            const bool auto_mc)
{
  // multipurpose flight test

  GlidePolar glide_polar(fixed_two);
  Waypoints waypoints;
  setup_waypoints(waypoints);

  if (verbose)
    distance_counts();

  TaskEventsPrint default_events(verbose);
  TaskManager task_manager(default_events, waypoints);
  task_manager.set_glide_polar(glide_polar);

  task_manager.get_ordered_task_behaviour().aat_min_time = aat_min_time(test_num);

  TaskBehaviour task_behaviour = task_manager.get_task_behaviour();
  task_behaviour.enable_trace = false;
  task_behaviour.auto_mc = auto_mc;
  task_behaviour.calc_glide_required = false;
  if ((test_num == 0) || (test_num == 2))
    task_behaviour.optimise_targets_bearing = false;
  task_manager.set_task_behaviour(task_behaviour);

  bool goto_target = false;

  switch (test_num) {
  case 0:
  case 2:
  case 7:
    goto_target = true;
    break;
  };
  autopilot_parms.goto_target = goto_target;
  test_task(task_manager, waypoints, test_num);

  waypoints.clear(); // clear waypoints so abort wont do anything

  return run_flight(task_manager, autopilot_parms, n_wind,
                    speed_factor);
}
void ai_ballos_priest(Object *o)
{
	//AIDEBUG;
	//debug("timer3: %d", o->timer3);
	
	/*if (o->state < 1000)
	{
		FindObjectByID2(500)->Delete();
		StartScript(900);
		return;
	}*/
	
	run_intro(o);
	run_defeated(o);
	
	run_flight(o);
	run_lightning(o);
	
	switch(o->state)
	{
		// show "ninja" stance for "timer" ticks,
		// then prepare to fly horizontally
		case BP_FIGHTING_STANCE:
		{
			o->frame = 1;
			o->animtimer = 0;
			o->state++;
			
			o->damage = DMG_NORMAL;
			o->savedhp = o->hp;
		}
		case BP_FIGHTING_STANCE+1:
		{
			ANIMATE(10, 1, 2);
			FACEPLAYER;
			
			if (--o->timer < 0 || (o->savedhp - o->hp) > 50)
			{
				if (++o->timer3 > 4)
				{
					o->state = BP_LIGHTNING_STRIKE;
					o->timer3 = 0;
				}
				else
				{
					o->state = BP_PREPARE_FLY_LR;
					o->timer2 = 0;
				}
			}
		}
		break;
		
		// prepare for flight attack
		case BP_PREPARE_FLY_LR:
		case BP_PREPARE_FLY_UD:
		{
			o->timer2++;
			o->state++;
			
			o->timer = 0;
			o->frame = 3;	// fists in
			o->damage = DMG_NORMAL;
			
			// Fly/UD faces player only once, at start
			FACEPLAYER;
		}
		case BP_PREPARE_FLY_LR+1:
		{
			FACEPLAYER;
		}
		case BP_PREPARE_FLY_UD+1:
		{
			// braking, if we came here out of another fly state
			o->xinertia *= 8; o->xinertia /= 9;
			o->yinertia *= 8; o->yinertia /= 9;
			
			if (++o->timer > 20)
			{
				sound(SND_FUNNY_EXPLODE);
				
				if (o->state == BP_PREPARE_FLY_LR+1)
				{
					o->state = BP_FLY_LR;		// flying left/right
				}
				else if (player->y < (o->y + (12 << CSF)))
				{
					o->state = BP_FLY_UP;		// flying up
				}
				else
				{
					o->state = BP_FLY_DOWN;		// flying down
				}
			}
		}
		break;
	}
	
	// his bounding box is in a slightly different place on L/R frames
	if (o->dirparam != o->dir)
	{
		sprites[o->sprite].bbox = sprites[o->sprite].frame[0].dir[o->dir].pf_bbox;
		o->dirparam = o->dir;
	}
}