mirror of https://github.com/AxioDL/metaforce.git
More bug fixes
This commit is contained in:
parent
055c8e8a47
commit
979a54a8a8
|
@ -17,23 +17,23 @@ struct Effect : IScriptObject
|
|||
Value<atVec3f> scale;
|
||||
UniqueID32 part;
|
||||
UniqueID32 elsc;
|
||||
Value<bool> unknown1;
|
||||
Value<bool> unknown2;
|
||||
Value<bool> unknown3;
|
||||
Value<bool> unknown4;
|
||||
Value<bool> unknown5;
|
||||
Value<float> unknown6;
|
||||
Value<float> unknown7;
|
||||
Value<float> unknown8;
|
||||
Value<float> unknown9;
|
||||
Value<bool> unknown10;
|
||||
Value<float> unknown11;
|
||||
Value<float> unknown12;
|
||||
Value<float> unknown13;
|
||||
Value<bool> unknown14;
|
||||
Value<bool> unknown15;
|
||||
Value<bool> unknown16;
|
||||
Value<bool> unknown17;
|
||||
Value<bool> hotInThermal;
|
||||
Value<bool> noTimerUnlessAreaOccluded;
|
||||
Value<bool> rebuildSystemsOnActivate;
|
||||
Value<bool> active;
|
||||
Value<bool> useRateInverseCamDist;
|
||||
Value<float> rateInverseCamDist;
|
||||
Value<float> rateInverseCamDistRate;
|
||||
Value<float> duration;
|
||||
Value<float> durationResetWhileVisible;
|
||||
Value<bool> useRateCamDistRange;
|
||||
Value<float> rateCamDistRangeMin;
|
||||
Value<float> rateCamDistRangeMax;
|
||||
Value<float> rateCamDistRangeFarRate;
|
||||
Value<bool> combatVisorVisible;
|
||||
Value<bool> thermalVisorVisible;
|
||||
Value<bool> xrayVisorVisible;
|
||||
Value<bool> dieWhenSystemsDone;
|
||||
LightParameters lightParameters;
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
|
||||
|
|
|
@ -758,7 +758,7 @@ void CStateManager::DrawWorld() const
|
|||
{
|
||||
if (TCastToPtr<CActor> actor = ent)
|
||||
{
|
||||
if (!actor->xe7_29_actorActive)
|
||||
if (!actor->xe7_29_drawEnabled)
|
||||
continue;
|
||||
TUniqueId actorId = actor->GetUniqueId();
|
||||
if (!thermal && area.LookupPVSUniqueID(actorId) == actorId)
|
||||
|
|
|
@ -24,7 +24,7 @@ CGameCamera::CGameCamera(TUniqueId uid, bool active, std::string_view name, cons
|
|||
, x184_fov(fovy)
|
||||
{
|
||||
|
||||
xe7_29_actorActive = false;
|
||||
xe7_29_drawEnabled = false;
|
||||
}
|
||||
|
||||
void CGameCamera::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)
|
||||
|
@ -46,7 +46,7 @@ void CGameCamera::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat
|
|||
void CGameCamera::SetActive(bool active)
|
||||
{
|
||||
CActor::SetActive(active);
|
||||
xe7_29_actorActive = false;
|
||||
xe7_29_drawEnabled = false;
|
||||
}
|
||||
|
||||
zeus::CMatrix4f CGameCamera::GetPerspectiveMatrix() const
|
||||
|
|
|
@ -571,8 +571,8 @@ CFluidPlaneShader::BuildShader(boo::GLDataFactory::Context& ctx, const SFluidPla
|
|||
const char* texNames[3] = {};
|
||||
std::string finalVS, finalFS;
|
||||
_BuildShader(finalVS, finalFS, nextTex, texNames, info);
|
||||
const char* uniNames[] = {"FluidPlaneUniform"};
|
||||
return ctx.newShaderPipeline(finalVS.c_str(), finalFS.c_str(), size_t(nextTex), texNames, 1, uniNames,
|
||||
const char* uniNames[] = {"FluidPlaneUniform", "FluidPlaneUniform", "LightingUniform"};
|
||||
return ctx.newShaderPipeline(finalVS.c_str(), finalFS.c_str(), size_t(nextTex), texNames, 3, uniNames,
|
||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, false,
|
||||
boo::CullMode::None);
|
||||
|
|
|
@ -176,6 +176,7 @@ public:
|
|||
boo::ObjToken<boo::IGraphicsBufferD> m_uniformBufPmus;
|
||||
|
||||
CGenDescription* GetDesc() {return x1c_genDesc.GetObj();}
|
||||
const SObjectTag* GetDescTag() const {return x1c_genDesc.GetObjectTag();}
|
||||
|
||||
static bool g_ParticleSystemInitialized;
|
||||
static int g_ParticleAliveCount;
|
||||
|
|
|
@ -66,12 +66,12 @@ CVECone::CVECone(CVectorElement* a, CRealElement* b)
|
|||
{
|
||||
zeus::CVector3f av;
|
||||
x4_direction->GetValue(0, av);
|
||||
av.normalize();
|
||||
if (av[0] > 0.8)
|
||||
zeus::CVector3f avNorm = av.normalized();
|
||||
if (avNorm.x > 0.8)
|
||||
xc_xVec = av.cross(zeus::CVector3f(0.f, 1.f, 0.f));
|
||||
else
|
||||
xc_xVec = av.cross(zeus::CVector3f(1.f, 0.f, 0.f));
|
||||
x18_yVec = av.cross(xc_xVec);
|
||||
x18_yVec = avNorm.cross(xc_xVec);
|
||||
}
|
||||
|
||||
bool CVECone::GetValue(int frame, zeus::CVector3f& valOut) const
|
||||
|
|
|
@ -51,7 +51,7 @@ CActor::CActor(TUniqueId uid, bool active, std::string_view name, const CEntityI
|
|||
xe6_29_renderParticleDBInside = true;
|
||||
xe6_31_targetableVisorFlags = params.GetVisorParameters().GetMask();
|
||||
xe7_27_enableRender = true;
|
||||
xe7_29_actorActive = active;
|
||||
xe7_29_drawEnabled = active;
|
||||
xe7_30_doTargetDistanceTest = true;
|
||||
xe7_31_targetable = true;
|
||||
if (x64_modelData)
|
||||
|
@ -77,11 +77,18 @@ void CActor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMana
|
|||
{
|
||||
if (!x30_24_active)
|
||||
xbc_time = CGraphics::GetSecondsMod900();
|
||||
}
|
||||
break;
|
||||
case EScriptObjectMessage::Decrement:
|
||||
}
|
||||
case EScriptObjectMessage::Deactivate:
|
||||
RemoveEmitter();
|
||||
break;
|
||||
case EScriptObjectMessage::Deleted: // 34
|
||||
{
|
||||
RemoveEmitter();
|
||||
if (HasModelData() && x64_modelData->AnimationData() && x64_modelData->GetNormalModel())
|
||||
x64_modelData->AnimationData()->GetParticleDB().DeleteAllLights(mgr);
|
||||
break;
|
||||
}
|
||||
case EScriptObjectMessage::Registered: // 33
|
||||
{
|
||||
if (x98_scanObjectInfo)
|
||||
|
@ -94,14 +101,13 @@ void CActor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMana
|
|||
TAreaId aid = GetAreaId();
|
||||
x64_modelData->AnimationData()->InitializeEffects(mgr, aid, x64_modelData->GetScale());
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EScriptObjectMessage::Deleted: // 34
|
||||
{
|
||||
RemoveEmitter();
|
||||
if (HasModelData() && x64_modelData->AnimationData() && x64_modelData->GetNormalModel())
|
||||
x64_modelData->AnimationData()->GetParticleDB().DeleteAllLights(mgr);
|
||||
}
|
||||
case EScriptObjectMessage::UpdateSplashInhabitant: // 37
|
||||
SetInFluid(true, uid);
|
||||
break;
|
||||
case EScriptObjectMessage::RemoveSplashInhabitant: // 39
|
||||
SetInFluid(false, kInvalidUniqueId);
|
||||
break;
|
||||
case EScriptObjectMessage::InitializedInArea: // 35
|
||||
{
|
||||
|
@ -114,14 +120,8 @@ void CActor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMana
|
|||
if (act && xc6_nextDrawNode == kInvalidUniqueId)
|
||||
xc6_nextDrawNode = act->GetUniqueId();
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case EScriptObjectMessage::UpdateSplashInhabitant: // 37
|
||||
SetInFluid(true, uid);
|
||||
break;
|
||||
case EScriptObjectMessage::RemoveSplashInhabitant: // 39
|
||||
SetInFluid(false, kInvalidUniqueId);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ protected:
|
|||
u8 xe6_31_targetableVisorFlags : 4;
|
||||
bool xe7_27_enableRender : 1;
|
||||
bool xe7_28_worldLightingDirty : 1;
|
||||
bool xe7_29_actorActive : 1;
|
||||
bool xe7_29_drawEnabled : 1;
|
||||
bool xe7_30_doTargetDistanceTest : 1;
|
||||
bool xe7_31_targetable : 1;
|
||||
};
|
||||
|
@ -110,7 +110,7 @@ public:
|
|||
xe4_27_notInSortedLists = true;
|
||||
xe4_28_transformDirty = true;
|
||||
xe4_29_actorLightsDirty = true;
|
||||
xe7_29_actorActive = active;
|
||||
xe7_29_drawEnabled = active;
|
||||
CEntity::SetActive(active);
|
||||
}
|
||||
virtual void PreRender(CStateManager&, const zeus::CFrustum&);
|
||||
|
@ -184,7 +184,7 @@ public:
|
|||
const CActorLights* GetActorLights() const { return x90_actorLights.get(); }
|
||||
CActorLights* ActorLights() { return x90_actorLights.get(); }
|
||||
bool CanDrawStatic() const;
|
||||
bool IsActorActive() const { return xe7_29_actorActive; }
|
||||
bool IsActorActive() const { return xe7_29_drawEnabled; }
|
||||
void SetWorldLightingDirty(bool b) { xe7_28_worldLightingDirty = b; }
|
||||
const CScannableObjectInfo* GetScannableObjectInfo() const;
|
||||
const CHealthInfo* GetHealthInfo(const CStateManager& mgr) const
|
||||
|
|
|
@ -46,22 +46,9 @@ void CScriptActor::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
|||
|
||||
void CScriptActor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)
|
||||
{
|
||||
if (msg == EScriptObjectMessage::Reset)
|
||||
{
|
||||
x2e2_25_dead = false;
|
||||
x260_currentHealth = x258_initialHealth;
|
||||
}
|
||||
else if (msg == EScriptObjectMessage::Increment && !GetActive())
|
||||
{
|
||||
mgr.SendScriptMsg(this, x8_uid, EScriptObjectMessage::Activate);
|
||||
CScriptColorModulate::FadeInHelper(mgr, x8_uid, x2d0_alphaMax);
|
||||
}
|
||||
else if (msg == EScriptObjectMessage::Decrement)
|
||||
{
|
||||
CScriptColorModulate::FadeOutHelper(mgr, x8_uid, x2d4_alphaMin);
|
||||
}
|
||||
else if (msg == EScriptObjectMessage::InitializedInArea)
|
||||
switch (msg)
|
||||
{
|
||||
case EScriptObjectMessage::InitializedInArea:
|
||||
for (const SConnection& conn : x20_conns)
|
||||
{
|
||||
if (conn.x0_state != EScriptObjectState::InheritBounds || conn.x4_msg != EScriptObjectMessage::Activate)
|
||||
|
@ -80,6 +67,23 @@ void CScriptActor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSta
|
|||
|
||||
if (x2e2_31_materialFlag54)
|
||||
CActor::AddMaterial(EMaterialTypes::Unknown54, mgr);
|
||||
break;
|
||||
case EScriptObjectMessage::Reset:
|
||||
x2e2_25_dead = false;
|
||||
x260_currentHealth = x258_initialHealth;
|
||||
break;
|
||||
case EScriptObjectMessage::Increment:
|
||||
if (!GetActive())
|
||||
{
|
||||
mgr.SendScriptMsg(this, x8_uid, EScriptObjectMessage::Activate);
|
||||
CScriptColorModulate::FadeInHelper(mgr, x8_uid, x2d0_alphaMax);
|
||||
}
|
||||
break;
|
||||
case EScriptObjectMessage::Decrement:
|
||||
CScriptColorModulate::FadeOutHelper(mgr, x8_uid, x2d4_alphaMin);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
CActor::AcceptScriptMsg(msg, uid, mgr);
|
||||
|
|
|
@ -212,18 +212,17 @@ void CScriptDamageableTrigger::Think(float dt, CStateManager& mgr)
|
|||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (x16c_hInfo.GetHP() <= 0.f && x30_24_active)
|
||||
else if (x16c_hInfo.GetHP() <= 0.f && x30_24_active)
|
||||
{
|
||||
SendScriptMsgs(EScriptObjectState::Dead, mgr, EScriptObjectMessage::None);
|
||||
RemoveMaterial(EMaterialTypes::Orbit, mgr);
|
||||
x300_25_alphaOut = true;
|
||||
x250_alphaTimer = 0.f;
|
||||
}
|
||||
|
||||
if (x250_alphaTimer <= 0.75f)
|
||||
x250_alphaTimer += dt;
|
||||
}
|
||||
|
||||
float objAlpha = GetPuddleAlphaScale();
|
||||
x1e0_alpha = 0.2f * objAlpha;
|
||||
SetLinkedObjectAlpha(objAlpha, mgr);
|
||||
|
|
|
@ -152,7 +152,7 @@ void CScriptDebris::AddToRenderer(const zeus::CFrustum& frustum, const CStateMan
|
|||
static zeus::CVector3f debris_cone(CStateManager& mgr, float coneAng, float minMag, float maxMag)
|
||||
{
|
||||
float mag = mgr.GetActiveRandom()->Float() * (maxMag - minMag) + minMag;
|
||||
float side = 1.f - (1.f - std::cos(zeus::degToRad(coneAng))) * mgr.GetActiveRandom()->Float();
|
||||
float side = 1.f - (1.f - std::cos(zeus::degToRad(coneAng * 0.5f))) * mgr.GetActiveRandom()->Float();
|
||||
float hyp = std::max(0.f, 1.f - side * side);
|
||||
if (hyp != 0.f)
|
||||
hyp = std::sqrt(hyp);
|
||||
|
|
|
@ -22,38 +22,43 @@ u32 CScriptEffect::g_NumParticlesRendered = 0;
|
|||
|
||||
CScriptEffect::CScriptEffect(TUniqueId uid, std::string_view name, const CEntityInfo& info,
|
||||
const zeus::CTransform& xf, const zeus::CVector3f& scale,
|
||||
CAssetId partId, CAssetId elscId, bool hotInThermal, bool b2, bool b3, bool active,
|
||||
bool b4, float f1, float f2, float f3, float f4, bool b5, float f5, float f6, float f7,
|
||||
bool b6, bool b7, bool b8, const CLightParameters& lParms, bool b9)
|
||||
CAssetId partId, CAssetId elscId, bool hotInThermal, bool noTimerUnlessAreaOccluded,
|
||||
bool rebuildSystemsOnActivate, bool active, bool useRateInverseCamDist,
|
||||
float rateInverseCamDist, float rateInverseCamDistRate, float duration,
|
||||
float durationResetWhileVisible, bool useRateCamDistRange, float rateCamDistRangeMin,
|
||||
float rateCamDistRangeMax, float rateCamDistRangeFarRate, bool combatVisorVisible,
|
||||
bool thermalVisorVisible, bool xrayVisorVisible, const CLightParameters& lParms,
|
||||
bool dieWhenSystemsDone)
|
||||
: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(),
|
||||
CActorParameters::None().HotInThermal(hotInThermal), kInvalidUniqueId)
|
||||
, x10c_partId(partId)
|
||||
, x110_24_(active)
|
||||
, x110_25_(b2)
|
||||
, x110_26_(b3)
|
||||
, x110_27_(b4)
|
||||
, x110_28_(b6)
|
||||
, x110_29_(b7)
|
||||
, x110_30_(b8)
|
||||
, x110_31_(b8 && b7 && b6)
|
||||
, x111_24_(b5)
|
||||
, x111_25_(b9)
|
||||
, x111_26_canRender(false)
|
||||
, x114_(f1)
|
||||
, x118_(f1 * f1)
|
||||
, x11c_(f2)
|
||||
, x120_(f5)
|
||||
, x124_(f6)
|
||||
, x128_(f7)
|
||||
, x12c_(f3)
|
||||
, x130_(f3)
|
||||
, x134_(f4)
|
||||
, x114_rateInverseCamDist(rateInverseCamDist)
|
||||
, x118_rateInverseCamDistSq(rateInverseCamDist * rateInverseCamDist)
|
||||
, x11c_rateInverseCamDistRate(rateInverseCamDistRate)
|
||||
, x120_rateCamDistRangeMin(rateCamDistRangeMin)
|
||||
, x124_rateCamDistRangeMax(rateCamDistRangeMax)
|
||||
, x128_rateCamDistRangeFarRate(rateCamDistRangeFarRate)
|
||||
, x12c_remTime(duration)
|
||||
, x130_duration(duration)
|
||||
, x134_durationResetWhileVisible(durationResetWhileVisible)
|
||||
, x138_actorLights(lParms.MakeActorLights())
|
||||
{
|
||||
x110_24_enable = active;
|
||||
x110_25_noTimerUnlessAreaOccluded = noTimerUnlessAreaOccluded;
|
||||
x110_26_rebuildSystemsOnActivate = rebuildSystemsOnActivate;
|
||||
x110_27_useRateInverseCamDist = useRateInverseCamDist;
|
||||
x110_28_combatVisorVisible = combatVisorVisible;
|
||||
x110_29_thermalVisorVisible = thermalVisorVisible;
|
||||
x110_30_xrayVisorVisible = xrayVisorVisible;
|
||||
x110_31_anyVisorVisible = xrayVisorVisible && thermalVisorVisible && combatVisorVisible;
|
||||
x111_24_useRateCamDistRange = useRateCamDistRange;
|
||||
x111_25_dieWhenSystemsDone = dieWhenSystemsDone;
|
||||
x111_26_canRender = false;
|
||||
|
||||
if (partId.IsValid())
|
||||
{
|
||||
xf8_particleSystemToken = g_SimplePool->GetObj({FOURCC('PART'), partId});
|
||||
x104_particleSystem.reset(new CElementGen(xf8_particleSystemToken, CElementGen::EModelOrientationType::Normal, CElementGen::EOptionalSystemFlags::One));
|
||||
x104_particleSystem.reset(new CElementGen(xf8_particleSystemToken));
|
||||
zeus::CTransform newXf = xf;
|
||||
newXf.origin = zeus::CVector3f::skZero;
|
||||
x104_particleSystem->SetOrientation(newXf);
|
||||
|
@ -76,7 +81,7 @@ CScriptEffect::CScriptEffect(TUniqueId uid, std::string_view name, const CEntity
|
|||
xf4_electric->SetLocalScale(scale);
|
||||
xf4_electric->SetParticleEmission(active);
|
||||
}
|
||||
xe7_29_actorActive = true;
|
||||
xe7_29_drawEnabled = true;
|
||||
}
|
||||
|
||||
void CScriptEffect::Accept(IVisitor& visitor)
|
||||
|
@ -86,10 +91,12 @@ void CScriptEffect::Accept(IVisitor& visitor)
|
|||
|
||||
void CScriptEffect::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)
|
||||
{
|
||||
bool active = GetActive();
|
||||
if (msg == EScriptObjectMessage::Activate)
|
||||
bool oldActive = GetActive();
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
if (x110_26_)
|
||||
case EScriptObjectMessage::Activate:
|
||||
if (x110_26_rebuildSystemsOnActivate)
|
||||
{
|
||||
if (x104_particleSystem)
|
||||
{
|
||||
|
@ -101,7 +108,7 @@ void CScriptEffect::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSt
|
|||
x104_particleSystem->SetOrientation(newXf);
|
||||
x104_particleSystem->SetTranslation(GetTranslation());
|
||||
x104_particleSystem->SetLocalScale(scale);
|
||||
x104_particleSystem->SetParticleEmission(active);
|
||||
x104_particleSystem->SetParticleEmission(oldActive);
|
||||
x104_particleSystem->SetModulationColor(color);
|
||||
x104_particleSystem->SetModelsUseLights(x138_actorLights != nullptr);
|
||||
}
|
||||
|
@ -116,29 +123,28 @@ void CScriptEffect::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSt
|
|||
xf4_electric->SetOrientation(newXf);
|
||||
xf4_electric->SetTranslation(GetTranslation());
|
||||
xf4_electric->SetLocalScale(scale);
|
||||
xf4_electric->SetParticleEmission(active);
|
||||
xf4_electric->SetParticleEmission(oldActive);
|
||||
xf4_electric->SetModulationColor(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (msg == EScriptObjectMessage::Registered)
|
||||
{
|
||||
break;
|
||||
case EScriptObjectMessage::Registered:
|
||||
if (x104_particleSystem && x104_particleSystem->SystemHasLight())
|
||||
{
|
||||
x108_lightId = mgr.AllocateUniqueId();
|
||||
mgr.AddObject(new CGameLight(x108_lightId, GetAreaIdAlways(), true, std::string("EffectPLight_") + GetName().data(), x34_transform, GetUniqueId(), x104_particleSystem->GetLight(), x10c_partId.Value(), 1, 0.f));
|
||||
mgr.AddObject(new CGameLight(x108_lightId, GetAreaIdAlways(), true,
|
||||
std::string("EffectPLight_") + GetName().data(), x34_transform, GetUniqueId(),
|
||||
x104_particleSystem->GetLight(), x10c_partId.Value(), 1, 0.f));
|
||||
}
|
||||
}
|
||||
else if (msg == EScriptObjectMessage::Deleted)
|
||||
{
|
||||
break;
|
||||
case EScriptObjectMessage::Deleted:
|
||||
if (x108_lightId != kInvalidUniqueId)
|
||||
{
|
||||
mgr.FreeScriptObject(x108_lightId);
|
||||
x108_lightId = kInvalidUniqueId;
|
||||
}
|
||||
}
|
||||
else if (msg == EScriptObjectMessage::InitializedInArea)
|
||||
{
|
||||
break;
|
||||
case EScriptObjectMessage::InitializedInArea:
|
||||
for (const SConnection& conn : x20_conns)
|
||||
{
|
||||
if (!(conn.x0_state == EScriptObjectState::Active && conn.x4_msg == EScriptObjectMessage::Deactivate) ||
|
||||
|
@ -152,14 +158,17 @@ void CScriptEffect::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSt
|
|||
x13c_triggerId = it->second;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
CActor::AcceptScriptMsg(msg, uid, mgr);
|
||||
|
||||
TCastToPtr<CActor> act = mgr.ObjectById(x108_lightId);
|
||||
mgr.SendScriptMsg(act, uid, msg);
|
||||
TCastToPtr<CActor> light = mgr.ObjectById(x108_lightId);
|
||||
mgr.SendScriptMsg(light, uid, msg);
|
||||
|
||||
if (active != GetActive())
|
||||
if (oldActive != GetActive())
|
||||
{
|
||||
std::vector<TUniqueId> playIds;
|
||||
for (const SConnection& conn : x20_conns)
|
||||
|
@ -174,66 +183,46 @@ void CScriptEffect::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSt
|
|||
|
||||
if (playIds.size() > 0)
|
||||
{
|
||||
TCastToConstPtr<CActor> otherAct = mgr.GetObjectById(playIds[u32(0.99f * playIds.size() * mgr.GetActiveRandom()->Float())]);
|
||||
TCastToConstPtr<CActor> otherAct =
|
||||
mgr.GetObjectById(playIds[u32(0.99f * playIds.size() * mgr.GetActiveRandom()->Float())]);
|
||||
if (otherAct)
|
||||
act->SetTransform(otherAct->GetTransform());
|
||||
light->SetTransform(otherAct->GetTransform());
|
||||
else
|
||||
act->SetTransform(GetTransform());
|
||||
light->SetTransform(GetTransform());
|
||||
}
|
||||
x110_24_ = true;
|
||||
x110_24_enable = true;
|
||||
if (x104_particleSystem)
|
||||
x104_particleSystem->SetParticleEmission(GetActive());
|
||||
if (xf4_electric)
|
||||
xf4_electric->SetParticleEmission(GetActive());
|
||||
|
||||
if (GetActive())
|
||||
x12c_ = zeus::max(x12c_, x130_);
|
||||
x12c_remTime = zeus::max(x12c_remTime, x130_duration);
|
||||
}
|
||||
}
|
||||
|
||||
void CScriptEffect::PreRender(CStateManager& mgr, const zeus::CFrustum&)
|
||||
{
|
||||
if (x110_27_ || x111_24_)
|
||||
if (x110_27_useRateInverseCamDist || x111_24_useRateCamDistRange)
|
||||
{
|
||||
float f31 = 1.f;
|
||||
float genRate = 1.f;
|
||||
const CGameCamera* cam = mgr.GetCameraManager()->GetCurrentCamera(mgr);
|
||||
float f6 = cam->GetTranslation().y - GetTranslation().y;
|
||||
float f4 = cam->GetTranslation().x - GetTranslation().x;
|
||||
float f5 = cam->GetTranslation().z - GetTranslation().z;
|
||||
float f1 = (f6 * f6);
|
||||
float f3 = (f5 * f5);
|
||||
f1 = (f4 * f4) + f1;
|
||||
f1 = f3 + f1;
|
||||
float camMagSq = (cam->GetTranslation() - GetTranslation()).magSquared();
|
||||
|
||||
if (f1 <= 0.001f)
|
||||
f3 = 0.f;
|
||||
else if (f1 != 0.f)
|
||||
f3 = f1 * zeus::sqrtF(f1);
|
||||
if (x110_27_ && x118_ < f1)
|
||||
float camMag = 0.f;
|
||||
if (camMagSq > 0.001f)
|
||||
camMag = std::sqrt(camMagSq);
|
||||
if (x110_27_useRateInverseCamDist && camMagSq < x118_rateInverseCamDistSq)
|
||||
genRate = (1.f - x11c_rateInverseCamDistRate) * (camMag / x114_rateInverseCamDist) +
|
||||
x11c_rateInverseCamDistRate;
|
||||
if (x111_24_useRateCamDistRange)
|
||||
{
|
||||
float f0 = x114_;
|
||||
float f2 = x11c_;
|
||||
f0 = f3 / f0;
|
||||
f1 = 1.f - f2;
|
||||
f31 = f1 * f0 + f2;
|
||||
}
|
||||
if (x111_24_)
|
||||
{
|
||||
float f4 = x120_;
|
||||
float f2 = x124_;
|
||||
f1 = f3 - f4;
|
||||
f2 = f2 - f4;
|
||||
|
||||
f1 = zeus::max(0.f, f1);
|
||||
f1 = f1 / f2;
|
||||
f2 = zeus::max(0.f, f1);
|
||||
f1 = 1.f - f2;
|
||||
float f0 = x128_;
|
||||
f0 = f2 * f0;
|
||||
f31 = f1 * f31 + f0;
|
||||
float t = zeus::min(1.f, zeus::max(0.f, camMag - x120_rateCamDistRangeMin) /
|
||||
(x124_rateCamDistRangeMax - x120_rateCamDistRangeMin));
|
||||
genRate = (1.f - t) * genRate + t * x128_rateCamDistRangeFarRate;
|
||||
}
|
||||
|
||||
x104_particleSystem->SetGeneratorRate(f31);
|
||||
x104_particleSystem->SetGeneratorRate(genRate);
|
||||
}
|
||||
|
||||
if (!mgr.GetObjectById(x13c_triggerId))
|
||||
|
@ -244,29 +233,30 @@ void CScriptEffect::AddToRenderer(const zeus::CFrustum& frustum, const CStateMan
|
|||
{
|
||||
if (!x111_26_canRender)
|
||||
{
|
||||
const_cast<CScriptEffect&>(*this).x12c_ = zeus::max(x12c_, x134_);
|
||||
const_cast<CScriptEffect&>(*this).x12c_remTime = zeus::max(x12c_remTime, x134_durationResetWhileVisible);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!frustum.aabbFrustumTest(x9c_renderBounds))
|
||||
return;
|
||||
const_cast<CScriptEffect&>(*this).x12c_ = zeus::max(x12c_, x134_);
|
||||
const_cast<CScriptEffect&>(*this).x12c_remTime = zeus::max(x12c_remTime, x134_durationResetWhileVisible);
|
||||
|
||||
if (x110_31_)
|
||||
if (x110_31_anyVisorVisible)
|
||||
{
|
||||
bool visible = false;
|
||||
const CPlayerState::EPlayerVisor visor = mgr.GetPlayerState()->GetActiveVisor(mgr);
|
||||
if (visor == CPlayerState::EPlayerVisor::Combat || visor == CPlayerState::EPlayerVisor::Scan)
|
||||
visible = x110_28_;
|
||||
visible = x110_28_combatVisorVisible;
|
||||
else if (visor == CPlayerState::EPlayerVisor::XRay)
|
||||
visible = x110_30_;
|
||||
visible = x110_30_xrayVisorVisible;
|
||||
else if (visor == CPlayerState::EPlayerVisor::Thermal)
|
||||
visible = x110_29_;
|
||||
visible = x110_29_thermalVisorVisible;
|
||||
|
||||
if (visible && x138_actorLights)
|
||||
{
|
||||
const CGameArea* area = mgr.GetWorld()->GetAreaAlways(GetAreaIdAlways());
|
||||
const_cast<CScriptEffect&>(*this).x138_actorLights->BuildAreaLightList(mgr, *area, zeus::CAABox{x9c_renderBounds.center(), x9c_renderBounds.center()});
|
||||
const_cast<CScriptEffect&>(*this).x138_actorLights->BuildAreaLightList(
|
||||
mgr, *area, zeus::CAABox{x9c_renderBounds.center(), x9c_renderBounds.center()});
|
||||
const_cast<CScriptEffect&>(*this).x138_actorLights->BuildDynamicLightList(mgr, x9c_renderBounds);
|
||||
}
|
||||
EnsureRendered(mgr);
|
||||
|
@ -317,20 +307,21 @@ void CScriptEffect::Think(float dt, CStateManager& mgr)
|
|||
xe4_28_transformDirty = false;
|
||||
}
|
||||
|
||||
if (x110_25_)
|
||||
if (x110_25_noTimerUnlessAreaOccluded)
|
||||
{
|
||||
const CGameArea* area = mgr.GetWorld()->GetAreaAlways(GetAreaIdAlways());
|
||||
bool visible = area->GetActive() ? bool(area->GetOcclusionState()) : false;
|
||||
CGameArea::EOcclusionState visible = area->IsPostConstructed() ? area->GetOcclusionState() :
|
||||
CGameArea::EOcclusionState::Occluded;
|
||||
|
||||
if (!visible || x12c_ <= 0.f)
|
||||
if (visible == CGameArea::EOcclusionState::Occluded && x12c_remTime <= 0.f)
|
||||
return;
|
||||
}
|
||||
else if (x12c_ <= 0.f)
|
||||
else if (x12c_remTime <= 0.f)
|
||||
return;
|
||||
|
||||
x12c_ -= dt;
|
||||
x12c_remTime -= dt;
|
||||
|
||||
if (x110_24_)
|
||||
if (x110_24_enable)
|
||||
{
|
||||
if (x104_particleSystem)
|
||||
{
|
||||
|
@ -343,7 +334,6 @@ void CScriptEffect::Think(float dt, CStateManager& mgr)
|
|||
xf4_electric->Update(dt);
|
||||
g_NumParticlesUpdating += xf4_electric->GetParticleCount();
|
||||
}
|
||||
}
|
||||
|
||||
if (x108_lightId != kInvalidUniqueId)
|
||||
{
|
||||
|
@ -354,15 +344,16 @@ void CScriptEffect::Think(float dt, CStateManager& mgr)
|
|||
}
|
||||
}
|
||||
|
||||
if (x111_25_)
|
||||
if (x111_25_dieWhenSystemsDone)
|
||||
{
|
||||
x140_ += dt;
|
||||
if (x140_ > 15.f || AreBothSystemsDeleteable())
|
||||
x140_destroyDelayTimer += dt;
|
||||
if (x140_destroyDelayTimer > 15.f || AreBothSystemsDeleteable())
|
||||
{
|
||||
mgr.FreeScriptObject(GetUniqueId());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (x104_particleSystem)
|
||||
{
|
||||
|
|
|
@ -17,35 +17,46 @@ class CScriptEffect : public CActor
|
|||
std::unique_ptr<CElementGen> x104_particleSystem;
|
||||
TUniqueId x108_lightId = kInvalidUniqueId;
|
||||
CAssetId x10c_partId;
|
||||
bool x110_24_ : 1;
|
||||
bool x110_25_ : 1;
|
||||
bool x110_26_ : 1;
|
||||
bool x110_27_ : 1;
|
||||
bool x110_28_ : 1;
|
||||
bool x110_29_ : 1;
|
||||
bool x110_30_ : 1;
|
||||
bool x110_31_ : 1;
|
||||
bool x111_24_ : 1;
|
||||
bool x111_25_ : 1;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool x110_24_enable : 1;
|
||||
bool x110_25_noTimerUnlessAreaOccluded : 1;
|
||||
bool x110_26_rebuildSystemsOnActivate : 1;
|
||||
bool x110_27_useRateInverseCamDist : 1;
|
||||
bool x110_28_combatVisorVisible : 1;
|
||||
bool x110_29_thermalVisorVisible : 1;
|
||||
bool x110_30_xrayVisorVisible : 1;
|
||||
bool x110_31_anyVisorVisible : 1;
|
||||
bool x111_24_useRateCamDistRange : 1;
|
||||
bool x111_25_dieWhenSystemsDone : 1;
|
||||
bool x111_26_canRender : 1;
|
||||
float x114_;
|
||||
float x118_;
|
||||
float x11c_;
|
||||
float x120_;
|
||||
float x124_;
|
||||
float x128_;
|
||||
float x12c_;
|
||||
float x130_;
|
||||
float x134_;
|
||||
};
|
||||
u32 _dummy = 0;
|
||||
};
|
||||
float x114_rateInverseCamDist;
|
||||
float x118_rateInverseCamDistSq;
|
||||
float x11c_rateInverseCamDistRate;
|
||||
float x120_rateCamDistRangeMin;
|
||||
float x124_rateCamDistRangeMax;
|
||||
float x128_rateCamDistRangeFarRate;
|
||||
float x12c_remTime;
|
||||
float x130_duration;
|
||||
float x134_durationResetWhileVisible;
|
||||
std::unique_ptr<CActorLights> x138_actorLights;
|
||||
TUniqueId x13c_triggerId = kInvalidUniqueId;
|
||||
float x140_ = 0.f;
|
||||
float x140_destroyDelayTimer = 0.f;
|
||||
public:
|
||||
CScriptEffect(TUniqueId, std::string_view name, const CEntityInfo& info,
|
||||
CScriptEffect(TUniqueId uid, std::string_view name, const CEntityInfo& info,
|
||||
const zeus::CTransform& xf, const zeus::CVector3f& scale,
|
||||
CAssetId partId, CAssetId elscId, bool, bool, bool, bool active,
|
||||
bool, float, float, float, float, bool, float, float, float,
|
||||
bool, bool, bool, const CLightParameters& lParms, bool);
|
||||
CAssetId partId, CAssetId elscId, bool hotInThermal, bool noTimerUnlessAreaOccluded,
|
||||
bool rebuildSystemsOnActivate, bool active, bool useRateInverseCamDist,
|
||||
float rateInverseCamDist, float rateInverseCamDistRate, float duration,
|
||||
float durationResetWhileVisible, bool useRateCamDistRange, float rateCamDistRangeMin,
|
||||
float rateCamDistRangeMax, float rateCamDistRangeFarRate, bool combatVisorVisible,
|
||||
bool thermalVisorVisible, bool xrayVisorVisible, const CLightParameters& lParms,
|
||||
bool dieWhenSystemsDone);
|
||||
|
||||
void Accept(IVisitor& visitor);
|
||||
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
|
||||
|
|
|
@ -35,7 +35,7 @@ CScriptPlayerActor::CScriptPlayerActor(TUniqueId uid, std::string_view name, con
|
|||
SetMaterialFilter(CMaterialFilter::MakeIncludeExclude(include, exclude));
|
||||
|
||||
SetActorLights(aParams.GetLightParameters().MakeActorLights());
|
||||
xe7_29_actorActive = true;
|
||||
xe7_29_drawEnabled = true;
|
||||
x2e3_24_isPlayerActor = true;
|
||||
}
|
||||
|
||||
|
@ -411,7 +411,7 @@ void CScriptPlayerActor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid
|
|||
void CScriptPlayerActor::SetActive(bool active)
|
||||
{
|
||||
CActor::SetActive(active);
|
||||
xe7_29_actorActive = true;
|
||||
xe7_29_drawEnabled = true;
|
||||
}
|
||||
|
||||
void CScriptPlayerActor::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum)
|
||||
|
|
|
@ -576,10 +576,10 @@ CEntity* ScriptLoader::LoadEffect(CStateManager& mgr, CInputStream& in, int prop
|
|||
|
||||
CAssetId partId(in);
|
||||
CAssetId elscId(in);
|
||||
bool b1 = in.readBool();
|
||||
bool b2 = in.readBool();
|
||||
bool b3 = in.readBool();
|
||||
bool b4 = in.readBool();
|
||||
bool hotInThermal = in.readBool();
|
||||
bool noTimerUnlessAreaOccluded = in.readBool();
|
||||
bool rebuildSystemsOnActivate = in.readBool();
|
||||
bool active = in.readBool();
|
||||
|
||||
if (!partId.IsValid() && !elscId.IsValid())
|
||||
return nullptr;
|
||||
|
@ -587,24 +587,28 @@ CEntity* ScriptLoader::LoadEffect(CStateManager& mgr, CInputStream& in, int prop
|
|||
if (!g_ResFactory->GetResourceTypeById(partId) && !g_ResFactory->GetResourceTypeById(elscId))
|
||||
return nullptr;
|
||||
|
||||
bool b5 = in.readBool();
|
||||
float f1 = in.readFloatBig();
|
||||
float f2 = in.readFloatBig();
|
||||
float f3 = in.readFloatBig();
|
||||
float f4 = in.readFloatBig();
|
||||
bool b6 = in.readBool();
|
||||
float f5 = in.readFloatBig();
|
||||
float f6 = in.readFloatBig();
|
||||
float f7 = in.readFloatBig();
|
||||
bool b7 = in.readBool();
|
||||
bool b8 = in.readBool();
|
||||
bool b9 = in.readBool();
|
||||
bool b10 = in.readBool();
|
||||
bool useRateInverseCamDist = in.readBool();
|
||||
float rateInverseCamDist = in.readFloatBig();
|
||||
float rateInverseCamDistRate = in.readFloatBig();
|
||||
float duration = in.readFloatBig();
|
||||
float durationResetWhileVisible = in.readFloatBig();
|
||||
bool useRateCamDistRange = in.readBool();
|
||||
float rateCamDistRangeMin = in.readFloatBig();
|
||||
float rateCamDistRangeMax = in.readFloatBig();
|
||||
float rateCamDistRangeFarRate = in.readFloatBig();
|
||||
bool combatVisorVisible = in.readBool();
|
||||
bool thermalVisorVisible = in.readBool();
|
||||
bool xrayVisorVisible = in.readBool();
|
||||
bool dieWhenSystemsDone = in.readBool();
|
||||
|
||||
CLightParameters lParms = LoadLightParameters(in);
|
||||
|
||||
return new CScriptEffect(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, head.x40_scale, partId,
|
||||
elscId, b1, b2, b3, b4, b5, f1, f2, f3, f4, b6, f5, f6, f7, b7, b8, b9, lParms, b10);
|
||||
elscId, hotInThermal, noTimerUnlessAreaOccluded, rebuildSystemsOnActivate, active,
|
||||
useRateInverseCamDist, rateInverseCamDist, rateInverseCamDistRate, duration,
|
||||
durationResetWhileVisible, useRateCamDistRange, rateCamDistRangeMin, rateCamDistRangeMax,
|
||||
rateCamDistRangeFarRate, combatVisorVisible, thermalVisorVisible, xrayVisorVisible,
|
||||
lParms, dieWhenSystemsDone);
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadPlatform(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
|||
Subproject commit fced7add60d925bf16dfa8c2391b4a77a1e45f8e
|
||||
Subproject commit dc5348ad25f5dc7264fde4319e8cd4505fe23af1
|
2
specter
2
specter
|
@ -1 +1 @@
|
|||
Subproject commit 369cf0cdd900b0b5abc5957dd1f20244ae671e4a
|
||||
Subproject commit 326b5b4d2ff727f4836ca0a4467ab311cd239889
|
Loading…
Reference in New Issue