BVB Source Codes

CRYENGINE Show ScriptBind_VehicleSystem.cpp Source code

Return Download CRYENGINE: download ScriptBind_VehicleSystem.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: Script Binding for the Vehicle System
  8.  
  9.    -------------------------------------------------------------------------
  10.    History:
  11.    - 26:04:2005   : Created by Mathieu Pinard
  12.  
  13. *************************************************************************/
  14. #include "StdAfx.h"
  15. #include <CryAnimation/ICryAnimation.h>
  16. #include "ActorSystem.h"
  17. #include <CryGame/IGameFramework.h>
  18. #include "VehicleSystem.h"
  19. #include "ScriptBind_VehicleSystem.h"
  20. #include "VehicleSystem/VehicleViewThirdPerson.h"
  21.  
  22. //------------------------------------------------------------------------
  23. CScriptBind_VehicleSystem::CScriptBind_VehicleSystem(ISystem* pSystem, CVehicleSystem* vehicleSystem)
  24. {
  25.         m_pVehicleSystem = vehicleSystem;
  26.  
  27.         Init(gEnv->pScriptSystem, pSystem);
  28.         SetGlobalName("Vehicle");
  29.  
  30.         RegisterGlobals();
  31.         RegisterMethods();
  32.  
  33.         gEnv->pScriptSystem->ExecuteFile("Scripts/Entities/Vehicles/VehicleSystem.lua");
  34. }
  35.  
  36. //------------------------------------------------------------------------
  37. CScriptBind_VehicleSystem::~CScriptBind_VehicleSystem()
  38. {
  39. }
  40.  
  41. //------------------------------------------------------------------------
  42. void CScriptBind_VehicleSystem::RegisterGlobals()
  43. {
  44. }
  45.  
  46. //------------------------------------------------------------------------
  47. void CScriptBind_VehicleSystem::RegisterMethods()
  48. {
  49. #undef SCRIPT_REG_CLASSNAME
  50. #define SCRIPT_REG_CLASSNAME &CScriptBind_VehicleSystem::
  51.  
  52.         SCRIPT_REG_FUNC(GetVehicleImplementations);
  53.         SCRIPT_REG_TEMPLFUNC(GetOptionalScript, "vehicleName");
  54.         SCRIPT_REG_TEMPLFUNC(ReloadSystem, "");
  55. }
  56.  
  57. //------------------------------------------------------------------------
  58. int CScriptBind_VehicleSystem::GetVehicleImplementations(IFunctionHandler* pH)
  59. {
  60.         SmartScriptTable tableImpls(m_pSS->CreateTable());
  61.         SVehicleImpls impls;
  62.  
  63.         m_pVehicleSystem->GetVehicleImplementations(impls);
  64.  
  65.         //CryLog("Scriptbind got %i vehicles", impls.Count());
  66.         for (int i = 0; i < impls.Count(); ++i)
  67.         {
  68.                 tableImpls->SetAt(i + 1, impls.GetAt(i).c_str());
  69.         }
  70.         return pH->EndFunction(tableImpls);
  71. }
  72.  
  73. //------------------------------------------------------------------------
  74. int CScriptBind_VehicleSystem::GetOptionalScript(IFunctionHandler* pH, char* vehicleName)
  75. {
  76.         char scriptName[1024] = { 0 };
  77.  
  78.         if (m_pVehicleSystem->GetOptionalScript(vehicleName, scriptName, sizeof(scriptName)))
  79.                 return pH->EndFunction(scriptName);
  80.  
  81.         return pH->EndFunction();
  82. }
  83.  
  84. //------------------------------------------------------------------------
  85. int CScriptBind_VehicleSystem::ReloadSystem(IFunctionHandler* pH)
  86. {
  87.         m_pVehicleSystem->ReloadSystem();
  88.  
  89.         return pH->EndFunction();
  90. }
  91.  
downloadScriptBind_VehicleSystem.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