BVB Source Codes

CRYENGINE Show DeformingBreak.h Source code

Return Download CRYENGINE: download DeformingBreak.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: deforming breaks
  8.    -------------------------------------------------------------------------
  9.    History:
  10.    - 22/01/2007   10:34 : Created by Craig Tiller
  11. *************************************************************************/
  12. #ifndef __DEFORMINGBREAK_H__
  13. #define __DEFORMINGBREAK_H__
  14.  
  15. #pragma once
  16.  
  17. #include "ProceduralBreak.h"
  18. #include "ActionGame.h"
  19. #include "IProceduralBreakType.h"
  20.  
  21. void LogDeformPhysicalEntity(const char* from, IPhysicalEntity* pEnt, const Vec3& p, const Vec3& n, float energy);
  22.  
  23. #if !NET_USE_SIMPLE_BREAKAGE
  24.  
  25. struct SDeformingBreakParams
  26. {
  27.         SDeformingBreakParams() : breakId(-1) {}
  28.         SDeformingBreakParams(int bid, const SBreakEvent& bev) : breakId(bid), breakEvent(bev)
  29.         {
  30.                 breakEvent.iState = eBES_Generated;
  31.                 breakEvent.time = gEnv->pTimer->GetFrameStartTime().GetSeconds();
  32.         }
  33.         int         breakId;
  34.         SBreakEvent breakEvent;
  35.  
  36.         void        SerializeWith(TSerialize ser);
  37. };
  38.  
  39. struct SDeformingBreak : public SProceduralBreak
  40. {
  41.         DynArray<SBreakEvent> breakEvents;
  42.  
  43.         virtual void GetAffectedRegion(AABB& pos);
  44.         virtual void AddSendables(INetSendableSink* pSink, int32 brkId);
  45. };
  46.  
  47. class CDeformingBreak : public IProceduralBreakType
  48. {
  49. public:
  50.         CDeformingBreak(const SBreakEvent& be);
  51.  
  52.         bool                         AttemptAbsorb(const IProceduralBreakTypePtr& pBT);
  53.         void                         AbsorbStep();
  54.         int                          GetVirtualId(IPhysicalEntity* pEnt);
  55.         CObjectSelector              GetObjectSelector(int idx);
  56.         _smart_ptr<SProceduralBreak> CompleteSend();
  57.         bool                         GotExplosiveObjectState(const SExplosiveObjectState* pState);
  58.         void                         PreparePlayback();
  59.         void                         BeginPlayback(bool hasJointBreaks);
  60.         const char*                  GetName()                                                                                       { return "DeformingBreak"; }
  61.         void                         PatchRecording(DynArray<SProceduralSpawnRec>& spawnRecs, DynArray<SJointBreakRec>& jointBreaks) {}
  62.  
  63.         virtual bool                 AllowComplete(const SProceduralBreakRecordingState& state);
  64.  
  65. private:
  66.         DynArray<SBreakEvent> m_bes;
  67.         IPhysicalEntity*      m_pPhysEnt;
  68.         int                   m_absorbIdx;
  69.  
  70.         void PreparePlaybackForEvent(int event);
  71.  
  72.         void PrepareSlot(int idx);
  73.  
  74.         bool IsOurStatObj(IRenderNode* rn)
  75.         {
  76.                 if (m_bes[0].itype == PHYS_FOREIGN_ID_STATIC)
  77.                         return m_bes[0].hash == CObjectSelector::CalculateHash(rn);
  78.                 else
  79.                         return false;
  80.         }
  81. };
  82.  
  83. #endif // !NET_USE_SIMPLE_BREAKAGE
  84.  
  85. #endif
  86.  
downloadDeformingBreak.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