BVB Source Codes

CRYENGINE Show ExplosiveObjectState.cpp Source code

Return Download CRYENGINE: download ExplosiveObjectState.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: state of an object pre-explosion
  8.    -------------------------------------------------------------------------
  9.    History:
  10.    - 22/01/2007   10:34 : Created by Craig Tiller
  11. *************************************************************************/
  12.  
  13. #include "StdAfx.h"
  14. #include "ExplosiveObjectState.h"
  15. #include "ObjectSelector.h"
  16. #include "DebugBreakage.h"
  17. #include "CryAction.h"
  18. #include "GameContext.h"
  19.  
  20. void SDeclareExplosiveObjectState::SerializeWith(TSerialize ser)
  21. {
  22.         LOGBREAK("SDeclareExplosiveObjectState: %s", ser.IsReading() ? "Reading:" : "Writing");
  23.  
  24.         ser.Value("breakId", breakId, 'brId');
  25.         ser.Value("isEnt", isEnt);
  26.         if (isEnt)
  27.         {
  28.                 if (ser.IsWriting())
  29.                         CRY_ASSERT(CCryAction::GetCryAction()->GetGameContext()->GetNetContext()->IsBound(entId));
  30.                 ser.Value("entid", entId, 'eid');
  31.                 ser.Value("entpos", entPos);
  32.                 ser.Value("entrot", entRot);
  33.                 ser.Value("entscale", entScale);
  34.         }
  35.         else
  36.         {
  37.                 ser.Value("eventPos", eventPos);
  38.                 ser.Value("hash", hash);
  39.         }
  40. }
  41.  
  42. bool ExplosiveObjectStateFromPhysicalEntity(SExplosiveObjectState& s, IPhysicalEntity* pPEnt)
  43. {
  44.         bool ok = false;
  45.         switch (pPEnt->GetiForeignData())
  46.         {
  47.         case PHYS_FOREIGN_ID_ENTITY:
  48.                 if (IEntity* pEnt = (IEntity*) pPEnt->GetForeignData(PHYS_FOREIGN_ID_ENTITY))
  49.                 {
  50.                         s.isEnt = true;
  51.                         s.entId = pEnt->GetId();
  52.                         s.entPos = pEnt->GetWorldPos();
  53.                         s.entRot = pEnt->GetWorldRotation();
  54.                         s.entScale = pEnt->GetScale();
  55.                         ok = true;
  56.                 }
  57.                 break;
  58.         case PHYS_FOREIGN_ID_STATIC:
  59.                 if (IRenderNode* rn = (IRenderNode*)pPEnt->GetForeignData(PHYS_FOREIGN_ID_STATIC))
  60.                 {
  61.                         s.isEnt = false;
  62.                         s.eventPos = rn->GetBBox().GetCenter();
  63.                         s.hash = CObjectSelector::CalculateHash(rn);
  64.                         ok = true;
  65.                 }
  66.                 break;
  67.         }
  68.         return ok;
  69. }
  70.  
downloadExplosiveObjectState.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