MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / AddDynamicLight2

Method AddDynamicLight2

CrySystem/ScriptObjectEntity.cpp:3585–3752  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

3583
3584//////////////////////////////////////////////////////////////////////////
3585int CScriptObjectEntity::AddDynamicLight2(IFunctionHandler *pH)
3586{
3587
3588 //if(pH->GetParamCount()<11)
3589 // return pH->EndFunction();
3590
3591 CDLight DynLight;
3592 CScriptObjectVector oVec(m_pScriptSystem,true);
3593 _SmartScriptObject pObj(m_pScriptSystem,true);
3594
3595 if (!pH->GetParam(1,*pObj))
3596 return pH->EndFunction(-1);
3597
3598 IScriptObject *pITable=*pObj;
3599
3600 if (!pITable->BeginSetGetChain())
3601 return pH->EndFunction(-1);
3602
3603 //////////////////////////////////////////////////////////////////////////
3604 bool bAttachToBone;
3605
3606 if (!pITable->GetValueChain( "useModel",bAttachToBone))
3607 m_pScriptSystem->RaiseError( "<AddDynamicLight2> use of model not specified" );
3608
3609 //////////////////////////////////////////////////////////////////////////
3610 const char *sTexName=NULL;
3611 const char *sShaderName=NULL;
3612
3613 if (!pITable->GetValueChain( "ProjTexture",sTexName))
3614 m_pScriptSystem->RaiseError( "<AddDynamicLight2> ProjTexture not specified" );
3615
3616 if (!pITable->GetValueChain( "lightShader",sShaderName))
3617 m_pScriptSystem->RaiseError( "<AddDynamicLight2> sShaderName not specified" );
3618
3619 if (sTexName && sTexName[0])
3620 {
3621 //m_pDynLight->m_fAnimSpeed = fAnimSpeed;
3622 int nFlags2 = FT2_FORCECUBEMAP;
3623 // [marco] ??? If it is supposed to be used as cubemap or whatever
3624 // must be specified by the texture name or in the shader
3625 //if (bUseAsCube)
3626 //nFlags2 |= FT2_REPLICATETOALLSIDES;
3627 //if (fAnimSpeed)
3628 //nFlags2 |= FT2_CHECKFORALLSEQUENCES;
3629 DynLight.m_pLightImage = m_pISystem->GetIRenderer()->EF_LoadTexture(sTexName, 0, nFlags2, eTT_Cubemap);
3630 DynLight.m_Flags = DLF_PROJECT;
3631 }
3632 else
3633 DynLight.m_Flags = DLF_POINT;
3634
3635 if (sShaderName && sShaderName[0])
3636 DynLight.m_pShader = m_pISystem->GetIRenderer()->EF_LoadShader(sShaderName, eSH_World);
3637
3638 //////////////////////////////////////////////////////////////////////////
3639 if (!pITable->GetValueChain("Pos",*oVec))
3640 m_pScriptSystem->RaiseError( "<AddDynamicLight2> Pos not specified" );
3641 else
3642 DynLight.m_Origin=oVec.Get();

Callers

nothing calls this directly

Calls 15

EndFunctionMethod · 0.80
BeginSetGetChainMethod · 0.80
GetValueChainMethod · 0.80
RaiseErrorMethod · 0.80
EF_LoadTextureMethod · 0.80
EF_LoadShaderMethod · 0.80
EndSetGetChainMethod · 0.80
IsTextureLoadedMethod · 0.80
EF_UpdateDLightMethod · 0.80
GetCharInterfaceMethod · 0.80
AddStaticLightSourceMethod · 0.80
GetI3DEngineMethod · 0.80

Tested by

no test coverage detected