Пример #1
0
//
// Create the node for external objects.
//
PointsToNode *PointsToGraph::getOrCreateExternalNode() {
  if (!ExternalNode) {
    Field Collapsed(Field::COLLAPSED);
    ExternalNode = new PointsToNode(0, PointsToNode::EXTERNAL);
    ExternalNode->addEdge(&Collapsed, ExternalNode, &Collapsed);
  }
  return ExternalNode;
}
Пример #2
0
InternetViewContainer::InternetViewContainer(QWidget* parent)
    : QWidget(parent),
      ui_(new Ui_InternetViewContainer),
      app_(nullptr),
      current_service_(nullptr),
      current_header_(nullptr) {
  ui_->setupUi(this);

  connect(ui_->tree, SIGNAL(collapsed(QModelIndex)),
          SLOT(Collapsed(QModelIndex)));
  connect(ui_->tree, SIGNAL(expanded(QModelIndex)),
          SLOT(Expanded(QModelIndex)));
  connect(ui_->tree, SIGNAL(FocusOnFilterSignal(QKeyEvent*)),
          SLOT(FocusOnFilter(QKeyEvent*)));
}
Пример #3
0
//
// Add an edge from a field to the node.
//
void PointsToNode::addEdge(Field *Src, PointsToNode *Node, Field *Dest) {
  Field Collapsed(Field::COLLAPSED);
  Field SourceField, DestField;

  if (AllocSite && !isa<PointerType>(AllocSite->getType()))
    return;
    
  //
  // Determine the source field and destination field based on the kind of
  // node this is.
  //
  if (Kind == TYPE_UNSAFE)
    SourceField = Collapsed;
  else
    SourceField = *Src;

  if (Node->Kind == TYPE_UNSAFE || Node->Kind == EXTERNAL)
    DestField = Collapsed;
  else
    DestField = *Dest;

  Edges[SourceField].insert(NodeFieldPair(Node, DestField));
}
//------------------------------------------------------------------------
void CVehicleMovementWarrior::Update(const float deltaTime)
{
	FUNCTION_PROFILER(GetISystem(), PROFILE_GAME);

	if(!IsCollapsing())
		CVehicleMovementHovercraft::Update(deltaTime);
	else
		CVehicleMovementBase::Update(deltaTime);

	if(IsCollapsing())
	{
		m_collapseTimer += deltaTime;

		// check platform
		Vec3 platformPos;

		if(m_pPlatformPos)
			platformPos = m_pPlatformPos->GetWorldSpaceTranslation();
		else
			platformPos.zero();

		float dist = platformPos.z - gEnv->p3DEngine->GetTerrainElevation(platformPos.x, platformPos.y);

		if(dist < 1.f)
		{
			m_platformDown = true;
		}

		// center turret
		RotatePart(m_pTurret, DEG2RAD(0.f), AXIS_Z, DEG2RAD(2.5f), deltaTime);

		// take down wing and cannon
		RotatePart(m_pWing, DEG2RAD(-12.5f), AXIS_X, DEG2RAD(3.f), deltaTime);
		RotatePart(m_pCannon, DEG2RAD(-20.f), AXIS_X, DEG2RAD(2.5f), deltaTime);

		if(!m_platformDown)
		{
			// handle legs to bring down platform
			TThrusters::iterator iter;

			for(iter=m_vecThrusters.begin(); iter!=m_vecThrusters.end(); ++iter)
			{
				SThruster *pThruster = *iter;

				if(pThruster->heightAdaption <= 0.f)
				{
					pThruster->hoverHeight = max(0.1f, pThruster->hoverHeight - 0.6f*deltaTime);
					continue;
				}
				else
				{
					//if (!pThruster->groundContact)
					//pThruster->hoverHeight = max(0.1f, pThruster->hoverHeight - 0.2f*deltaTime);
				}

				/*
				// special legs control
				float collapseSpeed = DEG2RAD(5.f);
				float maxDistMovable = 1.f/0.8f;

				float dist = (isneg(pThruster->prevDist)) ? 0.f : pThruster->hoverHeight - pThruster->prevDist;

				if (isneg(dist))
				{
				collapseSpeed *= max(0.f, 1.f + maxDistMovable*dist);
				}

				if (collapseSpeed > 0.f)
				{
				float angle = RotatePart(pThruster->pParentPart, DEG2RAD(m_collapsedLegAngle), collapseSpeed, deltaTime);
				RotatePart(pThruster->pPart, DEG2RAD(m_collapsedFeetAngle), collapseSpeed, deltaTime);
				}
				*/
			}
		}
		else
		{
			if(!m_collapsed)
			{
				Collapsed(true);
			}
		}
	}

	if(IsPowered() && !IsCollapsed())
	{
		// "normal" legs control here

		bool bStartComplete = (m_startComplete > 1.5f);
		float adaptionSpeed = IsCollapsing() ? 0.8f : 1.5f;
		int t = 0;

		for(TThrusters::iterator iter=m_vecThrusters.begin(); iter!=m_vecThrusters.end(); ++iter)
		{
			SThruster *pThruster = *iter;
			++t;

			if(pThruster->heightAdaption > 0.f && bStartComplete && pThruster->pPart && pThruster->pParentPart)
			{
				const char *footName = pThruster->pPart->GetName();
				EWarriorMovement mode = eWM_Hovering;
				float correction = 0.f, maxCorrection = 0.f;

				// adjust legs
				float error = 0.f;

				if(!pThruster->hit)
					error = pThruster->hoverHeight; // when not hit, correct downwards
				else if(pThruster->prevDist > 0.f)
					error = pThruster->prevDist - pThruster->hoverHeight;

				if(mode != eWM_None && abs(error) > 0.05f)
				{
					float speed = max(0.1f, min(1.f, abs(error))) * adaptionSpeed;
					correction = -sgn(error) * min(speed*deltaTime, abs(error)); // correct up to error

					// don't correct more than heightAdaption allows
					maxCorrection = abs((pThruster->heightInitial + sgn(correction)*pThruster->heightAdaption) - pThruster->pos.z);
					float minCorrection = (pThruster->groundContact) ? 0.f : -maxCorrection;

					correction = CLAMP(correction, minCorrection, maxCorrection);

					if(abs(correction) > 0.0001f)
					{
						// positive correction for leg, negative for foot
						Matrix34 legLocal  = pThruster->pParentPart->GetLocalBaseTM();
						Matrix34 footLocal = pThruster->pPart->GetLocalBaseTM();

						float radius = footLocal.GetTranslation().len();
						float deltaAngle = correction / radius; // this assumes correction on circle (accurate enough for large radius)

						Matrix34 legTM  = Matrix33(legLocal) * Matrix33::CreateRotationX(deltaAngle);
						Matrix34 footTM = Matrix33(footLocal) * Matrix33::CreateRotationX(-deltaAngle);

						legTM.SetTranslation(legLocal.GetTranslation());
						footTM.SetTranslation(footLocal.GetTranslation());

						pThruster->pParentPart->SetLocalBaseTM(legTM);
						pThruster->pPart->SetLocalBaseTM(footTM);
					}
				}

				if(IsProfilingMovement())
				{
					static ICVar *pDebugLeg = gEnv->pConsole->GetCVar("warrior_debug_leg");

					if(pDebugLeg && pDebugLeg->GetIVal() == t)
					{
						//CryLog("hoverErr %.2f, levelErr %.2f, neutralErr %.2f -> %s corr %.3f (max %.2f)", hoverError, levelError, neutralError, sMode, correction, maxCorrection);
					}
				}
			}
		}
	}

	// regain control
	if(m_collapseTimer > m_recoverTime)
	{
		Collapsed(false);
	}

	for(TThrusters::iterator it=m_vecThrusters.begin(); it!=m_vecThrusters.end(); ++it)
	{
		(*it)->groundContact = false;
	}
}