BVB Source Codes

CRYENGINE Show GenericPlaybackListener.cpp Source code

Return Download CRYENGINE: download GenericPlaybackListener.cpp Source code - Download CRYENGINE Source code - Type:.cpp
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. /*************************************************************************
  4.    -------------------------------------------------------------------------
  5.    $Id$
  6.    $DateTime$
  7.    Description:  network breakability: playback of generic breaking events
  8.    -------------------------------------------------------------------------
  9.    History:
  10.    - 22/01/2007   10:34 : Created by Craig Tiller
  11. *************************************************************************/
  12.  
  13. #include "StdAfx.h"
  14. #include <CryEntitySystem/IBreakableManager.h>
  15.  
  16. #if !NET_USE_SIMPLE_BREAKAGE
  17.  
  18.         #include "GenericPlaybackListener.h"
  19.  
  20. CGenericPlaybackListener::CGenericPlaybackListener() : m_spawnIdx(0), m_pBreakage(0)
  21. {
  22. }
  23.  
  24. void CGenericPlaybackListener::Perform(const SSimulateRemoveEntityParts& param, INetBreakagePlaybackPtr pBreakage)
  25. {
  26.         CRY_ASSERT(!m_pBreakage);
  27.         m_pBreakage = pBreakage;
  28.         CRY_ASSERT(m_spawnIdx == 0);
  29.  
  30.         EventPhysRemoveEntityParts event;
  31.         event.pEntity = param.ent.Find();
  32.         if (!event.pEntity)
  33.                 return;
  34.         event.iForeignData = event.pEntity->GetiForeignData();
  35.         event.pForeignData = event.pEntity->GetForeignData(event.iForeignData);
  36.         gEnv->pEntitySystem->GetBreakableManager()->FakePhysicsEvent(&event);
  37. }
  38.  
  39. bool CGenericPlaybackListener::AcceptUpdateMesh(const EventPhysUpdateMesh* pEvent)
  40. {
  41.         return false;
  42. }
  43.  
  44. bool CGenericPlaybackListener::AcceptCreateEntityPart(const EventPhysCreateEntityPart* pEvent)
  45. {
  46.         return false;
  47. }
  48.  
  49. bool CGenericPlaybackListener::AcceptRemoveEntityParts(const EventPhysRemoveEntityParts* pEvent)
  50. {
  51.         return false;
  52. }
  53.  
  54. bool CGenericPlaybackListener::AcceptJointBroken(const EventPhysJointBroken* pEvent)
  55. {
  56.         return false;
  57. }
  58.  
  59. void CGenericPlaybackListener::OnSpawn(IEntity* pEntity, SEntitySpawnParams& params)
  60. {
  61.         CRY_ASSERT(m_pBreakage != NULL);
  62.         m_pBreakage->SpawnedEntity(m_spawnIdx++, pEntity->GetId());
  63. }
  64.  
  65. void CGenericPlaybackListener::OnRemove(IEntity* pEntity)
  66. {
  67. }
  68.  
  69. void CGenericPlaybackListener::EndEvent(INetContext* pCtx)
  70. {
  71.         CRY_ASSERT(m_pBreakage != NULL);
  72.         m_pBreakage = 0;
  73.         m_spawnIdx = 0;
  74. }
  75.  
  76. void CGenericPlaybackListener::OnStartFrame()
  77. {
  78. }
  79.  
  80. bool CGenericPlaybackListener::OnEndFrame()
  81. {
  82.         CRY_ASSERT(false);
  83.         return false;
  84. }
  85.  
  86. void CGenericPlaybackListener::OnTimeout()
  87. {
  88. }
  89.  
  90. /*
  91.    void CGenericPlaybackListener::Perform( const SSimulateCreateEntityPart& param, INetBreakagePlayback * pBreakage )
  92.    {
  93.    CRY_ASSERT(!m_pBreakage);
  94.    m_pBreakage = pBreakage;
  95.    CRY_ASSERT(m_spawnIdx == 0);
  96.  
  97.    EventPhysCreateEntityPart event;
  98.    event.bInvalid = param.bInvalid;
  99.    event.breakAngImpulse = param.breakAngImpulse;
  100.    event.breakImpulse = param.breakImpulse;
  101.    for (int i=0; i<2; i++)
  102.    {
  103.     event.cutDirLoc[i] = param.cutDirLoc[i];
  104.     event.cutPtLoc[i] = param.cutPtLoc[i];
  105.    }
  106.    event.cutRadius = param.cutRadius;
  107.    event.pEntNew = param.entNew.Find();
  108.    event.pEntity = param.entSrc.Find();
  109.    if (!event.pEntity)
  110.     return;
  111.    event.iForeignData = event.pEntity->GetiForeignData();
  112.    event.pForeignData = event.pEntity->GetForeignData();
  113.    event.nTotParts = param.nTotParts;
  114.    event.partidNew = param.partidNew;
  115.    event.partidSrc = param.partidSrc;
  116.    gEnv->pEntitySystem->GetBreakableManager()->FakePhysicsEvent(&event);
  117.    }
  118.  */
  119.  
  120. #endif // !NET_USE_SIMPLE_BREAKAGE
  121.  
downloadGenericPlaybackListener.cpp Source code - Download CRYENGINE Source code
Related Source Codes/Software:
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top