From d10dd65dcd371c87012b31700a871a8d6c5a9aa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Sat, 30 Oct 2021 12:38:27 +0200 Subject: ksys/phys: Add some prerequisites for ContactInfoTable --- src/KingSystem/Physics/System/physDefines.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/KingSystem/Physics/System/physDefines.cpp') diff --git a/src/KingSystem/Physics/System/physDefines.cpp b/src/KingSystem/Physics/System/physDefines.cpp index 16cb9503..94fd34d3 100644 --- a/src/KingSystem/Physics/System/physDefines.cpp +++ b/src/KingSystem/Physics/System/physDefines.cpp @@ -12,6 +12,17 @@ u32 makeContactLayerMask(ContactLayer layer) { return 1 << (layer - ContactLayer::SensorObject); } +u32 getContactLayerBase(ContactLayerType type) { + if (type == ContactLayerType::Entity) + return ContactLayer::EntityObject; + return ContactLayer::SensorObject; +} + +u32 getContactLayerBaseRelativeValue(ContactLayer layer) { + return layer - (layer < ContactLayer::SensorObject ? ContactLayer::EntityObject : + ContactLayer::SensorObject); +} + const char* contactLayerToText(ContactLayer layer) { return layer.text(); } -- cgit v1.2.3