BVB Source Codes

CRYENGINE Show ProceduralBreakingPlaybackListener.h Source code

Return Download CRYENGINE: download ProceduralBreakingPlaybackListener.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 procedural breaks
  8.    -------------------------------------------------------------------------
  9.    History:
  10.    - 22/01/2007   10:34 : Created by Craig Tiller
  11. *************************************************************************/
  12. #ifndef __PROCEDURALBREAKPLAYBACKLISTENER_H__
  13. #define __PROCEDURALBREAKPLAYBACKLISTENER_H__
  14.  
  15. #pragma once
  16.  
  17. #if !NET_USE_SIMPLE_BREAKAGE
  18.  
  19.         #include "ProceduralBreakingBaseListener.h"
  20.         #include "IBreakPlaybackStream.h"
  21.  
  22. class CProceduralBreakingPlaybackStream;
  23. class CDumpOnExitRoutine;
  24.  
  25. class CProceduralBreakingPlaybackListener : public CProceduralBreakingBaseListener
  26. {
  27.         friend class CDumpOnExitRoutine;
  28.  
  29. public:
  30.         CProceduralBreakingPlaybackListener(_smart_ptr<CProceduralBreakingPlaybackStream> pStream, INetBreakagePlaybackPtr pBreakage);
  31.  
  32.         void Start();
  33.  
  34.         bool AttemptAbsorb(const IProceduralBreakTypePtr& pBT)
  35.         {
  36.                 return false;
  37.         }
  38.  
  39. private:
  40.         void                CompleteStepFrom(DynArray<SProceduralSpawnRec>::iterator it);
  41.  
  42.         virtual void        GotJointBreak(int idxRef, int id, int epicenter) {}
  43.         virtual void        GotJointBreakParticle(const EventPhysCreateEntityPart* pEvent);
  44.         virtual int         GotBreakOp(ENetBreakOperation op, int idxRef, int partid, EntityId to);
  45.         virtual void        FinishBreakOp(ENetBreakOperation op, int idxRef, EntityId to, int virtId);
  46.         virtual void        Complete();
  47.         virtual bool        AllowComplete();
  48.         virtual const char* GetListenerName() { return "Playback"; }
  49.  
  50.         void                UpdateJointBreaks();
  51.  
  52.         #if BREAK_HIERARCHICAL_TRACKING
  53.         uint16        m_playbackFrame;
  54.         std::set<int> m_createdObjects;
  55.         void IncrementFrame();
  56.         #endif
  57.         INetBreakagePlaybackPtr                       m_pBreakage;
  58.         _smart_ptr<CProceduralBreakingPlaybackStream> m_pStream;
  59.         int m_gibIdx;
  60. };
  61.  
  62. class CDumpOnExitRoutine
  63. {
  64. public:
  65.         CDumpOnExitRoutine(CProceduralBreakingPlaybackListener* pL, const char* desc) : m_pL(pL), m_desc(desc) {}
  66.         ~CDumpOnExitRoutine();
  67. private:
  68.         const char*                          m_desc;
  69.         CProceduralBreakingPlaybackListener* m_pL;
  70. };
  71.  
  72. class CProceduralBreakingPlaybackStream : public IBreakPlaybackStream
  73. {
  74.         friend class CProceduralBreakingPlaybackListener;
  75.         friend class CDumpOnExitRoutine;
  76.  
  77. public:
  78.         CProceduralBreakingPlaybackStream(IProceduralBreakTypePtr pBreakType);
  79.         ~CProceduralBreakingPlaybackStream();
  80.  
  81.         bool                                AttemptAbsorb(const IProceduralBreakTypePtr& pBT);
  82.  
  83.         virtual bool                        GotExplosiveObjectState(const SExplosiveObjectState* state);
  84.         virtual bool                        GotProceduralSpawnRec(const SProceduralSpawnRec* rec);
  85.         virtual bool                        GotJointBreakRec(const SJointBreakRec* rec);
  86.         virtual bool                        GotJointBreakParticleRec(const SJointBreakParticleRec* rec);
  87.         virtual bool                        SetMagicId(int id);
  88.  
  89.         virtual IBreakReplicatorListenerPtr Playback(CBreakReplicator* pReplicator, INetBreakagePlaybackPtr pBreak);
  90.  
  91. private:
  92.         IProceduralBreakTypePtr          m_pBreakType;
  93.         DynArray<SJointBreakRec>         m_jointBreaks;
  94.         DynArray<SProceduralSpawnRec>    m_spawnRecs;
  95.         DynArray<SJointBreakParticleRec> m_gibs;                  // An attempt to sync the initial particle velocities
  96.         int                              m_magicId;
  97. };
  98.  
  99. inline CDumpOnExitRoutine::~CDumpOnExitRoutine() { DumpSpawnRecs(m_pL->m_pStream->m_spawnRecs, m_pL->m_pStream->m_jointBreaks, m_desc); }
  100.  
  101. #endif // !NET_USE_SIMPLE_BREAKAGE
  102.  
  103. #endif
  104.  
downloadProceduralBreakingPlaybackListener.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