Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 55 additions & 3 deletions GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,46 @@ static void adjustVector(Coord3D *vec, const Matrix3D* mtx)
vec->z = vectmp.Z;
}
}
//-------------------------------------------------------------------------------------------------
static void adjustVectorXY(Coord3D* vec, const Matrix3D* mtx)
{
if (mtx)
{
//This can be optimized probably.

Coord3D u, x, y, z, pos;
Matrix3D mat;
Real angle = mtx->Get_Z_Rotation();

pos.x = mtx->Get_X_Translation();
pos.y = mtx->Get_Y_Translation();
pos.z = mtx->Get_Z_Translation();

z.x = 0.0f;
z.y = 0.0f;
z.z = 1.0f;

u.x = Cos(angle);
u.y = Sin(angle);
u.z = 0.0f;

y.crossProduct(&z, &u, &y);
x.crossProduct(&y, &z, &x);

mat.Set(x.x, y.x, z.x, pos.x,
x.y, y.y, z.y, pos.y,
x.z, y.z, z.z, pos.z);

Vector3 vectmp;
vectmp.X = vec->x;
vectmp.Y = vec->y;
vectmp.Z = vec->z;
vectmp = mat.Rotate_Vector(vectmp);
vec->x = vectmp.X;
vec->y = vectmp.Y;
vec->z = vectmp.Z;
}
}

///////////////////////////////////////////////////////////////////////////////////////////////////
// PRIVATE CLASSES ///////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -572,6 +612,8 @@ class ParticleSystemFXNugget : public FXNugget
{ "RotateY", INI::parseAngleReal, NULL, offsetof( ParticleSystemFXNugget, m_rotateY ) },
{ "RotateZ", INI::parseAngleReal, NULL, offsetof( ParticleSystemFXNugget, m_rotateZ ) },
{ "OrientToObject", INI::parseBool, NULL, offsetof( ParticleSystemFXNugget, m_orientToObject ) },
{ "OrientOffset", INI::parseBool, NULL, offsetof( ParticleSystemFXNugget, m_orientOffset ) },
{ "OrientXY", INI::parseBool, NULL, offsetof( ParticleSystemFXNugget, m_orientXY ) },
{ "Ricochet", INI::parseBool, NULL, offsetof( ParticleSystemFXNugget, m_ricochet ) },
{ "AttachToObject", INI::parseBool, NULL, offsetof( ParticleSystemFXNugget, m_attachToObject ) },
{ "CreateAtGroundHeight", INI::parseBool, NULL, offsetof( ParticleSystemFXNugget, m_createAtGroundHeight ) },
Expand All @@ -589,9 +631,14 @@ class ParticleSystemFXNugget : public FXNugget
void reallyDoFX(const Coord3D *primary, const Matrix3D* mtx, const Object* thingToAttachTo, Real overrideRadius ) const
{
Coord3D offset = m_offset;
if (mtx)
{
adjustVector(&offset, mtx);
if (mtx) {
if (m_orientToObject || m_orientOffset)
{
adjustVector(&offset, mtx);
}
if (m_orientXY) {
adjustVectorXY(&offset, mtx);
}
}

const ParticleSystemTemplate *tmp = TheParticleSystemManager->findTemplate(m_name);
Expand Down Expand Up @@ -626,6 +673,9 @@ class ParticleSystemFXNugget : public FXNugget
{
sys->setLocalTransform(mtx);
}
else if (m_orientXY) {
sys->rotateLocalTransformZ(mtx->Get_Z_Rotation());
}
if (m_rotateX != 0.0f)
sys->rotateLocalTransformX(m_rotateX);
if (m_rotateY != 0.0f)
Expand Down Expand Up @@ -669,6 +719,8 @@ class ParticleSystemFXNugget : public FXNugget
GameClientRandomVariable m_delay;
Real m_rotateX, m_rotateY, m_rotateZ;
Bool m_orientToObject;
Bool m_orientOffset;
Bool m_orientXY;
Bool m_attachToObject;
Bool m_createAtGroundHeight;
Bool m_useCallersRadius;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,8 @@ enum DebrisDisposition CPP_11(: Int)
RANDOM_FORCE = 0x00000020,
FLOATING = 0x00000040,
INHERIT_VELOCITY = 0x00000080,
WHIRLING = 0x00000100
WHIRLING = 0x00000100,
ALIGN_Z_UP = 0x00000200
};

static const char* DebrisDispositionNames[] =
Expand All @@ -713,6 +714,7 @@ static const char* DebrisDispositionNames[] =
"FLOATING",
"INHERIT_VELOCITY",
"WHIRLING",
"ALIGN_Z_UP"
};

std::vector<AsciiString> debrisModelNamesGlobalHack;
Expand Down Expand Up @@ -1053,7 +1055,7 @@ class GenericObjectCreationNugget : public ObjectCreationNugget

if( BitIsSet( m_disposition, LIKE_EXISTING ) )
{
if (mtx)
if (mtx && !BitIsSet(m_disposition, ALIGN_Z_UP))
obj->setTransformMatrix(mtx);
else
obj->setOrientation(orientation);
Expand Down