BVB Source Codes

CRYENGINE Show SerializeScriptTableWriter.cpp Source code

Return Download CRYENGINE: download SerializeScriptTableWriter.cpp Source code - Download CRYENGINE Source code - Type:.cpp
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. #include "StdAfx.h"
  4. #include "SerializeScriptTableWriter.h"
  5.  
  6. CSerializeScriptTableWriterImpl::CSerializeScriptTableWriterImpl(SmartScriptTable tbl)
  7. {
  8.         m_pSS = gEnv->pScriptSystem;
  9.         if (!tbl)
  10.                 tbl = SmartScriptTable(m_pSS);
  11.         m_tables.push(tbl);
  12. }
  13.  
  14. void CSerializeScriptTableWriterImpl::Value(const char* name, Vec3 value)
  15. {
  16.         SmartScriptTable newTable = ReuseTable(name);
  17.         newTable->SetValue("x", value.x);
  18.         newTable->SetValue("y", value.y);
  19.         newTable->SetValue("z", value.z);
  20. }
  21.  
  22. void CSerializeScriptTableWriterImpl::Value(const char* name, Vec2 value)
  23. {
  24.         SmartScriptTable newTable = ReuseTable(name);
  25.         newTable->SetValue("x", value.x);
  26.         newTable->SetValue("y", value.y);
  27. }
  28.  
  29. void CSerializeScriptTableWriterImpl::Value(const char* name, const SSerializeString& value)
  30. {
  31.         IScriptTable* pTbl = CurTable();
  32.         pTbl->SetValue(name, value.c_str());
  33. }
  34.  
  35. void CSerializeScriptTableWriterImpl::Value(const char* name, int64 value)
  36. {
  37.         // ignored, silently
  38. }
  39.  
  40. void CSerializeScriptTableWriterImpl::Value(const char* name, Quat value)
  41. {
  42.         SmartScriptTable newTable = ReuseTable(name);
  43.         newTable->SetValue("w", value.w);
  44.         newTable->SetValue("x", value.v.x);
  45.         newTable->SetValue("y", value.v.y);
  46.         newTable->SetValue("z", value.v.z);
  47. }
  48.  
  49. void CSerializeScriptTableWriterImpl::Value(const char* name, uint64 value)
  50. {
  51.         // ignored, silently
  52. }
  53.  
  54. void CSerializeScriptTableWriterImpl::Value(const char* name, CTimeValue value)
  55. {
  56.         Value(name, value.GetSeconds());
  57. }
  58.  
  59. bool CSerializeScriptTableWriterImpl::BeginGroup(const char* szName)
  60. {
  61.         SmartScriptTable newTable = ReuseTable(szName);
  62.         m_tables.push(newTable);
  63.         return true;
  64. }
  65.  
  66. void CSerializeScriptTableWriterImpl::EndGroup()
  67. {
  68.         m_tables.pop();
  69. }
  70.  
  71. SmartScriptTable CSerializeScriptTableWriterImpl::ReuseTable(const char* szName)
  72. {
  73.         IScriptTable* pTbl = CurTable();
  74.         ScriptAnyValue curVal;
  75.         pTbl->GetValueAny(szName, curVal);
  76.         SmartScriptTable newTable;
  77.         if (curVal.type == ANY_TTABLE)
  78.         {
  79.                 newTable = curVal.table;
  80.         }
  81.         else
  82.         {
  83.                 newTable = SmartScriptTable(m_pSS);
  84.                 pTbl->SetValue(szName, newTable);
  85.         }
  86.         return newTable;
  87. }
  88.  
downloadSerializeScriptTableWriter.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