本文整理汇总了C++中CItem::GetAccessoryParams方法的典型用法代码示例。如果您正苦于以下问题:C++ CItem::GetAccessoryParams方法的具体用法?C++ CItem::GetAccessoryParams怎么用?C++ CItem::GetAccessoryParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CItem
的用法示例。
在下文中一共展示了CItem::GetAccessoryParams方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ActivateLaser
//-------------------------------------------------------------------------
void CLam::ActivateLaser(bool activate, bool aiRequest /* = false */)
{
if (m_laserActivated == activate)
return;
CItem *pParent = NULL;
EntityId ownerId = 0;
bool ok = false;
if (IItem *pOwnerItem = m_pItemSystem->GetItem(GetParentId()))
{
pParent = (CItem *)pOwnerItem;
IWeapon *pWeapon = pOwnerItem->GetIWeapon();
if(pWeapon)
ownerId = pOwnerItem->GetOwnerId();
ok = true;
}
else
{
pParent = this;
ownerId = GetOwnerId();
}
IActor *pOwnerActor = gEnv->pGame->GetIGameFramework()->GetIActorSystem()->GetActor(ownerId);
if(!pOwnerActor)
return;
if(activate && !aiRequest && !pOwnerActor->IsPlayer())
return;
//Special FP stuff
if(pOwnerActor->IsPlayer() && !m_lamparams.isLaser)
return;
m_laserActivated = activate;
//Activate or deactivate effect??
if (!m_laserActivated)
{
AttachLAMLaser(false, eIGS_FirstPerson);
AttachLAMLaser(false, eIGS_ThirdPerson);
}
else
{
bool tp = pOwnerActor->IsThirdPerson();
if(!tp && ok)
{
SAccessoryParams *params = pParent->GetAccessoryParams(GetEntity()->GetClass()->GetName());
if (!params)
return;
m_laserHelperFP.clear();
m_laserHelperFP = params->attach_helper.c_str();
m_laserHelperFP.replace("_LAM","");
}
AttachLAMLaser(true, tp?eIGS_ThirdPerson:eIGS_FirstPerson);
}
if (m_laserActivated || m_lightActivated)
GetGameObject()->EnablePostUpdates(this);
if (!m_laserActivated && !m_lightActivated)
GetGameObject()->DisablePostUpdates(this);
}
示例2: UpdateScopeContexts
void CReplayActor::UpdateScopeContexts()
{
if (m_pActionController)
{
//--- Update variable scope contexts
CItem *pItem = static_cast<CItem*>(g_pGame->GetIGameFramework()->GetIItemSystem()->GetItem(m_gunId));
ICharacterInstance *pICharInst = (m_flags & eRAF_FirstPerson) && pItem ? pItem->GetEntity()->GetCharacter(0) : NULL;
IMannequin &mannequinSys = gEnv->pGame->GetIGameFramework()->GetMannequinInterface();
const int contextID = PlayerMannequin.contextIDs.Weapon;
if (contextID >= 0)
{
const uint32 numScopes = m_pActionController->GetContext().controllerDef.m_scopeDef.size();
ICharacterInstance *scopeCharInst = NULL;
for (uint32 s=0; s<numScopes; s++)
{
if (m_pActionController->GetContext().controllerDef.m_scopeDef[s].context == contextID)
{
scopeCharInst = m_pActionController->GetScope(s)->GetCharInst();
break;
}
}
if (scopeCharInst != pICharInst)
{
if (pICharInst)
{
const SParams& weaponParams = pItem->GetParams();
const IAnimationDatabase *animDB = !weaponParams.adbFile.empty() ? mannequinSys.GetAnimationDatabaseManager().Load(weaponParams.adbFile.c_str()) : NULL;
if (animDB)
{
m_pActionController->SetScopeContext(contextID, *pItem->GetEntity(), pICharInst, animDB);
}
else
{
m_pActionController->ClearScopeContext(contextID, false);
}
}
else
{
m_pActionController->ClearScopeContext(contextID, false);
}
}
}
const uint32 NUM_ACCESSORY_SLOTS = 2;
uint32 ACCESSORY_CONTEXT_IDS[NUM_ACCESSORY_SLOTS] = {PlayerMannequin.contextIDs.attachment_top, PlayerMannequin.contextIDs.attachment_bottom};
for (uint32 attachmentSlot=0; attachmentSlot<NUM_ACCESSORY_SLOTS; attachmentSlot++)
{
const int attachmentContextID = ACCESSORY_CONTEXT_IDS[attachmentSlot];
ICharacterInstance *scopeCharInst = NULL;
ICharacterInstance *accessoryCharInst = NULL;
CItem *accessory = NULL;
const char *contextName = m_pActionController->GetContext().controllerDef.m_scopeContexts.GetTagName(attachmentContextID);
const uint32 numScopes = m_pActionController->GetContext().controllerDef.m_scopeDef.size();
for (uint32 s=0; s<numScopes; s++)
{
if (m_pActionController->GetContext().controllerDef.m_scopeDef[s].context == attachmentContextID)
{
scopeCharInst = m_pActionController->GetScope(s)->GetCharInst();
break;
}
}
if (pItem)
{
//--- Find attachments
const CItem::TAccessoryArray &accessories = pItem->GetAccessories();
for (CItem::TAccessoryArray::const_iterator iter=accessories.begin(); iter != accessories.end(); ++iter)
{
const CItem::SAccessoryInfo &accessoryInfo = *iter;
const SAccessoryParams *aparams = pItem->GetAccessoryParams(accessoryInfo.pClass);
if (strcmp(aparams->attach_helper.c_str(), contextName) == 0)
{
//--- Found a match
accessory = pItem->GetAccessory(accessoryInfo.pClass);
accessoryCharInst = accessory->GetEntity()->GetCharacter(0);
break;
}
}
}
if (scopeCharInst != accessoryCharInst)
{
if (accessoryCharInst && !accessory->GetParams().adbFile.empty())
{
const IAnimationDatabase *animDB = mannequinSys.GetAnimationDatabaseManager().Load(accessory->GetParams().adbFile.c_str());
if (animDB)
{
m_pActionController->SetScopeContext(attachmentContextID, *pItem->GetEntity(), accessoryCharInst, animDB);
}
}
else
{
m_pActionController->ClearScopeContext(attachmentContextID, false);
}
}
}
}
//.........这里部分代码省略.........