Merge remote-tracking branch 'origin/collison-fixes'

This commit is contained in:
Luke Street 2021-05-02 18:38:09 -04:00
commit 003c6d2f3f
3 changed files with 20 additions and 13 deletions

View File

@ -18,7 +18,9 @@
#include "TCastTo.hpp" // Generated file, do not modify include path #include "TCastTo.hpp" // Generated file, do not modify include path
namespace metaforce { namespace metaforce {
namespace {
static constexpr bool skPlayerUsesNewColliderLogic = true;
}
static float CollisionImpulseFiniteVsInfinite(float mass, float velNormDot, float restitution) { static float CollisionImpulseFiniteVsInfinite(float mass, float velNormDot, float restitution) {
return mass * -(1.f + restitution) * velNormDot; return mass * -(1.f + restitution) * velNormDot;
} }
@ -60,13 +62,16 @@ void CGameCollision::MovePlayer(CStateManager& mgr, CPhysicsActor& actor, float
const rstl::reserved_vector<TUniqueId, 1024>* colliderList) { const rstl::reserved_vector<TUniqueId, 1024>* colliderList) {
actor.SetAngularEnabled(true); actor.SetAngularEnabled(true);
actor.AddMotionState(actor.PredictAngularMotion(dt)); actor.AddMotionState(actor.PredictAngularMotion(dt));
if (actor.IsUseStandardCollider()) { if (!actor.IsUseStandardCollider()) {
MoveAndCollide(mgr, actor, dt, CBallFilter(actor), colliderList); if (!actor.GetMaterialList().HasMaterial(EMaterialTypes::GroundCollider)) {
} else {
if (actor.GetMaterialList().HasMaterial(EMaterialTypes::GroundCollider))
CGroundMovement::MoveGroundCollider_New(mgr, actor, dt, colliderList);
else
MoveAndCollide(mgr, actor, dt, CBallFilter(actor), colliderList); MoveAndCollide(mgr, actor, dt, CBallFilter(actor), colliderList);
} else if (skPlayerUsesNewColliderLogic) {
CGroundMovement::MoveGroundCollider_New(mgr, actor, dt, colliderList);
} else {
CGroundMovement::MoveGroundCollider(mgr, actor, dt, colliderList);
}
} else {
MoveAndCollide(mgr, actor, dt, CBallFilter(actor), colliderList);
} }
actor.SetAngularEnabled(false); actor.SetAngularEnabled(false);
} }
@ -722,13 +727,14 @@ bool CGameCollision::DetectDynamicCollisionMoving(const CCollisionPrimitive& pri
return ret; return ret;
} }
bool CGameCollision::DetectCollision(const CStateManager& mgr, const CCollisionPrimitive& prim, const zeus::CTransform& xf, bool CGameCollision::DetectCollision(const CStateManager& mgr, const CCollisionPrimitive& prim,
const CMaterialFilter& filter, const rstl::reserved_vector<TUniqueId, 1024>& nearList, const zeus::CTransform& xf, const CMaterialFilter& filter,
TUniqueId& idOut, CCollisionInfoList& infoOut) { const rstl::reserved_vector<TUniqueId, 1024>& nearList, TUniqueId& idOut,
CCollisionInfoList& infoOut) {
bool ret = false; bool ret = false;
CMaterialList exclude = filter.ExcludeList(); CMaterialList exclude = filter.ExcludeList();
if (!exclude.HasMaterial(EMaterialTypes::Occluder) && DetectStaticCollision(mgr, prim, xf, filter, infoOut)) { if (!exclude.HasMaterial(EMaterialTypes::Occluder) && DetectStaticCollision(mgr, prim, xf, filter, infoOut)) {
ret = true; ret = true;
} }
TUniqueId tmpId = kInvalidUniqueId; TUniqueId tmpId = kInvalidUniqueId;

View File

@ -32,8 +32,9 @@ ECardResult CMemoryCardDriver::SFileInfo::StartRead() {
ECardResult CMemoryCardDriver::SFileInfo::TryFileRead() { ECardResult CMemoryCardDriver::SFileInfo::TryFileRead() {
ECardResult res = CMemoryCardSys::GetResultCode(GetFileCardPort()); ECardResult res = CMemoryCardSys::GetResultCode(GetFileCardPort());
if (res == ECardResult::READY) if (res == ECardResult::READY) {
res = FileRead(); res = FileRead();
}
return res; return res;
} }

2
extern/kabufuda vendored

@ -1 +1 @@
Subproject commit 106bb02fbf6e482af2621f9b5e3ea099fcf1d53a Subproject commit 1111fb48397534f86c61db3b681cbcfef583f019