From 54e2e23a86191766b15f35c280fafc9ed7afe32a Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Thu, 6 Oct 2022 11:26:18 -0700 Subject: [PATCH] Match and link CMaterialFilter/List Former-commit-id: 480e975add42d7f45db55f5b961a76ed1094a9ee --- configure.py | 1 + include/Collision/CMaterialList.hpp | 4 ++-- obj_files.mk | 4 ++-- src/Collision/CMaterialFilter.cpp | 15 ++++----------- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/configure.py b/configure.py index 0138c52b..3b613099 100755 --- a/configure.py +++ b/configure.py @@ -29,6 +29,7 @@ COMPLETE_OBJECTS = [ "MetroidPrime/ScriptObjects/CScriptDebugCameraWaypoint", "Weapons/IWeaponRenderer", "Collision/CMaterialList", + "Collision/CMaterialFilter", "Collision/CMRay", "Kyoto/Basics/CStopwatch", "Kyoto/Basics/COsContextDolphin", diff --git a/include/Collision/CMaterialList.hpp b/include/Collision/CMaterialList.hpp index 8c1fe409..cc647591 100644 --- a/include/Collision/CMaterialList.hpp +++ b/include/Collision/CMaterialList.hpp @@ -118,8 +118,8 @@ public: // Intersection__13CMaterialListCFRC13CMaterialList weak static s32 BitPosition(u64 flags); // GetMaterialString__13CMaterialListCFv weak - u64 SharesMaterials(const CMaterialList& other) const { - return (other.value & value); + bool SharesMaterials(const CMaterialList& other) const { + return (other.value & value) ? true : false; } private: diff --git a/obj_files.mk b/obj_files.mk index fd9bedb6..9be9e7f4 100644 --- a/obj_files.mk +++ b/obj_files.mk @@ -410,10 +410,10 @@ COLLISION :=\ $(BUILD_DIR)/asm/Collision/CCollisionInfo.o\ $(BUILD_DIR)/asm/Collision/InternalColliders.o\ $(BUILD_DIR)/asm/Collision/CCollisionPrimitive.o\ - $(BUILD_DIR)/asm/Collision/CMaterialList.o\ + $(BUILD_DIR)/src/Collision/CMaterialList.o\ $(BUILD_DIR)/asm/Collision/CollisionUtil.o\ $(BUILD_DIR)/asm/Collision/CCollidableSphere.o\ - $(BUILD_DIR)/asm/Collision/CMaterialFilter.o\ + $(BUILD_DIR)/src/Collision/CMaterialFilter.o\ $(BUILD_DIR)/asm/Collision/COBBox.o\ $(BUILD_DIR)/src/Collision/CMRay.o\ diff --git a/src/Collision/CMaterialFilter.cpp b/src/Collision/CMaterialFilter.cpp index 0a4668cf..d0714596 100644 --- a/src/Collision/CMaterialFilter.cpp +++ b/src/Collision/CMaterialFilter.cpp @@ -7,18 +7,11 @@ bool CMaterialFilter::Passes(const CMaterialList& other) const { case kFT_Always: return true; case kFT_Include: - return other.SharesMaterials(include) != 0 ? true : false; + return other.SharesMaterials(include); case kFT_Exclude: - return other.SharesMaterials(exclude) == 0; - case kFT_IncludeExclude: { - bool ret = false; - if (other.SharesMaterials(include) != 0) { - if (other.SharesMaterials(exclude) == 0) { - ret = true; - } - } - return ret; - } + return !other.SharesMaterials(exclude); + case kFT_IncludeExclude: + return other.SharesMaterials(include) && !other.SharesMaterials(exclude); default: return true; }