diff options
| author | Léo Lam <leo@leolam.fr> | 2021-04-24 11:17:43 +0200 |
|---|---|---|
| committer | Léo Lam <leo@leolam.fr> | 2021-04-24 11:18:14 +0200 |
| commit | 6deecbee61272dd4eca68c8b4043096d3ca61322 (patch) | |
| tree | d9e74da4c985809ff605b5676530af630a39e11f | |
| parent | 2fe382fb1a36de13d05dcb9c379787e0d38bb849 (diff) | |
ksys/phys: Add isSensorLayer and makeContactLayerMask
| -rw-r--r-- | data/uking_functions.csv | 4 | ||||
| -rw-r--r-- | src/KingSystem/Physics/System/physDefines.cpp | 10 | ||||
| -rw-r--r-- | src/KingSystem/Physics/System/physDefines.h | 3 |
3 files changed, 15 insertions, 2 deletions
diff --git a/data/uking_functions.csv b/data/uking_functions.csv index 4fe245aa..3da41102 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -79375,8 +79375,8 @@ 0x0000007100e93db0,sub_7100E93DB0,492, 0x0000007100e93f9c,NPCBase::m2,288, 0x0000007100e940bc,NPCBase::m3,92, -0x0000007100e94118,isGreaterThan0x1F,28, -0x0000007100e94134,getPowerOfTwo,44, +0x0000007100e94118,isGreaterThan0x1F,28,_ZN4ksys4phys13isSensorLayerENS0_12ContactLayerE +0x0000007100e94134,getPowerOfTwo,44,_ZN4ksys4phys20makeContactLayerMaskENS0_12ContactLayerE 0x0000007100e94160,sub_7100E94160,16, 0x0000007100e94170,sub_7100E94170,40, 0x0000007100e94198,sub_7100E94198,4,_ZN4ksys4phys18contactLayerToTextENS0_12ContactLayerE diff --git a/src/KingSystem/Physics/System/physDefines.cpp b/src/KingSystem/Physics/System/physDefines.cpp index 03be03a1..f6333608 100644 --- a/src/KingSystem/Physics/System/physDefines.cpp +++ b/src/KingSystem/Physics/System/physDefines.cpp @@ -2,6 +2,16 @@ namespace ksys::phys { +bool isSensorLayer(ContactLayer layer) { + return layer > ContactLayer::EntityEnd; +} + +u32 makeContactLayerMask(ContactLayer layer) { + if (layer < ContactLayer::SensorObject) + return 1 << layer; + return 1 << (layer - ContactLayer::SensorObject); +} + const char* contactLayerToText(ContactLayer layer) { return layer.text(); } diff --git a/src/KingSystem/Physics/System/physDefines.h b/src/KingSystem/Physics/System/physDefines.h index 51fe8bd5..4dd56af1 100644 --- a/src/KingSystem/Physics/System/physDefines.h +++ b/src/KingSystem/Physics/System/physDefines.h @@ -159,6 +159,9 @@ enum class MotionType { Unknown = 3, }; +bool isSensorLayer(ContactLayer layer); +u32 makeContactLayerMask(ContactLayer layer); + const char* contactLayerToText(ContactLayer layer); ContactLayer contactLayerFromText(const sead::SafeString& text); |
