virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
 {
     switch (event)
     {
     case eFE_Update:
     {
         bool bPaused = GetPortBool(pActInfo,IN_PAUSED);
         if (!bPaused)
         {
             float fSeconds = gEnv->pTimer->GetFrameStartTime().GetSeconds();
             ActivateOutput( pActInfo,OUT_SECONDS,fSeconds );
             ActivateOutput( pActInfo,OUT_TICK,0 );
         }
     }
     break;
     case eFE_Initialize:
     {
         bool bPaused = GetPortBool(pActInfo,IN_PAUSED);
         pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, !bPaused );
         break;
     }
     case eFE_Activate:
         if (IsPortActive(pActInfo,IN_PAUSED))
         {
             bool bPaused = GetPortBool(pActInfo,IN_PAUSED);
             pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, !bPaused );
         }
         break;
     }
 }
Esempio n. 2
0
void CFlowNode_ScreenFader::ProcessActivateEvent(SActivationInfo* activationInformation)
{
	if (InputEntityIsLocalPlayer(activationInformation) == false)
		return;

	if (IsPortActive(activationInformation, eInputPorts_FadeIn))
	{
		const float fadeInTime = GetPortFloat(activationInformation, eInputPorts_FadeInTime);
		const Vec3 fadeColor = GetPortVec3(activationInformation, eInputPorts_FadeColor);
		const string texture = GetPortString(activationInformation, eInputPorts_Texture);
		const bool useCurrentColor = GetPortBool(activationInformation, eInputPorts_UseCurrentColor);
		ColorF color;
		color.Set(fadeColor.x, fadeColor.y, fadeColor.z);
		m_environment.GetGame().FadeInScreen(texture, color, fadeInTime, useCurrentColor);
	}
	else if (IsPortActive(activationInformation, eInputPorts_FadeOut))
	{
		const float fadeOutTime = GetPortFloat(activationInformation, eInputPorts_FadeOutTime);
		const Vec3 fadeColor = GetPortVec3(activationInformation, eInputPorts_FadeColor);
		const string texture = GetPortString(activationInformation, eInputPorts_Texture);
		const bool useCurrentColor = GetPortBool(activationInformation, eInputPorts_UseCurrentColor);
		ColorF color;
		color.Set(fadeColor.x, fadeColor.y, fadeColor.z);
		m_environment.GetGame().FadeOutScreen(texture, color, fadeOutTime, useCurrentColor);	
	}

}
Esempio n. 3
0
	virtual void ProcessEvent( EFlowEvent event,SActivationInfo *pActInfo )
	{
		switch (event)
		{
		case eFE_Initialize:
			{
				m_bResult = 2;
				break;
			}

		case eFE_Activate:
			{
				bool a = GetPortBool(pActInfo,INP_A);
				bool b = GetPortBool(pActInfo,INP_B);
				int result = Execute(a,b)? 1 : 0;
				bool activateOutputs = GetPortBool( pActInfo, INP_Always ) || m_bResult!=result;
				m_bResult = result;
				if (activateOutputs)
				{
					ActivateOutput( pActInfo,0,result );
					if(result)
						ActivateOutput( pActInfo,1,true );
					else
						ActivateOutput( pActInfo,2,true );
				}
			}
		};
	};
Esempio n. 4
0
void CFlashUIActionNode::ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
{
	switch (event)
	{
	case eFE_Initialize:
		m_bWasStarted = false;
		m_startStack.clear();
		m_endStack.clear();
		m_selfEndStack.clear();
		m_startStack.init(pActInfo->pGraph);
		m_endStack.init(pActInfo->pGraph);
		m_selfEndStack.init(pActInfo->pGraph);
		UpdateAction(GetPortString(pActInfo, eI_UIAction).c_str(), GetPortBool(pActInfo, eI_Strict));
		pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID, true);
		break;
	case eFE_Activate:
		UpdateAction(GetPortString(pActInfo, eI_UIAction).c_str(), GetPortBool(pActInfo, eI_Strict));

		if (gEnv->pFlashUI && m_pAction)
		{
			if (IsPortActive(pActInfo, eI_StartAction))
			{
				SUIArguments args(GetPortString(pActInfo, eI_Args).c_str(), true);
				gEnv->pFlashUI->GetUIActionManager()->StartAction(m_pAction, args);
				ActivateOutput(pActInfo, eO_UIOnStart, true);
				m_bWasStarted = true;
			}
		}
		break;
	case eFE_Update:
		FlushNextAction(pActInfo);
		break;
	}
}
Esempio n. 5
0
	//----------------------------------------------------------------------
	void ReadCurrentInputParams( SActivationInfo* pActInfo, SInputParams &inputParams )
	{
		int presetIndex = GetPortInt( pActInfo, EIP_Preset );
		if (presetIndex > 0 && presetIndex <= NUM_PRESETS)
		{
			inputParams       = m_Presets[presetIndex - 1];
			inputParams.angle = Ang3(DEG2RAD(m_Presets[presetIndex - 1].angle));
		}
		else
		{
			inputParams.groundOnly      = GetPortBool(pActInfo, EIP_GroundOnly);
			inputParams.isSmooth        = GetPortBool(pActInfo, EIP_Smooth);
			inputParams.restriction     = eRestriction( GetPortInt(pActInfo, EIP_Restriction));
			inputParams.view            = eViewType( GetPortInt(pActInfo, EIP_ViewType));
			inputParams.angle           = Ang3(DEG2RAD(GetPortVec3(pActInfo, EIP_Angle)));
			inputParams.shift           = GetPortVec3(pActInfo, EIP_Shift);
			inputParams.frequency       = GetPortFloat(pActInfo, EIP_Frequency);
			inputParams.randomness      = GetPortFloat(pActInfo, EIP_Randomness);
			inputParams.distance        = GetPortFloat(pActInfo, EIP_Distance);
			inputParams.rangeMin        = GetPortFloat(pActInfo, EIP_RangeMin);
			inputParams.rangeMax        = GetPortFloat(pActInfo, EIP_RangeMax);
			inputParams.sustainDuration = GetPortFloat(pActInfo, EIP_SustainDuration);
			inputParams.fadeInDuration  = GetPortFloat(pActInfo, EIP_FadeInDuration);
			inputParams.fadeOutDuration = GetPortFloat(pActInfo, EIP_FadeOutDuration);
		}
	}
        virtual void ProcessEvent( EFlowEvent event, SActivationInfo* pActInfo )
        {

            if ( event == eFE_Initialize )
            {
                m_actInfo = *pActInfo;
                active = GetPortBool( pActInfo, 0 );
                pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, true );
            }

            if ( event == eFE_Activate )
            {
                active = GetPortBool( pActInfo, 0 );
            }

            if ( event == eFE_Update  && active )
            {

                int w_id = GetPortInt( pActInfo, 1 );

                if ( w_id < 0 || w_id >= CryVR_WiimoteManagerPlugin::found )
                {
                    return ;
                }


                int i = 0;
                wiimote** manettes =  CryVR_WiimoteManagerPlugin::GetWiimotes();

                //Optimisation v0.1
                wiimote_move = false;
                nunchuk_move = false;


                while ( wiiuse_poll( manettes, CryVR_WiimoteManagerPlugin::found ) && i < GetPortInt( pActInfo, 2 ) )
                {
                    if ( CryVR_WiimoteManagerPlugin::GetWiimotes( w_id )->event == WIIUSE_EVENT )
                    {
                        i++;
                        handle_event( CryVR_WiimoteManagerPlugin::GetWiimotes( w_id ) );
                    }

                    else if ( CryVR_WiimoteManagerPlugin::GetWiimotes( w_id )->event == WIIUSE_NUNCHUK_INSERTED || CryVR_WiimoteManagerPlugin::GetWiimotes( w_id )->event == WIIUSE_NUNCHUK_REMOVED )
                    {
                        CryVR_WiimoteManagerPlugin::Status( w_id );
                    }

                    //Recherche d'optimisation.
                    if ( nunchuk_move && wiimote_move && GetPortBool( pActInfo, 3 ) )
                    {

                        return ;
                    }

                }
            }
        }
	virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
	{
		m_actInfo = *pActInfo;
		switch(event)
		{
			case eFE_Initialize:
			{
				m_bOutputScreenCoords = GetPortBool(pActInfo, EIP_Screen);
				m_bOutputWorldCoords = GetPortBool(pActInfo, EIP_World);
				m_bOutputDeltaCoords = GetPortBool(pActInfo, EIP_DeltaScreen);
				
				break;
			}
			case eFE_Activate:
				{
					if(IsPortActive(pActInfo, EIP_Enable))
					{
						if (gEnv->pHardwareMouse)
							gEnv->pHardwareMouse->AddListener(this);

						if (GetISystem() && GetISystem()->GetIInput())
							GetISystem()->GetIInput()->AddEventListener(this);

						m_bOutputScreenCoords = GetPortBool(pActInfo, EIP_Screen);
						m_bOutputWorldCoords = GetPortBool(pActInfo, EIP_World);
						m_bOutputDeltaCoords = GetPortBool(pActInfo, EIP_DeltaScreen);
						
						m_enabled = true;
					}

					if(IsPortActive(pActInfo, EIP_Disable))
					{
						if (gEnv->pHardwareMouse)
							gEnv->pHardwareMouse->RemoveListener(this);

						if (GetISystem() && GetISystem()->GetIInput())
							GetISystem()->GetIInput()->RemoveEventListener(this);

						m_enabled = false;
					}

					if(IsPortActive(pActInfo, EIP_World))
					{
						m_bOutputWorldCoords = GetPortBool(pActInfo, EIP_World);
					}

					if(IsPortActive(pActInfo, EIP_Screen))
					{
						m_bOutputScreenCoords = GetPortBool(pActInfo, EIP_Screen);
					}

					if(IsPortActive(pActInfo, EIP_DeltaScreen))
					{
						m_bOutputDeltaCoords = GetPortBool(pActInfo, EIP_DeltaScreen);
					}

				break;
			}
		}
	}
	virtual void ProcessEvent(EFlowEvent event, SActivationInfo *pActInfo)
	{

		if(event==eFE_Initialize) {
			m_actInfo = *pActInfo;
			return ;
		}

		if(event==eFE_Activate){
			CryLogAlways(" *** GuitarHero Controler beta version *** ");
			active = GetPortBool(pActInfo, 0);
			
			pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID,true);
			return ;
		}

		if(event== eFE_Update) 
			{
				gh3_move = false;
				int i = 0;
				int w_id = GetPortInt(pActInfo, 1);
				if(!active || w_id < 0 || w_id >= CryVR_WiimoteManager::found) return ;

				
				
				if(CryVR_WiimoteManager::GetMotionSensing(w_id) && CryVR_WiimoteManager::GetWiimotes(w_id)->exp.type == 0){
					was_motion_sensing_active = true;
					CryLogAlways(" *** GuitarHero Controler force Motion Sensing off during connection *** ");
					CryVR_WiimoteManager::SetMotionSensing(w_id,false);
				}

				if(CryVR_WiimoteManager::GetWiimotes(w_id)->exp.type == EXP_CLASSIC && was_motion_sensing_active){
					CryLogAlways(" *** GuitarHero set Motion Sensing previous state *** ");
					//CryVR_WiimoteManager::SetMotionSensing(w_id,true);
					was_motion_sensing_active = false;
					CryVR_WiimoteManager::Status(CryVR_WiimoteManager::GetWiimotes(w_id));
				}
				
				
				/* fait planter la balance board ! */

				while (wiiuse_poll(CryVR_WiimoteManager::GetWiimotes(), CryVR_WiimoteManager::found) && i<GetPortInt(pActInfo, 2)) 
					{	
						if(CryVR_WiimoteManager::GetWiimotes(w_id)->event == WIIUSE_EVENT) {
							handle_event(CryVR_WiimoteManager::GetWiimotes(w_id));
						}

						//Recherche d'optimisation.
						if (GetPortBool(pActInfo, 3)) {
							return ; 
						}
						i++;
					}
			}
	}
Esempio n. 9
0
void CFlashUIConstraintsNode::ProcessEvent( EFlowEvent event,SActivationInfo *pActInfo )
{
    if ( event == eFE_Initialize )
    {
        UpdateUIElement( GetPortString( pActInfo, eI_UIElement ), pActInfo );
    }
    else if ( event == eFE_Activate )
    {
        if ( IsPortActive( pActInfo, eI_UIElement ) )
        {
            UpdateUIElement( GetPortString( pActInfo, eI_UIElement ), pActInfo );
        }

        const int instanceId = GetPortInt( pActInfo, eI_InstanceID );
        if ( IsPortActive( pActInfo, eI_Get ) )
        {
            IUIElement::SUIConstraints constraints;
            SPerInstanceCall1< IUIElement::SUIConstraints& > caller;
            if ( !caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUIConstraintsNode::GetConstraints), constraints, false) )
            {
                UIACTION_WARNING( "FG: UIElement \"%s\" can't get Constraints for multiple instances! (passed instanceId %i), referenced at node \"%s\"", GetPortString(pActInfo, eI_UIElement).c_str() ,instanceId, pActInfo->pGraph->GetNodeTypeName( pActInfo->myID ) );
            }
            ActivateOutput( pActInfo, eO_PosType, (int) constraints.eType );
            ActivateOutput( pActInfo, eO_Left, constraints.iLeft );
            ActivateOutput( pActInfo, eO_Top, constraints.iTop );
            ActivateOutput( pActInfo, eO_Width, constraints.iWidth );
            ActivateOutput( pActInfo, eO_Height, constraints.iHeight );
            ActivateOutput( pActInfo, eO_Scale, constraints.bScale );
            ActivateOutput( pActInfo, eO_HAlign, (int) constraints.eHAlign );
            ActivateOutput( pActInfo, eO_VAlign, (int) constraints.eVAlign );
            ActivateOutput( pActInfo, eO_Maximize, constraints.bMax );
            ActivateOutput( pActInfo, eO_OnGet, true );
        }

        if ( IsPortActive( pActInfo, eI_Set ) )
        {
            IUIElement::SUIConstraints constraints;
            constraints.eType = (IUIElement::SUIConstraints::EPositionType) GetPortInt( pActInfo, eI_PosType );
            constraints.iLeft = GetPortInt( pActInfo, eI_Left );
            constraints.iTop = GetPortInt( pActInfo, eI_Top );
            constraints.iWidth = GetPortInt( pActInfo, eI_Width );
            constraints.iHeight = GetPortInt( pActInfo, eI_Height );
            constraints.eHAlign = (IUIElement::SUIConstraints::EPositionAlign) GetPortInt( pActInfo, eI_HAlign );
            constraints.eVAlign = (IUIElement::SUIConstraints::EPositionAlign) GetPortInt( pActInfo, eI_VAlign );
            constraints.bScale = GetPortBool( pActInfo, eI_Scale );
            constraints.bMax = GetPortBool( pActInfo, eI_Maximize );

            SPerInstanceCall1< const IUIElement::SUIConstraints& > caller;
            caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUIConstraintsNode::SetConstraints), constraints);

            ActivateOutput( pActInfo, eO_OnSet, true );
        }
    }
}
Esempio n. 10
0
	virtual void ProcessEvent(EFlowEvent event, SActivationInfo *pActInfo)
	{
		switch (event)
		{
			case eFE_Activate:
			{
				if (IsPortActive(pActInfo, EIP_Start))
				{
					m_List.clear();
					m_ListIter = m_List.end();
					m_Iter = 0;
					m_Count = 0;

					OnIterStart(pActInfo);
					m_ListIter = m_List.begin();

					if (m_Count <= 0)
					{
						// None found
						ActivateOutput(pActInfo, EOP_Done, 0);
					}
					else
					{
						const bool bImmediate = GetPortBool(pActInfo, EIP_Immediate);
						const bool bFirstResult = SendNext(pActInfo);
						if (bImmediate && bFirstResult)
						{
							pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID, true);
						}
					}
				}
				else if (IsPortActive(pActInfo, EIP_Next))
				{
					const bool bImmediate = GetPortBool(pActInfo, EIP_Immediate);
					if (!bImmediate)
					{
						SendNext(pActInfo);
					}
				}
			}
			break;

			case eFE_Update:
			{
				if (!SendNext(pActInfo))
				{
					pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID, false);
				}

			}
			break;
		}
	}
Esempio n. 11
0
	virtual void ProcessEvent( EFlowEvent event,SActivationInfo* pActInfo )
	{
		CCamera camera(gEnv->pSystem->GetViewCamera());
		Vec3    pos(camera.GetPosition());
		Vec3    dir(camera.GetViewdir());
		float   roll(camera.GetAngles().z); // GetAngles() returns YPR angles - roll is in z component

		switch (event)
		{
		case eFE_Initialize:
			pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, GetPortBool(pActInfo, 3));
			break;
		case eFE_Activate:
		{
			if (InputEntityIsLocalPlayer( pActInfo ))
			{
				if (IsPortActive(pActInfo, 0))
					pos = GetPortVec3(pActInfo, 0);
				if (IsPortActive(pActInfo, 1))
					dir = GetPortVec3(pActInfo, 1);
				if (IsPortActive(pActInfo, 2))
					roll = GetPortFloat(pActInfo, 2);

				if (IsPortActive(pActInfo, 3))
				{
					pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, GetPortBool(pActInfo, 3));
				}

				if (dir.len2() > 0.0f)
				{
					dir.Normalize();
					camera.SetMatrix(CCamera::CreateOrientationYPR(CCamera::CreateAnglesYPR(dir, roll)));
					camera.SetPosition(pos);
					gEnv->pSystem->SetViewCamera(camera);
				}
			}
		}
		break;
		case eFE_Update:
		{
			if (InputEntityIsLocalPlayer( pActInfo ))
			{
				ActivateOutput(pActInfo, 0, pos);
				ActivateOutput(pActInfo, 1, dir);
				ActivateOutput(pActInfo, 2, roll);
			}
		}
		break;
		}
	}
Esempio n. 12
0
	virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
	{
		switch (event)
		{
		case eFE_Initialize:
			pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, true );
			m_Activated = false;
			break;

		case eFE_Update:
			{
				bool bReset = GetPortBool(pActInfo, IN_RESET);
				bool bCondition = GetPortBool(pActInfo, IN_CONDITION);

				if(bReset)
				{
					ActivateOutput(pActInfo, OUT_SLEEPING, !bCondition);
				} else
				{
					if(bCondition != m_Activated)
					{
						IEntity * pEntity = pActInfo->pEntity;

						if (pEntity)
						{
							IPhysicalEntity * pPhysEntity = pEntity->GetPhysics();

							if (pPhysEntity)
							{
								pe_status_awake psa;

								bool isSleeping = pPhysEntity->GetStatus( &psa ) ? false : true;

								ActivateOutput(pActInfo, OUT_SLEEPING, isSleeping);

								if(isSleeping)
									ActivateOutput(pActInfo, OUT_ONSLEEP, true);
								else
									ActivateOutput(pActInfo, OUT_ONAWAKE, true);
							}
						}

						m_Activated = bCondition;
					}
				}
			}
		}
	}
Esempio n. 13
0
	void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
	{
		switch (event)
		{
			case eFE_Initialize:
			{
				UpdateListenerStatus( pActInfo );
				m_actInfo = *pActInfo;
				m_lastColourPortTriggered = NOPORT;
				break;
			}

			case eFE_Activate:
			{
				if (IsPortActive(pActInfo, INP_ENABLED))
				{
					UpdateListenerStatus( pActInfo );
					bool enabled = GetPortBool( pActInfo, INP_ENABLED );
					if (enabled)
						UpdateOutputs( g_pGame->GetGameAISystem()->GetAIAwarenessToPlayerHelper().GetIntAwareness() );
				}
				break;
			}
		}
	}
Esempio n. 14
0
void CFlashUIScreenPosNode::ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
{
    if ( event == eFE_Initialize )
    {
        UpdateUIElement( GetPortString( pActInfo, eI_UIElement ), pActInfo );
    }
    else if ( event == eFE_Activate )
    {
        if ( IsPortActive( pActInfo, eI_UIElement ) )
        {
            UpdateUIElement( GetPortString( pActInfo, eI_UIElement ), pActInfo );
        }

        if ( IsPortActive( pActInfo, eI_Get ) )
        {
            const int instanceId = GetPortInt(pActInfo, eI_InstanceID);
            float px = GetPortFloat(pActInfo, eI_PX);
            float py = GetPortFloat(pActInfo, eI_PY);
            const bool scaleMode = GetPortBool(pActInfo, eI_ScaleMode);

            SPerInstanceCall3< float&, float&, bool > caller;
            if ( !caller.Execute(GetElement(), instanceId, functor(*this, &CFlashUIScreenPosNode::GetScreenPos), px, py, scaleMode, false) )
            {
                UIACTION_WARNING( "FG: UIElement \"%s\" called get screenpos for multiple instances! (passed instanceId %i), referenced at node \"%s\"", GetPortString(pActInfo, eI_UIElement).c_str(), instanceId, pActInfo->pGraph->GetNodeTypeName( pActInfo->myID ) );
            }

            ActivateOutput( pActInfo, eO_OnGet, true );
            ActivateOutput(pActInfo, eO_PX, px);
            ActivateOutput(pActInfo, eO_PY, py);
        }
    }
}
Esempio n. 15
0
	virtual void ProcessEvent(EFlowEvent event, SActivationInfo *pActInfo)
	{
		switch (event)
		{
		case eFE_Activate:
			{
				IEntity* pEntity = pActInfo->pEntity;
				if(!pEntity)
					return;

				m_delayResult = GetPortBool(pActInfo, EIP_DelayResult);

				if(IsPortActive(pActInfo, EIP_Enable))
				{
					m_actInfo = *pActInfo;
					m_entityId = pEntity->GetId();
					SetEnabled(true);
				}
				else if(IsPortActive(pActInfo, EIP_Disable))
				{
					SetEnabled(false);
				}
				break;
			}
		}
	}
Esempio n. 16
0
	virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
	{
		switch (event)
		{
		case eFE_Initialize:
			pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, true );
			break;
		case eFE_Update:
			{
				if(!GetPortBool(pActInfo, 0))
					return;

				IEntity * pEntity = pActInfo->pEntity;
				if (pEntity)
				{
					IPhysicalEntity * pPhysEntity = pEntity->GetPhysics();
					if (pPhysEntity)
					{
						pe_status_dynamics dyn;
						pPhysEntity->GetStatus( &dyn );
						ActivateOutput(pActInfo, 0, dyn.v);
						ActivateOutput(pActInfo, 1, dyn.a);
						ActivateOutput(pActInfo, 2, dyn.w);
						ActivateOutput(pActInfo, 3, dyn.wa);
						ActivateOutput(pActInfo, 4, dyn.mass);
					}
				}
			}
		}
	}
	void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
	{
		switch (event)
		{
		case eFE_Activate:
			if (IsPortActive(pActInfo,eIP_Get))
			{
				ITimeOfDay* pTOD = gEnv->p3DEngine->GetTimeOfDay();
				if (pTOD)
				{
					ActivateOutput(pActInfo, eOP_Latitude, pTOD->GetSunLatitude());
					ActivateOutput(pActInfo, eOP_Longitude, pTOD->GetSunLongitude());
				}
			}
			if (IsPortActive(pActInfo, eIP_Set))
			{
				ITimeOfDay* pTOD = gEnv->p3DEngine->GetTimeOfDay();
				if (pTOD)
				{
					float latitude = GetPortFloat(pActInfo, eIP_Latitude);
					float longitude = GetPortFloat(pActInfo, eIP_Longitude);

					pTOD->SetSunPos( longitude, latitude );
					bool forceUpdate = GetPortBool( pActInfo, eIP_ForceUpdate );
					pTOD->Update(true, forceUpdate);
					
					ActivateOutput(pActInfo, eOP_Latitude, latitude);
					ActivateOutput(pActInfo, eOP_Longitude, longitude);
				}
			}
			break;
		}
	}
Esempio n. 18
0
void CFlashUIWorldScreenPosNode::ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
{
    if ( event == eFE_Initialize )
    {
        UpdateUIElement( GetPortString( pActInfo, eI_UIElement ), pActInfo );
    }
    else if ( event == eFE_Activate )
    {
        if ( IsPortActive( pActInfo, eI_UIElement ) )
        {
            UpdateUIElement( GetPortString( pActInfo, eI_UIElement ), pActInfo );
        }

        if ( IsPortActive( pActInfo, eI_Get ) )
        {
            const int instanceId = GetPortInt(pActInfo, eI_InstanceID);
            Vec3 worldPos = GetPortVec3(pActInfo, eI_WorldPos);
            Vec3 offset = GetPortVec3(pActInfo, eI_Offset);
            const bool scaleMode = GetPortBool(pActInfo, eI_ScaleMode);

            SPerInstanceCall3< Vec3&, Vec3&, bool > caller;
            if ( !caller.Execute(GetElement(), instanceId, functor(*this, &CFlashUIWorldScreenPosNode::GetScreenPosFromWorld), worldPos, offset, scaleMode, false) )
            {
                UIACTION_WARNING( "FG: UIElement \"%s\" called get screenpos for multiple instances! (passed instanceId %i), referenced at node \"%s\"", GetPortString(pActInfo, eI_UIElement).c_str(), instanceId, pActInfo->pGraph->GetNodeTypeName( pActInfo->myID ) );
            }

            ActivateOutput( pActInfo, eO_ScreenPos, worldPos);
            ActivateOutput( pActInfo, eO_Scale, offset.z);
            ActivateOutput( pActInfo, eO_IsOnScreen, offset.x == 0 && offset.y == 0);
            offset.z = 0;
            ActivateOutput( pActInfo, eO_OverScanBorder, offset);
            ActivateOutput( pActInfo, eO_OnGet, true );
        }
    }
}
Esempio n. 19
0
	virtual void ProcessEvent(EFlowEvent event, SActivationInfo *pActInfo)
	{
		

		int butt= 0;

		switch (event)
		{
		case eFE_Initialize:
			{
				vrpn_analog = (vrpn_ANALOGCB *) malloc(sizeof(vrpn_ANALOGCB)*2);
				vrpn_analog_remote = new vrpn_Analog_Remote(GetPortString(pActInfo, 1));
				vrpn_analog_remote->register_change_handler(vrpn_analog,handle_analog_wii);
			
				vrpn_buttons = (vrpn_BUTTONCB *) malloc(sizeof(vrpn_BUTTONCB)*2);
				vrpn_buttons_remote = new vrpn_Button_Remote(GetPortString(pActInfo, 1));
				vrpn_buttons_remote->register_change_handler(vrpn_buttons,handle_button_change_wii);
			}
			break;
		case eFE_Activate:
			{
				if ( IsPortActive( pActInfo, ACTIVE ) ){
					active = GetPortBool( pActInfo, ACTIVE);
					pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID,true);
				}
				
			}
			break;
		
		case eFE_Update:
			{	
				if (!active) return ;

				if (vrpn_analog_remote){
					vrpn_analog_remote->mainloop();
					float angleJoystick = (float)vrpn_analog->channel[19];
					float intensityJoystick = (float)vrpn_analog->channel[20];

					if (intensityJoystick != 0) {
						ActivateOutput(pActInfo, WII_NUN_INTENSITY,intensityJoystick);
						ActivateOutput(pActInfo, WII_NUN_ANGLE,angleJoystick);
					}

					float gravity_x = (float)vrpn_analog->channel[1];
					float gravity_y = (float)vrpn_analog->channel[2];
					float gravity_z = (float)vrpn_analog->channel[3];

					ActivateOutput(pActInfo, WII_WIIMOTE_GRAVITY_X,gravity_x);
					ActivateOutput(pActInfo, WII_WIIMOTE_GRAVITY_Y,gravity_y);
					ActivateOutput(pActInfo, WII_WIIMOTE_GRAVITY_Z,gravity_z);
					
				}	

				if(vrpn_buttons_remote){
					vrpn_buttons_remote->mainloop();
					ActivateOutput(pActInfo,(int)vrpn_buttons->button, (int)vrpn_buttons->state);
				}
			}
		}
	}
	void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
	{
		if (event == eFE_Activate || event == eFE_Initialize)
		{
			if (IsPortActive(pActInfo, INP_ACTIVE))
			{
				bool active = GetPortBool(pActInfo, 0);
				if (active)
					m_pGF->GetIItemSystem()->RegisterListener(this);
				else
					m_pGF->GetIItemSystem()->UnregisterListener(this);
			}
			if (IsPortActive(pActInfo, INP_CHECK))
			{
				IActor* pActor = GetInputActor( pActInfo );
				if (pActor)
				{
					IInventory* pInventory = pActor->GetInventory();
					if (pInventory)
					{
						IEntity* pEntityItem = gEnv->pEntitySystem->GetEntity( pInventory->GetCurrentItem() );
						TriggerOutputs( pActInfo, pEntityItem );
					}
				}
			}
		}
	}
Assignment CombatMoveAssignmentFlowNode::SpecifyAssignment( SActivationInfo* pActInfo )
{
	SmartScriptTable data(gEnv->pScriptSystem);
	data->SetValue("position", GetPortVec3(pActInfo, InputPort_Position));
	data->SetValue("useCover", GetPortBool(pActInfo, InputPort_UseCover));
	return Assignment(Assignment::CombatMove, data);
}
Esempio n. 22
0
bool CGameFlowBaseNode::IsBoolPortActive( SActivationInfo *pActInfo,int nPort ) const
{
	if (IsPortActive(pActInfo,nPort) && GetPortBool(pActInfo,nPort))
		return true;
	else
		return false;
}
Esempio n. 23
0
	virtual void ProcessEvent(EFlowEvent event, SActivationInfo *pActInfo)
	{	
		switch (event)
		{
		case eFE_Initialize:
			{
				oef = new OneEuroFilter ();
			
			}
			break;
		case eFE_Activate:
			{
				if ( IsPortActive( pActInfo, ACTIVE ) ){
					active = GetPortBool( pActInfo, ACTIVE);
					pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID,true);
				}
			}
			break;
		
		case eFE_Update:
			{
				if(!active) return;

				oef->increaseTimeStamp(1.0/oef->getFrequence());
				float valeur =  GetPortFloat(pActInfo, IN_Value);
				float filtered = (float)oef->filter(valeur) ;
				ActivateOutput(pActInfo, OUT_Value,filtered);
			}
		}
	}
	void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
	{
		switch (event)
		{
		case eFE_Activate:
			if (IsPortActive(pActInfo,eIP_Get))
			{
				Vec3 v;
				gEnv->p3DEngine->GetGlobalParameter(E3DPARAM_SKY_MOONROTATION, v);
				ActivateOutput(pActInfo, eOP_Latitude, v.x);
				ActivateOutput(pActInfo, eOP_Longitude, v.y);
			}
			if (IsPortActive(pActInfo, eIP_Set))
			{
				Vec3 v(ZERO);
				v.x = GetPortFloat(pActInfo, eIP_Latitude);
				v.y = GetPortFloat(pActInfo, eIP_Longitude);
				gEnv->p3DEngine->SetGlobalParameter(E3DPARAM_SKY_MOONROTATION, v);
				ActivateOutput(pActInfo, eOP_Latitude, v.x);
				ActivateOutput(pActInfo, eOP_Longitude, v.y);
				bool forceUpdate = GetPortBool( pActInfo, eIP_ForceUpdate );
				ITimeOfDay* pTOD = gEnv->p3DEngine->GetTimeOfDay();
				if (forceUpdate && pTOD )
					pTOD->Update( true, true );
			}
		}
	}
Esempio n. 25
0
	virtual void ProcessEvent(EFlowEvent event, SActivationInfo *pActInfo)
	{
		switch(event)
		{
		case eFE_Activate:
			CGameRules *pGR = g_pGame->GetGameRules();

			if(!pGR)
				return;

			if(!pActInfo->pEntity)
				return;

			const bool bUseVapor = GetPortBool(pActInfo, EIP_Vapor);

			if(IsPortActive(pActInfo, EIP_Freeze))
			{
				pGR->FreezeEntity(pActInfo->pEntity->GetId(), true, bUseVapor, true);
				ActivateOutput(pActInfo, EOP_Frozen, true);
			}
			else if(IsPortActive(pActInfo, EIP_UnFreeze))
			{
				pGR->FreezeEntity(pActInfo->pEntity->GetId(), false, bUseVapor);
				ActivateOutput(pActInfo, EOP_UnFrozen, true);
			}

			break;
		}
	}
void CFlowNode_AISequenceAction_WeaponHolster::HandleSequenceEvent(AIActionSequence::SequenceEvent sequenceEvent)
{
	switch(sequenceEvent)
	{
	case AIActionSequence::StartAction:
		{
			CRY_ASSERT_MESSAGE(m_actInfo.pEntity, "entity has magically gone");
			if (!m_actInfo.pEntity)
			{
				// the entity has gone for some reason, at least make sure the action gets finished properly and the FG continues
				CancelSequenceAndActivateOutputPort(OutputPort_Done);
				return;
			}

			assert(gEnv && gEnv->pGame && gEnv->pGame->GetIGameFramework() && gEnv->pGame->GetIGameFramework()->GetIActorSystem());
			IActor* pActor = gEnv->pGame->GetIGameFramework()->GetIActorSystem()->GetActor(m_actInfo.pEntity->GetId());
			if (!pActor)
			{
				CRY_ASSERT_MESSAGE(0, "Provided entity must be an IActor");
				CryWarning(VALIDATOR_MODULE_AI, VALIDATOR_WARNING, "Provided entity %s must be an IActor", m_actInfo.pEntity->GetName());
				CancelSequenceAndActivateOutputPort(OutputPort_Done);
				return;
			}

			const bool skipHolsterAnimation = GetPortBool(&m_actInfo, InputPort_SkipHolsterAnimation);
			pActor->HolsterItem(true, !skipHolsterAnimation);
			FinishSequenceActionAndActivateOutputPort(OutputPort_Done);
		}
		break;
	}
}
Esempio n. 27
0
	virtual bool Execute(SActivationInfo *pActInfo)
	{
		bool bResult = false;

		SXmlDocument *doc;
		if (GDM->GetXmlDocument(pActInfo->pGraph, &doc) && doc->active)
		{
			char const* name = GetPortString(pActInfo, EIP_Name);
			XmlNodeRef ref = doc->active->findChild(name);
			if (ref)
			{
				doc->active = ref;
				bResult = true;
			}
			else if (GetPortBool(pActInfo, EIP_Create))
			{
				ref = doc->active->newChild(name);
				if (ref)
				{
					doc->active = ref;
					bResult = true;
				}
			}
		}

		return bResult;
	}
Esempio n. 28
0
// ---------------------------------------------------------------
void CFlashUIBaseNodeDynPorts::GetDynInput( SUIArguments &args, const SUIParameterDesc &desc, SActivationInfo* pActInfo, int port)
{
	switch (desc.eType)
	{
	case SUIParameterDesc::eUIPT_Bool:
		args.AddArgument( GetPortBool(pActInfo, port));
		break;
	case SUIParameterDesc::eUIPT_Int:
		args.AddArgument( GetPortInt(pActInfo, port));
		break;
	case SUIParameterDesc::eUIPT_Float:
		args.AddArgument( GetPortFloat(pActInfo, port));
		break;
	case SUIParameterDesc::eUIPT_String:
		args.AddArgument( GetPortString(pActInfo, port));
		break;
	case SUIParameterDesc::eUIPT_WString:
		args.AddArgument( GetPortString(pActInfo, port), eUIDT_WString );
		break;
	case SUIParameterDesc::eUIPT_Vec3:
		args.AddArgument( GetPortVec3(pActInfo, port));
		break;
	default:
	{
		string               val;
		const TFlowInputData data = GetPortAny(pActInfo, port);
		data.GetValueWithConversion(val);
		args.AddArgument(val, eUIDT_Any);
	}
	break;
	}
}
Esempio n. 29
0
	virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
	{
		switch (event)
		{
		case eFE_Activate:
			{
				IEntity* pEntity = pActInfo->pEntity;
				if (pEntity != 0)
				{
					ENanoMode nanoMode = NANOMODE_LAST;
					if (IsPortActive(pActInfo, EIP_Cloak))
						nanoMode = NANOMODE_CLOAK;
					else if (IsPortActive(pActInfo, EIP_Speed))
						nanoMode = NANOMODE_SPEED;
					else if (IsPortActive(pActInfo, EIP_Strength))
						nanoMode = NANOMODE_STRENGTH;
					else if (IsPortActive(pActInfo, EIP_Defense))
						nanoMode = NANOMODE_DEFENSE;
					if (nanoMode != NANOMODE_LAST)
					{
						const bool bAsian = GetPortBool(pActInfo, EIP_Asian);
						CNanoSuit::SNanoMaterial* pNanoMat = CNanoSuit::GetNanoMaterial(nanoMode, bAsian);
						if (pNanoMat)
						{
							CNanoSuit::AssignNanoMaterialToEntity(pEntity, pNanoMat);
							ActivateOutput(pActInfo, EOP_Done, true);
						}
					}
				}
			}
			break;
		}
	}
    virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
    {
        switch (event)
        {
        case eFE_Initialize:
        {
            bool bPaused = GetPortBool(pActInfo,IN_PAUSED);
            pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, !bPaused );
            m_last = gEnv->pTimer->GetFrameStartTime();
        }
        break;

        case eFE_Update:
        {
            if (GetPortBool(pActInfo,IN_PAUSED))
                return;

            float fPeriod = GetPortFloat(pActInfo,IN_PERIOD);
            CTimeValue time = gEnv->pTimer->GetFrameStartTime();
            CTimeValue dt = time - m_last;
            if (dt.GetSeconds() >= fPeriod)
            {
                m_last = time;
                int nMin = GetPortInt(pActInfo,IN_MIN);
                int nMax = GetPortInt(pActInfo,IN_MAX);
                m_nCurrentCount++;
                if (m_nCurrentCount < nMin)
                    m_nCurrentCount = nMin;
                if (m_nCurrentCount > nMax)
                {
                    m_nCurrentCount = nMin;
                }
                ActivateOutput( pActInfo,OUT_OUT,m_nCurrentCount );
            }
        }
        break;
        case eFE_Activate:
        {
            if (IsPortActive(pActInfo,IN_PAUSED))
            {
                bool bPaused = GetPortBool(pActInfo,IN_PAUSED);
                pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, !bPaused );
            }
        }
        break;
        }
    }