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

Method SetSecondShader

CrySystem/ScriptObjectEntity.cpp:2398–2481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2396}
2397
2398int CScriptObjectEntity::SetSecondShader(IFunctionHandler *pH)
2399{
2400 CHECK_PARAMETERS(2);
2401 const char *pszName;
2402 int iMask=0;
2403 pH->GetParam(1,pszName); // shader name
2404 pH->GetParam(2,iMask); // where to apply shader ? (0= char only, 1=char + attached, 2=char + hands only, 3=char + hands + attached, 4=all)
2405
2406 if(!m_pEntity)
2407 {
2408 return pH->EndFunction();
2409 }
2410
2411 IEntityCharacter *pEntChar=m_pEntity->GetCharInterface();
2412
2413 // where to use ?
2414 bool bOnCharAttached=0, bOnArmsAttached=0, bUseOnArms=0;
2415 switch(iMask) {
2416 case 1:
2417 bUseOnArms=0;
2418 bOnCharAttached=1;
2419 bOnArmsAttached=0;
2420 break;
2421 case 2:
2422 bUseOnArms=1;
2423 bOnCharAttached=0;
2424 bOnArmsAttached=0;
2425 break;
2426 case 3:
2427 bUseOnArms=1;
2428 bOnCharAttached=0;
2429 bOnArmsAttached=1;
2430 break;
2431 case 4:
2432 bUseOnArms=1;
2433 bOnCharAttached=1;
2434 bOnArmsAttached=1;
2435 break;
2436
2437 default:
2438 bUseOnArms=0;
2439 bOnCharAttached=0;
2440 bOnArmsAttached=0;
2441 break;
2442 }
2443
2444 // set third person shader
2445 if(pEntChar->GetCharacter(0))
2446 {
2447 pEntChar->GetCharacter(0)->SetShaderTemplateName(pszName, 1, 0, m_pEntity->GetMaterial(),(bOnCharAttached)?1:0);
2448 }
2449
2450 if(m_pEntity->GetIStatObj(0))
2451 {
2452 m_pEntity->GetIStatObj(0)->SetShaderTemplate(-1, pszName, 0);
2453 }
2454
2455 // set first person shader

Callers

nothing calls this directly

Calls 8

EndFunctionMethod · 0.80
GetCharInterfaceMethod · 0.80
GetParamMethod · 0.45
GetCharacterMethod · 0.45
SetShaderTemplateNameMethod · 0.45
GetMaterialMethod · 0.45
GetIStatObjMethod · 0.45
SetShaderTemplateMethod · 0.45

Tested by

no test coverage detected