예제 #1
0
Spawn::Spawn(Spawn* s, uint16_t id) : Item(tSpawn, id)
{
    setName(s->name());
    setLastName(s->lastName());
    Item::setPoint(s->x(), s->y(), s->z());
    setPetOwnerID(s->petOwnerID());
    setLight(s->light());
    setGender(s->gender());
    setDeity(s->deity());
    setRace(s->race());
    setClassVal(s->classVal());
    setHP(s->HP());
    setMaxHP(s->maxHP());
    setGuildID(s->guildID());
    setLevel(s->level());
    for (int i = 0; i <= tLastCoreWearSlot; i++)
    setEquipment(i, s->equipment(i));
    setEquipment(tUnknown1, SlotEmpty);
    setTypeflag(s->typeflag());
    setGM(s->gm());
    setNPC(s->NPC());
    setAnimation(s->animation());
    setDeltas(s->deltaX(), s->deltaY(), s->deltaZ());
    setHeading(s->heading(), s->deltaHeading());
    setConsidered(s->considered());

    // the new copy will own the spawn track list
    m_spawnTrackList.setAutoDelete(false);
    m_spawnTrackList = s->m_spawnTrackList;
    s->m_spawnTrackList.setAutoDelete(false);
    m_spawnTrackList.setAutoDelete(true);
}
예제 #2
0
파일: spawn.cpp 프로젝트: xbackupx/showeqx
//----------------------------------------------------------------------
// Spawn
Spawn::Spawn()
  : Item(tSpawn, 0)
{
  m_name = "fake";
  setNPC(SPAWN_NPC_UNKNOWN);

  Item::setPos(0, 0, 0);
  setDeltas(0, 0, 0);
  setHeading(0, 0);
  setAnimation(0);
  setPetOwnerID(0);
  setLight(0);
  setGender(0);
  setDeity(0);
  setRace(0);
  setClassVal(0);
  setHP(0);
  setMaxHP(0);
  setGuildID(0xffff);
  setGuildTag(NULL);
  setLevel(0);
  setTypeflag(0);
  for (int i = 0; i < tNumWearSlots; i++)
    setEquipment(i, 0);

  // just clear the considred flag since data would be outdated
  setConsidered(false);

  // finally, note when this update occurred.
  updateLast();
}
예제 #3
0
파일: spawn.cpp 프로젝트: xbackupx/showeqx
Spawn::Spawn(Spawn& s, uint16_t id)
  : Item(tSpawn, id)
{
  setName(s.name());
  setLastName(s.lastName());
  Item::setPoint(s.x(), s.y(), s.z());
  setPetOwnerID(s.petOwnerID());
  setLight(s.light());
  setGender(s.gender());
  setDeity(s.deity());
  setRace(s.race());
  setClassVal(s.classVal());
  setHP(s.HP());
  setMaxHP(s.maxHP());
  setGuildID(s.GuildID());
  setLevel(s.level());
  for (int i = 0; i <= tLastCoreWearSlot; i++)
    setEquipment(i, s.equipment(i));
  setEquipment(tUnknown1, 0);
  setTypeflag(s.typeflag());
  setNPC(s.NPC());
  setAnimation(s.animation());
  setDeltas(s.deltaX(), s.deltaY(), s.deltaZ());
  setHeading(s.heading(), s.deltaHeading());
  setConsidered(s.considered());

  // the new copy will own the spawn track list
  m_spawnTrackList.setAutoDelete(false);
  m_spawnTrackList = s.m_spawnTrackList;
  s.m_spawnTrackList.setAutoDelete(false);
  m_spawnTrackList.setAutoDelete(true);
}
예제 #4
0
파일: spawn.cpp 프로젝트: xbackupx/showeqx
Spawn::Spawn(uint16_t id, 
	     int16_t x, int16_t y, int16_t z,
	     int16_t deltaX, int16_t deltaY, int16_t deltaZ,
	     int8_t heading, int8_t deltaHeading,
	     uint8_t animation) 
  : Item(tSpawn, id)
{
  // apply the unknown mob values
  m_name = "unknown";
  setNPC(SPAWN_NPC_UNKNOWN);

  // set what is known
  setPos(x, y, z);
  setDeltas(deltaX, deltaY, deltaZ);
  setHeading(heading, deltaHeading);
  setAnimation(animation);
  
  // initialize what isn't to 0
  setPetOwnerID(0);
  setLight(0);
  setGender(0);
  setDeity(0);
  setRace(0);
  setClassVal(0);
  setHP(0);
  setMaxHP(0);
  setLevel(0);
  for (int i = 0; i < tNumWearSlots; i++)
    setEquipment(i, 0);
  setTypeflag(0);
  setConsidered(false);

  // turn on auto delete for the track list
  m_spawnTrackList.setAutoDelete(true);
}
/**
	this method is used to write the reduced state of the character to a file
*/
void Character::saveReducedStateToFile(char* fName, ReducedCharacterStateArray& state){
	// Update joint order
	updateJointOrdering();

	if (fName == NULL)
		throwError("cannot write to a file whose name is NULL!");

	FILE* fp = fopen(fName, "w");
	if (fp == NULL)
		throwError("cannot open the file \'%s\' for writing...", fName);

	//retrieve the current heading, write it to file, and then set a zero heading for the state
	double heading = getHeadingAngle();
	setHeading(Quaternion::getRotationQuaternion(0, PhysicsGlobals::up), &state);

	fprintf(fp, "# order is:\n# Heading\n# Position\n# Orientation\n# Velocity\n# AngularVelocity\n\n# Relative Orientation\n# Relative Angular Velocity\n#----------------\n\n# Heading\n%lf\n\n# Root(%s)\n", heading, root->name);
	fprintf(fp, "%lf %lf %lf\n", state[0], state[1], state[2]);
	fprintf(fp, "%lf %lf %lf %lf\n", state[3], state[4], state[5],state[6]);
	fprintf(fp, "%lf %lf %lf\n", state[7], state[8], state[9]);
	fprintf(fp, "%lf %lf %lf\n\n", state[10], state[11], state[12]);

	for (uint i=0;i<joints.size();i++){
		fprintf(fp, "# %s\n", joints[jointOrder[i]]->name);
		fprintf(fp, "%lf %lf %lf %lf\n", state[13+7*i+0], state[13+7*i+1], state[13+7*i+2],state[13+7*i+3]);
		fprintf(fp, "%lf %lf %lf\n", state[13+7*i+4], state[13+7*i+5], state[13+7*i+6]);
		fprintf(fp, "\n");
	}
	fclose(fp);
}
예제 #6
0
VehicleObject* GameWorld::tryToSpawnVehicle(VehicleGenerator& gen)
{
	constexpr float kMinClearRadius = 10.f;

	if (gen.remainingSpawns <= 0) {
		return nullptr;
	}

	/// @todo take into account maxDelay as well
	if (gen.lastSpawnTime + gen.minDelay > int(state->basic.timeMS)) {
		return nullptr;
	}

	/// @todo verify this logic
	auto position = gen.position;
	if (position.z < -90.f) {
		position = getGroundAtPosition(position);
	}

	// Ensure there's no existing vehicles near our spawn point
	for (auto& v : vehiclePool.objects)
	{
		if (glm::distance2(position, v.second->getPosition())
				< kMinClearRadius * kMinClearRadius) {
			return nullptr;
		}
	}

	int id = gen.vehicleID;
	if (id == -1) {
		// Random ID found by dice roll
		id = 134;
		/// @todo use zone information to decide vehicle id
	}

	auto vehicle = createVehicle(
				id,
				position);
	vehicle->setHeading(gen.heading);
	vehicle->setLifetime(GameObject::TrafficLifetime);

	/// @todo apply vehicle colours
	/// @todo apply locked & alarm thresholds

	// According to http://www.gtamodding.com/wiki/014C the spawn limit
	// doesn't work.
#if 0
	if (gen.remainingSpawns < 101) {
		gen.remainingSpawns --;
	}
#endif

	gen.lastSpawnTime = state->basic.timeMS;

	return vehicle;
}
예제 #7
0
//
// Formation& =(f)
// Last modified: 28Aug2006
//
// Copies the contents of the parameterized formation into this formation.
//
// Returns:     this formation
// Parameters:
//      f       in/out      the formation being copied
//
Formation& Formation::operator =(const Formation &f)
{
    setFunctions(f);
    setRadius(f.radius);
    setSeedGradient(f.seedGradient);
    setSeedID(f.seedID);
    setFormationID(f.formationID);
    setHeading(f.heading);
    return *this;
}   // =(const Formation &)
예제 #8
0
		Spatial::Spatial(Vec2d pos, const EntityTemplate &et)
		: mPos(pos)
		{
			mMass					= et.mass;
			mMaxSpeed				= et.maxSpeed;
			mMaxForce				= et.maxForce;
			mMaxTurnRate			= et.maxTurnRate;

			setHeading(Vec2d(0.0,-1.0));
		}
예제 #9
0
//
// bool init(dx, dy, dz, theta, colorIndex)
// Last modified: 06Nov2009
//
// Initializes the object to the parameterized values,
// returning true if successful, false otherwise.
//
// Returns:     true if successful, false otherwise
// Parameters:
//      dx          in      the initial x-coordinate of the object (default 0)
//      dy          in      the initial y-coordinate of the object (default 0)
//      dz          in      the initial z-coordinate of the object (default 0)
//      colorIndex  in      the initial array index of the color of the object
//
bool Object::init(const GLfloat dx,    const GLfloat dy, const GLfloat dz,
                 const GLfloat theta, const Color   colorIndex)
{
    Circle::init(dx, dy, dz, DEFAULT_OBJECT_RADIUS, colorIndex);
    setHeading(theta);
    behavior         = DEFAULT_OBJECT_BEHAVIOR;
    behavior.setMaxSpeed(maxSpeed());
    showFilled       = DEFAULT_OBJECT_SHOW_FILLED;
    setEnvironment(NULL);
    return true;
}   // init(const GLfloat..<4>, const Color)
예제 #10
0
void CFootballPlayer::update()
{
    m_canDoActions = true;
    updateOrientation();
    btVector3 velocity = m_body->getLinearVelocity();
    if(velocity.length() > 0.1) {
        setHeading(m_body->getLinearVelocity());
    }
    m_stateMachine->update();

}
예제 #11
0
//Dictates a light tracker step.
void lightTrackerStep()
{
     //As long as one of the front sensors is the minimum of all sampled
     //light sensors, go straight
    if(frontLightSensorsBelowThreshold() == 1)
    {
        headStraight();
    }
    else //Otherwise set the heading to the direction of the minimum value sensor.
    {
        setHeading(getTurnDirectionOfSmallestVarianceSensor() == 1);
    }
}
예제 #12
0
//
// Formation(f, r, sGrad, sID, fID, theta)
// Last modified: 28Aug2006
//
// Default constructor that initializes
// the formation to the parameterized values.
//
// Returns:     <none>
// Parameters:
//      f           in      the initial set of functions of the formation
//      r           in      the initial radius of the formation
//      sGrad       in      the initial seed gradient of the formation
//      sID         in      the initial seed ID of the formation
//      fID         in      the initial ID of the formation
//      theta       in      the initial heading of the formation
//
Formation::Formation(LinkedList<Function> f,
                     const GLfloat        r,
                     const Vector         sGrad,
                     const GLint          sID,
                     const GLint          fID,
                     const GLfloat        theta)
{
    setFunctions(f);
    setRadius(r);
    setSeedGradient(sGrad);
    setSeedID(sID);
    setFormationID(fID);
    setHeading(theta);
}   // Formation(const..{LL<Function>, GLfloat, Vector, GLint..<2>, GLfloat})
예제 #13
0
//
// Formation(f, r, sGrad, sID, fID, theta)
// Last modified: 04Sep2006
//
// Default constructor that initializes
// this formation to the parameterized values.
//
// Returns:     <none>
// Parameters:
//      f           in      the initial function of the formation
//      r           in      the initial radius of the formation
//      sGrad       in      the initial seed gradient of the formation
//      sID         in      the initial seed ID of the formation
//      fID         in      the initial ID of the formation
//      theta       in      the initial heading of the formation
//
Formation::Formation(const Function f,
                     const GLfloat  r,
                     const Vector   sGrad,
                     const GLint    sID,
                     const GLint    fID,
                     const GLfloat  theta)
{
    setFunction(f);
    setRadius(r);
    setSeedGradient(sGrad);
    setSeedID(sID);
    setFormationID(fID);
    setHeading(theta);
}   // Formation(const..{Function, GLfloat, Vector, GLint, GLint, GLfloat})
//
// bool init(dx, dy, dz, theta, colorIndex)
// Last modified: 06Nov2009
//
// Initializes the robot to the parameterized values,
// returning true if successful, false otherwise.
//
// Returns:     true if successful, false otherwise
// Parameters:
//      dx          in      the initial x-coordinate of the robot (default 0)
//      dy          in      the initial y-coordinate of the robot (default 0)
//      dz          in      the initial z-coordinate of the robot (default 0)
//      theta       in      the initial heading of the robot (default 0)
//      colorIndex  in      the initial array index of the color of the robot
//
bool Robot::init(const GLfloat dx,    const GLfloat dy, const GLfloat dz,
                 const GLfloat theta, const Color   colorIndex)
{
    Circle::init(dx, dy, dz, DEFAULT_ROBOT_RADIUS, colorIndex);
    setHeading(theta);
    behavior         = DEFAULT_ROBOT_BEHAVIOR;
    behavior.setMaxSpeed(maxSpeed());
    showHeading      = DEFAULT_ROBOT_SHOW_HEADING;
    heading.showLine = DEFAULT_ROBOT_SHOW_LINE;
    heading.showHead = DEFAULT_ROBOT_SHOW_HEAD;
    showFilled       = DEFAULT_ROBOT_SHOW_FILLED;
    setEnvironment(NULL);
    return true;
}   // init(const GLfloat..<4>, const Color)
예제 #15
0
// Default constructor that initializes
// this formation to the parameterized values.
Formation::Formation(const Function f,
                     const float  r,
                     const Vector   sGrad,
                     const int    sID,
                     const int    fID,
                     const float  theta)
{
    setFunction(f);
    setRadius(r);
    setSeedFrp(sGrad);
    setSeedID(sID);
    setFormationID(fID);
    setHeading(theta);
}
예제 #16
0
bool game_rotate_object(const ScriptArguments& args)
{
	auto object = args.getObject<InstanceObject>(0);
	if( object )
	{
		float start = args[2].real;
		float finish = args[1].real;
		RW_UNUSED(start);

		// @todo INTERPOLATE instead of just setting the heading.
		object->setHeading(finish);
	}
	
	return true;
}
예제 #17
0
		void Spatial::update()
		{
			double timeDelta = mTimeDelta.getElapsedTime().asSeconds();
			mSteeringForce.truncate(mMaxForce);

			Vec2d acceleration = mSteeringForce / mMass;
			mVelocity += acceleration * timeDelta;
			mVelocity.truncate(mMaxSpeed);
			mPos += mVelocity * timeDelta;

			if (mVelocity.lengthSq() > 0.00000001)
			{
				Vec2d velocityNorm = mVelocity;
				velocityNorm.normalize();
				setHeading(velocityNorm);
			}

			mTimeDelta.restart();
		}
예제 #18
0
파일: spawn.cpp 프로젝트: xbackupx/showeqx
void Spawn::update(const spawnStruct* s)
{
  if (m_name.find(Spawn_Corpse_Designator) == -1)
  {
    setName(s->name);
    setLastName(s->lastName);
  }

  setPos(s->x >> 3, s->y >> 3, s->z >> 3);
  setPetOwnerID(s->petOwnerId);
  setLight(s->light);
  setGender(s->gender);
  setDeity(s->deity);
  setRace(s->race);
  setClassVal(s->class_);
  setHP(s->curHp);
  //setMaxHP(s->maxHp);
  setMaxHP(s->curHp); //maxHp is no longer part of the struct
  setGuildID(s->guildID);
  setLevel(s->level);
  for (int i = 0; i <= tLastCoreWearSlot; i++)
    setEquipment(i, s->equipment[i]);
  setEquipment(tUnknown1, 0);

  setTypeflag(s->bodytype);
  setGM(s->gm);

  // If it is a corpse with Unknown (NPC) religion.
  if ((s->NPC == SPAWN_PC_CORPSE) && (s->deity == DEITY_UNKNOWN))
    setNPC(SPAWN_NPC_CORPSE); // it's a dead monster
  else
    setNPC(s->NPC); // otherwise it is what it is

  setAnimation(s->animation);

  // only non corpses and things with animation != 66 move
  if (!isCorpse() && (s->animation != 66))
  {
    setDeltas(s->deltaX >> 2, s->deltaY >> 2, s->deltaZ >> 2);
    setHeading(s->heading, s->deltaHeading);
  }
예제 #19
0
MapItem::MapItem(MapView* v, QGraphicsItem* parent) : QGraphicsItem(parent)
{
   view = v;
   bRect.setLeft(-5000);
   bRect.setWidth(10000);
   bRect.setTop(-5000);
   bRect.setHeight(10000);

   refLat = 0.0;
   refLon = 0.0;
   range = 500.0;
   pixNSRes = 1.0;
   pixWERes = 1.0;
   gridVis = false;

   // non-equitorial map math
   cosineLatReference = 1.0;
   northUp = true;
   setHeading(0.0);
   init = false;
}
GlobalReference& GlobalReference::setCurrentHeading(const State& state, double new_heading) {
  // get current yaw angle
  double current_yaw = state.getYaw();
  State::ConstPositionType position = state.getPosition();

  // get current position in WGS84
  double current_latitude, current_longitude;
  if (hasPosition()) {
    toWGS84(position.x(), position.y(), current_latitude, current_longitude);
  }

  // set the new reference heading
  setHeading(new_heading - (-current_yaw));

  // set the new reference position so that current position in WGS84 coordinates remains the same as before
  if (hasPosition()) {
    setCurrentPosition(state, current_latitude, current_longitude);
  }

  return *this;
}
예제 #21
0
파일: spawn.cpp 프로젝트: xbackupx/showeqx
Spawn::Spawn(QDataStream& d, uint16_t id)
  : Item(tSpawn, id)
{
  // restore Spawn info
  d.readRawBytes((char*)this, sizeof(EQPoint));
  d.readRawBytes((char*)&m_lastUpdate, 
		 ((char*)this + sizeof(Item)) - (char*)&m_lastUpdate);
  d.readRawBytes((char*)&m_petOwnerID,
		 ((char*)this + sizeof(Spawn)) - (char*)&m_petOwnerID);
  d >> m_name;
  d >> m_lastName;

  // calculate race/deity team info
  calcRaceTeam();
  calcDeityTeam();
  
  // don't trust old movement data (minimize walkoffs causing scaling)
  setDeltas(0, 0, 0);
  setHeading(0, 0);

  // even if it had been considered, mark it as not
  setConsidered(false);
}
예제 #22
0
		Spatial::Spatial(Vec2d pos, Vec2d heading, double mass, double maxSpeed, double maxForce, double maxTurnRate)
			: mPos(pos), mHeading(heading), mMass(mass), mMaxSpeed(maxSpeed), mMaxForce(maxForce), mMaxTurnRate(maxTurnRate)
		{
			setHeading(Vec2d(0.0,-1.0));
		}
/**
	this method is used to read the reduced state of the character from the file, into the array passed in as a parameter. The
	state of the character is not modified
*/
void Character::readReducedStateFromFile(char* fName, ReducedCharacterStateArray* state){
	// Update joint order
	if (fName == NULL)
		throwError("cannot write to a file whose name is NULL!");

	int start = state->size();

	FILE* fp = fopen(fName, "r");
	if (fp == NULL)
		throwError("cannot open the file \'%s\' for reading...", fName);

	double temp1, temp2, temp3, temp4;

	char line[100];

	//read the heading first...
	double heading;
	readValidLine(line, fp);
	sscanf(line, "%lf", &heading);
	
	readValidLine(line, fp);
	sscanf(line, "%lf %lf %lf", &temp1, &temp2, &temp3);
	state->push_back(temp1);
	state->push_back(temp2);
	state->push_back(temp3);
	readValidLine(line, fp);
	sscanf(line, "%lf %lf %lf %lf", &temp1, &temp2, &temp3, &temp4);
	state->push_back(temp1);
	state->push_back(temp2);
	state->push_back(temp3);
	state->push_back(temp4);
	readValidLine(line, fp);
	sscanf(line, "%lf %lf %lf", &temp1, &temp2, &temp3);
	state->push_back(temp1);
	state->push_back(temp2);
	state->push_back(temp3);
	readValidLine(line, fp);
	sscanf(line, "%lf %lf %lf", &temp1, &temp2, &temp3);
	state->push_back(temp1);
	state->push_back(temp2);
	state->push_back(temp3);

	for (uint i=0;i<joints.size();i++){
		readValidLine(line, fp);
		sscanf(line, "%lf %lf %lf %lf", &temp1, &temp2, &temp3, &temp4);
		state->push_back(temp1);
		state->push_back(temp2);
		state->push_back(temp3);
		state->push_back(temp4);
		readValidLine(line, fp);
		sscanf(line, "%lf %lf %lf", &temp1, &temp2, &temp3);
		state->push_back(temp1);
		state->push_back(temp2);
		state->push_back(temp3);
	}

	//now set the heading...
	setHeading(Quaternion::getRotationQuaternion(heading, PhysicsGlobals::up), state, start);

	fclose(fp);
}
/**
	this method is used to rotate the character about the vertical axis, so that it's default heading has the value that is given as a parameter
*/
void Character::setHeading(double val){
	ReducedCharacterStateArray state;
	getState(&state);
	setHeading(Quaternion::getRotationQuaternion(val, Vector3d(0,1,0)), &state);
	setState(&state);
}
/**
	this method is used to rotate the character (well, the character whose state is passed in as a parameter) 
	about the vertical axis, so that it's default heading has the value that is given as a parameter
*/
void Character::setHeading(double val, ReducedCharacterStateArray* state, int start){
	setHeading(Quaternion::getRotationQuaternion(val, Vector3d(0,1,0)), state, start);
}
/**
	this method is used to rotate the character about the vertical axis, so that it's default heading has the value that is given as a parameter
*/
void Character::setHeading(Quaternion heading){
	ReducedCharacterStateArray state;
	getState(&state);
	setHeading(heading, &state);
	setState(&state);
}
예제 #27
0
void game_set_player_heading(const ScriptArguments& args)
{
    auto object = args.getPlayerCharacter(0);
	object->setHeading(args[1].real);
}
예제 #28
0
void game_set_object_heading(const ScriptArguments& args)
{
	auto object = args.getObject<Tobject>(0);
	object->setHeading(args[1].real);
}
예제 #29
0
void setupPreferences() {
    auto preferences = DependencyManager::get<Preferences>();
    auto myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
    static const QString AVATAR_BASICS { "Avatar Basics" };
    {
        auto getter = [myAvatar]()->QString { return myAvatar->getDisplayName(); };
        auto setter = [myAvatar](const QString& value) { myAvatar->setDisplayName(value); };
        auto preference = new EditPreference(AVATAR_BASICS, "Avatar display name (optional)", getter, setter);
        preference->setPlaceholderText("Not showing a name");
        preferences->addPreference(preference);
    }

    {
        auto getter = [myAvatar]()->QString { return myAvatar->getCollisionSoundURL(); };
        auto setter = [myAvatar](const QString& value) { myAvatar->setCollisionSoundURL(value); };
        auto preference = new EditPreference(AVATAR_BASICS, "Avatar collision sound URL (optional)", getter, setter);
        preference->setPlaceholderText("Enter the URL of a sound to play when you bump into something");
        preferences->addPreference(preference);
    }

    {
        auto getter = [myAvatar]()->QString { return myAvatar->getFullAvatarURLFromPreferences().toString(); };
        auto setter = [myAvatar](const QString& value) { myAvatar->useFullAvatarURL(value, ""); qApp->clearAvatarOverrideUrl(); };
        auto preference = new AvatarPreference(AVATAR_BASICS, "Appearance", getter, setter);
        preferences->addPreference(preference);
    }

    // Graphics quality
    static const QString GRAPHICS_QUALITY { "Graphics Quality" };
    {
        auto getter = []()->float {
            return DependencyManager::get<LODManager>()->getWorldDetailQuality();
        };

        auto setter = [](float value) {
            DependencyManager::get<LODManager>()->setWorldDetailQuality(value);
        };

        auto wodSlider = new SliderPreference(GRAPHICS_QUALITY, "World Detail", getter, setter);
        wodSlider->setMin(0.25f);
        wodSlider->setMax(0.75f);
        wodSlider->setStep(0.25f);
        preferences->addPreference(wodSlider);

        auto getterShadow = []()->bool {
            auto menu = Menu::getInstance();
            return menu->isOptionChecked(MenuOption::Shadows);
        };
        auto setterShadow = [](bool value) {
            auto menu = Menu::getInstance();
            menu->setIsOptionChecked(MenuOption::Shadows, value);
        };
        preferences->addPreference(new CheckPreference(GRAPHICS_QUALITY, "Show Shadows", getterShadow, setterShadow));
    }

    // UI
    static const QString UI_CATEGORY { "User Interface" };
    {
        auto getter = []()->bool { return qApp->getSettingConstrainToolbarPosition(); };
        auto setter = [](bool value) { qApp->setSettingConstrainToolbarPosition(value); };
        preferences->addPreference(new CheckPreference(UI_CATEGORY, "Constrain Toolbar Position to Horizontal Center", getter, setter));
    }

    {
        auto getter = []()->float { return qApp->getDesktopTabletScale(); };
        auto setter = [](float value) { qApp->setDesktopTabletScale(value); };
        auto preference = new SpinnerPreference(UI_CATEGORY, "Desktop Tablet Scale %", getter, setter);
        preference->setMin(20);
        preference->setMax(500);
        preferences->addPreference(preference);
    }

    {
        auto getter = []()->float { return qApp->getHMDTabletScale(); };
        auto setter = [](float value) { qApp->setHMDTabletScale(value); };
        auto preference = new SpinnerPreference(UI_CATEGORY, "VR Tablet Scale %", getter, setter);
        preference->setMin(20);
        preference->setMax(500);
        preferences->addPreference(preference);
    }

    {
        static const QString RETICLE_ICON_NAME = { Cursor::Manager::getIconName(Cursor::Icon::RETICLE) };
        auto getter = []()->bool { return qApp->getPreferredCursor() == RETICLE_ICON_NAME; };
        auto setter = [](bool value) { qApp->setPreferredCursor(value ? RETICLE_ICON_NAME : QString()); };
        preferences->addPreference(new CheckPreference(UI_CATEGORY, "Use reticle cursor instead of arrow", getter, setter));
    }

    {
        auto getter = []()->bool { return qApp->getMiniTabletEnabled(); };
        auto setter = [](bool value) { qApp->setMiniTabletEnabled(value); };
        preferences->addPreference(new CheckPreference(UI_CATEGORY, "Use mini tablet", getter, setter));
    }

    {
        auto getter = []()->int { return DependencyManager::get<Keyboard>()->getUse3DKeyboard(); };
        auto setter = [](int value) { DependencyManager::get<Keyboard>()->setUse3DKeyboard(value); };
        preferences->addPreference(new CheckPreference(UI_CATEGORY, "Use Virtual Keyboard", getter, setter));
    }

    {
        auto getter = []()->bool { return DependencyManager::get<Keyboard>()->getPreferMalletsOverLasers() ? 1 : 0; };
        auto setter = [](bool value) { return DependencyManager::get<Keyboard>()->setPreferMalletsOverLasers((bool)value); };
        auto preference = new RadioButtonsPreference(UI_CATEGORY, "Keyboard laser / mallets", getter, setter);
        QStringList items;
        items << "Lasers" << "Mallets";
        preference->setItems(items);
        preference->setIndented(true);
        preferences->addPreference(preference);
    }


    {
        auto getter = []()->int { return qApp->getPreferStylusOverLaser() ? 1 : 0; };
        auto setter = [](int value) { qApp->setPreferStylusOverLaser((bool)value); };
        auto preference = new RadioButtonsPreference(UI_CATEGORY, "Tablet stylys / laser", getter, setter);
        QStringList items;
        items << "Lasers" << "Stylus";
        preference->setHeading("Tablet Input Mechanism");
        preference->setItems(items);
        preferences->addPreference(preference);
    }

    static const QString VIEW_CATEGORY{ "View" };
    {
        auto getter = [myAvatar]()->float { return myAvatar->getRealWorldFieldOfView(); };
        auto setter = [myAvatar](float value) { myAvatar->setRealWorldFieldOfView(value); };
        auto preference = new SpinnerPreference(VIEW_CATEGORY, "Real world vertical field of view (angular size of monitor)", getter, setter);
        preference->setMin(1);
        preference->setMax(180);
        preferences->addPreference(preference);
    }
    {
        auto getter = []()->float { return qApp->getFieldOfView(); };
        auto setter = [](float value) { qApp->setFieldOfView(value); };
        auto preference = new SpinnerPreference(VIEW_CATEGORY, "Vertical field of view", getter, setter);
        preference->setMin(1);
        preference->setMax(180);
        preference->setStep(1);
        preferences->addPreference(preference);
    }

    /*
    // FIXME: Remove setting completely or make available through JavaScript API?
    {
        auto getter = []()->bool { return qApp->getPreferAvatarFingerOverStylus(); };
        auto setter = [](bool value) { qApp->setPreferAvatarFingerOverStylus(value); };
        preferences->addPreference(new CheckPreference(UI_CATEGORY, "Prefer Avatar Finger Over Stylus", getter, setter));
        }*/

    // Snapshots
    static const QString SNAPSHOTS { "Snapshots" };
    {
        auto getter = []()->QString { return DependencyManager::get<Snapshot>()->_snapshotsLocation.get(); };
        auto setter = [](const QString& value) { DependencyManager::get<Snapshot>()->_snapshotsLocation.set(value); emit DependencyManager::get<Snapshot>()->snapshotLocationSet(value); };
        auto preference = new BrowsePreference(SNAPSHOTS, "Put my snapshots here", getter, setter);
        preferences->addPreference(preference);
    }
    {
        auto getter = []()->float { return SnapshotAnimated::snapshotAnimatedDuration.get(); };
        auto setter = [](float value) { SnapshotAnimated::snapshotAnimatedDuration.set(value); };
        auto preference = new SpinnerPreference(SNAPSHOTS, "Animated Snapshot Duration", getter, setter);
        preference->setMin(1);
        preference->setMax(5);
        preference->setStep(1);
        preferences->addPreference(preference);
    }

    {
        auto getter = []()->bool { return !Menu::getInstance()->isOptionChecked(MenuOption::DisableActivityLogger); };
        auto setter = [](bool value) { Menu::getInstance()->setIsOptionChecked(MenuOption::DisableActivityLogger, !value); };
        preferences->addPreference(new CheckPreference("Privacy", "Send data - High Fidelity uses information provided by your "
                                "client to improve the product through the logging of errors, tracking of usage patterns, "
                                "installation and system details, and crash events. By allowing High Fidelity to collect "
                                "this information you are helping to improve the product. ", getter, setter));
    }
    
    static const QString AVATAR_TUNING { "Avatar Tuning" };
    {
        auto getter = [myAvatar]()->QString { return myAvatar->getDominantHand(); };
        auto setter = [myAvatar](const QString& value) { myAvatar->setDominantHand(value); };
        preferences->addPreference(new PrimaryHandPreference(AVATAR_TUNING, "Dominant Hand", getter, setter));
    }
    {
        auto getter = [myAvatar]()->float { return myAvatar->getTargetScale(); };
        auto setter = [myAvatar](float value) { myAvatar->setTargetScale(value); };
        auto preference = new SpinnerSliderPreference(AVATAR_TUNING, "Avatar Scale", getter, setter);
        preference->setMin(0.25);
        preference->setMax(4);
        preference->setStep(0.05f);
        preference->setDecimals(2);
        preferences->addPreference(preference);
        
        // When the Interface is first loaded, this section setupPreferences(); is loaded - 
        // causing the myAvatar->getDomainMinScale() and myAvatar->getDomainMaxScale() to get set to incorrect values
        // which can't be changed across domain switches. Having these values loaded up when you load the Dialog each time
        // is a way around this, therefore they're not specified here but in the QML.
    }

    {
        auto getter = [myAvatar]()->QString { return myAvatar->getAnimGraphOverrideUrl().toString(); };
        auto setter = [myAvatar](const QString& value) { myAvatar->setAnimGraphOverrideUrl(QUrl(value)); };
        auto preference = new EditPreference(AVATAR_TUNING, "Avatar animation JSON", getter, setter);
        preference->setPlaceholderText("default");
        preferences->addPreference(preference);
    }

    {
        auto getter = [myAvatar]()->bool { return myAvatar->getCollisionsEnabled(); };
        auto setter = [myAvatar](bool value) { myAvatar->setCollisionsEnabled(value); };
        auto preference = new CheckPreference(AVATAR_TUNING, "Enable Avatar collisions", getter, setter);
        preferences->addPreference(preference);
    }

    static const QString FACE_TRACKING{ "Face Tracking" };
    {
        auto getter = []()->float { return DependencyManager::get<DdeFaceTracker>()->getEyeClosingThreshold(); };
        auto setter = [](float value) { DependencyManager::get<DdeFaceTracker>()->setEyeClosingThreshold(value); };
        preferences->addPreference(new SliderPreference(FACE_TRACKING, "Eye Closing Threshold", getter, setter));
    }
    {
        auto getter = []()->float { return FaceTracker::getEyeDeflection(); };
        auto setter = [](float value) { FaceTracker::setEyeDeflection(value); };
        preferences->addPreference(new SliderPreference(FACE_TRACKING, "Eye Deflection", getter, setter));
    }

    static const QString VR_MOVEMENT{ "VR Movement" };
    {
        auto getter = [myAvatar]()->bool { return myAvatar->getAllowTeleporting(); };
        auto setter = [myAvatar](bool value) { myAvatar->setAllowTeleporting(value); };
        auto preference = new CheckPreference(VR_MOVEMENT, "Teleporting", getter, setter);
        preferences->addPreference(preference);
    }
    {
        auto getter = [myAvatar]()->bool { return myAvatar->useAdvancedMovementControls(); };
        auto setter = [myAvatar](bool value) { myAvatar->setUseAdvancedMovementControls(value); };
        auto preference = new CheckPreference(VR_MOVEMENT, "Walking", getter, setter);
        preferences->addPreference(preference);
    }
    {
        auto getter = [myAvatar]()->bool { return myAvatar->getFlyingHMDPref(); };
        auto setter = [myAvatar](bool value) { myAvatar->setFlyingHMDPref(value); };
        auto preference = new CheckPreference(VR_MOVEMENT, "Jumping and flying", getter, setter);
        preference->setIndented(true);
        preferences->addPreference(preference);
    }
    {
        auto getter = [myAvatar]()->int { return myAvatar->getSnapTurn() ? 0 : 1; };
        auto setter = [myAvatar](int value) { myAvatar->setSnapTurn(value == 0); };
        auto preference = new RadioButtonsPreference(VR_MOVEMENT, "Snap turn / Smooth turn", getter, setter);
        QStringList items;
        items << "Snap turn" << "Smooth turn";
        preference->setHeading("Rotation mode");
        preference->setItems(items);
        preferences->addPreference(preference);
    }
    {
        auto getter = [myAvatar]()->bool { return myAvatar->getShowPlayArea(); };
        auto setter = [myAvatar](bool value) { myAvatar->setShowPlayArea(value); };
        auto preference = new CheckPreference(VR_MOVEMENT, "Show room boundaries while teleporting", getter, setter);
        preferences->addPreference(preference);
    }
    {
        auto getter = [myAvatar]()->int {
            switch (myAvatar->getUserRecenterModel()) {
                case MyAvatar::SitStandModelType::Auto:
                    default:
                    return 0;
                case MyAvatar::SitStandModelType::ForceSit:
                    return 1;
                case MyAvatar::SitStandModelType::ForceStand:
                    return 2;
                case MyAvatar::SitStandModelType::DisableHMDLean:
                    return 3;
            }
        };
        auto setter = [myAvatar](int value) {
            switch (value) {
                case 0:
                default:
                    myAvatar->setUserRecenterModel(MyAvatar::SitStandModelType::Auto);
                    break;
                case 1:
                    myAvatar->setUserRecenterModel(MyAvatar::SitStandModelType::ForceSit);
                    break;
                case 2:
                    myAvatar->setUserRecenterModel(MyAvatar::SitStandModelType::ForceStand);
                    break;
                case 3:
                    myAvatar->setUserRecenterModel(MyAvatar::SitStandModelType::DisableHMDLean);
                    break;
            }
        };
        auto preference = new RadioButtonsPreference(VR_MOVEMENT, "Auto / Force Sit / Force Stand / Disable Recenter", getter, setter);
        QStringList items;
        items << "Auto - turns on avatar leaning when standing in real world" << "Seated - disables all avatar leaning while sitting in real world" << "Standing - enables avatar leaning while sitting in real world" << "Disabled - allows avatar sitting on the floor [Experimental]";
        preference->setHeading("Avatar leaning behavior");
        preference->setItems(items);
        preferences->addPreference(preference);
    }
    {
        auto getter = [=]()->float { return myAvatar->getUserHeight(); };
        auto setter = [=](float value) { myAvatar->setUserHeight(value); };
        auto preference = new SpinnerPreference(VR_MOVEMENT, "User real-world height (meters)", getter, setter);
        preference->setMin(1.0f);
        preference->setMax(2.2f);
        preference->setDecimals(3);
        preference->setStep(0.001f);
        preferences->addPreference(preference);
    }

    static const QString AVATAR_CAMERA{ "Mouse Sensitivity" };
    {
        auto getter = [myAvatar]()->float { return myAvatar->getPitchSpeed(); };
        auto setter = [myAvatar](float value) { myAvatar->setPitchSpeed(value); };
        auto preference = new SpinnerSliderPreference(AVATAR_CAMERA, "Y input:", getter, setter);
        preference->setMin(1.0f);
        preference->setMax(360.0f);
        preference->setStep(1);
        preference->setDecimals(1);
        preferences->addPreference(preference);
    }
    {
        auto getter = [myAvatar]()->float { return myAvatar->getYawSpeed(); };
        auto setter = [myAvatar](float value) { myAvatar->setYawSpeed(value); };
        auto preference = new SpinnerSliderPreference(AVATAR_CAMERA, "X input:", getter, setter);
        preference->setMin(1.0f);
        preference->setMax(360.0f);
        preference->setStep(1);
        preference->setDecimals(1);
        preferences->addPreference(preference);
    }

    static const QString AUDIO_BUFFERS("Audio Buffers");
    {
        auto getter = []()->bool { return !DependencyManager::get<AudioClient>()->getReceivedAudioStream().dynamicJitterBufferEnabled(); };
        auto setter = [](bool value) { DependencyManager::get<AudioClient>()->getReceivedAudioStream().setDynamicJitterBufferEnabled(!value); };
        auto preference = new CheckPreference(AUDIO_BUFFERS, "Disable dynamic jitter buffer", getter, setter);
        preferences->addPreference(preference);
    }
    {
        auto getter = []()->float { return DependencyManager::get<AudioClient>()->getReceivedAudioStream().getStaticJitterBufferFrames(); };
        auto setter = [](float value) { DependencyManager::get<AudioClient>()->getReceivedAudioStream().setStaticJitterBufferFrames(value); };
        auto preference = new SpinnerPreference(AUDIO_BUFFERS, "Static jitter buffer frames", getter, setter);
        preference->setMin(0);
        preference->setMax(2000);
        preference->setStep(1);
        preferences->addPreference(preference);
    }
    {
        auto getter = []()->bool { return !DependencyManager::get<AudioClient>()->getOutputStarveDetectionEnabled(); };
        auto setter = [](bool value) { DependencyManager::get<AudioClient>()->setOutputStarveDetectionEnabled(!value); };
        auto preference = new CheckPreference(AUDIO_BUFFERS, "Disable output starve detection", getter, setter);
        preferences->addPreference(preference);
    }
    {
        auto getter = []()->float { return DependencyManager::get<AudioClient>()->getOutputBufferSize(); };
        auto setter = [](float value) { DependencyManager::get<AudioClient>()->setOutputBufferSize(value); };
        auto preference = new SpinnerPreference(AUDIO_BUFFERS, "Output buffer initial frames", getter, setter);
        preference->setMin(AudioClient::MIN_BUFFER_FRAMES);
        preference->setMax(AudioClient::MAX_BUFFER_FRAMES);
        preference->setStep(1);
        preferences->addPreference(preference);
    }
#if DEV_BUILD || PR_BUILD
    {
        auto getter = []()->bool { return DependencyManager::get<AudioClient>()->isSimulatingJitter(); };
        auto setter = [](bool value) { return DependencyManager::get<AudioClient>()->setIsSimulatingJitter(value); };
        auto preference = new CheckPreference(AUDIO_BUFFERS, "Packet jitter simulator", getter, setter);
        preferences->addPreference(preference);
    }
    {
        auto getter = []()->float { return DependencyManager::get<AudioClient>()->getGateThreshold(); };
        auto setter = [](float value) { return DependencyManager::get<AudioClient>()->setGateThreshold(value); };
        auto preference = new SpinnerPreference(AUDIO_BUFFERS, "Packet throttle threshold", getter, setter);
        preference->setMin(1);
        preference->setMax(200);
        preference->setStep(1);
        preferences->addPreference(preference);
    }
#endif

    {
        static const QString NETWORKING("Networking");

        QWeakPointer<NodeList> nodeListWeak = DependencyManager::get<NodeList>();
        {
            static const int MIN_PORT_NUMBER { 0 };
            static const int MAX_PORT_NUMBER { 65535 };
            auto getter = [nodeListWeak] {
                auto nodeList = nodeListWeak.lock();
                if (nodeList) {
                    return static_cast<int>(nodeList->getSocketLocalPort());
                } else {
                    return -1;
                }
            };
            auto setter = [nodeListWeak](int preset) {
                auto nodeList = nodeListWeak.lock();
                if (nodeList) {
                    nodeList->setSocketLocalPort(static_cast<quint16>(preset));
                }
            };
            auto preference = new IntSpinnerPreference(NETWORKING, "Listening Port", getter, setter);
            preference->setMin(MIN_PORT_NUMBER);
            preference->setMax(MAX_PORT_NUMBER);
            preferences->addPreference(preference);
        }

        {
            auto getter = []()->float { return qApp->getMaxOctreePacketsPerSecond(); };
            auto setter = [](float value) { qApp->setMaxOctreePacketsPerSecond(value); };
            auto preference = new SpinnerPreference(NETWORKING, "Max entities packets sent each second", getter, setter);
            preference->setMin(60);
            preference->setMax(6000);
            preference->setStep(10);
            preferences->addPreference(preference);
        }

    }
}
void PlaneState::updateState(const Basic::Component* const actor)
{
   const Simulation::AirVehicle* airVehicle = dynamic_cast<const Simulation::AirVehicle*>(actor);
   setAlive(false);
   if (airVehicle != nullptr && airVehicle->isActive()) {
      setAltitude(airVehicle->getAltitude());
      setAlive(airVehicle->getMode() == Simulation::Player::ACTIVE);
      setHeading(airVehicle->getHeading());
      setPitch(airVehicle->getPitch());
      setRoll(airVehicle->getRoll());
      osg::Vec3d angularVels = airVehicle->getAngularVelocities();
      setRollRate(angularVels.x());
      setPitchRate(angularVels.y());
      setYawRate(angularVels.z());
      setTracking(false);
      setTargetTrack(MAX_TRACKS);  // 0 is a valid target track, use MAX_TRACKS to
                                   // signal "no tgt track"
      setSpeed(airVehicle->getCalibratedAirspeed());
      setNumEngines(airVehicle->getNumberOfEngines());
      setIncomingMissile(false);
      setMissileFired(false);

      // determine if we have a missile to fire
#if 1
      const Simulation::StoresMgr* stores = airVehicle->getStoresManagement();
      if (stores == nullptr || stores->getNextMissile() == nullptr) {
         // either we have no SMS, or we have no more missile
         setMissileFired(true);
      }
      else {
         // we have an sms, and we have a missile available
         // loop through player list and attempt to find out if one of our missiles is active
         // if there is an active missile, then for the time being, we do not have a missile to fire
         const Simulation::Simulation* sim = airVehicle->getSimulation();
         const Basic::PairStream* players = sim->getPlayers();
         bool finished = false;
         for (const Basic::List::Item* item = players->getFirstItem(); item != nullptr && !finished; item = item->getNext()) {
            // Get the pointer to the target player
            const Basic::Pair* pair = static_cast<const Basic::Pair*>(item->getValue());
            const Simulation::Player* player = static_cast<const Simulation::Player*>(pair->object());
            if (player->isMajorType(Simulation::Player::WEAPON) && (player->isActive() || player->isMode(Simulation::Player::PRE_RELEASE)) && (player->getSide() == airVehicle->getSide())) {
               // our side has a weapon on-the-way/in-the-air;
               setMissileFired(true);
               finished=true;
            }
         }
      }
#else
      // this state class has no way to determine whether we've fired a missile other than checking to see if sms is out of missiles to fire.
      // which means, it will fire all its missiles at first target.
      const Simulation::StoresMgr* stores = airVehicle->getStoresManagement();
      if (stores != 0) {
         const Simulation::Missile* wpn = stores->getNextMissile();
         if (!wpn)
            setMissileFired(true);
      }
      else {
         // we have no SMS, we can't fire a missile;
         setMissileFired(true);
      }
#endif

      //const Basic::String* playerName = airVehicle->getName();
      // DH - DOES NOT COMPILE WITH CONST -- ????
      Simulation::AirVehicle* airVehicleX = const_cast<Simulation::AirVehicle*>(airVehicle);
      const Basic::Pair* sensorPair = airVehicleX->getSensorByType(typeid(Simulation::Radar));

      if (sensorPair != nullptr) {
         const Simulation::Radar* radar = static_cast<const Simulation::Radar*>(sensorPair->object());
         if (radar != nullptr) {
            const Simulation::TrackManager* trackManager = radar->getTrackManager();
            Basic::safe_ptr<Simulation::Track> trackList[50];
            unsigned int nTracks = trackManager->getTrackList(trackList, 50);

            for (int trackIndex = nTracks -1; trackIndex >= 0; trackIndex--) {
               setHeadingToTracked(trackIndex, trackList[trackIndex]->getRelAzimuth());
               setPitchToTracked(trackIndex, trackList[trackIndex]->getElevation());
               setDistanceToTracked(trackIndex, trackList[trackIndex]->getRange());

               // do we have a live "target track"? (shootlist is 1-based)
               if (getTargetTrack()==MAX_TRACKS && (trackList[trackIndex]->getShootListIndex() == 1) && trackList[trackIndex]->getTarget()->isActive()  ) {
                  setTargetTrack(trackIndex);
               }
               setTracking(true);
               setNumTracks(nTracks);

               // hack to implement "missile warning"
               if (isIncomingMissile() == false) {
                  // is this track a weapon, and if so, is it targeting me?
                  Simulation::Player* target = trackList[trackIndex]->getTarget();
                  Simulation::Weapon* weapon = dynamic_cast<Simulation::Weapon*> (target);
                  if (weapon!=nullptr && !weapon->isDead()) {
                     Simulation::Player* wpntgt = weapon->getTargetPlayer();
                     if (wpntgt == airVehicle) {
                        setIncomingMissile(true);
                     }
                  }
               }

            }
         }
      }

      const Simulation::OnboardComputer* oc = airVehicle->getOnboardComputer();
      if (oc != nullptr) {
         const Simulation::TrackManager* rtm = oc->getTrackManagerByType(typeid(Simulation::RwrTrkMgr));
         if(rtm !=nullptr) {
            Basic::safe_ptr<Simulation::Track> trackList[50];
            unsigned int nTracks = rtm->getTrackList(trackList, 50);
            int newTracks = 0;
            for (unsigned int trackIndex = 0; trackIndex < nTracks; trackIndex++) {
               Simulation::Player* target = trackList[trackIndex]->getTarget();
               bool alreadyTracked = false;
               for (unsigned int currTracks = 0; currTracks>getNumTracks(); currTracks++) {
                  // tracks are the same if the associated players are the same
                  if(trackList[currTracks]->getTarget()==target) {
                     alreadyTracked = true;
                     break;
                  }
               }

               if (!alreadyTracked && (getNumTracks() + newTracks) < MAX_TRACKS) {
                  int newTrackIndex = getNumTracks() + newTracks;
                  newTracks++;
                  setHeadingToTracked(newTrackIndex, trackList[trackIndex]->getRelAzimuth());
                  setPitchToTracked(newTrackIndex, trackList[trackIndex]->getElevation());
                  setDistanceToTracked(newTrackIndex, trackList[trackIndex]->getRange());
                  setTracking(true);

                  // update numTracks to new sum of radar + rwr tracks
                  setNumTracks(getNumTracks()+newTracks);
               }

               // do we have a live "target track"? (shootlist is 1-based)
               if (getTargetTrack()==MAX_TRACKS && (trackList[trackIndex]->getShootListIndex() == 1) && trackList[trackIndex]->getTarget()->isActive()  ) {
                  setTargetTrack(trackIndex);
               }

               // hack to implement "missile warning"
               if (isIncomingMissile() == false) {
                  // is this track a weapon, and if so, is it targeting me?
                  Simulation::Weapon* weapon = dynamic_cast<Simulation::Weapon*> (target);
                  if (weapon!=nullptr && !weapon->isDead()) {
                     Simulation::Player* wpntgt = weapon->getTargetPlayer();
                     if (wpntgt == airVehicle) {
                        setIncomingMissile(true);
                     }
                  }
               }

            }
         }
      }
   }
   BaseClass::updateState(actor);
}