@@ -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
615573private:
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;
0 commit comments