Skip to content

Commit ea14059

Browse files
committed
minor fixes and cleanup
1 parent db82dad commit ea14059

6 files changed

Lines changed: 104 additions & 373 deletions

File tree

Core/GameEngine/Source/GameClient/FXList.cpp

Lines changed: 17 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,7 @@ class DecalFXNugget : public FXNugget
492492
m_type = 0; /// type of projection
493493
m_decalSizeX = 0.0; /// 1/(world space extent of texture in x direction)
494494
m_decalSizeY = 0.0; /// 1/(world space extent of texture in y direction)*/
495+
m_offset.x = m_offset.y = m_offset.z = 0;
495496
m_angle = 0.0;
496497
m_orientToObject = FALSE;
497498
m_randomAngle = FALSE;
@@ -500,71 +501,37 @@ class DecalFXNugget : public FXNugget
500501

501502
virtual void doFXPos(const Coord3D* primary, const Matrix3D* primaryMtx, const Real primarySpeed, const Coord3D* secondary, const Real /*overrideRadius*/, FXSurfaceInfo* /*surfaceInfo*/) const
502503
{
503-
DEBUG_LOG(("DecalFXNugget::doFXPos 1"));
504-
505504
if (m_probability <= GameClientRandomValueReal(0, 1))
506505
return;
507506

508507
if (primary)
509508
{
509+
Coord3D offset = m_offset;
510+
if (primaryMtx) {
511+
if (m_orientToObject)
512+
{
513+
adjustVector(&offset, primaryMtx);
514+
}
515+
}
516+
510517
Drawable* drawable = TheThingFactory->newDrawable(TheThingFactory->findTemplate(m_templateName));
511518
if (!drawable)
512519
return;
513520

514521
// Does it even make sense to set the matrix?
515522
if (primaryMtx && m_orientToObject)
516523
drawable->setTransformMatrix(primaryMtx);
517-
drawable->setPosition(primary);
518-
519-
//TODO:
520-
//TracerDrawInterface* tdi = nullptr;
521-
//for (DrawModule** d = drawable->getDrawModules(); *d; ++d)
522-
//{
523-
// if ((tdi = (*d)->getTracerDrawInterface()) != nullptr)
524-
// {
525-
// tdi->setTracerParms(speed, m_length, m_width, m_color, 1.0f);
526-
// }
527-
//}
528-
529-
//Object* obj = drawable->getObject();
530-
//GeometryInfo newGeom(GEOMETRY_BOX, TRUE, 1.0f, m_decalSizeX/2.0f, m_decalSizeY/2.0f);
531-
//obj->setGeometryInfo(newGeom);
524+
525+
Coord3D newPos;
526+
newPos.x = primary->x + offset.x;
527+
newPos.y = primary->y + offset.y;
528+
newPos.z = primary->z + offset.z;
529+
drawable->setPosition(&newPos);
532530

533531
if (m_randomAngle)
534532
drawable->setOrientation(GameClientRandomValueReal(0, PI * 2));
535533

536534
drawable->setExpirationDate(TheGameLogic->getFrame() + m_lifetime);
537-
538-
//Set Shadow
539-
//for (DrawModule** d = drawable->getDrawModules(); *d; ++d)
540-
//{
541-
// W3DModelDraw* draw = (W3DModelDraw*) (*d);
542-
// if (draw) {
543-
// RenderObjClass* robj = draw->getRenderObject();
544-
545-
// Shadow::ShadowTypeInfo shadowInfo;
546-
// strlcpy(shadowInfo.m_ShadowName, m_textureName.str(), ARRAY_SIZE(shadowInfo.m_ShadowName));
547-
// shadowInfo.allowUpdates = FALSE; //shadow image will never update
548-
// shadowInfo.allowWorldAlign = TRUE; //shadow image will wrap around world objects
549-
// shadowInfo.m_type = m_type;
550-
// shadowInfo.m_sizeX = m_decalSizeX;
551-
// shadowInfo.m_sizeY = m_decalSizeY;
552-
// Shadow* shadow = TheW3DShadowManager->addShadow(robj, &shadowInfo);
553-
// //if (shadow)
554-
// //{
555-
// // shadow->enableShadowInvisible(m_fullyObscuredByShroud);
556-
// // if (m_renderObject->Is_Hidden() || !m_shadowEnabled)
557-
// // shadow->enableShadowRender(FALSE);
558-
// //}
559-
560-
// }
561-
// break;
562-
//}
563-
564-
//static const NameKeyType key_draw = NAMEKEY("W3DModelDraw");
565-
//W3DModelDraw* draw = (W3DModelDraw*)obj->findUpdateModule(key_centerUpdate);
566-
//if (centerModule)
567-
568535
}
569536
else
570537
{
@@ -574,8 +541,6 @@ class DecalFXNugget : public FXNugget
574541

575542
virtual void doFXObj(const Object* primary, const Object* secondary, FXSurfaceInfo* surfaceInfo) const
576543
{
577-
DEBUG_LOG(("DecalFXNugget::doFXObj 1"));
578-
579544
if (primary)
580545
{
581546
doFXPos(primary->getPosition(), primary->getTransformMatrix(), 0.0f, nullptr, 0.0f, surfaceInfo);
@@ -591,15 +556,8 @@ class DecalFXNugget : public FXNugget
591556
static const FieldParse myFieldParse[] =
592557
{
593558
{ "DecalName", INI::parseAsciiString, nullptr, offsetof(DecalFXNugget, m_templateName) },
594-
/* { "Texture", INI::parseAsciiString, nullptr, offsetof(TracerFXNugget, m_textureName) },
595-
{ "Style", INI::parseBitString32, TheShadowNames, offsetof(TracerFXNugget, m_shadowType) },
596-
{ "Color", INI::parseColorInt, nullptr, offsetof(TracerFXNugget, m_color) },
597-
{ "Opacity", INI::parsePercentToReal, nullptr, offsetof(TracerFXNugget, m_opacity) },*/
598559
{ "Lifetime", INI::parseDurationUnsignedInt, nullptr, offsetof(DecalFXNugget, m_lifetime) },
599-
/* { "FadeInTime", INI::parseDurationUnsignedInt, nullptr, offsetof(TracerFXNugget, m_fadeInTime) },
600-
{ "FadeOutTime", INI::parseDurationUnsignedInt, nullptr, offsetof(TracerFXNugget, m_fadeOutTime) },
601-
{ "SizeX", INI::parseReal, nullptr, offsetof(TracerFXNugget, m_decalSizeX) },
602-
{ "SizeY", INI::parseReal, nullptr, offsetof(TracerFXNugget, m_decalSizeY) },*/
560+
{ "Offset", INI::parseCoord3D, nullptr, offsetof(DecalFXNugget, m_offset) },
603561
{ "Angle", INI::parseReal, nullptr, offsetof(DecalFXNugget, m_angle) },
604562
{ "RandomAngle", INI::parseBool, nullptr, offsetof(DecalFXNugget, m_randomAngle) },
605563
{ "OrientToObject", INI::parseBool, nullptr, offsetof(DecalFXNugget, m_orientToObject) },
@@ -614,15 +572,8 @@ class DecalFXNugget : public FXNugget
614572

615573
private:
616574
AsciiString m_templateName;
617-
// AsciiString m_textureName;
618-
// Real m_opacity; ///< value between 0 and 1
619-
// UnsignedInt m_color; ///< color in ARGB format. (Alpha is ignored).
620575
UnsignedInt m_lifetime;
621-
// UnsignedInt m_fadeOutTime;
622-
// UnsignedInt m_fadeInTime;
623-
// ShadowType m_type; /// type of projection
624-
// Real m_decalSizeX; /// 1/(world space extent of texture in x direction)
625-
// Real m_decalSizeY; /// 1/(world space extent of texture in y direction)
576+
Coord3D m_offset;
626577
Real m_angle;
627578
Bool m_orientToObject;
628579
Bool m_randomAngle;

Core/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DWalkerDraw.h

Lines changed: 0 additions & 64 deletions
This file was deleted.

Core/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp

Lines changed: 5 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -2400,7 +2400,7 @@ void W3DModelDraw::adjustAnimation(const ModelConditionInfo* prevState, Real pre
24002400
prevState->m_animations[0].getAnimHandle() &&
24012401
m_renderObject->Class_ID() == RenderObjClass::CLASSID_HLOD) {
24022402

2403-
DEBUG_LOG((">>>>BLEND ANIMS!!"));
2403+
//DEBUG_LOG((">>>>BLEND ANIMS!!"));
24042404

24052405
HLodClass* hlod = (HLodClass*)m_renderObject;
24062406

@@ -2977,31 +2977,15 @@ void W3DModelDraw::handleFXEvents()
29772977
for (std::vector<FXEventInfo>::const_iterator it = m_curState->m_fxEvents.begin(); it != m_curState->m_fxEvents.end(); ++it)
29782978
{
29792979
// Check frame timing
2980+
// TODO: Make this work for backwards animations as well!
29802981
if (it->frame <= curAnimHelper.frameNum && it->frame > m_prevAnimHelper.frameNum) {
29812982
// Get bone position
29822983
Coord3D pos;
29832984
pos.zero();
2984-
//Real rotation = 0.0f;
2985-
29862985
Int boneIndex = m_renderObject ? m_renderObject->Get_Bone_Index(it->boneName.str()) : 0;
29872986
if (boneIndex != 0)
29882987
{
2989-
//// ugh... kill the mtx so we get it in modelspace, not world space
2990-
//Matrix3D originalTransform = m_renderObject->Get_Transform(); // save the transform
2991-
//Matrix3D tmp(true);
2992-
//tmp.Scale(getDrawable()->getScale());
2993-
//m_renderObject->Set_Transform(tmp); // set to identity transform
2994-
2995-
//const Matrix3D boneTransform = m_renderObject->Get_Bone_Transform(boneIndex);
2996-
//Vector3 vpos = boneTransform.Get_Translation();
2997-
//rotation = boneTransform.Get_Z_Rotation();
2998-
2999-
//m_renderObject->Set_Transform(originalTransform); // restore it
3000-
3001-
//pos.x = vpos.X;
3002-
//pos.y = vpos.Y;
3003-
//pos.z = vpos.Z;
3004-
2988+
30052989
if (!m_renderObject->Is_Hidden())
30062990
{
30072991
// I can ask the drawable's bone position if I am not hidden (if I have no object I have no choice)
@@ -3011,7 +2995,7 @@ void W3DModelDraw::handleFXEvents()
30112995
pos.y = mtx.Get_Y_Translation();
30122996
pos.z = mtx.Get_Z_Translation();
30132997

3014-
DEBUG_LOG((">>> FXEVENT: CurrentFrame = %d, PrevFrame = %d, Frame=%d, Bone=%s, FXList=%s, X/Y/Z = %f/%f/f",
2998+
/*DEBUG_LOG((">>> FXEVENT: CurrentFrame = %d, PrevFrame = %d, Frame=%d, Bone=%s, FXList=%s, X/Y/Z = %f/%f/f",
30152999
curAnimHelper.frameNum,
30163000
m_prevAnimHelper.frameNum,
30173001
it->frame,
@@ -3020,65 +3004,12 @@ void W3DModelDraw::handleFXEvents()
30203004
pos.x,
30213005
pos.y,
30223006
pos.z
3023-
));
3007+
));*/
30243008

30253009
FXList::doFXPos(it->fx, &pos, &mtx, 0.0f, nullptr, 0.0f);
30263010
}
30273011
}
30283012
}
3029-
3030-
//ParticleSystem* sys = TheParticleSystemManager->createParticleSystem(it->particleSystemTemplate);
3031-
//if (sys != nullptr)
3032-
//{
3033-
// Coord3D pos;
3034-
// pos.zero();
3035-
// Real rotation = 0.0f;
3036-
3037-
// Int boneIndex = m_renderObject ? m_renderObject->Get_Bone_Index(it->boneName.str()) : 0;
3038-
// if (boneIndex != 0)
3039-
// {
3040-
// // ugh... kill the mtx so we get it in modelspace, not world space
3041-
// Matrix3D originalTransform = m_renderObject->Get_Transform(); // save the transform
3042-
// Matrix3D tmp(true);
3043-
// tmp.Scale(getDrawable()->getScale());
3044-
// m_renderObject->Set_Transform(tmp); // set to identity transform
3045-
3046-
// const Matrix3D boneTransform = m_renderObject->Get_Bone_Transform(boneIndex);
3047-
// Vector3 vpos = boneTransform.Get_Translation();
3048-
// rotation = boneTransform.Get_Z_Rotation();
3049-
3050-
// m_renderObject->Set_Transform(originalTransform); // restore it
3051-
3052-
// pos.x = vpos.X;
3053-
// pos.y = vpos.Y;
3054-
// pos.z = vpos.Z;
3055-
// }
3056-
3057-
// // got the bone position...
3058-
// sys->setPosition(&pos);
3059-
3060-
// // and the direction, so that the system is oriented like the bone is
3061-
// sys->rotateLocalTransformZ(rotation);
3062-
3063-
// // Attach it to the object...
3064-
// sys->attachToDrawable(drawable);
3065-
3066-
// // important: mark it as do-not-save, since we'll just re-create it when we reload.
3067-
// sys->setSaveable(FALSE);
3068-
3069-
// if (drawable->isDrawableEffectivelyHidden() || m_fullyObscuredByShroud)
3070-
// {
3071-
// sys->stop(); // don't start the systems for drawables that are hidden.
3072-
// }
3073-
3074-
// // store the particle system id so we can kill it later.
3075-
3076-
// ParticleSysTrackerType tracker;
3077-
// tracker.id = sys->getSystemID();
3078-
// tracker.boneIndex = boneIndex;
3079-
3080-
// m_particleSystemIDs.push_back(tracker);
3081-
//}
30823013
}
30833014
}
30843015
}

0 commit comments

Comments
 (0)