diff --git a/source/game/PropStatic.cpp b/source/game/PropStatic.cpp index 5317ded5b23fed5d2d27a66da60b988bc55793a0..2d0a51f332a11073ab778c68d468207d456cba3a 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 38114fcb3e3045cff215b055e258058d7c90a12c..c4daf11915aa0193e885e04724ce391bc63de3ed 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 2cc8de71e9c58a07f2bc6180ebe88f25fa106761..f8007d48f2b3bfce74b416697962662125a9c7c4 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);