From 8ecb0cd781c8c5ce4978a4cda3b368178ade560c Mon Sep 17 00:00:00 2001 From: D-AIRY <admin@ds-servers.com> Date: Thu, 27 Jun 2019 06:46:19 +0300 Subject: [PATCH] Small hotfix --- source/game/PropStatic.cpp | 22 +++++++++++++++++++++- source/game/PropStatic.h | 3 +++ source/geom/plugin_main.cpp | 3 ++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/source/game/PropStatic.cpp b/source/game/PropStatic.cpp index 5317ded5b..2d0a51f33 100644 --- a/source/game/PropStatic.cpp +++ b/source/game/PropStatic.cpp @@ -15,7 +15,7 @@ BEGIN_PROPTABLE(CPropStatic) DEFINE_FIELD_FLOATFN(m_fScale, 0, "scale", "Scale", onSetScale, EDITOR_TEXTFIELD) - DEFINE_FIELD_BOOL(m_useTrimeshPhysics, 0, "use_trimesh", "Use trimesh physics", EDITOR_COMBOBOX) + DEFINE_FIELD_BOOLFN(m_useTrimeshPhysics, 0, "use_trimesh", "Use trimesh physics", onSetUseTrimesh, EDITOR_COMBOBOX) COMBO_OPTION("Yes", "1") COMBO_OPTION("No", "0") EDITOR_COMBO_END() @@ -136,3 +136,23 @@ void CPropStatic::releasePhysics() mem_delete(m_pCollideShape); } } + +void CPropStatic::setModel(const char *mdl) +{ + BaseClass::setModel(mdl); + + if(m_pModel) + { + m_pModel->setScale(m_fScale); + } +} + +void CPropStatic::onSetUseTrimesh(bool use) +{ + if(m_useTrimeshPhysics != use) + { + m_useTrimeshPhysics = use; + releasePhysics(); + initPhysics(); + } +} diff --git a/source/game/PropStatic.h b/source/game/PropStatic.h index 38114fcb3..c4daf1191 100644 --- a/source/game/PropStatic.h +++ b/source/game/PropStatic.h @@ -30,8 +30,11 @@ public: void initPhysics() override; void releasePhysics() override; + + void setModel(const char *mdl) override; protected: void onSetScale(float fScale); + void onSetUseTrimesh(bool use); float m_fScale = 1.0f; bool m_useTrimeshPhysics = false; }; diff --git a/source/geom/plugin_main.cpp b/source/geom/plugin_main.cpp index 2cc8de71e..f8007d48f 100644 --- a/source/geom/plugin_main.cpp +++ b/source/geom/plugin_main.cpp @@ -149,7 +149,7 @@ public: fread(&(vRotation.x), sizeof(float), 1, pFile); fread(&(vRotation.y), sizeof(float), 1, pFile); fread(&(vRotation.z), sizeof(float), 1, pFile); - pEntity->setOrient(SMQuaternion(vRotation.x, 'x') * SMQuaternion(vRotation.y, 'y') * SMQuaternion(vRotation.z, 'z')); + pEntity->setOrient(SMQuaternion(-vRotation.x, 'x') * SMQuaternion(-vRotation.y, 'y') * SMQuaternion(-vRotation.z, 'z')); fread(&(vScale.x), sizeof(float), 1, pFile); fread(&(vScale.y), sizeof(float), 1, pFile); @@ -166,6 +166,7 @@ public: szStr[iStrLen + 7] = 0; pEntity->setKV("model", szStr); + pEntity->setFlags(pEntity->getFlags() | EF_LEVEL | EF_EXPORT); fseek(pFile, uNextBlock, SEEK_SET); -- GitLab