BVB Source Codes

CRYENGINE Show VehicleUtils.cpp Source code

Return Download CRYENGINE: download VehicleUtils.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: Implements several utility functions for vehicles
  8.  
  9.    -------------------------------------------------------------------------
  10.    History:
  11.  
  12. *************************************************************************/
  13. #include "StdAfx.h"
  14.  
  15. #include "VehicleUtils.h"
  16.  
  17. #include "CryAction.h"
  18. #include "PersistantDebug.h"
  19.  
  20. #include "Vehicle.h"
  21. #include "VehicleAnimation.h"
  22. #include "VehicleCVars.h"
  23. #include "VehicleComponent.h"
  24. #include "VehicleHelper.h"
  25. #include "VehicleSeat.h"
  26. #include "VehicleSeatGroup.h"
  27. #include "VehicleSeatActionWeapons.h"
  28.  
  29. //------------------------------------------------------------------------
  30. void VehicleUtils::DumpDamageBehaviorEvent(const SVehicleDamageBehaviorEventParams& params)
  31. {
  32. #if ENABLE_VEHICLE_DEBUG
  33.         CryLog("=================================");
  34.         CryLog("SVehicleDamageBehaviorEventParams");
  35.         CryLog("localPos (%.2f, %.2f, %.2f)", params.localPos.x, params.localPos.y, params.localPos.z);
  36.         CryLog("shooterId: %u", params.shooterId);
  37.         CryLog("radius: %.2f", params.radius);
  38.         CryLog("hitValue: %.2f", params.hitValue);
  39.         CryLog("componentDamageRatio: %.2f", params.componentDamageRatio);
  40.         CryLog("randomness: %.1f", params.randomness);
  41.  
  42.         if (params.pVehicleComponent)
  43.                 CryLog("pVehicleComponent: <%s>", ((CVehicleComponent*)params.pVehicleComponent)->GetName().c_str());
  44. #endif
  45. }
  46.  
  47. //------------------------------------------------------------------------
  48. void VehicleUtils::DrawTM(const Matrix34& tm, const char* name, bool clear)
  49. {
  50. #if ENABLE_VEHICLE_DEBUG
  51.         IPersistantDebug* pDebug = CCryAction::GetCryAction()->GetIPersistantDebug();
  52.         pDebug->Begin(name, clear);
  53.  
  54.         const static ColorF red(1, 0, 0, 1);
  55.         const static ColorF green(0, 1, 0, 1);
  56.         const static ColorF blue(0, 0, 1, 1);
  57.  
  58.         float timeout = 0.1f;
  59.         float radius = 1.5f;
  60.  
  61.         pDebug->AddDirection(tm.GetTranslation(), radius, tm.GetColumn(0), red, timeout);
  62.         pDebug->AddDirection(tm.GetTranslation(), radius, tm.GetColumn(1), green, timeout);
  63.         pDebug->AddDirection(tm.GetTranslation(), radius, tm.GetColumn(2), blue, timeout);
  64. #endif
  65. }
  66.  
  67. //------------------------------------------------------------------------
  68. void VehicleUtils::DumpSlots(IVehicle* pVehicle)
  69. {
  70. #if ENABLE_VEHICLE_DEBUG
  71.         if (VehicleCVars().v_debugdraw)
  72.         {
  73.                 IEntity* pEntity = pVehicle->GetEntity();
  74.  
  75.                 for (int i = 0; i < pEntity->GetSlotCount(); ++i)
  76.                 {
  77.                         SEntitySlotInfo info;
  78.                         if (pEntity->GetSlotInfo(i, info))
  79.                         {
  80.                                 if (info.pCharacter)
  81.                                         CryLog("slot %i: <char> %s", i, info.pCharacter->GetFilePath());
  82.                                 else if (info.pStatObj)
  83.                                         CryLog("slot %i: <statobj> %s", i, info.pStatObj->GetGeoName());
  84.                                 else if (info.pParticleEmitter)
  85.                                         CryLog("slot %i: <particle> %s", i, info.pParticleEmitter->GetName());
  86.                                 else
  87.                                         CryLog("slot %i: <UNKNOWN>", i);
  88.                         }
  89.                 }
  90.         }
  91. #endif
  92. }
  93.  
downloadVehicleUtils.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