mirror of https://github.com/AxioDL/metaforce.git
Merge pull request #247 from lioncash/sign-mismatch
CFlameThrower: Resolve sign-conversion warnings in DoCollisionCheck()
This commit is contained in:
commit
a7b2ad15dc
|
@ -139,49 +139,62 @@ CRayCastResult CFlameThrower::DoCollisionCheck(TUniqueId& idOut, const zeus::CAA
|
||||||
rstl::reserved_vector<TUniqueId, 1024> nearList;
|
rstl::reserved_vector<TUniqueId, 1024> nearList;
|
||||||
mgr.BuildNearList(nearList, aabb, CMaterialFilter::skPassEverything, this);
|
mgr.BuildNearList(nearList, aabb, CMaterialFilter::skPassEverything, this);
|
||||||
const auto& colPoints = x34c_flameWarp.GetCollisionPoints();
|
const auto& colPoints = x34c_flameWarp.GetCollisionPoints();
|
||||||
if (x400_27_coneCollision && colPoints.size() > 0) {
|
|
||||||
float radiusPitch = (x34c_flameWarp.GetMaxSize() - x34c_flameWarp.GetMinSize()) /
|
if (x400_27_coneCollision && !colPoints.empty()) {
|
||||||
float(colPoints.size()) * 0.5f;
|
const float radiusPitch =
|
||||||
|
(x34c_flameWarp.GetMaxSize() - x34c_flameWarp.GetMinSize()) / float(colPoints.size()) * 0.5f;
|
||||||
float curRadius = radiusPitch;
|
float curRadius = radiusPitch;
|
||||||
for (int i = 1; i < colPoints.size(); ++i) {
|
|
||||||
zeus::CVector3f delta = colPoints[i] - colPoints[i - 1];
|
for (size_t i = 1; i < colPoints.size(); ++i) {
|
||||||
|
const zeus::CVector3f delta = colPoints[i] - colPoints[i - 1];
|
||||||
zeus::CTransform lookXf = zeus::lookAt(colPoints[i - 1], colPoints[i]);
|
zeus::CTransform lookXf = zeus::lookAt(colPoints[i - 1], colPoints[i]);
|
||||||
lookXf.origin = delta * 0.5f + colPoints[i - 1];
|
lookXf.origin = delta * 0.5f + colPoints[i - 1];
|
||||||
zeus::COBBox obb(lookXf, {curRadius, delta.magnitude() * 0.5f, curRadius});
|
const zeus::COBBox obb(lookXf, {curRadius, delta.magnitude() * 0.5f, curRadius});
|
||||||
for (TUniqueId id : nearList) {
|
|
||||||
if (CActor* act = static_cast<CActor*>(mgr.ObjectById(id))) {
|
for (const TUniqueId id : nearList) {
|
||||||
CProjectileTouchResult tres = CanCollideWith(*act, mgr);
|
if (auto* act = static_cast<CActor*>(mgr.ObjectById(id))) {
|
||||||
if (tres.GetActorId() == kInvalidUniqueId)
|
const CProjectileTouchResult tres = CanCollideWith(*act, mgr);
|
||||||
|
if (tres.GetActorId() == kInvalidUniqueId) {
|
||||||
continue;
|
continue;
|
||||||
auto tb = act->GetTouchBounds();
|
}
|
||||||
if (!tb)
|
|
||||||
|
const auto tb = act->GetTouchBounds();
|
||||||
|
if (!tb) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (obb.AABoxIntersectsBox(*tb)) {
|
if (obb.AABoxIntersectsBox(*tb)) {
|
||||||
CCollidableAABox caabb(*tb, act->GetMaterialList());
|
const CCollidableAABox caabb(*tb, act->GetMaterialList());
|
||||||
zeus::CVector3f flameToAct = act->GetAimPosition(mgr, 0.f) - x2e8_flameXf.origin;
|
const zeus::CVector3f flameToAct = act->GetAimPosition(mgr, 0.f) - x2e8_flameXf.origin;
|
||||||
float flameToActDist = flameToAct.magnitude();
|
const float flameToActDist = flameToAct.magnitude();
|
||||||
CInternalRayCastStructure rc(x2e8_flameXf.origin, flameToAct.normalized(), flameToActDist,
|
const CInternalRayCastStructure rc(x2e8_flameXf.origin, flameToAct.normalized(), flameToActDist, {},
|
||||||
{}, CMaterialFilter::skPassEverything);
|
CMaterialFilter::skPassEverything);
|
||||||
CRayCastResult cres = caabb.CastRayInternal(rc);
|
const CRayCastResult cres = caabb.CastRayInternal(rc);
|
||||||
if (cres.IsInvalid())
|
if (cres.IsInvalid()) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
return cres;
|
return cres;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
curRadius += radiusPitch;
|
curRadius += radiusPitch;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < colPoints.size() - 1; ++i) {
|
for (size_t i = 0; i < colPoints.size() - 1; ++i) {
|
||||||
zeus::CVector3f delta = colPoints[i + 1] - colPoints[i];
|
const zeus::CVector3f delta = colPoints[i + 1] - colPoints[i];
|
||||||
float deltaMag = delta.magnitude();
|
const float deltaMag = delta.magnitude();
|
||||||
if (deltaMag <= 0.f)
|
if (deltaMag <= 0.f) {
|
||||||
break;
|
break;
|
||||||
CRayCastResult cres = RayCollisionCheckWithWorld(idOut, colPoints[i], colPoints[i + 1], deltaMag, nearList, mgr);
|
}
|
||||||
if (cres.IsValid())
|
|
||||||
|
const CRayCastResult cres = RayCollisionCheckWithWorld(idOut, colPoints[i], colPoints[i + 1], deltaMag, nearList, mgr);
|
||||||
|
if (cres.IsValid()) {
|
||||||
return cres;
|
return cres;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue