BVB Source Codes

CRYENGINE Show GenericPlaybackListener.h Source code

Return Download CRYENGINE: download GenericPlaybackListener.h Source code - Download CRYENGINE Source code - Type:.h
  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. #ifndef __GENERICPLAYBACKLISTENER_H__
  13. #define __GENERICPLAYBACKLISTENER_H__
  14.  
  15. #pragma once
  16.  
  17. #if !NET_USE_SIMPLE_BREAKAGE
  18.  
  19.         #include "IBreakReplicatorListener.h"
  20.         #include "IBreakPlaybackStream.h"
  21.         #include "SimulateRemoveEntityParts.h"
  22.         #include "BreakReplicator.h"
  23.  
  24. class CGenericPlaybackListener : public IBreakReplicatorListener
  25. {
  26. public:
  27.         CGenericPlaybackListener();
  28.  
  29.         void Perform(const SSimulateRemoveEntityParts& param, INetBreakagePlaybackPtr pBreakage);
  30.         bool AcceptUpdateMesh(const EventPhysUpdateMesh* pEvent);
  31.         bool AcceptCreateEntityPart(const EventPhysCreateEntityPart* pEvent);
  32.         bool AcceptRemoveEntityParts(const EventPhysRemoveEntityParts* pEvent);
  33.         bool AcceptJointBroken(const EventPhysJointBroken*);
  34.  
  35.         void OnSpawn(IEntity* pEntity, SEntitySpawnParams& params);
  36.         void OnRemove(IEntity* pEntity);
  37.  
  38.         void OnPostStep() {}
  39.  
  40.         void EndEvent(INetContext* pCtx);
  41.  
  42.         bool AttemptAbsorb(const IProceduralBreakTypePtr& pBT)
  43.         {
  44.                 return false;
  45.         }
  46.  
  47.         virtual void OnStartFrame();
  48.         virtual bool OnEndFrame();
  49.  
  50.         virtual void OnTimeout();
  51.  
  52.         const char*  GetName()
  53.         {
  54.                 return "GenericPlaybackListener";
  55.         }
  56.  
  57. private:
  58.         int                     m_spawnIdx;
  59.         INetBreakagePlaybackPtr m_pBreakage;
  60. };
  61.  
  62. template<class TParam>
  63. class CGenericPlaybackStream : public IBreakPlaybackStream
  64. {
  65. public:
  66.         CGenericPlaybackStream(const TParam& param) : m_param(param) {}
  67.  
  68.         bool GotExplosiveObjectState(const SExplosiveObjectState* state)
  69.         {
  70.                 return false;
  71.         }
  72.         bool GotProceduralSpawnRec(const SProceduralSpawnRec* rec)
  73.         {
  74.                 return false;
  75.         }
  76.         bool GotJointBreakRec(const SJointBreakRec* rec)
  77.         {
  78.                 return false;
  79.         }
  80.         bool GotJointBreakParticleRec(const SJointBreakParticleRec* rec)
  81.         {
  82.                 return false;
  83.         }
  84.  
  85.         IBreakReplicatorListenerPtr Playback(CBreakReplicator* pReplicator, INetBreakagePlaybackPtr pBreak)
  86.         {
  87.                 _smart_ptr<CGenericPlaybackListener> pListener = new CGenericPlaybackListener();
  88.                 pReplicator->BeginEvent(&*pListener);
  89.                 pListener->Perform(m_param, pBreak);
  90.                 pReplicator->EndEvent();
  91.                 return 0;
  92.         }
  93.  
  94. protected:
  95.         CObjectSelector GetObjectSelector(int idx)
  96.         {
  97.                 CRY_ASSERT(false);
  98.                 return CObjectSelector();
  99.         }
  100.  
  101. private:
  102.         TParam m_param;
  103. };
  104.  
  105. #endif // !NET_USE_SIMPLE_BREAKAGE
  106.  
  107. #endif
  108.  
downloadGenericPlaybackListener.h 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