diff options
Diffstat (limited to 'src/KingSystem/Physics/System/physSystem.h')
| -rw-r--r-- | src/KingSystem/Physics/System/physSystem.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/KingSystem/Physics/System/physSystem.h b/src/KingSystem/Physics/System/physSystem.h index 6b130476..1f9647c1 100644 --- a/src/KingSystem/Physics/System/physSystem.h +++ b/src/KingSystem/Physics/System/physSystem.h @@ -86,8 +86,11 @@ public: void removeSystemGroupHandler(SystemGroupHandler* handler); hkpWorld* getHavokWorld(ContactLayerType type) const; + + // 0x0000007101215754 void lockWorld(ContactLayerType type, const char* description = nullptr, int b = 0, OnlyLockIfNeeded only_lock_if_needed = OnlyLockIfNeeded::No); + // 0x0000007101215784 void unlockWorld(ContactLayerType type, const char* description = nullptr, int b = 0, OnlyLockIfNeeded only_lock_if_needed = OnlyLockIfNeeded::No); @@ -146,4 +149,27 @@ private: }; KSYS_CHECK_SIZE_NX150(System, 0x480); +class ScopedWorldLock { +public: + explicit ScopedWorldLock(ContactLayerType type, const char* description = nullptr, int unk = 0, + OnlyLockIfNeeded only_lock_if_needed = OnlyLockIfNeeded::No) + : mType(type), mDescription(description), mUnk(unk), + mOnlyLockIfNeeded(only_lock_if_needed) { + System::instance()->lockWorld(mType, mDescription, mUnk, mOnlyLockIfNeeded); + } + + ~ScopedWorldLock() { + System::instance()->unlockWorld(mType, mDescription, mUnk, mOnlyLockIfNeeded); + } + + ScopedWorldLock(const ScopedWorldLock&) = delete; + auto operator=(const ScopedWorldLock&) = delete; + +private: + ContactLayerType mType; + const char* mDescription; + int mUnk; + OnlyLockIfNeeded mOnlyLockIfNeeded; +}; + } // namespace ksys::phys |
