Game Development Community

Sword Trails Not working 1.5.2

by J · in Torque Game Engine · 01/11/2011 (4:28 pm) · 8 replies

I'm having a heck of a time getting this to work.
Motion Trails

I have made these engine changes:
Compiling in TGE 1.5.2

In motion.cc

Line 57
add this:
IMPLEMENT_CONSOLETYPE(MotionTrailData)

before this:
IMPLEMENT_GETDATATYPE(MotionTrailData)   
IMPLEMENT_SETDATATYPE(MotionTrailData)

Line 67 thru line 69
Comment out this:
Con::registerType("MotionTrailDataPtr", TypeMotionTrailDataPtr, sizeof(MotionTrailData*),   
                    REF_GETDATATYPE(MotionTrailData),   
                    REF_SETDATATYPE(MotionTrailData));

In motion.h

before the #endif
I put:
DECLARE_CONSOLETYPE(MotionTrailData)

It compiles just fine.

I also do not get a missing texture for the motiontrail.png in the console.
Everything should be working but its not.
Are there other engine changes I have missed? I'm not that savvy in the code.
Does anyone have the motionTrail.png from RW I could try? Maybe my texture is not right.
Is there a certain place to put the motionTrail = SwordTrail; in the Image datablock?

Thanks for any help.
J

About the author

I used to be obsessed with building my own open-ended RPG and a 3D Side Scroller RPG. But the job/house/girlfriend got in the way. I know, I know. Now I concentrate on doing architectural renderings (with the help of T3D of course) and VBA programming.


#1
01/12/2011 (2:43 pm)
Anyone?

I need to get this working...
#2
01/13/2011 (3:58 pm)
K...

added "start" and "end" nodes to my sword with no changes.

This is what I need if anyone could help me out:

1. Exact code changes besides the ones mentioned above. I'm assuming a need to somehow expose this to the shapebaseimagedata, I have no clue how to do this.

2. example datablock for a motionTrail();
3. example texturew/alpha channel
4. example of EXACTLY where you place motionTrail = myTrail; in the ShapeBaseImageData datablock
5. anything else i might be missing....

This is so frustrating and three days/nights of changing code and working on this have got me fried... ANYONE HELP ME?! I'm even willing to exchange some artwork for someone that knows how to get this working.
#3
01/13/2011 (6:10 pm)
did you add the motionTrail stuff to shapebase and shapeimage ?
#4
01/14/2011 (3:21 pm)
EDIT: this update is from 1/17/2011 and includes the edited code so I can keep track of my changes. Still won't work, but at least motion.cc is trying to render in the console

_________________________________________________

in shapebase.h
_________________________________________________
In your includes:
#ifndef _MotionTrail_H_
#include "game/fx/motion.h"
#endif

Line 53, below "class shapebase" I added:
class MotionTrailData;

Line 334, below "S32 casingID;" I added:
MotionTrailData *   wepTrail;
S32 		    wepTrailID;

Line 412, I added:
MotionTrailData*	 motionTrail;
S32			 motionTrailID;



_________________________________________________

in shapebase.cc
_________________________________________________
Line 30:
#include "game/fx/motion.h"

Line 91, after "underwaterExplosionID=0;" I added:
motionTrail = NULL;
motionTrailID = 0;

Line 160:
if( !motionTrail && motionTrailID != 0 )
      {
         Sim::findObject( motionTrailID, motionTrail );
         AssertFatal(!(motionTrail && ((motionTrailID < DataBlockObjectIdFirst) || (motionTrailID > DataBlockObjectIdLast))),
            "ShapeBaseData::preload: invalid motionTrail data");
      }

Line 336, I added:
addField("motionTrail",	TypeMotionTrailDataPtr,	Offset(motionTrail, ShapeBaseData));

Line 506, I added:
if( stream->writeFlag( motionTrail != NULL ) )
   {
      stream->writeRangedU32( motionTrail->getId(), DataBlockObjectIdFirst,  DataBlockObjectIdLast );
   }

Line 601, I added:
if( stream->readFlag() )
   {
      motionTrailID = stream->readRangedU32( DataBlockObjectIdFirst, DataBlockObjectIdLast );
   }


_________________________________________________

in shapeImage.cc
_________________________________________________
Line 20 at end of includes:
#include "game/fx/motion.h"

Line 163, I added:
wepTrail = NULL;
wepTrailID = 0;

Line 395, I added:
addField("wepTrail", TypeMotionTrailDataPtr, Offset(wepTrail,		ShapeBaseImageData));

Line 484, I added:
if( stream->writeFlag( wepTrail ) )
   {
      stream->writeRangedU32(packed? SimObjectId(wepTrail):
         wepTrail->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast);
   }

Line 597, I added:
if(stream->readFlag())
   {
      wepTrailID = stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast);
   }

Line 1398
//--->J added
   if (isClientObject())
   {
	   //Con::printf("!!!!!!!!!!!WE ARE AT THE NEW MOTIONTRAIL in shapeImage.cc!!!!!!!!!!!!!");
	   MotionTrail *wepTrail = new MotionTrail();
	   wepTrail->onNewDataBlock( imageData->wepTrail );
	   //imageData->wepTrail;

      if (!wepTrail->registerObject())
      delete wepTrail;
    }
//<---J ended
#5
01/14/2011 (3:42 pm)
n/m see post above
#6
01/14/2011 (4:11 pm)
n/m see post above
#7
01/15/2011 (9:27 pm)
n/m see post above
#8
01/17/2011 (7:48 pm)
haha

n/m see post above