void EQPlayer::playerUpdate(const playerUpdateStruct *pupdate, bool client) { if (!client && (pupdate->spawnId != m_playerID)) return; else if (client) setPlayerID(pupdate->spawnId); m_xPos = pupdate->xPos; m_yPos = pupdate->yPos; m_zPos = pupdate->zPos; m_deltaX = pupdate->deltaX; m_deltaY = pupdate->deltaY; m_deltaZ = pupdate->deltaZ; m_heading = 360 - (pupdate->heading * 360) / 256; emit headingChanged(m_heading); emit posChanged(m_xPos, m_yPos, m_zPos, m_deltaX, m_deltaY, m_deltaZ, m_heading); }
void TPreferences::setPlayerBin(QString bin, bool allow_other_player, TPlayerID wanted_player) { // Check binary and try to fix it if (bin.isEmpty()) { if (wanted_player == ID_MPLAYER) { bin = default_mplayer_bin; } else { bin = default_mpv_bin; } } QString found_bin = Helper::findExecutable(bin); // Try to find an alternative if not found if (found_bin.isEmpty()) { TPlayerID found_id = ID_MPLAYER; QFileInfo fi(bin); if (wanted_player == ID_MPV || fi.baseName().startsWith("mpv")) { // Try default mpv first if (bin != default_mpv_bin) { found_bin = Helper::findExecutable(default_mpv_bin); if (!found_bin.isEmpty()) { found_id = ID_MPV; } } if (found_bin.isEmpty()) { if (bin != default_mplayer_bin && (allow_other_player || wanted_player == ID_MPLAYER)) { // Try default mplayer found_bin = Helper::findExecutable(default_mplayer_bin); } } else { found_id = ID_MPV; } } else { // Try default mplayer if (bin != default_mplayer_bin && (allow_other_player || wanted_player == ID_MPLAYER)) { found_bin = Helper::findExecutable(default_mplayer_bin); } if (found_bin.isEmpty() && bin != default_mpv_bin && (allow_other_player || wanted_player == ID_MPV)) { // Try default mpv found_bin = Helper::findExecutable(default_mpv_bin); if (!found_bin.isEmpty()) { found_id = ID_MPV; } } } if (found_bin.isEmpty()) { logger()->warn("setPlayerBin: failed to find player '%1'", bin); } else if (allow_other_player || found_id == wanted_player) { logger()->warn("setPlayerBin: failed to find player '%1'," " selecting '%2' instead", bin, found_bin); bin = found_bin; } else { logger()->warn("setPlayerBin: failed to find player '%1'. Maybe you" " can try '%2' instead.", bin, found_bin); } } else { bin = found_bin; } player_bin = bin; setPlayerID(); // Store player and set drivers for player if (!found_bin.isEmpty()) { if (player_id == ID_MPLAYER) { mplayer_bin = player_bin; vo = mplayer_vo; ao = mplayer_ao; player_additional_options = mplayer_additional_options; } else { mpv_bin = player_bin; vo = mpv_vo; ao = mpv_ao; player_additional_options = mpv_additional_options; } } logger()->info("setPlayerBin: selected player '%1'", bin); logger()->debug("setPlayerBin: mplayer vo '%1' ao '%2' options '%3'", mplayer_vo, mplayer_ao, mplayer_additional_options); logger()->debug("setPlayerBin: mpv vo '%1' ao '%2' options '%3'", mpv_vo, mpv_ao, mpv_additional_options); }
//------------------------------------------------------------------------------ // entityState2Nib() -- (Input support) // Transfers data from the incoming entity attributes to the basic // NIB class variables. //------------------------------------------------------------------------------ void Nib::entityState2Nib() { if (isAttributeUpdateRequired(NetIO::ENTITY_IDENTIFIER_AI)) { setPlayerID(baseEntity->entityIdentifier.entityNumber); setSiteID(baseEntity->entityIdentifier.federateIdentifier.siteID); setApplicationID(baseEntity->entityIdentifier.federateIdentifier.applicationID); setAttributeUpdateRequiredFlag(NetIO::ENTITY_IDENTIFIER_AI, false); haveEntityIdFlg = true; } if (isAttributeUpdateRequired(NetIO::ENTITY_TYPE_AI)) { setEntityType( baseEntity->entityType.entityKind, baseEntity->entityType.domain, baseEntity->entityType.countryCode, baseEntity->entityType.category, baseEntity->entityType.subcategory, baseEntity->entityType.specific, baseEntity->entityType.extra ); setAttributeUpdateRequiredFlag(NetIO::ENTITY_TYPE_AI, false); haveEntityTypeFlg = true; } if (isAttributeUpdateRequired(NetIO::SPATIAL_AI)) { // NIB's base entity structures //SpatialStruct* spatial = &(baseEntity->spatial); SpatialRVStruct* spatialRvw = &(baseEntity->spatialRvw); // Set the freeze flag freeze(spatialRvw->isFrozen != 0); // Get the geocentric position, velocity and acceleration osg::Vec3d geocPos; geocPos[base::Nav::IX] = spatialRvw->worldLocation.x; geocPos[base::Nav::IY] = spatialRvw->worldLocation.y; geocPos[base::Nav::IZ] = spatialRvw->worldLocation.z; osg::Vec3d geocVel; geocVel[base::Nav::IX] = spatialRvw->velocityVector.xVelocity; geocVel[base::Nav::IY] = spatialRvw->velocityVector.yVelocity; geocVel[base::Nav::IZ] = spatialRvw->velocityVector.zVelocity; osg::Vec3d geocAcc; geocAcc[base::Nav::IX] = spatialRvw->accelerationVector.xAcceleration; geocAcc[base::Nav::IY] = spatialRvw->accelerationVector.yAcceleration; geocAcc[base::Nav::IZ] = spatialRvw->accelerationVector.zAcceleration; // Get orientation orientation and rates osg::Vec3d geocAngles; geocAngles[base::Nav::IPHI] = spatialRvw->orientation.phi; geocAngles[base::Nav::ITHETA] = spatialRvw->orientation.theta; geocAngles[base::Nav::IPSI] = spatialRvw->orientation.psi; osg::Vec3d arates(0.0, 0.0, 0.0); // (re)initialize the dead reckoning function double diffTime(0.0); resetDeadReckoning( RVW_DRM, geocPos, geocVel, geocAcc, geocAngles, arates, diffTime); haveWorldLocationFlg = true; haveOrientationFlg = true; setAttributeUpdateRequiredFlag(NetIO::SPATIAL_AI, false); } // PhysicalEntity pointer PhysicalEntity* physicalEntity = dynamic_cast<PhysicalEntity*>(baseEntity); if (physicalEntity != nullptr) { if (isAttributeUpdateRequired(NetIO::FORCE_IDENTIFIER_AI)) { // Side: When mapping Force ID to Player Side ... if (physicalEntity->forceIdentifier == FRIENDLY) { // Friendly's are blue, ... setSide(simulation::Player::BLUE); } else if (physicalEntity->forceIdentifier == OPPOSING) { // opposing side is red, ... setSide(simulation::Player::RED); } else if (physicalEntity->forceIdentifier == NEUTRAL) { // Neutrals are white, ... setSide(simulation::Player::WHITE); } else { // and everyone else is gray. setSide(simulation::Player::GRAY); } setAttributeUpdateRequiredFlag(NetIO::FORCE_IDENTIFIER_AI, false); } } setMode(simulation::Player::ACTIVE); setTimeExec( (double) getNetIO()->getCurrentTime() ); }