//------------------------------------------------------------------------ void CItem::RestoreLayers() { for(TActiveLayerMap::iterator it = m_activelayers.begin(); it != m_activelayers.end(); it++) PlayLayer(it->first, it->second, false); for(TLayerMap::iterator lit = m_sharedparams->layers.begin(); lit != m_sharedparams->layers.end(); lit++) { if(lit->second.isstatic) PlayLayer(lit->first, eIPAF_Default, false); } }
//------------------------------------------------------------------------ void CItem::ReAttachAccessory(const ItemString &name) { CItem *pAccessory = GetAccessory(name); SAccessoryParams *params = GetAccessoryParams(name); if(pAccessory && params) { SetCharacterAttachment(eIGS_FirstPerson, params->attach_helper.c_str(), pAccessory->GetEntity(), eIGS_FirstPerson, 0); Vec3 position = GetSlotHelperPos(eIGS_ThirdPerson, params->attach_helper.c_str(), false); GetEntity()->AttachChild(pAccessory->GetEntity()); Matrix34 tm(Matrix34::CreateIdentity()); tm.SetTranslation(position); pAccessory->GetEntity()->SetLocalTM(tm); pAccessory->SetParentId(GetEntityId()); pAccessory->Physicalize(false, false); PlayLayer(params->attach_layer, eIPAF_Default|eIPAF_NoBlend); } }
//------------------------------------------------------------------------ void CItem::AttachAccessoryPlaceHolder(const ItemString &name, bool attach) { const SAccessoryParams *params = GetAccessoryParams(name); if(!params) return; CItem *pPlaceHolder = GetAccessoryPlaceHolder(name); if(!pPlaceHolder) return; if(attach) { SetCharacterAttachment(eIGS_FirstPerson, params->attach_helper, pPlaceHolder->GetEntity(), eIGS_FirstPerson, 0); PlayLayer(params->attach_layer, eIPAF_FirstPerson, false); } else { ResetCharacterAttachment(eIGS_FirstPerson, params->attach_helper); StopLayer(params->attach_layer, eIPAF_FirstPerson, false); } }