Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing collision functions and clean up #245

Merged
merged 1 commit into from
Mar 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions source/game/field/CollisionDirector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ namespace Field {

/// @addr{0x8078E4F0}
void CollisionDirector::checkCourseColNarrScLocal(f32 radius, const EGG::Vector3f &pos,
KCLTypeMask mask, u32 /*unused*/) {
KCLTypeMask mask, u32 /*timeOffset*/) {
CourseColMgr::Instance()->scaledNarrowScopeLocal(1.0f, radius, nullptr, pos, mask);
}

/// @addr{0x8078F500}
bool CollisionDirector::checkSphereFull(f32 radius, const EGG::Vector3f &v0,
const EGG::Vector3f &v1, KCLTypeMask flags, CourseColMgr::CollisionInfo *pInfo,
KCLTypeMask *pFlagsOut, u32 /*start*/) {
KCLTypeMask *pFlagsOut, u32 /*timeOffset*/) {
if (pInfo) {
pInfo->bbox.min = EGG::Vector3f::zero;
pInfo->bbox.max = EGG::Vector3f::zero;
Expand Down Expand Up @@ -57,7 +57,7 @@ bool CollisionDirector::checkSphereFull(f32 radius, const EGG::Vector3f &v0,
/// @addr{0x8078F784}
bool CollisionDirector::checkSphereFullPush(f32 radius, const EGG::Vector3f &v0,
const EGG::Vector3f &v1, KCLTypeMask flags, CourseColMgr::CollisionInfo *pInfo,
KCLTypeMask *pFlagsOut, u32 /*param_8*/) {
KCLTypeMask *pFlagsOut, u32 /*timeOffset*/) {
if (pInfo) {
pInfo->bbox.setZero();
pInfo->_50 = -std::numeric_limits<f32>::min();
Expand Down Expand Up @@ -101,11 +101,11 @@ bool CollisionDirector::checkSphereFullPush(f32 radius, const EGG::Vector3f &v0,
}

/// @addr{0x807901F0}
bool CollisionDirector::checkSphereCachedPartial(const EGG::Vector3f &pos,
const EGG::Vector3f &prevPos, KCLTypeMask typeMask, CourseColMgr::CollisionInfo *colInfo,
KCLTypeMask *typeMaskOut, f32 radius) {
if (colInfo) {
colInfo->bbox.setZero();
bool CollisionDirector::checkSphereCachedPartial(f32 radius, const EGG::Vector3f &pos,
const EGG::Vector3f &prevPos, KCLTypeMask typeMask,
CourseColMgr::CollisionInfoPartial *info, KCLTypeMask *typeMaskOut, u32 /*timeOffset*/) {
if (info) {
info->bbox.setZero();
}

if (typeMaskOut) {
Expand All @@ -119,12 +119,12 @@ bool CollisionDirector::checkSphereCachedPartial(const EGG::Vector3f &pos,
noBounceInfo->dist = std::numeric_limits<f32>::min();
}

bool hasCourseCol = courseColMgr->checkSphereCachedPartial(nullptr, pos, prevPos, typeMask,
colInfo, typeMaskOut, 1.0f, radius);
bool hasCourseCol = courseColMgr->checkSphereCachedPartial(1.0f, radius, nullptr, pos, prevPos,
typeMask, info, typeMaskOut);

if (hasCourseCol) {
if (colInfo) {
colInfo->tangentOff = colInfo->bbox.min + colInfo->bbox.max;
if (info) {
info->tangentOff = info->bbox.min + info->bbox.max;
}

if (noBounceInfo) {
Expand All @@ -138,11 +138,11 @@ bool CollisionDirector::checkSphereCachedPartial(const EGG::Vector3f &pos,
}

/// @addr{0x807903BC}
bool CollisionDirector::checkSphereCachedPartialPush(const EGG::Vector3f &pos,
const EGG::Vector3f &prevPos, KCLTypeMask typeMask, CourseColMgr::CollisionInfo *colInfo,
KCLTypeMask *typeMaskOut, f32 radius, u32 /*start*/) {
if (colInfo) {
colInfo->bbox.setZero();
bool CollisionDirector::checkSphereCachedPartialPush(f32 radius, const EGG::Vector3f &pos,
const EGG::Vector3f &prevPos, KCLTypeMask typeMask,
CourseColMgr::CollisionInfoPartial *info, KCLTypeMask *typeMaskOut, u32 /*timeOffset*/) {
if (info) {
info->bbox.setZero();
}

if (typeMaskOut) {
Expand All @@ -156,18 +156,18 @@ bool CollisionDirector::checkSphereCachedPartialPush(const EGG::Vector3f &pos,
noBounceInfo->dist = std::numeric_limits<f32>::min();
}

bool hasCourseCol = courseColMgr->checkSphereCachedPartialPush(nullptr, pos, prevPos, typeMask,
colInfo, typeMaskOut, 1.0f, radius);
bool hasCourseCol = courseColMgr->checkSphereCachedPartialPush(1.0f, radius, nullptr, pos,
prevPos, typeMask, info, typeMaskOut);

courseColMgr->clearNoBounceWallInfo();

return hasCourseCol;
}

/// @addr{0x807907F8}
bool CollisionDirector::checkSphereCachedFullPush(const EGG::Vector3f &pos,
bool CollisionDirector::checkSphereCachedFullPush(f32 radius, const EGG::Vector3f &pos,
const EGG::Vector3f &prevPos, KCLTypeMask typeMask, CourseColMgr::CollisionInfo *colInfo,
KCLTypeMask *typeMaskOut, f32 radius, u32 /*start*/) {
KCLTypeMask *typeMaskOut, u32 /*timeOffset*/) {
if (colInfo) {
colInfo->bbox.min.setZero();
colInfo->bbox.max.setZero();
Expand All @@ -188,8 +188,8 @@ bool CollisionDirector::checkSphereCachedFullPush(const EGG::Vector3f &pos,
info->dist = std::numeric_limits<f32>::min();
}

bool hasCourseCol = courseColMgr->checkSphereCachedFullPush(nullptr, pos, prevPos, typeMask,
colInfo, typeMaskOut, 1.0f, radius);
bool hasCourseCol = courseColMgr->checkSphereCachedFullPush(1.0f, radius, nullptr, pos, prevPos,
typeMask, colInfo, typeMaskOut);

if (hasCourseCol) {
if (colInfo) {
Expand Down
20 changes: 10 additions & 10 deletions source/game/field/CollisionDirector.hh
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,24 @@ public:
};

void checkCourseColNarrScLocal(f32 radius, const EGG::Vector3f &pos, KCLTypeMask mask,
u32 /*unused*/);
u32 timeOffset);

[[nodiscard]] bool checkSphereFull(f32 radius, const EGG::Vector3f &v0, const EGG::Vector3f &v1,
KCLTypeMask flags, CourseColMgr::CollisionInfo *pInfo, KCLTypeMask *pFlagsOut,
u32 /*start*/);
u32 timeOffset);
[[nodiscard]] bool checkSphereFullPush(f32 radius, const EGG::Vector3f &v0,
const EGG::Vector3f &v1, KCLTypeMask flags, CourseColMgr::CollisionInfo *pInfo,
KCLTypeMask *pFlagsOut, u32 /*start*/);
KCLTypeMask *pFlagsOut, u32 timeOffset);

[[nodiscard]] bool checkSphereCachedPartial(const EGG::Vector3f &pos,
[[nodiscard]] bool checkSphereCachedPartial(f32 radius, const EGG::Vector3f &pos,
const EGG::Vector3f &prevPos, KCLTypeMask typeMask,
CourseColMgr::CollisionInfo *colInfo, KCLTypeMask *typeMaskOut, f32 radius);
[[nodiscard]] bool checkSphereCachedPartialPush(const EGG::Vector3f &pos,
CourseColMgr::CollisionInfoPartial *info, KCLTypeMask *typeMaskOut, u32 timeOffset);
[[nodiscard]] bool checkSphereCachedPartialPush(f32 radius, const EGG::Vector3f &pos,
const EGG::Vector3f &prevPos, KCLTypeMask typeMask,
CourseColMgr::CollisionInfo *colInfo, KCLTypeMask *typeMaskOut, f32 radius, u32 start);
[[nodiscard]] bool checkSphereCachedFullPush(const EGG::Vector3f &pos,
const EGG::Vector3f &prevPos, KCLTypeMask typeMask,
CourseColMgr::CollisionInfo *colInfo, KCLTypeMask *typeMaskOut, f32 radius, u32 start);
CourseColMgr::CollisionInfoPartial *info, KCLTypeMask *typeMaskOut, u32 timeOffset);
[[nodiscard]] bool checkSphereCachedFullPush(f32 radius, const EGG::Vector3f &pos,
const EGG::Vector3f &prevPos, KCLTypeMask typeMask, CourseColMgr::CollisionInfo *info,
KCLTypeMask *typeMaskOut, u32 timeOffset);

void resetCollisionEntries(KCLTypeMask *ptr);
void pushCollisionEntry(f32 dist, KCLTypeMask *typeMask, KCLTypeMask kclTypeBit, u16 attribute);
Expand Down
Loading