COmegaPirate: Renaming & fixes

This commit is contained in:
Luke Street 2020-04-19 19:26:25 -04:00
parent 4e88f503ac
commit de5513e277
4 changed files with 205 additions and 184 deletions

View File

@ -372,7 +372,7 @@ void CPlayerVisor::DrawScanEffect(const CStateManager& mgr, CTargetingManager* t
const float uvX1 = float(rect.x4_left + rect.xc_width) / float(g_Viewport.x8_width); const float uvX1 = float(rect.x4_left + rect.xc_width) / float(g_Viewport.x8_width);
const float uvY0 = float(rect.x8_top) / float(g_Viewport.xc_height); const float uvY0 = float(rect.x8_top) / float(g_Viewport.xc_height);
const float uvY1 = float(rect.x8_top + rect.x10_height) / float(g_Viewport.xc_height); const float uvY1 = float(rect.x8_top + rect.x10_height) / float(g_Viewport.xc_height);
const std::array<CTexturedQuadFilter::Vert, 4> rttVerts{{ std::array<CTexturedQuadFilter::Vert, 4> rttVerts{{
{{-5.f, 0.f, 4.45f}, {uvX0, uvY0}}, {{-5.f, 0.f, 4.45f}, {uvX0, uvY0}},
{{5.f, 0.f, 4.45f}, {uvX1, uvY0}}, {{5.f, 0.f, 4.45f}, {uvX1, uvY0}},
{{-5.f, 0.f, -4.45f}, {uvX0, uvY1}}, {{-5.f, 0.f, -4.45f}, {uvX0, uvY1}},

View File

@ -131,8 +131,7 @@ void CGrenadeLauncher::PreRender(CStateManager& mgr, const zeus::CFrustum& frust
// Original code redundantly sets a() = 1.f // Original code redundantly sets a() = 1.f
xb4_drawFlags.addColor = x3f4_color3; xb4_drawFlags.addColor = x3f4_color3;
} else { } else {
xb4_drawFlags = CModelFlags{5, 0, 3, zeus::skWhite}; xb4_drawFlags = CModelFlags{5, 0, 3, x3f4_color3};
xb4_drawFlags.addColor = x3f4_color3;
} }
CActor::PreRender(mgr, frustum); CActor::PreRender(mgr, frustum);
} }

View File

@ -123,8 +123,8 @@ COmegaPirate::COmegaPirate(TUniqueId uid, std::string_view name, const CEntityIn
CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms, CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms,
CElitePirateData data, CAssetId w1, CAssetId w2, CAssetId w3) CElitePirateData data, CAssetId w1, CAssetId w2, CAssetId w3)
: CElitePirate(uid, name, info, xf, std::move(mData), pInfo, actParms, data) : CElitePirate(uid, name, info, xf, std::move(mData), pInfo, actParms, data)
, x9d0_(GetModelData()->GetScale()) , x9d0_initialScale(GetModelData()->GetScale())
, x9f0_(*g_SimplePool, w1, w2, w3, 0, 0) , x9f0_skeletonModel(*g_SimplePool, w1, w2, w3, 0, 0)
, xb70_thermalSpot(g_SimplePool->GetObj("Thermal_Spot_2"sv)) { , xb70_thermalSpot(g_SimplePool->GetObj("Thermal_Spot_2"sv)) {
x9a4_scriptWaypointPlatforms.reserve(3); x9a4_scriptWaypointPlatforms.reserve(3);
x9b8_scriptEffects.reserve(24); x9b8_scriptEffects.reserve(24);
@ -191,7 +191,7 @@ void COmegaPirate::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSta
} }
break; break;
case EScriptObjectMessage::Stop: case EScriptObjectMessage::Stop:
Destroy(mgr); DeathDestroy(mgr);
break; break;
case EScriptObjectMessage::StopAndReset: case EScriptObjectMessage::StopAndReset:
xb7c_[1] -= xb7c_[1] == 0 ? 0 : 1; xb7c_[1] -= xb7c_[1] == 0 ? 0 : 1;
@ -295,9 +295,9 @@ 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_ == 2) { if (uid == xa46_ && xa7c_xrayAlphaState == EXRayAlphaState::Two) {
xa7c_ = 3; xa7c_xrayAlphaState = EXRayAlphaState::Three;
xa84_ = 0.f; xa84_xrayAlphaStateTime = 0.f;
} }
break; break;
case EScriptObjectMessage::InvulnDamage: case EScriptObjectMessage::InvulnDamage:
@ -409,12 +409,12 @@ void COmegaPirate::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node
} }
break; break;
case EUserEventType::FadeIn: case EUserEventType::FadeIn:
x9a1_ = true; x9a1_fadeIn = true;
break; break;
case EUserEventType::FadeOut: case EUserEventType::FadeOut:
if (x994_ != 2 && x9a1_) { if (x994_fadeState != EFadeState::Two && x9a1_fadeIn) {
x994_ = 1; x994_fadeState = EFadeState::One;
xa30_ = 3; xa30_skeletonState = ESkeletonState::Three;
} }
break; break;
case EUserEventType::ObjectPickUp: case EUserEventType::ObjectPickUp:
@ -462,8 +462,8 @@ void COmegaPirate::Enraged(CStateManager& mgr, EStateMsg msg, float dt) {
SetState(CElitePirate::EState::Over); SetState(CElitePirate::EState::Over);
} }
} else if (msg == EStateMsg::Deactivate) { } else if (msg == EStateMsg::Deactivate) {
xadf_ = true; xadf_launcher1FollowPlayer = true;
xae0_ = true; xae0_launcher2FollowPlayer = true;
} }
} }
@ -484,7 +484,7 @@ void COmegaPirate::Explode(CStateManager& mgr, EStateMsg msg, float dt) {
SetState(CElitePirate::EState::Over); SetState(CElitePirate::EState::Over);
} }
} else if (msg == EStateMsg::Deactivate) { } else if (msg == EStateMsg::Deactivate) {
GetBodyController()->SetLocomotionType(xa40_); GetBodyController()->SetLocomotionType(xa40_locomotionType);
} }
} }
@ -493,7 +493,7 @@ void COmegaPirate::Faint(CStateManager& mgr, EStateMsg msg, float dt) {
GetBodyController()->GetCommandMgr().DeliverCmd(CBCLoopReactionCmd(pas::EReactionType::Zero)); GetBodyController()->GetCommandMgr().DeliverCmd(CBCLoopReactionCmd(pas::EReactionType::Zero));
xa44_ = true; xa44_ = true;
xa4a_ = true; xa4a_ = true;
if (xa7c_ == 2) { if (xa7c_xrayAlphaState == EXRayAlphaState::Two) {
xa8c_ = 0.333f; xa8c_ = 0.333f;
} }
for (const auto& entry : x9dc_scriptPlatforms) { for (const auto& entry : x9dc_scriptPlatforms) {
@ -502,29 +502,26 @@ void COmegaPirate::Faint(CStateManager& mgr, EStateMsg msg, float dt) {
} }
} }
} else if (msg == EStateMsg::Update) { } else if (msg == EStateMsg::Update) {
if (xb4c_ < 4 && x9c8_ == 0 && xb58_ >= 2.5f) { if (xb4c_ < 4 && x9c8_scaleState == EScaleState::Zero && xb58_ >= 2.5f) {
float alpha = std::max(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_ > idx) {
CModelFlags flags{5, 0, 3, zeus::skWhite}; CModelFlags flags{5, 0, 3, zeus::skBlack};
flags.addColor = zeus::skBlack;
platform->SetDrawFlags(flags); platform->SetDrawFlags(flags);
} else if (xb4c_ == idx) { } else if (xb4c_ == idx) {
if (!xb6e_) { if (!xb6e_) {
SendScriptMsgs(EScriptObjectState::Entered, mgr, EScriptObjectMessage::None); SendScriptMsgs(EScriptObjectState::Entered, mgr, EScriptObjectMessage::None);
xb6e_ = true; xb6e_ = true;
} }
CModelFlags flags{5, 0, 3, zeus::skWhite}; CModelFlags flags{5, 0, 3, zeus::CColor{invAlpha, alpha}};
flags.addColor = zeus::CColor{invAlpha, alpha};
platform->SetDrawFlags(flags); platform->SetDrawFlags(flags);
} }
} else { } else {
CModelFlags flags{5, 0, 3, zeus::skWhite}; CModelFlags flags{5, 0, 3, zeus::CColor{1.f, 0.f}};
flags.addColor = zeus::CColor{1.f, 0.f};
platform->SetDrawFlags(flags); platform->SetDrawFlags(flags);
} }
} }
@ -550,13 +547,13 @@ void COmegaPirate::Faint(CStateManager& mgr, EStateMsg msg, float dt) {
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_ = 2; x9c8_scaleState = EScaleState::Two;
xad0_ = false; xad0_ = false;
RemoveMaterial(EMaterialTypes::RadarObject, EMaterialTypes::Scannable, mgr); RemoveMaterial(EMaterialTypes::RadarObject, EMaterialTypes::Scannable, mgr);
xb6c_ = false; xb6c_ = false;
xb6d_ = false; xb6d_ = false;
ProcessSoundEvent(0xb27, 1.f, 0, 0.1f, 1000.f, 0.16f, 1.f, zeus::skZero3f, GetTranslation(), mgr.GetNextAreaId(), ProcessSoundEvent(SFXsfx0B27, 1.f, 0, 0.1f, 1000.f, 0.16f, 1.f, zeus::skZero3f, GetTranslation(),
mgr, false); mgr.GetNextAreaId(), mgr, false);
} else if (msg == EStateMsg::Update) { } else if (msg == EStateMsg::Update) {
if (xb68_ == 0) { if (xb68_ == 0) {
if (x330_stateMachineState.GetTime() > 0.3f * xb64_ && !xb6c_) { if (x330_stateMachineState.GetTime() > 0.3f * xb64_ && !xb6c_) {
@ -575,8 +572,8 @@ void COmegaPirate::Growth(CStateManager& mgr, EStateMsg msg, float dt) {
TeleportToFurthestPlatform(mgr); TeleportToFurthestPlatform(mgr);
xad0_ = true; xad0_ = true;
AddMaterial(EMaterialTypes::RadarObject, mgr); AddMaterial(EMaterialTypes::RadarObject, mgr);
ProcessSoundEvent(0xb28, 1.f, 0, 0.1f, 1000.f, 0.16f, 1.f, zeus::skZero3f, GetTranslation(), mgr.GetNextAreaId(), ProcessSoundEvent(SFXsfx0B28, 1.f, 0, 0.1f, 1000.f, 0.16f, 1.f, zeus::skZero3f, GetTranslation(),
mgr, false); mgr.GetNextAreaId(), mgr, false);
} }
} }
@ -585,10 +582,10 @@ void COmegaPirate::JumpBack(CStateManager& mgr, EStateMsg msg, float dt) {
SetShotAt(false, mgr); SetShotAt(false, mgr);
SetState(CElitePirate::EState::Two); SetState(CElitePirate::EState::Two);
xade_ = 0; xade_ = 0;
xadf_ = false; xadf_launcher1FollowPlayer = false;
xae0_ = false; xae0_launcher2FollowPlayer = false;
xb68_ = 0; xb68_ = 0;
xa40_ = GetBodyController()->GetLocomotionType(); xa40_locomotionType = GetBodyController()->GetLocomotionType();
GetBodyController()->SetLocomotionType(pas::ELocomotionType::Internal5); GetBodyController()->SetLocomotionType(pas::ELocomotionType::Internal5);
GetBodyController()->GetCommandMgr().DeliverCmd( GetBodyController()->GetCommandMgr().DeliverCmd(
CBCKnockBackCmd(GetTransform().frontVector(), pas::ESeverity::Five)); CBCKnockBackCmd(GetTransform().frontVector(), pas::ESeverity::Five));
@ -638,7 +635,7 @@ void COmegaPirate::PathFind(CStateManager& mgr, EStateMsg msg, float dt) {
void COmegaPirate::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) { void COmegaPirate::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) {
CElitePirate::PreRender(mgr, frustum); CElitePirate::PreRender(mgr, frustum);
if (mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::XRay) { if (mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::XRay) {
xb4_drawFlags = CModelFlags{1, 0, 3, zeus::CColor{xa80_}}; xb4_drawFlags = CModelFlags{1, 0, 3, zeus::CColor{xa80_xrayAlpha}};
} }
} }
@ -648,11 +645,11 @@ void COmegaPirate::Render(CStateManager& mgr) {
CGraphics::SetModelMatrix(GetTransform() * zeus::CTransform::Scale(mData->GetScale())); CGraphics::SetModelMatrix(GetTransform() * zeus::CTransform::Scale(mData->GetScale()));
if (mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::EPlayerVisor::XRay && xa2c_ > 0.f) { if (mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::EPlayerVisor::XRay && xa2c_skeletonAlpha > 0.f) {
const CModelFlags flags{5, 0, 3, zeus::CColor{1.f, xa2c_}}; const CModelFlags flags{5, 0, 3, zeus::CColor{1.f, xa2c_skeletonAlpha}};
animData->Render(x9f0_, flags, std::nullopt, nullptr); animData->Render(x9f0_skeletonModel, flags, std::nullopt, nullptr);
} }
if (x9a0_) { if (x9a0_visible) {
bool isXRay = mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay; bool isXRay = mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay;
if (isXRay) { if (isXRay) {
g_Renderer->SetWorldFog(ERglFogMode::None, 0.f, 1.f, zeus::skBlack); g_Renderer->SetWorldFog(ERglFogMode::None, 0.f, 1.f, zeus::skBlack);
@ -751,7 +748,7 @@ 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_ = 3; xa7c_xrayAlphaState = EXRayAlphaState::Three;
xa88_ = true; xa88_ = true;
} else if (msg == EStateMsg::Update) { } else if (msg == EStateMsg::Update) {
if (GetState() == CElitePirate::EState::Zero) { if (GetState() == CElitePirate::EState::Zero) {
@ -826,11 +823,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); sub_8028f6f0(mgr, dt);
sub_8028d690(mgr, dt); UpdateSkeleton(mgr, dt);
sub_8028cd04(mgr, dt); UpdateXRayAlpha(mgr, dt);
if ((!x9a1_ || xa4a_) && mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay && xa44_) { if ((!x9a1_fadeIn || xa4a_) && mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay &&
xa44_) {
AddMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr); AddMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr);
if (x9c8_ == 4) { if (x9c8_scaleState == EScaleState::Four) {
xa38_collisionActorMgr1->SetActive(mgr, false); xa38_collisionActorMgr1->SetActive(mgr, false);
xa9c_collisionActorMgr2->SetActive(mgr, false); xa9c_collisionActorMgr2->SetActive(mgr, false);
} else { } else {
@ -843,7 +841,7 @@ void COmegaPirate::Think(float dt, CStateManager& mgr) {
} else { } else {
RemoveMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr); RemoveMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr);
xa38_collisionActorMgr1->SetActive(mgr, false); xa38_collisionActorMgr1->SetActive(mgr, false);
if (x9a1_) { if (x9a1_fadeIn) {
xa9c_collisionActorMgr2->SetActive(mgr, true); xa9c_collisionActorMgr2->SetActive(mgr, true);
if (auto* entity = mgr.ObjectById(xa48_)) { if (auto* entity = mgr.ObjectById(xa48_)) {
entity->SetActive(true); entity->SetActive(true);
@ -856,7 +854,7 @@ void COmegaPirate::Think(float dt, CStateManager& mgr) {
} }
} }
sub_8028d7e4(mgr, dt); UpdateScale(mgr, dt);
xa38_collisionActorMgr1->Update(dt, mgr, CCollisionActorManager::EUpdateOptions::ObjectSpace); xa38_collisionActorMgr1->Update(dt, mgr, CCollisionActorManager::EUpdateOptions::ObjectSpace);
xa9c_collisionActorMgr2->Update(dt, mgr, CCollisionActorManager::EUpdateOptions::ObjectSpace); xa9c_collisionActorMgr2->Update(dt, mgr, CCollisionActorManager::EUpdateOptions::ObjectSpace);
@ -879,7 +877,7 @@ void COmegaPirate::Think(float dt, CStateManager& mgr) {
x9b4_ = true; x9b4_ = true;
} }
} else { } else {
Destroy(mgr); DeathDestroy(mgr);
} }
sub_8028c704(mgr, dt); sub_8028c704(mgr, dt);
@ -925,10 +923,10 @@ void COmegaPirate::Think(float dt, CStateManager& mgr) {
} }
if (auto* launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(GetLauncherId()))) { if (auto* launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(GetLauncherId()))) {
launcher->SetFollowPlayer(xadf_); launcher->SetFollowPlayer(xadf_launcher1FollowPlayer);
} }
if (auto* launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(x990_launcherId2))) { if (auto* launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(x990_launcherId2))) {
launcher->SetFollowPlayer(xae0_); launcher->SetFollowPlayer(xae0_launcher2FollowPlayer);
} }
if (x9ec_) { if (x9ec_) {
@ -1050,7 +1048,7 @@ void COmegaPirate::SetupCollisionActorInfo1(const std::unique_ptr<CCollisionActo
CMaterialFilter::MakeIncludeExclude(selfFilter.GetIncludeList(), selfFilter.GetExcludeList()); CMaterialFilter::MakeIncludeExclude(selfFilter.GetIncludeList(), selfFilter.GetExcludeList());
filter.IncludeList().Add(actFilter.GetIncludeList()); filter.IncludeList().Add(actFilter.GetIncludeList());
filter.ExcludeList().Add(actFilter.GetExcludeList()); filter.ExcludeList().Add(actFilter.GetExcludeList());
filter.ExcludeList().Add(EMaterialTypes::Platform); // ? filter.ExcludeList().Add(EMaterialTypes::Platform);
act->SetMaterialFilter(filter); act->SetMaterialFilter(filter);
act->RemoveMaterial(EMaterialTypes::ProjectilePassthrough, mgr); act->RemoveMaterial(EMaterialTypes::ProjectilePassthrough, mgr);
} }
@ -1069,10 +1067,10 @@ void COmegaPirate::SetupCollisionActorInfo2(const std::unique_ptr<CCollisionActo
CMaterialFilter filter = CMaterialFilter filter =
CMaterialFilter::MakeIncludeExclude(selfFilter.GetIncludeList(), selfFilter.GetExcludeList()); CMaterialFilter::MakeIncludeExclude(selfFilter.GetIncludeList(), selfFilter.GetExcludeList());
filter.IncludeList().Add(actFilter.GetIncludeList()); filter.IncludeList().Add(actFilter.GetIncludeList());
filter.IncludeList().Add(EMaterialTypes::Player); // ? filter.IncludeList().Add(EMaterialTypes::Player);
filter.ExcludeList().Add(actFilter.GetExcludeList()); filter.ExcludeList().Add(actFilter.GetExcludeList());
filter.ExcludeList().Remove(EMaterialTypes::Player); // ? filter.ExcludeList().Remove(EMaterialTypes::Player);
filter.ExcludeList().Add(EMaterialTypes::Platform); // ? filter.ExcludeList().Add(EMaterialTypes::Platform);
act->SetMaterialFilter(filter); act->SetMaterialFilter(filter);
act->RemoveMaterial(EMaterialTypes::ProjectilePassthrough, mgr); act->RemoveMaterial(EMaterialTypes::ProjectilePassthrough, mgr);
act->SetDamageVulnerability(CDamageVulnerability::ReflectVulnerabilty()); act->SetDamageVulnerability(CDamageVulnerability::ReflectVulnerabilty());
@ -1125,7 +1123,7 @@ void COmegaPirate::sub_8028c840(u32 arg, CStateManager& mgr) {
sub_8028cbec(arg, mgr); sub_8028cbec(arg, mgr);
} else { } else {
s32 rand = mgr.GetActiveRandom()->Next(); s32 rand = mgr.GetActiveRandom()->Next();
int sz = vec.size(); // might be wrong? int sz = vec.size();
int val = vec[rand - (rand / sz) * sz]; int val = vec[rand - (rand / sz) * sz];
u32 v = 3 - (xab4_.size() + sub_8028c230()); u32 v = 3 - (xab4_.size() + sub_8028c230());
u32 ct = std::min(arg, v); u32 ct = std::min(arg, v);
@ -1144,7 +1142,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_) { if (dist > maxDist && waypoint->GetUniqueId() != xada_waypointId) {
waypointIdx = i; waypointIdx = i;
maxDist = dist; maxDist = dist;
pos = waypointPos; pos = waypointPos;
@ -1154,7 +1152,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; xada_waypointId = 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);
} }
@ -1175,45 +1173,45 @@ zeus::CVector3f COmegaPirate::FindGround(const zeus::CVector3f& pos, CStateManag
} }
void COmegaPirate::sub_8028f6f0(CStateManager& mgr, float dt) { void COmegaPirate::sub_8028f6f0(CStateManager& mgr, float dt) {
if (x994_ == 1) { if (x994_fadeState == EFadeState::One) {
x99c_ = 1.f - std::min(x998_, 1.25f) / 1.25f; x99c_alpha = 1.f - std::min(x998_, 1.25f) / 1.25f;
x42c_color.a() = x99c_; x42c_color.a() = x99c_alpha;
if (x998_ > 1.25f) { if (x998_ > 1.25f) {
x994_ = 2; x994_fadeState = EFadeState::Two;
x9a1_ = false; x9a1_fadeIn = false;
x998_ = 0.f; x998_ = 0.f;
} }
x998_ += dt; x998_ += dt;
x9a0_ = true; x9a0_visible = true;
} else if (x994_ == 2) { } else if (x994_fadeState == EFadeState::Two) {
x99c_ = 0.f; x99c_alpha = 0.f;
if (x998_ > 1.5f && x9a1_) { if (x998_ > 1.5f && x9a1_fadeIn) {
CreateFlash(mgr, 0.f); CreateFlash(mgr, 0.f);
x994_ = 3; x994_fadeState = EFadeState::Three;
x998_ = 0.f; x998_ = 0.f;
} }
x998_ += dt; x998_ += dt;
x9a0_ = false; x9a0_visible = false;
} else if (x994_ == 3) { } else if (x994_fadeState == EFadeState::Three) {
x99c_ = std::min(x998_, 1.f) / 1.25f; x99c_alpha = std::min(x998_, 1.f) / 1.25f;
if (x998_ > 1.f) { if (x998_ > 1.f) {
x994_ = 0; x994_fadeState = EFadeState::Zero;
x998_ = 0.f; x998_ = 0.f;
} }
x998_ += dt; x998_ += dt;
x9a0_ = true; x9a0_visible = true;
} else { } else {
x99c_ = 1.f; x99c_alpha = 1.f;
x9a0_ = true; x9a0_visible = true;
} }
float alpha = x99c_; float alpha = x99c_alpha;
if (mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay) { if (mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay) {
alpha = 0.f; alpha = 0.f;
x99c_ = 1.f; x99c_alpha = 1.f;
x9a0_ = true; x9a0_visible = true;
} }
x42c_color.a() = x99c_; x42c_color.a() = x99c_alpha;
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()))) {
@ -1263,94 +1261,94 @@ void COmegaPirate::sub_8028c704(CStateManager& mgr, float dt) {
xab0_ -= dt; xab0_ -= dt;
} }
void COmegaPirate::sub_8028cd04(CStateManager& mgr, float dt) { void COmegaPirate::UpdateXRayAlpha(CStateManager& mgr, float dt) {
if (xa7c_ == 1) { if (xa7c_xrayAlphaState == EXRayAlphaState::One) {
xa80_ = std::min(xa84_, xa90_) / xa90_; xa80_xrayAlpha = std::min(xa84_xrayAlphaStateTime, xa90_) / xa90_;
if (xa90_ < xa84_) { if (xa90_ < xa84_xrayAlphaStateTime) {
xa7c_ = 0; xa7c_xrayAlphaState = EXRayAlphaState::Zero;
xa84_ = 0.f; xa84_xrayAlphaStateTime = 0.f;
} }
xa84_ += dt; xa84_xrayAlphaStateTime += dt;
} else if (xa7c_ == 2) { } else if (xa7c_xrayAlphaState == EXRayAlphaState::Two) {
xa80_ = 0.f; xa80_xrayAlpha = 0.f;
if ((xa94_ < xa84_) && !xa88_) { if ((xa94_ < xa84_xrayAlphaStateTime) && !xa88_) {
xa7c_ = 1; xa7c_xrayAlphaState = EXRayAlphaState::One;
xa84_ = 0.f; xa84_xrayAlphaStateTime = 0.f;
} }
xa84_ += dt; xa84_xrayAlphaStateTime += dt;
} else if (xa7c_ == 3) { } else if (xa7c_xrayAlphaState == EXRayAlphaState::Three) {
xa80_ = 1.f - std::min(xa84_, xa8c_) / xa8c_; xa80_xrayAlpha = 1.f - std::min(xa84_xrayAlphaStateTime, xa8c_) / xa8c_;
if (xa8c_ < xa84_) { if (xa8c_ < xa84_xrayAlphaStateTime) {
xa7c_ = 2; xa7c_xrayAlphaState = EXRayAlphaState::Two;
xa84_ = 0.f; xa84_xrayAlphaStateTime = 0.f;
} }
xa84_ += dt; xa84_xrayAlphaStateTime += dt;
} else { } else {
xa80_ = 1.f; xa80_xrayAlpha = 1.f;
} }
} }
void COmegaPirate::sub_8028d7e4(CStateManager& mgr, float dt) { 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_) { switch (x9c8_scaleState) {
case 0: case EScaleState::Zero:
default: default:
return; return;
case 1: case EScaleState::One:
scale.x() = x9d0_.x() * std::min(1.f, 0.005f + (1.f - std::min(x9cc_, 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_ > 0.25f) { if (x9cc_scaleTime > 0.25f) {
x9c8_ = 3; x9c8_scaleState = EScaleState::Three;
x9cc_ = 0.f; x9cc_scaleTime = 0.f;
} }
x9cc_ += dt; x9cc_scaleTime += dt;
break; break;
case 2: case EScaleState::Two:
scale.y() = x9d0_.y() * std::min(1.f, 0.005f + (1.f - std::min(x9cc_, 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_ > 0.25f) { if (x9cc_scaleTime > 0.25f) {
x9c8_ = 1; x9c8_scaleState = EScaleState::One;
x9cc_ = 0.f; x9cc_scaleTime = 0.f;
} }
x9cc_ += dt; x9cc_scaleTime += dt;
break; break;
case 3: case EScaleState::Three:
scale.z() = x9d0_.z() * std::min(1.f, 0.005f + (1.f - std::min(x9cc_, 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_ > 0.25f) { if (x9cc_scaleTime > 0.25f) {
x9c8_ = 4; x9c8_scaleState = EScaleState::Four;
x9cc_ = 0.f; x9cc_scaleTime = 0.f;
} }
x9cc_ += dt; x9cc_scaleTime += dt;
break; break;
case 4: case EScaleState::Four:
if (x9cc_ > 0.1f && xad0_) { if (x9cc_scaleTime > 0.1f && xad0_) {
x9c8_ = 7; x9c8_scaleState = EScaleState::Seven;
x9cc_ = 0.f; x9cc_scaleTime = 0.f;
} }
x9cc_ += dt; x9cc_scaleTime += dt;
break; break;
case 5: case EScaleState::Five:
scale.x() = x9d0_.x() * std::min(1.f, 0.005f + (1.f - std::min(x9cc_, 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_ > 0.25f) { if (x9cc_scaleTime > 0.25f) {
x9c8_ = 6; x9c8_scaleState = EScaleState::Six;
x9cc_ = 0.f; x9cc_scaleTime = 0.f;
} }
x9cc_ += dt; x9cc_scaleTime += dt;
break; break;
case 6: case EScaleState::Six:
scale.y() = x9d0_.y() * std::min(1.f, 0.005f + (1.f - std::min(x9cc_, 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_ > 0.25f) { if (x9cc_scaleTime > 0.25f) {
x9c8_ = 0; x9c8_scaleState = EScaleState::Zero;
x9cc_ = 0.f; x9cc_scaleTime = 0.f;
} }
x9cc_ += dt; x9cc_scaleTime += dt;
break; break;
case 7: case EScaleState::Seven:
scale.z() = x9d0_.z() * std::min(1.f, 0.005f + (1.f - std::min(x9cc_, 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_ > 0.25f) { if (x9cc_scaleTime > 0.25f) {
x9c8_ = 5; x9c8_scaleState = EScaleState::Five;
x9cc_ = 0.f; x9cc_scaleTime = 0.f;
} }
x9cc_ += dt; x9cc_scaleTime += dt;
break; break;
} }
@ -1368,38 +1366,38 @@ void COmegaPirate::sub_8028d7e4(CStateManager& mgr, float dt) {
} }
} }
void COmegaPirate::sub_8028d690(CStateManager& mgr, float dt) { void COmegaPirate::UpdateSkeleton(CStateManager& mgr, float dt) {
if (xa30_ == 1) { if (xa30_skeletonState == ESkeletonState::One) {
xa2c_ = 1.f - std::min(xa34_, 1.f); xa2c_skeletonAlpha = 1.f - std::min(xa34_skeletonStateTime, 1.f);
if (xa34_ > 1.f) { if (xa34_skeletonStateTime > 1.f) {
xa30_ = 0; xa30_skeletonState = ESkeletonState::Zero;
xa34_ = 0.f; xa34_skeletonStateTime = 0.f;
} }
xa34_ += dt; xa34_skeletonStateTime += dt;
} else if (xa30_ == 2) { } else if (xa30_skeletonState == ESkeletonState::Two) {
xa2c_ = 1.f; xa2c_skeletonAlpha = 1.f;
if (xa34_ > 1.f) { if (xa34_skeletonStateTime > 1.f) {
xa30_ = 1; xa30_skeletonState = ESkeletonState::One;
xa34_ = 0.f; xa34_skeletonStateTime = 0.f;
CreateFlash(mgr, 0.75f); CreateFlash(mgr, 0.75f);
} }
xa34_ += dt; xa34_skeletonStateTime += dt;
} else if (xa30_ == 3) { } else if (xa30_skeletonState == ESkeletonState::Three) {
xa2c_ = std::min(xa34_, 1.f); xa2c_skeletonAlpha = std::min(xa34_skeletonStateTime, 1.f);
if (xa34_ > 1.f) { if (xa34_skeletonStateTime > 1.f) {
xa30_ = 2; xa30_skeletonState = ESkeletonState::Two;
xa34_ = 0.f; xa34_skeletonStateTime = 0.f;
} }
xa34_ += dt; xa34_skeletonStateTime += dt;
} else { } else {
xa2c_ = 0.f; xa2c_skeletonAlpha = 0.f;
} }
} }
void COmegaPirate::Destroy(CStateManager& mgr) { void COmegaPirate::DeathDestroy(CStateManager& mgr) {
RemoveEmitter(); RemoveEmitter();
SetTransform(xa4c_initialXf); SetTransform(xa4c_initialXf);
x9a1_ = true; x9a1_fadeIn = true;
xa4a_ = false; xa4a_ = 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);

View File

@ -28,34 +28,58 @@ private:
}; };
TUniqueId x990_launcherId2 = kInvalidUniqueId; TUniqueId x990_launcherId2 = kInvalidUniqueId;
int x994_ = 0; enum class EFadeState {
Zero,
One,
Two,
Three,
} x994_fadeState = EFadeState::Zero;
float x998_ = 0.f; float x998_ = 0.f;
float x99c_ = 1.f; float x99c_alpha = 1.f;
bool x9a0_ = true; bool x9a0_visible = true;
bool x9a1_ = 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;
int x9c8_ = 0; enum class EScaleState {
float x9cc_ = 0.f; Zero,
zeus::CVector3f x9d0_; One,
Two,
Three,
Four,
Five,
Six,
Seven,
} x9c8_scaleState = EScaleState::Zero;
float x9cc_scaleTime = 0.f;
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_ = false;
CSkinnedModel x9f0_; CSkinnedModel x9f0_skeletonModel;
float xa2c_ = 0.f; float xa2c_skeletonAlpha = 0.f;
int xa30_ = 0; enum class ESkeletonState {
float xa34_ = 0.f; Zero,
One,
Two,
Three,
} xa30_skeletonState = ESkeletonState::Zero;
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_ = pas::ELocomotionType::Relaxed; pas::ELocomotionType xa40_locomotionType = pas::ELocomotionType::Relaxed;
bool xa44_ = false; bool xa44_ = false;
TUniqueId xa46_ = kInvalidUniqueId; TUniqueId xa46_ = kInvalidUniqueId;
TUniqueId xa48_ = kInvalidUniqueId; TUniqueId xa48_ = kInvalidUniqueId;
bool xa4a_ = false; bool xa4a_ = false;
zeus::CTransform xa4c_initialXf; zeus::CTransform xa4c_initialXf;
int xa7c_ = 0; enum class EXRayAlphaState {
float xa80_ = 1.f; Zero,
float xa84_ = 0.f; One,
Two,
Three,
} xa7c_xrayAlphaState = EXRayAlphaState::Zero;
float xa80_xrayAlpha = 1.f;
float xa84_xrayAlphaStateTime = 0.f;
bool xa88_ = false; bool xa88_ = false;
float xa8c_ = 3.f; float xa8c_ = 3.f;
float xa90_ = 1.f; float xa90_ = 1.f;
@ -71,12 +95,12 @@ private:
bool xad0_ = false; bool xad0_ = false;
float xad4_cachedSpeed = 1.f; float xad4_cachedSpeed = 1.f;
bool xad8_cover = false; bool xad8_cover = false;
TUniqueId xada_ = kInvalidUniqueId; TUniqueId xada_waypointId = kInvalidUniqueId;
bool xadc_ = false; bool xadc_ = false;
bool xadd_ = false; bool xadd_ = false;
u8 xade_ = 0; u8 xade_ = 0;
bool xadf_ = true; bool xadf_launcher1FollowPlayer = true;
bool xae0_ = true; bool xae0_launcher2FollowPlayer = true;
CDamageVulnerability xae4_platformVuln = CDamageVulnerability::NormalVulnerabilty(); CDamageVulnerability xae4_platformVuln = CDamageVulnerability::NormalVulnerabilty();
int xb4c_ = 0; int xb4c_ = 0;
float xb50_ = 0.f; float xb50_ = 0.f;
@ -157,10 +181,10 @@ private:
void TeleportToFurthestPlatform(CStateManager& mgr); void TeleportToFurthestPlatform(CStateManager& mgr);
void sub_8028f6f0(CStateManager& mgr, float dt); void sub_8028f6f0(CStateManager& mgr, float dt);
void sub_8028c704(CStateManager& mgr, float dt); void sub_8028c704(CStateManager& mgr, float dt);
void sub_8028cd04(CStateManager& mgr, float dt); void UpdateXRayAlpha(CStateManager& mgr, float dt);
void sub_8028d7e4(CStateManager& mgr, float dt); void UpdateScale(CStateManager& mgr, float dt);
void sub_8028d690(CStateManager& mgr, float dt); void UpdateSkeleton(CStateManager& mgr, float dt);
void Destroy(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;
}; };