//------------------------------------------------------------------------ void CNetworkMovementHelicopterCrysis2::Serialize(TSerialize ser, EEntityAspects aspects) { CRY_ASSERT(ser.GetSerializationTarget() == eST_Network); NET_PROFILE_SCOPE("Movement", ser.IsReading()); NET_PROFILE_SCOPE("NetMovementHelicopterCrysis2", ser.IsReading()); if (m_netSyncFlags & k_syncLookMoveSpeed) { ser.Value("look", m_lookTarget, 'wrl3'); ser.Value("move", m_moveTarget, 'wrl3'); ser.Value("speed", m_desiredSpeed, 'iii'); } if (m_netSyncFlags & k_syncPos) { ser.Value("pos", m_currentPos, 'wrld'); ser.Value("rot", m_currentRot, 'ori1'); } }
//----------------------------------------------------------------------------- bool CNetworkedPhysicsEntity::NetSerialize( TSerialize ser, EEntityAspects aspect, uint8 profile, int flags ) { NET_PROFILE_SCOPE("NetworkedPhysicsEntity", ser.IsReading()); if (aspect == eEA_Physics) { pe_type type = PE_NONE; switch (profile) { case ePhys_PhysicalizedRigid: { type = PE_RIGID; break; } case ePhys_PhysicalizedStatic: { type = PE_STATIC; // Serialise the position ourselves - physics system won't do it for static entities const Matrix34 &worldTM = GetEntity()->GetWorldTM(); Vec3 worldPos = worldTM.GetTranslation(); ser.Value("worldPos", worldPos, 'wrld'); if (ser.IsReading()) { Matrix34 newTM = worldTM; newTM.SetTranslation(worldPos); GetEntity()->SetWorldTM(newTM); } break; } } if (type == PE_NONE) return true; IEntityPhysicalProxy * pEPP = (IEntityPhysicalProxy *) GetEntity()->GetProxy(ENTITY_PROXY_PHYSICS); if (ser.IsWriting()) { if (!pEPP || !pEPP->GetPhysicalEntity() || pEPP->GetPhysicalEntity()->GetType() != type) { gEnv->pPhysicalWorld->SerializeGarbageTypedSnapshot( ser, type, 0 ); return true; } } else if (!pEPP) { return false; } pEPP->SerializeTyped( ser, type, flags ); } return true; }
void CDamageEffectController::NetSerialiseEffects(TSerialize ser, EEntityAspects aspect) { if(m_allowSerialise && aspect == eEA_GameServerDynamic) { NET_PROFILE_SCOPE("DamageEffects", ser.IsReading()); ser.Value("activeEffects", m_ownerActor, &CActor::GetActiveDamageEffects, &CActor::SetActiveDamageEffects, 'ui8'); ser.Value("effectReset", m_ownerActor, &CActor::GetDamageEffectsResetSwitch, &CActor::SetDamageEffectsResetSwitch, 'ui8'); ser.Value("effectKilled", m_ownerActor, &CActor::GetDamageEffectsKilled, &CActor::SetDamageEffectsKilled, 'ui8'); } }
//------------------------------------------------------------------------ void CNetworkMovementStdBoat::Serialize(TSerialize ser, EEntityAspects aspects) { if (ser.GetSerializationTarget()==eST_Network && aspects&CONTROLLED_ASPECT) { NET_PROFILE_SCOPE("NetMovementStdBoat", ser.IsReading()); ser.Value("pedal", m_pedal, 'vPed'); ser.Value("steer", m_steer, 'vStr'); ser.Value("boost", m_boost, 'bool'); } }
void CPlayerPlugin_CurrentlyTargetting::NetSerialize(TSerialize ser, EEntityAspects aspect, uint8 profile, int flags) { if(aspect == CPlayer::ASPECT_CURRENTLYTARGETTING_CLIENT) { NET_PROFILE_SCOPE("CurrentlyTargeting", ser.IsReading()); EntityId previousTarget = m_currentTarget; ser.Value("curTargetId", m_currentTarget, 'eid'); if(ser.IsReading()) { if(m_currentTarget != previousTarget) { CCCPOINT_IF(m_currentTarget, PlayerState_RemotePlayerNowTargettingSomebody); CCCPOINT_IF(!m_currentTarget, PlayerState_RemotePlayerNowTargettingNobody); m_currentTargetTime = 0.0f; CGameRules *pGameRules = g_pGame->GetGameRules(); const EntityId clientActorId = g_pGame->GetClientActorId(); if (m_bTargetingLocalPlayer) { SHUDEvent event (eHUDEvent_LocalPlayerTargeted); event.AddData(false); CHUDEventDispatcher::CallEvent(event); m_bTargetingLocalPlayer = false; //m_targetedSignal.Stop(clientActorId); } } } } }
//------------------------------------------------------------------------ void CVehicleSeatActionSound::Serialize(TSerialize ser, EEntityAspects aspects) { if (aspects&CVehicle::ASPECT_SEAT_ACTION) { NET_PROFILE_SCOPE("SeatAction_Sound", ser.IsReading()); bool enabled=m_enabled; ser.Value("enabled", enabled, 'bool'); if(ser.IsReading()) { if(m_enabled != enabled) { if (enabled) ExecuteTrigger(m_nAudioControlIDStart); else StopTrigger(); m_enabled=enabled; } } } }