diff --git a/src/Core/Resource/CCollisionMaterial.cpp b/src/Core/Resource/CCollisionMaterial.cpp index c7e5abcd..0a23e4aa 100644 --- a/src/Core/Resource/CCollisionMaterial.cpp +++ b/src/Core/Resource/CCollisionMaterial.cpp @@ -1,5 +1,6 @@ #include "CCollisionMaterial.h" #include "EGame.h" +#include #include ECollisionFlag CCollisionMaterial::SurfaceType(EGame Game) const @@ -71,3 +72,14 @@ CColor CCollisionMaterial::SurfaceColor(EGame Game) const auto FindColor = gkTypeToColor.find(SurfType); return (FindColor == gkTypeToColor.end() ? CColor::skWhite : FindColor->second); } + +bool CCollisionMaterial::IsFloor() const +{ + return HasFlag(eCF_Floor) && !HasFlag(eCF_JumpNotAllowed); +} + +bool CCollisionMaterial::IsUnstandable(EGame Game) const +{ + BREAK_ONLY_ASSERT(!HasFlag(eCF_Wood)); + return HasFlag(eCF_JumpNotAllowed) || (Game >= eEchoesDemo && !HasFlag(eCF_Floor) && HasAnyFlags(eCF_Wall | eCF_Ceiling)); +} diff --git a/src/Core/Resource/CCollisionMaterial.h b/src/Core/Resource/CCollisionMaterial.h index bcb78114..d07be371 100644 --- a/src/Core/Resource/CCollisionMaterial.h +++ b/src/Core/Resource/CCollisionMaterial.h @@ -41,11 +41,11 @@ enum ECollisionFlag eCF_ScanThru = 0x01000000, eCF_AiWalkThru = 0x02000000, eCF_FlippedTri = 0x04000000, - eCF_Floor = 0x08000000, - eCF_AiBlock = 0x10000000, - eCF_JumpNotAllowed = 0x20000000, - eCF_SpiderBall = 0x40000000, - eCF_WallJump = 0x80000000 + eCF_Ceiling = 0x08000000, + eCF_Wall = 0x10000000, + eCF_Floor = 0x20000000, + eCF_AiBlock = 0x40000000, + eCF_JumpNotAllowed = 0x80000000 }; class CCollisionMaterial : public TFlags @@ -56,6 +56,8 @@ class CCollisionMaterial : public TFlags public: ECollisionFlag SurfaceType(EGame Game) const; CColor SurfaceColor(EGame Game) const; + bool IsFloor() const; + bool IsUnstandable(EGame Game) const; inline u64 RawFlags() const { return mRawFlags; } }; diff --git a/src/Core/Resource/Factory/CCollisionLoader.cpp b/src/Core/Resource/Factory/CCollisionLoader.cpp index c3bd78a6..4f122537 100644 --- a/src/Core/Resource/Factory/CCollisionLoader.cpp +++ b/src/Core/Resource/Factory/CCollisionLoader.cpp @@ -66,6 +66,8 @@ void CCollisionLoader::ReadPropertyFlags(IInputStream& rSrc) if (RawFlags & 0x02000000) Material |= eCF_FlippedTri; if (RawFlags & 0x08000000) Material |= eCF_ScanThru; if (RawFlags & 0x10000000) Material |= eCF_AiWalkThru; + if (RawFlags & 0x20000000) Material |= eCF_Ceiling; + if (RawFlags & 0x40000000) Material |= eCF_Wall; if (RawFlags & 0x80000000) Material |= eCF_Floor; } @@ -95,12 +97,12 @@ void CCollisionLoader::ReadPropertyFlags(IInputStream& rSrc) if (RawFlags & 0x02000000) Material |= eCF_Rubber; if (RawFlags & 0x08000000) Material |= eCF_ScanThru; if (RawFlags & 0x10000000) Material |= eCF_AiWalkThru; + if (RawFlags & 0x20000000) Material |= eCF_Ceiling; + if (RawFlags & 0x40000000) Material |= eCF_Wall; if (RawFlags & 0x80000000) Material |= eCF_Floor; if (RawFlags & 0x0001000000000000) Material |= eCF_AiBlock; if (RawFlags & 0x0400000000000000) Material |= eCF_JumpNotAllowed; - if (RawFlags & 0x2000000000000000) Material |= eCF_SpiderBall; - if (RawFlags & 0x4000000000000000) Material |= eCF_WallJump; } else if (mVersion == eReturns) diff --git a/src/Core/Scene/CCollisionNode.cpp b/src/Core/Scene/CCollisionNode.cpp index fcd0b65b..8e549e0c 100644 --- a/src/Core/Scene/CCollisionNode.cpp +++ b/src/Core/Scene/CCollisionNode.cpp @@ -68,8 +68,8 @@ void CCollisionNode::Draw(FRenderOptions /*Options*/, int /*ComponentIndex*/, ER else if (CollisionGame != eReturns && rkViewInfo.CollisionSettings.TintWithSurfaceColor) Tint *= rMat.SurfaceColor(CollisionGame); - bool IsFloor = (rkViewInfo.CollisionSettings.TintUnwalkableTris ? rMat.HasFlag(eCF_Floor) : true) || CollisionGame == eReturns; - bool IsUnstandable = (rkViewInfo.CollisionSettings.TintUnwalkableTris ? rMat.HasFlag(eCF_JumpNotAllowed) : false) && CollisionGame != eReturns; + bool IsFloor = (rkViewInfo.CollisionSettings.TintUnwalkableTris ? rMat.IsFloor() : true) || CollisionGame == eReturns; + bool IsUnstandable = (rkViewInfo.CollisionSettings.TintUnwalkableTris ? rMat.IsUnstandable(CollisionGame) : false) && CollisionGame != eReturns; CDrawUtil::UseCollisionShader(IsFloor, IsUnstandable, Tint); pMesh->DrawMaterial(iMat, false);