2016-02-11 23:05:42 +00:00
|
|
|
#include "CParticleElectric.hpp"
|
2016-03-06 02:55:09 +00:00
|
|
|
#include "CElectricDescription.hpp"
|
2016-02-26 05:38:11 +00:00
|
|
|
#include "CGenDescription.hpp"
|
|
|
|
#include "CSwooshDescription.hpp"
|
2016-03-06 02:55:09 +00:00
|
|
|
#include "CParticleSwoosh.hpp"
|
|
|
|
#include "CElementGen.hpp"
|
2016-03-04 23:04:53 +00:00
|
|
|
#include "Graphics/CModel.hpp"
|
|
|
|
#include "Graphics/CGraphics.hpp"
|
2016-02-11 23:05:42 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
namespace urde
|
2016-02-11 23:05:42 +00:00
|
|
|
{
|
|
|
|
|
2016-03-06 02:55:09 +00:00
|
|
|
CParticleElectric::CParticleElectric(const TToken<CElectricDescription>& token)
|
|
|
|
: x1c_elecDesc(token)
|
2016-02-13 05:49:59 +00:00
|
|
|
{
|
2016-03-06 02:55:09 +00:00
|
|
|
x438_24_x450_24 = true;
|
|
|
|
/* x438_28_x450_28 = true; demo */
|
|
|
|
x450_29 = true; // are 28 and 29 the same between retail and demo?
|
|
|
|
CElectricDescription* desc = x1c_elecDesc.GetObj();
|
|
|
|
if (desc->x10_SSEG)
|
|
|
|
desc->x10_SSEG->GetValue(x28_currentFrame, x150_SSEG);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
x150_SSEG++;
|
|
|
|
x154_SCNT = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (desc->xc_SCNT)
|
|
|
|
desc->xc_SCNT->GetValue(x28_currentFrame, x154_SCNT);
|
|
|
|
std::max(0, std::min(x154_SCNT, 32));
|
|
|
|
|
|
|
|
if (desc->x0_LIFE)
|
|
|
|
desc->x0_LIFE->GetValue(x28_currentFrame, x2c_LIFE);
|
|
|
|
else
|
|
|
|
x2c_LIFE = 0x7FFFFF;
|
2016-03-07 08:07:55 +00:00
|
|
|
|
2016-03-06 02:55:09 +00:00
|
|
|
if (desc->x40_SSWH.m_found)
|
|
|
|
{
|
2016-03-07 08:07:55 +00:00
|
|
|
x438_27_x450_27_HaveSSWH = true;
|
|
|
|
for (int i = 0 ; i < x154_SCNT ; i++)
|
|
|
|
x1e0_lineManagers[i].SSWH.reset(new CParticleSwoosh(desc->x40_SSWH.m_token, x150_SSEG));
|
2016-03-06 02:55:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (desc->x50_GPSM.m_found)
|
|
|
|
{
|
2016-03-07 08:07:55 +00:00
|
|
|
x438_25_x450_25_HaveGPSM = true;
|
|
|
|
for (int i = 0 ; i < x154_SCNT ; i++)
|
|
|
|
x1e0_lineManagers[i].GPSM.reset(new CElementGen(desc->x50_GPSM.m_token,
|
|
|
|
CElementGen::EModelOrientationType::Normal,
|
|
|
|
CElementGen::EOptionalSystemFlags::One));
|
2016-03-06 02:55:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (desc->x60_EPSM.m_found)
|
|
|
|
{
|
2016-03-07 08:07:55 +00:00
|
|
|
x438_26_x450_26_HaveEPSM = true;
|
|
|
|
for (int i = 0 ; i < x154_SCNT ; i++)
|
|
|
|
x1e0_lineManagers[i].EPSM.reset(new CElementGen(desc->x60_EPSM.m_token,
|
|
|
|
CElementGen::EModelOrientationType::Normal,
|
|
|
|
CElementGen::EOptionalSystemFlags::One));
|
2016-03-06 02:55:09 +00:00
|
|
|
}
|
2016-02-13 05:49:59 +00:00
|
|
|
}
|
|
|
|
|
2016-02-26 03:45:36 +00:00
|
|
|
void CParticleElectric::SetupLineGXMaterial()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-02-26 03:31:00 +00:00
|
|
|
void CParticleElectric::RenderLines()
|
|
|
|
{
|
|
|
|
CGraphics::DisableAllLights();
|
|
|
|
CGraphics::SetDepthWriteMode(true, ERglEnum::LEqual, false);
|
|
|
|
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::SrcAlpha, ERglBlendFactor::One, ERglLogicOp::Clear);
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
zeus::CTransform viewXfrm = CGraphics::g_ViewMatrix;
|
|
|
|
zeus::CTransform localScale;
|
2016-02-26 03:45:36 +00:00
|
|
|
localScale.Scale(xec_localScale);
|
2016-03-04 23:04:53 +00:00
|
|
|
zeus::CTransform globalScale;
|
2016-02-26 03:31:00 +00:00
|
|
|
globalScale.Scale(xe0_globalScale);
|
2016-03-04 23:04:53 +00:00
|
|
|
zeus::CTransform localTranslation;
|
2016-02-26 03:45:36 +00:00
|
|
|
localTranslation.Translate(x38_translation);
|
2016-03-04 23:04:53 +00:00
|
|
|
zeus::CTransform globalTranslation;
|
2016-02-26 03:45:36 +00:00
|
|
|
globalTranslation.Translate(xa4_globalTranslation);
|
|
|
|
CGraphics::SetModelMatrix(xb0_globalOrientation * globalTranslation * localTranslation * x44_orientation * globalScale);
|
|
|
|
CGraphics::SetCullMode(ERglCullMode::None);
|
|
|
|
SetupLineGXMaterial();
|
|
|
|
/* Iterate line managers */
|
|
|
|
|
|
|
|
CGraphics::SetCullMode(ERglCullMode::Front);
|
|
|
|
//CGraphics::SetLineWidth(1.f, ERglTexOffset);
|
|
|
|
CGraphics::SetViewPointMatrix(viewXfrm);
|
2016-02-26 03:31:00 +00:00
|
|
|
}
|
|
|
|
|
2016-02-13 05:49:59 +00:00
|
|
|
void CParticleElectric::Update(double)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void CParticleElectric::Render()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void CParticleElectric::SetOrientation(const zeus::CTransform& orientation)
|
2016-02-13 05:49:59 +00:00
|
|
|
{
|
2016-02-26 03:31:00 +00:00
|
|
|
x44_orientation = orientation;
|
2016-03-06 02:55:09 +00:00
|
|
|
x438_28_x450_28 = true;
|
2016-02-13 05:49:59 +00:00
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void CParticleElectric::SetTranslation(const zeus::CVector3f& translation)
|
2016-02-13 05:49:59 +00:00
|
|
|
{
|
2016-02-26 03:31:00 +00:00
|
|
|
x38_translation = translation;
|
2016-03-06 02:55:09 +00:00
|
|
|
x438_28_x450_28 = true;
|
2016-02-13 05:49:59 +00:00
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void CParticleElectric::SetGlobalOrientation(const zeus::CTransform& orientation)
|
2016-02-13 05:49:59 +00:00
|
|
|
{
|
2016-02-26 03:31:00 +00:00
|
|
|
xb0_globalOrientation = orientation;
|
2016-03-06 02:55:09 +00:00
|
|
|
x438_28_x450_28 = true;
|
2016-02-13 05:49:59 +00:00
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void CParticleElectric::SetGlobalTranslation(const zeus::CVector3f& translation)
|
2016-02-13 05:49:59 +00:00
|
|
|
{
|
2016-02-26 03:31:00 +00:00
|
|
|
xa4_globalTranslation = translation;
|
2016-03-06 02:55:09 +00:00
|
|
|
x438_28_x450_28 = true;
|
2016-02-13 05:49:59 +00:00
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void CParticleElectric::SetGlobalScale(const zeus::CVector3f& scale)
|
2016-02-13 05:49:59 +00:00
|
|
|
{
|
2016-02-26 03:31:00 +00:00
|
|
|
xe0_globalScale = scale;
|
2016-03-06 02:55:09 +00:00
|
|
|
x438_28_x450_28 = true;
|
2016-02-13 05:49:59 +00:00
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void CParticleElectric::SetLocalScale(const zeus::CVector3f& scale)
|
2016-02-13 05:49:59 +00:00
|
|
|
{
|
2016-02-26 03:31:00 +00:00
|
|
|
xec_localScale = scale;
|
2016-03-06 02:55:09 +00:00
|
|
|
x438_28_x450_28 = true;
|
2016-03-07 08:07:55 +00:00
|
|
|
if (x438_26_x450_26_HaveEPSM)
|
2016-02-26 03:31:00 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2016-02-13 05:49:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CParticleElectric::SetParticleEmission(bool)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
void CParticleElectric::SetModulationColor(const zeus::CColor& color)
|
2016-02-13 05:49:59 +00:00
|
|
|
{
|
2016-02-26 03:31:00 +00:00
|
|
|
if (!x1bc_hasModuColor)
|
|
|
|
x1bc_hasModuColor = true;
|
|
|
|
|
|
|
|
x1b8_moduColor = color;
|
|
|
|
/* TODO: Add child particle systems */
|
2016-02-13 05:49:59 +00:00
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
const zeus::CTransform& CParticleElectric::GetOrientation() const
|
2016-02-13 05:49:59 +00:00
|
|
|
{
|
2016-02-26 03:31:00 +00:00
|
|
|
return x44_orientation;
|
2016-02-13 05:49:59 +00:00
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
const zeus::CVector3f& CParticleElectric::GetTranslation() const
|
2016-02-13 05:49:59 +00:00
|
|
|
{
|
2016-02-26 03:31:00 +00:00
|
|
|
return x38_translation;
|
2016-02-13 05:49:59 +00:00
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
const zeus::CTransform& CParticleElectric::GetGlobalOrientation() const
|
2016-02-13 05:49:59 +00:00
|
|
|
{
|
2016-02-26 03:31:00 +00:00
|
|
|
return xb0_globalOrientation;
|
2016-02-13 05:49:59 +00:00
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
const zeus::CVector3f& CParticleElectric::GetGlobalTranslation() const
|
2016-02-13 05:49:59 +00:00
|
|
|
{
|
2016-02-26 03:31:00 +00:00
|
|
|
return xa4_globalTranslation;
|
2016-02-13 05:49:59 +00:00
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
const zeus::CVector3f& CParticleElectric::GetGlobalScale() const
|
2016-02-13 05:49:59 +00:00
|
|
|
{
|
2016-02-26 03:31:00 +00:00
|
|
|
return xe0_globalScale;
|
2016-02-13 05:49:59 +00:00
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
const zeus::CColor& CParticleElectric::GetModulationColor() const
|
2016-02-13 05:49:59 +00:00
|
|
|
{
|
2016-02-26 03:31:00 +00:00
|
|
|
if (!x1bc_hasModuColor)
|
2016-03-04 23:04:53 +00:00
|
|
|
return zeus::CColor::skWhite;
|
2016-02-26 03:31:00 +00:00
|
|
|
return x1b8_moduColor;
|
2016-02-13 05:49:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CParticleElectric::IsSystemDeletable() const
|
|
|
|
{
|
2016-02-17 03:42:27 +00:00
|
|
|
return false;
|
2016-02-13 05:49:59 +00:00
|
|
|
}
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
std::pair<zeus::CAABox, bool> CParticleElectric::GetBounds() const
|
2016-02-13 05:49:59 +00:00
|
|
|
{
|
2016-03-04 23:04:53 +00:00
|
|
|
return std::make_pair(zeus::CAABox(), false);
|
2016-02-13 05:49:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
u32 CParticleElectric::GetParticleCount() const
|
|
|
|
{
|
2016-02-17 03:42:27 +00:00
|
|
|
return 0;
|
2016-02-13 05:49:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CParticleElectric::SystemHasLight() const
|
|
|
|
{
|
2016-02-17 03:42:27 +00:00
|
|
|
return false;
|
2016-02-13 05:49:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CLight CParticleElectric::GetLight() const
|
|
|
|
{
|
2016-02-17 03:42:27 +00:00
|
|
|
return CLight();
|
2016-02-13 05:49:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CParticleElectric::GetParticleEmission() const
|
|
|
|
{
|
2016-02-17 03:42:27 +00:00
|
|
|
return false;
|
2016-02-13 05:49:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CParticleElectric::DestroyParticles()
|
2016-02-11 23:05:42 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|