Merge pull request #2236 from Azaezel/memberMess

cleans up all 'hides' warnings (at time of writing)
This commit is contained in:
Areloch 2018-05-30 20:36:43 -05:00 committed by GitHub
commit 5a1af9ccd7
233 changed files with 4370 additions and 4418 deletions

View file

@ -206,11 +206,11 @@ void AccumulationVolume::buildSilhouette( const SceneCameraState& cameraState, V
if( mTransformDirty )
{
const U32 numPoints = mPolyhedron.getNumPoints();
const U32 numPolyPoints = mPolyhedron.getNumPoints();
const PolyhedronType::PointType* points = getPolyhedron().getPoints();
mWSPoints.setSize( numPoints );
for( U32 i = 0; i < numPoints; ++ i )
mWSPoints.setSize(numPolyPoints);
for( U32 i = 0; i < numPolyPoints; ++ i )
{
Point3F p = points[ i ];
p.convolve( getScale() );

View file

@ -645,12 +645,12 @@ void AnimationComponent::advanceThreads(F32 dt)
if (mOwnerShapeInstance && !isClientObject())
{
for (U32 i = 1; i < 32; i++)
for (U32 stateIDx = 1; stateIDx < 32; stateIDx++)
{
if (mOwnerShapeInstance->getTriggerState(i))
if (mOwnerShapeInstance->getTriggerState(stateIDx))
{
const char* animName = st.thread->getSequenceName().c_str();
onAnimationTrigger_callback(this, animName, i);
onAnimationTrigger_callback(this, animName, stateIDx);
}
}
}

View file

@ -357,12 +357,12 @@ void CollisionTrigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron)
{
mCollisionTriggerPolyhedron = rPolyhedron;
if (mCollisionTriggerPolyhedron.pointList.size() != 0) {
if (mCollisionTriggerPolyhedron.mPointList.size() != 0) {
mObjBox.minExtents.set(1e10, 1e10, 1e10);
mObjBox.maxExtents.set(-1e10, -1e10, -1e10);
for (U32 i = 0; i < mCollisionTriggerPolyhedron.pointList.size(); i++) {
mObjBox.minExtents.setMin(mCollisionTriggerPolyhedron.pointList[i]);
mObjBox.maxExtents.setMax(mCollisionTriggerPolyhedron.pointList[i]);
for (U32 i = 0; i < mCollisionTriggerPolyhedron.mPointList.size(); i++) {
mObjBox.minExtents.setMin(mCollisionTriggerPolyhedron.mPointList[i]);
mObjBox.maxExtents.setMax(mCollisionTriggerPolyhedron.mPointList[i]);
}
}
else {
@ -374,7 +374,7 @@ void CollisionTrigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron)
setTransform(xform);
mClippedList.clear();
mClippedList.mPlaneList = mCollisionTriggerPolyhedron.planeList;
mClippedList.mPlaneList = mCollisionTriggerPolyhedron.mPlaneList;
// for (U32 i = 0; i < mClippedList.mPlaneList.size(); i++)
// mClippedList.mPlaneList[i].neg();
@ -412,7 +412,7 @@ void CollisionTrigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron)
bool CollisionTrigger::testObject(GameBase* enter)
{
if (mCollisionTriggerPolyhedron.pointList.size() == 0)
if (mCollisionTriggerPolyhedron.mPointList.size() == 0)
return false;
mClippedList.clear();
@ -507,17 +507,17 @@ U32 CollisionTrigger::packUpdate(NetConnection* con, U32 mask, BitStream* stream
// Write the polyhedron
if (stream->writeFlag(mask & PolyMask))
{
stream->write(mCollisionTriggerPolyhedron.pointList.size());
for (i = 0; i < mCollisionTriggerPolyhedron.pointList.size(); i++)
mathWrite(*stream, mCollisionTriggerPolyhedron.pointList[i]);
stream->write(mCollisionTriggerPolyhedron.mPointList.size());
for (i = 0; i < mCollisionTriggerPolyhedron.mPointList.size(); i++)
mathWrite(*stream, mCollisionTriggerPolyhedron.mPointList[i]);
stream->write(mCollisionTriggerPolyhedron.planeList.size());
for (i = 0; i < mCollisionTriggerPolyhedron.planeList.size(); i++)
mathWrite(*stream, mCollisionTriggerPolyhedron.planeList[i]);
stream->write(mCollisionTriggerPolyhedron.mPlaneList.size());
for (i = 0; i < mCollisionTriggerPolyhedron.mPlaneList.size(); i++)
mathWrite(*stream, mCollisionTriggerPolyhedron.mPlaneList[i]);
stream->write(mCollisionTriggerPolyhedron.edgeList.size());
for (i = 0; i < mCollisionTriggerPolyhedron.edgeList.size(); i++) {
const Polyhedron::Edge& rEdge = mCollisionTriggerPolyhedron.edgeList[i];
stream->write(mCollisionTriggerPolyhedron.mEdgeList.size());
for (i = 0; i < mCollisionTriggerPolyhedron.mEdgeList.size(); i++) {
const Polyhedron::Edge& rEdge = mCollisionTriggerPolyhedron.mEdgeList[i];
stream->write(rEdge.face[0]);
stream->write(rEdge.face[1]);
@ -555,19 +555,19 @@ void CollisionTrigger::unpackUpdate(NetConnection* con, BitStream* stream)
{
Polyhedron tempPH;
stream->read(&size);
tempPH.pointList.setSize(size);
for (i = 0; i < tempPH.pointList.size(); i++)
mathRead(*stream, &tempPH.pointList[i]);
tempPH.mPointList.setSize(size);
for (i = 0; i < tempPH.mPointList.size(); i++)
mathRead(*stream, &tempPH.mPointList[i]);
stream->read(&size);
tempPH.planeList.setSize(size);
for (i = 0; i < tempPH.planeList.size(); i++)
mathRead(*stream, &tempPH.planeList[i]);
tempPH.mPlaneList.setSize(size);
for (i = 0; i < tempPH.mPlaneList.size(); i++)
mathRead(*stream, &tempPH.mPlaneList[i]);
stream->read(&size);
tempPH.edgeList.setSize(size);
for (i = 0; i < tempPH.edgeList.size(); i++) {
Polyhedron::Edge& rEdge = tempPH.edgeList[i];
tempPH.mEdgeList.setSize(size);
for (i = 0; i < tempPH.mEdgeList.size(); i++) {
Polyhedron::Edge& rEdge = tempPH.mEdgeList[i];
stream->read(&rEdge.face[0]);
stream->read(&rEdge.face[1]);

View file

@ -441,16 +441,15 @@ void PlayerControllerComponent::updateMove()
// get the head pitch and add it to the moveVec
// This more accurate swim vector calc comes from Matt Fairfax
MatrixF xRot, zRot;
MatrixF xRot;
xRot.set(EulerF(mOwner->getRotation().asEulerF().x, 0, 0));
zRot.set(EulerF(0, 0, mOwner->getRotation().asEulerF().z));
zRot.set(EulerF(0, 0, mOwner->getRotation().asEulerF().z));//reset prior uses
MatrixF rot;
rot.mul(zRot, xRot);
rot.getColumn(0, &moveVec);
moveVec *= move->x;
VectorF tv;
rot.getColumn(1, &tv);
rot.getColumn(1, &tv);//reset prior uses
moveVec += tv * move->y;
rot.getColumn(2, &tv);
moveVec += tv * move->z;

View file

@ -254,8 +254,8 @@ void MeshComponent::updateShape()
mOwner->getWorldToObj().mulP(pos);
min = mMeshAsset->getShape()->bounds.minExtents;
max = mMeshAsset->getShape()->bounds.maxExtents;
min = mMeshAsset->getShape()->mBounds.minExtents;
max = mMeshAsset->getShape()->mBounds.maxExtents;
if (mInterfaceData)
{

View file

@ -492,7 +492,6 @@ void ConvexShape::unpackUpdate( NetConnection *conn, BitStream *stream )
void ConvexShape::prepRenderImage( SceneRenderState *state )
{
/*
if ( state->isDiffusePass() )
{
ObjectRenderInst *ri2 = state->getRenderPass()->allocInst<ObjectRenderInst>();
@ -500,8 +499,7 @@ void ConvexShape::prepRenderImage( SceneRenderState *state )
ri2->type = RenderPassManager::RIT_Editor;
state->getRenderPass()->addInst( ri2 );
}
*/
if ( mVertexBuffer.isNull() || !state)
return;
@ -795,21 +793,10 @@ bool ConvexShape::castRay( const Point3F &start, const Point3F &end, RayInfo *in
F32 t;
F32 tmin = F32_MAX;
S32 hitFace = -1;
Point3F hitPnt, pnt;
Point3F pnt;
VectorF rayDir( end - start );
rayDir.normalizeSafe();
if ( false )
{
PlaneF plane( Point3F(0,0,0), Point3F(0,0,1) );
Point3F sp( 0,0,-1 );
Point3F ep( 0,0,1 );
F32 t = plane.intersect( sp, ep );
Point3F hitPnt;
hitPnt.interpolate( sp, ep, t );
}
for ( S32 i = 0; i < planeCount; i++ )
{
// Don't hit the back-side of planes.
@ -1228,11 +1215,11 @@ void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, B
GFX->setTexture( 0, NULL );
// Render world box.
if ( false )
if (Con::getBoolVariable("$pref::convexDBG::ShowWorldBox", false))
{
Box3F wbox( mWorldBox );
//if ( getServerObject() )
// Box3F wbox = static_cast<ConvexShape*>( getServerObject() )->mWorldBox;
if ( getServerObject() )
wbox = static_cast<ConvexShape*>( getServerObject() )->mWorldBox;
GFXStateBlockDesc desc;
desc.setCullMode( GFXCullNone );
desc.setFillModeWireframe();
@ -1244,7 +1231,7 @@ void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, B
const Vector< ConvexShape::Face > &faceList = mGeometry.faces;
// Render Edges.
if ( false )
if (Con::getBoolVariable("$pref::convexDBG::ShowEdges", false))
{
GFXTransformSaver saver;
//GFXFrustumSaver fsaver;
@ -1298,7 +1285,7 @@ void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, B
objToWorld.scale( mObjScale );
// Render faces centers/colors.
if ( false )
if (Con::getBoolVariable("$pref::convexDBG::ShowFaceColors", false))
{
GFXStateBlockDesc desc;
desc.setCullMode( GFXCullNone );
@ -1322,7 +1309,7 @@ void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, B
}
// Render winding order.
if ( false )
if (Con::getBoolVariable("$pref::convexDBG::ShowWinding", false))
{
GFXStateBlockDesc desc;
desc.setCullMode( GFXCullNone );
@ -1379,7 +1366,7 @@ void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, B
}
// Render surface transforms.
if ( false )
if (Con::getBoolVariable("$pref::convexDBG::ShowSurfaceTransforms", false))
{
GFXStateBlockDesc desc;
desc.setBlend( false );
@ -1389,7 +1376,7 @@ void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, B
for ( S32 i = 0; i < mSurfaces.size(); i++ )
{
MatrixF objToWorld( mObjToWorld );
objToWorld = mObjToWorld;
objToWorld.scale( mObjScale );
MatrixF renderMat;

View file

@ -396,7 +396,7 @@ void DebrisData::packData(BitStream* stream)
if( stream->writeFlag( explosion ) )
{
stream->writeRangedU32(packed? SimObjectId((uintptr_t)explosion):
stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)explosion):
explosion->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast);
}
@ -669,7 +669,7 @@ bool Debris::onAdd()
// Setup our bounding box
if( mDataBlock->shape )
{
mObjBox = mDataBlock->shape->bounds;
mObjBox = mDataBlock->shape->mBounds;
}
else
{

View file

@ -1302,14 +1302,14 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
// Loop through batches allocating buffers and submitting render instances.
for ( U32 i = 0; i < batches.size(); i++ )
{
DecalBatch &currentBatch = batches[i];
currentBatch = &batches[i];
// Copy data into the system memory arrays, from all decals in this batch...
DecalVertex *vpPtr = vertData;
U16 *pbPtr = indexData;
U32 lastDecal = currentBatch.startDecal + currentBatch.decalCount;
U32 lastDecal = currentBatch->startDecal + currentBatch->decalCount;
U32 voffset = 0;
U32 ioffset = 0;
@ -1317,13 +1317,13 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
// This is an ugly hack for ProjectedShadow!
GFXTextureObject *customTex = NULL;
for ( U32 j = currentBatch.startDecal; j < lastDecal; j++ )
for ( U32 j = currentBatch->startDecal; j < lastDecal; j++ )
{
DecalInstance *dinst = mDecalQueue[j];
dinst = mDecalQueue[j];
const U32 indxCount =
(dinst->mIndxCount > currentBatch.iCount) ?
currentBatch.iCount : dinst->mIndxCount;
(dinst->mIndxCount > currentBatch->iCount) ?
currentBatch->iCount : dinst->mIndxCount;
for ( U32 k = 0; k < indxCount; k++ )
{
*( pbPtr + ioffset + k ) = dinst->mIndices[k] + voffset;
@ -1332,8 +1332,8 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
ioffset += indxCount;
const U32 vertCount =
(dinst->mVertCount > currentBatch.vCount) ?
currentBatch.vCount : dinst->mVertCount;
(dinst->mVertCount > currentBatch->vCount) ?
currentBatch->vCount : dinst->mVertCount;
dMemcpy( vpPtr + voffset, dinst->mVerts, sizeof( DecalVertex ) * vertCount );
voffset += vertCount;
@ -1342,8 +1342,8 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
customTex = *dinst->mCustomTex;
}
AssertFatal( ioffset == currentBatch.iCount, "bad" );
AssertFatal( voffset == currentBatch.vCount, "bad" );
AssertFatal( ioffset == currentBatch->iCount, "bad" );
AssertFatal( voffset == currentBatch->vCount, "bad" );
// Get handles to video memory buffers we will be filling...
@ -1385,9 +1385,9 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
pb->lock( &pbPtr );
// Memcpy from system to video memory.
const U32 vpCount = sizeof( DecalVertex ) * currentBatch.vCount;
const U32 vpCount = sizeof( DecalVertex ) * currentBatch->vCount;
dMemcpy( vpPtr, vertData, vpCount );
const U32 pbCount = sizeof( U16 ) * currentBatch.iCount;
const U32 pbCount = sizeof( U16 ) * currentBatch->iCount;
dMemcpy( pbPtr, indexData, pbCount );
pb->unlock();
@ -1400,7 +1400,7 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
// Get the best lights for the current camera position
// if the materail is forward lit and we haven't got them yet.
if ( currentBatch.matInst->isForwardLit() && !baseRenderInst.lights[0] )
if ( currentBatch->matInst->isForwardLit() && !baseRenderInst.lights[0] )
{
LightQuery query;
query.init( rootFrustum.getPosition(),
@ -1416,15 +1416,15 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
ri->primBuff = pb;
ri->vertBuff = vb;
ri->matInst = currentBatch.matInst;
ri->matInst = currentBatch->matInst;
ri->prim = renderPass->allocPrim();
ri->prim->type = GFXTriangleList;
ri->prim->minIndex = 0;
ri->prim->startIndex = 0;
ri->prim->numPrimitives = currentBatch.iCount / 3;
ri->prim->numPrimitives = currentBatch->iCount / 3;
ri->prim->startVertex = 0;
ri->prim->numVertices = currentBatch.vCount;
ri->prim->numVertices = currentBatch->vCount;
// Ugly hack for ProjectedShadow!
if ( customTex )
@ -1433,7 +1433,7 @@ void DecalManager::prepRenderImage( SceneRenderState* state )
// The decal bin will contain render instances for both decals and decalRoad's.
// Dynamic decals render last, then editor decals and roads in priority order.
// DefaultKey is sorted in descending order.
ri->defaultKey = currentBatch.dynamic ? 0xFFFFFFFF : (U32)currentBatch.priority;
ri->defaultKey = currentBatch->dynamic ? 0xFFFFFFFF : (U32)currentBatch->priority;
ri->defaultKey2 = 1;//(U32)lastDecal->mDataBlock;
renderPass->addInst( ri );

View file

@ -1542,11 +1542,9 @@ void Entity::write(Stream &stream, U32 tabStop, U32 flags)
if (mComponents.size() > 0)
{
// Pack out the behaviors into fields
U32 i = 0;
for (U32 i = 0; i < mComponents.size(); i++)
{
writeTabs(stream, tabStop + 1);
char buffer[1024];
dSprintf(buffer, sizeof(buffer), "new %s() {\r\n", mComponents[i]->getClassName());
stream.write(dStrlen(buffer), buffer);
//bi->writeFields( stream, tabStop + 2 );

View file

@ -213,7 +213,7 @@ void RenderShapeExample::createShape()
}
// Update the bounding box
mObjBox = mShape->bounds;
mObjBox = mShape->mBounds;
resetWorldBox();
setRenderTransform(mObjToWorld);

View file

@ -1384,7 +1384,7 @@ bool Explosion::explode()
mEndingMS = U32(mExplosionInstance->getScaledDuration(mExplosionThread) * 1000.0f);
mObjScale.convolve(mDataBlock->explosionScale);
mObjBox = mDataBlock->explosionShape->bounds;
mObjBox = mDataBlock->explosionShape->mBounds;
resetWorldBox();
}

View file

@ -1142,7 +1142,7 @@ GroundCoverCell* GroundCover::_generateCell( const Point2I& index,
const F32 typeMaxElevation = mMaxElevation[type];
const F32 typeMinElevation = mMinElevation[type];
const bool typeIsShape = mShapeInstances[ type ] != NULL;
const Box3F typeShapeBounds = typeIsShape ? mShapeInstances[ type ]->getShape()->bounds : Box3F();
const Box3F typeShapeBounds = typeIsShape ? mShapeInstances[ type ]->getShape()->mBounds : Box3F();
const F32 typeWindScale = mWindScale[type];
StringTableEntry typeLayer = mLayer[type];
const bool typeInvertLayer = mInvertLayer[type];
@ -1184,9 +1184,9 @@ GroundCoverCell* GroundCover::_generateCell( const Point2I& index,
terrainBlock = dynamic_cast< TerrainBlock* >( terrainBlocks.first() );
else
{
for ( U32 i = 0; i < terrainBlocks.size(); i++ )
for ( U32 blockIDx = 0; blockIDx < terrainBlocks.size(); blockIDx++ )
{
TerrainBlock *terrain = dynamic_cast< TerrainBlock* >( terrainBlocks[ i ] );
TerrainBlock *terrain = dynamic_cast< TerrainBlock* >( terrainBlocks[ blockIDx ] );
if( !terrain )
continue;

View file

@ -412,7 +412,7 @@ void ParticleEmitterData::packData(BitStream* stream)
#if defined(AFX_CAP_PARTICLE_POOLS)
if (stream->writeFlag(pool_datablock))
{
stream->writeRangedU32(packed ? SimObjectId((uintptr_t)pool_datablock) : pool_datablock->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast);
stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)pool_datablock) : pool_datablock->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast);
stream->write(pool_index);
stream->writeFlag(pool_depth_fade);
stream->writeFlag(pool_radial_fade);

View file

@ -508,10 +508,10 @@ void Ribbon::prepRenderImage(SceneRenderState *state)
// Set up our vertex buffer and primitive buffer
if(mUpdateBuffers)
createBuffers(state, verts, primBuffer, segments);
createBuffers(state, mVerts, mPrimBuffer, segments);
ri->vertBuff = &verts;
ri->primBuff = &primBuffer;
ri->vertBuff = &mVerts;
ri->primBuff = &mPrimBuffer;
ri->visibility = 1.0f;
ri->prim = renderPass->allocPrim();

View file

@ -99,8 +99,8 @@ class Ribbon : public GameBase
BaseMatInstance *mRibbonMat;
MaterialParameterHandle* mRadiusSC;
MaterialParameterHandle* mRibbonProjSC;
GFXPrimitiveBufferHandle primBuffer;
GFXVertexBufferHandle<GFXVertexPCNTT> verts;
GFXPrimitiveBufferHandle mPrimBuffer;
GFXVertexBufferHandle<GFXVertexPCNTT> mVerts;
protected:

View file

@ -127,13 +127,13 @@ IMPLEMENT_CALLBACK( GameBase, setControl, void, ( bool controlled ), ( controlle
GameBaseData::GameBaseData()
{
category = "";
packed = false;
mCategory = "";
mPacked = false;
}
GameBaseData::GameBaseData(const GameBaseData& other, bool temp_clone) : SimDataBlock(other, temp_clone)
{
packed = other.packed;
category = other.category;
mPacked = other.mPacked;
mCategory = other.mCategory;
//mReloadSignal = other.mReloadSignal; // DO NOT copy the mReloadSignal member.
}
@ -158,7 +158,7 @@ void GameBaseData::initPersistFields()
{
addGroup("Scripting");
addField( "category", TypeCaseString, Offset( category, GameBaseData ),
addField( "category", TypeCaseString, Offset(mCategory, GameBaseData ),
"The group that this datablock will show up in under the \"Scripted\" "
"tab in the World Editor Library." );
@ -171,14 +171,14 @@ bool GameBaseData::preload(bool server, String &errorStr)
{
if (!Parent::preload(server, errorStr))
return false;
packed = false;
mPacked = false;
return true;
}
void GameBaseData::unpackData(BitStream* stream)
{
Parent::unpackData(stream);
packed = true;
mPacked = true;
}
//----------------------------------------------------------------------------
@ -259,7 +259,7 @@ GameBase::GameBase()
GameBase::~GameBase()
{
#ifdef TORQUE_AFX_ENABLED
if (scope_registered)
if (mScope_registered)
arcaneFX::unregisterScopedObject(this);
#endif
}
@ -277,7 +277,7 @@ bool GameBase::onAdd()
#ifdef TORQUE_AFX_ENABLED
if (isClientObject())
{
if (scope_id > 0 && !scope_registered)
if (mScope_id > 0 && !mScope_registered)
arcaneFX::registerScopedObject(this);
}
else
@ -298,7 +298,7 @@ bool GameBase::onAdd()
void GameBase::onRemove()
{
#ifdef TORQUE_AFX_ENABLED
if (scope_registered)
if (mScope_registered)
arcaneFX::unregisterScopedObject(this);
#endif
// EDITOR FEATURE: Remove us from the reload signal of our datablock.
@ -455,7 +455,7 @@ F32 GameBase::getUpdatePriority(CameraScopeQuery *camInfo, U32 updateMask, S32 u
// Projectiles are more interesting if they
// are heading for us.
wInterest = 0.30f;
F32 dot = -mDot(pos,getVelocity());
dot = -mDot(pos,getVelocity());
if (dot > 0.0f)
wInterest += 0.20 * dot;
}
@ -586,8 +586,8 @@ U32 GameBase::packUpdate( NetConnection *connection, U32 mask, BitStream *stream
#ifdef TORQUE_AFX_ENABLED
if (stream->writeFlag(mask & ScopeIdMask))
{
if (stream->writeFlag(scope_refs > 0))
stream->writeInt(scope_id, SCOPE_ID_BITS);
if (stream->writeFlag(mScope_refs > 0))
stream->writeInt(mScope_id, SCOPE_ID_BITS);
}
#endif
return retMask;
@ -631,8 +631,8 @@ void GameBase::unpackUpdate(NetConnection *con, BitStream *stream)
#ifdef TORQUE_AFX_ENABLED
if (stream->readFlag())
{
scope_id = (stream->readFlag()) ? (U16) stream->readInt(SCOPE_ID_BITS) : 0;
scope_refs = 0;
mScope_id = (stream->readFlag()) ? (U16) stream->readInt(SCOPE_ID_BITS) : 0;
mScope_refs = 0;
}
#endif
}

View file

@ -91,8 +91,8 @@ private:
public:
bool packed;
StringTableEntry category;
bool mPacked;
StringTableEntry mCategory;
// Signal triggered when this datablock is modified.
// GameBase objects referencing this datablock notify with this signal.

View file

@ -269,7 +269,7 @@ void GuiMaterialPreview::setObjectModel(const char* modelName)
// Initialize camera values:
mOrbitPos = mModel->getShape()->center;
mMinOrbitDist = mModel->getShape()->radius;
mMinOrbitDist = mModel->getShape()->mRadius;
lastRenderTime = Platform::getVirtualMilliseconds();
}

View file

@ -367,7 +367,7 @@ void GuiObjectView::setObjectModel( const String& modelName )
// Initialize camera values.
mOrbitPos = mModel->getShape()->center;
mMinOrbitDist = mModel->getShape()->radius;
mMinOrbitDist = mModel->getShape()->mRadius;
// Initialize animation.

View file

@ -320,8 +320,8 @@ Item::Item()
mAtRest = true;
mAtRestCounter = 0;
mInLiquid = false;
delta.warpTicks = 0;
delta.dt = 1;
mDelta.warpTicks = 0;
mDelta.dt = 1;
mCollisionObject = 0;
mCollisionTimeout = 0;
mPhysicsRep = NULL;
@ -350,7 +350,7 @@ bool Item::onAdd()
if (mStatic)
mAtRest = true;
mObjToWorld.getColumn(3,&delta.pos);
mObjToWorld.getColumn(3,&mDelta.pos);
// Setup the box for our convex object...
mObjBox.getCenter(&mConvex.mCenter);
@ -564,21 +564,21 @@ void Item::processTick(const Move* move)
mCollisionObject = 0;
// Warp to catch up to server
if (delta.warpTicks > 0)
if (mDelta.warpTicks > 0)
{
delta.warpTicks--;
mDelta.warpTicks--;
// Set new pos.
MatrixF mat = mObjToWorld;
mat.getColumn(3,&delta.pos);
delta.pos += delta.warpOffset;
mat.setColumn(3,delta.pos);
mat.getColumn(3,&mDelta.pos);
mDelta.pos += mDelta.warpOffset;
mat.setColumn(3, mDelta.pos);
Parent::setTransform(mat);
// Backstepping
delta.posVec.x = -delta.warpOffset.x;
delta.posVec.y = -delta.warpOffset.y;
delta.posVec.z = -delta.warpOffset.z;
mDelta.posVec.x = -mDelta.warpOffset.x;
mDelta.posVec.y = -mDelta.warpOffset.y;
mDelta.posVec.z = -mDelta.warpOffset.z;
}
else
{
@ -601,7 +601,7 @@ void Item::processTick(const Move* move)
else
{
// Need to clear out last updatePos or warp interpolation
delta.posVec.set(0,0,0);
mDelta.posVec.set(0,0,0);
}
}
}
@ -613,11 +613,11 @@ void Item::interpolateTick(F32 dt)
return;
// Client side interpolation
Point3F pos = delta.pos + delta.posVec * dt;
Point3F pos = mDelta.pos + mDelta.posVec * dt;
MatrixF mat = mRenderObjToWorld;
mat.setColumn(3,pos);
setRenderTransform(mat);
delta.dt = dt;
mDelta.dt = dt;
}
@ -733,7 +733,7 @@ void Item::updatePos(const U32 /*mask*/, const F32 dt)
// Try and move
Point3F pos;
mObjToWorld.getColumn(3,&pos);
delta.posVec = pos;
mDelta.posVec = pos;
bool contact = false;
bool nonStatic = false;
@ -891,9 +891,9 @@ void Item::updatePos(const U32 /*mask*/, const F32 dt)
if (collisionList.getTime() < 1.0)
{
// Set to collision point
F32 dt = time * collisionList.getTime();
pos += mVelocity * dt;
time -= dt;
F32 cdt = time * collisionList.getTime();
pos += mVelocity * cdt;
time -= cdt;
// Pick the most resistant surface
F32 bd = 0;
@ -959,9 +959,9 @@ void Item::updatePos(const U32 /*mask*/, const F32 dt)
// If on the client, calculate delta for backstepping
if (isGhost()) {
delta.pos = pos;
delta.posVec -= pos;
delta.dt = 1;
mDelta.pos = pos;
mDelta.posVec -= pos;
mDelta.dt = 1;
}
// Update transform
@ -1131,40 +1131,40 @@ void Item::unpackUpdate(NetConnection *connection, BitStream *stream)
if (stream->readFlag() && isProperlyAdded()) {
// Determin number of ticks to warp based on the average
// of the client and server velocities.
delta.warpOffset = pos - delta.pos;
mDelta.warpOffset = pos - mDelta.pos;
F32 as = (speed + mVelocity.len()) * 0.5f * TickSec;
F32 dt = (as > 0.00001f) ? delta.warpOffset.len() / as: sMaxWarpTicks;
delta.warpTicks = (S32)((dt > sMinWarpTicks)? getMax(mFloor(dt + 0.5f), 1.0f): 0.0f);
F32 dt = (as > 0.00001f) ? mDelta.warpOffset.len() / as: sMaxWarpTicks;
mDelta.warpTicks = (S32)((dt > sMinWarpTicks)? getMax(mFloor(dt + 0.5f), 1.0f): 0.0f);
if (delta.warpTicks)
if (mDelta.warpTicks)
{
// Setup the warp to start on the next tick, only the
// object's position is warped.
if (delta.warpTicks > sMaxWarpTicks)
delta.warpTicks = sMaxWarpTicks;
delta.warpOffset /= (F32)delta.warpTicks;
if (mDelta.warpTicks > sMaxWarpTicks)
mDelta.warpTicks = sMaxWarpTicks;
mDelta.warpOffset /= (F32)mDelta.warpTicks;
}
else {
// Going to skip the warp, server and client are real close.
// Adjust the frame interpolation to move smoothly to the
// new position within the current tick.
Point3F cp = delta.pos + delta.posVec * delta.dt;
VectorF vec = delta.pos - cp;
Point3F cp = mDelta.pos + mDelta.posVec * mDelta.dt;
VectorF vec = mDelta.pos - cp;
F32 vl = vec.len();
if (vl) {
F32 s = delta.posVec.len() / vl;
delta.posVec = (cp - pos) * s;
F32 s = mDelta.posVec.len() / vl;
mDelta.posVec = (cp - pos) * s;
}
delta.pos = pos;
mDelta.pos = pos;
mat.setColumn(3,pos);
}
}
else {
// Set the item to the server position
delta.warpTicks = 0;
delta.posVec.set(0,0,0);
delta.pos = pos;
delta.dt = 0;
mDelta.warpTicks = 0;
mDelta.posVec.set(0,0,0);
mDelta.pos = pos;
mDelta.dt = 0;
mat.setColumn(3,pos);
}
}

View file

@ -88,7 +88,7 @@ class Item: public ShapeBase
Point3F warpOffset;
F32 dt;
};
StateDelta delta;
StateDelta mDelta;
// Static attributes
ItemData* mDataBlock;

View file

@ -167,11 +167,11 @@ void OcclusionVolume::buildSilhouette( const SceneCameraState& cameraState, Vect
if( mTransformDirty )
{
const U32 numPoints = mPolyhedron.getNumPoints();
const U32 numPolyPoints = mPolyhedron.getNumPoints();
const PolyhedronType::PointType* points = getPolyhedron().getPoints();
mWSPoints.setSize( numPoints );
for( U32 i = 0; i < numPoints; ++ i )
mWSPoints.setSize(numPolyPoints);
for( U32 i = 0; i < numPolyPoints; ++ i )
{
Point3F p = points[ i ];
p.convolve( getScale() );

View file

@ -342,17 +342,17 @@ U32 PhysicalZone::packUpdate(NetConnection* con, U32 mask, BitStream* stream)
if (stream->writeFlag(mask & PolyhedronMask))
{
// Write the polyhedron
stream->write(mPolyhedron.pointList.size());
for (i = 0; i < mPolyhedron.pointList.size(); i++)
mathWrite(*stream, mPolyhedron.pointList[i]);
stream->write(mPolyhedron.mPointList.size());
for (i = 0; i < mPolyhedron.mPointList.size(); i++)
mathWrite(*stream, mPolyhedron.mPointList[i]);
stream->write(mPolyhedron.planeList.size());
for (i = 0; i < mPolyhedron.planeList.size(); i++)
mathWrite(*stream, mPolyhedron.planeList[i]);
stream->write(mPolyhedron.mPlaneList.size());
for (i = 0; i < mPolyhedron.mPlaneList.size(); i++)
mathWrite(*stream, mPolyhedron.mPlaneList[i]);
stream->write(mPolyhedron.edgeList.size());
for (i = 0; i < mPolyhedron.edgeList.size(); i++) {
const Polyhedron::Edge& rEdge = mPolyhedron.edgeList[i];
stream->write(mPolyhedron.mEdgeList.size());
for (i = 0; i < mPolyhedron.mEdgeList.size(); i++) {
const Polyhedron::Edge& rEdge = mPolyhedron.mEdgeList[i];
stream->write(rEdge.face[0]);
stream->write(rEdge.face[1]);
@ -399,19 +399,19 @@ void PhysicalZone::unpackUpdate(NetConnection* con, BitStream* stream)
// Read the polyhedron
stream->read(&size);
tempPH.pointList.setSize(size);
for (i = 0; i < tempPH.pointList.size(); i++)
mathRead(*stream, &tempPH.pointList[i]);
tempPH.mPointList.setSize(size);
for (i = 0; i < tempPH.mPointList.size(); i++)
mathRead(*stream, &tempPH.mPointList[i]);
stream->read(&size);
tempPH.planeList.setSize(size);
for (i = 0; i < tempPH.planeList.size(); i++)
mathRead(*stream, &tempPH.planeList[i]);
tempPH.mPlaneList.setSize(size);
for (i = 0; i < tempPH.mPlaneList.size(); i++)
mathRead(*stream, &tempPH.mPlaneList[i]);
stream->read(&size);
tempPH.edgeList.setSize(size);
for (i = 0; i < tempPH.edgeList.size(); i++) {
Polyhedron::Edge& rEdge = tempPH.edgeList[i];
tempPH.mEdgeList.setSize(size);
for (i = 0; i < tempPH.mEdgeList.size(); i++) {
Polyhedron::Edge& rEdge = tempPH.mEdgeList[i];
stream->read(&rEdge.face[0]);
stream->read(&rEdge.face[1]);
@ -467,12 +467,12 @@ void PhysicalZone::setPolyhedron(const Polyhedron& rPolyhedron)
{
mPolyhedron = rPolyhedron;
if (mPolyhedron.pointList.size() != 0) {
if (mPolyhedron.mPointList.size() != 0) {
mObjBox.minExtents.set(1e10, 1e10, 1e10);
mObjBox.maxExtents.set(-1e10, -1e10, -1e10);
for (U32 i = 0; i < mPolyhedron.pointList.size(); i++) {
mObjBox.minExtents.setMin(mPolyhedron.pointList[i]);
mObjBox.maxExtents.setMax(mPolyhedron.pointList[i]);
for (U32 i = 0; i < mPolyhedron.mPointList.size(); i++) {
mObjBox.minExtents.setMin(mPolyhedron.mPointList[i]);
mObjBox.maxExtents.setMax(mPolyhedron.mPointList[i]);
}
} else {
mObjBox.minExtents.set(-0.5, -0.5, -0.5);
@ -483,7 +483,7 @@ void PhysicalZone::setPolyhedron(const Polyhedron& rPolyhedron)
setTransform(xform);
mClippedList.clear();
mClippedList.mPlaneList = mPolyhedron.planeList;
mClippedList.mPlaneList = mPolyhedron.mPlaneList;
MatrixF base(true);
base.scale(Point3F(1.0/mObjScale.x,
@ -540,7 +540,7 @@ bool PhysicalZone::testObject(SceneObject* enter)
// all. And whats the point of building a convex if no collision methods
// are implemented?
if (mPolyhedron.pointList.size() == 0)
if (mPolyhedron.mPointList.size() == 0)
return false;
mClippedList.clear();

View file

@ -358,7 +358,7 @@ bool PhysicsDebris::onAdd()
}
// Setup our bounding box
mObjBox = mDataBlock->shape->bounds;
mObjBox = mDataBlock->shape->mBounds;
resetWorldBox();
// Add it to the client scene.

View file

@ -308,10 +308,10 @@ bool PhysicsShapeData::preload( bool server, String &errorBuffer )
{
//no collision so we create a simple box collision shape from the shapes bounds and alert the user
Con::warnf( "PhysicsShapeData::preload - No collision found for shape '%s', auto-creating one", shapeName );
Point3F halfWidth = shape->bounds.getExtents() * 0.5f;
Point3F halfWidth = shape->mBounds.getExtents() * 0.5f;
colShape = PHYSICSMGR->createCollision();
MatrixF centerXfm(true);
centerXfm.setPosition(shape->bounds.getCenter());
centerXfm.setPosition(shape->mBounds.getCenter());
colShape->addBox(halfWidth, centerXfm);
return true;
}
@ -707,7 +707,7 @@ bool PhysicsShape::_createShape()
return false;
// Set the world box.
mObjBox = db->shape->bounds;
mObjBox = db->shape->mBounds;
resetWorldBox();
// If this is the server and its a client only simulation

View file

@ -1577,20 +1577,20 @@ Player::Player()
{
mTypeMask |= PlayerObjectType | DynamicShapeObjectType;
delta.pos = mAnchorPoint = Point3F(0,0,100);
delta.rot = delta.head = Point3F(0,0,0);
delta.rotOffset.set(0.0f,0.0f,0.0f);
delta.warpOffset.set(0.0f,0.0f,0.0f);
delta.posVec.set(0.0f,0.0f,0.0f);
delta.rotVec.set(0.0f,0.0f,0.0f);
delta.headVec.set(0.0f,0.0f,0.0f);
delta.warpTicks = 0;
delta.dt = 1.0f;
delta.move = NullMove;
mDelta.pos = mAnchorPoint = Point3F(0,0,100);
mDelta.rot = mDelta.head = Point3F(0,0,0);
mDelta.rotOffset.set(0.0f,0.0f,0.0f);
mDelta.warpOffset.set(0.0f,0.0f,0.0f);
mDelta.posVec.set(0.0f,0.0f,0.0f);
mDelta.rotVec.set(0.0f,0.0f,0.0f);
mDelta.headVec.set(0.0f,0.0f,0.0f);
mDelta.warpTicks = 0;
mDelta.dt = 1.0f;
mDelta.move = NullMove;
mPredictionCount = sMaxPredictionTicks;
mObjToWorld.setColumn(3,delta.pos);
mRot = delta.rot;
mHead = delta.head;
mObjToWorld.setColumn(3, mDelta.pos);
mRot = mDelta.rot;
mHead = mDelta.head;
mVelocity.set(0.0f, 0.0f, 0.0f);
mDataBlock = 0;
mHeadHThread = mHeadVThread = mRecoilThread = mImageStateThread = 0;
@ -2104,30 +2104,30 @@ void Player::processTick(const Move* move)
}
}
// Warp to catch up to server
if (delta.warpTicks > 0) {
delta.warpTicks--;
if (mDelta.warpTicks > 0) {
mDelta.warpTicks--;
// Set new pos
getTransform().getColumn(3, &delta.pos);
delta.pos += delta.warpOffset;
delta.rot += delta.rotOffset;
getTransform().getColumn(3, &mDelta.pos);
mDelta.pos += mDelta.warpOffset;
mDelta.rot += mDelta.rotOffset;
// Wrap yaw to +/-PI
if (delta.rot.z < - M_PI_F)
delta.rot.z += M_2PI_F;
else if (delta.rot.z > M_PI_F)
delta.rot.z -= M_2PI_F;
if (mDelta.rot.z < - M_PI_F)
mDelta.rot.z += M_2PI_F;
else if (mDelta.rot.z > M_PI_F)
mDelta.rot.z -= M_2PI_F;
if (!ignore_updates)
{
setPosition(delta.pos,delta.rot);
setPosition(mDelta.pos, mDelta.rot);
}
updateDeathOffsets();
updateLookAnimation();
// Backstepping
delta.posVec = -delta.warpOffset;
delta.rotVec = -delta.rotOffset;
mDelta.posVec = -mDelta.warpOffset;
mDelta.rotVec = -mDelta.rotOffset;
}
else {
// If there is no move, the player is either an
@ -2140,7 +2140,7 @@ void Player::processTick(const Move* move)
if (mPredictionCount-- <= 0)
return;
move = &delta.move;
move = &mDelta.move;
}
else
move = &NullMove;
@ -2216,8 +2216,8 @@ void Player::interpolateTick(F32 dt)
// Client side interpolation
Parent::interpolateTick(dt);
Point3F pos = delta.pos + delta.posVec * dt;
Point3F rot = delta.rot + delta.rotVec * dt;
Point3F pos = mDelta.pos + mDelta.posVec * dt;
Point3F rot = mDelta.rot + mDelta.rotVec * dt;
if (!ignore_updates)
setRenderPosition(pos,rot,dt);
@ -2238,7 +2238,7 @@ void Player::interpolateTick(F32 dt)
*/
updateLookAnimation(dt);
delta.dt = dt;
mDelta.dt = dt;
}
void Player::advanceTime(F32 dt)
@ -2562,7 +2562,7 @@ void Player::updateMove(const Move* move)
}
move = &my_move;
}
delta.move = *move;
mDelta.move = *move;
#ifdef TORQUE_OPENVR
if (mControllers[0])
@ -2612,7 +2612,7 @@ void Player::updateMove(const Move* move)
// Update current orientation
if (mDamageState == Enabled) {
F32 prevZRot = mRot.z;
delta.headVec = mHead;
mDelta.headVec = mHead;
bool doStandardMove = true;
bool absoluteDelta = false;
@ -2773,29 +2773,29 @@ void Player::updateMove(const Move* move)
mRot.z -= M_2PI_F;
}
delta.rot = mRot;
delta.rotVec.x = delta.rotVec.y = 0.0f;
delta.rotVec.z = prevZRot - mRot.z;
if (delta.rotVec.z > M_PI_F)
delta.rotVec.z -= M_2PI_F;
else if (delta.rotVec.z < -M_PI_F)
delta.rotVec.z += M_2PI_F;
mDelta.rot = mRot;
mDelta.rotVec.x = mDelta.rotVec.y = 0.0f;
mDelta.rotVec.z = prevZRot - mRot.z;
if (mDelta.rotVec.z > M_PI_F)
mDelta.rotVec.z -= M_2PI_F;
else if (mDelta.rotVec.z < -M_PI_F)
mDelta.rotVec.z += M_2PI_F;
delta.head = mHead;
delta.headVec -= mHead;
mDelta.head = mHead;
mDelta.headVec -= mHead;
if (absoluteDelta)
{
delta.headVec = Point3F(0, 0, 0);
delta.rotVec = Point3F(0, 0, 0);
mDelta.headVec = Point3F(0, 0, 0);
mDelta.rotVec = Point3F(0, 0, 0);
}
for(U32 i=0; i<3; ++i)
{
if (delta.headVec[i] > M_PI_F)
delta.headVec[i] -= M_2PI_F;
else if (delta.headVec[i] < -M_PI_F)
delta.headVec[i] += M_2PI_F;
if (mDelta.headVec[i] > M_PI_F)
mDelta.headVec[i] -= M_2PI_F;
else if (mDelta.headVec[i] < -M_PI_F)
mDelta.headVec[i] += M_2PI_F;
}
}
MatrixF zRot;
@ -3029,7 +3029,7 @@ void Player::updateMove(const Move* move)
// get the head pitch and add it to the moveVec
// This more accurate swim vector calc comes from Matt Fairfax
MatrixF xRot, zRot;
MatrixF xRot;
xRot.set(EulerF(mHead.x, 0, 0));
zRot.set(EulerF(0, 0, mRot.z));
MatrixF rot;
@ -3584,7 +3584,7 @@ void Player::updateLookAnimation(F32 dt)
return;
}
// Calculate our interpolated head position.
Point3F renderHead = delta.head + delta.headVec * dt;
Point3F renderHead = mDelta.head + mDelta.headVec * dt;
// Adjust look pos. This assumes that the animations match
// the min and max look angles provided in the datablock.
@ -4422,8 +4422,8 @@ void Player::onImageStateAnimation(U32 imageSlot, const char* seqName, bool dire
if (!found && hasImageBasePrefix && hasScriptPrefix)
{
String seqName = String(imageBasePrefix) + String("_") + String(scriptPrefix) + String("_") + baseSeqName;
S32 index = mShapeInstance->getShape()->findSequence(seqName);
String comboSeqName = String(imageBasePrefix) + String("_") + String(scriptPrefix) + String("_") + baseSeqName;
S32 index = mShapeInstance->getShape()->findSequence(comboSeqName);
if (index != -1)
{
seqIndex = index;
@ -4433,8 +4433,8 @@ void Player::onImageStateAnimation(U32 imageSlot, const char* seqName, bool dire
if (!found && hasImageBasePrefix)
{
String seqName = String(imageBasePrefix) + String("_") + baseSeqName;
S32 index = mShapeInstance->getShape()->findSequence(seqName);
String imgSeqName = String(imageBasePrefix) + String("_") + baseSeqName;
S32 index = mShapeInstance->getShape()->findSequence(imgSeqName);
if (index != -1)
{
seqIndex = index;
@ -4444,8 +4444,8 @@ void Player::onImageStateAnimation(U32 imageSlot, const char* seqName, bool dire
if (!found && hasScriptPrefix)
{
String seqName = String(scriptPrefix) + String("_") + baseSeqName;
S32 index = mShapeInstance->getShape()->findSequence(seqName);
String scriptSeqName = String(scriptPrefix) + String("_") + baseSeqName;
S32 index = mShapeInstance->getShape()->findSequence(scriptSeqName);
if (index != -1)
{
seqIndex = index;
@ -5114,7 +5114,7 @@ void Player::_handleCollision( const Collision &collision )
bool Player::updatePos(const F32 travelTime)
{
PROFILE_SCOPE(Player_UpdatePos);
getTransform().getColumn(3,&delta.posVec);
getTransform().getColumn(3,&mDelta.posVec);
// When mounted to another object, only Z rotation used.
if (isMounted()) {
@ -5206,7 +5206,7 @@ bool Player::updatePos(const F32 travelTime)
else
{
if ( mVelocity.isZero() )
newPos = delta.posVec;
newPos = mDelta.posVec;
else
newPos = _move( travelTime, &col );
@ -5223,9 +5223,9 @@ bool Player::updatePos(const F32 travelTime)
// If on the client, calc delta for backstepping
if (isClientObject())
{
delta.pos = newPos;
delta.posVec = delta.posVec - delta.pos;
delta.dt = 1.0f;
mDelta.pos = newPos;
mDelta.posVec = mDelta.posVec - mDelta.pos;
mDelta.dt = 1.0f;
}
setPosition( newPos, mRot );
@ -5461,8 +5461,8 @@ bool Player::displaceObject(const Point3F& displacement)
sBalance--;
getTransform().getColumn(3, &delta.pos);
delta.posVec.set(0.0f, 0.0f, 0.0f);
getTransform().getColumn(3, &mDelta.pos);
mDelta.posVec.set(0.0f, 0.0f, 0.0f);
return result;
}
@ -5481,8 +5481,8 @@ bool Player::displaceObject(const Point3F& displacement)
bool result = updatePos(dt);
mObjToWorld.getColumn(3, &delta.pos);
delta.posVec.set(0.0f, 0.0f, 0.0f);
mObjToWorld.getColumn(3, &mDelta.pos);
mDelta.posVec.set(0.0f, 0.0f, 0.0f);
return result;
}
@ -5685,10 +5685,10 @@ void Player::getRenderEyeBaseTransform(MatrixF* mat, bool includeBank)
// Eye transform in world space. We only use the eye position
// from the animation and supply our own rotation.
MatrixF pmat,xmat,zmat;
xmat.set(EulerF(delta.head.x + delta.headVec.x * delta.dt, 0.0f, 0.0f));
xmat.set(EulerF(mDelta.head.x + mDelta.headVec.x * mDelta.dt, 0.0f, 0.0f));
if (mUseHeadZCalc)
zmat.set(EulerF(0.0f, 0.0f, delta.head.z + delta.headVec.z * delta.dt));
zmat.set(EulerF(0.0f, 0.0f, mDelta.head.z + mDelta.headVec.z * mDelta.dt));
else
zmat.identity();
@ -5698,7 +5698,7 @@ void Player::getRenderEyeBaseTransform(MatrixF* mat, bool includeBank)
MatrixF imat;
imat.mul(zmat, xmat);
MatrixF ymat;
ymat.set(EulerF(0.0f, delta.head.y + delta.headVec.y * delta.dt, 0.0f));
ymat.set(EulerF(0.0f, mDelta.head.y + mDelta.headVec.y * mDelta.dt, 0.0f));
pmat.mul(imat, ymat);
}
else
@ -6235,7 +6235,7 @@ void Player::readPacketData(GameConnection *connection, BitStream *stream)
stream->read(&mVelocity.y);
stream->read(&mVelocity.z);
stream->setCompressionPoint(pos);
delta.pos = pos;
mDelta.pos = pos;
mJumpSurfaceLastContact = stream->readInt(4);
if (stream->readFlag())
@ -6258,7 +6258,7 @@ void Player::readPacketData(GameConnection *connection, BitStream *stream)
}
}
else
pos = delta.pos;
pos = mDelta.pos;
stream->read(&mHead.x);
if(stream->readFlag())
{
@ -6270,8 +6270,8 @@ void Player::readPacketData(GameConnection *connection, BitStream *stream)
rot.x = rot.y = 0;
if (!ignore_updates)
setPosition(pos,rot);
delta.head = mHead;
delta.rot = rot;
mDelta.head = mHead;
mDelta.rot = rot;
if (stream->readFlag()) {
S32 gIndex = stream->readInt(NetConnection::GhostIdBitSize);
@ -6349,7 +6349,7 @@ U32 Player::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
stream->writeFloat(mRot.z / M_2PI_F, 7);
stream->writeSignedFloat(mHead.x / (mDataBlock->maxLookAngle - mDataBlock->minLookAngle), 6);
stream->writeSignedFloat(mHead.z / mDataBlock->maxFreelookAngle, 6);
delta.move.pack(stream);
mDelta.move.pack(stream);
stream->writeFlag(!(mask & NoWarpMask));
}
// Ghost need energy to predict reliably
@ -6455,67 +6455,67 @@ void Player::unpackUpdate(NetConnection *con, BitStream *stream)
rot.z = stream->readFloat(7) * M_2PI_F;
mHead.x = stream->readSignedFloat(6) * (mDataBlock->maxLookAngle - mDataBlock->minLookAngle);
mHead.z = stream->readSignedFloat(6) * mDataBlock->maxFreelookAngle;
delta.move.unpack(stream);
mDelta.move.unpack(stream);
delta.head = mHead;
delta.headVec.set(0.0f, 0.0f, 0.0f);
mDelta.head = mHead;
mDelta.headVec.set(0.0f, 0.0f, 0.0f);
if (stream->readFlag() && isProperlyAdded())
{
// Determine number of ticks to warp based on the average
// of the client and server velocities.
delta.warpOffset = pos - delta.pos;
mDelta.warpOffset = pos - mDelta.pos;
F32 as = (speed + mVelocity.len()) * 0.5f * TickSec;
F32 dt = (as > 0.00001f) ? delta.warpOffset.len() / as: sMaxWarpTicks;
delta.warpTicks = (S32)((dt > sMinWarpTicks) ? getMax(mFloor(dt + 0.5f), 1.0f) : 0.0f);
F32 dt = (as > 0.00001f) ? mDelta.warpOffset.len() / as: sMaxWarpTicks;
mDelta.warpTicks = (S32)((dt > sMinWarpTicks) ? getMax(mFloor(dt + 0.5f), 1.0f) : 0.0f);
if (delta.warpTicks)
if (mDelta.warpTicks)
{
// Setup the warp to start on the next tick.
if (delta.warpTicks > sMaxWarpTicks)
delta.warpTicks = sMaxWarpTicks;
delta.warpOffset /= (F32)delta.warpTicks;
if (mDelta.warpTicks > sMaxWarpTicks)
mDelta.warpTicks = sMaxWarpTicks;
mDelta.warpOffset /= (F32)mDelta.warpTicks;
delta.rotOffset = rot - delta.rot;
mDelta.rotOffset = rot - mDelta.rot;
// Ignore small rotation differences
if (mFabs(delta.rotOffset.z) < 0.001f)
delta.rotOffset.z = 0;
if (mFabs(mDelta.rotOffset.z) < 0.001f)
mDelta.rotOffset.z = 0;
// Wrap rotation to +/-PI
if(delta.rotOffset.z < - M_PI_F)
delta.rotOffset.z += M_2PI_F;
else if(delta.rotOffset.z > M_PI_F)
delta.rotOffset.z -= M_2PI_F;
if(mDelta.rotOffset.z < - M_PI_F)
mDelta.rotOffset.z += M_2PI_F;
else if(mDelta.rotOffset.z > M_PI_F)
mDelta.rotOffset.z -= M_2PI_F;
delta.rotOffset /= (F32)delta.warpTicks;
mDelta.rotOffset /= (F32)mDelta.warpTicks;
}
else
{
// Going to skip the warp, server and client are real close.
// Adjust the frame interpolation to move smoothly to the
// new position within the current tick.
Point3F cp = delta.pos + delta.posVec * delta.dt;
if (delta.dt == 0)
Point3F cp = mDelta.pos + mDelta.posVec * mDelta.dt;
if (mDelta.dt == 0)
{
delta.posVec.set(0.0f, 0.0f, 0.0f);
delta.rotVec.set(0.0f, 0.0f, 0.0f);
mDelta.posVec.set(0.0f, 0.0f, 0.0f);
mDelta.rotVec.set(0.0f, 0.0f, 0.0f);
}
else
{
F32 dti = 1.0f / delta.dt;
delta.posVec = (cp - pos) * dti;
delta.rotVec.z = mRot.z - rot.z;
F32 dti = 1.0f / mDelta.dt;
mDelta.posVec = (cp - pos) * dti;
mDelta.rotVec.z = mRot.z - rot.z;
if(delta.rotVec.z > M_PI_F)
delta.rotVec.z -= M_2PI_F;
else if(delta.rotVec.z < -M_PI_F)
delta.rotVec.z += M_2PI_F;
if(mDelta.rotVec.z > M_PI_F)
mDelta.rotVec.z -= M_2PI_F;
else if(mDelta.rotVec.z < -M_PI_F)
mDelta.rotVec.z += M_2PI_F;
delta.rotVec.z *= dti;
mDelta.rotVec.z *= dti;
}
delta.pos = pos;
delta.rot = rot;
mDelta.pos = pos;
mDelta.rot = rot;
if (!ignore_updates)
setPosition(pos,rot);
}
@ -6523,12 +6523,12 @@ void Player::unpackUpdate(NetConnection *con, BitStream *stream)
else
{
// Set the player to the server position
delta.pos = pos;
delta.rot = rot;
delta.posVec.set(0.0f, 0.0f, 0.0f);
delta.rotVec.set(0.0f, 0.0f, 0.0f);
delta.warpTicks = 0;
delta.dt = 0.0f;
mDelta.pos = pos;
mDelta.rot = rot;
mDelta.posVec.set(0.0f, 0.0f, 0.0f);
mDelta.rotVec.set(0.0f, 0.0f, 0.0f);
mDelta.warpTicks = 0;
mDelta.dt = 0.0f;
if (!ignore_updates)
setPosition(pos,rot);
}

View file

@ -436,7 +436,7 @@ protected:
Point3F rotOffset;
/// @}
};
StateDelta delta; ///< Used for interpolation on the client. @see StateDelta
StateDelta mDelta; ///< Used for interpolation on the client. @see StateDelta
S32 mPredictionCount; ///< Number of ticks to predict
// Current pos, vel etc.

View file

@ -828,7 +828,7 @@ bool Projectile::onAdd()
// Setup our bounding box
if (bool(mDataBlock->projectileShape) == true)
mObjBox = mDataBlock->projectileShape->bounds;
mObjBox = mDataBlock->projectileShape->mBounds;
else
mObjBox = Box3F(Point3F(0, 0, 0), Point3F(0, 0, 0));

View file

@ -386,8 +386,8 @@ void ProximityMine::setDeployedPos( const Point3F& pos, const Point3F& normal )
MathUtils::getMatrixFromUpVector( normal, &mat );
mat.setPosition( pos + normal * mObjBox.minExtents.z );
delta.pos = pos;
delta.posVec.set(0, 0, 0);
mDelta.pos = pos;
mDelta.posVec.set(0, 0, 0);
ShapeBase::setTransform( mat );
if ( mPhysicsRep )

View file

@ -1194,7 +1194,7 @@ bool RigidShape::updateCollision(F32 dt)
mCollisionList.clear();
CollisionState *state = mConvex.findClosestState(cmat, getScale(), mDataBlock->collisionTol);
if (state && state->dist <= mDataBlock->collisionTol)
if (state && state->mDist <= mDataBlock->collisionTol)
{
//resolveDisplacement(ns,state,dt);
mConvex.getCollisionInfo(cmat, getScale(), &mCollisionList, mDataBlock->collisionTol);
@ -1326,8 +1326,8 @@ bool RigidShape::resolveContacts(Rigid& ns,CollisionList& cList,F32 dt)
bool RigidShape::resolveDisplacement(Rigid& ns,CollisionState *state, F32 dt)
{
SceneObject* obj = (state->a->getObject() == this)?
state->b->getObject(): state->a->getObject();
SceneObject* obj = (state->mA->getObject() == this)?
state->mB->getObject(): state->mA->getObject();
if (obj->isDisplacable() && ((obj->getTypeMask() & ShapeBaseObjectType) != 0))
{

View file

@ -405,17 +405,17 @@ bool ShapeBaseData::preload(bool server, String &errorStr)
mShape->computeBounds(collisionDetails.last(), collisionBounds.last());
mShape->getAccelerator(collisionDetails.last());
if (!mShape->bounds.isContained(collisionBounds.last()))
if (!mShape->mBounds.isContained(collisionBounds.last()))
{
if (!silent_bbox_check)
Con::warnf("Warning: shape %s collision detail %d (Collision-%d) bounds exceed that of shape.", shapeName, collisionDetails.size() - 1, collisionDetails.last());
collisionBounds.last() = mShape->bounds;
collisionBounds.last() = mShape->mBounds;
}
else if (collisionBounds.last().isValidBox() == false)
{
if (!silent_bbox_check)
Con::errorf("Error: shape %s-collision detail %d (Collision-%d) bounds box invalid!", shapeName, collisionDetails.size() - 1, collisionDetails.last());
collisionBounds.last() = mShape->bounds;
collisionBounds.last() = mShape->mBounds;
}
// The way LOS works is that it will check to see if there is a LOS detail that matches
@ -482,7 +482,7 @@ bool ShapeBaseData::preload(bool server, String &errorStr)
damageSequence = mShape->findSequence("Damage");
//
F32 w = mShape->bounds.len_y() / 2;
F32 w = mShape->mBounds.len_y() / 2;
if (cameraMaxDist < w)
cameraMaxDist = w;
// just parse up the string and collect the remappings in txr_tag_remappings.
@ -707,7 +707,7 @@ DefineEngineMethod( ShapeBaseData, checkDeployPos, bool, ( TransformF txfm ),,
MatrixF mat = txfm.getMatrix();
Box3F objBox = object->mShape->bounds;
Box3F objBox = object->mShape->mBounds;
Point3F boxCenter = (objBox.minExtents + objBox.maxExtents) * 0.5f;
objBox.minExtents = boxCenter + (objBox.minExtents - boxCenter) * 0.9f;
objBox.maxExtents = boxCenter + (objBox.maxExtents - boxCenter) * 0.9f;
@ -808,7 +808,7 @@ void ShapeBaseData::packData(BitStream* stream)
if( stream->writeFlag( debris != NULL ) )
{
stream->writeRangedU32(packed? SimObjectId((uintptr_t)debris):
stream->writeRangedU32(mPacked? SimObjectId((uintptr_t)debris):
debris->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast);
}
@ -1275,7 +1275,7 @@ bool ShapeBase::onNewDataBlock( GameBaseData *dptr, bool reload )
}
}
mObjBox = mDataBlock->mShape->bounds;
mObjBox = mDataBlock->mShape->mBounds;
resetWorldBox();
// Set the initial mesh hidden state.
@ -2801,7 +2801,7 @@ void ShapeBase::_renderBoundingBox( ObjectRenderInst *ri, SceneRenderState *stat
MatrixF mat;
getRenderImageTransform( ri->objectIndex, &mat );
const Box3F &objBox = image.shapeInstance[getImageShapeIndex(image)]->getShape()->bounds;
const Box3F &objBox = image.shapeInstance[getImageShapeIndex(image)]->getShape()->mBounds;
drawer->drawCube( desc, objBox, ColorI( 255, 255, 255 ), &mat );
}
@ -3315,23 +3315,23 @@ void ShapeBase::unpackUpdate(NetConnection *con, BitStream *stream)
bool datablockChange = image.dataBlock != imageData;
if (datablockChange || (image.skinNameHandle != skinDesiredNameHandle))
{
MountedImage& image = mMountedImageList[i];
image.scriptAnimPrefix = scriptDesiredAnimPrefix;
MountedImage& neoImage = mMountedImageList[i];
neoImage.scriptAnimPrefix = scriptDesiredAnimPrefix;
setImage( i, imageData,
skinDesiredNameHandle, image.loaded,
image.ammo, image.triggerDown, image.altTriggerDown,
image.motion, image.genericTrigger[0], image.genericTrigger[1], image.genericTrigger[2], image.genericTrigger[3],
image.target);
skinDesiredNameHandle, neoImage.loaded,
neoImage.ammo, neoImage.triggerDown, neoImage.altTriggerDown,
neoImage.motion, neoImage.genericTrigger[0], neoImage.genericTrigger[1], neoImage.genericTrigger[2], neoImage.genericTrigger[3],
neoImage.target);
}
if (!datablockChange && image.scriptAnimPrefix != scriptDesiredAnimPrefix)
{
// We don't have a new image, but we do have a new script anim prefix to work with.
// Notify the image of this change.
MountedImage& image = mMountedImageList[i];
image.scriptAnimPrefix = scriptDesiredAnimPrefix;
updateAnimThread(i, getImageShapeIndex(image));
MountedImage& animImage = mMountedImageList[i];
animImage.scriptAnimPrefix = scriptDesiredAnimPrefix;
updateAnimThread(i, getImageShapeIndex(animImage));
}
bool isFiring = stream->readFlag();
@ -3586,8 +3586,8 @@ void ShapeBaseConvex::getFeatures(const MatrixF& mat, const VectorF& n, ConvexFe
U32 numVerts = emitString[currPos++];
for (i = 0; i < numVerts; i++) {
cf->mVertexList.increment();
U32 index = emitString[currPos++];
mat.mulP(pAccel->vertexList[index], &cf->mVertexList.last());
U32 vListIDx = emitString[currPos++];
mat.mulP(pAccel->vertexList[vListIDx], &cf->mVertexList.last());
}
U32 numEdges = emitString[currPos++];

View file

@ -1019,7 +1019,7 @@ void ShapeBaseImageData::packData(BitStream* stream)
// Write the projectile datablock
if (stream->writeFlag(projectile))
stream->writeRangedU32(packed? SimObjectId((uintptr_t)projectile):
stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)projectile):
projectile->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast);
stream->writeFlag(cloakable);
@ -1050,7 +1050,7 @@ void ShapeBaseImageData::packData(BitStream* stream)
if( stream->writeFlag( casing ) )
{
stream->writeRangedU32(packed? SimObjectId((uintptr_t)casing):
stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)casing):
casing->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast);
}
@ -1139,7 +1139,7 @@ void ShapeBaseImageData::packData(BitStream* stream)
if (stream->writeFlag(s.emitter))
{
stream->writeRangedU32(packed? SimObjectId((uintptr_t)s.emitter):
stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)s.emitter):
s.emitter->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast);
stream->write(s.emitterTime);

View file

@ -350,9 +350,9 @@ void MeshRenderSystem::rebuildBuffers()
U16 *pIndex;
buffers.primitiveBuffer.lock(&pIndex);
for (U16 i = 0; i < buffers.primData.size(); i++)
for (U16 primDataIDx = 0; primDataIDx < buffers.primData.size(); primDataIDx++)
{
*pIndex = i;
*pIndex = primDataIDx;
pIndex++;
}

View file

@ -245,16 +245,16 @@ ConsoleGetType( TypeTriggerPolyhedron )
Polyhedron* pPoly = reinterpret_cast<Polyhedron*>(dptr);
// First point is corner, need to find the three vectors...`
Point3F origin = pPoly->pointList[0];
Point3F origin = pPoly->mPointList[0];
U32 currVec = 0;
Point3F vecs[3];
for (i = 0; i < pPoly->edgeList.size(); i++) {
const U32 *vertex = pPoly->edgeList[i].vertex;
for (i = 0; i < pPoly->mEdgeList.size(); i++) {
const U32 *vertex = pPoly->mEdgeList[i].vertex;
if (vertex[0] == 0)
vecs[currVec++] = pPoly->pointList[vertex[1]] - origin;
vecs[currVec++] = pPoly->mPointList[vertex[1]] - origin;
else
if (vertex[1] == 0)
vecs[currVec++] = pPoly->pointList[vertex[0]] - origin;
vecs[currVec++] = pPoly->mPointList[vertex[0]] - origin;
}
AssertFatal(currVec == 3, "Internal error: Bad trigger polyhedron");
@ -302,45 +302,45 @@ ConsoleSetType( TypeTriggerPolyhedron )
// edges with CCW instead of CW order for face[0] and that it b) lets plane
// normals face outwards rather than inwards.
pPoly->pointList.setSize(8);
pPoly->pointList[0] = origin;
pPoly->pointList[1] = origin + vecs[0];
pPoly->pointList[2] = origin + vecs[1];
pPoly->pointList[3] = origin + vecs[2];
pPoly->pointList[4] = origin + vecs[0] + vecs[1];
pPoly->pointList[5] = origin + vecs[0] + vecs[2];
pPoly->pointList[6] = origin + vecs[1] + vecs[2];
pPoly->pointList[7] = origin + vecs[0] + vecs[1] + vecs[2];
pPoly->mPointList.setSize(8);
pPoly->mPointList[0] = origin;
pPoly->mPointList[1] = origin + vecs[0];
pPoly->mPointList[2] = origin + vecs[1];
pPoly->mPointList[3] = origin + vecs[2];
pPoly->mPointList[4] = origin + vecs[0] + vecs[1];
pPoly->mPointList[5] = origin + vecs[0] + vecs[2];
pPoly->mPointList[6] = origin + vecs[1] + vecs[2];
pPoly->mPointList[7] = origin + vecs[0] + vecs[1] + vecs[2];
Point3F normal;
pPoly->planeList.setSize(6);
pPoly->mPlaneList.setSize(6);
mCross(vecs[2], vecs[0], &normal);
pPoly->planeList[0].set(origin, normal);
pPoly->mPlaneList[0].set(origin, normal);
mCross(vecs[0], vecs[1], &normal);
pPoly->planeList[1].set(origin, normal);
pPoly->mPlaneList[1].set(origin, normal);
mCross(vecs[1], vecs[2], &normal);
pPoly->planeList[2].set(origin, normal);
pPoly->mPlaneList[2].set(origin, normal);
mCross(vecs[1], vecs[0], &normal);
pPoly->planeList[3].set(pPoly->pointList[7], normal);
pPoly->mPlaneList[3].set(pPoly->mPointList[7], normal);
mCross(vecs[2], vecs[1], &normal);
pPoly->planeList[4].set(pPoly->pointList[7], normal);
pPoly->mPlaneList[4].set(pPoly->mPointList[7], normal);
mCross(vecs[0], vecs[2], &normal);
pPoly->planeList[5].set(pPoly->pointList[7], normal);
pPoly->mPlaneList[5].set(pPoly->mPointList[7], normal);
pPoly->edgeList.setSize(12);
pPoly->edgeList[0].vertex[0] = 0; pPoly->edgeList[0].vertex[1] = 1; pPoly->edgeList[0].face[0] = 0; pPoly->edgeList[0].face[1] = 1;
pPoly->edgeList[1].vertex[0] = 1; pPoly->edgeList[1].vertex[1] = 5; pPoly->edgeList[1].face[0] = 0; pPoly->edgeList[1].face[1] = 4;
pPoly->edgeList[2].vertex[0] = 5; pPoly->edgeList[2].vertex[1] = 3; pPoly->edgeList[2].face[0] = 0; pPoly->edgeList[2].face[1] = 3;
pPoly->edgeList[3].vertex[0] = 3; pPoly->edgeList[3].vertex[1] = 0; pPoly->edgeList[3].face[0] = 0; pPoly->edgeList[3].face[1] = 2;
pPoly->edgeList[4].vertex[0] = 3; pPoly->edgeList[4].vertex[1] = 6; pPoly->edgeList[4].face[0] = 3; pPoly->edgeList[4].face[1] = 2;
pPoly->edgeList[5].vertex[0] = 6; pPoly->edgeList[5].vertex[1] = 2; pPoly->edgeList[5].face[0] = 2; pPoly->edgeList[5].face[1] = 5;
pPoly->edgeList[6].vertex[0] = 2; pPoly->edgeList[6].vertex[1] = 0; pPoly->edgeList[6].face[0] = 2; pPoly->edgeList[6].face[1] = 1;
pPoly->edgeList[7].vertex[0] = 1; pPoly->edgeList[7].vertex[1] = 4; pPoly->edgeList[7].face[0] = 4; pPoly->edgeList[7].face[1] = 1;
pPoly->edgeList[8].vertex[0] = 4; pPoly->edgeList[8].vertex[1] = 2; pPoly->edgeList[8].face[0] = 1; pPoly->edgeList[8].face[1] = 5;
pPoly->edgeList[9].vertex[0] = 4; pPoly->edgeList[9].vertex[1] = 7; pPoly->edgeList[9].face[0] = 4; pPoly->edgeList[9].face[1] = 5;
pPoly->edgeList[10].vertex[0] = 5; pPoly->edgeList[10].vertex[1] = 7; pPoly->edgeList[10].face[0] = 3; pPoly->edgeList[10].face[1] = 4;
pPoly->edgeList[11].vertex[0] = 7; pPoly->edgeList[11].vertex[1] = 6; pPoly->edgeList[11].face[0] = 3; pPoly->edgeList[11].face[1] = 5;
pPoly->mEdgeList.setSize(12);
pPoly->mEdgeList[0].vertex[0] = 0; pPoly->mEdgeList[0].vertex[1] = 1; pPoly->mEdgeList[0].face[0] = 0; pPoly->mEdgeList[0].face[1] = 1;
pPoly->mEdgeList[1].vertex[0] = 1; pPoly->mEdgeList[1].vertex[1] = 5; pPoly->mEdgeList[1].face[0] = 0; pPoly->mEdgeList[1].face[1] = 4;
pPoly->mEdgeList[2].vertex[0] = 5; pPoly->mEdgeList[2].vertex[1] = 3; pPoly->mEdgeList[2].face[0] = 0; pPoly->mEdgeList[2].face[1] = 3;
pPoly->mEdgeList[3].vertex[0] = 3; pPoly->mEdgeList[3].vertex[1] = 0; pPoly->mEdgeList[3].face[0] = 0; pPoly->mEdgeList[3].face[1] = 2;
pPoly->mEdgeList[4].vertex[0] = 3; pPoly->mEdgeList[4].vertex[1] = 6; pPoly->mEdgeList[4].face[0] = 3; pPoly->mEdgeList[4].face[1] = 2;
pPoly->mEdgeList[5].vertex[0] = 6; pPoly->mEdgeList[5].vertex[1] = 2; pPoly->mEdgeList[5].face[0] = 2; pPoly->mEdgeList[5].face[1] = 5;
pPoly->mEdgeList[6].vertex[0] = 2; pPoly->mEdgeList[6].vertex[1] = 0; pPoly->mEdgeList[6].face[0] = 2; pPoly->mEdgeList[6].face[1] = 1;
pPoly->mEdgeList[7].vertex[0] = 1; pPoly->mEdgeList[7].vertex[1] = 4; pPoly->mEdgeList[7].face[0] = 4; pPoly->mEdgeList[7].face[1] = 1;
pPoly->mEdgeList[8].vertex[0] = 4; pPoly->mEdgeList[8].vertex[1] = 2; pPoly->mEdgeList[8].face[0] = 1; pPoly->mEdgeList[8].face[1] = 5;
pPoly->mEdgeList[9].vertex[0] = 4; pPoly->mEdgeList[9].vertex[1] = 7; pPoly->mEdgeList[9].face[0] = 4; pPoly->mEdgeList[9].face[1] = 5;
pPoly->mEdgeList[10].vertex[0] = 5; pPoly->mEdgeList[10].vertex[1] = 7; pPoly->mEdgeList[10].face[0] = 3; pPoly->mEdgeList[10].face[1] = 4;
pPoly->mEdgeList[11].vertex[0] = 7; pPoly->mEdgeList[11].vertex[1] = 6; pPoly->mEdgeList[11].face[0] = 3; pPoly->mEdgeList[11].face[1] = 5;
}
@ -569,12 +569,12 @@ void Trigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron)
{
mTriggerPolyhedron = rPolyhedron;
if (mTriggerPolyhedron.pointList.size() != 0) {
if (mTriggerPolyhedron.mPointList.size() != 0) {
mObjBox.minExtents.set(1e10, 1e10, 1e10);
mObjBox.maxExtents.set(-1e10, -1e10, -1e10);
for (U32 i = 0; i < mTriggerPolyhedron.pointList.size(); i++) {
mObjBox.minExtents.setMin(mTriggerPolyhedron.pointList[i]);
mObjBox.maxExtents.setMax(mTriggerPolyhedron.pointList[i]);
for (U32 i = 0; i < mTriggerPolyhedron.mPointList.size(); i++) {
mObjBox.minExtents.setMin(mTriggerPolyhedron.mPointList[i]);
mObjBox.maxExtents.setMax(mTriggerPolyhedron.mPointList[i]);
}
} else {
mObjBox.minExtents.set(-0.5, -0.5, -0.5);
@ -585,7 +585,7 @@ void Trigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron)
setTransform(xform);
mClippedList.clear();
mClippedList.mPlaneList = mTriggerPolyhedron.planeList;
mClippedList.mPlaneList = mTriggerPolyhedron.mPlaneList;
// for (U32 i = 0; i < mClippedList.mPlaneList.size(); i++)
// mClippedList.mPlaneList[i].neg();
@ -623,7 +623,7 @@ void Trigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron)
bool Trigger::testObject(GameBase* enter)
{
if (mTriggerPolyhedron.pointList.size() == 0)
if (mTriggerPolyhedron.mPointList.size() == 0)
return false;
mClippedList.clear();
@ -731,17 +731,17 @@ U32 Trigger::packUpdate(NetConnection* con, U32 mask, BitStream* stream)
// Write the polyhedron
if( stream->writeFlag( mask & PolyMask ) )
{
stream->write(mTriggerPolyhedron.pointList.size());
for (i = 0; i < mTriggerPolyhedron.pointList.size(); i++)
mathWrite(*stream, mTriggerPolyhedron.pointList[i]);
stream->write(mTriggerPolyhedron.mPointList.size());
for (i = 0; i < mTriggerPolyhedron.mPointList.size(); i++)
mathWrite(*stream, mTriggerPolyhedron.mPointList[i]);
stream->write(mTriggerPolyhedron.planeList.size());
for (i = 0; i < mTriggerPolyhedron.planeList.size(); i++)
mathWrite(*stream, mTriggerPolyhedron.planeList[i]);
stream->write(mTriggerPolyhedron.mPlaneList.size());
for (i = 0; i < mTriggerPolyhedron.mPlaneList.size(); i++)
mathWrite(*stream, mTriggerPolyhedron.mPlaneList[i]);
stream->write(mTriggerPolyhedron.edgeList.size());
for (i = 0; i < mTriggerPolyhedron.edgeList.size(); i++) {
const Polyhedron::Edge& rEdge = mTriggerPolyhedron.edgeList[i];
stream->write(mTriggerPolyhedron.mEdgeList.size());
for (i = 0; i < mTriggerPolyhedron.mEdgeList.size(); i++) {
const Polyhedron::Edge& rEdge = mTriggerPolyhedron.mEdgeList[i];
stream->write(rEdge.face[0]);
stream->write(rEdge.face[1]);
@ -779,19 +779,19 @@ void Trigger::unpackUpdate(NetConnection* con, BitStream* stream)
{
Polyhedron tempPH;
stream->read(&size);
tempPH.pointList.setSize(size);
for (i = 0; i < tempPH.pointList.size(); i++)
mathRead(*stream, &tempPH.pointList[i]);
tempPH.mPointList.setSize(size);
for (i = 0; i < tempPH.mPointList.size(); i++)
mathRead(*stream, &tempPH.mPointList[i]);
stream->read(&size);
tempPH.planeList.setSize(size);
for (i = 0; i < tempPH.planeList.size(); i++)
mathRead(*stream, &tempPH.planeList[i]);
tempPH.mPlaneList.setSize(size);
for (i = 0; i < tempPH.mPlaneList.size(); i++)
mathRead(*stream, &tempPH.mPlaneList[i]);
stream->read(&size);
tempPH.edgeList.setSize(size);
for (i = 0; i < tempPH.edgeList.size(); i++) {
Polyhedron::Edge& rEdge = tempPH.edgeList[i];
tempPH.mEdgeList.setSize(size);
for (i = 0; i < tempPH.mEdgeList.size(); i++) {
Polyhedron::Edge& rEdge = tempPH.mEdgeList[i];
stream->read(&rEdge.face[0]);
stream->read(&rEdge.face[1]);

View file

@ -373,7 +373,7 @@ bool TSStatic::_createShape()
NetConnection::filesWereDownloaded() )
return false;
mObjBox = mShape->bounds;
mObjBox = mShape->mBounds;
resetWorldBox();
mShapeInstance = new TSShapeInstance( mShape, isClientObject() );

View file

@ -244,7 +244,7 @@ void FlyingVehicleData::packData(BitStream* stream)
{
if (stream->writeFlag(sound[i]))
{
SimObjectId writtenId = packed ? SimObjectId((uintptr_t)sound[i]) : sound[i]->getId();
SimObjectId writtenId = mPacked ? SimObjectId((uintptr_t)sound[i]) : sound[i]->getId();
stream->writeRangedU32(writtenId, DataBlockObjectIdFirst, DataBlockObjectIdLast);
}
}
@ -253,7 +253,7 @@ void FlyingVehicleData::packData(BitStream* stream)
{
if (stream->writeFlag(jetEmitter[j]))
{
SimObjectId writtenId = packed ? SimObjectId((uintptr_t)jetEmitter[j]) : jetEmitter[j]->getId();
SimObjectId writtenId = mPacked ? SimObjectId((uintptr_t)jetEmitter[j]) : jetEmitter[j]->getId();
stream->writeRangedU32(writtenId, DataBlockObjectIdFirst,DataBlockObjectIdLast);
}
}
@ -731,10 +731,10 @@ void FlyingVehicle::updateEmitter(bool active,F32 dt,ParticleEmitterData *emitte
}
}
else {
for (S32 j = idx; j < idx + count; j++)
if (bool(mJetEmitter[j])) {
mJetEmitter[j]->deleteWhenEmpty();
mJetEmitter[j] = 0;
for (S32 k = idx; k < idx + count; k++)
if (bool(mJetEmitter[k])) {
mJetEmitter[k]->deleteWhenEmpty();
mJetEmitter[k] = 0;
}
}
}

View file

@ -362,14 +362,14 @@ void HoverVehicleData::packData(BitStream* stream)
for (S32 i = 0; i < MaxSounds; i++)
if (stream->writeFlag(sound[i]))
stream->writeRangedU32(packed? SimObjectId((uintptr_t)sound[i]):
stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)sound[i]):
sound[i]->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast);
for (S32 j = 0; j < MaxJetEmitters; j++)
{
if (stream->writeFlag(jetEmitter[j]))
{
SimObjectId writtenId = packed ? SimObjectId((uintptr_t)jetEmitter[j]) : jetEmitter[j]->getId();
SimObjectId writtenId = mPacked ? SimObjectId((uintptr_t)jetEmitter[j]) : jetEmitter[j]->getId();
stream->writeRangedU32(writtenId, DataBlockObjectIdFirst,DataBlockObjectIdLast);
}
}
@ -965,10 +965,10 @@ void HoverVehicle::updateEmitter(bool active,F32 dt,ParticleEmitterData *emitter
}
}
else {
for (S32 j = idx; j < idx + count; j++)
if (bool(mJetEmitter[j])) {
mJetEmitter[j]->deleteWhenEmpty();
mJetEmitter[j] = 0;
for (S32 k = idx; k < idx + count; k++)
if (bool(mJetEmitter[k])) {
mJetEmitter[k]->deleteWhenEmpty();
mJetEmitter[k] = 0;
}
}
}

View file

@ -277,7 +277,7 @@ void VehicleData::packData(BitStream* stream)
stream->write(body.friction);
for (i = 0; i < Body::MaxSounds; i++)
if (stream->writeFlag(body.sound[i]))
stream->writeRangedU32(packed? SimObjectId((uintptr_t)body.sound[i]):
stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)body.sound[i]):
body.sound[i]->getId(),DataBlockObjectIdFirst,
DataBlockObjectIdLast);
@ -1364,7 +1364,7 @@ bool Vehicle::updateCollision(F32 dt)
mCollisionList.clear();
CollisionState *state = mConvex.findClosestState(cmat, getScale(), mDataBlock->collisionTol);
if (state && state->dist <= mDataBlock->collisionTol)
if (state && state->mDist <= mDataBlock->collisionTol)
{
//resolveDisplacement(ns,state,dt);
mConvex.getCollisionInfo(cmat, getScale(), &mCollisionList, mDataBlock->collisionTol);
@ -1497,8 +1497,8 @@ bool Vehicle::resolveDisplacement(Rigid& ns,CollisionState *state, F32 dt)
{
PROFILE_SCOPE( Vehicle_ResolveDisplacement );
SceneObject* obj = (state->a->getObject() == this)?
state->b->getObject(): state->a->getObject();
SceneObject* obj = (state->mA->getObject() == this)?
state->mB->getObject(): state->mA->getObject();
if (obj->isDisplacable() && ((obj->getTypeMask() & ShapeBaseObjectType) != 0))
{

View file

@ -111,7 +111,7 @@ bool WheeledVehicleTire::preload(bool server, String &errorStr)
// Determinw wheel radius from the shape's bounding box.
// The tire should be built with it's hub axis along the
// object's Y axis.
radius = shape->bounds.len_z() / 2;
radius = shape->mBounds.len_z() / 2;
}
return true;
@ -400,7 +400,7 @@ bool WheeledVehicleData::preload(bool server, String &errorStr)
MatrixF imat(1);
SphereF sphere;
sphere.center = mShape->center;
sphere.radius = mShape->radius;
sphere.radius = mShape->mRadius;
PlaneExtractorPolyList polyList;
polyList.mPlaneList = &rigidBody.mPlaneList;
polyList.setTransform(&imat, Point3F(1,1,1));
@ -477,7 +477,7 @@ void WheeledVehicleData::packData(BitStream* stream)
Parent::packData(stream);
if (stream->writeFlag(tireEmitter))
stream->writeRangedU32(packed? SimObjectId((uintptr_t)tireEmitter):
stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)tireEmitter):
tireEmitter->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast);
for (S32 i = 0; i < MaxSounds; i++)

View file

@ -99,11 +99,11 @@ afxCamera::afxCamera()
{
mNetFlags.clear(Ghostable);
mTypeMask |= CameraObjectType;
delta.pos = Point3F(0,0,100);
delta.rot = Point3F(0,0,0);
delta.posVec = delta.rotVec = VectorF(0,0,0);
mObjToWorld.setColumn(3,delta.pos);
mRot = delta.rot;
mDelta.pos = Point3F(0,0,100);
mDelta.rot = Point3F(0,0,0);
mDelta.posVec = mDelta.rotVec = VectorF(0,0,0);
mObjToWorld.setColumn(3, mDelta.pos);
mRot = mDelta.rot;
mMinOrbitDist = 0;
mMaxOrbitDist = 0;
@ -111,19 +111,19 @@ afxCamera::afxCamera()
mOrbitObject = NULL;
mPosition.set(0.f, 0.f, 0.f);
mObservingClientObject = false;
mode = FlyMode;
mMode = FlyMode;
cam_subject = NULL;
coi_offset.set(0, 0, 2);
cam_offset.set(0, 0, 0);
cam_distance = 0.0f;
cam_angle = 0.0f;
cam_dirty = false;
mCam_subject = NULL;
mCoi_offset.set(0, 0, 2);
mCam_offset.set(0, 0, 0);
mCam_distance = 0.0f;
mCam_angle = 0.0f;
mCam_dirty = false;
flymode_saved = false;
third_person_snap_s = 1;
third_person_snap_c = 1;
flymode_saved_pos.zero();
mFlymode_saved = false;
mThird_person_snap_s = 1;
mThird_person_snap_c = 1;
mFlymode_saved_pos.zero();
mDamageState = Disabled;
}
@ -136,7 +136,7 @@ afxCamera::~afxCamera()
void afxCamera::cam_update(F32 dt, bool on_server)
{
if (mode == ThirdPersonMode && cam_subject)
if (mMode == ThirdPersonMode && mCam_subject)
cam_update_3pov(dt, on_server);
}
@ -176,9 +176,9 @@ Point3F &afxCamera::getPosition()
//----------------------------------------------------------------------------
void afxCamera::setFlyMode()
{
mode = FlyMode;
if (flymode_saved)
snapToPosition(flymode_saved_pos);
mMode = FlyMode;
if (mFlymode_saved)
snapToPosition(mFlymode_saved_pos);
if (bool(mOrbitObject))
{
@ -202,11 +202,11 @@ void afxCamera::setOrbitMode(GameBase *obj, Point3F &pos, AngAxisF &rot, F32 min
processAfter(mOrbitObject);
deleteNotify(mOrbitObject);
mOrbitObject->getWorldBox().getCenter(&mPosition);
mode = OrbitObjectMode;
mMode = OrbitObjectMode;
}
else
{
mode = OrbitPointMode;
mMode = OrbitPointMode;
mPosition = pos;
}
@ -278,14 +278,14 @@ void afxCamera::snapToPosition(const Point3F& tPos)
{
MatrixF transMat;
if (cam_subject)
if (mCam_subject)
{
// get the subject's transform
MatrixF objToWorld = cam_subject->getRenderTransform();
MatrixF objToWorld = mCam_subject->getRenderTransform();
// transform the center-of-interest to world-space
Point3F objPos;
objToWorld.mulP(coi_offset, &objPos);
objToWorld.mulP(mCoi_offset, &objPos);
// find normalized direction vector looking from camera to coi
VectorF dirVec = objPos - tPos;
@ -308,31 +308,31 @@ void afxCamera::snapToPosition(const Point3F& tPos)
void afxCamera::setCameraSubject(SceneObject* new_subject)
{
// cleanup any existing chase subject
if (cam_subject)
if (mCam_subject)
{
if (dynamic_cast<GameBase*>(cam_subject))
if (dynamic_cast<GameBase*>(mCam_subject))
clearProcessAfter();
clearNotify(cam_subject);
clearNotify(mCam_subject);
}
cam_subject = new_subject;
mCam_subject = new_subject;
// set associations with new chase subject
if (cam_subject)
if (mCam_subject)
{
if (dynamic_cast<GameBase*>(cam_subject))
processAfter((GameBase*)cam_subject);
deleteNotify(cam_subject);
if (dynamic_cast<GameBase*>(mCam_subject))
processAfter((GameBase*)mCam_subject);
deleteNotify(mCam_subject);
}
mode = (cam_subject) ? ThirdPersonMode : FlyMode;
mMode = (mCam_subject) ? ThirdPersonMode : FlyMode;
setMaskBits(SubjectMask);
}
void afxCamera::setThirdPersonOffset(const Point3F& offset)
{
// new method
if (cam_distance > 0.0f)
if (mCam_distance > 0.0f)
{
if (isClientObject())
{
@ -342,25 +342,25 @@ void afxCamera::setThirdPersonOffset(const Point3F& offset)
// this auto switches to/from first person
if (conn->isFirstPerson())
{
if (cam_distance >= 1.0f)
if (mCam_distance >= 1.0f)
conn->setFirstPerson(false);
}
else
{
if (cam_distance < 1.0f)
if (mCam_distance < 1.0f)
conn->setFirstPerson(true);
}
}
}
cam_offset = offset;
cam_dirty = true;
mCam_offset = offset;
mCam_dirty = true;
return;
}
// old backwards-compatible method
if (offset.y != cam_offset.y && isClientObject())
if (offset.y != mCam_offset.y && isClientObject())
{
GameConnection* conn = GameConnection::getConnectionToServer();
if (conn)
@ -379,62 +379,62 @@ void afxCamera::setThirdPersonOffset(const Point3F& offset)
}
}
cam_offset = offset;
cam_dirty = true;
mCam_offset = offset;
mCam_dirty = true;
}
void afxCamera::setThirdPersonOffset(const Point3F& offset, const Point3F& coi_offset)
{
this->coi_offset = coi_offset;
mCoi_offset = coi_offset;
setThirdPersonOffset(offset);
}
void afxCamera::setThirdPersonDistance(F32 distance)
{
cam_distance = distance;
cam_dirty = true;
mCam_distance = distance;
mCam_dirty = true;
}
F32 afxCamera::getThirdPersonDistance()
{
return cam_distance;
return mCam_distance;
}
void afxCamera::setThirdPersonAngle(F32 angle)
{
cam_angle = angle;
cam_dirty = true;
mCam_angle = angle;
mCam_dirty = true;
}
F32 afxCamera::getThirdPersonAngle()
{
return cam_angle;
return mCam_angle;
}
void afxCamera::setThirdPersonMode()
{
mode = ThirdPersonMode;
flymode_saved_pos = getPosition();
flymode_saved = true;
cam_dirty = true;
third_person_snap_s++;
mMode = ThirdPersonMode;
mFlymode_saved_pos = getPosition();
mFlymode_saved = true;
mCam_dirty = true;
mThird_person_snap_s++;
}
void afxCamera::setThirdPersonSnap()
{
if (mode == ThirdPersonMode)
third_person_snap_s += 2;
if (mMode == ThirdPersonMode)
mThird_person_snap_s += 2;
}
void afxCamera::setThirdPersonSnapClient()
{
if (mode == ThirdPersonMode)
third_person_snap_c++;
if (mMode == ThirdPersonMode)
mThird_person_snap_c++;
}
const char* afxCamera::getMode()
{
switch (mode)
switch (mMode)
{
case ThirdPersonMode:
return "ThirdPerson";
@ -450,8 +450,6 @@ const char* afxCamera::getMode()
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// Console Methods
static char buffer[100];
ConsoleMethod(afxCamera, setOrbitMode, void, 7, 8,
"(GameBase orbitObject, TransformF mat, float minDistance, float maxDistance, float curDistance, bool ownClientObject)"
"Set the camera to orbit around some given object.\n\n"
@ -493,6 +491,7 @@ ConsoleMethod( afxCamera, getPosition, const char *, 2, 2, "()"
"@returns A string of form \"x y z\".")
{
Point3F& pos = object->getPosition();
char buffer[100];
dSprintf(buffer, sizeof(buffer),"%f %f %f",pos.x,pos.y,pos.z);
return buffer;
}
@ -558,6 +557,7 @@ ConsoleMethod(afxCamera, setThirdPersonOffset, void, 3, 4, "(Point3F offset [, P
ConsoleMethod(afxCamera, getThirdPersonOffset, const char *, 2, 2, "()")
{
const Point3F& pos = object->getThirdPersonOffset();
char buffer[100];
dSprintf(buffer, sizeof(buffer),"%f %f %f",pos.x,pos.y,pos.z);
return buffer;
}
@ -565,6 +565,7 @@ ConsoleMethod(afxCamera, getThirdPersonOffset, const char *, 2, 2, "()")
ConsoleMethod(afxCamera, getThirdPersonCOIOffset, const char *, 2, 2, "()")
{
const Point3F& pos = object->getThirdPersonCOIOffset();
char buffer[100];
dSprintf(buffer, sizeof(buffer),"%f %f %f",pos.x,pos.y,pos.z);
return buffer;
}
@ -592,17 +593,17 @@ void afxCamera::cam_update_3pov(F32 dt, bool on_server)
{
Point3F goal_pos;
Point3F curr_pos = getRenderPosition();
MatrixF xfm = cam_subject->getRenderTransform();
Point3F coi = cam_subject->getRenderPosition() + coi_offset;
MatrixF xfm = mCam_subject->getRenderTransform();
Point3F coi = mCam_subject->getRenderPosition() + mCoi_offset;
// for player subjects, pitch is adjusted
Player* player_subj = dynamic_cast<Player*>(cam_subject);
Player* player_subj = dynamic_cast<Player*>(mCam_subject);
if (player_subj)
{
if (cam_distance > 0.0f)
if (mCam_distance > 0.0f)
{
// rotate xfm by amount of cam_angle
F32 look_yaw = player_subj->getHeadRotation().z + mDegToRad(-cam_angle);
F32 look_yaw = player_subj->getHeadRotation().z + mDegToRad(-mCam_angle);
MatrixF look_yaw_mtx(EulerF(0,0,look_yaw));
xfm.mul(look_yaw_mtx);
@ -611,9 +612,9 @@ void afxCamera::cam_update_3pov(F32 dt, bool on_server)
MatrixF head_pitch_mtx(EulerF(head_pitch,0,0));
xfm.mul(head_pitch_mtx);
VectorF behind_vec(0, -cam_distance, 0);
VectorF behind_vec(0, -mCam_distance, 0);
xfm.mulP(behind_vec, &goal_pos);
goal_pos += cam_offset;
goal_pos += mCam_offset;
}
else // old backwards-compatible method
{
@ -622,15 +623,15 @@ void afxCamera::cam_update_3pov(F32 dt, bool on_server)
MatrixF head_pitch_mtx(EulerF(head_pitch,0,0));
xfm.mul(head_pitch_mtx);
VectorF behind_vec(0, cam_offset.y, 0);
VectorF behind_vec(0, mCam_offset.y, 0);
xfm.mulP(behind_vec, &goal_pos);
goal_pos.z += cam_offset.z;
goal_pos.z += mCam_offset.z;
}
}
// for non-player subjects, camera will follow, but pitch won't adjust.
else
{
xfm.mulP(cam_offset, &goal_pos);
xfm.mulP(mCam_offset, &goal_pos);
}
// avoid view occlusion
@ -638,7 +639,7 @@ void afxCamera::cam_update_3pov(F32 dt, bool on_server)
{
// snap to final position if path to goal is blocked
if (test_blocked_line(curr_pos, goal_pos))
third_person_snap_c++;
mThird_person_snap_c++;
}
// place camera into its final position
@ -652,11 +653,11 @@ void afxCamera::cam_update_3pov(F32 dt, bool on_server)
F32 time_inc = 1.0f/speed_factor;
// snap to final position
if (on_server || (third_person_snap_c > 0 || dt > time_inc))
if (on_server || (mThird_person_snap_c > 0 || dt > time_inc))
{
snapToPosition(goal_pos);
if (!on_server && third_person_snap_c > 0)
third_person_snap_c--;
if (!on_server && mThird_person_snap_c > 0)
mThird_person_snap_c--;
return;
}
// interpolate to final position
@ -731,13 +732,13 @@ void afxCamera::onDeleteNotify(SimObject *obj)
if (obj == (SimObject*)mOrbitObject)
{
mOrbitObject = NULL;
if (mode == OrbitObjectMode)
mode = OrbitPointMode;
if (mMode == OrbitObjectMode)
mMode = OrbitPointMode;
}
if (obj == cam_subject)
if (obj == mCam_subject)
{
cam_subject = NULL;
mCam_subject = NULL;
}
}
@ -747,12 +748,12 @@ void afxCamera::advanceTime(F32 dt)
if (gSFX3DWorld)
{
if (mode == ThirdPersonMode && cam_subject)
if (mMode == ThirdPersonMode && mCam_subject)
{
if (gSFX3DWorld->getListener() != cam_subject)
gSFX3DWorld->setListener(cam_subject);
if (gSFX3DWorld->getListener() != mCam_subject)
gSFX3DWorld->setListener(mCam_subject);
}
else if (mode == FlyMode)
else if (mMode == FlyMode)
{
if (gSFX3DWorld->getListener() != this)
gSFX3DWorld->setListener(this);
@ -771,15 +772,15 @@ void afxCamera::processTick(const Move* move)
if (move)
{
// UPDATE ORIENTATION //
delta.rotVec = mRot;
mObjToWorld.getColumn(3, &delta.posVec);
mDelta.rotVec = mRot;
mObjToWorld.getColumn(3, &mDelta.posVec);
mRot.x = mClampF(mRot.x + move->pitch, -MaxPitch, MaxPitch);
mRot.z += move->yaw;
// ORBIT MODE //
if (mode == OrbitObjectMode || mode == OrbitPointMode)
if (mMode == OrbitObjectMode || mMode == OrbitPointMode)
{
if(mode == OrbitObjectMode && bool(mOrbitObject))
if(mMode == OrbitObjectMode && bool(mOrbitObject))
{
// If this is a shapebase, use its render eye transform
// to avoid jittering.
@ -822,10 +823,10 @@ void afxCamera::processTick(const Move* move)
// If on the client, calc delta for backstepping
if (isClientObject())
{
delta.pos = pos;
delta.rot = mRot;
delta.posVec = delta.posVec - delta.pos;
delta.rotVec = delta.rotVec - delta.rot;
mDelta.pos = pos;
mDelta.rot = mRot;
mDelta.posVec = mDelta.posVec - mDelta.pos;
mDelta.rotVec = mDelta.rotVec - mDelta.rot;
}
else
{
@ -846,14 +847,14 @@ void afxCamera::interpolateTick(F32 dt)
{
Parent::interpolateTick(dt);
if (mode == ThirdPersonMode)
if (mMode == ThirdPersonMode)
return;
Point3F rot = delta.rot + delta.rotVec * dt;
Point3F rot = mDelta.rot + mDelta.rotVec * dt;
if(mode == OrbitObjectMode || mode == OrbitPointMode)
if(mMode == OrbitObjectMode || mMode == OrbitPointMode)
{
if(mode == OrbitObjectMode && bool(mOrbitObject))
if(mMode == OrbitObjectMode && bool(mOrbitObject))
{
// If this is a shapebase, use its render eye transform
// to avoid jittering.
@ -879,7 +880,7 @@ void afxCamera::interpolateTick(F32 dt)
{
// NOTE - posVec is 0,0,0 unless cam is control-object and process tick is
// updating the delta
Point3F pos = delta.pos + delta.posVec * dt;
Point3F pos = mDelta.pos + mDelta.posVec * dt;
set_cam_pos(pos,rot);
}
}
@ -895,19 +896,19 @@ void afxCamera::writePacketData(GameConnection *connection, BitStream *bstream)
bstream->write(mRot.x); // SND X ROT
bstream->write(mRot.z); // SND Z ROT
if (bstream->writeFlag(cam_dirty))
if (bstream->writeFlag(mCam_dirty))
{
mathWrite(*bstream, cam_offset); // SND CAM_OFFSET
mathWrite(*bstream, coi_offset); // SND COI_OFFSET
bstream->write(cam_distance);
bstream->write(cam_angle);
cam_dirty = false;
mathWrite(*bstream, mCam_offset); // SND CAM_OFFSET
mathWrite(*bstream, mCoi_offset); // SND COI_OFFSET
bstream->write(mCam_distance);
bstream->write(mCam_angle);
mCam_dirty = false;
}
U32 writeMode = mode;
U32 writeMode = mMode;
Point3F writePos = mPosition;
S32 gIndex = -1;
if (mode == OrbitObjectMode)
if (mMode == OrbitObjectMode)
{
gIndex = bool(mOrbitObject) ? connection->getGhostIndex(mOrbitObject): -1;
if(gIndex == -1)
@ -920,9 +921,9 @@ void afxCamera::writePacketData(GameConnection *connection, BitStream *bstream)
bstream->writeRangedU32(writeMode, CameraFirstMode, CameraLastMode); // SND MODE
if (writeMode == ThirdPersonMode)
{
bstream->write(third_person_snap_s > 0); // SND SNAP
if (third_person_snap_s > 0)
third_person_snap_s--;
bstream->write(mThird_person_snap_s > 0); // SND SNAP
if (mThird_person_snap_s > 0)
mThird_person_snap_s--;
}
if (writeMode == OrbitObjectMode || writeMode == OrbitPointMode)
@ -955,34 +956,34 @@ void afxCamera::readPacketData(GameConnection *connection, BitStream *bstream)
Point3F new_cam_offset, new_coi_offset;
mathRead(*bstream, &new_cam_offset); // RCV CAM_OFFSET
mathRead(*bstream, &new_coi_offset); // RCV COI_OFFSET
bstream->read(&cam_distance);
bstream->read(&cam_angle);
bstream->read(&mCam_distance);
bstream->read(&mCam_angle);
setThirdPersonOffset(new_cam_offset, new_coi_offset);
}
GameBase* obj = 0;
mode = bstream->readRangedU32(CameraFirstMode, // RCV MODE
mMode = bstream->readRangedU32(CameraFirstMode, // RCV MODE
CameraLastMode);
if (mode == ThirdPersonMode)
if (mMode == ThirdPersonMode)
{
bool snap; bstream->read(&snap);
if (snap)
third_person_snap_c++;
mThird_person_snap_c++;
}
mObservingClientObject = false;
if (mode == OrbitObjectMode || mode == OrbitPointMode) {
if (mMode == OrbitObjectMode || mMode == OrbitPointMode) {
bstream->read(&mMinOrbitDist);
bstream->read(&mMaxOrbitDist);
bstream->read(&mCurOrbitDist);
if(mode == OrbitObjectMode)
if(mMode == OrbitObjectMode)
{
mObservingClientObject = bstream->readFlag();
S32 gIndex = bstream->readInt(NetConnection::GhostIdBitSize);
obj = static_cast<GameBase*>(connection->resolveGhost(gIndex));
}
if (mode == OrbitPointMode)
if (mMode == OrbitPointMode)
bstream->readCompressedPoint(&mPosition);
}
if (obj != (GameBase*)mOrbitObject) {
@ -997,14 +998,14 @@ void afxCamera::readPacketData(GameConnection *connection, BitStream *bstream)
}
}
if (mode == ThirdPersonMode)
if (mMode == ThirdPersonMode)
return;
set_cam_pos(pos,rot);
delta.pos = pos;
delta.rot = rot;
delta.rotVec.set(0,0,0);
delta.posVec.set(0,0,0);
mDelta.pos = pos;
mDelta.rot = rot;
mDelta.rotVec.set(0,0,0);
mDelta.posVec.set(0,0,0);
}
U32 afxCamera::packUpdate(NetConnection* conn, U32 mask, BitStream *bstream)
@ -1028,10 +1029,10 @@ U32 afxCamera::packUpdate(NetConnection* conn, U32 mask, BitStream *bstream)
if (bstream->writeFlag(mask & SubjectMask))
{
S32 ghost_id = (cam_subject) ? conn->getGhostIndex(cam_subject) : -1;
S32 ghost_id = (mCam_subject) ? conn->getGhostIndex(mCam_subject) : -1;
if (bstream->writeFlag(ghost_id != -1))
bstream->writeRangedU32(U32(ghost_id), 0, NetConnection::MaxGhostCount);
else if (cam_subject)
else if (mCam_subject)
retMask |= SubjectMask;
}
@ -1056,9 +1057,9 @@ void afxCamera::unpackUpdate(NetConnection *conn, BitStream *bstream)
set_cam_pos(pos,rot);
// New delta for client side interpolation
delta.pos = pos;
delta.rot = rot;
delta.posVec = delta.rotVec = VectorF(0,0,0);
mDelta.pos = pos;
mDelta.rot = rot;
mDelta.posVec = mDelta.rotVec = VectorF(0,0,0);
}
if (bstream->readFlag())
@ -1066,18 +1067,18 @@ void afxCamera::unpackUpdate(NetConnection *conn, BitStream *bstream)
if (bstream->readFlag())
{
S32 ghost_id = bstream->readRangedU32(0, NetConnection::MaxGhostCount);
cam_subject = dynamic_cast<GameBase*>(conn->resolveGhost(ghost_id));
mCam_subject = dynamic_cast<GameBase*>(conn->resolveGhost(ghost_id));
}
else
cam_subject = NULL;
mCam_subject = NULL;
}
}
// Override to ensure both are kept in scope
void afxCamera::onCameraScopeQuery(NetConnection* conn, CameraScopeQuery* query)
{
if (cam_subject)
conn->objectInScope(cam_subject);
if (mCam_subject)
conn->objectInScope(mCam_subject);
Parent::onCameraScopeQuery(conn, query);
}
@ -1155,7 +1156,7 @@ void afxCamera::setCameraFov(F32 fov)
F32 afxCamera::getDamageFlash() const
{
if (mode == OrbitObjectMode && isServerObject() && bool(mOrbitObject))
if (mMode == OrbitObjectMode && isServerObject() && bool(mOrbitObject))
{
const GameBase *castObj = mOrbitObject;
const ShapeBase* psb = dynamic_cast<const ShapeBase*>(castObj);
@ -1168,7 +1169,7 @@ F32 afxCamera::getDamageFlash() const
F32 afxCamera::getWhiteOut() const
{
if (mode == OrbitObjectMode && isServerObject() && bool(mOrbitObject))
if (mMode == OrbitObjectMode && isServerObject() && bool(mOrbitObject))
{
const GameBase *castObj = mOrbitObject;
const ShapeBase* psb = dynamic_cast<const ShapeBase*>(castObj);

View file

@ -88,9 +88,9 @@ class afxCamera: public ShapeBase
};
private:
int mode;
int mMode;
Point3F mRot;
StateDelta delta;
StateDelta mDelta;
SimObjectPtr<GameBase> mOrbitObject;
F32 mMinOrbitDist;
@ -99,17 +99,17 @@ private:
Point3F mPosition;
bool mObservingClientObject;
SceneObject* cam_subject;
Point3F cam_offset;
Point3F coi_offset;
F32 cam_distance;
F32 cam_angle;
bool cam_dirty;
SceneObject* mCam_subject;
Point3F mCam_offset;
Point3F mCoi_offset;
F32 mCam_distance;
F32 mCam_angle;
bool mCam_dirty;
bool flymode_saved;
Point3F flymode_saved_pos;
S8 third_person_snap_c;
S8 third_person_snap_s;
bool mFlymode_saved;
Point3F mFlymode_saved_pos;
S8 mThird_person_snap_c;
S8 mThird_person_snap_s;
void set_cam_pos(const Point3F& pos, const Point3F& viewRot);
void cam_update(F32 dt, bool on_server);
@ -130,8 +130,8 @@ public:
void setCameraSubject(SceneObject* subject);
void setThirdPersonOffset(const Point3F& offset);
void setThirdPersonOffset(const Point3F& offset, const Point3F& coi_offset);
const Point3F& getThirdPersonOffset() const { return cam_offset; }
const Point3F& getThirdPersonCOIOffset() const { return coi_offset; }
const Point3F& getThirdPersonOffset() const { return mCam_offset; }
const Point3F& getThirdPersonCOIOffset() const { return mCoi_offset; }
void setThirdPersonDistance(F32 distance);
F32 getThirdPersonDistance();
void setThirdPersonAngle(F32 angle);
@ -147,7 +147,7 @@ public:
DECLARE_CATEGORY("AFX");
private: // 3POV SECTION
U32 blockers_mask_3pov;
U32 mBlockers_mask_3pov;
void cam_update_3pov(F32 dt, bool on_server);
bool avoid_blocked_view(const Point3F& start, const Point3F& end, Point3F& newpos);

View file

@ -142,7 +142,7 @@ afxChoreographer::afxChoreographer()
lod = 0;
exec_conds_mask = 0;
choreographer_id = 0;
extra = 0;
mExtra = 0;
started_with_newop = false;
postpone_activation = false;
remapped_cons_sent = false; // CONSTRAINT REMAPPING
@ -179,7 +179,7 @@ afxChoreographer::~afxChoreographer()
void afxChoreographer::initPersistFields()
{
// conditionals
addField("extra", TYPEID<SimObject>(), Offset(extra, afxChoreographer),
addField("extra", TYPEID<SimObject>(), Offset(mExtra, afxChoreographer),
"...");
addField("postponeActivation", TypeBool, Offset(postpone_activation, afxChoreographer),
"...");
@ -331,9 +331,9 @@ void afxChoreographer::unpack_constraint_info(NetConnection* conn, BitStream* st
{
if (stream->readFlag())
{
U16 scope_id = stream->readInt(NetObject::SCOPE_ID_BITS);
mScope_id = stream->readInt(NetObject::SCOPE_ID_BITS);
bool is_shape = stream->readFlag();
addObjectConstraint(scope_id, cons_name, is_shape);
addObjectConstraint(mScope_id, cons_name, is_shape);
}
}
}

View file

@ -121,7 +121,7 @@ protected:
U8 ranking;
U8 lod;
U32 exec_conds_mask;
SimObject* extra;
SimObject* mExtra;
Vector<NetConnection*> explicit_clients;
bool started_with_newop;
bool postpone_activation;
@ -182,7 +182,7 @@ public:
void clearChoreographerId() { choreographer_id = 0; }
U32 getChoreographerId() { return choreographer_id; }
void setGhostConstraintObject(SceneObject*, StringTableEntry cons_name);
void setExtra(SimObject* extra) { this->extra = extra; }
void setExtra(SimObject* extra) { mExtra = extra; }
void addExplicitClient(NetConnection* conn);
void removeExplicitClient(NetConnection* conn);
U32 getExplicitClientCount() { return explicit_clients.size(); }

File diff suppressed because it is too large Load diff

View file

@ -47,17 +47,17 @@ struct afxConstraintDef : public afxEffectDefs
CONS_GHOST
};
DefType def_type;
DefType mDef_type;
StringTableEntry cons_src_name;
StringTableEntry cons_node_name;
F32 history_time;
U8 sample_rate;
StringTableEntry mCons_src_name;
StringTableEntry mCons_node_name;
F32 mHistory_time;
U8 mSample_rate;
bool runs_on_server;
bool runs_on_client;
bool pos_at_box_center;
bool treat_as_camera;
bool mRuns_on_server;
bool mRuns_on_client;
bool mPos_at_box_center;
bool mTreat_as_camera;
/*C*/ afxConstraintDef();
@ -94,30 +94,30 @@ class afxConstraint : public SimObject, public afxEffectDefs
typedef SimObject Parent;
protected:
afxConstraintMgr* mgr;
afxConstraintDef cons_def;
bool is_defined;
bool is_valid;
Point3F last_pos;
MatrixF last_xfm;
F32 history_time;
bool is_alive;
bool gone_missing;
U32 change_code;
afxConstraintMgr* mMgr;
afxConstraintDef mCons_def;
bool mIs_defined;
bool mIs_valid;
Point3F mLast_pos;
MatrixF mLast_xfm;
F32 mHistory_time;
bool mIs_alive;
bool mGone_missing;
U32 mChange_code;
public:
/*C*/ afxConstraint(afxConstraintMgr*);
virtual ~afxConstraint();
virtual bool getPosition(Point3F& pos, F32 hist=0.0f)
{ pos = last_pos; return is_valid; }
{ pos = mLast_pos; return mIs_valid; }
virtual bool getTransform(MatrixF& xfm, F32 hist=0.0f)
{ xfm = last_xfm; return is_valid;}
{ xfm = mLast_xfm; return mIs_valid;}
virtual bool getAltitudes(F32& terrain_alt, F32& interior_alt) { return false; }
virtual bool isDefined() { return is_defined; }
virtual bool isValid() { return is_valid; }
virtual U32 getChangeCode() { return change_code; }
virtual bool isDefined() { return mIs_defined; }
virtual bool isValid() { return mIs_valid; }
virtual U32 getChangeCode() { return mChange_code; }
virtual U32 setAnimClip(const char* clip, F32 pos, F32 rate, F32 trans, bool is_death_anim)
{ return 0; };
@ -127,8 +127,8 @@ public:
virtual F32 getAnimClipDuration(const char* clip) { return 0.0f; }
virtual S32 getDamageState() { return -1; }
virtual void setLivingState(bool state) { is_alive = state; };
virtual bool getLivingState() { return is_alive; };
virtual void setLivingState(bool state) { mIs_alive = state; };
virtual bool getLivingState() { return mIs_alive; };
virtual void sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos)=0;
@ -175,15 +175,15 @@ class afxConstraintMgr : public afxEffectDefs
U32 type;
};
Vector<afxConstraintList*> constraints_v;
Vector<afxConstraintList*> mConstraints_v;
Vector<StringTableEntry> names_on_server;
Vector<S32> ghost_ids;
Vector<preDef> predefs;
U32 starttime;
bool on_server;
bool initialized;
F32 scoping_dist_sq;
Vector<StringTableEntry> mNames_on_server;
Vector<S32> mGhost_ids;
Vector<preDef> mPredefs;
U32 mStartTime;
bool mOn_server;
bool mInitialized;
F32 mScoping_dist_sq;
SceneObject* find_object_from_name(StringTableEntry);
S32 find_cons_idx_from_name(StringTableEntry);
@ -221,7 +221,7 @@ public:
void sample(F32 dt, U32 now, const Point3F* cam_pos=0);
void setStartTime(U32 timestamp) { starttime = timestamp; }
void setStartTime(U32 timestamp) { mStartTime = timestamp; }
void initConstraintDefs(Vector<afxConstraintDef>&, bool on_server, F32 scoping_dist=-1.0f);
void packConstraintNames(NetConnection* conn, BitStream* stream);
void unpackConstraintNames(BitStream* stream);
@ -245,7 +245,7 @@ public:
void restoreScopedObject(SceneObject*, afxChoreographer* ch);
void adjustProcessOrdering(afxChoreographer*);
F32 getScopingDistanceSquared() const { return scoping_dist_sq; }
F32 getScopingDistanceSquared() const { return mScoping_dist_sq; }
};
inline afxConstraintID afxConstraintMgr::setReferencePoint(StringTableEntry which, Point3F point)
@ -270,8 +270,8 @@ class afxPointConstraint : public afxConstraint
typedef afxConstraint Parent;
protected:
Point3F point;
Point3F vector;
Point3F mPoint;
Point3F mVector;
public:
/*C*/ afxPointConstraint(afxConstraintMgr*);
@ -298,7 +298,7 @@ class afxTransformConstraint : public afxConstraint
typedef afxConstraint Parent;
protected:
MatrixF xfm;
MatrixF mXfm;
public:
/*C*/ afxTransformConstraint(afxConstraintMgr*);
@ -329,11 +329,11 @@ class afxShapeConstraint : public afxConstraint
typedef afxConstraint Parent;
protected:
StringTableEntry arb_name;
ShapeBase* shape;
U16 scope_id;
U32 clip_tag;
U32 lock_tag;
StringTableEntry mArb_name;
ShapeBase* mShape;
U16 mScope_id;
U32 mClip_tag;
U32 mLock_tag;
public:
/*C*/ afxShapeConstraint(afxConstraintMgr*);
@ -354,9 +354,9 @@ public:
virtual S32 getDamageState();
virtual SceneObject* getSceneObject() { return shape; }
virtual SceneObject* getSceneObject() { return mShape; }
virtual void restoreObject(SceneObject*);
virtual U16 getScopeId() { return scope_id; }
virtual U16 getScopeId() { return mScope_id; }
virtual U32 getTriggers();
virtual void onDeleteNotify(SimObject*);
@ -373,8 +373,8 @@ class afxShapeNodeConstraint : public afxShapeConstraint
typedef afxShapeConstraint Parent;
protected:
StringTableEntry arb_node;
S32 shape_node_ID;
StringTableEntry mArb_node;
S32 mShape_node_ID;
public:
/*C*/ afxShapeNodeConstraint(afxConstraintMgr*);
@ -385,7 +385,7 @@ public:
virtual void sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos);
virtual void restoreObject(SceneObject*);
S32 getNodeID() const { return shape_node_ID; }
S32 getNodeID() const { return mShape_node_ID; }
virtual void onDeleteNotify(SimObject*);
};
@ -404,10 +404,10 @@ class afxObjectConstraint : public afxConstraint
typedef afxConstraint Parent;
protected:
StringTableEntry arb_name;
SceneObject* obj;
U16 scope_id;
bool is_camera;
StringTableEntry mArb_name;
SceneObject* mObj;
U16 mScope_id;
bool mIs_camera;
public:
afxObjectConstraint(afxConstraintMgr*);
@ -418,9 +418,9 @@ public:
virtual void set_scope_id(U16 scope_id);
virtual void sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos);
virtual SceneObject* getSceneObject() { return obj; }
virtual SceneObject* getSceneObject() { return mObj; }
virtual void restoreObject(SceneObject*);
virtual U16 getScopeId() { return scope_id; }
virtual U16 getScopeId() { return mScope_id; }
virtual U32 getTriggers();
virtual void onDeleteNotify(SimObject*);
@ -441,11 +441,11 @@ class afxEffectConstraint : public afxConstraint
typedef afxConstraint Parent;
protected:
StringTableEntry effect_name;
afxEffectWrapper* effect;
U32 clip_tag;
bool is_death_clip;
U32 lock_tag;
StringTableEntry mEffect_name;
afxEffectWrapper* mEffect;
U32 mClip_tag;
bool mIs_death_clip;
U32 mLock_tag;
public:
/*C*/ afxEffectConstraint(afxConstraintMgr*);
@ -480,8 +480,8 @@ class afxEffectNodeConstraint : public afxEffectConstraint
typedef afxEffectConstraint Parent;
protected:
StringTableEntry effect_node;
S32 effect_node_ID;
StringTableEntry mEffect_node;
S32 mEffect_node_ID;
public:
/*C*/ afxEffectNodeConstraint(afxConstraintMgr*);
@ -492,7 +492,7 @@ public:
virtual void set(afxEffectWrapper* effect);
S32 getNodeID() const { return effect_node_ID; }
S32 getNodeID() const { return mEffect_node_ID; }
};
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
@ -501,13 +501,13 @@ public:
class afxSampleBuffer
{
protected:
U32 buffer_sz;
U32 buffer_ms;
U32 ms_per_sample;
U32 elapsed_ms;
U32 last_sample_ms;
U32 next_sample_num;
U32 n_samples;
U32 mBuffer_sz;
U32 mBuffer_ms;
U32 mMS_per_sample;
U32 mElapsed_ms;
U32 mLast_sample_ms;
U32 mNext_sample_num;
U32 mNum_samples;
virtual void recSample(U32 idx, void* data) = 0;
bool compute_idx_from_lag(F32 lag, U32& idx);
@ -530,7 +530,7 @@ class afxSampleXfmBuffer : public afxSampleBuffer
typedef afxSampleBuffer Parent;
protected:
MatrixF* xfm_buffer;
MatrixF* mXfm_buffer;
virtual void recSample(U32 idx, void* data);
@ -552,7 +552,7 @@ class afxPointHistConstraint : public afxPointConstraint
typedef afxPointConstraint Parent;
protected:
afxSampleBuffer* samples;
afxSampleBuffer* mSamples;
public:
/*C*/ afxPointHistConstraint(afxConstraintMgr*);
@ -575,7 +575,7 @@ class afxTransformHistConstraint : public afxTransformConstraint
typedef afxTransformConstraint Parent;
protected:
afxSampleBuffer* samples;
afxSampleBuffer* mSamples;
public:
/*C*/ afxTransformHistConstraint(afxConstraintMgr*);
@ -598,7 +598,7 @@ class afxShapeHistConstraint : public afxShapeConstraint
typedef afxShapeConstraint Parent;
protected:
afxSampleBuffer* samples;
afxSampleBuffer* mSamples;
public:
/*C*/ afxShapeHistConstraint(afxConstraintMgr*);
@ -625,7 +625,7 @@ class afxShapeNodeHistConstraint : public afxShapeNodeConstraint
typedef afxShapeNodeConstraint Parent;
protected:
afxSampleBuffer* samples;
afxSampleBuffer* mSamples;
public:
/*C*/ afxShapeNodeHistConstraint(afxConstraintMgr*);
@ -654,7 +654,7 @@ class afxObjectHistConstraint : public afxObjectConstraint
typedef afxObjectConstraint Parent;
protected:
afxSampleBuffer* samples;
afxSampleBuffer* mSamples;
public:
afxObjectHistConstraint(afxConstraintMgr*);

View file

@ -184,7 +184,7 @@ void afxEffectGroupData::packData(BitStream* stream)
stream->write(timing.fade_in_time);
stream->write(timing.fade_out_time);
pack_fx(stream, fx_list, packed);
pack_fx(stream, fx_list, mPacked);
}
void afxEffectGroupData::unpackData(BitStream* stream)

View file

@ -38,52 +38,52 @@ void afxEffectVector::filter_client_server()
if (empty())
return;
for (S32 i = 0; i < fx_v->size(); i++)
for (S32 i = 0; i < mFX_v->size(); i++)
{
if ((*fx_v)[i]->datablock->runsHere(on_server))
fx_v2->push_back((*fx_v)[i]);
if ((*mFX_v)[i]->mDatablock->runsHere(mOn_server))
mFX_v2->push_back((*mFX_v)[i]);
else
{
delete (*fx_v)[i];
(*fx_v)[i] = 0;
delete (*mFX_v)[i];
(*mFX_v)[i] = 0;
}
}
swap_vecs();
fx_v2->clear();
mFX_v2->clear();
}
void afxEffectVector::calc_fx_dur_and_afterlife()
{
total_fx_dur = 0.0f;
after_life = 0.0f;
mTotal_fx_dur = 0.0f;
mAfter_life = 0.0f;
if (empty())
return;
for (S32 i = 0; i < fx_v->size(); i++)
for (S32 i = 0; i < mFX_v->size(); i++)
{
afxEffectWrapper* ew = (*fx_v)[i];
afxEffectWrapper* ew = (*mFX_v)[i];
if (ew)
{
F32 ew_dur;
if (ew->ew_timing.lifetime < 0)
if (ew->mEW_timing.lifetime < 0)
{
if (phrase_dur > ew->ew_timing.delay)
ew_dur = phrase_dur + ew->afterStopTime();
if (mPhrase_dur > ew->mEW_timing.delay)
ew_dur = mPhrase_dur + ew->afterStopTime();
else
ew_dur = ew->ew_timing.delay + ew->afterStopTime();
ew_dur = ew->mEW_timing.delay + ew->afterStopTime();
}
else
ew_dur = ew->ew_timing.delay + ew->ew_timing.lifetime + ew->ew_timing.fade_out_time;
ew_dur = ew->mEW_timing.delay + ew->mEW_timing.lifetime + ew->mEW_timing.fade_out_time;
if (ew_dur > total_fx_dur)
total_fx_dur = ew_dur;
if (ew_dur > mTotal_fx_dur)
mTotal_fx_dur = ew_dur;
F32 after = ew->afterStopTime();
if (after > after_life)
after_life = after;
if (after > mAfter_life)
mAfter_life = after;
}
}
}
@ -92,19 +92,19 @@ void afxEffectVector::calc_fx_dur_and_afterlife()
afxEffectVector::afxEffectVector()
{
fx_v = 0;
fx_v2 = 0;
active = false;
on_server = false;
total_fx_dur = 0;
after_life = 0;
mFX_v = 0;
mFX_v2 = 0;
mActive = false;
mOn_server = false;
mTotal_fx_dur = 0;
mAfter_life = 0;
}
afxEffectVector::~afxEffectVector()
{
stop(true);
delete fx_v;
delete fx_v2;
delete mFX_v;
delete mFX_v2;
}
void afxEffectVector::effects_init(afxChoreographer* chor, afxEffectList& effects, bool will_stop, F32 time_factor,
@ -189,7 +189,7 @@ void afxEffectVector::effects_init(afxChoreographer* chor, afxEffectList& effect
afxEffectWrapper* effect;
effect = afxEffectWrapper::ew_create(chor, ewd, cons_mgr, time_factor, group_index);
if (effect)
fx_v->push_back(effect);
mFX_v->push_back(effect);
}
}
else
@ -205,14 +205,14 @@ void afxEffectVector::effects_init(afxChoreographer* chor, afxEffectList& effect
void afxEffectVector::ev_init(afxChoreographer* chor, afxEffectList& effects, bool on_server,
bool will_stop, F32 time_factor, F32 phrase_dur, S32 group_index)
{
this->on_server = on_server;
this->phrase_dur = phrase_dur;
mOn_server = on_server;
mPhrase_dur = phrase_dur;
fx_v = new Vector<afxEffectWrapper*>;
mFX_v = new Vector<afxEffectWrapper*>;
effects_init(chor, effects, will_stop, time_factor, group_index);
fx_v2 = new Vector<afxEffectWrapper*>(fx_v->size());
mFX_v2 = new Vector<afxEffectWrapper*>(mFX_v->size());
}
void afxEffectVector::start(F32 timestamp)
@ -222,8 +222,8 @@ void afxEffectVector::start(F32 timestamp)
// At this point both client and server effects are in the list.
// Timing adjustments are made during prestart().
for (S32 i = 0; i < fx_v->size(); i++)
(*fx_v)[i]->prestart();
for (S32 i = 0; i < mFX_v->size(); i++)
(*mFX_v)[i]->prestart();
// duration and afterlife values are pre-calculated here
calc_fx_dur_and_afterlife();
@ -232,58 +232,58 @@ void afxEffectVector::start(F32 timestamp)
// don't belong here,
filter_client_server();
active = true;
mActive = true;
for (S32 j = 0; j < fx_v->size(); j++)
for (S32 j = 0; j < mFX_v->size(); j++)
{
if ((*fx_v)[j]->start(timestamp))
fx_v2->push_back((*fx_v)[j]);
if ((*mFX_v)[j]->start(timestamp))
mFX_v2->push_back((*mFX_v)[j]);
else
{
delete (*fx_v)[j];
(*fx_v)[j] = 0;
delete (*mFX_v)[j];
(*mFX_v)[j] = 0;
}
}
swap_vecs();
fx_v2->clear();
mFX_v2->clear();
}
void afxEffectVector::update(F32 dt)
{
if (empty())
{
active = false;
mActive = false;
return;
}
for (int i = 0; i < fx_v->size(); i++)
for (int i = 0; i < mFX_v->size(); i++)
{
(*fx_v)[i]->update(dt);
(*mFX_v)[i]->update(dt);
if ((*fx_v)[i]->isDone() || (*fx_v)[i]->isAborted())
if ((*mFX_v)[i]->isDone() || (*mFX_v)[i]->isAborted())
{
// effect has ended, cleanup and delete
(*fx_v)[i]->cleanup();
delete (*fx_v)[i];
(*fx_v)[i] = 0;
(*mFX_v)[i]->cleanup();
delete (*mFX_v)[i];
(*mFX_v)[i] = 0;
}
else
{
// effect is still going, so keep it around
fx_v2->push_back((*fx_v)[i]);
mFX_v2->push_back((*mFX_v)[i]);
}
}
swap_vecs();
fx_v2->clear();
mFX_v2->clear();
if (empty())
{
active = false;
delete fx_v; fx_v =0;
delete fx_v2; fx_v2 = 0;
mActive = false;
delete mFX_v; mFX_v =0;
delete mFX_v2; mFX_v2 = 0;
}
}
@ -291,37 +291,37 @@ void afxEffectVector::stop(bool force_cleanup)
{
if (empty())
{
active = false;
mActive = false;
return;
}
for (int i = 0; i < fx_v->size(); i++)
for (int i = 0; i < mFX_v->size(); i++)
{
(*fx_v)[i]->stop();
(*mFX_v)[i]->stop();
if (force_cleanup || (*fx_v)[i]->deleteWhenStopped())
if (force_cleanup || (*mFX_v)[i]->deleteWhenStopped())
{
// effect is over when stopped, cleanup and delete
(*fx_v)[i]->cleanup();
delete (*fx_v)[i];
(*fx_v)[i] = 0;
(*mFX_v)[i]->cleanup();
delete (*mFX_v)[i];
(*mFX_v)[i] = 0;
}
else
{
// effect needs to fadeout or something, so keep it around
fx_v2->push_back((*fx_v)[i]);
mFX_v2->push_back((*mFX_v)[i]);
}
}
swap_vecs();
fx_v2->clear();
mFX_v2->clear();
if (empty())
{
active = false;
delete fx_v; fx_v =0;
delete fx_v2; fx_v2 = 0;
mActive = false;
delete mFX_v; mFX_v =0;
delete mFX_v2; mFX_v2 = 0;
}
}
@ -329,27 +329,27 @@ void afxEffectVector::interrupt()
{
if (empty())
{
active = false;
mActive = false;
return;
}
for (int i = 0; i < fx_v->size(); i++)
for (int i = 0; i < mFX_v->size(); i++)
{
(*fx_v)[i]->stop();
(*fx_v)[i]->cleanup();
delete (*fx_v)[i];
(*fx_v)[i] = 0;
(*mFX_v)[i]->stop();
(*mFX_v)[i]->cleanup();
delete (*mFX_v)[i];
(*mFX_v)[i] = 0;
}
swap_vecs();
fx_v2->clear();
mFX_v2->clear();
if (empty())
{
active = false;
delete fx_v; fx_v =0;
delete fx_v2; fx_v2 = 0;
mActive = false;
delete mFX_v; mFX_v =0;
delete mFX_v2; mFX_v2 = 0;
}
}

View file

@ -37,14 +37,14 @@ class afxChoreographer;
class afxEffectVector
{
Vector<afxEffectWrapper*>* fx_v;
Vector<afxEffectWrapper*>* fx_v2;
Vector<afxEffectWrapper*>* mFX_v;
Vector<afxEffectWrapper*>* mFX_v2;
bool active;
bool on_server;
F32 phrase_dur;
F32 total_fx_dur;
F32 after_life;
bool mActive;
bool mOn_server;
F32 mPhrase_dur;
F32 mTotal_fx_dur;
F32 mAfter_life;
void swap_vecs();
void filter_client_server();
@ -64,21 +64,21 @@ public:
void update(F32 dt);
void stop(bool force_cleanup=false);
void interrupt();
bool empty() { return (!fx_v || fx_v->empty()); }
bool isActive() { return active; }
S32 count() { return (fx_v) ? fx_v->size() : 0; }
bool empty() { return (!mFX_v || mFX_v->empty()); }
bool isActive() { return mActive; }
S32 count() { return (mFX_v) ? mFX_v->size() : 0; }
F32 getTotalDur() { return total_fx_dur; }
F32 getAfterLife() { return after_life; }
F32 getTotalDur() { return mTotal_fx_dur; }
F32 getAfterLife() { return mAfter_life; }
Vector<afxEffectWrapper*>* getFX() { return fx_v; }
Vector<afxEffectWrapper*>* getFX() { return mFX_v; }
};
inline void afxEffectVector::swap_vecs()
{
Vector<afxEffectWrapper*>* tmp = fx_v;
fx_v = fx_v2;
fx_v2 = tmp;
Vector<afxEffectWrapper*>* tmp = mFX_v;
mFX_v = mFX_v2;
mFX_v2 = tmp;
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//

View file

@ -380,7 +380,7 @@ void afxEffectWrapperData::packData(BitStream* stream)
{
Parent::packData(stream);
writeDatablockID(stream, effect_data, packed);
writeDatablockID(stream, effect_data, mPacked);
stream->writeString(effect_name);
@ -419,7 +419,7 @@ void afxEffectWrapperData::packData(BitStream* stream)
stream->write(scale_factor);
// modifiers
pack_mods(stream, xfm_modifiers, packed);
pack_mods(stream, xfm_modifiers, mPacked);
mathWrite(*stream, forced_bbox);
stream->write(update_forced_bbox);
@ -681,55 +681,55 @@ ConsoleDocClass( afxEffectWrapper,
afxEffectWrapper::afxEffectWrapper()
{
choreographer = 0;
datablock = 0;
cons_mgr = 0;
mChoreographer = 0;
mDatablock = 0;
mCons_mgr = 0;
cond_alive = true;
elapsed = 0;
life_end = 0;
life_elapsed = 0;
stopped = false;
n_updates = 0;
fade_value = 1.0f;
last_fade_value = 0.0f;
fade_in_end = 0.0;
fade_out_start = 0.0f;
in_scope = true;
is_aborted = false;
do_fade_inout = false;
do_fades = false;
full_lifetime = 0;
mCond_alive = true;
mElapsed = 0;
mLife_end = 0;
mLife_elapsed = 0;
mStopped = false;
mNum_updates = 0;
mFade_value = 1.0f;
mLast_fade_value = 0.0f;
mFade_in_end = 0.0;
mFade_out_start = 0.0f;
mIn_scope = true;
mIs_aborted = false;
mDo_fade_inout = false;
mDo_fades = false;
mFull_lifetime = 0;
time_factor = 1.0f;
prop_time_factor = 1.0f;
mTime_factor = 1.0f;
mProp_time_factor = 1.0f;
live_scale_factor = 1.0f;
live_fade_factor = 1.0f;
terrain_altitude = -1.0f;
interior_altitude = -1.0f;
mLive_scale_factor = 1.0f;
mLive_fade_factor = 1.0f;
mTerrain_altitude = -1.0f;
mInterior_altitude = -1.0f;
group_index = 0;
mGroup_index = 0;
dMemset(xfm_modifiers, 0, sizeof(xfm_modifiers));
dMemset(mXfm_modifiers, 0, sizeof(mXfm_modifiers));
}
afxEffectWrapper::~afxEffectWrapper()
{
for (S32 i = 0; i < MAX_XFM_MODIFIERS; i++)
if (xfm_modifiers[i])
delete xfm_modifiers[i];
if (mXfm_modifiers[i])
delete mXfm_modifiers[i];
if (datablock && datablock->effect_name != ST_NULLSTRING)
if (mDatablock && mDatablock->effect_name != ST_NULLSTRING)
{
choreographer->removeNamedEffect(this);
if (datablock->use_as_cons_obj && !effect_cons_id.undefined())
cons_mgr->setReferenceEffect(effect_cons_id, 0);
mChoreographer->removeNamedEffect(this);
if (mDatablock->use_as_cons_obj && !mEffect_cons_id.undefined())
mCons_mgr->setReferenceEffect(mEffect_cons_id, 0);
}
if (datablock && datablock->isTempClone())
delete datablock;
datablock = 0;
if (mDatablock && mDatablock->isTempClone())
delete mDatablock;
mDatablock = 0;
}
#undef myOffset
@ -737,9 +737,9 @@ afxEffectWrapper::~afxEffectWrapper()
void afxEffectWrapper::initPersistFields()
{
addField("liveScaleFactor", TypeF32, myOffset(live_scale_factor),
addField("liveScaleFactor", TypeF32, myOffset(mLive_scale_factor),
"...");
addField("liveFadeFactor", TypeF32, myOffset(live_fade_factor),
addField("liveFadeFactor", TypeF32, myOffset(mLive_fade_factor),
"...");
Parent::initPersistFields();
@ -754,37 +754,37 @@ void afxEffectWrapper::ew_init(afxChoreographer* choreographer,
AssertFatal(datablock != NULL, "Datablock is missing.");
AssertFatal(cons_mgr != NULL, "Constraint manager is missing.");
this->choreographer = choreographer;
this->datablock = datablock;
this->cons_mgr = cons_mgr;
mChoreographer = choreographer;
mDatablock = datablock;
mCons_mgr = cons_mgr;
ea_set_datablock(datablock->effect_data);
ew_timing = datablock->ewd_timing;
if (ew_timing.life_bias != 1.0f)
mEW_timing = datablock->ewd_timing;
if (mEW_timing.life_bias != 1.0f)
{
if (ew_timing.lifetime > 0)
ew_timing.lifetime *= ew_timing.life_bias;
ew_timing.fade_in_time *= ew_timing.life_bias;
ew_timing.fade_out_time *= ew_timing.life_bias;
if (mEW_timing.lifetime > 0)
mEW_timing.lifetime *= mEW_timing.life_bias;
mEW_timing.fade_in_time *= mEW_timing.life_bias;
mEW_timing.fade_out_time *= mEW_timing.life_bias;
}
pos_cons_id = cons_mgr->getConstraintId(datablock->pos_cons_def);
orient_cons_id = cons_mgr->getConstraintId(datablock->orient_cons_def);
aim_cons_id = cons_mgr->getConstraintId(datablock->aim_cons_def);
life_cons_id = cons_mgr->getConstraintId(datablock->life_cons_def);
mPos_cons_id = cons_mgr->getConstraintId(datablock->pos_cons_def);
mOrient_cons_id = cons_mgr->getConstraintId(datablock->orient_cons_def);
mAim_cons_id = cons_mgr->getConstraintId(datablock->aim_cons_def);
mLife_cons_id = cons_mgr->getConstraintId(datablock->life_cons_def);
this->time_factor = (datablock->ignore_time_factor) ? 1.0f : time_factor;
mTime_factor = (datablock->ignore_time_factor) ? 1.0f : time_factor;
if (datablock->propagate_time_factor)
prop_time_factor = time_factor;
mProp_time_factor = time_factor;
if (datablock->runsHere(choreographer->isServerObject()))
{
for (int i = 0; i < MAX_XFM_MODIFIERS && datablock->xfm_modifiers[i] != 0; i++)
{
xfm_modifiers[i] = datablock->xfm_modifiers[i]->create(this, choreographer->isServerObject());
AssertFatal(xfm_modifiers[i] != 0, avar("Error, creation failed for xfm_modifiers[%d] of %s.", i, datablock->getName()));
if (xfm_modifiers[i] == 0)
mXfm_modifiers[i] = datablock->xfm_modifiers[i]->create(this, choreographer->isServerObject());
AssertFatal(mXfm_modifiers[i] != 0, avar("Error, creation failed for xfm_modifiers[%d] of %s.", i, datablock->getName()));
if (mXfm_modifiers[i] == 0)
Con::errorf("Error, creation failed for xfm_modifiers[%d] of %s.", i, datablock->getName());
}
}
@ -795,9 +795,9 @@ void afxEffectWrapper::ew_init(afxChoreographer* choreographer,
choreographer->addNamedEffect(this);
if (datablock->use_as_cons_obj)
{
effect_cons_id = cons_mgr->setReferenceEffect(datablock->effect_name, this);
if (effect_cons_id.undefined() && datablock->isTempClone() && datablock->runsHere(choreographer->isServerObject()))
effect_cons_id = cons_mgr->createReferenceEffect(datablock->effect_name, this);
mEffect_cons_id = cons_mgr->setReferenceEffect(datablock->effect_name, this);
if (mEffect_cons_id.undefined() && datablock->isTempClone() && datablock->runsHere(choreographer->isServerObject()))
mEffect_cons_id = cons_mgr->createReferenceEffect(datablock->effect_name, this);
}
}
}
@ -805,37 +805,37 @@ void afxEffectWrapper::ew_init(afxChoreographer* choreographer,
void afxEffectWrapper::prestart()
{
// modify timing values by time_factor
if (ew_timing.lifetime > 0)
ew_timing.lifetime *= time_factor;
ew_timing.delay *= time_factor;
ew_timing.fade_in_time *= time_factor;
ew_timing.fade_out_time *= time_factor;
if (mEW_timing.lifetime > 0)
mEW_timing.lifetime *= mTime_factor;
mEW_timing.delay *= mTime_factor;
mEW_timing.fade_in_time *= mTime_factor;
mEW_timing.fade_out_time *= mTime_factor;
if (ew_timing.lifetime < 0)
if (mEW_timing.lifetime < 0)
{
full_lifetime = INFINITE_LIFETIME;
life_end = INFINITE_LIFETIME;
mFull_lifetime = INFINITE_LIFETIME;
mLife_end = INFINITE_LIFETIME;
}
else
{
full_lifetime = ew_timing.lifetime + ew_timing.fade_out_time;
life_end = ew_timing.delay + ew_timing.lifetime;
mFull_lifetime = mEW_timing.lifetime + mEW_timing.fade_out_time;
mLife_end = mEW_timing.delay + mEW_timing.lifetime;
}
if ((ew_timing.fade_in_time + ew_timing.fade_out_time) > 0.0f)
if ((mEW_timing.fade_in_time + mEW_timing.fade_out_time) > 0.0f)
{
fade_in_end = ew_timing.delay + ew_timing.fade_in_time;
if (full_lifetime == INFINITE_LIFETIME)
fade_out_start = INFINITE_LIFETIME;
mFade_in_end = mEW_timing.delay + mEW_timing.fade_in_time;
if (mFull_lifetime == INFINITE_LIFETIME)
mFade_out_start = INFINITE_LIFETIME;
else
fade_out_start = ew_timing.delay + ew_timing.lifetime;
do_fade_inout = true;
mFade_out_start = mEW_timing.delay + mEW_timing.lifetime;
mDo_fade_inout = true;
}
if (!do_fade_inout && datablock->vis_keys != NULL && datablock->vis_keys->numKeys() > 0)
if (!mDo_fade_inout && mDatablock->vis_keys != NULL && mDatablock->vis_keys->numKeys() > 0)
{
//do_fades = true;
fade_out_start = ew_timing.delay + ew_timing.lifetime;
mFade_out_start = mEW_timing.delay + mEW_timing.lifetime;
}
}
@ -843,22 +843,22 @@ bool afxEffectWrapper::start(F32 timestamp)
{
if (!ea_is_enabled())
{
Con::warnf("afxEffectWrapper::start() -- effect type of %s is currently disabled.", datablock->getName());
Con::warnf("afxEffectWrapper::start() -- effect type of %s is currently disabled.", mDatablock->getName());
return false;
}
afxConstraint* life_constraint = getLifeConstraint();
if (life_constraint)
cond_alive = life_constraint->getLivingState();
mCond_alive = life_constraint->getLivingState();
elapsed = timestamp;
mElapsed = timestamp;
for (S32 i = 0; i < MAX_XFM_MODIFIERS; i++)
{
if (!xfm_modifiers[i])
if (!mXfm_modifiers[i])
break;
else
xfm_modifiers[i]->start(timestamp);
mXfm_modifiers[i]->start(timestamp);
}
if (!ea_start())
@ -874,109 +874,109 @@ bool afxEffectWrapper::start(F32 timestamp)
bool afxEffectWrapper::test_life_conds()
{
afxConstraint* life_constraint = getLifeConstraint();
if (!life_constraint || datablock->life_conds == 0)
if (!life_constraint || mDatablock->life_conds == 0)
return true;
S32 now_state = life_constraint->getDamageState();
if ((datablock->life_conds & DEAD) != 0 && now_state == ShapeBase::Disabled)
if ((mDatablock->life_conds & DEAD) != 0 && now_state == ShapeBase::Disabled)
return true;
if ((datablock->life_conds & ALIVE) != 0 && now_state == ShapeBase::Enabled)
if ((mDatablock->life_conds & ALIVE) != 0 && now_state == ShapeBase::Enabled)
return true;
if ((datablock->life_conds & DYING) != 0)
return (cond_alive && now_state == ShapeBase::Disabled);
if ((mDatablock->life_conds & DYING) != 0)
return (mCond_alive && now_state == ShapeBase::Disabled);
return false;
}
bool afxEffectWrapper::update(F32 dt)
{
elapsed += dt;
mElapsed += dt;
// life_elapsed won't exceed full_lifetime
life_elapsed = getMin(elapsed - ew_timing.delay, full_lifetime);
mLife_elapsed = getMin(mElapsed - mEW_timing.delay, mFull_lifetime);
// update() returns early if elapsed is outside of active timing range
// (delay <= elapsed <= delay+lifetime)
// note: execution is always allowed beyond this point at least once,
// even if elapsed exceeds the lifetime.
if (elapsed < ew_timing.delay)
if (mElapsed < mEW_timing.delay)
{
setScopeStatus(false);
return false;
}
if (!datablock->requiresStop(ew_timing) && ew_timing.lifetime < 0)
if (!mDatablock->requiresStop(mEW_timing) && mEW_timing.lifetime < 0)
{
F32 afterlife = elapsed - ew_timing.delay;
if (afterlife > 1.0f || ((afterlife > 0.0f) && (n_updates > 0)))
F32 afterlife = mElapsed - mEW_timing.delay;
if (afterlife > 1.0f || ((afterlife > 0.0f) && (mNum_updates > 0)))
{
setScopeStatus(ew_timing.residue_lifetime > 0.0f);
setScopeStatus(mEW_timing.residue_lifetime > 0.0f);
return false;
}
}
else
{
F32 afterlife = elapsed - (full_lifetime + ew_timing.delay);
if (afterlife > 1.0f || ((afterlife > 0.0f) && (n_updates > 0)))
F32 afterlife = mElapsed - (mFull_lifetime + mEW_timing.delay);
if (afterlife > 1.0f || ((afterlife > 0.0f) && (mNum_updates > 0)))
{
setScopeStatus(ew_timing.residue_lifetime > 0.0f);
setScopeStatus(mEW_timing.residue_lifetime > 0.0f);
return false;
}
}
// first time here, test if required conditions for effect are met
if (n_updates == 0)
if (mNum_updates == 0)
{
if (!test_life_conds())
{
elapsed = full_lifetime + ew_timing.delay;
mElapsed = mFull_lifetime + mEW_timing.delay;
setScopeStatus(false);
n_updates++;
mNum_updates++;
return false;
}
}
setScopeStatus(true);
n_updates++;
mNum_updates++;
// calculate current fade value if enabled
if (do_fade_inout)
if (mDo_fade_inout)
{
if (ew_timing.fade_in_time > 0 && elapsed <= fade_in_end)
if (mEW_timing.fade_in_time > 0 && mElapsed <= mFade_in_end)
{
F32 t = mClampF((elapsed-ew_timing.delay)/ew_timing.fade_in_time, 0.0f, 1.0f);
fade_value = afxEase::t(t, ew_timing.fadein_ease.x,ew_timing.fadein_ease.y);
do_fades = true;
F32 t = mClampF((mElapsed - mEW_timing.delay)/ mEW_timing.fade_in_time, 0.0f, 1.0f);
mFade_value = afxEase::t(t, mEW_timing.fadein_ease.x, mEW_timing.fadein_ease.y);
mDo_fades = true;
}
else if (elapsed > fade_out_start)
else if (mElapsed > mFade_out_start)
{
if (ew_timing.fade_out_time == 0)
fade_value = 0.0f;
if (mEW_timing.fade_out_time == 0)
mFade_value = 0.0f;
else
{
F32 t = mClampF(1.0f-(elapsed-fade_out_start)/ew_timing.fade_out_time, 0.0f, 1.0f);
fade_value = afxEase::t(t, ew_timing.fadeout_ease.x,ew_timing.fadeout_ease.y);
F32 t = mClampF(1.0f-(mElapsed - mFade_out_start)/ mEW_timing.fade_out_time, 0.0f, 1.0f);
mFade_value = afxEase::t(t, mEW_timing.fadeout_ease.x, mEW_timing.fadeout_ease.y);
}
do_fades = true;
mDo_fades = true;
}
else
{
fade_value = 1.0f;
do_fades = false;
mFade_value = 1.0f;
mDo_fades = false;
}
}
else
{
fade_value = 1.0;
do_fades = false;
mFade_value = 1.0;
mDo_fades = false;
}
if (datablock->vis_keys && datablock->vis_keys->numKeys() > 0)
if (mDatablock->vis_keys && mDatablock->vis_keys->numKeys() > 0)
{
F32 vis = datablock->vis_keys->evaluate(elapsed-ew_timing.delay);
fade_value *= mClampF(vis, 0.0f, 1.0f);
do_fades = (fade_value < 1.0f);
F32 vis = mDatablock->vis_keys->evaluate(mElapsed - mEW_timing.delay);
mFade_value *= mClampF(vis, 0.0f, 1.0f);
mDo_fades = (mFade_value < 1.0f);
}
// DEAL WITH CONSTRAINTS
@ -990,17 +990,17 @@ bool afxEffectWrapper::update(F32 dt)
afxConstraint* pos_constraint = getPosConstraint();
if (pos_constraint)
{
bool valid = pos_constraint->getPosition(CONS_POS, datablock->pos_cons_def.history_time);
bool valid = pos_constraint->getPosition(CONS_POS, mDatablock->pos_cons_def.mHistory_time);
if (!valid)
getUnconstrainedPosition(CONS_POS);
setScopeStatus(valid);
if (valid && datablock->borrow_altitudes)
if (valid && mDatablock->borrow_altitudes)
{
F32 terr_alt, inter_alt;
if (pos_constraint->getAltitudes(terr_alt, inter_alt))
{
terrain_altitude = terr_alt;
interior_altitude = inter_alt;
mTerrain_altitude = terr_alt;
mInterior_altitude = inter_alt;
}
}
}
@ -1013,7 +1013,7 @@ bool afxEffectWrapper::update(F32 dt)
afxConstraint* orient_constraint = getOrientConstraint();
if (orient_constraint)
{
orient_constraint->getTransform(CONS_XFM, datablock->pos_cons_def.history_time);
orient_constraint->getTransform(CONS_XFM, mDatablock->pos_cons_def.mHistory_time);
}
else
{
@ -1022,11 +1022,11 @@ bool afxEffectWrapper::update(F32 dt)
afxConstraint* aim_constraint = getAimConstraint();
if (aim_constraint)
aim_constraint->getPosition(CONS_AIM, datablock->pos_cons_def.history_time);
aim_constraint->getPosition(CONS_AIM, mDatablock->pos_cons_def.mHistory_time);
else
CONS_AIM.zero();
CONS_SCALE.set(datablock->scale_factor, datablock->scale_factor, datablock->scale_factor);
CONS_SCALE.set(mDatablock->scale_factor, mDatablock->scale_factor, mDatablock->scale_factor);
/*
if (datablock->isPositional() && CONS_POS.isZero() && in_scope)
@ -1035,44 +1035,44 @@ bool afxEffectWrapper::update(F32 dt)
getBaseColor(CONS_COLOR);
params.vis = fade_value;
params.vis = mFade_value;
// apply modifiers
for (int i = 0; i < MAX_XFM_MODIFIERS; i++)
{
if (!xfm_modifiers[i])
if (!mXfm_modifiers[i])
break;
else
xfm_modifiers[i]->updateParams(dt, life_elapsed, params);
mXfm_modifiers[i]->updateParams(dt, mLife_elapsed, params);
}
// final pos/orient is determined
updated_xfm = CONS_XFM;
updated_pos = CONS_POS;
updated_aim = CONS_AIM;
updated_xfm.setPosition(updated_pos);
updated_scale = CONS_SCALE;
updated_color = CONS_COLOR;
mUpdated_xfm = CONS_XFM;
mUpdated_pos = CONS_POS;
mUpdated_aim = CONS_AIM;
mUpdated_xfm.setPosition(mUpdated_pos);
mUpdated_scale = CONS_SCALE;
mUpdated_color = CONS_COLOR;
if (params.vis > 1.0f)
fade_value = 1.0f;
mFade_value = 1.0f;
else
fade_value = params.vis;
mFade_value = params.vis;
if (last_fade_value != fade_value)
if (mLast_fade_value != mFade_value)
{
do_fades = true;
last_fade_value = fade_value;
mDo_fades = true;
mLast_fade_value = mFade_value;
}
else
{
do_fades = (fade_value < 1.0f);
mDo_fades = (mFade_value < 1.0f);
}
if (!ea_update(dt))
{
is_aborted = true;
Con::errorf("afxEffectWrapper::update() -- effect %s ended unexpectedly.", datablock->getName());
mIs_aborted = true;
Con::errorf("afxEffectWrapper::update() -- effect %s ended unexpectedly.", mDatablock->getName());
}
return true;
@ -1080,44 +1080,44 @@ bool afxEffectWrapper::update(F32 dt)
void afxEffectWrapper::stop()
{
if (!datablock->requiresStop(ew_timing))
if (!mDatablock->requiresStop(mEW_timing))
return;
stopped = true;
mStopped = true;
// this resets full_lifetime so it starts to shrink or fade
if (full_lifetime == INFINITE_LIFETIME)
if (mFull_lifetime == INFINITE_LIFETIME)
{
full_lifetime = (elapsed - ew_timing.delay) + afterStopTime();
life_end = elapsed;
if (ew_timing.fade_out_time > 0)
fade_out_start = elapsed;
mFull_lifetime = (mElapsed - mEW_timing.delay) + afterStopTime();
mLife_end = mElapsed;
if (mEW_timing.fade_out_time > 0)
mFade_out_start = mElapsed;
}
}
void afxEffectWrapper::cleanup(bool was_stopped)
{
ea_finish(was_stopped);
if (!effect_cons_id.undefined())
if (!mEffect_cons_id.undefined())
{
cons_mgr->setReferenceEffect(effect_cons_id, 0);
effect_cons_id = afxConstraintID();
mCons_mgr->setReferenceEffect(mEffect_cons_id, 0);
mEffect_cons_id = afxConstraintID();
}
}
void afxEffectWrapper::setScopeStatus(bool in_scope)
{
if (this->in_scope != in_scope)
if (mIn_scope != in_scope)
{
this->in_scope = in_scope;
mIn_scope = in_scope;
ea_set_scope_status(in_scope);
}
}
bool afxEffectWrapper::isDone()
{
if (!datablock->is_looping)
return (elapsed >= (life_end + ew_timing.fade_out_time));
if (!mDatablock->is_looping)
return (mElapsed >= (mLife_end + mEW_timing.fade_out_time));
return false;
}
@ -1136,7 +1136,7 @@ afxEffectWrapper* afxEffectWrapper::ew_create(afxChoreographer* choreograph
if (adapter)
{
adapter->group_index = (datablock->group_index != -1) ? datablock->group_index : group_index;
adapter->mGroup_index = (datablock->group_index != -1) ? datablock->group_index : group_index;
adapter->ew_init(choreographer, datablock, cons_mgr, time_factor);
}

View file

@ -255,59 +255,59 @@ private:
bool test_life_conds();
protected:
afxEffectWrapperData* datablock;
afxEffectWrapperData* mDatablock;
afxEffectTimingData ew_timing;
afxEffectTimingData mEW_timing;
F32 fade_in_end;
F32 fade_out_start;
F32 full_lifetime;
F32 mFade_in_end;
F32 mFade_out_start;
F32 mFull_lifetime;
F32 time_factor;
F32 prop_time_factor;
F32 mTime_factor;
F32 mProp_time_factor;
afxChoreographer* choreographer;
afxConstraintMgr* cons_mgr;
afxChoreographer* mChoreographer;
afxConstraintMgr* mCons_mgr;
afxConstraintID pos_cons_id;
afxConstraintID orient_cons_id;
afxConstraintID aim_cons_id;
afxConstraintID life_cons_id;
afxConstraintID mPos_cons_id;
afxConstraintID mOrient_cons_id;
afxConstraintID mAim_cons_id;
afxConstraintID mLife_cons_id;
afxConstraintID effect_cons_id;
afxConstraintID mEffect_cons_id;
F32 elapsed;
F32 life_elapsed;
F32 life_end;
bool stopped;
bool cond_alive;
F32 mElapsed;
F32 mLife_elapsed;
F32 mLife_end;
bool mStopped;
bool mCond_alive;
U32 n_updates;
U32 mNum_updates;
MatrixF updated_xfm;
Point3F updated_pos;
Point3F updated_aim;
Point3F updated_scale;
LinearColorF updated_color;
MatrixF mUpdated_xfm;
Point3F mUpdated_pos;
Point3F mUpdated_aim;
Point3F mUpdated_scale;
LinearColorF mUpdated_color;
F32 fade_value;
F32 last_fade_value;
F32 mFade_value;
F32 mLast_fade_value;
bool do_fade_inout;
bool do_fades;
bool in_scope;
bool is_aborted;
bool mDo_fade_inout;
bool mDo_fades;
bool mIn_scope;
bool mIs_aborted;
U8 effect_flags;
U8 mEffect_flags;
afxXM_Base* xfm_modifiers[MAX_XFM_MODIFIERS];
afxXM_Base* mXfm_modifiers[MAX_XFM_MODIFIERS];
F32 live_scale_factor;
F32 live_fade_factor;
F32 terrain_altitude;
F32 interior_altitude;
F32 mLive_scale_factor;
F32 mLive_fade_factor;
F32 mTerrain_altitude;
F32 mInterior_altitude;
S32 group_index;
S32 mGroup_index;
public:
/*C*/ afxEffectWrapper();
@ -316,18 +316,18 @@ public:
void ew_init(afxChoreographer*, afxEffectWrapperData*, afxConstraintMgr*,
F32 time_factor);
F32 getFullLifetime() { return ew_timing.lifetime + ew_timing.fade_out_time; }
F32 getTimeFactor() { return time_factor; }
afxConstraint* getPosConstraint() { return cons_mgr->getConstraint(pos_cons_id); }
afxConstraint* getOrientConstraint() { return cons_mgr->getConstraint(orient_cons_id); }
afxConstraint* getAimConstraint() { return cons_mgr->getConstraint(aim_cons_id); }
afxConstraint* getLifeConstraint() { return cons_mgr->getConstraint(life_cons_id); }
afxChoreographer* getChoreographer() { return choreographer; }
F32 getFullLifetime() { return mEW_timing.lifetime + mEW_timing.fade_out_time; }
F32 getTimeFactor() { return mTime_factor; }
afxConstraint* getPosConstraint() { return mCons_mgr->getConstraint(mPos_cons_id); }
afxConstraint* getOrientConstraint() { return mCons_mgr->getConstraint(mOrient_cons_id); }
afxConstraint* getAimConstraint() { return mCons_mgr->getConstraint(mAim_cons_id); }
afxConstraint* getLifeConstraint() { return mCons_mgr->getConstraint(mLife_cons_id); }
afxChoreographer* getChoreographer() { return mChoreographer; }
virtual bool isDone();
virtual bool deleteWhenStopped() { return false; }
F32 afterStopTime() { return ew_timing.fade_out_time; }
bool isAborted() const { return is_aborted; }
F32 afterStopTime() { return mEW_timing.fade_out_time; }
bool isAborted() const { return mIs_aborted; }
void prestart();
bool start(F32 timestamp);
@ -345,11 +345,11 @@ public:
virtual SceneObject* ea_get_scene_object() const { return 0; }
U32 ea_get_triggers() const { return 0; }
void getUpdatedPosition(Point3F& pos) { pos = updated_pos;}
void getUpdatedTransform(MatrixF& xfm) { xfm = updated_xfm; }
void getUpdatedScale(Point3F& scale) { scale = updated_scale; }
void getUpdatedColor(LinearColorF& color) { color = updated_color; }
virtual void getUpdatedBoxCenter(Point3F& pos) { pos = updated_pos;}
void getUpdatedPosition(Point3F& pos) { pos = mUpdated_pos;}
void getUpdatedTransform(MatrixF& xfm) { xfm = mUpdated_xfm; }
void getUpdatedScale(Point3F& scale) { scale = mUpdated_scale; }
void getUpdatedColor(LinearColorF& color) { color = mUpdated_color; }
virtual void getUpdatedBoxCenter(Point3F& pos) { pos = mUpdated_pos;}
virtual void getUnconstrainedPosition(Point3F& pos) { pos.zero();}
virtual void getUnconstrainedTransform(MatrixF& xfm) { xfm.identity(); }
@ -358,9 +358,9 @@ public:
SceneObject* getSceneObject() const { return ea_get_scene_object(); }
U32 getTriggers() const { return ea_get_triggers(); }
F32 getMass() { return datablock->mass; }
Point3F getDirection() { return datablock->direction; }
F32 getSpeed() { return datablock->speed; }
F32 getMass() { return mDatablock->mass; }
Point3F getDirection() { return mDatablock->direction; }
F32 getSpeed() { return mDatablock->speed; }
virtual TSShape* getTSShape() { return 0; }
virtual TSShapeInstance* getTSShapeInstance() { return 0; }
@ -369,14 +369,14 @@ public:
virtual void resetAnimation(U32 tag) { }
virtual F32 getAnimClipDuration(const char* clip) { return 0.0f; }
void setTerrainAltitude(F32 alt) { terrain_altitude = alt; }
void setInteriorAltitude(F32 alt) { interior_altitude = alt; }
void getAltitudes(F32& terr_alt, F32& inter_alt) const { terr_alt = terrain_altitude; inter_alt = interior_altitude; }
void setTerrainAltitude(F32 alt) { mTerrain_altitude = alt; }
void setInteriorAltitude(F32 alt) { mInterior_altitude = alt; }
void getAltitudes(F32& terr_alt, F32& inter_alt) const { terr_alt = mTerrain_altitude; inter_alt = mInterior_altitude; }
void setGroupIndex(S32 idx) { group_index = idx; }
S32 getGroupIndex() const { return group_index; }
void setGroupIndex(S32 idx) { mGroup_index = idx; }
S32 getGroupIndex() const { return mGroup_index; }
bool inScope() const { return in_scope; }
bool inScope() const { return mIn_scope; }
public:
static void initPersistFields();

View file

@ -157,7 +157,7 @@ void afxEffectronData::packData(BitStream* stream)
stream->write(duration);
stream->write(n_loops);
pack_fx(stream, fx_list, packed);
pack_fx(stream, fx_list, mPacked);
}
void afxEffectronData::unpackData(BitStream* stream)
@ -407,9 +407,9 @@ U32 afxEffectron::packUpdate(NetConnection* conn, U32 mask, BitStream* stream)
if (stream->writeFlag(mask & InitialUpdateMask))
{
// pack extra object's ghost index or scope id if not yet ghosted
if (stream->writeFlag(dynamic_cast<NetObject*>(extra) != 0))
if (stream->writeFlag(dynamic_cast<NetObject*>(mExtra) != 0))
{
NetObject* net_extra = (NetObject*)extra;
NetObject* net_extra = (NetObject*)mExtra;
S32 ghost_idx = conn->getGhostIndex(net_extra);
if (stream->writeFlag(ghost_idx != -1))
stream->writeRangedU32(U32(ghost_idx), 0, NetConnection::MaxGhostCount);
@ -476,7 +476,7 @@ void afxEffectron::unpackUpdate(NetConnection * conn, BitStream * stream)
if (stream->readFlag()) // is ghost_idx
{
S32 ghost_idx = stream->readRangedU32(0, NetConnection::MaxGhostCount);
extra = dynamic_cast<SimObject*>(conn->resolveGhost(ghost_idx));
mExtra = dynamic_cast<SimObject*>(conn->resolveGhost(ghost_idx));
}
else
{

View file

@ -532,9 +532,9 @@ bool afxMagicMissileData::preload(bool server, String &errorStr)
Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet, bad datablockId(decal): %d", decalId);
*/
String errorStr;
if( !sfxResolve( &sound, errorStr ) )
Con::errorf(ConsoleLogEntry::General, "afxMagicMissileData::preload: Invalid packet: %s", errorStr.c_str());
String sfxErrorStr;
if( !sfxResolve( &sound, sfxErrorStr) )
Con::errorf(ConsoleLogEntry::General, "afxMagicMissileData::preload: Invalid packet: %s", sfxErrorStr.c_str());
if (!lightDesc && lightDescId != 0)
if (Sim::findObject(lightDescId, lightDesc) == false)
@ -1117,7 +1117,7 @@ bool afxMagicMissile::onAdd()
// Setup our bounding box
if (bool(mDataBlock->projectileShape) == true)
mObjBox = mDataBlock->projectileShape->bounds;
mObjBox = mDataBlock->projectileShape->mBounds;
else
mObjBox = Box3F(Point3F(0, 0, 0), Point3F(0, 0, 0));
resetWorldBox();
@ -1864,7 +1864,7 @@ SceneObject* afxMagicMissile::get_default_launcher() const
if (mDataBlock->reverse_targeting)
{
if (dynamic_cast<afxMagicSpell*>(choreographer))
launch_cons_obj = ((afxMagicSpell*)choreographer)->target;
launch_cons_obj = ((afxMagicSpell*)choreographer)->mTarget;
if (!launch_cons_obj)
{
Con::errorf("afxMagicMissile::get_launch_data(): missing target constraint object for reverse targeted missile.");
@ -1874,7 +1874,7 @@ SceneObject* afxMagicMissile::get_default_launcher() const
else
{
if (dynamic_cast<afxMagicSpell*>(choreographer))
launch_cons_obj = ((afxMagicSpell*)choreographer)->caster;
launch_cons_obj = ((afxMagicSpell*)choreographer)->mCaster;
if (!launch_cons_obj)
{
Con::errorf("afxMagicMissile::get_launch_data(): missing launch constraint object missile.");
@ -2036,17 +2036,17 @@ void afxMagicMissile::launch()
{
if (mDataBlock->reverse_targeting)
{
missile_target = spell->caster;
collide_exempt = spell->target;
missile_target = spell->mCaster;
collide_exempt = spell->mTarget;
}
else
{
missile_target = spell->target;
collide_exempt = spell->caster;
missile_target = spell->mTarget;
collide_exempt = spell->mCaster;
}
if (spell->caster)
processAfter(spell->caster);
if (spell->mCaster)
processAfter(spell->mCaster);
if (missile_target)
deleteNotify(missile_target);
if (collide_exempt)

File diff suppressed because it is too large Load diff

View file

@ -68,36 +68,36 @@ class afxMagicSpellData : public afxChoreographerData, public afxMagicSpellDefs
void validateType(SimObject *object, void *typePtr);
};
bool do_id_convert;
bool mDo_id_convert;
public:
F32 casting_dur;
F32 delivery_dur;
F32 linger_dur;
F32 mCasting_dur;
F32 mDelivery_dur;
F32 mLinger_dur;
//
S32 n_casting_loops;
S32 n_delivery_loops;
S32 n_linger_loops;
S32 mNum_casting_loops;
S32 mNum_delivery_loops;
S32 mNum_linger_loops;
//
F32 extra_casting_time;
F32 extra_delivery_time;
F32 extra_linger_time;
F32 mExtra_casting_time;
F32 mExtra_delivery_time;
F32 mExtra_linger_time;
//
bool do_move_interrupts;
F32 move_interrupt_speed;
bool mDo_move_interrupts;
F32 mMove_interrupt_speed;
//
afxMagicMissileData* missile_db;
bool launch_on_server_signal;
U32 primary_target_types;
afxMagicMissileData* mMissile_db;
bool mLaunch_on_server_signal;
U32 mPrimary_target_types;
//
afxEffectWrapperData* dummy_fx_entry;
afxEffectWrapperData* mDummy_fx_entry;
// various effects lists
afxEffectList casting_fx_list;
afxEffectList launch_fx_list;
afxEffectList delivery_fx_list;
afxEffectList impact_fx_list;
afxEffectList linger_fx_list;
afxEffectList mCasting_fx_list;
afxEffectList mLaunch_fx_list;
afxEffectList mDelivery_fx_list;
afxEffectList mImpact_fx_list;
afxEffectList mLinger_fx_list;
void pack_fx(BitStream* stream, const afxEffectList& fx, bool packed);
void unpack_fx(BitStream* stream, afxEffectList& fx);
@ -222,39 +222,39 @@ private:
static StringTableEntry IMPACTED_OBJECT_CONS;
private:
afxMagicSpellData* datablock;
SimObject* exeblock;
afxMagicMissileData* missile_db;
afxMagicSpellData* mDatablock;
SimObject* mExeblock;
afxMagicMissileData* mMissile_db;
ShapeBase* caster;
SceneObject* target;
SimObject* caster_field;
SimObject* target_field;
ShapeBase* mCaster;
SceneObject* mTarget;
SimObject* mCaster_field;
SimObject* mTarget_field;
U16 caster_scope_id;
U16 target_scope_id;
bool target_is_shape;
U16 mCaster_scope_id;
U16 mTarget_scope_id;
bool mTarget_is_shape;
bool constraints_initialized;
bool scoping_initialized;
bool mConstraints_initialized;
bool mScoping_initialized;
U8 spell_state;
F32 spell_elapsed;
U8 mSpell_state;
F32 mSpell_elapsed;
afxConstraintID listener_cons_id;
afxConstraintID caster_cons_id;
afxConstraintID target_cons_id;
afxConstraintID impacted_cons_id;
afxConstraintID camera_cons_id;
SceneObject* camera_cons_obj;
afxConstraintID mListener_cons_id;
afxConstraintID mCaster_cons_id;
afxConstraintID mTarget_cons_id;
afxConstraintID mImpacted_cons_id;
afxConstraintID mCamera_cons_id;
SceneObject* mCamera_cons_obj;
afxPhrase* phrases[NUM_PHRASES];
F32 tfactors[NUM_PHRASES];
afxPhrase* mPhrases[NUM_PHRASES];
F32 mTfactors[NUM_PHRASES];
bool notify_castbar;
F32 overall_time_factor;
bool mNotify_castbar;
F32 mOverall_time_factor;
U16 marks_mask;
U16 mMarks_mask;
private:
void init();
@ -278,13 +278,13 @@ protected:
virtual void unpack_constraint_info(NetConnection* conn, BitStream* stream);
private:
afxMagicMissile* missile;
bool missile_is_armed;
SceneObject* impacted_obj;
Point3F impact_pos;
Point3F impact_norm;
U16 impacted_scope_id;
bool impacted_is_shape;
afxMagicMissile* mMissile;
bool mMissile_is_armed;
SceneObject* mImpacted_obj;
Point3F mImpact_pos;
Point3F mImpact_norm;
U16 mImpacted_scope_id;
bool mImpacted_is_shape;
void init_missile_s(afxMagicMissileData* mm);
void launch_missile_s();
@ -353,15 +353,15 @@ public:
void postSpellEvent(U8 event);
void resolveTimeFactors();
void setTimeFactor(F32 f) { overall_time_factor = (f > 0) ? f : 1.0f; }
F32 getTimeFactor() { return overall_time_factor; }
void setTimeFactor(U8 phase, F32 f) { tfactors[phase] = (f > 0) ? f : 1.0f; }
F32 getTimeFactor(U8 phase) { return tfactors[phase]; }
void setTimeFactor(F32 f) { mOverall_time_factor = (f > 0) ? f : 1.0f; }
F32 getTimeFactor() { return mOverall_time_factor; }
void setTimeFactor(U8 phase, F32 f) { mTfactors[phase] = (f > 0) ? f : 1.0f; }
F32 getTimeFactor(U8 phase) { return mTfactors[phase]; }
ShapeBase* getCaster() const { return caster; }
SceneObject* getTarget() const { return target; }
afxMagicMissile* getMissile() const { return missile; }
SceneObject* getImpactedObject() const { return impacted_obj; }
ShapeBase* getCaster() const { return mCaster; }
SceneObject* getTarget() const { return mTarget; }
afxMagicMissile* getMissile() const { return mMissile; }
SceneObject* getImpactedObject() const { return mImpacted_obj; }
virtual void restoreObject(SceneObject*);
@ -377,7 +377,7 @@ public:
inline bool afxMagicSpell::is_caster_moving()
{
return (caster) ? (caster->getVelocity().len() > datablock->move_interrupt_speed) : false;
return (mCaster) ? (mCaster->getVelocity().len() > mDatablock->mMove_interrupt_speed) : false;
}
inline bool afxMagicSpell::is_caster_client(ShapeBase* caster, GameConnection* conn)

View file

@ -34,51 +34,51 @@
void
afxPhrase::init_fx(S32 group_index)
{
fx->ev_init(init_chor, *init_fx_list, on_server, will_stop, init_time_factor, init_dur, group_index);
mFX->ev_init(mInit_chor, *mInit_fx_list, mOn_server, mWill_stop, mInit_time_factor, mInit_dur, group_index);
}
//~~~~~~~~~~~~~~~~~~~~//
afxPhrase::afxPhrase(bool on_server, bool will_stop)
{
this->on_server = on_server;
this->will_stop = will_stop;
mOn_server = on_server;
mWill_stop = will_stop;
init_fx_list = NULL;
init_dur = 0.0f;
init_chor = NULL;
init_time_factor = 1.0f;
mInit_fx_list = NULL;
mInit_dur = 0.0f;
mInit_chor = NULL;
mInit_time_factor = 1.0f;
fx = new afxEffectVector;
fx2 = NULL;
starttime = 0;
dur = 0;
mFX = new afxEffectVector;
mFX2 = NULL;
mStartTime = 0;
mDur = 0;
n_loops = 1;
loop_cnt = 1;
mNum_loops = 1;
mLoop_cnt = 1;
extra_time = 0.0f;
extra_stoptime = 0.0f;
mExtra_time = 0.0f;
mExtra_stoptime = 0.0f;
}
afxPhrase::~afxPhrase()
{
delete fx;
delete fx2;
delete mFX;
delete mFX2;
};
void
afxPhrase::init(afxEffectList& fx_list, F32 dur, afxChoreographer* chor, F32 time_factor,
S32 n_loops, S32 group_index, F32 extra_time)
{
init_fx_list = &fx_list;
init_dur = dur;
init_chor = chor;
init_time_factor = time_factor;
mInit_fx_list = &fx_list;
mInit_dur = dur;
mInit_chor = chor;
mInit_time_factor = time_factor;
this->n_loops = n_loops;
this->extra_time = extra_time;
this->dur = (init_dur < 0) ? init_dur : init_dur*init_time_factor;
mNum_loops = n_loops;
mExtra_time = extra_time;
mDur = (mInit_dur < 0) ? mInit_dur : mInit_dur*mInit_time_factor;
init_fx(group_index);
}
@ -86,30 +86,30 @@ afxPhrase::init(afxEffectList& fx_list, F32 dur, afxChoreographer* chor, F32 tim
void
afxPhrase::start(F32 startstamp, F32 timestamp)
{
starttime = startstamp;
mStartTime = startstamp;
F32 loopstart = timestamp - startstamp;
if (dur > 0 && loopstart > dur)
if (mDur > 0 && loopstart > mDur)
{
loop_cnt += (S32) (loopstart/dur);
loopstart = mFmod(loopstart, dur);
mLoop_cnt += (S32) (loopstart/ mDur);
loopstart = mFmod(loopstart, mDur);
}
if (!fx->empty())
fx->start(loopstart);
if (!mFX->empty())
mFX->start(loopstart);
}
void
afxPhrase::update(F32 dt, F32 timestamp)
{
if (fx->isActive())
fx->update(dt);
if (mFX->isActive())
mFX->update(dt);
if (fx2 && fx2->isActive())
fx2->update(dt);
if (mFX2 && mFX2->isActive())
mFX2->update(dt);
if (extra_stoptime > 0 && timestamp > extra_stoptime)
if (mExtra_stoptime > 0 && timestamp > mExtra_stoptime)
{
stop(timestamp);
}
@ -118,54 +118,54 @@ afxPhrase::update(F32 dt, F32 timestamp)
void
afxPhrase::stop(F32 timestamp)
{
if (extra_time > 0 && !(extra_stoptime > 0))
if (mExtra_time > 0 && !(mExtra_stoptime > 0))
{
extra_stoptime = timestamp + extra_time;
mExtra_stoptime = timestamp + mExtra_time;
return;
}
if (fx->isActive())
fx->stop();
if (mFX->isActive())
mFX->stop();
if (fx2 && fx2->isActive())
fx2->stop();
if (mFX2 && mFX2->isActive())
mFX2->stop();
}
bool
afxPhrase::expired(F32 timestamp)
{
if (dur < 0)
if (mDur < 0)
return false;
return ((timestamp - starttime) > loop_cnt*dur);
return ((timestamp - mStartTime) > mLoop_cnt*mDur);
}
F32
afxPhrase::elapsed(F32 timestamp)
{
return (timestamp - starttime);
return (timestamp - mStartTime);
}
bool
afxPhrase::recycle(F32 timestamp)
{
if (n_loops < 0 || loop_cnt < n_loops)
if (mNum_loops < 0 || mLoop_cnt < mNum_loops)
{
if (fx2)
delete fx2;
if (mFX2)
delete mFX2;
fx2 = fx;
mFX2 = mFX;
fx = new afxEffectVector;
mFX = new afxEffectVector;
init_fx();
if (fx2 && !fx2->empty())
fx2->stop();
if (mFX2 && !mFX2->empty())
mFX2->stop();
if (!fx->empty())
fx->start(0.0F);
if (!mFX->empty())
mFX->start(0.0F);
loop_cnt++;
mLoop_cnt++;
return true;
}
@ -175,21 +175,21 @@ afxPhrase::recycle(F32 timestamp)
void
afxPhrase::interrupt(F32 timestamp)
{
if (fx->isActive())
fx->interrupt();
if (mFX->isActive())
mFX->interrupt();
if (fx2 && fx2->isActive())
fx2->interrupt();
if (mFX2 && mFX2->isActive())
mFX2->interrupt();
}
F32 afxPhrase::calcDoneTime()
{
return starttime + fx->getTotalDur();
return mStartTime + mFX->getTotalDur();
}
F32 afxPhrase::calcAfterLife()
{
return fx->getAfterLife();
return mFX->getAfterLife();
}

View file

@ -38,23 +38,23 @@ class afxEffectVector;
class afxPhrase
{
protected:
afxEffectList* init_fx_list;
F32 init_dur;
afxChoreographer* init_chor;
F32 init_time_factor;
F32 extra_time;
afxEffectList* mInit_fx_list;
F32 mInit_dur;
afxChoreographer* mInit_chor;
F32 mInit_time_factor;
F32 mExtra_time;
afxEffectVector* fx;
afxEffectVector* fx2;
afxEffectVector* mFX;
afxEffectVector* mFX2;
bool on_server;
bool will_stop;
bool mOn_server;
bool mWill_stop;
F32 starttime;
F32 dur;
S32 n_loops;
S32 loop_cnt;
F32 extra_stoptime;
F32 mStartTime;
F32 mDur;
S32 mNum_loops;
S32 mLoop_cnt;
F32 mExtra_stoptime;
void init_fx(S32 group_index=0);
@ -73,13 +73,13 @@ public:
virtual bool recycle(F32 timestamp);
virtual F32 elapsed(F32 timestamp);
bool isEmpty() { return fx->empty(); }
bool isInfinite() { return (init_dur < 0); }
bool isEmpty() { return mFX->empty(); }
bool isInfinite() { return (mInit_dur < 0); }
F32 calcDoneTime();
F32 calcAfterLife();
bool willStop() { return will_stop; }
bool onServer() { return on_server; }
S32 count() { return fx->count(); }
bool willStop() { return mWill_stop; }
bool onServer() { return mOn_server; }
S32 count() { return mFX->count(); }
};
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//

View file

@ -230,9 +230,9 @@ void afxSelectronData::packData(BitStream* stream)
stream->write(obj_type_style);
stream->write(obj_type_mask);
pack_fx(stream, main_fx_list, packed);
pack_fx(stream, select_fx_list, packed);
pack_fx(stream, deselect_fx_list, packed);
pack_fx(stream, main_fx_list, mPacked);
pack_fx(stream, select_fx_list, mPacked);
pack_fx(stream, deselect_fx_list, mPacked);
}
void afxSelectronData::unpackData(BitStream* stream)

View file

@ -116,7 +116,7 @@ void afxSpellBookData::packData(BitStream* stream)
stream->write(pages_per_book);
for (S32 i = 0; i < pages_per_book*spells_per_page; i++)
writeDatablockID(stream, rpg_spells[i], packed);
writeDatablockID(stream, rpg_spells[i], mPacked);
}
void afxSpellBookData::unpackData(BitStream* stream)

View file

@ -176,8 +176,8 @@ void afxT3DLightBaseData::packData(BitStream* stream)
stream->write( mAnimState.animationPhase );
stream->write( mFlareScale );
writeDatablockID(stream, mAnimationData, packed);
writeDatablockID(stream, mFlareData, packed);
writeDatablockID(stream, mAnimationData, mPacked);
writeDatablockID(stream, mFlareData, mPacked);
}
void afxT3DLightBaseData::unpackData(BitStream* stream)

View file

@ -397,7 +397,7 @@ bool afxModel::onAdd()
// setup our bounding box
if (mDataBlock->shape)
mObjBox = mDataBlock->shape->bounds;
mObjBox = mDataBlock->shape->mBounds;
else
mObjBox = Box3F(Point3F(-1, -1, -1), Point3F(1, 1, 1));

View file

@ -235,7 +235,7 @@ void afxPhraseEffectData::packData(BitStream* stream)
stream->writeString(on_trig_cmd);
pack_fx(stream, fx_list, packed);
pack_fx(stream, fx_list, mPacked);
}
void afxPhraseEffectData::unpackData(BitStream* stream)

View file

@ -122,11 +122,11 @@ ConsoleDocClass( afxStaticShape,
afxStaticShape::afxStaticShape()
{
afx_data = 0;
is_visible = true;
chor_id = 0;
hookup_with_chor = false;
ghost_cons_name = ST_NULLSTRING;
mAFX_data = 0;
mIs_visible = true;
mChor_id = 0;
mHookup_with_chor = false;
mGhost_cons_name = ST_NULLSTRING;
}
afxStaticShape::~afxStaticShape()
@ -135,8 +135,8 @@ afxStaticShape::~afxStaticShape()
void afxStaticShape::init(U32 chor_id, StringTableEntry cons_name)
{
this->chor_id = chor_id;
ghost_cons_name = cons_name;
mChor_id = chor_id;
mGhost_cons_name = cons_name;
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//
@ -147,7 +147,7 @@ bool afxStaticShape::onNewDataBlock(GameBaseData* dptr, bool reload)
if (!mDataBlock || !Parent::onNewDataBlock(dptr, reload))
return false;
afx_data = dynamic_cast<afxStaticShapeData*>(mDataBlock);
mAFX_data = dynamic_cast<afxStaticShapeData*>(mDataBlock);
if (!mShapeInstance)
return true;
@ -156,10 +156,10 @@ bool afxStaticShape::onNewDataBlock(GameBaseData* dptr, bool reload)
// if datablock is afxStaticShapeData we get the sequence setting
// directly from the datablock on the client-side only
if (afx_data)
if (mAFX_data)
{
if (isClientObject())
seq_name = afx_data->sequence;
seq_name = mAFX_data->sequence;
}
// otherwise datablock is stock StaticShapeData and we look for
// a sequence name on a dynamic field on the server.
@ -188,13 +188,13 @@ void afxStaticShape::advanceTime(F32 dt)
{
Parent::advanceTime(dt);
if (hookup_with_chor)
if (mHookup_with_chor)
{
afxChoreographer* chor = arcaneFX::findClientChoreographer(chor_id);
afxChoreographer* chor = arcaneFX::findClientChoreographer(mChor_id);
if (chor)
{
chor->setGhostConstraintObject(this, ghost_cons_name);
hookup_with_chor = false;
chor->setGhostConstraintObject(this, mGhost_cons_name);
mHookup_with_chor = false;
}
}
}
@ -206,8 +206,8 @@ U32 afxStaticShape::packUpdate(NetConnection* conn, U32 mask, BitStream* stream)
// InitialUpdate
if (stream->writeFlag(mask & InitialUpdateMask))
{
stream->write(chor_id);
stream->writeString(ghost_cons_name);
stream->write(mChor_id);
stream->writeString(mGhost_cons_name);
}
return retMask;
@ -222,11 +222,11 @@ void afxStaticShape::unpackUpdate(NetConnection * conn, BitStream * stream)
// InitialUpdate
if (stream->readFlag())
{
stream->read(&chor_id);
ghost_cons_name = stream->readSTString();
stream->read(&mChor_id);
mGhost_cons_name = stream->readSTString();
if (chor_id != 0 && ghost_cons_name != ST_NULLSTRING)
hookup_with_chor = true;
if (mChor_id != 0 && mGhost_cons_name != ST_NULLSTRING)
mHookup_with_chor = true;
}
}
@ -234,7 +234,7 @@ void afxStaticShape::unpackUpdate(NetConnection * conn, BitStream * stream)
void afxStaticShape::prepRenderImage(SceneRenderState* state)
{
if (is_visible)
if (mIs_visible)
Parent::prepRenderImage(state);
}

View file

@ -66,11 +66,11 @@ class afxStaticShape : public StaticShape
private:
StaticShapeData* mDataBlock;
afxStaticShapeData* afx_data;
bool is_visible;
U32 chor_id;
bool hookup_with_chor;
StringTableEntry ghost_cons_name;
afxStaticShapeData* mAFX_data;
bool mIs_visible;
U32 mChor_id;
bool mHookup_with_chor;
StringTableEntry mGhost_cons_name;
protected:
virtual void prepRenderImage(SceneRenderState*);
@ -87,7 +87,7 @@ public:
virtual void unpackUpdate(NetConnection*, BitStream*);
const char* getShapeFileName() const { return mDataBlock->shapeName; }
void setVisibility(bool flag) { is_visible = flag; }
void setVisibility(bool flag) { mIs_visible = flag; }
DECLARE_CONOBJECT(afxStaticShape);
DECLARE_CATEGORY("AFX");

View file

@ -89,10 +89,10 @@ bool afxEA_AnimClip::ea_start()
do_runtime_substitutions();
afxConstraint* pos_constraint = getPosConstraint();
if (full_lifetime == INFINITE_LIFETIME && pos_constraint != 0)
if (mFull_lifetime == INFINITE_LIFETIME && pos_constraint != 0)
anim_lifetime = pos_constraint->getAnimClipDuration(clip_data->clip_name);
else
anim_lifetime = full_lifetime;
anim_lifetime = mFull_lifetime;
anim_tag = 0;
lock_tag = 0;
@ -127,8 +127,8 @@ bool afxEA_AnimClip::ea_update(F32 dt)
if (go_for_it)
{
F32 rate = clip_data->rate/prop_time_factor;
F32 pos = mFmod(life_elapsed, anim_lifetime)/anim_lifetime;
F32 rate = clip_data->rate/mProp_time_factor;
F32 pos = mFmod(mLife_elapsed, anim_lifetime)/anim_lifetime;
pos = mFmod(pos + clip_data->pos_offset, 1.0);
if (clip_data->rate < 0)
pos = 1.0f - pos;
@ -164,7 +164,7 @@ void afxEA_AnimClip::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxAnimClipData* orig_db = clip_data;
clip_data = new afxAnimClipData(*orig_db, true);
orig_db->performSubstitutions(clip_data, choreographer, group_index);
orig_db->performSubstitutions(clip_data, mChoreographer, mGroup_index);
}
}

View file

@ -133,7 +133,7 @@ void afxEA_AreaDamage::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxAreaDamageData* orig_db = damage_data;
damage_data = new afxAreaDamageData(*orig_db, true);
orig_db->performSubstitutions(damage_data, choreographer, group_index);
orig_db->performSubstitutions(damage_data, mChoreographer, mGroup_index);
}
}
@ -204,8 +204,8 @@ void afxEA_AreaDamage::notify_damage_source(ShapeBase* damaged, F32 damage, cons
char *posArg = Con::getArgBuffer(64);
dSprintf(posArg, 64, "%f %f %f", pos.x, pos.y, pos.z);
Con::executef(choreographer->getDataBlock(), "onInflictedAreaDamage",
choreographer->getIdString(),
Con::executef(mChoreographer->getDataBlock(), "onInflictedAreaDamage",
mChoreographer->getIdString(),
damaged->getIdString(),
Con::getFloatArg(damage),
flavor,
@ -221,7 +221,7 @@ void afxEA_AreaDamage::apply_damage(ShapeBase* shape, F32 damage, const char* fl
dSprintf(posArg, 64, "%f %f %f", pos.x, pos.y, pos.z);
Con::executef(shape, "damage",
choreographer->getIdString(),
mChoreographer->getIdString(),
posArg,
Con::getFloatArg(damage),
flavor);

View file

@ -125,8 +125,8 @@ bool afxEA_AudioBank::ea_update(F32 dt)
if (sound_handle)
{
sound_handle->setTransform(updated_xfm);
sound_handle->setVolume(updated_scale.x*fade_value);
sound_handle->setTransform(mUpdated_xfm);
sound_handle->setVolume(mUpdated_scale.x*mFade_value);
}
return true;
@ -143,14 +143,14 @@ void afxEA_AudioBank::ea_finish(bool was_stopped)
void afxEA_AudioBank::do_runtime_substitutions()
{
sound_bank = sound_bank->cloneAndPerformSubstitutions(choreographer, group_index);
sound_bank = sound_bank->cloneAndPerformSubstitutions(mChoreographer, mGroup_index);
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
class afxEA_SoundBankDesc : public afxEffectAdapterDesc, public afxEffectDefs
{
static afxEA_SoundBankDesc desc;
static afxEA_SoundBankDesc mDesc;
public:
virtual bool testEffectType(const SimDataBlock*) const;
@ -162,7 +162,7 @@ public:
virtual afxEffectWrapper* create() const { return new afxEA_AudioBank; }
};
afxEA_SoundBankDesc afxEA_SoundBankDesc::desc;
afxEA_SoundBankDesc afxEA_SoundBankDesc::mDesc;
bool afxEA_SoundBankDesc::testEffectType(const SimDataBlock* db) const
{

View file

@ -108,18 +108,18 @@ bool afxEA_Billboard::ea_update(F32 dt)
deleteNotify(bb);
///bb->setSequenceRateFactor(datablock->rate_factor/prop_time_factor);
bb->setSortPriority(datablock->sort_priority);
bb->setSortPriority(mDatablock->sort_priority);
}
if (bb)
{
bb->live_color = updated_color;
if (do_fades)
bb->live_color = mUpdated_color;
if (mDo_fades)
{
bb->setFadeAmount(fade_value);
bb->setFadeAmount(mFade_value);
}
bb->setTransform(updated_xfm);
bb->setScale(updated_scale);
bb->setTransform(mUpdated_xfm);
bb->setScale(mUpdated_scale);
}
return true;
@ -162,7 +162,7 @@ void afxEA_Billboard::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxBillboardData* orig_db = bb_data;
bb_data = new afxBillboardData(*orig_db, true);
orig_db->performSubstitutions(bb_data, choreographer, group_index);
orig_db->performSubstitutions(bb_data, mChoreographer, mGroup_index);
}
}

View file

@ -83,8 +83,8 @@ bool afxEA_CameraPuppet::ea_start()
do_runtime_substitutions();
afxConstraintID obj_id = cons_mgr->getConstraintId(puppet_data->cam_def);
cam_cons = cons_mgr->getConstraint(obj_id);
afxConstraintID obj_id = mCons_mgr->getConstraintId(puppet_data->cam_def);
cam_cons = mCons_mgr->getConstraint(obj_id);
SceneObject* obj = (cam_cons) ? cam_cons->getSceneObject() : 0;
if (obj && obj->isClientObject())
@ -105,9 +105,9 @@ bool afxEA_CameraPuppet::ea_update(F32 dt)
{
SceneObject* obj = (cam_cons) ? cam_cons->getSceneObject() : 0;
if (obj && in_scope)
if (obj && mIn_scope)
{
obj->setTransform(updated_xfm);
obj->setTransform(mUpdated_xfm);
}
return true;
@ -153,7 +153,7 @@ void afxEA_CameraPuppet::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxCameraPuppetData* orig_db = puppet_data;
puppet_data = new afxCameraPuppetData(*orig_db, true);
orig_db->performSubstitutions(puppet_data, choreographer, group_index);
orig_db->performSubstitutions(puppet_data, mChoreographer, mGroup_index);
}
}

View file

@ -91,7 +91,7 @@ bool afxEA_CameraShake::ea_start()
if (aim_constraint && pos_constraint)
{
if (full_lifetime <= 0 || full_lifetime == INFINITE_LIFETIME)
if (mFull_lifetime <= 0 || mFull_lifetime == INFINITE_LIFETIME)
{
Con::errorf("afxEA_CameraShake::ea_start() -- effect requires a finite lifetime.");
return false;
@ -106,7 +106,7 @@ bool afxEA_CameraShake::ea_start()
if (dist < shake_data->camShakeRadius)
{
camera_shake = new CameraShake;
camera_shake->setDuration(full_lifetime);
camera_shake->setDuration(mFull_lifetime);
camera_shake->setFrequency(shake_data->camShakeFreq);
F32 falloff = dist/shake_data->camShakeRadius;
@ -161,7 +161,7 @@ void afxEA_CameraShake::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxCameraShakeData* orig_db = shake_data;
shake_data = new afxCameraShakeData(*orig_db, true);
orig_db->performSubstitutions(shake_data, choreographer, group_index);
orig_db->performSubstitutions(shake_data, mChoreographer, mGroup_index);
}
}

View file

@ -107,16 +107,16 @@ bool afxEA_CollisionEvent::ea_update(F32 dt)
afxConstraint* pos_constraint = getPosConstraint();
set_shape((pos_constraint) ? dynamic_cast<ShapeBase*>(pos_constraint->getSceneObject()) : 0);
if (choreographer && trigger_mask != 0)
if (mChoreographer && trigger_mask != 0)
{
if (triggered)
{
choreographer->setTriggerMask(trigger_mask | choreographer->getTriggerMask());
mChoreographer->setTriggerMask(trigger_mask | mChoreographer->getTriggerMask());
triggered = false;
}
else
{
choreographer->setTriggerMask(~trigger_mask & choreographer->getTriggerMask());
mChoreographer->setTriggerMask(~trigger_mask & mChoreographer->getTriggerMask());
}
}
@ -136,7 +136,7 @@ void afxEA_CollisionEvent::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxCollisionEventData* orig_db = script_data;
script_data = new afxCollisionEventData(*orig_db, true);
orig_db->performSubstitutions(script_data, choreographer, group_index);
orig_db->performSubstitutions(script_data, mChoreographer, mGroup_index);
}
}
@ -162,7 +162,7 @@ void afxEA_CollisionEvent::set_shape(ShapeBase* new_shape)
void afxEA_CollisionEvent::collisionNotify(SceneObject* obj0, SceneObject* obj1, const VectorF& vel)
{
if (obj0 != shape || !choreographer || !choreographer->getDataBlock())
if (obj0 != shape || !mChoreographer || !mChoreographer->getDataBlock())
return;
if (script_data->method_name != ST_NULLSTRING)
@ -171,8 +171,8 @@ void afxEA_CollisionEvent::collisionNotify(SceneObject* obj0, SceneObject* obj1,
dSprintf(arg_buf, 256, "%g %g %g", vel.x, vel.y, vel.z);
// CALL SCRIPT afxChoreographerData::method(%spell, %obj0, %obj1, %velocity)
Con::executef(choreographer->getDataBlock(), script_data->method_name,
choreographer->getIdString(),
Con::executef(mChoreographer->getDataBlock(), script_data->method_name,
mChoreographer->getIdString(),
(obj0) ? obj0->getIdString() : "",
(obj1) ? obj1->getIdString() : "",
arg_buf,

View file

@ -98,7 +98,7 @@ void afxEA_ConsoleMessage::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxConsoleMessageData* orig_db = message_data;
message_data = new afxConsoleMessageData(*orig_db, true);
orig_db->performSubstitutions(message_data, choreographer, group_index);
orig_db->performSubstitutions(message_data, mChoreographer, mGroup_index);
}
}

View file

@ -101,7 +101,7 @@ bool afxEA_Damage::ea_start()
if (damage_data->repeats > 1)
{
dot_delta_ms = full_lifetime/(damage_data->repeats - 1);
dot_delta_ms = mFull_lifetime /(damage_data->repeats - 1);
next_dot_time = dot_delta_ms;
}
@ -122,15 +122,15 @@ bool afxEA_Damage::ea_update(F32 dt)
if (aim_cons && aim_cons->getSceneObject())
impacted_obj_id = aim_cons->getSceneObject()->getId();
if (choreographer)
choreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount,
if (mChoreographer)
mChoreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount,
repeat_cnt, damage_data->ad_amount, damage_data->radius, impact_pos,
damage_data->impulse);
repeat_cnt++;
}
else if (repeat_cnt < damage_data->repeats)
{
if (next_dot_time <= life_elapsed)
if (next_dot_time <= mLife_elapsed)
{
// CONSTRAINT REMAPPING <<
afxConstraint* aim_cons = getAimConstraint();
@ -138,8 +138,8 @@ bool afxEA_Damage::ea_update(F32 dt)
impacted_obj_id = aim_cons->getSceneObject()->getId();
// CONSTRAINT REMAPPING >>
if (choreographer)
choreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount,
if (mChoreographer)
mChoreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount,
repeat_cnt, 0, 0, impact_pos, 0);
next_dot_time += dot_delta_ms;
repeat_cnt++;
@ -153,10 +153,10 @@ void afxEA_Damage::ea_finish(bool was_stopped)
{
if (started && (repeat_cnt < damage_data->repeats))
{
if (next_dot_time <= life_elapsed)
if (next_dot_time <= mLife_elapsed)
{
if (choreographer)
choreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount,
if (mChoreographer)
mChoreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount,
repeat_cnt, 0, 0, impact_pos, 0);
}
}
@ -172,7 +172,7 @@ void afxEA_Damage::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxDamageData* orig_db = damage_data;
damage_data = new afxDamageData(*orig_db, true);
orig_db->performSubstitutions(damage_data, choreographer, group_index);
orig_db->performSubstitutions(damage_data, mChoreographer, mGroup_index);
}
}

View file

@ -78,7 +78,7 @@ afxEA_Debris::~afxEA_Debris()
bool afxEA_Debris::isDone()
{
return (datablock->use_as_cons_obj) ? debris_done : exploded;
return (mDatablock->use_as_cons_obj) ? debris_done : exploded;
}
void afxEA_Debris::ea_set_datablock(SimDataBlock* db)
@ -106,21 +106,21 @@ bool afxEA_Debris::ea_update(F32 dt)
{
if (exploded && debris)
{
if (in_scope)
if (mIn_scope)
{
updated_xfm = debris->getRenderTransform();
updated_xfm.getColumn(3, &updated_pos);
mUpdated_xfm = debris->getRenderTransform();
mUpdated_xfm.getColumn(3, &mUpdated_pos);
}
}
if (!exploded && debris)
{
if (in_scope)
if (mIn_scope)
{
Point3F dir_vec(0,1,0);
updated_xfm.mulV(dir_vec);
mUpdated_xfm.mulV(dir_vec);
debris->init(updated_pos, dir_vec);
debris->init(mUpdated_pos, dir_vec);
if (!debris->registerObject())
{
delete debris;
@ -165,7 +165,7 @@ void afxEA_Debris::do_runtime_substitutions()
// clone the datablock and perform substitutions
DebrisData* orig_db = debris_data;
debris_data = new DebrisData(*orig_db, true);
orig_db->performSubstitutions(debris_data, choreographer, group_index);
orig_db->performSubstitutions(debris_data, mChoreographer, mGroup_index);
}
}

View file

@ -81,7 +81,7 @@ bool afxEA_Explosion::ea_start()
do_runtime_substitutions();
explosion = new Explosion();
explosion->setSubstitutionData(choreographer, group_index);
explosion->setSubstitutionData(mChoreographer, mGroup_index);
explosion->setDataBlock(explosion_data);
return true;
@ -91,10 +91,10 @@ bool afxEA_Explosion::ea_update(F32 dt)
{
if (!exploded && explosion)
{
if (in_scope)
if (mIn_scope)
{
Point3F norm(0,0,1); updated_xfm.mulV(norm);
explosion->setInitialState(updated_pos, norm);
Point3F norm(0,0,1); mUpdated_xfm.mulV(norm);
explosion->setInitialState(mUpdated_pos, norm);
if (!explosion->registerObject())
{
delete explosion;
@ -117,7 +117,7 @@ void afxEA_Explosion::ea_finish(bool was_stopped)
void afxEA_Explosion::do_runtime_substitutions()
{
explosion_data = explosion_data->cloneAndPerformSubstitutions(choreographer, group_index);
explosion_data = explosion_data->cloneAndPerformSubstitutions(mChoreographer, mGroup_index);
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//

View file

@ -40,8 +40,8 @@ class afxEA_FootSwitch : public afxEffectWrapper
{
typedef afxEffectWrapper Parent;
afxFootSwitchData* footfall_data;
Player* player;
afxFootSwitchData* mFootfall_data;
Player* mPlayer;
void do_runtime_substitutions();
@ -62,38 +62,38 @@ public:
afxEA_FootSwitch::afxEA_FootSwitch()
{
footfall_data = 0;
player = 0;
mFootfall_data = 0;
mPlayer = 0;
}
inline void afxEA_FootSwitch::set_overrides(Player* player)
{
if (footfall_data->override_all)
if (mFootfall_data->override_all)
player->overrideFootfallFX();
else
player->overrideFootfallFX(footfall_data->override_decals,
footfall_data->override_sounds,
footfall_data->override_dust);
player->overrideFootfallFX(mFootfall_data->override_decals,
mFootfall_data->override_sounds,
mFootfall_data->override_dust);
}
inline void afxEA_FootSwitch::clear_overrides(Player* player)
{
if (footfall_data->override_all)
if (mFootfall_data->override_all)
player->restoreFootfallFX();
else
player->restoreFootfallFX(footfall_data->override_decals,
footfall_data->override_sounds,
footfall_data->override_dust);
player->restoreFootfallFX(mFootfall_data->override_decals,
mFootfall_data->override_sounds,
mFootfall_data->override_dust);
}
void afxEA_FootSwitch::ea_set_datablock(SimDataBlock* db)
{
footfall_data = dynamic_cast<afxFootSwitchData*>(db);
mFootfall_data = dynamic_cast<afxFootSwitchData*>(db);
}
bool afxEA_FootSwitch::ea_start()
{
if (!footfall_data)
if (!mFootfall_data)
{
Con::errorf("afxEA_FootSwitch::ea_start() -- missing or incompatible datablock.");
return false;
@ -102,25 +102,25 @@ bool afxEA_FootSwitch::ea_start()
do_runtime_substitutions();
afxConstraint* pos_cons = getPosConstraint();
player = (pos_cons) ? dynamic_cast<Player*>(pos_cons->getSceneObject()) : 0;
if (player)
set_overrides(player);
mPlayer = (pos_cons) ? dynamic_cast<Player*>(pos_cons->getSceneObject()) : 0;
if (mPlayer)
set_overrides(mPlayer);
return true;
}
bool afxEA_FootSwitch::ea_update(F32 dt)
{
if (!player)
if (!mPlayer)
return true;
afxConstraint* pos_cons = getPosConstraint();
Player* temp_player = (pos_cons) ? dynamic_cast<Player*>(pos_cons->getSceneObject()) : 0;
if (temp_player && temp_player != player)
if (temp_player && temp_player != mPlayer)
{
player = temp_player;
if (player)
set_overrides(player);
mPlayer = temp_player;
if (mPlayer)
set_overrides(mPlayer);
}
return true;
@ -128,24 +128,24 @@ bool afxEA_FootSwitch::ea_update(F32 dt)
void afxEA_FootSwitch::ea_finish(bool was_stopped)
{
if (!player)
if (!mPlayer)
return;
afxConstraint* pos_cons = getPosConstraint();
Player* temp_player = (pos_cons) ? dynamic_cast<Player*>(pos_cons->getSceneObject()) : 0;
if (temp_player == player)
clear_overrides(player);
if (temp_player == mPlayer)
clear_overrides(mPlayer);
}
void afxEA_FootSwitch::do_runtime_substitutions()
{
// only clone the datablock if there are substitutions
if (footfall_data->getSubstitutionCount() > 0)
if (mFootfall_data->getSubstitutionCount() > 0)
{
// clone the datablock and perform substitutions
afxFootSwitchData* orig_db = footfall_data;
footfall_data = new afxFootSwitchData(*orig_db, true);
orig_db->performSubstitutions(footfall_data, choreographer, group_index);
afxFootSwitchData* orig_db = mFootfall_data;
mFootfall_data = new afxFootSwitchData(*orig_db, true);
orig_db->performSubstitutions(mFootfall_data, mChoreographer, mGroup_index);
}
}

View file

@ -146,7 +146,7 @@ bool afxEA_GuiController::ea_update(F32 dt)
if (ts_ctrl && !controller_data->preserve_pos)
{
Point3F screen_pos;
if (ts_ctrl->project(updated_pos, &screen_pos))
if (ts_ctrl->project(mUpdated_pos, &screen_pos))
{
const Point2I ext = gui_control->getExtent();
Point2I newpos(screen_pos.x - ext.x/2, screen_pos.y - ext.y/2);
@ -155,12 +155,12 @@ bool afxEA_GuiController::ea_update(F32 dt)
}
if (progress_base)
progress_base->setProgress((ew_timing.lifetime > 0.0) ? life_elapsed/ew_timing.lifetime : 0.0f);
progress_base->setProgress((mEW_timing.lifetime > 0.0) ? mLife_elapsed / mEW_timing.lifetime : 0.0f);
else if (progress_ctrl)
progress_ctrl->setScriptValue((ew_timing.lifetime > 0.0) ? avar("%g", life_elapsed/ew_timing.lifetime) : 0);
progress_ctrl->setScriptValue((mEW_timing.lifetime > 0.0) ? avar("%g", mLife_elapsed / mEW_timing.lifetime) : 0);
if (do_fades)
gui_control->setFadeAmount(fade_value);
if (mDo_fades)
gui_control->setFadeAmount(mFade_value);
return true;
}
@ -182,7 +182,7 @@ void afxEA_GuiController::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxGuiControllerData* orig_db = controller_data;
controller_data = new afxGuiControllerData(*orig_db, true);
orig_db->performSubstitutions(controller_data, choreographer, group_index);
orig_db->performSubstitutions(controller_data, mChoreographer, mGroup_index);
}
}

View file

@ -105,9 +105,9 @@ bool afxEA_GuiText::ea_update(F32 dt)
case USER_TEXT:
{
LinearColorF temp_clr = text_clr;
if (do_fades)
temp_clr.alpha = fade_value;
afxGuiTextHud::addTextItem(updated_pos, text_data->text_str, temp_clr);
if (mDo_fades)
temp_clr.alpha = mFade_value;
afxGuiTextHud::addTextItem(mUpdated_pos, text_data->text_str, temp_clr);
}
break;
case SHAPE_NAME:
@ -127,9 +127,9 @@ bool afxEA_GuiText::ea_update(F32 dt)
if (name && name[0] != '\0')
{
LinearColorF temp_clr = text_clr;
if (do_fades)
temp_clr.alpha = fade_value;
afxGuiTextHud::addTextItem(updated_pos, name, temp_clr, cons_obj);
if (mDo_fades)
temp_clr.alpha = mFade_value;
afxGuiTextHud::addTextItem(mUpdated_pos, name, temp_clr, cons_obj);
}
}
break;
@ -146,7 +146,7 @@ void afxEA_GuiText::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxGuiTextData* orig_db = text_data;
text_data = new afxGuiTextData(*orig_db, true);
orig_db->performSubstitutions(text_data, choreographer, group_index);
orig_db->performSubstitutions(text_data, mChoreographer, mGroup_index);
}
}

View file

@ -110,15 +110,15 @@ bool afxEA_MachineGun::ea_update(F32 dt)
{
if (!shooting)
{
start_time = elapsed;
start_time = mElapsed;
shooting = true;
}
else
{
F32 next_shot = start_time + (shot_count+1)*shot_gap;
while (next_shot < elapsed)
while (next_shot < mElapsed)
{
if (in_scope)
if (mIn_scope)
launch_projectile();
next_shot += shot_gap;
shot_count++;
@ -141,7 +141,7 @@ void afxEA_MachineGun::launch_projectile()
if (bullet_data->getSubstitutionCount() > 0)
{
next_bullet = new ProjectileData(*bullet_data, true);
bullet_data->performSubstitutions(next_bullet, choreographer, group_index);
bullet_data->performSubstitutions(next_bullet, mChoreographer, mGroup_index);
}
projectile->onNewDataBlock(next_bullet, false);
@ -151,10 +151,10 @@ void afxEA_MachineGun::launch_projectile()
afxConstraint* pos_cons = getPosConstraint();
ShapeBase* src_obj = (pos_cons) ? (dynamic_cast<ShapeBase*>(pos_cons->getSceneObject())) : 0;
Point3F dir_vec = updated_aim - updated_pos;
Point3F dir_vec = mUpdated_aim - mUpdated_pos;
dir_vec.normalizeSafe();
dir_vec *= muzzle_vel;
projectile->init(updated_pos, dir_vec, src_obj);
projectile->init(mUpdated_pos, dir_vec, src_obj);
if (!projectile->registerObject())
{
delete projectile;
@ -162,7 +162,7 @@ void afxEA_MachineGun::launch_projectile()
Con::errorf("afxEA_MachineGun::launch_projectile() -- projectile failed to register.");
}
if (projectile)
projectile->setDataField(StringTable->insert("afxOwner"), 0, choreographer->getIdString());
projectile->setDataField(StringTable->insert("afxOwner"), 0, mChoreographer->getIdString());
}
void afxEA_MachineGun::do_runtime_substitutions()
@ -173,7 +173,7 @@ void afxEA_MachineGun::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxMachineGunData* orig_db = gun_data;
gun_data = new afxMachineGunData(*orig_db, true);
orig_db->performSubstitutions(gun_data, choreographer, group_index);
orig_db->performSubstitutions(gun_data, mChoreographer, mGroup_index);
}
}

View file

@ -119,18 +119,18 @@ bool afxEA_Model::ea_update(F32 dt)
}
deleteNotify(model);
model->setSequenceRateFactor(datablock->rate_factor/prop_time_factor);
model->setSortPriority(datablock->sort_priority);
model->setSequenceRateFactor(mDatablock->rate_factor/ mProp_time_factor);
model->setSortPriority(mDatablock->sort_priority);
}
if (model)
{
if (do_fades)
if (mDo_fades)
{
model->setFadeAmount(fade_value);
model->setFadeAmount(mFade_value);
}
model->setTransform(updated_xfm);
model->setScale(updated_scale);
model->setTransform(mUpdated_xfm);
model->setScale(mUpdated_scale);
}
return true;
@ -141,10 +141,10 @@ void afxEA_Model::ea_finish(bool was_stopped)
if (!model)
return;
if (in_scope && ew_timing.residue_lifetime > 0)
if (mIn_scope && mEW_timing.residue_lifetime > 0)
{
clearNotify(model);
afxResidueMgr::add(ew_timing.residue_lifetime, ew_timing.residue_fadetime, model);
afxResidueMgr::add(mEW_timing.residue_lifetime, mEW_timing.residue_fadetime, model);
model = 0;
}
else
@ -203,7 +203,7 @@ void afxEA_Model::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxModelData* orig_db = model_data;
model_data = new afxModelData(*orig_db, true);
orig_db->performSubstitutions(model_data, choreographer, group_index);
orig_db->performSubstitutions(model_data, mChoreographer, mGroup_index);
}
}

View file

@ -37,8 +37,8 @@ class afxEA_Mooring : public afxEffectWrapper
{
typedef afxEffectWrapper Parent;
afxMooringData* mooring_data;
afxMooring* obj;
afxMooringData* mMooring_data;
afxMooring* mObj;
void do_runtime_substitutions();
@ -57,27 +57,27 @@ public:
afxEA_Mooring::afxEA_Mooring()
{
mooring_data = 0;
obj = 0;
mMooring_data = 0;
mObj = 0;
}
afxEA_Mooring::~afxEA_Mooring()
{
if (obj)
obj->deleteObject();
if (mooring_data && mooring_data->isTempClone())
delete mooring_data;
mooring_data = 0;
if (mObj)
mObj->deleteObject();
if (mMooring_data && mMooring_data->isTempClone())
delete mMooring_data;
mMooring_data = 0;
}
void afxEA_Mooring::ea_set_datablock(SimDataBlock* db)
{
mooring_data = dynamic_cast<afxMooringData*>(db);
mMooring_data = dynamic_cast<afxMooringData*>(db);
}
bool afxEA_Mooring::ea_start()
{
if (!mooring_data)
if (!mMooring_data)
{
Con::errorf("afxEA_Mooring::ea_start() -- missing or incompatible datablock.");
return false;
@ -90,33 +90,33 @@ bool afxEA_Mooring::ea_start()
bool afxEA_Mooring::ea_update(F32 dt)
{
if (!obj)
if (!mObj)
{
if (datablock->use_ghost_as_cons_obj && datablock->effect_name != ST_NULLSTRING)
if (mDatablock->use_ghost_as_cons_obj && mDatablock->effect_name != ST_NULLSTRING)
{
obj = new afxMooring(mooring_data->networking,
choreographer->getChoreographerId(),
datablock->effect_name);
mObj = new afxMooring(mMooring_data->networking,
mChoreographer->getChoreographerId(),
mDatablock->effect_name);
}
else
{
obj = new afxMooring(mooring_data->networking, 0, ST_NULLSTRING);
mObj = new afxMooring(mMooring_data->networking, 0, ST_NULLSTRING);
}
obj->onNewDataBlock(mooring_data, false);
if (!obj->registerObject())
mObj->onNewDataBlock(mMooring_data, false);
if (!mObj->registerObject())
{
delete obj;
obj = 0;
delete mObj;
mObj = 0;
Con::errorf("afxEA_Mooring::ea_update() -- effect failed to register.");
return false;
}
deleteNotify(obj);
deleteNotify(mObj);
}
if (obj)
if (mObj)
{
obj->setTransform(updated_xfm);
mObj->setTransform(mUpdated_xfm);
}
return true;
@ -128,7 +128,7 @@ void afxEA_Mooring::ea_finish(bool was_stopped)
void afxEA_Mooring::onDeleteNotify(SimObject* obj)
{
if (this->obj == obj)
if (mObj == obj)
obj = 0;
Parent::onDeleteNotify(obj);
@ -137,12 +137,12 @@ void afxEA_Mooring::onDeleteNotify(SimObject* obj)
void afxEA_Mooring::do_runtime_substitutions()
{
// only clone the datablock if there are substitutions
if (mooring_data->getSubstitutionCount() > 0)
if (mMooring_data->getSubstitutionCount() > 0)
{
// clone the datablock and perform substitutions
afxMooringData* orig_db = mooring_data;
mooring_data = new afxMooringData(*orig_db, true);
orig_db->performSubstitutions(mooring_data, choreographer, group_index);
afxMooringData* orig_db = mMooring_data;
mMooring_data = new afxMooringData(*orig_db, true);
orig_db->performSubstitutions(mMooring_data, mChoreographer, mGroup_index);
}
}

View file

@ -84,28 +84,28 @@ bool afxEA_ParticleEmitter::ea_start()
{
afxParticleEmitterVector* pe = new afxParticleEmitterVector();
pe->onNewDataBlock(afx_emitter_db, false);
pe->setAFXOwner(choreographer);
pe->setAFXOwner(mChoreographer);
emitter = pe;
}
else if (dynamic_cast<afxParticleEmitterConeData*>(emitter_data))
{
afxParticleEmitterCone* pe = new afxParticleEmitterCone();
pe->onNewDataBlock(afx_emitter_db, false);
pe->setAFXOwner(choreographer);
pe->setAFXOwner(mChoreographer);
emitter = pe;
}
else if (dynamic_cast<afxParticleEmitterPathData*>(emitter_data))
{
afxParticleEmitterPath* pe = new afxParticleEmitterPath();
pe->onNewDataBlock(afx_emitter_db, false);
pe->setAFXOwner(choreographer);
pe->setAFXOwner(mChoreographer);
emitter = pe;
}
else if (dynamic_cast<afxParticleEmitterDiscData*>(emitter_data))
{
afxParticleEmitterDisc* pe = new afxParticleEmitterDisc();
pe->onNewDataBlock(afx_emitter_db, false);
pe->setAFXOwner(choreographer);
pe->setAFXOwner(mChoreographer);
emitter = pe;
}
}
@ -120,7 +120,7 @@ bool afxEA_ParticleEmitter::ea_start()
// here we find or create any required particle-pools
if (emitter_data->pool_datablock)
{
afxParticlePool* pool = choreographer->findParticlePool(emitter_data->pool_datablock, emitter_data->pool_index);
afxParticlePool* pool = mChoreographer->findParticlePool(emitter_data->pool_datablock, emitter_data->pool_index);
if (!pool)
{
afxParticlePoolData* pool_data = emitter_data->pool_datablock;
@ -129,7 +129,7 @@ bool afxEA_ParticleEmitter::ea_start()
// clone the datablock and perform substitutions
afxParticlePoolData* orig_db = pool_data;
pool_data = new afxParticlePoolData(*orig_db, true);
orig_db->performSubstitutions(pool_data, choreographer, group_index);
orig_db->performSubstitutions(pool_data, mChoreographer, mGroup_index);
}
pool = new afxParticlePool();
@ -143,8 +143,8 @@ bool afxEA_ParticleEmitter::ea_start()
}
if (pool)
{
pool->setChoreographer(choreographer);
choreographer->registerParticlePool(pool);
pool->setChoreographer(mChoreographer);
mChoreographer->registerParticlePool(pool);
}
}
if (pool)
@ -160,12 +160,12 @@ bool afxEA_ParticleEmitter::ea_start()
return false;
}
if (datablock->forced_bbox.isValidBox())
if (mDatablock->forced_bbox.isValidBox())
{
do_bbox_update = true;
}
emitter->setSortPriority(datablock->sort_priority);
emitter->setSortPriority(mDatablock->sort_priority);
deleteNotify(emitter);
return true;
@ -173,26 +173,26 @@ bool afxEA_ParticleEmitter::ea_start()
bool afxEA_ParticleEmitter::ea_update(F32 dt)
{
if (emitter && in_scope)
if (emitter && mIn_scope)
{
if (do_bbox_update)
{
Box3F bbox = emitter->getObjBox();
bbox.minExtents = updated_pos + datablock->forced_bbox.minExtents;
bbox.maxExtents = updated_pos + datablock->forced_bbox.maxExtents;
bbox.minExtents = mUpdated_pos + mDatablock->forced_bbox.minExtents;
bbox.maxExtents = mUpdated_pos + mDatablock->forced_bbox.maxExtents;
emitter->setForcedObjBox(bbox);
emitter->setTransform(emitter->getTransform());
if (!datablock->update_forced_bbox)
if (!mDatablock->update_forced_bbox)
do_bbox_update = false;
}
if (do_fades)
emitter->setFadeAmount(fade_value);
if (mDo_fades)
emitter->setFadeAmount(mFade_value);
emitter->emitParticlesExt(updated_xfm, updated_pos, Point3F(0.0,0.0,0.0), (U32)(dt*1000));
emitter->emitParticlesExt(mUpdated_xfm, mUpdated_pos, Point3F(0.0,0.0,0.0), (U32)(dt*1000));
}
return true;
@ -209,7 +209,7 @@ void afxEA_ParticleEmitter::ea_finish(bool was_stopped)
// note - fully faded particles are not always
// invisible, so they are still kept alive and
// deleted via deleteWhenEmpty().
if (ew_timing.fade_out_time > 0.0f)
if (mEW_timing.fade_out_time > 0.0f)
emitter->setFadeAmount(0.0f);
if (dynamic_cast<afxParticleEmitter*>(emitter))
((afxParticleEmitter*)emitter)->setAFXOwner(0);
@ -240,32 +240,32 @@ void afxEA_ParticleEmitter::do_runtime_substitutions()
{
afxParticleEmitterVectorData* orig_db = (afxParticleEmitterVectorData*)emitter_data;
emitter_data = new afxParticleEmitterVectorData(*orig_db, true);
orig_db->performSubstitutions(emitter_data, choreographer, group_index);
orig_db->performSubstitutions(emitter_data, mChoreographer, mGroup_index);
}
else if (dynamic_cast<afxParticleEmitterConeData*>(emitter_data))
{
afxParticleEmitterConeData* orig_db = (afxParticleEmitterConeData*)emitter_data;
emitter_data = new afxParticleEmitterConeData(*orig_db, true);
orig_db->performSubstitutions(emitter_data, choreographer, group_index);
orig_db->performSubstitutions(emitter_data, mChoreographer, mGroup_index);
}
else if (dynamic_cast<afxParticleEmitterPathData*>(emitter_data))
{
afxParticleEmitterPathData* orig_db = (afxParticleEmitterPathData*)emitter_data;
emitter_data = new afxParticleEmitterPathData(*orig_db, true);
orig_db->performSubstitutions(emitter_data, choreographer, group_index);
orig_db->performSubstitutions(emitter_data, mChoreographer, mGroup_index);
}
else if (dynamic_cast<afxParticleEmitterDiscData*>(emitter_data))
{
afxParticleEmitterDiscData* orig_db = (afxParticleEmitterDiscData*)emitter_data;
emitter_data = new afxParticleEmitterDiscData(*orig_db, true);
orig_db->performSubstitutions(emitter_data, choreographer, group_index);
orig_db->performSubstitutions(emitter_data, mChoreographer, mGroup_index);
}
}
else
{
ParticleEmitterData* orig_db = emitter_data;
emitter_data = new ParticleEmitterData(*orig_db, true);
orig_db->performSubstitutions(emitter_data, choreographer, group_index);
orig_db->performSubstitutions(emitter_data, mChoreographer, mGroup_index);
}
if (clone_particles)
@ -277,7 +277,7 @@ void afxEA_ParticleEmitter::do_runtime_substitutions()
// clone the datablock and perform substitutions
ParticleData* orig_db = emitter_data->particleDataBlocks[i];
emitter_data->particleDataBlocks[i] = new ParticleData(*orig_db, true);
orig_db->performSubstitutions(emitter_data->particleDataBlocks[i], choreographer, group_index);
orig_db->performSubstitutions(emitter_data->particleDataBlocks[i], mChoreographer, mGroup_index);
}
}
}

View file

@ -137,7 +137,7 @@ void afxEA_PhraseEffect::grab_player_triggers(U32& trigger_mask)
bool afxEA_PhraseEffect::ea_update(F32 dt)
{
if (fade_value >= 1.0f)
if (mFade_value >= 1.0f)
{
//
// Choreographer Triggers:
@ -145,7 +145,7 @@ bool afxEA_PhraseEffect::ea_update(F32 dt)
// They must be set explicitly by calls to afxChoreographer
// console-methods, setTriggerBit(), or clearTriggerBit().
//
U32 trigger_mask = (phrase_fx_data->no_choreographer_trigs) ? 0 : choreographer->getTriggerMask();
U32 trigger_mask = (phrase_fx_data->no_choreographer_trigs) ? 0 : mChoreographer->getTriggerMask();
//
// Constraint Triggers:
@ -191,7 +191,7 @@ bool afxEA_PhraseEffect::ea_update(F32 dt)
{
for (S32 i = 0; i < active_phrases->size(); i++)
{
(*active_phrases)[i]->stop(life_elapsed);
(*active_phrases)[i]->stop(mLife_elapsed);
}
}
}
@ -240,7 +240,7 @@ void afxEA_PhraseEffect::ea_finish(bool was_stopped)
{
for (S32 i = 0; i < active_phrases->size(); i++)
{
(*active_phrases)[i]->stop(life_elapsed);
(*active_phrases)[i]->stop(mLife_elapsed);
}
}
@ -252,7 +252,7 @@ void afxEA_PhraseEffect::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxPhraseEffectData* orig_db = phrase_fx_data;
phrase_fx_data = new afxPhraseEffectData(*orig_db, true);
orig_db->performSubstitutions(phrase_fx_data, choreographer, group_index);
orig_db->performSubstitutions(phrase_fx_data, mChoreographer, mGroup_index);
}
}
@ -260,8 +260,8 @@ void afxEA_PhraseEffect::trigger_new_phrase()
{
//afxPhrase* phrase = new afxPhrase(choreographer->isServerObject(), /*willStop=*/false);
bool will_stop = phrase_fx_data->phrase_type == afxPhraseEffectData::PHRASE_CONTINUOUS;
afxPhrase* phrase = new afxPhrase(choreographer->isServerObject(), will_stop);
phrase->init(phrase_fx_data->fx_list, datablock->ewd_timing.lifetime, choreographer, time_factor, phrase_fx_data->n_loops, group_index);
afxPhrase* phrase = new afxPhrase(mChoreographer->isServerObject(), will_stop);
phrase->init(phrase_fx_data->fx_list, mDatablock->ewd_timing.lifetime, mChoreographer, mTime_factor, phrase_fx_data->n_loops, mGroup_index);
phrase->start(0, 0);
if (phrase->isEmpty())
{
@ -272,10 +272,10 @@ void afxEA_PhraseEffect::trigger_new_phrase()
if (phrase_fx_data->on_trig_cmd != ST_NULLSTRING)
{
char obj_str[32];
dStrcpy(obj_str, Con::getIntArg(choreographer->getId()), 32);
dStrcpy(obj_str, Con::getIntArg(mChoreographer->getId()), 32);
char index_str[32];
dStrcpy(index_str, Con::getIntArg(group_index), 32);
dStrcpy(index_str, Con::getIntArg(mGroup_index), 32);
char buffer[1024];
char* b = buffer;
@ -331,9 +331,9 @@ void afxEA_PhraseEffect::update_active_phrases(F32 dt)
for (S32 i = 0; i < active_phrases->size(); i++)
{
afxPhrase* phrase = (*active_phrases)[i];
if (phrase->expired(life_elapsed))
phrase->recycle(life_elapsed);
phrase->update(dt, life_elapsed);
if (phrase->expired(mLife_elapsed))
phrase->recycle(mLife_elapsed);
phrase->update(dt, mLife_elapsed);
}
}

View file

@ -127,9 +127,9 @@ bool afxEA_PhysicalZone::ea_update(F32 dt)
set_cons_object((pos_constraint) ? pos_constraint->getSceneObject() : 0);
}
if (do_fades)
physical_zone->setFadeAmount(fade_value);
physical_zone->setTransform(updated_xfm);
if (mDo_fades)
physical_zone->setFadeAmount(mFade_value);
physical_zone->setTransform(mUpdated_xfm);
}
return true;
@ -172,7 +172,7 @@ void afxEA_PhysicalZone::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxPhysicalZoneData* orig_db = zone_data;
zone_data = new afxPhysicalZoneData(*orig_db, true);
orig_db->performSubstitutions(zone_data, choreographer, group_index);
orig_db->performSubstitutions(zone_data, mChoreographer, mGroup_index);
}
}

View file

@ -136,7 +136,7 @@ void afxEA_PlayerMovement::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxPlayerMovementData* orig_db = movement_data;
movement_data = new afxPlayerMovementData(*orig_db, true);
orig_db->performSubstitutions(movement_data, choreographer, group_index);
orig_db->performSubstitutions(movement_data, mChoreographer, mGroup_index);
}
}

View file

@ -80,8 +80,8 @@ bool afxEA_PlayerPuppet::ea_start()
do_runtime_substitutions();
afxConstraintID obj_id = cons_mgr->getConstraintId(mover_data->obj_def);
obj_cons = cons_mgr->getConstraint(obj_id);
afxConstraintID obj_id = mCons_mgr->getConstraintId(mover_data->obj_def);
obj_cons = mCons_mgr->getConstraint(obj_id);
Player* player = dynamic_cast<Player*>((obj_cons) ? obj_cons->getSceneObject() : 0);
if (player)
@ -94,9 +94,9 @@ bool afxEA_PlayerPuppet::ea_update(F32 dt)
{
SceneObject* obj = (obj_cons) ? obj_cons->getSceneObject() : 0;
if (obj && in_scope)
if (obj && mIn_scope)
{
obj->setTransform(updated_xfm);
obj->setTransform(mUpdated_xfm);
}
return true;
@ -138,7 +138,7 @@ void afxEA_PlayerPuppet::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxPlayerPuppetData* orig_db = mover_data;
mover_data = new afxPlayerPuppetData(*orig_db, true);
orig_db->performSubstitutions(mover_data, choreographer, group_index);
orig_db->performSubstitutions(mover_data, mChoreographer, mGroup_index);
}
}

View file

@ -66,10 +66,10 @@ public:
class PointLightProxy : public PointLight
{
F32 fade_amt;
F32 mFade_amt;
public:
PointLightProxy() { fade_amt = 1.0f; }
PointLightProxy() { mFade_amt = 1.0f; }
void force_ghost()
{
@ -79,7 +79,7 @@ public:
void setFadeAmount(F32 fade_amt)
{
this->fade_amt = fade_amt;
mFade_amt = fade_amt;
mLight->setBrightness(mBrightness*fade_amt);
}
@ -125,10 +125,10 @@ public:
void submitLights(LightManager* lm, bool staticLighting)
{
if (mAnimState.active && mAnimationData && fade_amt < 1.0f)
if (mAnimState.active && mAnimationData && mFade_amt < 1.0f)
{
F32 mBrightness_save = mBrightness;
mBrightness *= fade_amt;
mBrightness *= mFade_amt;
PointLight::submitLights(lm, staticLighting);
mBrightness = mBrightness_save;
return;
@ -203,12 +203,12 @@ bool afxEA_T3DPointLight::ea_update(F32 dt)
light->setConstraintObject(cons_obj);
#endif
light->setLiveColor(updated_color);
light->setLiveColor(mUpdated_color);
if (do_fades)
light->setFadeAmount(fade_value*updated_scale.x);
if (mDo_fades)
light->setFadeAmount(mFade_value*mUpdated_scale.x);
light->updateTransform(updated_xfm);
light->updateTransform(mUpdated_xfm);
// scale should not be updated this way. It messes up the culling.
//light->setScale(updated_scale);
@ -254,7 +254,7 @@ void afxEA_T3DPointLight::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxT3DPointLightData* orig_db = light_data;
light_data = new afxT3DPointLightData(*orig_db, true);
orig_db->performSubstitutions(light_data, choreographer, group_index);
orig_db->performSubstitutions(light_data, mChoreographer, mGroup_index);
}
}

View file

@ -92,7 +92,7 @@ afxEA_Projectile::~afxEA_Projectile()
bool afxEA_Projectile::isDone()
{
return (datablock->use_as_cons_obj || datablock->use_ghost_as_cons_obj) ? projectile_done : impacted;
return (mDatablock->use_as_cons_obj || mDatablock->use_ghost_as_cons_obj) ? projectile_done : impacted;
}
void afxEA_Projectile::ea_set_datablock(SimDataBlock* db)
@ -117,8 +117,8 @@ bool afxEA_Projectile::ea_start()
}
else
{
if (datablock->use_ghost_as_cons_obj && datablock->effect_name != ST_NULLSTRING)
projectile = new afxProjectile(afx_projectile_data->networking, choreographer->getChoreographerId(), datablock->effect_name);
if (mDatablock->use_ghost_as_cons_obj && mDatablock->effect_name != ST_NULLSTRING)
projectile = new afxProjectile(afx_projectile_data->networking, mChoreographer->getChoreographerId(), mDatablock->effect_name);
else
projectile = new afxProjectile(afx_projectile_data->networking, 0, ST_NULLSTRING);
projectile->ignoreSourceTimeout = afx_projectile_data->ignore_src_timeout;
@ -127,8 +127,8 @@ bool afxEA_Projectile::ea_start()
projectile->dynamicCollisionMask = afx_projectile_data->dynamicCollisionMask;
projectile->staticCollisionMask = afx_projectile_data->staticCollisionMask;
}
afxConstraintID launch_pos_id = cons_mgr->getConstraintId(afx_projectile_data->launch_pos_def);
launch_cons = cons_mgr->getConstraint(launch_pos_id);
afxConstraintID launch_pos_id = mCons_mgr->getConstraintId(afx_projectile_data->launch_pos_def);
launch_cons = mCons_mgr->getConstraint(launch_pos_id);
launch_dir_bias = afx_projectile_data->launch_dir_bias;
}
@ -141,7 +141,7 @@ bool afxEA_Projectile::ea_update(F32 dt)
{
if (!launched && projectile)
{
if (in_scope)
if (mIn_scope)
{
afxConstraint* pos_cons = getPosConstraint();
ShapeBase* src_obj = (pos_cons) ? (dynamic_cast<ShapeBase*>(pos_cons->getSceneObject())) : 0;
@ -155,19 +155,19 @@ bool afxEA_Projectile::ea_update(F32 dt)
{
case afxProjectileData::OrientConstraint:
dir_vec.set(0,0,1);
updated_xfm.mulV(dir_vec);
mUpdated_xfm.mulV(dir_vec);
break;
case afxProjectileData::LaunchDirField:
dir_vec.set(0,0,1);
break;
case afxProjectileData::TowardPos2Constraint:
default:
dir_vec = updated_aim - updated_pos;
dir_vec = mUpdated_aim - mUpdated_pos;
break;
}
}
else
dir_vec = updated_aim - updated_pos;
dir_vec = mUpdated_aim - mUpdated_pos;
dir_vec.normalizeSafe();
if (!launch_dir_bias.isZero())
@ -184,7 +184,7 @@ bool afxEA_Projectile::ea_update(F32 dt)
projectile->init(launch_pos, dir_vec, (launch_obj) ? launch_obj : src_obj);
}
else
projectile->init(updated_pos, dir_vec, src_obj);
projectile->init(mUpdated_pos, dir_vec, src_obj);
if (!projectile->registerObject())
{
@ -197,7 +197,7 @@ bool afxEA_Projectile::ea_update(F32 dt)
deleteNotify(projectile);
if (projectile)
projectile->setDataField(StringTable->insert("afxOwner"), 0, choreographer->getIdString());
projectile->setDataField(StringTable->insert("afxOwner"), 0, mChoreographer->getIdString());
}
launched = true;
@ -205,10 +205,10 @@ bool afxEA_Projectile::ea_update(F32 dt)
if (launched && projectile)
{
if (in_scope)
if (mIn_scope)
{
updated_xfm = projectile->getRenderTransform();
updated_xfm.getColumn(3, &updated_pos);
mUpdated_xfm = projectile->getRenderTransform();
mUpdated_xfm.getColumn(3, &mUpdated_pos);
}
}
@ -247,7 +247,7 @@ void afxEA_Projectile::do_runtime_substitutions()
afxProjectileData* orig_db = (afxProjectileData*)projectile_data;
afx_projectile_data = new afxProjectileData(*orig_db, true);
projectile_data = afx_projectile_data;
orig_db->performSubstitutions(projectile_data, choreographer, group_index);
orig_db->performSubstitutions(projectile_data, mChoreographer, mGroup_index);
}
else
{
@ -255,7 +255,7 @@ void afxEA_Projectile::do_runtime_substitutions()
ProjectileData* orig_db = projectile_data;
afx_projectile_data = 0;
projectile_data = new ProjectileData(*orig_db, true);
orig_db->performSubstitutions(projectile_data, choreographer, group_index);
orig_db->performSubstitutions(projectile_data, mChoreographer, mGroup_index);
}
}
}

View file

@ -91,10 +91,10 @@ bool afxEA_ScriptEvent::ea_start()
bool afxEA_ScriptEvent::ea_update(F32 dt)
{
if (!ran_script && choreographer != NULL)
if (!ran_script && mChoreographer != NULL)
{
afxConstraint* pos_constraint = getPosConstraint();
choreographer->executeScriptEvent(script_data->method_name, pos_constraint, updated_xfm,
mChoreographer->executeScriptEvent(script_data->method_name, pos_constraint, mUpdated_xfm,
script_data->script_data);
ran_script = true;
}
@ -115,7 +115,7 @@ void afxEA_ScriptEvent::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxScriptEventData* orig_db = script_data;
script_data = new afxScriptEventData(*orig_db, true);
orig_db->performSubstitutions(script_data, choreographer, group_index);
orig_db->performSubstitutions(script_data, mChoreographer, mGroup_index);
}
}

View file

@ -108,15 +108,15 @@ bool afxEA_Sound::ea_update(F32 dt)
{
if (!sound_handle)
{
sound_handle = SFX->createSource(sound_prof, &updated_xfm, 0);
sound_handle = SFX->createSource(sound_prof, &mUpdated_xfm, 0);
if (sound_handle)
sound_handle->play();
}
if (sound_handle)
{
sound_handle->setTransform(updated_xfm);
sound_handle->setVolume((in_scope) ? updated_scale.x*fade_value : 0.0f);
sound_handle->setTransform(mUpdated_xfm);
sound_handle->setVolume((mIn_scope) ? mUpdated_scale.x*mFade_value : 0.0f);
deleteNotify(sound_handle);
}
@ -134,7 +134,7 @@ void afxEA_Sound::ea_finish(bool was_stopped)
void afxEA_Sound::do_runtime_substitutions()
{
sound_prof = sound_prof->cloneAndPerformSubstitutions(choreographer, group_index);
sound_prof = sound_prof->cloneAndPerformSubstitutions(mChoreographer, mGroup_index);
sound_desc = sound_prof->getDescription();
}
@ -150,7 +150,7 @@ void afxEA_Sound::onDeleteNotify(SimObject* obj)
class afxEA_SoundDesc : public afxEffectAdapterDesc, public afxEffectDefs
{
static afxEA_SoundDesc desc;
static afxEA_SoundDesc mDesc;
public:
virtual bool testEffectType(const SimDataBlock*) const;
@ -162,7 +162,7 @@ public:
virtual afxEffectWrapper* create() const { return new afxEA_Sound; }
};
afxEA_SoundDesc afxEA_SoundDesc::desc;
afxEA_SoundDesc afxEA_SoundDesc::mDesc;
bool afxEA_SoundDesc::testEffectType(const SimDataBlock* db) const
{

View file

@ -66,10 +66,10 @@ public:
class SpotLightProxy : public SpotLight
{
F32 fade_amt;
F32 mFade_amt;
public:
SpotLightProxy() { fade_amt = 1.0f; }
SpotLightProxy() { mFade_amt = 1.0f; }
void force_ghost()
{
@ -79,7 +79,7 @@ public:
void setFadeAmount(F32 fade_amt)
{
this->fade_amt = fade_amt;
mFade_amt = fade_amt;
mLight->setBrightness(mBrightness*fade_amt);
}
@ -130,10 +130,10 @@ public:
void submitLights(LightManager* lm, bool staticLighting)
{
if (mAnimState.active && mAnimationData && fade_amt < 1.0f)
if (mAnimState.active && mAnimationData && mFade_amt < 1.0f)
{
F32 mBrightness_save = mBrightness;
mBrightness *= fade_amt;
mBrightness *= mFade_amt;
SpotLight::submitLights(lm, staticLighting);
mBrightness = mBrightness_save;
return;
@ -207,12 +207,12 @@ bool afxEA_T3DSpotLight::ea_update(F32 dt)
light->setConstraintObject(cons_obj);
#endif
light->setLiveColor(updated_color);
light->setLiveColor(mUpdated_color);
if (do_fades)
light->setFadeAmount(fade_value);
if (mDo_fades)
light->setFadeAmount(mFade_value);
light->updateTransform(updated_xfm);
light->updateTransform(mUpdated_xfm);
// scale should not be updated this way. It messes up the culling.
//light->setScale(updated_scale);
@ -258,7 +258,7 @@ void afxEA_T3DSpotLight::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxT3DSpotLightData* orig_db = light_data;
light_data = new afxT3DSpotLightData(*orig_db, true);
orig_db->performSubstitutions(light_data, choreographer, group_index);
orig_db->performSubstitutions(light_data, mChoreographer, mGroup_index);
}
}

View file

@ -97,7 +97,7 @@ bool afxEA_StaticShape::ea_start()
do_runtime_substitutions();
// fades are handled using startFade() calls.
do_fades = false;
mDo_fades = false;
return true;
}
@ -108,8 +108,8 @@ bool afxEA_StaticShape::ea_update(F32 dt)
{
// create and register effect
static_shape = new afxStaticShape();
if (datablock->use_ghost_as_cons_obj && datablock->effect_name != ST_NULLSTRING)
static_shape->init(choreographer->getChoreographerId(), datablock->effect_name);
if (mDatablock->use_ghost_as_cons_obj && mDatablock->effect_name != ST_NULLSTRING)
static_shape->init(mChoreographer->getChoreographerId(), mDatablock->effect_name);
static_shape->onNewDataBlock(shape_data, false);
if (!static_shape->registerObject())
@ -122,26 +122,26 @@ bool afxEA_StaticShape::ea_update(F32 dt)
deleteNotify(static_shape);
registerForCleanup(static_shape);
if (ew_timing.fade_in_time > 0.0f)
static_shape->startFade(ew_timing.fade_in_time, 0, false);
if (mEW_timing.fade_in_time > 0.0f)
static_shape->startFade(mEW_timing.fade_in_time, 0, false);
}
if (static_shape)
{
if (!fade_out_started && elapsed > fade_out_start)
if (!fade_out_started && mElapsed > mFade_out_start)
{
if (!do_spawn)
{
if (ew_timing.fade_out_time > 0.0f)
static_shape->startFade(ew_timing.fade_out_time, 0, true);
if (mEW_timing.fade_out_time > 0.0f)
static_shape->startFade(mEW_timing.fade_out_time, 0, true);
}
fade_out_started = true;
}
if (in_scope)
if (mIn_scope)
{
static_shape->setTransform(updated_xfm);
static_shape->setScale(updated_scale);
static_shape->setTransform(mUpdated_xfm);
static_shape->setScale(mUpdated_scale);
}
}
@ -155,7 +155,7 @@ void afxEA_StaticShape::ea_finish(bool was_stopped)
if (do_spawn)
{
Con::executef(shape_data, "onSpawn", static_shape->getIdString(), datablock->effect_name);
Con::executef(shape_data, "onSpawn", static_shape->getIdString(), mDatablock->effect_name);
clearNotify(static_shape);
}
else
@ -204,13 +204,13 @@ void afxEA_StaticShape::do_runtime_substitutions()
{
afxStaticShapeData* orig_db = (afxStaticShapeData*)shape_data;
shape_data = new afxStaticShapeData(*orig_db, true);
orig_db->performSubstitutions(shape_data, choreographer, group_index);
orig_db->performSubstitutions(shape_data, mChoreographer, mGroup_index);
}
else
{
StaticShapeData* orig_db = shape_data;
shape_data = new StaticShapeData(*orig_db, true);
orig_db->performSubstitutions(shape_data, choreographer, group_index);
orig_db->performSubstitutions(shape_data, mChoreographer, mGroup_index);
}
}
}

View file

@ -108,16 +108,16 @@ F32 afxEA_Zodiac::calc_facing_angle()
inline F32 afxEA_Zodiac::calc_terrain_alt_bias()
{
if (terrain_altitude >= zode_data->altitude_max)
if (mTerrain_altitude >= zode_data->altitude_max)
return 0.0f;
return 1.0f - (terrain_altitude - zode_data->altitude_falloff)/altitude_falloff_range;
return 1.0f - (mTerrain_altitude - zode_data->altitude_falloff)/altitude_falloff_range;
}
inline F32 afxEA_Zodiac::calc_interior_alt_bias()
{
if (interior_altitude >= zode_data->altitude_max)
if (mInterior_altitude >= zode_data->altitude_max)
return 0.0f;
return 1.0f - (interior_altitude - zode_data->altitude_falloff)/altitude_falloff_range;
return 1.0f - (mInterior_altitude - zode_data->altitude_falloff)/altitude_falloff_range;
}
afxEA_Zodiac::afxEA_Zodiac()
@ -170,13 +170,13 @@ bool afxEA_Zodiac::ea_start()
bool afxEA_Zodiac::ea_update(F32 dt)
{
if (!in_scope)
if (!mIn_scope)
return true;
//~~~~~~~~~~~~~~~~~~~~//
// Zodiac Color
zode_color = updated_color;
zode_color = mUpdated_color;
if (live_color_factor > 0.0)
{
@ -190,15 +190,15 @@ bool afxEA_Zodiac::ea_update(F32 dt)
//Con::printf("LIVE-COLOR-FACTOR is ZERO");
}
if (do_fades)
if (mDo_fades)
{
if (fade_value < 0.01f)
if (mFade_value < 0.01f)
return true; // too transparent
if (zode_data->blend_flags == afxZodiacDefs::BLEND_SUBTRACTIVE)
zode_color *= fade_value*live_fade_factor;
zode_color *= mFade_value * mLive_fade_factor;
else
zode_color.alpha *= fade_value*live_fade_factor;
zode_color.alpha *= mFade_value * mLive_fade_factor;
}
if (zode_color.alpha < 0.01f)
@ -208,22 +208,22 @@ bool afxEA_Zodiac::ea_update(F32 dt)
// Zodiac
// scale and grow zode
zode_radius = zode_data->radius_xy*updated_scale.x + life_elapsed*zode_data->growth_rate;
zode_radius = zode_data->radius_xy*mUpdated_scale.x + mLife_elapsed *zode_data->growth_rate;
// zode is growing
if (life_elapsed < zode_data->grow_in_time)
if (mLife_elapsed < zode_data->grow_in_time)
{
F32 t = life_elapsed/zode_data->grow_in_time;
F32 t = mLife_elapsed /zode_data->grow_in_time;
zode_radius = afxEase::eq(t, 0.001f, zode_radius, 0.2f, 0.8f);
}
// zode is shrinking
else if (full_lifetime - life_elapsed < zode_data->shrink_out_time)
else if (mFull_lifetime - mLife_elapsed < zode_data->shrink_out_time)
{
F32 t = (full_lifetime - life_elapsed)/zode_data->shrink_out_time;
F32 t = (mFull_lifetime - mLife_elapsed)/zode_data->shrink_out_time;
zode_radius = afxEase::eq(t, 0.001f, zode_radius, 0.0f, 0.9f);
}
zode_radius *= live_scale_factor;
zode_radius *= mLive_scale_factor;
if (zode_radius < 0.001f)
return true; // too small
@ -238,7 +238,7 @@ bool afxEA_Zodiac::ea_update(F32 dt)
//~~~~~~~~~~~~~~~~~~~~//
// Zodiac Position
zode_pos = updated_pos;
zode_pos = mUpdated_pos;
//~~~~~~~~~~~~~~~~~~~~//
// Zodiac Rotation
@ -249,7 +249,7 @@ bool afxEA_Zodiac::ea_update(F32 dt)
if (orient_constraint)
{
VectorF shape_vec;
updated_xfm.getColumn(1, &shape_vec);
mUpdated_xfm.getColumn(1, &shape_vec);
shape_vec.z = 0.0f;
shape_vec.normalize();
F32 pitch, yaw;
@ -258,14 +258,14 @@ bool afxEA_Zodiac::ea_update(F32 dt)
}
}
zode_angle = zode_data->calcRotationAngle(life_elapsed, datablock->rate_factor/prop_time_factor);
zode_angle = zode_data->calcRotationAngle(mLife_elapsed, mDatablock->rate_factor/ mProp_time_factor);
zode_angle = mFmod(zode_angle + zode_angle_offset, 360.0f);
//~~~~~~~~~~~~~~~~~~~~//
// post zodiac
if ((zode_data->zflags & afxZodiacDefs::SHOW_ON_TERRAIN) != 0)
{
if (do_altitude_bias && terrain_altitude > zode_data->altitude_falloff)
if (do_altitude_bias && mTerrain_altitude > zode_data->altitude_falloff)
{
F32 alt_bias = calc_terrain_alt_bias();
if (alt_bias > 0.0f)
@ -287,7 +287,7 @@ bool afxEA_Zodiac::ea_update(F32 dt)
if ((zode_data->zflags & afxZodiacDefs::SHOW_ON_INTERIORS) != 0)
{
if (do_altitude_bias && interior_altitude > zode_data->altitude_falloff)
if (do_altitude_bias && mInterior_altitude > zode_data->altitude_falloff)
{
F32 alt_bias = calc_interior_alt_bias();
if (alt_bias > 0.0f)
@ -310,17 +310,17 @@ bool afxEA_Zodiac::ea_update(F32 dt)
void afxEA_Zodiac::ea_finish(bool was_stopped)
{
if (in_scope && ew_timing.residue_lifetime > 0)
if (mIn_scope && mEW_timing.residue_lifetime > 0)
{
if (do_fades)
if (mDo_fades)
{
if (fade_value < 0.01f)
if (mFade_value < 0.01f)
return;
zode_color.alpha *= fade_value;
zode_color.alpha *= mFade_value;
}
if ((zode_data->zflags & afxZodiacDefs::SHOW_ON_TERRAIN) != 0)
{
if (do_altitude_bias && terrain_altitude > zode_data->altitude_falloff)
if (do_altitude_bias && mTerrain_altitude > zode_data->altitude_falloff)
{
F32 alt_bias = calc_terrain_alt_bias();
if (alt_bias > 0.0f)
@ -332,20 +332,20 @@ void afxEA_Zodiac::ea_finish(bool was_stopped)
if (zode_data->altitude_fades)
zode_color.alpha *= alt_bias;
became_residue = true;
afxResidueMgr::add_terrain_zodiac(ew_timing.residue_lifetime, ew_timing.residue_fadetime, zode_data, zode_pos, alt_rad,
afxResidueMgr::add_terrain_zodiac(mEW_timing.residue_lifetime, mEW_timing.residue_fadetime, zode_data, zode_pos, alt_rad,
alt_clr, zode_angle);
}
}
else
{
became_residue = true;
afxResidueMgr::add_terrain_zodiac(ew_timing.residue_lifetime, ew_timing.residue_fadetime, zode_data, zode_pos, zode_radius,
afxResidueMgr::add_terrain_zodiac(mEW_timing.residue_lifetime, mEW_timing.residue_fadetime, zode_data, zode_pos, zode_radius,
zode_color, zode_angle);
}
}
if ((zode_data->zflags & afxZodiacDefs::SHOW_ON_INTERIORS) != 0)
{
if (do_altitude_bias && interior_altitude > zode_data->altitude_falloff)
if (do_altitude_bias && mInterior_altitude > zode_data->altitude_falloff)
{
F32 alt_bias = calc_interior_alt_bias();
if (alt_bias > 0.0f)
@ -361,7 +361,7 @@ void afxEA_Zodiac::ea_finish(bool was_stopped)
if (became_residue)
temp_zode = new afxZodiacData(*zode_data, true);
became_residue = true;
afxResidueMgr::add_interior_zodiac(ew_timing.residue_lifetime, ew_timing.residue_fadetime, temp_zode, zode_pos, alt_rad,
afxResidueMgr::add_interior_zodiac(mEW_timing.residue_lifetime, mEW_timing.residue_fadetime, temp_zode, zode_pos, alt_rad,
zode_vrange, alt_clr, zode_angle);
}
@ -372,7 +372,7 @@ void afxEA_Zodiac::ea_finish(bool was_stopped)
if (became_residue)
temp_zode = new afxZodiacData(*zode_data, true);
became_residue = true;
afxResidueMgr::add_interior_zodiac(ew_timing.residue_lifetime, ew_timing.residue_fadetime, temp_zode, zode_pos, zode_radius,
afxResidueMgr::add_interior_zodiac(mEW_timing.residue_lifetime, mEW_timing.residue_fadetime, temp_zode, zode_pos, zode_radius,
zode_vrange, zode_color, zode_angle);
}
}
@ -387,7 +387,7 @@ void afxEA_Zodiac::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxZodiacData* orig_db = zode_data;
zode_data = new afxZodiacData(*orig_db, true);
orig_db->performSubstitutions(zode_data, choreographer, group_index);
orig_db->performSubstitutions(zode_data, mChoreographer, mGroup_index);
}
}

View file

@ -174,42 +174,42 @@ bool afxEA_ZodiacPlane::ea_update(F32 dt)
if (pzode)
{
//LinearColorF zode_color = zode_data->color;
LinearColorF zode_color = updated_color;
LinearColorF zode_color = mUpdated_color;
if (live_color_factor > 0.0)
zode_color.interpolate(zode_color, live_color, live_color_factor);
if (do_fades)
if (mDo_fades)
{
if (zode_data->blend_flags == afxZodiacDefs::BLEND_SUBTRACTIVE)
zode_color *= fade_value*live_fade_factor;
zode_color *= mFade_value *mLive_fade_factor;
else
zode_color.alpha *= fade_value*live_fade_factor;
zode_color.alpha *= mFade_value * mLive_fade_factor;
}
// scale and grow zode
//F32 zode_radius = zode_data->radius_xy*updated_scale.x + life_elapsed*zode_data->growth_rate;
F32 zode_radius = zode_data->radius_xy + life_elapsed*zode_data->growth_rate;
F32 zode_radius = zode_data->radius_xy + mLife_elapsed *zode_data->growth_rate;
// zode is growing
if (life_elapsed < zode_data->grow_in_time)
if (mLife_elapsed < zode_data->grow_in_time)
{
F32 t = life_elapsed/zode_data->grow_in_time;
F32 t = mLife_elapsed /zode_data->grow_in_time;
zode_radius = afxEase::eq(t, 0.001f, zode_radius, 0.2f, 0.8f);
}
// zode is shrinking
else if (full_lifetime - life_elapsed < zode_data->shrink_out_time)
else if (mFull_lifetime - mLife_elapsed < zode_data->shrink_out_time)
{
F32 t = (full_lifetime - life_elapsed)/zode_data->shrink_out_time;
F32 t = (mFull_lifetime - mLife_elapsed)/zode_data->shrink_out_time;
zode_radius = afxEase::eq(t, 0.001f, zode_radius, 0.0f, 0.9f);
}
zode_radius *= live_scale_factor;
zode_radius *= mLive_scale_factor;
if (zode_data->respect_ori_cons && !zode_data->use_full_xfm)
{
VectorF shape_vec;
updated_xfm.getColumn(1, &shape_vec);
mUpdated_xfm.getColumn(1, &shape_vec);
shape_vec.normalize();
F32 ang;
@ -246,7 +246,7 @@ bool afxEA_ZodiacPlane::ea_update(F32 dt)
zode_angle_offset = mRadToDeg(ang);
}
F32 zode_angle = zode_data->calcRotationAngle(life_elapsed, datablock->rate_factor/prop_time_factor);
F32 zode_angle = zode_data->calcRotationAngle(mLife_elapsed, mDatablock->rate_factor/ mProp_time_factor);
zode_angle = mFmod(zode_angle + zode_angle_offset, 360.0f);
aa_rot.angle = mDegToRad(zode_angle);
@ -258,13 +258,13 @@ bool afxEA_ZodiacPlane::ea_update(F32 dt)
pzode->setRadius(zode_radius);
if (zode_data->use_full_xfm)
{
updated_xfm.mul(spin_xfm);
pzode->setTransform(updated_xfm);
mUpdated_xfm.mul(spin_xfm);
pzode->setTransform(mUpdated_xfm);
}
else
pzode->setTransform(spin_xfm);
pzode->setPosition(updated_pos);
pzode->setScale(updated_scale);
pzode->setPosition(mUpdated_pos);
pzode->setScale(mUpdated_scale);
}
return true;
@ -307,7 +307,7 @@ void afxEA_ZodiacPlane::do_runtime_substitutions()
// clone the datablock and perform substitutions
afxZodiacPlaneData* orig_db = zode_data;
zode_data = new afxZodiacPlaneData(*orig_db, true);
orig_db->performSubstitutions(zode_data, choreographer, group_index);
orig_db->performSubstitutions(zode_data, mChoreographer, mGroup_index);
}
}

View file

@ -95,7 +95,7 @@ bool afxEA_Force::ea_start()
do_runtime_substitutions();
force_set_mgr = choreographer->getForceSetMgr();
force_set_mgr = mChoreographer->getForceSetMgr();
return true;
}
@ -109,7 +109,7 @@ bool afxEA_Force::ea_update(F32 dt)
{
delete force;
force = 0;
Con::errorf(ConsoleLogEntry::General, "Force effect failed to instantiate. (%s)", datablock->getName());
Con::errorf(ConsoleLogEntry::General, "Force effect failed to instantiate. (%s)", mDatablock->getName());
return false;
}
force->onNewDataBlock(force_data, false);
@ -123,8 +123,8 @@ bool afxEA_Force::ea_update(F32 dt)
if (force) // && in_scope)
{
if (do_fades)
force->setFadeAmount(fade_value);
if (mDo_fades)
force->setFadeAmount(mFade_value);
force->update(dt);
}
@ -145,7 +145,7 @@ void afxEA_Force::ea_finish(bool was_stopped)
void afxEA_Force::do_runtime_substitutions()
{
force_data = force_data->cloneAndPerformSubstitutions(choreographer, group_index);
force_data = force_data->cloneAndPerformSubstitutions(mChoreographer, mGroup_index);
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//

View file

@ -32,21 +32,21 @@
afxForceSet::afxForceSet(const char* name)
{
this->name = (name) ? StringTable->insert(name) : ST_NULLSTRING;
update_dt = 10.0f; // seems like an ok maximum, force-xmods will probably lower it.
elapsed_dt = 0.0f;
elapsed_ms = 0;
num_updates = 0;
last_num_updates = 0;
mName = (name) ? StringTable->insert(name) : ST_NULLSTRING;
mUpdate_dt = 10.0f; // seems like an ok maximum, force-xmods will probably lower it.
mElapsed_dt = 0.0f;
mElapsed_ms = 0;
mNum_updates = 0;
mLast_num_updates = 0;
}
void afxForceSet::remove(afxForce* force)
{
for (S32 i = 0; i < force_v.size(); i++)
for (S32 i = 0; i < mForce_v.size(); i++)
{
if (force_v[i] == force)
if (mForce_v[i] == force)
{
force_v.erase(i);
mForce_v.erase(i);
return;
}
}
@ -56,23 +56,23 @@ S32 afxForceSet::updateDT(F32 dt)
{
U32 now = Platform::getVirtualMilliseconds();
if (elapsed_ms == now)
return last_num_updates;
if (mElapsed_ms == now)
return mLast_num_updates;
elapsed_ms = now;
elapsed_dt += dt;
mElapsed_ms = now;
mElapsed_dt += dt;
if (elapsed_dt < update_dt)
if (mElapsed_dt < mUpdate_dt)
{
last_num_updates = 0;
mLast_num_updates = 0;
return 0;
}
num_updates = mFloor(elapsed_dt/update_dt);
elapsed_dt -= update_dt*num_updates;
last_num_updates = num_updates;
mNum_updates = mFloor(mElapsed_dt/mUpdate_dt);
mElapsed_dt -= mUpdate_dt*mNum_updates;
mLast_num_updates = mNum_updates;
return num_updates;
return mNum_updates;
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//

View file

@ -32,28 +32,28 @@ class afxForce;
class afxForceSet
{
Vector<afxForce*> force_v;
StringTableEntry name;
Vector<afxForce*> mForce_v;
StringTableEntry mName;
// tick-based updating
F32 update_dt; // constant update interval, in seconds
F32 elapsed_dt; // runtime elapsed delta, in seconds
U32 elapsed_ms;
S32 num_updates;
S32 last_num_updates;
F32 mUpdate_dt; // constant update interval, in seconds
F32 mElapsed_dt; // runtime elapsed delta, in seconds
U32 mElapsed_ms;
S32 mNum_updates;
S32 mLast_num_updates;
public:
/*C*/ afxForceSet(const char* name=0);
void add(afxForce* force) { force_v.push_back(force); }
void add(afxForce* force) { mForce_v.push_back(force); }
void remove(afxForce* force);
S32 count() { return force_v.size(); }
afxForce* getForce(S32 idx) { return force_v[idx]; }
const char* getName() const { return name; }
S32 count() { return mForce_v.size(); }
afxForce* getForce(S32 idx) { return mForce_v[idx]; }
const char* getName() const { return mName; }
void setUpdateDT(F32 update_dt) { this->update_dt = update_dt; }
F32 getUpdateDT() { return update_dt; }
void setUpdateDT(F32 update_dt) { mUpdate_dt = update_dt; }
F32 getUpdateDT() { return mUpdate_dt; }
S32 updateDT(F32 dt);
};

View file

@ -29,7 +29,7 @@
#include "afx/util/afxPath3D.h"
afxPath3D::afxPath3D() : start_time(0), num_points(0), loop_type(LOOP_CONSTANT)
afxPath3D::afxPath3D() : mStart_time(0), mNum_points(0), mLoop_type(LOOP_CONSTANT)
{
}
@ -39,88 +39,88 @@ afxPath3D::~afxPath3D()
void afxPath3D::sortAll()
{
curve.sort();
curve_parameters.sort();
mCurve.sort();
mCurve_parameters.sort();
}
void afxPath3D::setStartTime( F32 time )
{
start_time = time;
mStart_time = time;
}
void afxPath3D::setLoopType( U32 loop_type )
{
this->loop_type = loop_type;
mLoop_type = loop_type;
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
F32 afxPath3D::getEndTime()
{
return end_time;
return mEnd_time;
}
int afxPath3D::getNumPoints()
{
return num_points;
return mNum_points;
}
Point3F afxPath3D::getPointPosition( int index )
{
if (index < 0 || index >= num_points)
if (index < 0 || index >= mNum_points)
return Point3F(0.0f, 0.0f, 0.0f);
return curve.getPoint(index);
return mCurve.getPoint(index);
}
F32 afxPath3D::getPointTime( int index )
{
if (index < 0 || index >= num_points)
if (index < 0 || index >= mNum_points)
return 0.0f;
return curve_parameters.getKeyTime(index);
return mCurve_parameters.getKeyTime(index);
}
F32 afxPath3D::getPointParameter( int index )
{
if (index < 0 || index >= num_points)
if (index < 0 || index >= mNum_points)
return 0.0f;
return curve_parameters.getKeyValue(index);
return mCurve_parameters.getKeyValue(index);
}
Point2F afxPath3D::getParameterSegment( F32 time )
{
return curve_parameters.getSegment(time);
return mCurve_parameters.getSegment(time);
}
void afxPath3D::setPointPosition( int index, Point3F &p )
{
if (index < 0 || index >= num_points)
if (index < 0 || index >= mNum_points)
return;
curve.setPoint(index, p);
mCurve.setPoint(index, p);
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
F32 afxPath3D::calcCurveTime( F32 time )
{
if( time <= start_time )
if( time <= mStart_time )
return 0.0f;
if( time <= end_time )
return time-start_time;
if( time <= mEnd_time )
return time-mStart_time;
switch( loop_type )
switch( mLoop_type )
{
case LOOP_CYCLE :
{
return mFmod( time-start_time, end_time-start_time );
return mFmod( time-mStart_time, mEnd_time-mStart_time );
}
case LOOP_OSCILLATE :
{
F32 t1 = time-start_time;
F32 t2 = end_time-start_time;
F32 t1 = time- mStart_time;
F32 t2 = mEnd_time - mStart_time;
if( (int)(t1/t2) % 2 ) // odd segment
return t2 - mFmod( t1, t2 );
@ -129,26 +129,26 @@ F32 afxPath3D::calcCurveTime( F32 time )
}
case LOOP_CONSTANT :
default:
return end_time;
return mEnd_time;
}
}
Point3F afxPath3D::evaluateAtTime( F32 time )
{
F32 ctime = calcCurveTime( time );
F32 param = curve_parameters.evaluate( ctime );
return curve.evaluate(param);
F32 param = mCurve_parameters.evaluate( ctime );
return mCurve.evaluate(param);
}
Point3F afxPath3D::evaluateAtTime(F32 t0, F32 t1)
{
F32 ctime = calcCurveTime(t0);
F32 param = curve_parameters.evaluate( ctime );
Point3F p0 = curve.evaluate(param);
F32 param = mCurve_parameters.evaluate( ctime );
Point3F p0 = mCurve.evaluate(param);
ctime = calcCurveTime(t1);
param = curve_parameters.evaluate( ctime );
Point3F p1 = curve.evaluate(param);
param = mCurve_parameters.evaluate( ctime );
Point3F p1 = mCurve.evaluate(param);
return p1-p0;
}
@ -156,21 +156,21 @@ Point3F afxPath3D::evaluateAtTime(F32 t0, F32 t1)
Point3F afxPath3D::evaluateTangentAtTime( F32 time )
{
F32 ctime = calcCurveTime( time );
F32 param = curve_parameters.evaluate( ctime );
return curve.evaluateTangent(param);
F32 param = mCurve_parameters.evaluate( ctime );
return mCurve.evaluateTangent(param);
}
Point3F afxPath3D::evaluateTangentAtPoint( int index )
{
F32 param = curve_parameters.getKeyValue(index);
return curve.evaluateTangent(param);
F32 param = mCurve_parameters.getKeyValue(index);
return mCurve.evaluateTangent(param);
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
void afxPath3D::buildPath( int num_points, Point3F curve_points[], F32 start_time, F32 end_time )
{
this->num_points = num_points;
mNum_points = num_points;
// Add points to path
F32 param_inc = 1.0f / (F32)(num_points - 1);
@ -179,10 +179,10 @@ void afxPath3D::buildPath( int num_points, Point3F curve_points[], F32 start_tim
{
if( i == num_points-1 )
param = 1.0f;
curve.addPoint( param, curve_points[i] );
mCurve.addPoint( param, curve_points[i] );
}
curve.computeTangents();
mCurve.computeTangents();
initPathParametersNEW( curve_points, start_time, end_time );
@ -191,7 +191,7 @@ void afxPath3D::buildPath( int num_points, Point3F curve_points[], F32 start_tim
void afxPath3D::buildPath( int num_points, Point3F curve_points[], F32 speed )
{
this->num_points = num_points;
mNum_points = num_points;
// Add points to path
F32 param_inc = 1.0f / (F32)(num_points - 1);
@ -200,7 +200,7 @@ void afxPath3D::buildPath( int num_points, Point3F curve_points[], F32 speed )
{
if( i == num_points-1 )
param = 1.0f;
curve.addPoint( param, curve_points[i] );
mCurve.addPoint( param, curve_points[i] );
}
initPathParameters( curve_points, speed );
@ -211,7 +211,7 @@ void afxPath3D::buildPath( int num_points, Point3F curve_points[], F32 speed )
void afxPath3D::buildPath( int num_points, Point3F curve_points[],
F32 point_times[], F32 time_offset, F32 time_factor )
{
this->num_points = num_points;
mNum_points = num_points;
// Add points to path
F32 param_inc = 1.0f / (F32)(num_points - 1);
@ -220,20 +220,20 @@ void afxPath3D::buildPath( int num_points, Point3F curve_points[],
{
if( i == num_points-1 )
param = 1.0f;
curve.addPoint( param, curve_points[i] );
mCurve.addPoint( param, curve_points[i] );
curve_parameters.addKey( (point_times[i]+time_offset)*time_factor, param );
mCurve_parameters.addKey( (point_times[i]+time_offset)*time_factor, param );
}
// Set end time
end_time = (point_times[num_points-1]+time_offset)*time_factor;
mEnd_time = (point_times[num_points-1]+time_offset)*time_factor;
sortAll();
}
void afxPath3D::buildPath( int num_points, Point3F curve_points[], Point2F curve_params[] )
{
this->num_points = num_points;
mNum_points = num_points;
// Add points to path
F32 param_inc = 1.0f / (F32)(num_points - 1);
@ -242,22 +242,22 @@ void afxPath3D::buildPath( int num_points, Point3F curve_points[], Point2F curve
{
if( i == num_points-1 )
param = 1.0f;
curve.addPoint( param, curve_points[i] );
mCurve.addPoint( param, curve_points[i] );
}
//
for (int i = 0; i < num_points; i++)
curve_parameters.addKey( curve_params[i] );
mCurve_parameters.addKey( curve_params[i] );
// Set end time
end_time = curve_params[num_points - 1].x;
mEnd_time = curve_params[num_points - 1].x;
sortAll();
}
void afxPath3D::reBuildPath()
{
curve.computeTangents();
mCurve.computeTangents();
sortAll();
}
@ -265,7 +265,7 @@ void afxPath3D::initPathParameters( Point3F curve_points[], F32 speed )
{
// Compute the time for each point dependent on the speed of the character and the
// distance it must travel (approximately!)
int num_segments = num_points - 1;
int num_segments = mNum_points - 1;
F32 *point_distances = new F32[num_segments];
for( int i = 0; i < num_segments; i++ )
{
@ -283,14 +283,14 @@ void afxPath3D::initPathParameters( Point3F curve_points[], F32 speed )
last_time = times[i];
}
curve_parameters.addKey( 0, 0.0f );//start_time, 0.0f );
F32 param_inc = 1.0f / (F32)(num_points - 1);
mCurve_parameters.addKey( 0, 0.0f );//start_time, 0.0f );
F32 param_inc = 1.0f / (F32)(mNum_points - 1);
F32 param = 0.0f + param_inc;
for( int i = 0; i < num_segments; i++, param += param_inc )
curve_parameters.addKey( times[i], param );
mCurve_parameters.addKey( times[i], param );
// Set end time
end_time = times[num_segments-1];
mEnd_time = times[num_segments-1];
if (point_distances)
delete [] point_distances;
@ -300,7 +300,7 @@ void afxPath3D::initPathParameters( Point3F curve_points[], F32 speed )
void afxPath3D::initPathParametersNEW( Point3F curve_points[], F32 start_time, F32 end_time )
{
int num_segments = num_points - 1;
int num_segments = mNum_points - 1;
F32 *point_distances = new F32[num_segments];
F32 total_distance = 0.0f;
for( int i = 0; i < num_segments; i++ )
@ -315,19 +315,19 @@ void afxPath3D::initPathParametersNEW( Point3F curve_points[], F32 start_time, F
F32 duration = end_time - start_time;
F32 time = 0.0f; //start_time;
curve_parameters.addKey( time, 0.0f );
F32 param_inc = 1.0f / (F32)(num_points - 1);
mCurve_parameters.addKey( time, 0.0f );
F32 param_inc = 1.0f / (F32)(mNum_points - 1);
F32 param = 0.0f + param_inc;
for( int i=0; i < num_segments; i++, param += param_inc )
{
time += (point_distances[i]/total_distance) * duration;
curve_parameters.addKey( time, param );
mCurve_parameters.addKey( time, param );
}
// Set end time ????
//end_time = time;
this->start_time = start_time;
this->end_time = end_time;
mStart_time = start_time;
mEnd_time = end_time;
if (point_distances)
delete [] point_distances;
@ -336,7 +336,7 @@ void afxPath3D::initPathParametersNEW( Point3F curve_points[], F32 start_time, F
void afxPath3D::print()
{
// curve.print();
curve_parameters.print();
mCurve_parameters.print();
}
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//

View file

@ -37,13 +37,13 @@ class afxPath3D : public EngineObject
{
private:
// Path-related data
afxCurve3D curve;
afxAnimCurve curve_parameters;
int num_points;
afxCurve3D mCurve;
afxAnimCurve mCurve_parameters;
int mNum_points;
// Time data
F32 start_time;
F32 end_time;
F32 mStart_time;
F32 mEnd_time;
public:
/*C*/ afxPath3D( );
@ -83,7 +83,7 @@ public:
LOOP_OSCILLATE
};
U32 loop_type;
U32 mLoop_type;
void setLoopType(U32);
private:

View file

@ -60,13 +60,13 @@ class afxXM_AltitudeConform : public afxXM_WeightedBase
{
typedef afxXM_WeightedBase Parent;
afxXM_AltitudeConformData* db;
SceneContainer* container;
bool do_freeze;
bool is_frozen;
F32 terrain_alt;
F32 interior_alt;
Point3F conformed_pos;
afxXM_AltitudeConformData* mConformData;
SceneContainer* mContainer;
bool mDo_freeze;
bool mIs_frozen;
F32 mTerrain_alt;
F32 mInterior_alt;
Point3F mConformed_pos;
public:
/*C*/ afxXM_AltitudeConform(afxXM_AltitudeConformData*, afxEffectWrapper*, bool on_server);
@ -157,24 +157,24 @@ afxXM_Base* afxXM_AltitudeConformData::create(afxEffectWrapper* fx, bool on_serv
afxXM_AltitudeConform::afxXM_AltitudeConform(afxXM_AltitudeConformData* db, afxEffectWrapper* fxw, bool on_server)
: afxXM_WeightedBase(db, fxw)
{
this->db = db;
container = (on_server) ? &gServerContainer : &gClientContainer;
do_freeze = db->do_freeze;
is_frozen = false;
terrain_alt = -1.0f;
interior_alt = -1.0f;
conformed_pos.zero();
mConformData = db;
mContainer = (on_server) ? &gServerContainer : &gClientContainer;
mDo_freeze = db->do_freeze;
mIs_frozen = false;
mTerrain_alt = -1.0f;
mInterior_alt = -1.0f;
mConformed_pos.zero();
}
void afxXM_AltitudeConform::updateParams(F32 dt, F32 elapsed, afxXM_Params& params)
{
if (is_frozen)
if (mIs_frozen)
{
if (terrain_alt >= 0.0f)
fx_wrapper->setTerrainAltitude(terrain_alt);
if (interior_alt >= 0.0f)
fx_wrapper->setInteriorAltitude(interior_alt);
params.pos = conformed_pos;
if (mTerrain_alt >= 0.0f)
fx_wrapper->setTerrainAltitude(mTerrain_alt);
if (mInterior_alt >= 0.0f)
fx_wrapper->setInteriorAltitude(mInterior_alt);
params.pos = mConformed_pos;
return;
}
@ -185,53 +185,51 @@ void afxXM_AltitudeConform::updateParams(F32 dt, F32 elapsed, afxXM_Params& para
// find primary ground
Point3F above_pos(params.pos); above_pos.z += 0.1f;
Point3F below_pos(params.pos); below_pos.z -= 10000;
hit1 = container->castRay(above_pos, below_pos, db->interior_types | db->terrain_types, &rInfo1);
hit1 = mContainer->castRay(above_pos, below_pos, mConformData->interior_types | mConformData->terrain_types, &rInfo1);
// find secondary ground
if (hit1 && rInfo1.object)
{
hit1_is_interior = ((rInfo1.object->getTypeMask() & db->interior_types) != 0);
U32 mask = (hit1_is_interior) ? db->terrain_types : db->interior_types;
Point3F above_pos(params.pos); above_pos.z += 0.1f;
Point3F below_pos(params.pos); below_pos.z -= 10000;
hit2 = container->castRay(above_pos, below_pos, mask, &rInfo2);
hit1_is_interior = ((rInfo1.object->getTypeMask() & mConformData->interior_types) != 0);
U32 mask = (hit1_is_interior) ? mConformData->terrain_types : mConformData->interior_types;
hit2 = mContainer->castRay(above_pos, below_pos, mask, &rInfo2);
}
if (hit1)
{
F32 wt_factor = calc_weight_factor(elapsed);
F32 incoming_z = params.pos.z;
F32 ground1_z = rInfo1.point.z + db->height;
F32 ground1_z = rInfo1.point.z + mConformData->height;
F32 pos_z = ground1_z + (1.0f - wt_factor)*(incoming_z - ground1_z);
if (hit1_is_interior)
{
interior_alt = incoming_z - pos_z;
fx_wrapper->setInteriorAltitude(interior_alt);
if (db->do_interiors)
mInterior_alt = incoming_z - pos_z;
fx_wrapper->setInteriorAltitude(mInterior_alt);
if (mConformData->do_interiors)
params.pos.z = pos_z;
}
else
{
terrain_alt = incoming_z - pos_z;
fx_wrapper->setTerrainAltitude(terrain_alt);
if (db->do_terrain)
mTerrain_alt = incoming_z - pos_z;
fx_wrapper->setTerrainAltitude(mTerrain_alt);
if (mConformData->do_terrain)
params.pos.z = pos_z;
}
if (hit2)
{
F32 ground2_z = rInfo2.point.z + db->height;
F32 ground2_z = rInfo2.point.z + mConformData->height;
F32 z2 = ground2_z + (1.0f - wt_factor)*(incoming_z - ground2_z);
if (hit1_is_interior)
{
terrain_alt = incoming_z - z2;
fx_wrapper->setTerrainAltitude(terrain_alt);
mTerrain_alt = incoming_z - z2;
fx_wrapper->setTerrainAltitude(mTerrain_alt);
}
else
{
interior_alt = incoming_z - z2;
fx_wrapper->setInteriorAltitude(interior_alt);
mInterior_alt = incoming_z - z2;
fx_wrapper->setInteriorAltitude(mInterior_alt);
}
}
@ -241,19 +239,19 @@ void afxXM_AltitudeConform::updateParams(F32 dt, F32 elapsed, afxXM_Params& para
RayInfo rInfo0;
Point3F lookup_from_pos(params.pos); lookup_from_pos.z -= 0.1f;
Point3F lookup_to_pos(params.pos); lookup_to_pos.z += 10000;
if (container->castRay(lookup_from_pos, lookup_to_pos, TerrainObjectType, &rInfo0))
if (mContainer->castRay(lookup_from_pos, lookup_to_pos, TerrainObjectType, &rInfo0))
{
F32 ground2_z = rInfo0.point.z + db->height;
F32 ground2_z = rInfo0.point.z + mConformData->height;
F32 z2 = ground2_z + (1.0f - wt_factor)*(incoming_z - ground2_z);
terrain_alt = z2 - incoming_z;
fx_wrapper->setTerrainAltitude(terrain_alt);
mTerrain_alt = z2 - incoming_z;
fx_wrapper->setTerrainAltitude(mTerrain_alt);
}
}
if (do_freeze)
if (mDo_freeze)
{
conformed_pos = params.pos;
is_frozen = true;
mConformed_pos = params.pos;
mIs_frozen = true;
}
}
}

View file

@ -63,11 +63,11 @@ class afxXM_MountedImageNode : public afxXM_Base
{
typedef afxXM_Base Parent;
StringTableEntry node_name;
U32 image_slot;
S32 node_ID;
ShapeBase* shape;
afxConstraint* cons;
StringTableEntry mNode_name;
U32 mImage_slot;
S32 mNode_ID;
ShapeBase* mShape;
afxConstraint* mCons;
afxConstraint* find_constraint();
@ -163,11 +163,11 @@ afxXM_Base* afxXM_MountedImageNodeData::create(afxEffectWrapper* fx, bool on_ser
afxXM_MountedImageNode::afxXM_MountedImageNode(afxXM_MountedImageNodeData* db, afxEffectWrapper* fxw)
: afxXM_Base(db, fxw)
{
image_slot = db->image_slot;
node_name = db->node_name;
cons = 0;
node_ID = -1;
shape = 0;
mImage_slot = db->image_slot;
mNode_name = db->node_name;
mCons = 0;
mNode_ID = -1;
mShape = 0;
}
// find the first constraint with a shape by checking pos
@ -189,41 +189,41 @@ void afxXM_MountedImageNode::start(F32 timestamp)
{
// constraint won't change over the modifier's
// lifetime so we find it here in start().
cons = find_constraint();
if (!cons)
mCons = find_constraint();
if (!mCons)
Con::errorf(ConsoleLogEntry::General,
"afxXM_MountedImageNode: failed to find a ShapeBase derived constraint source.");
}
void afxXM_MountedImageNode::updateParams(F32 dt, F32 elapsed, afxXM_Params& params)
{
if (!cons)
if (!mCons)
return;
// validate shape
// The shape must be validated in case it gets deleted
// of goes out scope.
SceneObject* scene_object = cons->getSceneObject();
if (scene_object != (SceneObject*)shape)
SceneObject* scene_object = mCons->getSceneObject();
if (scene_object != (SceneObject*)mShape)
{
shape = dynamic_cast<ShapeBase*>(scene_object);
if (shape && node_name != ST_NULLSTRING)
mShape = dynamic_cast<ShapeBase*>(scene_object);
if (mShape && mNode_name != ST_NULLSTRING)
{
node_ID = shape->getNodeIndex(image_slot, node_name);
if (node_ID < 0)
mNode_ID = mShape->getNodeIndex(mImage_slot, mNode_name);
if (mNode_ID < 0)
{
Con::errorf(ConsoleLogEntry::General,
"afxXM_MountedImageNode: failed to find nodeName, \"%s\".",
node_name);
mNode_name);
}
}
else
node_ID = -1;
mNode_ID = -1;
}
if (shape)
if (mShape)
{
shape->getImageTransform(image_slot, node_ID, &params.ori);
mShape->getImageTransform(mImage_slot, mNode_ID, &params.ori);
params.pos = params.ori.getPosition();
}
}

Some files were not shown because too many files have changed in this diff Show more