mirror of https://github.com/AxioDL/metaforce.git
CGrappleArm: Invert conditionals where applicable
Makes early-exit conditions nicer to follow and also unindents some code.
This commit is contained in:
parent
823c01ce12
commit
2b2edfa871
|
@ -185,43 +185,55 @@ void CGrappleArm::GrappleBeamConnected() {
|
|||
}
|
||||
|
||||
void CGrappleArm::RenderGrappleBeam(const CStateManager& mgr, const zeus::CVector3f& pos) {
|
||||
if (x3b2_24_active && !x3b2_29_suitLoading) {
|
||||
zeus::CTransform tmpXf = zeus::CTransform::Translate(pos) * x220_xf;
|
||||
if (x3b2_25_beamActive) {
|
||||
if (x3b2_26_grappleHit)
|
||||
if (!x3b2_24_active || x3b2_29_suitLoading) {
|
||||
return;
|
||||
}
|
||||
|
||||
const zeus::CTransform tmpXf = zeus::CTransform::Translate(pos) * x220_xf;
|
||||
if (!x3b2_25_beamActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (x3b2_26_grappleHit) {
|
||||
x398_grappleHitGen->Render();
|
||||
}
|
||||
|
||||
x394_grappleClawGen->Render();
|
||||
x3a0_grappleSwooshGen->Render();
|
||||
x390_grappleSegmentGen->Render();
|
||||
zeus::CTransform backupViewMtx = CGraphics::g_ViewMatrix;
|
||||
const zeus::CTransform backupViewMtx = CGraphics::g_ViewMatrix;
|
||||
CGraphics::SetViewPointMatrix(tmpXf.inverse() * backupViewMtx);
|
||||
CGraphics::SetModelMatrix(zeus::CTransform());
|
||||
x39c_grappleMuzzleGen->Render();
|
||||
CGraphics::SetViewPointMatrix(backupViewMtx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CGrappleArm::TouchModel(const CStateManager& mgr) const {
|
||||
if (x3b2_24_active && !x3b2_29_suitLoading) {
|
||||
if (!x3b2_24_active || x3b2_29_suitLoading) {
|
||||
return;
|
||||
}
|
||||
|
||||
x0_grappleArmModel->Touch(mgr, 0);
|
||||
if (x50_grappleArmSkeletonModel)
|
||||
if (x50_grappleArmSkeletonModel) {
|
||||
x50_grappleArmSkeletonModel->Touch(mgr, 0);
|
||||
}
|
||||
|
||||
if (mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::GrappleBeam)) {
|
||||
xa0_grappleGearModel.Touch(mgr, 0);
|
||||
xec_grapNoz1Model.Touch(mgr, 0);
|
||||
x138_grapNoz2Model.Touch(mgr, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CGrappleArm::LoadSuitPoll() {
|
||||
if (NWeaponTypes::are_tokens_ready(x19c_suitDeps[int(x3a8_loadedSuit)])) {
|
||||
if (!NWeaponTypes::are_tokens_ready(x19c_suitDeps[size_t(x3a8_loadedSuit)])) {
|
||||
return;
|
||||
}
|
||||
|
||||
x0_grappleArmModel.emplace(CAnimRes(g_tweakGunRes->x8_grappleArm, int(x3a8_loadedSuit), x31c_scale, 41, false));
|
||||
x0_grappleArmModel->SetSortThermal(true);
|
||||
x328_gunController = std::make_unique<CGunController>(*x0_grappleArmModel);
|
||||
x3b2_29_suitLoading = false;
|
||||
}
|
||||
}
|
||||
|
||||
void CGrappleArm::BuildXRayModel() {
|
||||
|
@ -467,9 +479,12 @@ void CGrappleArm::Update(float grappleSwingT, float dt, CStateManager& mgr) {
|
|||
}
|
||||
|
||||
void CGrappleArm::PreRender(const CStateManager& mgr, const zeus::CFrustum& frustum, const zeus::CVector3f& camPos) {
|
||||
if (x3b2_24_active && !x3b2_29_suitLoading) {
|
||||
if (!x3b2_24_active || x3b2_29_suitLoading) {
|
||||
return;
|
||||
}
|
||||
|
||||
x0_grappleArmModel->GetAnimationData()->PreRender();
|
||||
if (x50_grappleArmSkeletonModel)
|
||||
if (x50_grappleArmSkeletonModel) {
|
||||
x50_grappleArmSkeletonModel->GetAnimationData()->PreRender();
|
||||
}
|
||||
}
|
||||
|
@ -491,11 +506,15 @@ void CGrappleArm::PointGenerator(void* ctx, const std::vector<std::pair<zeus::CV
|
|||
|
||||
void CGrappleArm::Render(const CStateManager& mgr, const zeus::CVector3f& pos, const CModelFlags& flags,
|
||||
const CActorLights* lights) {
|
||||
if (x3b2_24_active && !x3b2_29_suitLoading) {
|
||||
if (!x3b2_24_active || x3b2_29_suitLoading) {
|
||||
return;
|
||||
}
|
||||
|
||||
SCOPED_GRAPHICS_DEBUG_GROUP("CGrappleArm::Render", zeus::skOrange);
|
||||
zeus::CTransform modelXf = zeus::CTransform::Translate(pos) * x220_xf * x2e0_auxXf;
|
||||
if (x50_grappleArmSkeletonModel)
|
||||
const zeus::CTransform modelXf = zeus::CTransform::Translate(pos) * x220_xf * x2e0_auxXf;
|
||||
if (x50_grappleArmSkeletonModel) {
|
||||
RenderXRayModel(mgr, modelXf, flags);
|
||||
}
|
||||
|
||||
CModelFlags useFlags;
|
||||
const CActorLights* useLights;
|
||||
|
@ -507,8 +526,9 @@ void CGrappleArm::Render(const CStateManager& mgr, const zeus::CVector3f& pos, c
|
|||
useLights = lights;
|
||||
}
|
||||
|
||||
if (x3a4_rainSplashGenerator && x3a4_rainSplashGenerator->IsRaining())
|
||||
if (x3a4_rainSplashGenerator && x3a4_rainSplashGenerator->IsRaining()) {
|
||||
CSkinnedModel::SetPointGeneratorFunc(x3a4_rainSplashGenerator.get(), PointGenerator);
|
||||
}
|
||||
|
||||
x0_grappleArmModel->Render(mgr, modelXf, useLights, useFlags);
|
||||
|
||||
|
@ -522,7 +542,6 @@ void CGrappleArm::Render(const CStateManager& mgr, const zeus::CVector3f& pos, c
|
|||
xec_grapNoz1Model.Render(mgr, modelXf * x280_grapNozLoc1Xf, useLights, useFlags);
|
||||
x138_grapNoz2Model.Render(mgr, modelXf * x2b0_grapNozLoc2Xf, useLights, useFlags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CGrappleArm::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr) {
|
||||
|
|
Loading…
Reference in New Issue