void Init(IEntity &entity, const float blendTime) { m_targetTime = blendTime; m_lastTime = 0.0f; m_invalid = false; m_delta.zero(); m_deltaRot.SetIdentity(); IActor* pActor = gEnv->pGame->GetIGameFramework()->GetIActorSystem()->GetActor(entity.GetId()); m_pAnimatedCharacter = pActor ? pActor->GetAnimatedCharacter() : NULL; }
void CDoorPanel::NotifyScreenSharingEvent(const EDoorPanelGameObjectEvent event) { if (m_screenSharingEntities.size() > 0) { const EntityId thisEntityId = GetEntityId(); for (size_t i = 0; i < m_screenSharingEntities.size(); i++) { const EntityId entityId = m_screenSharingEntities[i]; IEntity* pEntity = gEnv->pEntitySystem->GetEntity( entityId ); if (pEntity) { CGameObject* pGameObject = static_cast<CGameObject*>(pEntity->GetProxy(ENTITY_PROXY_USER)); if (pGameObject != NULL) { SGameObjectEvent goEvent( (uint32)event, eGOEF_ToExtensions, IGameObjectSystem::InvalidExtensionID, (void*)(&(thisEntityId)) ); pGameObject->SendEvent( goEvent ); } } } } }
//------------------------------------------------------------------------ void CProjectile::InitWithAI() { // register with ai if needed //FIXME //make AI ignore grenades thrown by AI; needs proper/readable grenade reaction if (m_pAmmoParams->aiType!=AIOBJECT_NONE) { bool isFriendlyGrenade(true); IEntity *pOwnerEntity = gEnv->pEntitySystem->GetEntity(m_ownerId); if (pOwnerEntity && pOwnerEntity->GetAI()) isFriendlyGrenade = (pOwnerEntity->GetAI()->GetAIType()==AIOBJECT_PUPPET); if (!isFriendlyGrenade) { AIObjectParameters params; GetEntity()->RegisterInAISystem(m_pAmmoParams->aiType, params); } } GetGameObject()->SetAIActivation(eGOAIAM_Always); }
//------------------------------------------------------------------------ void CFreezingBeam::Hit(ray_hit &hit, const Vec3 &dir) { if (gEnv->bMultiplayer) if (CActor *pActor=m_pWeapon->GetOwnerActor()) if (pActor && !pActor->IsClient()) return; IEntity *pEntity = gEnv->pEntitySystem->GetEntityFromPhysics(hit.pCollider); float frost = m_pShared->freezeparams.freeze_speed>0.0f?m_pShared->freezeparams.freeze_speed*m_pShared->beamparams.tick:1.0f; int type=hit.pCollider->GetType(); if (pEntity && (type==PE_RIGID || type==PE_ARTICULATED || type==PE_LIVING || type==PE_WHEELEDVEHICLE || (type==PE_STATIC && g_pGame->GetWeaponSystem()->GetProjectile(pEntity->GetId())))) // static projectiles are allowed to be frozen { SimpleHitInfo info(m_pWeapon->GetOwnerId(), pEntity->GetId(), m_pWeapon->GetEntityId(), 0xe); info.value=frost; g_pGame->GetGameRules()->ClientSimpleHit(info); } }
void CBoundingContainer::SetupEntity() { IEntity* pEntity = GetEntity(); CRY_ASSERT(pEntity != NULL); IScriptTable* pScriptTable = pEntity->GetScriptTable(); if (pScriptTable != NULL) { SmartScriptTable propertiesTable; if (pScriptTable->GetValue("Properties", propertiesTable)) { Vec3 boundingDimensions(0.0f,0.0f,0.0f); propertiesTable->GetValue("DimX", boundingDimensions.x); propertiesTable->GetValue("DimY", boundingDimensions.y); propertiesTable->GetValue("DimZ", boundingDimensions.z); m_vBoundingMin = -boundingDimensions/2.0f; m_vBoundingMax = boundingDimensions/2.0f; } } }
virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo ) { ICustomAction* pCustomAction = pActInfo->pGraph->GetCustomAction(); switch ( event ) { case eFE_Update: pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, false ); if ( pCustomAction ) { IEntity* pTarget = pCustomAction->GetObjectEntity(); ActivateOutput( pActInfo, 0, pTarget ? pTarget->GetId() : 0 ); } break; case eFE_Initialize: pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, false ); break; case eFE_Activate: break; } }
CWaterPuddle* CWaterPuddleManager::FindWaterPuddle(Vec3 point) { size_t numPuddles = m_waterPuddles.size(); for (size_t i = 0; i < numPuddles; ++i) { EntityId puddle = m_waterPuddles[i].m_entityId; IEntity* pEntity = gEnv->pEntitySystem->GetEntity(puddle); if (!pEntity) continue; IGameVolumes::VolumeInfo volumeInfo; if (!GetVolumeInfoForEntity(puddle, &volumeInfo)) continue; if (IsPointInsideVolume(pEntity->GetWorldTM(), volumeInfo, point, 0.0f)) return m_waterPuddles[i].m_pPuddle; } return 0; }
void CBodyDestrutibilityInstance::Update( float frameTime ) { if (m_mikeAttachmentEntityId && m_mikeExplodeAlphaTestFadeOutTimer > 0.0f) { m_mikeExplodeAlphaTestFadeOutTimer -= min(frameTime, m_mikeExplodeAlphaTestFadeOutTimer); float alphaTestValue = max(min(m_mikeExplodeAlphaTestFadeOutTimer*m_mikeExplodeAlphaTestFadeOutScale+1.0f, 1.0f), 0.0f) * m_mikeExplodeAlphaTestMax; IEntity* pJellyEntity = gEnv->pEntitySystem->GetEntity(m_mikeAttachmentEntityId); ICharacterInstance* pJellyCharacter = pJellyEntity ? pJellyEntity->GetCharacter(0) : 0; IMaterial* pJellyMaterial = pJellyCharacter ? pJellyCharacter->GetIMaterial() : 0; if (pJellyMaterial) { int numSubMaterials = pJellyMaterial->GetSubMtlCount(); for (int i = 0; i < numSubMaterials; ++i) { IMaterial* pSubJellyMaterial = pJellyMaterial->GetSubMtl(i); pSubJellyMaterial->SetGetMaterialParamFloat("alpha", alphaTestValue, false); } } } }
//------------------------------------------------------------------------ IMPLEMENT_RMI(CGameRules, ClRenameEntity) { IEntity *pEntity = gEnv->pEntitySystem->GetEntity(params.entityId); if (pEntity) { string old = pEntity->GetName(); pEntity->SetName(params.name.c_str()); CryLogAlways("$8%s$o renamed to $8%s", old.c_str(), params.name.c_str()); // if this was a remote player, check we're not spectating them. // If we are, we need to trigger a spectator hud update for the new name EntityId clientId = g_pGame->GetIGameFramework()->GetClientActorId(); if(gEnv->bMultiplayer && params.entityId != clientId) { CActor *pClientActor = static_cast<CActor *>(g_pGame->GetIGameFramework()->GetClientActor()); } } return true; }
BuildingGUID CBaseManager::GetBuildingFromInterface(EntityId nEntityId, IBuildingController **ppController) const { if (NULL != ppController) *ppController = NULL; // Get the entity IEntity *pEntity = gEnv->pEntitySystem->GetEntity(nEntityId); if (NULL == pEntity) return GUID_INVALID; if (false == pEntity->CheckFlags(ENTITY_FLAG_ISINTERFACE)) return GUID_INVALID; // Check all controllers for (ControllerList::const_iterator itBuilding = m_ControllerList.begin(); itBuilding != m_ControllerList.end(); itBuilding++) { if (true == itBuilding->second->HasInterface(pEntity)) { // Got it if (NULL != ppController) *ppController = itBuilding->second; return itBuilding->first; } } return GUID_INVALID; }
//------------------------------------------------------------------------ void CVehicleViewSteer::Reset() { CVehicleViewBase::Reset(); IEntity* pEntity = m_pVehicle->GetEntity(); assert(pEntity); m_position = pEntity->GetWorldTM() * m_localSpaceCameraOffset; Vec3 entityPos = pEntity->GetPos(); CalcLookAt(pEntity->GetWorldTM()); m_lastOffset = m_position - m_lookAt; m_lastOffsetBeforeElev = m_lastOffset; m_angReturnSpeed = 0.f; m_angSpeedCorrection = 0.f; // Going Forwards m_flags &= ~m_backwardsFlags; m_flags |= eVCam_goingForwards | m_forwardFlags; m_radius = fabsf(m_localSpaceCameraOffset.y); m_curYaw = 0.f; m_lastVehVel.zero(); m_radiusVel = 0.f; }
uint8 CAutoAimManager::GetLocalPlayerFaction() const { if (m_localPlayerFaction != IFactionMap::InvalidFactionID) { return m_localPlayerFaction; } else { IEntity* pLocalPlayerEntity = gEnv->pEntitySystem->GetEntity(g_pGame->GetIGameFramework()->GetClientActorId()); if (pLocalPlayerEntity) { IAIObject* pAIObject = pLocalPlayerEntity->GetAI(); if (pAIObject) { m_localPlayerFaction = pAIObject->GetFactionID(); } } } return m_localPlayerFaction; }
void CDeformingBreak::PreparePlaybackForEvent( int event ) { m_pPhysEnt = 0; if (m_bes[event].itype == PHYS_FOREIGN_ID_ENTITY) { IEntity * pEnt = gEnv->pEntitySystem->GetEntity(m_bes[event].idEnt); if (!pEnt) { GameWarning("Unable to find entity to perform deforming break on"); return; } pEnt->SetPosRotScale(m_bes[event].pos, m_bes[event].rot, m_bes[event].scale); m_pPhysEnt = pEnt->GetPhysics(); } else if (m_bes[event].itype == PHYS_FOREIGN_ID_STATIC) { m_pPhysEnt = CObjectSelector::FindPhysicalEntity(m_bes[event].eventPos, m_bes[event].hash, CObjectSelector_Eps); if (!m_pPhysEnt) GameWarning("Unable to find static object to perform deforming break on"); } }
bool Map::isReachableByWalking (const IEntity *start, const IEntity *end, int startPos, int endPos) const { // check that there is nothing solid in between IEntity* entity = nullptr; trace(start, end, &entity); if (entity != nullptr && entity->isSolid()) return false; if (startPos == -1 || endPos == -1) getPlatformDimensions(static_cast<int>(start->getPos().x), static_cast<int>(start->getPos().y), &startPos, &endPos); // if there is a start and end pos of a platform given, then let's check whether end is inside the range const gridCoord xStart = start->getPos().x; const gridCoord xEnd = end->getPos().x; if (xStart < xEnd) { // walking right return xEnd <= endPos; } // walking left return startPos <= xEnd; }
virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo ) { switch (event) { case eFE_Activate: if (IsPortActive(pActInfo, 0)) { string state = "invalid entity"; IEntity *ent = pActInfo->pEntity; if(ent) { IEntityScriptProxy *pScriptProxy = (IEntityScriptProxy*)ent->GetProxy(ENTITY_PROXY_SCRIPT); state = "invalid script"; if(pScriptProxy) state = pScriptProxy->GetState(); } ActivateOutput(pActInfo, OUT_STATE, state); } } }
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); } } } }
void CBattleEvent::Update(SEntityUpdateContext &ctx, int updateSlot) { IEntity* pEntity = GetEntity(); if(pEntity) { Matrix34 tm = pEntity->GetWorldTM(); tm.SetTranslation(m_worldPos); pEntity->SetWorldTM(tm); if(m_numParticles > 0 && !m_pParticleEffect) { // attach the particle effect to this entity now m_pParticleEffect = gEnv->pParticleManager->FindEffect(g_pGameCVars->g_battleDust_effect->GetString()); if (m_pParticleEffect) { pEntity->LoadParticleEmitter(0, m_pParticleEffect, 0, true, true); Matrix34 tm = IParticleEffect::ParticleLoc(Vec3(0,0,0)); pEntity->SetSlotLocalTM(0, tm); } } if(m_pParticleEffect) { SEntitySlotInfo info; pEntity->GetSlotInfo(0, info); if(info.pParticleEmitter) { SpawnParams sp; sp.fCountScale = (float)m_numParticles/60.0f; info.pParticleEmitter->SetSpawnParams(sp); } } if(g_pGameCVars->g_battleDust_debug != 0) { if(g_pGameCVars->g_battleDust_debug >= 2) { if(m_numParticles > 0) { gEnv->pRenderer->GetIRenderAuxGeom()->DrawSphere(m_worldPos, m_numParticles, ColorF(0.0f,1.0f,0.0f,0.2f)); } else { gEnv->pRenderer->GetIRenderAuxGeom()->DrawSphere(m_worldPos, 0.5f, ColorF(1.0f,0.0f,0.0f,0.2f)); } } else { if(m_numParticles > 0) { gEnv->pRenderer->GetIRenderAuxGeom()->DrawSphere(m_worldPos, 0.5f, ColorF(0.0f,1.0f,0.0f,0.2f)); } else { gEnv->pRenderer->GetIRenderAuxGeom()->DrawSphere(m_worldPos, 0.5f, ColorF(1.0f,0.0f,0.0f,0.2f)); } } } } }
void CNativeEntity::Physicalize() { IEntity *pEntity = GetEntity(); pEntity->LoadGeometry(0, "objects/tank_env_assets/scifi/yellowcrate.cgf"); // Unphysicalize { const Ang3 oldRotation = pEntity->GetWorldAngles(); const Quat newRotation = Quat::CreateRotationZ(oldRotation.z); pEntity->SetRotation(newRotation); SEntityPhysicalizeParams pp; pp.type = PE_NONE; pEntity->Physicalize(pp); } // ~Unphysicalize SEntityPhysicalizeParams pp; pp.type = PE_RIGID; pp.mass = 20; pp.nSlot = 0; pEntity->Physicalize(pp); }
void CGameRealtimeRemoteUpdateListener::EndCameraSync() { IGame *pGame = gEnv->pGame; if(!pGame) return; IGameFramework *pGameFramework=pGame->GetIGameFramework(); if(!pGameFramework) return; IViewSystem *pViewSystem=pGameFramework->GetIViewSystem(); if(!pViewSystem) return; IView *pView=pViewSystem->GetActiveView(); if(!pView) return; IEntity *pEntity = gEnv->pEntitySystem->GetEntity(pView->GetLinkedId()); if(!pEntity) return; CPlayer *pPlayer=static_cast<CPlayer *>(pGameFramework->GetClientActor()); if (!pPlayer) return; IEntity * pPlayerEntity = pPlayer->GetEntity(); if ( !pPlayerEntity ) return; #ifndef _RELEASE pPlayer->SetFlyMode(m_nPreviousFlyMode); #endif pPlayerEntity->Hide(false); pViewSystem->SetOverrideCameraRotation(false,Quat::CreateRotationVDir(m_ViewDirection)); pEntity->SetRotation(Quat::CreateRotationVDir(m_ViewDirection)); m_bCameraSync = false; // reset our head-position delta on end camera sync m_headPositionDelta.zero(); }
//------------------------------------------------------------------------ void CVehicleActionEntityAttachment::Update(const float deltaTime) { if (m_isAttached) return; IEntitySystem* pEntitySystem = gEnv->pEntitySystem; assert(pEntitySystem); IEntity* pEntity = pEntitySystem->GetEntity(m_entityId); if (!pEntity) return; IPhysicalEntity* pPhysEntity = pEntity->GetPhysics(); if (!pPhysEntity) return; pe_simulation_params paramsSim; float gravity; if (pPhysEntity->GetParams(¶msSim)) gravity = abs(paramsSim.gravity.z); else gravity = 9.82f; pe_status_dynamics dyn; if (pPhysEntity->GetStatus(&dyn)) { pe_action_impulse impulse; impulse.impulse = Matrix33(pEntity->GetWorldTM()) * Vec3(0.0f, 0.0f, 1.0f) * g_parachuteForce * gravity; impulse.impulse = impulse.impulse - dyn.v; impulse.impulse *= dyn.mass * deltaTime; impulse.iSource = 3; pPhysEntity->Action(&impulse); } m_timer -= deltaTime; if (m_timer <= 0.0f || dyn.v.z >= 0.0f) m_pVehicle->SetObjectUpdate(this, IVehicle::eVOU_NoUpdate); }
void CGameRealtimeRemoteUpdateListener::EndCameraSync() { IGame *pGame = gEnv->pGame; if(!pGame) return; IGameFramework *pGameFramework=pGame->GetIGameFramework(); if(!pGameFramework) return; IViewSystem *pViewSystem=pGameFramework->GetIViewSystem(); if(!pViewSystem) return; IView *pView=pViewSystem->GetActiveView(); if(!pView) return; IEntity *pEntity = gEnv->pEntitySystem->GetEntity(pView->GetLinkedId()); if(!pEntity) return; IActor *pPlayer=pGameFramework->GetClientActor(); if (!pPlayer) return; IEntity * pPlayerEntity = pPlayer->GetEntity(); if ( !pPlayerEntity ) return; SEntityUpdateContext ctx; pPlayer->Update( ctx, 0 ); pPlayerEntity->Hide(false); pViewSystem->SetOverrideCameraRotation(false,Quat::CreateRotationVDir(m_ViewDirection)); pEntity->SetRotation(Quat::CreateRotationVDir(m_ViewDirection)); m_bCameraSync = false; // reset our head-position delta on end camera sync m_headPositionDelta.zero(); }
void CPlayerVisTable::UpdateIgnoreEntityDebug() { // Output array contents CryWatch("==== VISTABLE: Ignore Entities ===="); CryWatch(""); const int finalIndex = m_currentNumIgnoreEntities; for(int i = 0; i <= finalIndex; ++i) { const char* pEntName = "Unknown"; IEntity* pIgnoreEntity = gEnv->pEntitySystem->GetEntity(m_globalIgnoreEntities[i].id); if(pIgnoreEntity) { pEntName = pIgnoreEntity->GetName(); } CryWatch("Entity: Id < %d > , Name < %s >", m_globalIgnoreEntities[i].id, pEntName); CryWatch("RefCount %d", m_globalIgnoreEntities[i].refCount); if(m_globalIgnoreEntities[i].requesteeName.c_str()) { CryWatch("Caller %s", m_globalIgnoreEntities[i].requesteeName.c_str()); } CryWatch(""); } CryWatch("==== ==== ==== ==== ==== ==== ===="); // Test adding / removing specified ids if(g_pGameCVars->pl_debug_vistableAddEntityId) { AddGlobalIgnoreEntity(g_pGameCVars->pl_debug_vistableAddEntityId, "VisTable DEBUG"); g_pGameCVars->pl_debug_vistableAddEntityId = 0; } if(g_pGameCVars->pl_debug_vistableRemoveEntityId) { RemoveGlobalIgnoreEntity(g_pGameCVars->pl_debug_vistableRemoveEntityId); g_pGameCVars->pl_debug_vistableRemoveEntityId = 0; } }
bool CStickyProjectile::IsValid() const { if (!IsStuck()) return false; if(m_parentId == 0) return true; pe_params_part part; part.partid = m_stuckPartId; IEntity* pEntity = gEnv->pEntitySystem->GetEntity(m_parentId); if(pEntity) { if (pEntity->IsHidden()) { return false; } if(ICharacterInstance* pCharacter = pEntity->GetCharacter(0)) { if(ISkeletonPose* pSkel = pCharacter->GetISkeletonPose()) { IPhysicalEntity* pSkelPhysics = pSkel->GetCharacterPhysics(); if (pSkelPhysics) { return pSkelPhysics->GetParams(&part) != 0; } } } else { IPhysicalEntity* pPhysics = pEntity->GetPhysics(); if (pPhysics) { return pPhysics->GetParams(&part) != 0; } } } return false; }
void Map::addEntity (int clientMask, const IEntity& entity) const { const EntityAngle angle = static_cast<EntityAngle>(RadiansToDegrees(entity.getAngle())); const AddEntityMessage msg(entity.getID(), entity.getType(), Animation::NONE, entity.getSpriteID(), entity.getCol(), entity.getRow(), 1.0f, 1.0f, angle, ENTITY_ALIGN_UPPER_LEFT); _serviceProvider->getNetwork().sendToClients(clientMask, msg); }
EntityId CAICorpse::CloneAttachedItem( const CAICorpse::AttachedItem& attachedItem, IAttachment* pAttachment ) { stack_string clonedItemName; clonedItemName.Format("%s_%s", GetEntity()->GetName(), attachedItem.pClass->GetName() ); SEntitySpawnParams params; params.sName = clonedItemName.c_str(); params.pClass = attachedItem.pClass; // Flag as 'No Save' they will be recreated during serialization if needed params.nFlags |= (ENTITY_FLAG_NO_SAVE); IEntity *pClonedItemEntity = gEnv->pEntitySystem->SpawnEntity(params); assert (pClonedItemEntity != NULL); IItem* pClonedItem = g_pGame->GetIGameFramework()->GetIItemSystem()->GetItem(pClonedItemEntity->GetId()); assert(pClonedItem != NULL); pClonedItem->Physicalize(false, false); pClonedItem->SetOwnerId( GetEntityId() ); // Set properties table to null, since they'll not be used IScriptTable* pClonedItemEntityScript = pClonedItemEntity->GetScriptTable(); if (pClonedItemEntityScript != NULL) { pClonedItemEntity->GetScriptTable()->SetToNull("Properties"); } // Swap attachments CEntityAttachment* pEntityAttachement = new CEntityAttachment(); pEntityAttachement->SetEntityId( pClonedItemEntity->GetId() ); pAttachment->AddBinding( pEntityAttachement ); return pClonedItemEntity->GetId(); }
// NOTE Dez 15, 2006: <pvl> not called ATM. Should be moved to BaseGrabHandler. Vec3 CAnimatedGrabHandler::GetGrabIKPos(IEntity *pGrab,int limbIdx) { AABB bbox; pGrab->GetLocalBounds(bbox); Vec3 grabCenter((bbox.max + bbox.min) * 0.5f); if (m_grabStats.limbNum<2) { } else { IEntity *pEnt = m_pActor->GetEntity(); SIKLimb *pLimb = m_pActor->GetIKLimb(m_grabStats.limbId[limbIdx]); ICharacterInstance *pCharacter = pEnt->GetCharacter(pLimb->characterSlot); if (pCharacter) { Vec3 posPool[2]={grabCenter,grabCenter}; posPool[0].x = bbox.min.x; posPool[1].x = bbox.max.x; Vec3 limbPosInLocal(pGrab->GetWorldTM().GetInverted()*(pEnt->GetSlotWorldTM(pLimb->characterSlot) * pCharacter->GetISkeletonPose()->GetAbsJointByID(pLimb->rootBoneID).t )); float minDist(9999.9f); for (int i=0;i<2;++i) { //gEnv->pRenderer->GetIRenderAuxGeom()->DrawLine(pGrab->GetWorldTM() * posPool[i], ColorB(0,255,0,100), pGrab->GetWorldTM() * limbPosInLocal, ColorB(0,255,0,100)); float len2((posPool[i] - limbPosInLocal).len2()); if (len2<minDist) { minDist = len2; grabCenter = posPool[i]; } } } } return (pGrab->GetWorldTM() * grabCenter); }
//------------------------------------------------------------------------ void SSoundEffect::Activate(EntityId targetId, EntityId ownerId, EntityId weaponId, const char *effect, const char *defaultEffect) { // TODO: make work in MP... IEntity* pEntity = gEnv->pEntitySystem->GetEntity(targetId); IEntity* pOwnerEntity = gEnv->pEntitySystem->GetEntity(ownerId); if(pEntity && gEnv->pSoundSystem && pOwnerEntity) { int soundFlag = FLAG_SOUND_3D; bool repeating = false; bool force3DSound = true; IEntitySoundProxy* pSoundProxy = (IEntitySoundProxy*)pOwnerEntity->GetProxy(ENTITY_PROXY_SOUND); if(pSoundProxy) { //Execute sound at entity position GameWarning("Sound effect: %s (Entity)", defaultEffect); pSoundProxy->PlaySound(defaultEffect, pEntity->GetWorldPos()-pOwnerEntity->GetWorldPos(),FORWARD_DIRECTION, FLAG_SOUND_DEFAULT_3D); // Notify AI system (TODO: Parametrize radius) gEnv->pAISystem->SoundEvent(pEntity->GetWorldPos(), 100.0f, AISE_GENERIC, NULL); //gEnv->pRenderer->GetIRenderAuxGeom()->DrawSphere(pEntity->GetWorldPos(),0.5f,ColorB(255,0,0)); } } }
bool CVTOLVehicleManager::TestEntityInVTOL( const IEntity& entity ) const { AABB aabb; entity.GetLocalBounds(aabb); for(TVTOLList::const_iterator iter=m_vtolList.begin(), end=m_vtolList.end(); iter!=end; ++iter) { if(TestIsInVTOL(iter->second, aabb)) { return true; } } return false; }
//------------------------------------------ bool CC4Projectile::Init(IGameObject *pGameObject) { bool ok = CProjectile::Init(pGameObject); // C4 should always be saved (unlike other projectiles) IEntity* pEntity = GetEntity(); pEntity->SetFlags(pEntity->GetFlags() & ~ENTITY_FLAG_NO_SAVE); if(!gEnv->bServer) { CreateLight(); } if(gEnv->bMultiplayer) { CGameRules *pGameRules = g_pGame->GetGameRules(); pGameRules->RegisterTeamChangedListener(this); pGameRules->RegisterClientConnectionListener(this); } return ok; }
void CPlayerRotation::ProcessLinkedState( SLinkStats& linkStats, const Quat& lastBaseQuat, const Quat& lastViewQuat ) { if (!linkStats.linkID) return; IEntity *pLinked = linkStats.GetLinked(); if (pLinked) { //at this point m_baseQuat and m_viewQuat contain the previous frame rotation, I'm using them to calculate the delta rotation. m_baseQuatLinked *= lastBaseQuat.GetInverted() * m_baseQuat; m_viewQuatLinked *= lastViewQuat.GetInverted() * m_viewQuat; m_baseQuatLinked.Normalize(); m_viewQuatLinked.Normalize(); const Quat qLinkedRotation = pLinked->GetRotation(); m_baseQuat = qLinkedRotation * m_baseQuatLinked; m_viewQuat = qLinkedRotation * m_viewQuatLinked; } }