COmegaPirate: Fix UpdateScale & Landed; renaming

This commit is contained in:
Luke Street 2020-04-20 02:14:17 -04:00
parent 32c44cbf05
commit 3563a1c8c4
2 changed files with 144 additions and 142 deletions

View File

@ -166,7 +166,7 @@ void COmegaPirate::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSta
} }
break; break;
case EScriptObjectMessage::Decrement: case EScriptObjectMessage::Decrement:
x9ec_ = true; x9ec_decrement = true;
break; break;
case EScriptObjectMessage::Increment: case EScriptObjectMessage::Increment:
SetShotAt(true, mgr); SetShotAt(true, mgr);
@ -175,7 +175,7 @@ void COmegaPirate::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSta
xb7c_[3] -= xb7c_[3] == 0 ? 0 : 1; xb7c_[3] -= xb7c_[3] == 0 ? 0 : 1;
break; break;
case EScriptObjectMessage::Reset: case EScriptObjectMessage::Reset:
xb78_ = true; xb78_codeTrigger = true;
break; break;
case EScriptObjectMessage::SetToMax: case EScriptObjectMessage::SetToMax:
xa3c_hearPlayer = true; xa3c_hearPlayer = true;
@ -185,8 +185,8 @@ void COmegaPirate::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSta
break; break;
case EScriptObjectMessage::Start: case EScriptObjectMessage::Start:
x3b4_speed = 1.f; x3b4_speed = 1.f;
++xade_; ++xade_armorPiecesDestroyed;
if (xade_ < 4) { if (xade_armorPiecesDestroyed < 4) {
GetBodyController()->GetCommandMgr().DeliverCmd(CBCKnockBackCmd(zeus::skLeft, pas::ESeverity::One)); GetBodyController()->GetCommandMgr().DeliverCmd(CBCKnockBackCmd(zeus::skLeft, pas::ESeverity::One));
} }
break; break;
@ -201,8 +201,8 @@ void COmegaPirate::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSta
break; break;
case EScriptObjectMessage::Action: case EScriptObjectMessage::Action:
x3b4_speed = 1.f; x3b4_speed = 1.f;
++xade_; ++xade_armorPiecesDestroyed;
if (xade_ < 4) { if (xade_armorPiecesDestroyed < 4) {
GetBodyController()->GetCommandMgr().DeliverCmd(CBCKnockBackCmd(zeus::skRight, pas::ESeverity::One)); GetBodyController()->GetCommandMgr().DeliverCmd(CBCKnockBackCmd(zeus::skRight, pas::ESeverity::One));
} }
break; break;
@ -295,14 +295,14 @@ void COmegaPirate::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSta
CBCKnockBackCmd(GetTransform().frontVector(), pas::ESeverity::Eight)); CBCKnockBackCmd(GetTransform().frontVector(), pas::ESeverity::Eight));
} }
CElitePirate::AcceptScriptMsg(msg, uid, mgr); CElitePirate::AcceptScriptMsg(msg, uid, mgr);
if (uid == xa46_ && xa7c_xrayAlphaState == EXRayAlphaState::Two) { if (uid == xa46_ && xa7c_xrayAlphaState == EXRayFadeState::WaitForTrigger) {
xa7c_xrayAlphaState = EXRayAlphaState::Three; xa7c_xrayAlphaState = EXRayFadeState::FadeOut;
xa84_xrayAlphaStateTime = 0.f; xa84_xrayAlphaStateTime = 0.f;
} }
break; break;
case EScriptObjectMessage::InvulnDamage: case EScriptObjectMessage::InvulnDamage:
if (const TCastToConstPtr<CGameProjectile> projectile = mgr.GetObjectById(uid)) { if (const TCastToConstPtr<CGameProjectile> projectile = mgr.GetObjectById(uid)) {
if (xa4a_) { if (xa4a_heartVisible) {
mgr.ApplyDamage(uid, xa46_, projectile->GetOwnerId(), projectile->GetDamageInfo(), mgr.ApplyDamage(uid, xa46_, projectile->GetOwnerId(), projectile->GetDamageInfo(),
CMaterialFilter::MakeInclude({EMaterialTypes::Solid}), zeus::skZero3f); CMaterialFilter::MakeInclude({EMaterialTypes::Solid}), zeus::skZero3f);
} }
@ -326,7 +326,7 @@ void COmegaPirate::Attack(CStateManager& mgr, EStateMsg msg, float dt) {
CElitePirate::Attack(mgr, msg, dt); CElitePirate::Attack(mgr, msg, dt);
} }
bool COmegaPirate::CodeTrigger(CStateManager&, float) { return xb78_; } bool COmegaPirate::CodeTrigger(CStateManager&, float) { return xb78_codeTrigger; }
void COmegaPirate::Cover(CStateManager& mgr, EStateMsg msg, float dt) { void COmegaPirate::Cover(CStateManager& mgr, EStateMsg msg, float dt) {
CElitePirate::Cover(mgr, msg, dt); CElitePirate::Cover(mgr, msg, dt);
@ -349,7 +349,7 @@ bool COmegaPirate::CoverBlown(CStateManager&, float) {
void COmegaPirate::Dizzy(CStateManager& mgr, EStateMsg msg, float dt) { void COmegaPirate::Dizzy(CStateManager& mgr, EStateMsg msg, float dt) {
if (msg == EStateMsg::Activate) { if (msg == EStateMsg::Activate) {
xa44_ = true; xa44_targetable = true;
} else if (msg == EStateMsg::Update) { } else if (msg == EStateMsg::Update) {
GetBodyController()->GetCommandMgr().DeliverCmd(CBCLoopReactionCmd(pas::EReactionType::Two)); GetBodyController()->GetCommandMgr().DeliverCmd(CBCLoopReactionCmd(pas::EReactionType::Two));
} else if (msg == EStateMsg::Deactivate) { } else if (msg == EStateMsg::Deactivate) {
@ -362,9 +362,9 @@ void COmegaPirate::DoubleSnap(CStateManager& mgr, EStateMsg msg, float dt) {
SendScriptMsgs(EScriptObjectState::MaxReached, mgr, EScriptObjectMessage::None); SendScriptMsgs(EScriptObjectState::MaxReached, mgr, EScriptObjectMessage::None);
SetShotAt(false, mgr); SetShotAt(false, mgr);
SetState(CElitePirate::EState::Zero); SetState(CElitePirate::EState::Zero);
xa44_ = false; xa44_targetable = false;
xa4a_ = false; xa4a_heartVisible = false;
xa88_ = false; xa88_xrayFadeInTrigger = false;
xa8c_ = 3.f; xa8c_ = 3.f;
for (auto& entry : x9dc_scriptPlatforms) { for (auto& entry : x9dc_scriptPlatforms) {
if (auto* platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) { if (auto* platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) {
@ -412,9 +412,9 @@ void COmegaPirate::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node
x9a1_fadeIn = true; x9a1_fadeIn = true;
break; break;
case EUserEventType::FadeOut: case EUserEventType::FadeOut:
if (x994_fadeState != EFadeState::Two && x9a1_fadeIn) { if (x994_normalFadeState != ENormalFadeState::Two && x9a1_fadeIn) {
x994_fadeState = EFadeState::One; x994_normalFadeState = ENormalFadeState::One;
xa30_skeletonState = ESkeletonState::Three; xa30_skeletonFadeState = ESkeletonFadeState::FadeIn;
} }
break; break;
case EUserEventType::ObjectPickUp: case EUserEventType::ObjectPickUp:
@ -470,7 +470,7 @@ void COmegaPirate::Enraged(CStateManager& mgr, EStateMsg msg, float dt) {
void COmegaPirate::Explode(CStateManager& mgr, EStateMsg msg, float dt) { void COmegaPirate::Explode(CStateManager& mgr, EStateMsg msg, float dt) {
if (msg == EStateMsg::Activate) { if (msg == EStateMsg::Activate) {
SetState(EState::Zero); SetState(EState::Zero);
xad0_ = false; xad0_scaleUpTrigger = false;
} else if (msg == EStateMsg::Update) { } else if (msg == EStateMsg::Update) {
if (GetState() == CElitePirate::EState::Zero) { if (GetState() == CElitePirate::EState::Zero) {
if (GetBodyController()->GetCurrentStateId() == pas::EAnimationState::Step) { if (GetBodyController()->GetCurrentStateId() == pas::EAnimationState::Step) {
@ -491,9 +491,9 @@ void COmegaPirate::Explode(CStateManager& mgr, EStateMsg msg, float dt) {
void COmegaPirate::Faint(CStateManager& mgr, EStateMsg msg, float dt) { void COmegaPirate::Faint(CStateManager& mgr, EStateMsg msg, float dt) {
if (msg == EStateMsg::Activate) { if (msg == EStateMsg::Activate) {
GetBodyController()->GetCommandMgr().DeliverCmd(CBCLoopReactionCmd(pas::EReactionType::Zero)); GetBodyController()->GetCommandMgr().DeliverCmd(CBCLoopReactionCmd(pas::EReactionType::Zero));
xa44_ = true; xa44_targetable = true;
xa4a_ = true; xa4a_heartVisible = true;
if (xa7c_xrayAlphaState == EXRayAlphaState::Two) { if (xa7c_xrayAlphaState == EXRayFadeState::WaitForTrigger) {
xa8c_ = 0.333f; xa8c_ = 0.333f;
} }
for (const auto& entry : x9dc_scriptPlatforms) { for (const auto& entry : x9dc_scriptPlatforms) {
@ -502,17 +502,17 @@ void COmegaPirate::Faint(CStateManager& mgr, EStateMsg msg, float dt) {
} }
} }
} else if (msg == EStateMsg::Update) { } else if (msg == EStateMsg::Update) {
if (xb4c_ < 4 && x9c8_scaleState == EScaleState::Zero && xb58_ >= 2.5f) { if (xb4c_armorPiecesHealed < 4 && x9c8_scaleState == EScaleState::None && xb58_ >= 2.5f) {
float alpha = std::min(xb50_, 1.f); float alpha = std::min(xb50_, 1.f);
float invAlpha = 1.f - alpha; float invAlpha = 1.f - alpha;
size_t idx = 0; size_t idx = 0;
for (const auto& entry : x9dc_scriptPlatforms) { for (const auto& entry : x9dc_scriptPlatforms) {
if (auto* platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) { if (auto* platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) {
if (mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay) { if (mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay) {
if (xb4c_ > idx) { if (xb4c_armorPiecesHealed > idx) {
CModelFlags flags{5, 0, 3, zeus::skBlack}; CModelFlags flags{5, 0, 3, zeus::skBlack};
platform->SetDrawFlags(flags); platform->SetDrawFlags(flags);
} else if (xb4c_ == idx) { } else if (xb4c_armorPiecesHealed == idx) {
if (!xb6e_) { if (!xb6e_) {
SendScriptMsgs(EScriptObjectState::Entered, mgr, EScriptObjectMessage::None); SendScriptMsgs(EScriptObjectState::Entered, mgr, EScriptObjectMessage::None);
xb6e_ = true; xb6e_ = true;
@ -528,7 +528,7 @@ void COmegaPirate::Faint(CStateManager& mgr, EStateMsg msg, float dt) {
++idx; ++idx;
} }
if (xb50_ > 1.f) { if (xb50_ > 1.f) {
++xb4c_; ++xb4c_armorPiecesHealed;
xb50_ = 0.f; xb50_ = 0.f;
xb58_ = 0.f; xb58_ = 0.f;
xb6e_ = false; xb6e_ = false;
@ -540,15 +540,15 @@ void COmegaPirate::Faint(CStateManager& mgr, EStateMsg msg, float dt) {
} else if (msg == EStateMsg::Deactivate) { } else if (msg == EStateMsg::Deactivate) {
GetBodyController()->GetCommandMgr().DeliverCmd(CBodyStateCmd(EBodyStateCmd::ExitState)); GetBodyController()->GetCommandMgr().DeliverCmd(CBodyStateCmd(EBodyStateCmd::ExitState));
if (xb58_ >= 2.5f) { if (xb58_ >= 2.5f) {
++xb4c_; ++xb4c_armorPiecesHealed;
} }
} }
} }
void COmegaPirate::Growth(CStateManager& mgr, EStateMsg msg, float dt) { void COmegaPirate::Growth(CStateManager& mgr, EStateMsg msg, float dt) {
if (msg == EStateMsg::Activate) { if (msg == EStateMsg::Activate) {
x9c8_scaleState = EScaleState::Two; x9c8_scaleState = EScaleState::ScaleDownY;
xad0_ = false; xad0_scaleUpTrigger = false;
RemoveMaterial(EMaterialTypes::RadarObject, EMaterialTypes::Scannable, mgr); RemoveMaterial(EMaterialTypes::RadarObject, EMaterialTypes::Scannable, mgr);
xb6c_ = false; xb6c_ = false;
xb6d_ = false; xb6d_ = false;
@ -570,7 +570,7 @@ void COmegaPirate::Growth(CStateManager& mgr, EStateMsg msg, float dt) {
} }
} else if (msg == EStateMsg::Deactivate) { } else if (msg == EStateMsg::Deactivate) {
TeleportToFurthestPlatform(mgr); TeleportToFurthestPlatform(mgr);
xad0_ = true; xad0_scaleUpTrigger = true;
AddMaterial(EMaterialTypes::RadarObject, mgr); AddMaterial(EMaterialTypes::RadarObject, mgr);
ProcessSoundEvent(SFXsfx0B28, 1.f, 0, 0.1f, 1000.f, 0.16f, 1.f, zeus::skZero3f, GetTranslation(), ProcessSoundEvent(SFXsfx0B28, 1.f, 0, 0.1f, 1000.f, 0.16f, 1.f, zeus::skZero3f, GetTranslation(),
mgr.GetNextAreaId(), mgr, false); mgr.GetNextAreaId(), mgr, false);
@ -581,7 +581,7 @@ void COmegaPirate::JumpBack(CStateManager& mgr, EStateMsg msg, float dt) {
if (msg == EStateMsg::Activate) { if (msg == EStateMsg::Activate) {
SetShotAt(false, mgr); SetShotAt(false, mgr);
SetState(CElitePirate::EState::Two); SetState(CElitePirate::EState::Two);
xade_ = 0; xade_armorPiecesDestroyed = 0;
xadf_launcher1FollowPlayer = false; xadf_launcher1FollowPlayer = false;
xae0_launcher2FollowPlayer = false; xae0_launcher2FollowPlayer = false;
xb68_ = 0; xb68_ = 0;
@ -602,7 +602,10 @@ void COmegaPirate::JumpBack(CStateManager& mgr, EStateMsg msg, float dt) {
} }
} }
bool COmegaPirate::Landed(CStateManager& mgr, float arg) { return (xb4c_ & 0xe7) == 0; } bool COmegaPirate::Landed(CStateManager& mgr, float arg) {
fmt::print(FMT_STRING("OMEGA: {} pieces healed\n"), xb4c_armorPiecesHealed);
return xb4c_armorPiecesHealed == 4;
}
zeus::CVector3f COmegaPirate::GetOrbitPosition(const CStateManager& mgr) const { zeus::CVector3f COmegaPirate::GetOrbitPosition(const CStateManager& mgr) const {
if (x990_launcherId2 != kInvalidUniqueId && if (x990_launcherId2 != kInvalidUniqueId &&
@ -669,9 +672,9 @@ void COmegaPirate::Retreat(CStateManager& mgr, EStateMsg msg, float dt) {
SetShotAt(false, mgr); SetShotAt(false, mgr);
SetState(CElitePirate::EState::Zero); SetState(CElitePirate::EState::Zero);
SendScriptMsgs(EScriptObjectState::Inside, mgr, EScriptObjectMessage::None); SendScriptMsgs(EScriptObjectState::Inside, mgr, EScriptObjectMessage::None);
xad0_ = false; xad0_scaleUpTrigger = false;
xa44_ = false; xa44_targetable = false;
xa4a_ = false; xa4a_heartVisible = false;
xb5c_ = 0.f; xb5c_ = 0.f;
xb60_ = 0.f; xb60_ = 0.f;
xb64_ = 5.f; xb64_ = 5.f;
@ -748,8 +751,8 @@ void COmegaPirate::Skid(CStateManager& mgr, EStateMsg msg, float dt) {
void COmegaPirate::Suck(CStateManager& mgr, EStateMsg msg, float dt) { void COmegaPirate::Suck(CStateManager& mgr, EStateMsg msg, float dt) {
if (msg == EStateMsg::Activate) { if (msg == EStateMsg::Activate) {
SetState(CElitePirate::EState::Zero); SetState(CElitePirate::EState::Zero);
xa7c_xrayAlphaState = EXRayAlphaState::Three; xa7c_xrayAlphaState = EXRayFadeState::FadeOut;
xa88_ = true; xa88_xrayFadeInTrigger = true;
} else if (msg == EStateMsg::Update) { } else if (msg == EStateMsg::Update) {
if (GetState() == CElitePirate::EState::Zero) { if (GetState() == CElitePirate::EState::Zero) {
if (GetBodyController()->GetCurrentStateId() == pas::EAnimationState::Step) { if (GetBodyController()->GetCurrentStateId() == pas::EAnimationState::Step) {
@ -776,7 +779,7 @@ void COmegaPirate::Suck(CStateManager& mgr, EStateMsg msg, float dt) {
} }
xb50_ = 0.f; xb50_ = 0.f;
xb58_ = 2.5f; xb58_ = 2.5f;
xb4c_ = 0; xb4c_armorPiecesHealed = 0;
} }
} }
@ -822,13 +825,12 @@ void COmegaPirate::Think(float dt, CStateManager& mgr) {
UpdateActorTransform(mgr, x990_launcherId2, "grenadeLauncher2_LCTR"sv); UpdateActorTransform(mgr, x990_launcherId2, "grenadeLauncher2_LCTR"sv);
sub_8028f6f0(mgr, dt); UpdateNormalAlpha(mgr, dt);
UpdateSkeleton(mgr, dt); UpdateSkeletonAlpha(mgr, dt);
UpdateXRayAlpha(mgr, dt); UpdateXRayAlpha(mgr, dt);
if ((!x9a1_fadeIn || xa4a_) && mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay && if ((!x9a1_fadeIn || xa4a_heartVisible) && mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay && xa44_targetable) {
xa44_) {
AddMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr); AddMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr);
if (x9c8_scaleState == EScaleState::Four) { if (x9c8_scaleState == EScaleState::WaitForTrigger) {
xa38_collisionActorMgr1->SetActive(mgr, false); xa38_collisionActorMgr1->SetActive(mgr, false);
xa9c_collisionActorMgr2->SetActive(mgr, false); xa9c_collisionActorMgr2->SetActive(mgr, false);
} else { } else {
@ -884,7 +886,7 @@ void COmegaPirate::Think(float dt, CStateManager& mgr) {
for (auto& entry : x9dc_scriptPlatforms) { for (auto& entry : x9dc_scriptPlatforms) {
auto* platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first)); auto* platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first));
if ((!xb78_ && !xb79_) || xa4a_) { if ((!xb78_codeTrigger && !xb79_) || xa4a_heartVisible) {
platform->RemoveMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr); platform->RemoveMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr);
} else { } else {
platform->AddMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr); platform->AddMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr);
@ -904,7 +906,7 @@ void COmegaPirate::Think(float dt, CStateManager& mgr) {
} }
} }
player.GetPlayerGun()->GetAuxWeapon().SetNewTarget(GetUniqueId(), mgr); player.GetPlayerGun()->GetAuxWeapon().SetNewTarget(GetUniqueId(), mgr);
} else if (!xa4a_) { } else if (!xa4a_heartVisible) {
RemoveMaterial(EMaterialTypes::Target, mgr); RemoveMaterial(EMaterialTypes::Target, mgr);
for (auto& entry : x9dc_scriptPlatforms) { for (auto& entry : x9dc_scriptPlatforms) {
if (auto* platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) { if (auto* platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) {
@ -929,8 +931,8 @@ void COmegaPirate::Think(float dt, CStateManager& mgr) {
launcher->SetFollowPlayer(xae0_launcher2FollowPlayer); launcher->SetFollowPlayer(xae0_launcher2FollowPlayer);
} }
if (x9ec_) { if (x9ec_decrement) {
x9ec_ = false; x9ec_decrement = false;
x330_stateMachineState.SetState(mgr, *this, GetStateMachine(), "JumpBack"sv); x330_stateMachineState.SetState(mgr, *this, GetStateMachine(), "JumpBack"sv);
} }
@ -1142,7 +1144,7 @@ void COmegaPirate::TeleportToFurthestPlatform(CStateManager& mgr) {
if (TCastToConstPtr<CScriptWaypoint> waypoint = mgr.GetObjectById(entry.first)) { if (TCastToConstPtr<CScriptWaypoint> waypoint = mgr.GetObjectById(entry.first)) {
auto waypointPos = waypoint->GetTranslation(); auto waypointPos = waypoint->GetTranslation();
float dist = (mgr.GetPlayer().GetTranslation() - waypointPos).magnitude(); float dist = (mgr.GetPlayer().GetTranslation() - waypointPos).magnitude();
if (dist > maxDist && waypoint->GetUniqueId() != xada_waypointId) { if (dist > maxDist && waypoint->GetUniqueId() != xada_lastWaypointId) {
waypointIdx = i; waypointIdx = i;
maxDist = dist; maxDist = dist;
pos = waypointPos; pos = waypointPos;
@ -1152,7 +1154,7 @@ void COmegaPirate::TeleportToFurthestPlatform(CStateManager& mgr) {
SetTranslation(FindGround(pos, mgr)); SetTranslation(FindGround(pos, mgr));
auto waypointId = x9a4_scriptWaypointPlatforms[waypointIdx].first; auto waypointId = x9a4_scriptWaypointPlatforms[waypointIdx].first;
xada_waypointId = waypointId; xada_lastWaypointId = waypointId;
if (TCastToPtr<CScriptWaypoint> waypoint = mgr.ObjectById(waypointId)) { if (TCastToPtr<CScriptWaypoint> waypoint = mgr.ObjectById(waypointId)) {
waypoint->SendScriptMsgs(EScriptObjectState::Arrived, mgr, EScriptObjectMessage::None); waypoint->SendScriptMsgs(EScriptObjectState::Arrived, mgr, EScriptObjectMessage::None);
} }
@ -1172,46 +1174,46 @@ zeus::CVector3f COmegaPirate::FindGround(const zeus::CVector3f& pos, CStateManag
return pos; return pos;
} }
void COmegaPirate::sub_8028f6f0(CStateManager& mgr, float dt) { void COmegaPirate::UpdateNormalAlpha(CStateManager& mgr, float dt) {
if (x994_fadeState == EFadeState::One) { if (x994_normalFadeState == ENormalFadeState::One) {
x99c_alpha = 1.f - std::min(x998_, 1.25f) / 1.25f; x99c_normalAlpha = 1.f - std::min(x998_normalFadeTime, 1.25f) / 1.25f;
x42c_color.a() = x99c_alpha; x42c_color.a() = x99c_normalAlpha;
if (x998_ > 1.25f) { if (x998_normalFadeTime > 1.25f) {
x994_fadeState = EFadeState::Two; x994_normalFadeState = ENormalFadeState::Two;
x9a1_fadeIn = false; x9a1_fadeIn = false;
x998_ = 0.f; x998_normalFadeTime = 0.f;
} }
x998_ += dt; x998_normalFadeTime += dt;
x9a0_visible = true; x9a0_visible = true;
} else if (x994_fadeState == EFadeState::Two) { } else if (x994_normalFadeState == ENormalFadeState::Two) {
x99c_alpha = 0.f; x99c_normalAlpha = 0.f;
if (x998_ > 1.5f && x9a1_fadeIn) { if (x998_normalFadeTime > 1.5f && x9a1_fadeIn) {
CreateFlash(mgr, 0.f); CreateFlash(mgr, 0.f);
x994_fadeState = EFadeState::Three; x994_normalFadeState = ENormalFadeState::Three;
x998_ = 0.f; x998_normalFadeTime = 0.f;
} }
x998_ += dt; x998_normalFadeTime += dt;
x9a0_visible = false; x9a0_visible = false;
} else if (x994_fadeState == EFadeState::Three) { } else if (x994_normalFadeState == ENormalFadeState::Three) {
x99c_alpha = std::min(x998_, 1.f) / 1.25f; x99c_normalAlpha = std::min(x998_normalFadeTime, 1.f) / 1.25f;
if (x998_ > 1.f) { if (x998_normalFadeTime > 1.f) {
x994_fadeState = EFadeState::Zero; x994_normalFadeState = ENormalFadeState::Zero;
x998_ = 0.f; x998_normalFadeTime = 0.f;
} }
x998_ += dt; x998_normalFadeTime += dt;
x9a0_visible = true; x9a0_visible = true;
} else { } else {
x99c_alpha = 1.f; x99c_normalAlpha = 1.f;
x9a0_visible = true; x9a0_visible = true;
} }
float alpha = x99c_alpha; float alpha = x99c_normalAlpha;
if (mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay) { if (mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay) {
alpha = 0.f; alpha = 0.f;
x99c_alpha = 1.f; x99c_normalAlpha = 1.f;
x9a0_visible = true; x9a0_visible = true;
} }
x42c_color.a() = x99c_alpha; x42c_color.a() = x99c_normalAlpha;
if (alpha >= 1.f) { if (alpha >= 1.f) {
if (auto* launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(GetLauncherId()))) { if (auto* launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(GetLauncherId()))) {
@ -1262,24 +1264,24 @@ void COmegaPirate::sub_8028c704(CStateManager& mgr, float dt) {
} }
void COmegaPirate::UpdateXRayAlpha(CStateManager& mgr, float dt) { void COmegaPirate::UpdateXRayAlpha(CStateManager& mgr, float dt) {
if (xa7c_xrayAlphaState == EXRayAlphaState::One) { if (xa7c_xrayAlphaState == EXRayFadeState::FadeIn) {
xa80_xrayAlpha = std::min(xa84_xrayAlphaStateTime, xa90_) / xa90_; xa80_xrayAlpha = std::min(xa84_xrayAlphaStateTime, xa90_) / xa90_;
if (xa90_ < xa84_xrayAlphaStateTime) { if (xa90_ < xa84_xrayAlphaStateTime) {
xa7c_xrayAlphaState = EXRayAlphaState::Zero; xa7c_xrayAlphaState = EXRayFadeState::None;
xa84_xrayAlphaStateTime = 0.f; xa84_xrayAlphaStateTime = 0.f;
} }
xa84_xrayAlphaStateTime += dt; xa84_xrayAlphaStateTime += dt;
} else if (xa7c_xrayAlphaState == EXRayAlphaState::Two) { } else if (xa7c_xrayAlphaState == EXRayFadeState::WaitForTrigger) {
xa80_xrayAlpha = 0.f; xa80_xrayAlpha = 0.f;
if ((xa94_ < xa84_xrayAlphaStateTime) && !xa88_) { if ((xa94_ < xa84_xrayAlphaStateTime) && !xa88_xrayFadeInTrigger) {
xa7c_xrayAlphaState = EXRayAlphaState::One; xa7c_xrayAlphaState = EXRayFadeState::FadeIn;
xa84_xrayAlphaStateTime = 0.f; xa84_xrayAlphaStateTime = 0.f;
} }
xa84_xrayAlphaStateTime += dt; xa84_xrayAlphaStateTime += dt;
} else if (xa7c_xrayAlphaState == EXRayAlphaState::Three) { } else if (xa7c_xrayAlphaState == EXRayFadeState::FadeOut) {
xa80_xrayAlpha = 1.f - std::min(xa84_xrayAlphaStateTime, xa8c_) / xa8c_; xa80_xrayAlpha = 1.f - std::min(xa84_xrayAlphaStateTime, xa8c_) / xa8c_;
if (xa8c_ < xa84_xrayAlphaStateTime) { if (xa8c_ < xa84_xrayAlphaStateTime) {
xa7c_xrayAlphaState = EXRayAlphaState::Two; xa7c_xrayAlphaState = EXRayFadeState::WaitForTrigger;
xa84_xrayAlphaStateTime = 0.f; xa84_xrayAlphaStateTime = 0.f;
} }
xa84_xrayAlphaStateTime += dt; xa84_xrayAlphaStateTime += dt;
@ -1292,60 +1294,60 @@ void COmegaPirate::UpdateScale(CStateManager& mgr, float dt) {
auto* modelData = GetModelData(); auto* modelData = GetModelData();
zeus::CVector3f scale = modelData->GetScale(); zeus::CVector3f scale = modelData->GetScale();
switch (x9c8_scaleState) { switch (x9c8_scaleState) {
case EScaleState::Zero: case EScaleState::None:
default: default:
return; return;
case EScaleState::One: case EScaleState::ScaleDownX:
scale.x() = x9d0_initialScale.x() * std::min(1.f, 0.005f + (1.f - std::min(x9cc_scaleTime, 0.25f) / 0.25f)); scale.x() = x9d0_initialScale.x() * std::min(1.f, 0.005f + (1.f - std::min(x9cc_scaleTime, 0.25f) / 0.25f));
if (x9cc_scaleTime > 0.25f) { if (x9cc_scaleTime > 0.25f) {
x9c8_scaleState = EScaleState::Three; x9c8_scaleState = EScaleState::ScaleDownZ;
x9cc_scaleTime = 0.f; x9cc_scaleTime = 0.f;
} }
x9cc_scaleTime += dt; x9cc_scaleTime += dt;
break; break;
case EScaleState::Two: case EScaleState::ScaleDownY:
scale.y() = x9d0_initialScale.y() * std::min(1.f, 0.005f + (1.f - std::min(x9cc_scaleTime, 0.25f) / 0.25f)); scale.y() = x9d0_initialScale.y() * std::min(1.f, 0.005f + (1.f - std::min(x9cc_scaleTime, 0.25f) / 0.25f));
if (x9cc_scaleTime > 0.25f) { if (x9cc_scaleTime > 0.25f) {
x9c8_scaleState = EScaleState::One; x9c8_scaleState = EScaleState::ScaleDownX;
x9cc_scaleTime = 0.f; x9cc_scaleTime = 0.f;
} }
x9cc_scaleTime += dt; x9cc_scaleTime += dt;
break; break;
case EScaleState::Three: case EScaleState::ScaleDownZ:
scale.z() = x9d0_initialScale.z() * std::min(1.f, 0.005f + (1.f - std::min(x9cc_scaleTime, 0.25f) / 0.25f)); scale.z() = x9d0_initialScale.z() * std::min(1.f, 0.005f + (1.f - std::min(x9cc_scaleTime, 0.25f) / 0.25f));
if (x9cc_scaleTime > 0.25f) { if (x9cc_scaleTime > 0.25f) {
x9c8_scaleState = EScaleState::Four; x9c8_scaleState = EScaleState::WaitForTrigger;
x9cc_scaleTime = 0.f; x9cc_scaleTime = 0.f;
} }
x9cc_scaleTime += dt; x9cc_scaleTime += dt;
break; break;
case EScaleState::Four: case EScaleState::WaitForTrigger:
if (x9cc_scaleTime > 0.1f && xad0_) { if (x9cc_scaleTime > 0.1f && xad0_scaleUpTrigger) {
x9c8_scaleState = EScaleState::Seven; x9c8_scaleState = EScaleState::ScaleUpZ;
x9cc_scaleTime = 0.f; x9cc_scaleTime = 0.f;
} }
x9cc_scaleTime += dt; x9cc_scaleTime += dt;
break; break;
case EScaleState::Five: case EScaleState::ScaleUpX:
scale.x() = x9d0_initialScale.x() * std::min(1.f, 0.005f + (1.f - std::min(x9cc_scaleTime, 0.25f) / 0.25f)); scale.x() = x9d0_initialScale.x() * std::min(1.f, 0.005f + std::min(x9cc_scaleTime, 0.25f) / 0.25f);
if (x9cc_scaleTime > 0.25f) { if (x9cc_scaleTime > 0.25f) {
x9c8_scaleState = EScaleState::Six; x9c8_scaleState = EScaleState::ScaleUpY;
x9cc_scaleTime = 0.f; x9cc_scaleTime = 0.f;
} }
x9cc_scaleTime += dt; x9cc_scaleTime += dt;
break; break;
case EScaleState::Six: case EScaleState::ScaleUpY:
scale.y() = x9d0_initialScale.y() * std::min(1.f, 0.005f + (1.f - std::min(x9cc_scaleTime, 0.25f) / 0.25f)); scale.y() = x9d0_initialScale.y() * std::min(1.f, 0.005f + std::min(x9cc_scaleTime, 0.25f) / 0.25f);
if (x9cc_scaleTime > 0.25f) { if (x9cc_scaleTime > 0.25f) {
x9c8_scaleState = EScaleState::Zero; x9c8_scaleState = EScaleState::None;
x9cc_scaleTime = 0.f; x9cc_scaleTime = 0.f;
} }
x9cc_scaleTime += dt; x9cc_scaleTime += dt;
break; break;
case EScaleState::Seven: case EScaleState::ScaleUpZ:
scale.z() = x9d0_initialScale.z() * std::min(1.f, 0.005f + (1.f - std::min(x9cc_scaleTime, 0.25f) / 0.25f)); scale.z() = x9d0_initialScale.z() * std::min(1.f, 0.005f + std::min(x9cc_scaleTime, 0.25f) / 0.25f);
if (x9cc_scaleTime > 0.25f) { if (x9cc_scaleTime > 0.25f) {
x9c8_scaleState = EScaleState::Five; x9c8_scaleState = EScaleState::ScaleUpX;
x9cc_scaleTime = 0.f; x9cc_scaleTime = 0.f;
} }
x9cc_scaleTime += dt; x9cc_scaleTime += dt;
@ -1366,26 +1368,26 @@ void COmegaPirate::UpdateScale(CStateManager& mgr, float dt) {
} }
} }
void COmegaPirate::UpdateSkeleton(CStateManager& mgr, float dt) { void COmegaPirate::UpdateSkeletonAlpha(CStateManager& mgr, float dt) {
if (xa30_skeletonState == ESkeletonState::One) { if (xa30_skeletonFadeState == ESkeletonFadeState::FadeOut) {
xa2c_skeletonAlpha = 1.f - std::min(xa34_skeletonStateTime, 1.f); xa2c_skeletonAlpha = 1.f - std::min(xa34_skeletonStateTime, 1.f);
if (xa34_skeletonStateTime > 1.f) { if (xa34_skeletonStateTime > 1.f) {
xa30_skeletonState = ESkeletonState::Zero; xa30_skeletonFadeState = ESkeletonFadeState::None;
xa34_skeletonStateTime = 0.f; xa34_skeletonStateTime = 0.f;
} }
xa34_skeletonStateTime += dt; xa34_skeletonStateTime += dt;
} else if (xa30_skeletonState == ESkeletonState::Two) { } else if (xa30_skeletonFadeState == ESkeletonFadeState::Flash) {
xa2c_skeletonAlpha = 1.f; xa2c_skeletonAlpha = 1.f;
if (xa34_skeletonStateTime > 1.f) { if (xa34_skeletonStateTime > 1.f) {
xa30_skeletonState = ESkeletonState::One; xa30_skeletonFadeState = ESkeletonFadeState::FadeOut;
xa34_skeletonStateTime = 0.f; xa34_skeletonStateTime = 0.f;
CreateFlash(mgr, 0.75f); CreateFlash(mgr, 0.75f);
} }
xa34_skeletonStateTime += dt; xa34_skeletonStateTime += dt;
} else if (xa30_skeletonState == ESkeletonState::Three) { } else if (xa30_skeletonFadeState == ESkeletonFadeState::FadeIn) {
xa2c_skeletonAlpha = std::min(xa34_skeletonStateTime, 1.f); xa2c_skeletonAlpha = std::min(xa34_skeletonStateTime, 1.f);
if (xa34_skeletonStateTime > 1.f) { if (xa34_skeletonStateTime > 1.f) {
xa30_skeletonState = ESkeletonState::Two; xa30_skeletonFadeState = ESkeletonFadeState::Flash;
xa34_skeletonStateTime = 0.f; xa34_skeletonStateTime = 0.f;
} }
xa34_skeletonStateTime += dt; xa34_skeletonStateTime += dt;
@ -1398,7 +1400,7 @@ void COmegaPirate::DeathDestroy(CStateManager& mgr) {
RemoveEmitter(); RemoveEmitter();
SetTransform(xa4c_initialXf); SetTransform(xa4c_initialXf);
x9a1_fadeIn = true; x9a1_fadeIn = true;
xa4a_ = false; xa4a_heartVisible = false;
SendScriptMsgs(EScriptObjectState::DeathRattle, mgr, EScriptObjectMessage::None); SendScriptMsgs(EScriptObjectState::DeathRattle, mgr, EScriptObjectMessage::None);
SendScriptMsgs(EScriptObjectState::Dead, mgr, EScriptObjectMessage::None); SendScriptMsgs(EScriptObjectState::Dead, mgr, EScriptObjectMessage::None);
SendScriptMsgs(EScriptObjectState::Inside, mgr, EScriptObjectMessage::None); SendScriptMsgs(EScriptObjectState::Inside, mgr, EScriptObjectMessage::None);

View File

@ -28,59 +28,59 @@ private:
}; };
TUniqueId x990_launcherId2 = kInvalidUniqueId; TUniqueId x990_launcherId2 = kInvalidUniqueId;
enum class EFadeState { enum class ENormalFadeState {
Zero, Zero,
One, One,
Two, Two,
Three, Three,
} x994_fadeState = EFadeState::Zero; } x994_normalFadeState = ENormalFadeState::Zero;
float x998_ = 0.f; float x998_normalFadeTime = 0.f;
float x99c_alpha = 1.f; float x99c_normalAlpha = 1.f;
bool x9a0_visible = true; bool x9a0_visible = true;
bool x9a1_fadeIn = true; bool x9a1_fadeIn = true;
std::vector<std::pair<TUniqueId, std::vector<TUniqueId>>> x9a4_scriptWaypointPlatforms; std::vector<std::pair<TUniqueId, std::vector<TUniqueId>>> x9a4_scriptWaypointPlatforms;
bool x9b4_ = false; bool x9b4_ = false;
std::vector<std::pair<TUniqueId, std::string_view>> x9b8_scriptEffects; std::vector<std::pair<TUniqueId, std::string_view>> x9b8_scriptEffects;
enum class EScaleState { enum class EScaleState {
Zero, None,
One, ScaleDownX,
Two, ScaleDownY,
Three, ScaleDownZ,
Four, WaitForTrigger,
Five, ScaleUpX,
Six, ScaleUpY,
Seven, ScaleUpZ,
} x9c8_scaleState = EScaleState::Zero; } x9c8_scaleState = EScaleState::None;
float x9cc_scaleTime = 0.f; float x9cc_scaleTime = 0.f;
zeus::CVector3f x9d0_initialScale; zeus::CVector3f x9d0_initialScale;
std::vector<std::pair<TUniqueId, std::string_view>> x9dc_scriptPlatforms; std::vector<std::pair<TUniqueId, std::string_view>> x9dc_scriptPlatforms;
bool x9ec_ = false; bool x9ec_decrement = false;
CSkinnedModel x9f0_skeletonModel; CSkinnedModel x9f0_skeletonModel;
float xa2c_skeletonAlpha = 0.f; float xa2c_skeletonAlpha = 0.f;
enum class ESkeletonState { enum class ESkeletonFadeState {
Zero, None,
One, FadeOut,
Two, Flash,
Three, FadeIn,
} xa30_skeletonState = ESkeletonState::Zero; } xa30_skeletonFadeState = ESkeletonFadeState::None;
float xa34_skeletonStateTime = 0.f; float xa34_skeletonStateTime = 0.f;
std::unique_ptr<CCollisionActorManager> xa38_collisionActorMgr1; std::unique_ptr<CCollisionActorManager> xa38_collisionActorMgr1;
bool xa3c_hearPlayer = false; bool xa3c_hearPlayer = false;
pas::ELocomotionType xa40_locomotionType = pas::ELocomotionType::Relaxed; pas::ELocomotionType xa40_locomotionType = pas::ELocomotionType::Relaxed;
bool xa44_ = false; bool xa44_targetable = false;
TUniqueId xa46_ = kInvalidUniqueId; TUniqueId xa46_ = kInvalidUniqueId;
TUniqueId xa48_ = kInvalidUniqueId; TUniqueId xa48_ = kInvalidUniqueId;
bool xa4a_ = false; bool xa4a_heartVisible = false;
zeus::CTransform xa4c_initialXf; zeus::CTransform xa4c_initialXf;
enum class EXRayAlphaState { enum class EXRayFadeState {
Zero, None,
One, FadeIn,
Two, WaitForTrigger,
Three, FadeOut,
} xa7c_xrayAlphaState = EXRayAlphaState::Zero; } xa7c_xrayAlphaState = EXRayFadeState::None;
float xa80_xrayAlpha = 1.f; float xa80_xrayAlpha = 1.f;
float xa84_xrayAlphaStateTime = 0.f; float xa84_xrayAlphaStateTime = 0.f;
bool xa88_ = false; bool xa88_xrayFadeInTrigger = false;
float xa8c_ = 3.f; float xa8c_ = 3.f;
float xa90_ = 1.f; float xa90_ = 1.f;
float xa94_ = 1.f; float xa94_ = 1.f;
@ -92,17 +92,17 @@ private:
int xac4_ = 0; int xac4_ = 0;
int xac8_ = 0; int xac8_ = 0;
int xacc_ = 0; int xacc_ = 0;
bool xad0_ = false; bool xad0_scaleUpTrigger = false;
float xad4_cachedSpeed = 1.f; float xad4_cachedSpeed = 1.f;
bool xad8_cover = false; bool xad8_cover = false;
TUniqueId xada_waypointId = kInvalidUniqueId; TUniqueId xada_lastWaypointId = kInvalidUniqueId;
bool xadc_ = false; bool xadc_ = false;
bool xadd_ = false; bool xadd_ = false;
u8 xade_ = 0; u8 xade_armorPiecesDestroyed = 0;
bool xadf_launcher1FollowPlayer = true; bool xadf_launcher1FollowPlayer = true;
bool xae0_launcher2FollowPlayer = true; bool xae0_launcher2FollowPlayer = true;
CDamageVulnerability xae4_platformVuln = CDamageVulnerability::NormalVulnerabilty(); CDamageVulnerability xae4_platformVuln = CDamageVulnerability::NormalVulnerabilty();
int xb4c_ = 0; int xb4c_armorPiecesHealed = 0;
float xb50_ = 0.f; float xb50_ = 0.f;
zeus::CColor xb54_platformColor = zeus::skWhite; zeus::CColor xb54_platformColor = zeus::skWhite;
float xb58_ = 2.5f; float xb58_ = 2.5f;
@ -114,7 +114,7 @@ private:
bool xb6d_ = false; bool xb6d_ = false;
bool xb6e_ = false; bool xb6e_ = false;
TLockedToken<CTexture> xb70_thermalSpot; // was TToken<CTexture> TLockedToken<CTexture> xb70_thermalSpot; // was TToken<CTexture>
bool xb78_ = false; bool xb78_codeTrigger = false;
bool xb79_ = false; bool xb79_ = false;
std::vector<u8> xb7c_; std::vector<u8> xb7c_;
float xb8c_ = 0.f; // not initialized in ctr float xb8c_ = 0.f; // not initialized in ctr
@ -179,11 +179,11 @@ private:
u8 sub_8028c230() const; u8 sub_8028c230() const;
u8 sub_8028bfac() const; u8 sub_8028bfac() const;
void TeleportToFurthestPlatform(CStateManager& mgr); void TeleportToFurthestPlatform(CStateManager& mgr);
void sub_8028f6f0(CStateManager& mgr, float dt); void UpdateNormalAlpha(CStateManager& mgr, float dt);
void sub_8028c704(CStateManager& mgr, float dt); void sub_8028c704(CStateManager& mgr, float dt);
void UpdateXRayAlpha(CStateManager& mgr, float dt); void UpdateXRayAlpha(CStateManager& mgr, float dt);
void UpdateScale(CStateManager& mgr, float dt); void UpdateScale(CStateManager& mgr, float dt);
void UpdateSkeleton(CStateManager& mgr, float dt); void UpdateSkeletonAlpha(CStateManager& mgr, float dt);
void DeathDestroy(CStateManager& mgr); void DeathDestroy(CStateManager& mgr);
void sub_8028c840(u32 arg, CStateManager& mgr); void sub_8028c840(u32 arg, CStateManager& mgr);
zeus::CVector3f FindGround(const zeus::CVector3f& pos, CStateManager& mgr) const; zeus::CVector3f FindGround(const zeus::CVector3f& pos, CStateManager& mgr) const;