//-------------------------------------------------------------------------------------------------------
	static void Register_IPipelineSystem( IScriptSystem& sys )
	{
		{
			ClassRegister sc;
			sc.ClassType( &IPipelineSystem::RTTI() );

			sys.RegisterClass(sc);
		}
		ClassRegister sc;
		sc.ClassType( &PipelineProperty::RTTI() );
		sc.ClassConstant( PipelineProperty::PT_LIGHTING_AMBIENT, "PT_LIGHTING_AMBIENT" );
		sc.ClassConstant( PipelineProperty::PT_LIGHTING_DIRECTION, "PT_LIGHTING_DIRECTION" );
		sc.ClassConstant( PipelineProperty::PT_LIGHTING_POINT, "PT_LIGHTING_POINT" );
		sc.ClassConstant( PipelineProperty::PT_LIGHTING_SPOT, "PT_LIGHTING_SPOT" );
		sc.ClassConstant( PipelineProperty::PT_UNIVERSAL_DEPTH, "PT_UNIVERSAL_DEPTH" );
		sc.ClassConstant( PipelineProperty::PT_UNIVERSAL_NORMAL, "PT_UNIVERSAL_NORMAL" );
		sc.ClassConstant( PipelineProperty::PT_UNIVERSAL_DECAL, "PT_UNIVERSAL_DECAL" );
		sc.ClassConstant( PipelineProperty::PT_UNIVERSAL_MULTI_RENDER_TARGET, "PT_UNIVERSAL_MULTI_RENDER_TARGET" );
		sc.ClassConstant( PipelineProperty::PT_UNIVERSAL_POST_EFFECT, "PT_UNIVERSAL_POST_EFFECT" );

		sc.ClassConstant( PipelineProperty::LT_AMBIENT, "LT_AMBIENT" );
		sc.ClassConstant( PipelineProperty::LT_DIRECTIONAL, "LT_DIRECTIONAL" );
		sc.ClassConstant( PipelineProperty::LT_POINT, "LT_POINT" );
		sc.ClassConstant( PipelineProperty::LT_SPOT, "LT_SPOT" );
		sys.RegisterClass(sc);
	}
bool CCustomReactionFunctions::CallCustomExecutionFunction(ScriptTablePtr hitDeathReactionsTable, CActor& actor, const SReactionParams& reactionParams, const HitInfo& hitInfo) const
{
	CRY_ASSERT(!reactionParams.sCustomExecutionFunc.empty());

	bool bSuccess = false;

	// try LUA first. This is so overriding C++ functions can be easily done on LUA, without the need to recompile or to change 
	// the name of the LUA methods in both reactionParams and script code
	HSCRIPTFUNCTION executionFunc = NULL;
	if (hitDeathReactionsTable->GetValue(reactionParams.sCustomExecutionFunc.c_str(), executionFunc))
	{
		IScriptSystem* pScriptSystem = hitDeathReactionsTable->GetScriptSystem();
		bSuccess = Script::Call(pScriptSystem, executionFunc, hitDeathReactionsTable, reactionParams.reactionScriptTable);
		pScriptSystem->ReleaseFunc(executionFunc);
	}

	// Try C++ now
	if (!bSuccess)
	{
		// C++ custom execution
		ExecutionFncContainer::const_iterator itFind = m_executionFunctors.find(reactionParams.sCustomExecutionFunc);
		if (itFind != m_executionFunctors.end())
		{
			// [*DavidR | 21/Oct/2010] C++ custom functions have the advantage of receiving a reference to the hitinfo, LUA methods can get the "lastHit" so we
			// avoid the expensive construction of the hitInfo table
			itFind->second(actor, reactionParams, hitInfo);
			bSuccess = true;
		}
		else
			CHitDeathReactionsSystem::Warning("Couldn't find custom execution function (%s)", reactionParams.sCustomExecutionFunc.c_str());
	}

	return bSuccess;
}
Example #3
0
bool CScriptRMI::SerializeScript( TSerialize ser, IEntity * pEntity )
{
	SSerializeFunctionParams p( ser, pEntity );
	ScriptHandle hdl( &p );
	IScriptTable * pTable = pEntity->GetScriptTable();
	if (pTable)
	{
		SmartScriptTable serTable;
		SmartScriptTable synchedTable;
		pTable->GetValue( "synched", synchedTable );
		if (synchedTable.GetPtr())
		{
			synchedTable->GetValue( HIDDEN_FIELD, serTable );
			if (serTable.GetPtr())
			{
				IScriptSystem * pScriptSystem = pTable->GetScriptSystem();
				pScriptSystem->BeginCall( serTable.GetPtr(), SERIALIZE_FUNCTION );
				pScriptSystem->PushFuncParam( serTable );
				pScriptSystem->PushFuncParam( hdl );
				return pScriptSystem->EndCall();
			}
		}
	}
	return true;
}
Example #4
0
	//-------------------------------------------------------------------------------------------------------
	void FunctionRegister::Result( const IScriptSystem& sys, const Rtti* rtti )
	{
		ASSERT(NULL==m_pResult);
		m_pResult = rtti;
		m_pResultGetter = sys.GetScriptResultValueFunction( rtti );
		m_pResultPusher = sys.GetScriptResultPushFunction( rtti );
		_CaculateID();
	}
Example #5
0
	//-------------------------------------------------------------------------------------------------------
	void FunctionRegister::Arguments( const IScriptSystem& sys, const Rtti* rtti1, const Rtti* rtti2, const Rtti* rtti3 )
	{
		ASSERT( 0 == m_ArgumentRttis.size() );
		m_ArgumentRttis.push_back(rtti1);
		m_ArgumentRttis.push_back(rtti2);
		m_ArgumentRttis.push_back(rtti3);
		m_ArgumentGetter.push_back( sys.GetScriptArgumentFunction( rtti1 ) );
		m_ArgumentGetter.push_back( sys.GetScriptArgumentFunction( rtti2 ) );
		m_ArgumentGetter.push_back( sys.GetScriptArgumentFunction( rtti3 ) );
		_CaculateID();
	}
Example #6
0
void CCinematicInput::ClearCutSceneScriptVariables()
{
	IScriptSystem* pScriptSystem = gEnv->pScriptSystem;
	if (pScriptSystem)
	{
		pScriptSystem->SetGlobalValue("Cinematic_RumbleA", 0.0f);
		pScriptSystem->SetGlobalValue("Cinematic_RumbleB", 0.0f);

		pScriptSystem->SetGlobalValue("Cinematic_CameraLookUp", 0.0f);
		pScriptSystem->SetGlobalValue("Cinematic_CameraLookDown", 0.0f);
		pScriptSystem->SetGlobalValue("Cinematic_CameraLookLeft", 0.0f);
		pScriptSystem->SetGlobalValue("Cinematic_CameraLookRight", 0.0f);
	}
}
//------------------------------------------------------------------------
void CGameRulesHoldObjectiveBase::CleanUpEntity(SHoldEntityDetails *pDetails)
{
	CCCPOINT(HoldObjective_CleanUpActiveCaptureEntity);

	if (pDetails->m_localPlayerIsWithinRange)
	{		
		CHUDEventDispatcher::CallEvent(SHUDEvent(eHUDEvent_OnSiteAboutToExplode));
	}

	OnRemoveHoldEntity(pDetails);

	gEnv->pEntitySystem->RemoveEntityEventListener(pDetails->m_id, ENTITY_EVENT_ENTERAREA, this);
	gEnv->pEntitySystem->RemoveEntityEventListener(pDetails->m_id, ENTITY_EVENT_LEAVEAREA, this);

	if (m_spawnPOIType == eSPT_Avoid)
	{
		IGameRulesSpawningModule *pSpawningModule = g_pGame->GetGameRules()->GetSpawningModule();
		if (pSpawningModule)
		{
			pSpawningModule->RemovePOI(pDetails->m_id);
		}
	}

	IEntity *pEntity = gEnv->pEntitySystem->GetEntity(pDetails->m_id);
	if (pEntity)
	{
		IScriptTable *pScript = pEntity->GetScriptTable();
		if (pScript != NULL && pScript->GetValueType("DeactivateCapturePoint") == svtFunction)
		{
			IScriptSystem *pScriptSystem = gEnv->pScriptSystem;
			pScriptSystem->BeginCall(pScript, "DeactivateCapturePoint");
			pScriptSystem->PushFuncParam(pScript);
			pScriptSystem->PushFuncParam(true);
			pScriptSystem->EndCall();
		}

		CGameRules *pGameRules = g_pGame->GetGameRules();
		EGameMode gamemode = pGameRules->GetGameMode();
		if (gamemode == eGM_CrashSite)
		{
			Announce("Destruct", k_announceType_CS_Destruct);
		}
	}

	pDetails->Reset();

	// Fade out effect
	m_effectData.alphaLerp.Set(1.0f,0.0f,0.0f);
}
Example #8
0
ScriptAnyValue CTweakMetadataLUA::GetLuaValue(void) const {
	IScriptSystem *scripts = gEnv->pScriptSystem;
	//ScriptAnyValue failed("Value unrecognised");
	ScriptAnyValue result;

	// Fetch as a variable
	if (GetLuaVarRecursive(m_sVariable.c_str(), result)) {
		
		// Is this actually a function? If so call it
		if (result.type == ANY_TFUNCTION) {
				scripts->BeginCall(result.function);
				scripts->EndCallAny(result);
		} 
	}
	return result;
}
	//-------------------------------------------------------------------------------------------------------
	static void Register_IResourceSystem( IScriptSystem& sys )
	{
		ClassRegister sc;
		sc.ClassType( &IResourceSystem::RTTI() );

		sys.RegisterClass(sc);
	}
Example #10
0
bool CTweakMetadataLUA::ChangeValue(bool bIncrement) const {
	IScriptSystem *scripts = gEnv->pScriptSystem;

	if (!bIncrement && m_decrementer) {
		// A decrement function has been provided 

		scripts->BeginCall(m_decrementer);
		//m_pSystem->GetIScriptSystem()->PushFuncParam(maxAlertness); // Give it state
		scripts->EndCall();

	} else if (bIncrement && m_incrementer) {
		// An increment function has been provided 

		scripts->BeginCall(m_incrementer);
		//m_pSystem->GetIScriptSystem()->PushFuncParam(maxAlertness); // Give it state
		scripts->EndCall();

	}	else {

		// Simple variable - get, (in|de)crement and set

		// Decide delta
		double fDelta = m_fDelta;
		if (!bIncrement) fDelta *= -1.0;

		// Change variable based on type
		ScriptAnyValue value = GetLuaValue();
		ScriptAnyType type = value.type;
		switch (type) {
			case ANY_TNUMBER:
				value.number += fDelta;
				break;
			case ANY_TBOOLEAN:
				value.b ^= true;
				break;
			default:
				// Type not handled
				return false;
		}

		// Set the variable
		SetLuaVarRecursive(m_sVariable.c_str(), value);
	}

	return true;
}
//------------------------------------------------------------------------
void CGameRulesKingOfTheHillObjective::OnChangedTeam( EntityId entityId, int oldTeamId, int newTeamId )
{
	BaseType::OnChangedTeam(entityId, oldTeamId, newTeamId);

	if ((g_pGame->GetIGameFramework()->GetClientActorId() == entityId) && newTeamId)
	{
		// Local player has changed teams, reset icons
		int currActiveIndex = -1;
		for (int i = 0; i < HOLD_OBJECTIVE_MAX_ENTITIES; ++ i)
		{
			SHoldEntityDetails *pDetails = &m_entities[i];
			if (pDetails->m_id)
			{
				SKotHEntity *pKotHEntity = static_cast<SKotHEntity *>(pDetails->m_pAdditionalData);
				CRY_ASSERT(pKotHEntity);

				pKotHEntity->m_needsIconUpdate = true;

				++currActiveIndex;
				if (pDetails->m_controllingTeamId == 1 || pDetails->m_controllingTeamId == 2)
				{
					CRY_TODO( 23,03,2010, "HUD: OnSiteCaptured events are being sent multiple times from multiple places. /FH");
					SHUDEvent siteIsCaptured(eHUDEvent_OnSiteCaptured);
					siteIsCaptured.eventIntData = currActiveIndex;
					siteIsCaptured.eventIntData2 = pDetails->m_controllingTeamId;
					CHUDEventDispatcher::CallEvent(siteIsCaptured);
				}

				IEntity *pEntity = gEnv->pEntitySystem->GetEntity(pDetails->m_id);
				if (pEntity)
				{
					IScriptTable *pScript = pEntity->GetScriptTable();
					if (pScript && pScript->GetValueType("LocalPlayerChangedTeam") == svtFunction)
					{
						IScriptSystem *pScriptSystem = gEnv->pScriptSystem;
						pScriptSystem->BeginCall(pScript, "LocalPlayerChangedTeam");
						pScriptSystem->PushFuncParam(pScript);
						pScriptSystem->EndCall();
					}
				}
			}
		}
	}
}
Example #12
0
void CScriptRMI::OnPostInitClient( uint16 channelId, IEntity * pEntity )
{
	SmartScriptTable server;
	SmartScriptTable entity = pEntity->GetScriptTable();

	if (!entity.GetPtr())
		return;

	if (!entity->GetValue( "Server", server ) || !server.GetPtr())
		return;

	IScriptSystem * pSystem = entity->GetScriptSystem();
	if ((server->GetValueType( "OnPostInitClient" ) == svtFunction) &&
		pSystem->BeginCall( server, "OnPostInitClient" ))
	{
		pSystem->PushFuncParam( entity );
		pSystem->PushFuncParam( channelId );
		pSystem->EndCall();
	}
}
void CCheckpointSystem::OnCheckpointLoaded(SCheckpointData metaData)
{
	IEntity *pCheckpoint = gEnv->pEntitySystem->GetEntity(metaData.m_checkPointId);
	if(pCheckpoint)
	{
		//Trigger OnLoad
		IScriptTable *pScript = pCheckpoint->GetScriptTable();
		if (pScript)
		{
			HSCRIPTFUNCTION hScriptFunc(NULL);
			pScript->GetValue("Event_OnLoadCheckpoint", hScriptFunc);

			if (hScriptFunc) //this will trigger the flowgraph output
			{
				IScriptSystem *pIScriptSystem = gEnv->pScriptSystem;
				Script::Call(pIScriptSystem,hScriptFunc,pScript);
				pIScriptSystem->ReleaseFunc(hScriptFunc);
			}
		}
	}
}
Example #14
0
	//-------------------------------------------------------------------------------------------------------
	void FunctionRegister::Arguments( const IScriptSystem& sys, const Rtti* rtti1, const Rtti* rtti2, const Rtti* rtti3, const Rtti* rtti4, const Rtti* rtti5, const Rtti* rtti6, const Rtti* rtti7, const Rtti* rtti8, const Rtti* rtti9, const Rtti* rtti10, const Rtti* rtti11 )
	{
		ASSERT( 0 == m_ArgumentRttis.size() );
		m_ArgumentRttis.push_back(rtti1);
		m_ArgumentRttis.push_back(rtti2);
		m_ArgumentRttis.push_back(rtti3);
		m_ArgumentRttis.push_back(rtti4);
		m_ArgumentRttis.push_back(rtti5);
		m_ArgumentRttis.push_back(rtti6);
		m_ArgumentRttis.push_back(rtti7);
		m_ArgumentRttis.push_back(rtti8);
		m_ArgumentRttis.push_back(rtti9);
		m_ArgumentRttis.push_back(rtti10);
		m_ArgumentRttis.push_back(rtti11);
		m_ArgumentGetter.push_back( sys.GetScriptArgumentFunction( rtti1 ) );
		m_ArgumentGetter.push_back( sys.GetScriptArgumentFunction( rtti2 ) );
		m_ArgumentGetter.push_back( sys.GetScriptArgumentFunction( rtti3 ) );
		m_ArgumentGetter.push_back( sys.GetScriptArgumentFunction( rtti4 ) );
		m_ArgumentGetter.push_back( sys.GetScriptArgumentFunction( rtti5 ) );
		m_ArgumentGetter.push_back( sys.GetScriptArgumentFunction( rtti6 ) );
		m_ArgumentGetter.push_back( sys.GetScriptArgumentFunction( rtti7 ) );
		m_ArgumentGetter.push_back( sys.GetScriptArgumentFunction( rtti8 ) );
		m_ArgumentGetter.push_back( sys.GetScriptArgumentFunction( rtti9 ) );
		m_ArgumentGetter.push_back( sys.GetScriptArgumentFunction( rtti10 ) );
		m_ArgumentGetter.push_back( sys.GetScriptArgumentFunction( rtti11 ) );
		_CaculateID();
	}
	virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
	{
		switch (event)
		{
		case eFE_Activate:
			if (IsPortActive(pActInfo, INP_TRIGGER))
			{
				IEntity* pEntity = pActInfo->pEntity;
				if (pEntity)
				{ 
					int damage = GetPortInt(pActInfo, INP_DAMAGE);
					if (damage==0)
					{
						int damageRelative = GetPortInt( pActInfo, INP_RELATIVEDAMAGE );
						if (IScriptTable* pScriptTable = pEntity->GetScriptTable())
						{
							IScriptSystem* pSS = pScriptTable->GetScriptSystem();
							if (pScriptTable->GetValueType("GetMaxHealth") == svtFunction &&	pSS->BeginCall(pScriptTable, "GetMaxHealth"))
							{
								pSS->PushFuncParam(pScriptTable);
								ScriptAnyValue result;
								if (pSS->EndCallAny( result ))
								{
									int maxHealth = 0;
									if (result.CopyTo( maxHealth ))
									{
										damage = ( damageRelative * maxHealth ) / 100;
									}
								}
							}
						}
					}
					
					SendFlowHitToEntity( pEntity->GetId(), pEntity->GetId(), damage, GetPortVec3(pActInfo, INP_POSITION) );
				}
			}
			break;
		}
	}
Example #16
0
	//-------------------------------------------------------------------------------------------------------
	static void Register_IPostHandle( IScriptSystem& sys )
	{
		ClassRegister sc;
		sc.ClassType( &IPostHandle::RTTI(), &IBaseHandle::RTTI() );

		{
			FunctionRegister sf;
			sf.Result( sys, &String::RTTI() );
			sf.Function( &BohgeEngine::IPostHandle_GetResult, "GetResult" );
			sc.ClassFunction( sf );
		}

		{
			FunctionRegister sf;
			sf.Arguments( sys, &String::RTTI(), &String::RTTI() );
			sf.Function( &BohgeEngine::IPostHandle_SetPostContent, "SetPostContent" );
			sc.ClassFunction( sf );
		}

		sys.RegisterClass(sc);
	}
void CCinematicInput::ClearCutSceneVariables()
{
	IScriptSystem* pScriptSystem = gEnv->pScriptSystem;
	if (pScriptSystem)
	{
		pScriptSystem->SetGlobalValue("Cinematic_RumbleA", 0.0f);
		pScriptSystem->SetGlobalValue("Cinematic_RumbleB", 0.0f);

		pScriptSystem->SetGlobalValue("Cinematic_CameraLookUp", 0.0f);
		pScriptSystem->SetGlobalValue("Cinematic_CameraLookDown", 0.0f);
		pScriptSystem->SetGlobalValue("Cinematic_CameraLookLeft", 0.0f);
		pScriptSystem->SetGlobalValue("Cinematic_CameraLookRight", 0.0f);

		pScriptSystem->SetGlobalValue("Cinematic_CameraDoNotCenter", 0.0f);
	}

#if CINEMATIC_INPUT_PC_MOUSE
	m_mouseAccumulatedAngles.Set(0.0f, 0.0f, 0.0f);
	m_mouseAccumulatedInput.Set(0.0f, 0.0f, 0.0f);
	m_lastUpdateWithMouse = false;
#endif

	m_controllerAccumulatedAngles.Set(0.0f, 0.0f, 0.0f);
}
//------------------------------------------------------------------------
void CGameRulesHoldObjectiveBase::DoAddEntityId(int type, EntityId entityId, int index, bool isNewEntity)
{
	CRY_ASSERT(index < HOLD_OBJECTIVE_MAX_ENTITIES);
	CryLog("CGameRulesHoldObjectiveBase::DoAddEntityId() received objective, eid=%i, index=%i", entityId, index);

	SHoldEntityDetails *pDetails = &m_entities[index];

	pDetails->m_id = entityId;

	if (m_spawnPOIType == eSPT_Avoid)
	{
		IGameRulesSpawningModule *pSpawningModule = g_pGame->GetGameRules()->GetSpawningModule();
		if (pSpawningModule)
		{
			pSpawningModule->AddAvoidPOI(entityId, m_spawnPOIDistance, true, AreObjectivesStatic());
		}
	}

	OnNewHoldEntity(pDetails, index);
	CCCPOINT(HoldObjective_AddEntity);

	gEnv->pEntitySystem->AddEntityEventListener(entityId, ENTITY_EVENT_ENTERAREA, this);
	gEnv->pEntitySystem->AddEntityEventListener(entityId, ENTITY_EVENT_LEAVEAREA, this);

	if (gEnv->bServer)
	{
		CHANGED_NETWORK_STATE(g_pGame->GetGameRules(), HOLD_OBJECTIVE_STATE_ASPECT);
	}

	if(isNewEntity)
	{
		//Not playing for the first time because it clashes with game start
		Announce("Incoming", k_announceType_CS_Incoming, m_shouldPlayIncomingAudio);
		m_shouldPlayIncomingAudio = true;
	}

	IEntity *pEntity = gEnv->pEntitySystem->GetEntity(entityId);
	if (pEntity)
	{
		IScriptTable *pScript = pEntity->GetScriptTable();
		CRY_TODO(11, 02, 2009, "function name from xml?");
		if (pScript)
		{
			if (pScript->GetValueType("ActivateCapturePoint") == svtFunction)
			{
				if (isNewEntity)
				{
					// Set flag to say we're expecting a trackview to start - so we can set the start position in the callback
					m_bExpectingMovieStart = true;

					if (!m_bAddedMovieListener)
					{
						if (gEnv->pMovieSystem)
						{
							CryLog("CGameRulesHoldObjectiveBase::CGameRulesHoldObjectiveBase() adding movie listener");
							gEnv->pMovieSystem->AddMovieListener(NULL, this);
							m_bAddedMovieListener = true;
						}
					}
				}

				IScriptSystem *pScriptSystem = gEnv->pScriptSystem;
				pScriptSystem->BeginCall(pScript, "ActivateCapturePoint");
				pScriptSystem->PushFuncParam(pScript);
				pScriptSystem->PushFuncParam(isNewEntity);
				pScriptSystem->EndCall();
			}
			SmartScriptTable propertiesTable;
			if (pScript->GetValue("Properties", propertiesTable))
			{
				pDetails->m_controlRadius = 5.f;
				propertiesTable->GetValue("ControlRadius", pDetails->m_controlRadius);
				pDetails->m_controlRadiusSqr = (pDetails->m_controlRadius * pDetails->m_controlRadius);
				pDetails->m_controlHeight = 5.f;
				propertiesTable->GetValue("ControlHeight", pDetails->m_controlHeight);
				pDetails->m_controlOffsetZ = 0.f;
				propertiesTable->GetValue("ControlOffsetZ", pDetails->m_controlOffsetZ);
			}
		}

		const IActor *pLocalPlayer = g_pGame->GetIGameFramework()->GetClientActor();
		if (pLocalPlayer != NULL && IsActorEligible(pLocalPlayer))
		{
			CheckLocalPlayerInside(pDetails, pEntity, pLocalPlayer->GetEntity());
		}
	}
}
void SendFlowHitToEntity( EntityId targetId, EntityId shooterId, int damage, const Vec3& pos )
{
	if (IEntity* pGameRules = CCryAction::GetCryAction()->GetIGameRulesSystem()->GetCurrentGameRulesEntity())
	{
		if (IScriptTable* pGameRulesScript = pGameRules->GetScriptTable())
		{
			IScriptSystem* pSS = pGameRulesScript->GetScriptSystem();
			if (pGameRulesScript->GetValueType("CreateHit") == svtFunction &&
				pSS->BeginCall(pGameRulesScript, "CreateHit"))
			{
				pSS->PushFuncParam(pGameRulesScript);
				pSS->PushFuncParam(ScriptHandle(targetId));
				pSS->PushFuncParam(ScriptHandle(shooterId));
				pSS->PushFuncParam(ScriptHandle(0)); // weapon
				pSS->PushFuncParam(damage);
				pSS->PushFuncParam(0);  // radius
				pSS->PushFuncParam(""); // material
				pSS->PushFuncParam(0); // partID
				pSS->PushFuncParam("normal");  // type
				pSS->PushFuncParam(pos);
				pSS->PushFuncParam(FORWARD_DIRECTION);  // dir
				pSS->PushFuncParam(FORWARD_DIRECTION); // normal
				pSS->EndCall();
			}
		}
	}
}
bool CScriptSurfaceTypesLoader::LoadSurfaceTypes( const char *sFolder,bool bReload )
{
	{
		if (!gEnv->p3DEngine)
			return false;

		I3DEngine *pEngine = gEnv->p3DEngine;
		ISurfaceTypeEnumerator *pEnum = pEngine->GetMaterialManager()->GetSurfaceTypeManager()->GetEnumerator();
		if (pEnum)
		{
			for (ISurfaceType *pSurfaceType = pEnum->GetFirst(); pSurfaceType; pSurfaceType = pEnum->GetNext())
			{
				SmartScriptTable mtlTable(gEnv->pScriptSystem);
				gEnv->pScriptSystem->SetGlobalValue( pSurfaceType->GetName(),mtlTable );

				SmartScriptTable aiTable(gEnv->pScriptSystem);
				mtlTable->SetValue("AI",aiTable);
				aiTable->SetValue( "fImpactRadius",5.0f );
				aiTable->SetValue( "fFootStepRadius",15.0f );
				aiTable->SetValue( "proneMult",0.2f );
				aiTable->SetValue( "crouchMult",0.5f );
				aiTable->SetValue( "movingMult",2.5f );
			}

			pEnum->Release();
		}
	}

	return true; // Do not load surface types from script anymore.

	m_root = GetISystem()->CreateXmlNode("SurfaceTypes");

	IScriptSystem *pScriptSystem = gEnv->pScriptSystem;
	//////////////////////////////////////////////////////////////////////////
	// Make sure Materials table exist.
	//////////////////////////////////////////////////////////////////////////
	SmartScriptTable mtlTable;

	if (!pScriptSystem->GetGlobalValue("Materials", mtlTable) || bReload)
	{
		mtlTable = pScriptSystem->CreateTable();
		pScriptSystem->SetGlobalValue("Materials", mtlTable);
	}

	ICryPak *pIPak = gEnv->pCryPak;

	ISurfaceTypeManager *pSurfaceManager = gEnv->p3DEngine->GetMaterialManager()->GetSurfaceTypeManager();

	if (!bReload)
		stl::push_back_unique( m_folders,sFolder );

	string searchFolder = string(sFolder) + "/";;
	string searchFilter = searchFolder + "mat_*.lua";

	gEnv->pScriptSystem->ExecuteFile(searchFolder+"common.lua", false, bReload);

	_finddata_t fd;
	intptr_t fhandle;
	fhandle = pIPak->FindFirst( searchFilter,&fd );
	if (fhandle != -1)
	{
		do {
			// Skip back folders.
			if (fd.attrib & _A_SUBDIR) // skip if directory.
				continue;

			char name[_MAX_PATH];
			_splitpath( fd.name,NULL,NULL,name,NULL );

			if (strlen(name) == 0)
				continue;

			if (bReload)
			{
				ISurfaceType *pSurfaceType = pSurfaceManager->GetSurfaceTypeByName(name);
				if (pSurfaceType)
				{
					pSurfaceType->Load( pSurfaceType->GetId() );
					continue;
				}
			}

			ISurfaceType *pSurfaceType = new CScriptSurfaceType( this,name,searchFolder+fd.name,0 );
			if (pSurfaceManager->RegisterSurfaceType( pSurfaceType ))
				m_surfaceTypes.push_back(pSurfaceType);
			else
				pSurfaceType->Release();
		} while (pIPak->FindNext( fhandle,&fd ) == 0);
		pIPak->FindClose(fhandle);
	}

	if (m_root)
	{
		m_root->saveToFile( "SurfaceTypes.xml" );
	}

	return true;
}
bool CScriptSurfaceType::Load( int nId )
{
	m_nId = nId;
	IScriptSystem *pScriptSystem = gEnv->pScriptSystem;

	SmartScriptTable mtlTable;

	if (!pScriptSystem->GetGlobalValue("Materials", mtlTable))
	{
		return false;
	}

	//////////////////////////////////////////////////////////////////////////
	if (!pScriptSystem->ExecuteFile( m_script,true ))
	{
		GetISystem()->Warning(
			VALIDATOR_MODULE_3DENGINE,VALIDATOR_WARNING,
			VALIDATOR_FLAG_FILE|VALIDATOR_FLAG_SCRIPT,
			m_script.c_str(),
			"'%s' failed to load surface type definition script",m_name.c_str() );
		return false;
	}

	if (!mtlTable->GetValue( m_name,m_pScriptTable ))
		return false;

	XmlNodeRef matNode = m_root->newChild("SurfaceType");
	matNode->setAttr( "name",m_name );

	// Load physics params.
	SmartScriptTable pPhysicsTable,props;
	float fBouncyness = 0.0f;
	float fFriction = 1.0f;
	int		iPiercingResistence = sf_max_pierceable;	// physics traces range 0-15
	int   imatBreakable = -1, bManuallyBreakable=0;
	m_iBreakability=0; m_nHitpoints=0; m_breakEnergy=0;
	if (m_pScriptTable->GetValue("physics",pPhysicsTable))
	{
		pPhysicsTable->GetValue("friction",fFriction);
		pPhysicsTable->GetValue("bouncyness",fBouncyness);
		pPhysicsTable->GetValue("breakable_id",imatBreakable);
		if (pPhysicsTable->GetValue("pierceability",iPiercingResistence))
		{
			if(iPiercingResistence>sf_max_pierceable)
				iPiercingResistence = sf_max_pierceable;
		}
		int nBreakable2d = 0;
		int bNoCollide = 0;
		pPhysicsTable->GetValue("no_collide", bNoCollide);
		if (pPhysicsTable->GetValue("break_energy",m_breakEnergy))
		{
			bManuallyBreakable = sf_manually_breakable;
			m_iBreakability = 2;
			pPhysicsTable->GetValue("hit_points",m_nHitpoints);
		} else if (m_pScriptTable->GetValue("breakable_2d",props))
		{
			nBreakable2d = 1;
			bManuallyBreakable = sf_manually_breakable;
			m_iBreakability = 1;
			props->GetValue("break_energy",m_breakEnergy);
			props->GetValue("hit_points",m_nHitpoints);
		}

		m_nFlags &= ~SURFACE_TYPE_NO_COLLIDE;
		if (bNoCollide)
			m_nFlags |= SURFACE_TYPE_NO_COLLIDE;

		XmlNodeRef physNode = matNode->newChild("Physics");
		physNode->setAttr( "friction",fFriction );
		physNode->setAttr( "elasticity",fBouncyness );
		physNode->setAttr( "breakable_id",imatBreakable );
		physNode->setAttr( "pierceability",iPiercingResistence );
		physNode->setAttr( "no_collide",bNoCollide );
		physNode->setAttr( "break_energy",m_breakEnergy );
		physNode->setAttr( "hit_points",m_nHitpoints );
		physNode->setAttr( "breakable_2d",nBreakable2d );
	}

	SmartScriptTable pAITable;
	if (m_pScriptTable->GetValue("AI",pAITable))
	{
		XmlNodeRef aiNode = matNode->newChild("AI");
		float fImpactRadius = 1;
		float fFootStepRadius = 1;
		float proneMult = 1;
		float crouchMult = 1;
		float movingMult = 1;
		pAITable->GetValue( "fImpactRadius",fImpactRadius );
		pAITable->GetValue( "fFootStepRadius",fFootStepRadius );
		pAITable->GetValue( "proneMult",proneMult );
		pAITable->GetValue( "crouchMult",crouchMult );
		pAITable->GetValue( "movingMult",movingMult );

		aiNode->setAttr( "fImpactRadius",fImpactRadius );
		aiNode->setAttr( "fFootStepRadius",fFootStepRadius );
		aiNode->setAttr( "proneMult",proneMult );
		aiNode->setAttr( "crouchMult",crouchMult );
		aiNode->setAttr( "movingMult",movingMult );
	}
	gEnv->pPhysicalWorld->SetSurfaceParameters(m_nId,fBouncyness,fFriction,
		(uint32)(sf_pierceability(iPiercingResistence) | sf_matbreakable(imatBreakable) | bManuallyBreakable));


	return true;
}
Example #22
0
//////////////////////////////////////////////////////////////////////////
// Set event targets from the XmlNode exported by Editor.
void CScriptProxy::SetEventTargets( XmlNodeRef &eventTargetsNode )
{
	std::set<string>                sourceEvents;
	std::vector<SEntityEventTarget> eventTargets;

	IScriptSystem* pSS = GetIScriptSystem();

	for (int i = 0; i < eventTargetsNode->getChildCount(); i++)
	{
		XmlNodeRef eventNode = eventTargetsNode->getChild(i);

		SEntityEventTarget et;
		et.event = eventNode->getAttr("Event");
		if (!eventNode->getAttr("Target", et.target))
			et.target = 0; // failed reading...
		et.sourceEvent = eventNode->getAttr("SourceEvent");

		if (et.event.empty() || !et.target || et.sourceEvent.empty())
			continue;

		eventTargets.push_back(et);
		sourceEvents.insert(et.sourceEvent);
	}
	if (eventTargets.empty())
		return;

	SmartScriptTable pEventsTable;

	if (!m_pThis->GetValue( "Events",pEventsTable ))
	{
		pEventsTable = pSS->CreateTable();
		// assign events table to the entity self script table.
		m_pThis->SetValue( "Events",pEventsTable );
	}

	for (std::set<string>::iterator it = sourceEvents.begin(); it != sourceEvents.end(); ++it)
	{
		SmartScriptTable pTrgEvents(pSS);

		string sourceEvent = *it;

		pEventsTable->SetValue( sourceEvent.c_str(),pTrgEvents );

		// Put target events to table.
		int trgEventIndex = 1;
		for (size_t i = 0; i < eventTargets.size(); i++)
		{
			SEntityEventTarget &et = eventTargets[i];
			if (et.sourceEvent == sourceEvent)
			{
				SmartScriptTable pTrgEvent(pSS);

				pTrgEvents->SetAt( trgEventIndex,pTrgEvent );
				trgEventIndex++;
				ScriptHandle hdl;
				hdl.n = et.target;
				pTrgEvent->SetAt( 1, hdl);
				pTrgEvent->SetAt( 2,et.event.c_str());
			}
		}
	}
}
Example #23
0
// build a script dispatch table - this table is the metatable for all
// dispatch proxy tables used (onClient, allClients, otherClients)
bool CScriptRMI::BuildDispatchTable( 
	SmartScriptTable methods, 
	SmartScriptTable classMethodTable, 
	SmartScriptTable cls, 
	const char * name )
{
	IScriptSystem * pSS = methods->GetScriptSystem();
	SmartScriptTable dispatch( pSS );

	uint8 funcID = 0;

	IScriptTable::SUserFunctionDesc fd;
	SFunctionInfo info;

	IScriptTable::Iterator iter = methods->BeginIteration();
	while (methods->MoveNext(iter))
	{
		if (iter.sKey)
		{
			const char * function = iter.sKey;

			if (strlen(function)>=2 && function[0] == '_' && function[1] == '_')
			{
				methods->EndIteration(iter);
				pSS->RaiseError( "In Net.Expose: can't expose functions beginning with '__' (function was %s)",
					function );
				return false;
			}

			SmartScriptTable specTable;
			if (!methods->GetValue(function, specTable))
			{
				methods->EndIteration(iter);
				pSS->RaiseError( "In Net.Expose: function %s entry is not a table (in %s)", 
					function, name );
				return false;
			}

			// fetch format
			int count = specTable->Count();
			if (count < 1)
			{
				methods->EndIteration(iter);
				pSS->RaiseError( "In Net.Expose: function %s entry is an empty table (in %s)", 
					function, name );
				return false;
			}
			else if (count-1 > MaxRMIParameters)
			{
				methods->EndIteration(iter);
				pSS->RaiseError( "In Net.Expose: function %s has too many parameters (%d) (in %s)", 
					function, count-1, name );
				return false;
			}
			int tempReliability;
			if (!specTable->GetAt(1, tempReliability) || tempReliability < 0 || tempReliability >= eNRT_NumReliabilityTypes)
			{
				methods->EndIteration(iter);
				pSS->RaiseError( "In Net.Expose: function %s has invalid reliability type %d (in %s)", 
					function, tempReliability, name );
				return false;
			}
			ENetReliabilityType reliability = (ENetReliabilityType) tempReliability;
			if (!specTable->GetAt(2, tempReliability) || tempReliability < 0 || tempReliability >= eRAT_NumAttachmentTypes)
			{
				methods->EndIteration(iter);
				pSS->RaiseError( "In Net.Expose: function %s has invalid attachment type %d (in %s)", 
					function, tempReliability, name );
			}
			ERMIAttachmentType attachment = (ERMIAttachmentType) tempReliability;
			string format;
			format.reserve(count-1);
			for (int i=3; i<=count; i++)
			{
				int type = 666;
				if (!specTable->GetAt( i, type ) || type<-128 || type>127)
				{
					methods->EndIteration(iter);
					pSS->RaiseError( "In Net.Expose: function %s has invalid serialization policy %d at %d (in %s)", 
						function, type, i, name );
					return false;
				}
				format.push_back( (char) type );
			}

			CRY_ASSERT( format.length() <= MaxRMIParameters );
			strcpy( info.format, format.c_str() );
			info.funcID = funcID;
			info.reliability = reliability;
			info.attachment = attachment;

			fd.pUserDataFunc = ProxyFunction;
			fd.sFunctionName = function;
			fd.nDataSize = sizeof(SFunctionInfo);
			fd.pDataBuffer = &info;
			fd.sGlobalName = "<net-dispatch>";
			fd.sFunctionParams = "(...)";

			dispatch->AddFunction( fd );

			string lookupData = function;
			lookupData += ":";
			lookupData += format;
			dispatch->SetAt( funcID+1, lookupData.c_str() );


			funcID ++;
			if (funcID == 0)
			{
				funcID--;
				methods->EndIteration(iter);
				pSS->RaiseError( "Too many functions... max is %d", funcID );
				return false;
			}
		}
		else
		{
			GameWarning( "In Net.Expose: non-string key ignored" );
		}
	}
	methods->EndIteration(iter);

	dispatch->SetValue( VALIDATED_FIELD, false );
	cls->SetValue( name, dispatch );

	return true;
}
Example #24
0
// send a call
int CScriptRMI::ProxyFunction( IFunctionHandler* pH, void *pBuffer, int nSize )
{
	if (!m_pThis->m_pParent)
	{
		pH->GetIScriptSystem()->RaiseError( "Trying to proxy a remote method invocation with no game started... failing" );
		return pH->EndFunction();
	}

	string funcInfo;
	string dispatchInfo;
	bool gatherDebugInfo = pLogRMIEvents && pLogRMIEvents->GetIVal() != 0;

	IScriptSystem * pSS = pH->GetIScriptSystem();
	const SFunctionInfo * pFunctionInfo = static_cast<const SFunctionInfo *>(pBuffer);

	SmartScriptTable proxyTable;
	if (!pH->GetParam( 1, proxyTable ))
		return pH->EndFunction( false );

	ScriptHandle flags;
	ScriptHandle id;
	if (!proxyTable->GetValue(FLAGS_FIELD, flags))
		return pH->EndFunction( false );
	if (!proxyTable->GetValue(ID_FIELD, id))
		return pH->EndFunction( false );

	int formatStart = 2;
	if (uint32 flagsMask = flags.n & (eDF_ToClientOnChannel | eDF_ToClientOnOtherChannels))
	{
		if (flagsMask != (eDF_ToClientOnChannel | eDF_ToClientOnOtherChannels))
			formatStart ++;
	}

	_smart_ptr<CScriptMessage> pMsg = new CScriptMessage( 
		pFunctionInfo->reliability,
		pFunctionInfo->attachment,
		(EntityId)id.n, 
		pFunctionInfo->funcID, 
		pFunctionInfo->format );
	if (!pMsg->SetFromFunction( pH, formatStart ))
	{
		return pH->EndFunction( false );
	}

	if (gatherDebugInfo)
		funcInfo = pMsg->DebugInfo();

	INetContext * pNetContext = m_pThis->m_pParent->GetNetContext();
	CCryAction * pFramework = m_pThis->m_pParent->GetFramework();

	if (flags.n & eDF_ToServer)
	{
		CGameClientNub * pClientNub = pFramework->GetGameClientNub();
		bool called = false;
		if (pClientNub)
		{
			CGameClientChannel * pChannel = pClientNub->GetGameClientChannel();
			if (pChannel)
			{
				DispatchRMI( pChannel->GetNetChannel(), pMsg, false );
				called = true;
			}
		}
		if (!called)
		{
			pSS->RaiseError( "RMI via client (to server) requested but we are not a client" );
		}

		if (gatherDebugInfo)
			dispatchInfo = "server";
	}
	else if (flags.n & (eDF_ToClientOnChannel | eDF_ToClientOnOtherChannels))
	{
		CGameServerNub * pServerNub = pFramework->GetGameServerNub();
		if (pServerNub)
		{
			int myChannelId = 0;
			bool ok = true;
			if (flags.n != (eDF_ToClientOnChannel | eDF_ToClientOnOtherChannels))
			{
				if (!pH->GetParam( 2, myChannelId ))
				{
					pSS->RaiseError( "RMI onClient or otherClients must have a valid channel id for its first argument" );
					ok = false;
				}
				else if (pServerNub->GetServerChannelMap()->find(myChannelId) == pServerNub->GetServerChannelMap()->end())
				{
					pSS->RaiseError( "RMI No such server channel %d", myChannelId );
					ok = false;
				}
			}
			if (ok)
			{
				TServerChannelMap * pChannelMap = pServerNub->GetServerChannelMap();
				for (TServerChannelMap::iterator iter = pChannelMap->begin(); iter != pChannelMap->end(); ++iter)
				{
					bool isOwn = iter->first == myChannelId;
					if (isOwn && !(flags.n & eDF_ToClientOnChannel))
						continue;
					if (!isOwn && !(flags.n & eDF_ToClientOnOtherChannels))
						continue;

					if (iter->second->GetNetChannel())
						DispatchRMI( iter->second->GetNetChannel(), pMsg, true );
				}
				if (gatherDebugInfo)
				{
					dispatchInfo = "client: ";
					bool appendChannel = false;
					switch (flags.n)
					{
					case eDF_ToClientOnChannel:
						dispatchInfo += "specificChannel";
						appendChannel = true;
						break;
					case eDF_ToClientOnOtherChannels:
						dispatchInfo += "otherChannels";
						appendChannel = true;
						break;
					case eDF_ToClientOnChannel | eDF_ToClientOnOtherChannels:
						dispatchInfo += "allChannels";
						break;
					default:
						dispatchInfo += "UNKNOWN(BUG)";
						appendChannel = true;
						CRY_ASSERT(false);
					}
					if (appendChannel)
					{
						string temp;
						temp.Format(" %d", myChannelId);
						dispatchInfo += temp;
					}
				}
			}
		}
		else
		{
			pSS->RaiseError( "RMI via server (to client) requested but we are not a server" );
		}
	}

	if (gatherDebugInfo)
	{
		IEntity * pEntity = gEnv->pEntitySystem->GetEntity((EntityId)id.n);
		const char * name = "<invalid>";
		if (pEntity) name = pEntity->GetName();
		CryLogAlways("[rmi] %s(%s) [%s] on entity[%d] %s", 
			pH->GetFuncName(), funcInfo.c_str(), dispatchInfo.c_str(), (int)id.n, name);
	}

	return pH->EndFunction( true );
}
Example #25
0
// setup the meta-table for synched variables
bool CScriptRMI::BuildSynchTable( SmartScriptTable vars, SmartScriptTable cls, const char * name )
{
	IScriptSystem * pSS = vars->GetScriptSystem();
	SmartScriptTable synched( pSS );
	SmartScriptTable defaultValues( pSS );

	// TODO: Improve
	IScriptTable::SUserFunctionDesc fd;
	fd.pFunctor = functor_ret( SynchedNewIndexFunction );
	fd.sFunctionName = "__newindex";
	fd.sGlobalName = "<net-dispatch>";
	fd.sFunctionParams = "(...)";
	synched->AddFunction( fd );

	std::vector<SSynchedPropertyInfo> properties;

	IScriptTable::Iterator iter = vars->BeginIteration();
	while (vars->MoveNext(iter))
	{
		if (iter.sKey)
		{
			int type;
			if (!vars->GetValue(iter.sKey, type))
			{
				vars->EndIteration(iter);
				pSS->RaiseError( "No type for %s", iter.sKey );
				return false;
			}
			size_t len = strlen(iter.sKey);
			if (len > MaxSynchedPropertyNameLength)
			{
				vars->EndIteration(iter);
				pSS->RaiseError( "Synched var name '%s' too long (max is %d)",
					iter.sKey, (int)MaxSynchedPropertyNameLength );
				return false;
			}
			SSynchedPropertyInfo info;
			strcpy( info.name, iter.sKey );
			info.type = (EScriptSerializeType) type;
			properties.push_back( info );

			if (info.type == eSST_String)
				defaultValues->SetValue( iter.sKey, "" );
			else
				defaultValues->SetValue( iter.sKey, 0 );
		}
	}
	vars->EndIteration( iter );

	if (properties.empty())
		return true;

	fd.pFunctor = NULL;
	fd.pUserDataFunc = SerializeFunction;
	fd.nDataSize = sizeof(SSynchedPropertyInfo) * properties.size();
	fd.pDataBuffer = &properties[0];
	fd.sFunctionName = SERIALIZE_FUNCTION;
	fd.sFunctionParams = "(...)";
	fd.sGlobalName = "<net-dispatch>";
	synched->AddFunction( fd );

	cls->SetValue( SERVER_SYNCHED_FIELD, synched );
	cls->SetValue( "synched", defaultValues );

	return true;
}
Example #26
0
// implementation of Net.Expose() - exposes a class
int CScriptRMI::ExposeClass( IFunctionHandler * pFH )
{
	SmartScriptTable params, cls, clientMethods, serverMethods;
	SmartScriptTable clientTable, serverTable;
	SmartScriptTable serverProperties;

	IScriptSystem * pSS = pFH->GetIScriptSystem();

	if (pFH->GetParamCount() != 1)
	{
		pSS->RaiseError( "Net.Expose takes only one parameter - a table" );
		return pFH->EndFunction(false);
	}

	if (!pFH->GetParam( 1, params ))
	{
		pSS->RaiseError( "Net.Expose takes only one parameter - a table" );
		return pFH->EndFunction(false);
	}
	if (!params->GetValue( "Class", cls ))
	{
		pSS->RaiseError( "No 'Class' parameter to Net.Expose" );
		return pFH->EndFunction(false);
	}

	if (!params->GetValue( "ClientMethods", clientMethods ))
	{
		GameWarning( "No 'ClientMethods' parameter to Net.Expose" );
	}
	else if (!cls->GetValue("Client", clientTable))
	{
		pSS->RaiseError( "'ClientMethods' exposed, but no 'Client' table in class" );
		return pFH->EndFunction(false);
	}
	if (!params->GetValue( "ServerMethods", serverMethods ))
	{
		GameWarning( "No 'ServerMethods' parameter to Net.Expose" );
	}
	else if (!cls->GetValue("Server", serverTable))
	{
		pSS->RaiseError( "'ServerMethods' exposed, but no 'Server' table in class" );
		return pFH->EndFunction(false);
	}
	params->GetValue( "ServerProperties", serverProperties );

	if (clientMethods.GetPtr())
	{
		CRY_ASSERT( clientTable.GetPtr() );
		if (!BuildDispatchTable( clientMethods, clientTable, cls, CLIENT_DISPATCH_FIELD ))
			return pFH->EndFunction(false);
	}

	if (serverMethods.GetPtr())
	{
		CRY_ASSERT( serverTable.GetPtr() );
		if (!BuildDispatchTable( serverMethods, serverTable, cls, SERVER_DISPATCH_FIELD ))
			return pFH->EndFunction(false);
	}

	if (serverProperties.GetPtr())
	{
		if (!BuildSynchTable(serverProperties, cls, SERVER_SYNCHED_FIELD))
			return pFH->EndFunction(false);
	}

	return pFH->EndFunction(true);
}
Example #27
0
	//-------------------------------------------------------------------------------------------------------
	static void Register_RenderTargetEntity( IScriptSystem& sys )
	{
		{
			ClassRegister sc;
			sc.ClassType( &RenderTargetEntity::RTTI() );
			{
				FunctionRegister sf;
				sf.Result( sys, &RenderTargetEntity::RTTI() );
				sf.Function( &BohgeEngine::RenderTargetEntity_PushRenderTarget, "PushRenderTarget" );
				sc.ClassFunction( sf );
			}

			{
				FunctionRegister sf;
				sf.Arguments( sys, &Number::RTTI() );
				sf.Function( &BohgeEngine::RenderTargetEntity_ClearBuffer, "ClearBuffer" );
				sc.ClassFunction( sf );
			}

			{
				FunctionRegister sf;
				sf.Arguments( sys, &Number::RTTI() );
				sf.Function( &BohgeEngine::RenderTargetEntity_ActiveTargetFace, "ActiveTargetFace" );
				sc.ClassFunction( sf );
			}

			{
				FunctionRegister sf;
				sf.Result( sys, &TextureEntity::RTTI() );
				sf.Arguments( sys, &Number::RTTI() );
				sf.Function( &BohgeEngine::RenderTargetEntity_GetAttachment, "GetAttachment" );
				sc.ClassFunction( sf );
			}
			sys.RegisterClass(sc);
		}

		{
			ClassRegister sc;
			sc.ClassType( &RenderTargetProperty::RTTI() );
			sc.ClassConstant( RenderTargetProperty::ST_SWAP_A, "ST_SWAP_A" );
			sc.ClassConstant( RenderTargetProperty::ST_SWAP_B, "ST_SWAP_B" );
			sc.ClassConstant( RenderTargetProperty::ST_SWAP_C, "ST_SWAP_C" );
			sc.ClassConstant( RenderTargetProperty::ST_SWAP_D, "ST_SWAP_D" );

			sc.ClassConstant( RenderTargetProperty::RT_RENDER_TARGET_MAIN, "RT_RENDER_TARGET_MAIN" );
			sc.ClassConstant( RenderTargetProperty::RT_RENDER_TARGET_2D, "RT_RENDER_TARGET_2D" );
			sc.ClassConstant( RenderTargetProperty::RT_RENDER_TARGET_CUBE, "RT_RENDER_TARGET_CUBE" );

			sc.ClassConstant( RenderTargetProperty::TF_POSITIVE_X, "TF_POSITIVE_X" );
			sc.ClassConstant( RenderTargetProperty::TF_NEGATIVE_X, "TF_NEGATIVE_X" );
			sc.ClassConstant( RenderTargetProperty::TF_POSITIVE_Y, "TF_POSITIVE_Y" );
			sc.ClassConstant( RenderTargetProperty::TF_NEGATIVE_Y, "TF_NEGATIVE_Y" );
			sc.ClassConstant( RenderTargetProperty::TF_POSITIVE_Z, "TF_POSITIVE_Z" );
			sc.ClassConstant( RenderTargetProperty::TF_NEGATIVE_Z, "TF_NEGATIVE_Z" );
			sc.ClassConstant( RenderTargetProperty::TF_DEFAULT, "TF_DEFAULT" );

			sc.ClassConstant( RenderTargetProperty::TA_COLOR_0, "TA_COLOR_0" );
			sc.ClassConstant( RenderTargetProperty::TA_COLOR_1, "TA_COLOR_1" );
			sc.ClassConstant( RenderTargetProperty::TA_COLOR_2, "TA_COLOR_2" );
			sc.ClassConstant( RenderTargetProperty::TA_COLOR_3, "TA_COLOR_3" );
			sc.ClassConstant( RenderTargetProperty::TA_COLOR_4, "TA_COLOR_4" );
			sc.ClassConstant( RenderTargetProperty::TA_COLOR_5, "TA_COLOR_5" );
			sc.ClassConstant( RenderTargetProperty::TA_COLOR_6, "TA_COLOR_6" );
			sc.ClassConstant( RenderTargetProperty::TA_COLOR_7, "TA_COLOR_7" );
			sc.ClassConstant( RenderTargetProperty::TA_COLOR_8, "TA_COLOR_8" );
			sc.ClassConstant( RenderTargetProperty::TA_COLOR_9, "TA_COLOR_9" );
			sc.ClassConstant( RenderTargetProperty::TA_DEPTH, "TA_DEPTH" );
			sc.ClassConstant( RenderTargetProperty::TA_DEPTH_STENCIL, "TA_DEPTH_STENCIL" );

			sc.ClassConstant( RenderTargetProperty::CF_COLOR, "CF_COLOR" );
			sc.ClassConstant( RenderTargetProperty::CF_DEPTH, "CF_DEPTH" );
			sc.ClassConstant( RenderTargetProperty::CF_STENCIL, "CF_STENCIL" );
			sc.ClassConstant( RenderTargetProperty::CF_COLOR_DEPTH, "CF_COLOR_DEPTH" );
			sc.ClassConstant( RenderTargetProperty::CF_COLOR_STENCIL, "CF_COLOR_STENCIL" );
			sc.ClassConstant( RenderTargetProperty::CF_DEPTH_STENCIL, "CF_DEPTH_STENCIL" );
			sc.ClassConstant( RenderTargetProperty::CF_COLOR_DEPTH_STENCIL, "CF_COLOR_DEPTH_STENCIL" );

			sys.RegisterClass(sc);
		}
	}