2018-11-17 05:05:57 +00:00
|
|
|
#include <Runtime/World/CPatternedInfo.hpp>
|
2018-10-11 22:57:05 +00:00
|
|
|
#include "CFireFlea.hpp"
|
2018-11-10 02:47:07 +00:00
|
|
|
#include "CStateManager.hpp"
|
|
|
|
#include "CPlayerState.hpp"
|
2018-11-17 05:05:57 +00:00
|
|
|
#include "World/CWorld.hpp"
|
2018-11-10 02:47:07 +00:00
|
|
|
#include "TCastTo.hpp"
|
2018-10-11 22:57:05 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace urde::MP1 {
|
2018-10-11 22:57:05 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
// region Fire Flea Death Camera
|
2018-11-10 02:47:07 +00:00
|
|
|
|
|
|
|
const zeus::CColor CFireFlea::CDeathCameraEffect::skEndFadeColor{1.f, 1.f, 0.5f, 1.f};
|
|
|
|
const zeus::CColor CFireFlea::CDeathCameraEffect::skStartFadeColor{1.f, 0.f, 0.f, 0.f};
|
|
|
|
zeus::CColor CFireFlea::CDeathCameraEffect::sCurrentFadeColor = zeus::CColor::skClear;
|
|
|
|
|
|
|
|
CFireFlea::CDeathCameraEffect::CDeathCameraEffect(TUniqueId uid, TAreaId areaId, std::string_view name)
|
2018-12-08 05:30:43 +00:00
|
|
|
: CEntity(uid, CEntityInfo(areaId, CEntity::NullConnectionList), true, name) {}
|
|
|
|
|
|
|
|
void CFireFlea::CDeathCameraEffect::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
|
|
|
|
|
|
|
void CFireFlea::CDeathCameraEffect::PreThink(float dt, CStateManager& mgr) {
|
|
|
|
CCameraFilterPassPoly& filterPass = mgr.GetCameraFilterPass(5);
|
|
|
|
u32 r5 = x34_ + x38_;
|
|
|
|
u32 r8 = r5 + x3c_;
|
|
|
|
u32 r31 = r8 + x40_;
|
|
|
|
if (x44_ >= x34_ && x44_ <= r5) {
|
|
|
|
sCurrentFadeColor += zeus::CColor::lerp(skStartFadeColor, skEndFadeColor, x34_ - x44_);
|
|
|
|
filterPass.SetFilter(EFilterType::Blend, EFilterShape::Fullscreen, 0.f, sCurrentFadeColor, CAssetId());
|
|
|
|
} else if (x44_ >= r8 && x44_ <= r31) {
|
|
|
|
sCurrentFadeColor += zeus::CColor::lerp(skEndFadeColor, skStartFadeColor, r8 - x44_);
|
|
|
|
filterPass.SetFilter(EFilterType::Blend, EFilterShape::Fullscreen, 0.f, sCurrentFadeColor, CAssetId());
|
|
|
|
} else if (x44_ > r5) {
|
|
|
|
sCurrentFadeColor = skEndFadeColor;
|
|
|
|
filterPass.SetFilter(EFilterType::Blend, EFilterShape::Fullscreen, 0.f, sCurrentFadeColor, CAssetId());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (r31 == x44_) {
|
|
|
|
filterPass.DisableFilter(0.f);
|
|
|
|
mgr.FreeScriptObject(GetUniqueId());
|
|
|
|
x44_ = 0;
|
|
|
|
} else
|
|
|
|
x44_++;
|
|
|
|
|
|
|
|
if (mgr.GetPlayerState()->GetActiveVisor(mgr) != CPlayerState::EPlayerVisor::Thermal)
|
|
|
|
filterPass.DisableFilter(0.f);
|
2018-11-10 02:47:07 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFireFlea::CDeathCameraEffect::Think(float dt, CStateManager& mgr) { sCurrentFadeColor = zeus::CColor::skClear; }
|
2018-11-10 02:47:07 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
// endregion
|
2018-11-10 02:47:07 +00:00
|
|
|
|
2018-11-17 05:05:57 +00:00
|
|
|
s32 CFireFlea::sLightIdx = 0;
|
|
|
|
|
2018-10-11 22:57:05 +00:00
|
|
|
CFireFlea::CFireFlea(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
2018-11-17 05:05:57 +00:00
|
|
|
CModelData&& mData, const CActorParameters& actParms, const CPatternedInfo& pInfo, float f1)
|
2018-12-08 05:30:43 +00:00
|
|
|
: CPatterned(ECharacter::FireFlea, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
|
|
|
|
EMovementType::Flyer, EColliderType::One, EBodyType::NewFlyer, actParms, EKnockBackVariant::Small)
|
|
|
|
, x56c_(f1)
|
|
|
|
, xd8c_pathFind(nullptr, 2, pInfo.GetPathfindingIndex(), 1.f, 1.f) {
|
|
|
|
CMaterialFilter filter = GetMaterialFilter();
|
|
|
|
filter.ExcludeList().Add(EMaterialTypes::Character);
|
|
|
|
SetMaterialFilter(filter);
|
|
|
|
|
|
|
|
ModelData()->AnimationData()->SetParticleLightIdx(sLightIdx);
|
|
|
|
++sLightIdx;
|
2018-11-17 05:05:57 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFireFlea::Dead(CStateManager& mgr, EStateMsg msg, float dt) {
|
|
|
|
if (msg != EStateMsg::Activate || mgr.GetPlayerState()->GetActiveVisor(mgr) != CPlayerState::EPlayerVisor::Thermal)
|
|
|
|
return;
|
2018-11-17 05:05:57 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
mgr.AddObject(new CDeathCameraEffect(mgr.AllocateUniqueId(), GetAreaIdAlways(), ""sv));
|
2018-11-17 05:05:57 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
bool CFireFlea::Delay(CStateManager&, float arg) { return x330_stateMachineState.GetTime() > 0.5f; }
|
2018-10-11 22:57:05 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFireFlea::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
|
|
|
|
|
|
|
void CFireFlea::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) {
|
|
|
|
CPatterned::AcceptScriptMsg(msg, uid, mgr);
|
2018-11-17 05:05:57 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
if (msg == EScriptObjectMessage::Registered) {
|
|
|
|
x450_bodyController->Activate(mgr);
|
|
|
|
} else if (msg == EScriptObjectMessage::InitializedInArea) {
|
|
|
|
xd8c_pathFind.SetArea(mgr.GetWorld()->GetAreaAlways(GetAreaIdAlways())->GetPostConstructed()->x10bc_pathArea);
|
|
|
|
xe64_ = 50.f;
|
|
|
|
}
|
2018-11-17 05:05:57 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
bool CFireFlea::InPosition(CStateManager& mgr, float dt) {
|
|
|
|
if (x2dc_destObj == kInvalidUniqueId)
|
|
|
|
return false;
|
|
|
|
return (xd80_ - GetTranslation()).magnitude() < 25.f;
|
2018-10-11 22:57:05 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace urde::MP1
|