mirror of https://github.com/AxioDL/metaforce.git
CScriptVisorGoo: Brace conditionals where applicable
Makes the code consistent.
This commit is contained in:
parent
f78c85f37c
commit
d517db5c5d
|
@ -27,11 +27,13 @@ CScriptVisorGoo::CScriptVisorGoo(TUniqueId uid, std::string_view name, const CEn
|
||||||
, x110_farProb(farProb)
|
, x110_farProb(farProb)
|
||||||
, x114_color(color) {
|
, x114_color(color) {
|
||||||
x118_24_angleTest = !forceShow;
|
x118_24_angleTest = !forceShow;
|
||||||
if (particle.IsValid())
|
if (particle.IsValid()) {
|
||||||
xe8_particleDesc = g_SimplePool->GetObj(SObjectTag{FOURCC('PART'), particle});
|
xe8_particleDesc = g_SimplePool->GetObj(SObjectTag{FOURCC('PART'), particle});
|
||||||
if (electric.IsValid())
|
}
|
||||||
|
if (electric.IsValid()) {
|
||||||
xf0_electricDesc = g_SimplePool->GetObj(SObjectTag{FOURCC('ELSC'), electric});
|
xf0_electricDesc = g_SimplePool->GetObj(SObjectTag{FOURCC('ELSC'), electric});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CScriptVisorGoo::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
void CScriptVisorGoo::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
||||||
|
|
||||||
|
@ -40,11 +42,12 @@ void CScriptVisorGoo::Think(float, CStateManager& mgr) {
|
||||||
bool loaded = false;
|
bool loaded = false;
|
||||||
if (xfc_particleId.IsValid()) {
|
if (xfc_particleId.IsValid()) {
|
||||||
if (xe8_particleDesc.IsLoaded()) {
|
if (xe8_particleDesc.IsLoaded()) {
|
||||||
if (x100_electricId.IsValid())
|
if (x100_electricId.IsValid()) {
|
||||||
loaded = xf0_electricDesc.IsLoaded();
|
loaded = xf0_electricDesc.IsLoaded();
|
||||||
else
|
} else {
|
||||||
loaded = true;
|
loaded = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
loaded = xf0_electricDesc.IsLoaded();
|
loaded = xf0_electricDesc.IsLoaded();
|
||||||
}
|
}
|
||||||
|
@ -52,11 +55,11 @@ void CScriptVisorGoo::Think(float, CStateManager& mgr) {
|
||||||
if (loaded) {
|
if (loaded) {
|
||||||
bool showGoo = false;
|
bool showGoo = false;
|
||||||
if (mgr.GetPlayer().GetCameraState() == CPlayer::EPlayerCameraState::FirstPerson) {
|
if (mgr.GetPlayer().GetCameraState() == CPlayer::EPlayerCameraState::FirstPerson) {
|
||||||
zeus::CVector3f eyeToGoo = GetTranslation() - mgr.GetPlayer().GetEyePosition();
|
const zeus::CVector3f eyeToGoo = GetTranslation() - mgr.GetPlayer().GetEyePosition();
|
||||||
float eyeToGooDist = eyeToGoo.magnitude();
|
const float eyeToGooDist = eyeToGoo.magnitude();
|
||||||
if (eyeToGooDist >= x104_minDist && eyeToGooDist <= x108_maxDist) {
|
if (eyeToGooDist >= x104_minDist && eyeToGooDist <= x108_maxDist) {
|
||||||
if (x118_24_angleTest) {
|
if (x118_24_angleTest) {
|
||||||
float angle = zeus::radToDeg(
|
const float angle = zeus::radToDeg(
|
||||||
std::acos(mgr.GetCameraManager()->GetCurrentCameraTransform(mgr).basis[1].normalized().dot(
|
std::acos(mgr.GetCameraManager()->GetCurrentCameraTransform(mgr).basis[1].normalized().dot(
|
||||||
eyeToGoo.normalized())));
|
eyeToGoo.normalized())));
|
||||||
float angleThresh = 45.f;
|
float angleThresh = 45.f;
|
||||||
|
@ -64,13 +67,14 @@ void CScriptVisorGoo::Think(float, CStateManager& mgr) {
|
||||||
angleThresh *= 4.f / eyeToGooDist;
|
angleThresh *= 4.f / eyeToGooDist;
|
||||||
angleThresh = std::min(90.f, angleThresh);
|
angleThresh = std::min(90.f, angleThresh);
|
||||||
}
|
}
|
||||||
if (angle <= angleThresh)
|
if (angle <= angleThresh) {
|
||||||
showGoo = true;
|
showGoo = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
showGoo = true;
|
showGoo = true;
|
||||||
}
|
}
|
||||||
if (showGoo) {
|
if (showGoo) {
|
||||||
float t = (x108_maxDist - eyeToGooDist) / (x108_maxDist - x104_minDist);
|
const float t = (x108_maxDist - eyeToGooDist) / (x108_maxDist - x104_minDist);
|
||||||
if (mgr.GetActiveRandom()->Float() * 100.f <= (1.f - t) * x110_farProb + t * x10c_nearProb) {
|
if (mgr.GetActiveRandom()->Float() * 100.f <= (1.f - t) * x110_farProb + t * x10c_nearProb) {
|
||||||
mgr.AddObject(new CHUDBillboardEffect(
|
mgr.AddObject(new CHUDBillboardEffect(
|
||||||
xfc_particleId.IsValid() ? std::make_optional(xe8_particleDesc) : std::nullopt,
|
xfc_particleId.IsValid() ? std::make_optional(xe8_particleDesc) : std::nullopt,
|
||||||
|
@ -90,10 +94,12 @@ void CScriptVisorGoo::Think(float, CStateManager& mgr) {
|
||||||
void CScriptVisorGoo::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& mgr) {
|
void CScriptVisorGoo::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& mgr) {
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
case EScriptObjectMessage::Activate:
|
case EScriptObjectMessage::Activate:
|
||||||
if (xfc_particleId.IsValid())
|
if (xfc_particleId.IsValid()) {
|
||||||
xe8_particleDesc.Lock();
|
xe8_particleDesc.Lock();
|
||||||
if (x100_electricId.IsValid())
|
}
|
||||||
|
if (x100_electricId.IsValid()) {
|
||||||
xf0_electricDesc.Lock();
|
xf0_electricDesc.Lock();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue