CScriptEffect: Minor fixes

This commit is contained in:
Luke Street 2020-04-07 23:39:01 -04:00
parent 1f55b5f92e
commit 416ca4653b
1 changed files with 18 additions and 17 deletions

View File

@ -76,6 +76,7 @@ CScriptEffect::CScriptEffect(TUniqueId uid, std::string_view name, const CEntity
xf4_electric->SetGlobalTranslation(xf.origin);
xf4_electric->SetGlobalScale(scale);
xf4_electric->SetParticleEmission(active);
xf4_electric->SetModulationColor(lParms.GetNoLightsAmbient());
}
xe7_29_drawEnabled = true;
}
@ -97,7 +98,6 @@ void CScriptEffect::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSt
x104_particleSystem->SetOrientation(newXf);
x104_particleSystem->SetGlobalTranslation(GetTranslation());
x104_particleSystem->SetGlobalScale(scale);
x104_particleSystem->SetParticleEmission(oldActive);
x104_particleSystem->SetModulationColor(color);
x104_particleSystem->SetModelsUseLights(x138_actorLights != nullptr);
}
@ -111,7 +111,6 @@ void CScriptEffect::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSt
xf4_electric->SetOrientation(newXf);
xf4_electric->SetGlobalTranslation(GetTranslation());
xf4_electric->SetGlobalScale(scale);
xf4_electric->SetParticleEmission(oldActive);
xf4_electric->SetModulationColor(color);
}
}
@ -152,26 +151,28 @@ void CScriptEffect::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSt
mgr.SendScriptMsg(light, uid, msg);
if (oldActive != GetActive()) {
std::vector<TUniqueId> playIds;
for (const SConnection& conn : x20_conns) {
if (conn.x0_state != EScriptObjectState::Play || conn.x4_msg != EScriptObjectMessage::Activate)
continue;
if (GetActive()) {
std::vector<TUniqueId> playIds;
for (const SConnection& conn : x20_conns) {
if (conn.x0_state != EScriptObjectState::Play || conn.x4_msg != EScriptObjectMessage::Activate)
continue;
TUniqueId uid = mgr.GetIdForScript(conn.x8_objId);
if (uid != kInvalidUniqueId)
playIds.push_back(uid);
}
TUniqueId connId = mgr.GetIdForScript(conn.x8_objId);
if (connId != kInvalidUniqueId)
playIds.push_back(connId);
}
if (playIds.size() > 0) {
TCastToConstPtr<CActor> otherAct =
mgr.GetObjectById(playIds[u32(0.99f * playIds.size() * mgr.GetActiveRandom()->Float())]);
if (otherAct) {
if (light)
light->SetTransform(otherAct->GetTransform());
else
if (!playIds.empty()) {
TCastToConstPtr<CActor> otherAct =
mgr.GetObjectById(playIds[u32(0.99f * playIds.size() * mgr.GetActiveRandom()->Float())]);
if (otherAct) {
SetTransform(otherAct->GetTransform());
if (light)
light->SetTransform(otherAct->GetTransform());
}
}
}
x110_24_enable = true;
if (x104_particleSystem)
x104_particleSystem->SetParticleEmission(GetActive());