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 36db8eacc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
233 changed files with 4370 additions and 4418 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1142,7 +1142,7 @@ GroundCoverCell* GroundCover::_generateCell( const Point2I& index,
const F32 typeMaxElevation = mMaxElevation[type]; const F32 typeMaxElevation = mMaxElevation[type];
const F32 typeMinElevation = mMinElevation[type]; const F32 typeMinElevation = mMinElevation[type];
const bool typeIsShape = mShapeInstances[ type ] != NULL; 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]; const F32 typeWindScale = mWindScale[type];
StringTableEntry typeLayer = mLayer[type]; StringTableEntry typeLayer = mLayer[type];
const bool typeInvertLayer = mInvertLayer[type]; const bool typeInvertLayer = mInvertLayer[type];
@ -1184,9 +1184,9 @@ GroundCoverCell* GroundCover::_generateCell( const Point2I& index,
terrainBlock = dynamic_cast< TerrainBlock* >( terrainBlocks.first() ); terrainBlock = dynamic_cast< TerrainBlock* >( terrainBlocks.first() );
else 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 ) if( !terrain )
continue; continue;

View file

@ -412,7 +412,7 @@ void ParticleEmitterData::packData(BitStream* stream)
#if defined(AFX_CAP_PARTICLE_POOLS) #if defined(AFX_CAP_PARTICLE_POOLS)
if (stream->writeFlag(pool_datablock)) 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->write(pool_index);
stream->writeFlag(pool_depth_fade); stream->writeFlag(pool_depth_fade);
stream->writeFlag(pool_radial_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 // Set up our vertex buffer and primitive buffer
if(mUpdateBuffers) if(mUpdateBuffers)
createBuffers(state, verts, primBuffer, segments); createBuffers(state, mVerts, mPrimBuffer, segments);
ri->vertBuff = &verts; ri->vertBuff = &mVerts;
ri->primBuff = &primBuffer; ri->primBuff = &mPrimBuffer;
ri->visibility = 1.0f; ri->visibility = 1.0f;
ri->prim = renderPass->allocPrim(); ri->prim = renderPass->allocPrim();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -358,7 +358,7 @@ bool PhysicsDebris::onAdd()
} }
// Setup our bounding box // Setup our bounding box
mObjBox = mDataBlock->shape->bounds; mObjBox = mDataBlock->shape->mBounds;
resetWorldBox(); resetWorldBox();
// Add it to the client scene. // 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 //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 ); 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(); colShape = PHYSICSMGR->createCollision();
MatrixF centerXfm(true); MatrixF centerXfm(true);
centerXfm.setPosition(shape->bounds.getCenter()); centerXfm.setPosition(shape->mBounds.getCenter());
colShape->addBox(halfWidth, centerXfm); colShape->addBox(halfWidth, centerXfm);
return true; return true;
} }
@ -707,7 +707,7 @@ bool PhysicsShape::_createShape()
return false; return false;
// Set the world box. // Set the world box.
mObjBox = db->shape->bounds; mObjBox = db->shape->mBounds;
resetWorldBox(); resetWorldBox();
// If this is the server and its a client only simulation // If this is the server and its a client only simulation

View file

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

View file

@ -436,7 +436,7 @@ protected:
Point3F rotOffset; 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 S32 mPredictionCount; ///< Number of ticks to predict
// Current pos, vel etc. // Current pos, vel etc.

View file

@ -828,7 +828,7 @@ bool Projectile::onAdd()
// Setup our bounding box // Setup our bounding box
if (bool(mDataBlock->projectileShape) == true) if (bool(mDataBlock->projectileShape) == true)
mObjBox = mDataBlock->projectileShape->bounds; mObjBox = mDataBlock->projectileShape->mBounds;
else else
mObjBox = Box3F(Point3F(0, 0, 0), Point3F(0, 0, 0)); 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 ); MathUtils::getMatrixFromUpVector( normal, &mat );
mat.setPosition( pos + normal * mObjBox.minExtents.z ); mat.setPosition( pos + normal * mObjBox.minExtents.z );
delta.pos = pos; mDelta.pos = pos;
delta.posVec.set(0, 0, 0); mDelta.posVec.set(0, 0, 0);
ShapeBase::setTransform( mat ); ShapeBase::setTransform( mat );
if ( mPhysicsRep ) if ( mPhysicsRep )

View file

@ -1194,7 +1194,7 @@ bool RigidShape::updateCollision(F32 dt)
mCollisionList.clear(); mCollisionList.clear();
CollisionState *state = mConvex.findClosestState(cmat, getScale(), mDataBlock->collisionTol); CollisionState *state = mConvex.findClosestState(cmat, getScale(), mDataBlock->collisionTol);
if (state && state->dist <= mDataBlock->collisionTol) if (state && state->mDist <= mDataBlock->collisionTol)
{ {
//resolveDisplacement(ns,state,dt); //resolveDisplacement(ns,state,dt);
mConvex.getCollisionInfo(cmat, getScale(), &mCollisionList, mDataBlock->collisionTol); 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) bool RigidShape::resolveDisplacement(Rigid& ns,CollisionState *state, F32 dt)
{ {
SceneObject* obj = (state->a->getObject() == this)? SceneObject* obj = (state->mA->getObject() == this)?
state->b->getObject(): state->a->getObject(); state->mB->getObject(): state->mA->getObject();
if (obj->isDisplacable() && ((obj->getTypeMask() & ShapeBaseObjectType) != 0)) 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->computeBounds(collisionDetails.last(), collisionBounds.last());
mShape->getAccelerator(collisionDetails.last()); mShape->getAccelerator(collisionDetails.last());
if (!mShape->bounds.isContained(collisionBounds.last())) if (!mShape->mBounds.isContained(collisionBounds.last()))
{ {
if (!silent_bbox_check) 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()); 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) else if (collisionBounds.last().isValidBox() == false)
{ {
if (!silent_bbox_check) if (!silent_bbox_check)
Con::errorf("Error: shape %s-collision detail %d (Collision-%d) bounds box invalid!", shapeName, collisionDetails.size() - 1, collisionDetails.last()); 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 // 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"); damageSequence = mShape->findSequence("Damage");
// //
F32 w = mShape->bounds.len_y() / 2; F32 w = mShape->mBounds.len_y() / 2;
if (cameraMaxDist < w) if (cameraMaxDist < w)
cameraMaxDist = w; cameraMaxDist = w;
// just parse up the string and collect the remappings in txr_tag_remappings. // 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(); MatrixF mat = txfm.getMatrix();
Box3F objBox = object->mShape->bounds; Box3F objBox = object->mShape->mBounds;
Point3F boxCenter = (objBox.minExtents + objBox.maxExtents) * 0.5f; Point3F boxCenter = (objBox.minExtents + objBox.maxExtents) * 0.5f;
objBox.minExtents = boxCenter + (objBox.minExtents - boxCenter) * 0.9f; objBox.minExtents = boxCenter + (objBox.minExtents - boxCenter) * 0.9f;
objBox.maxExtents = boxCenter + (objBox.maxExtents - 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 ) ) if( stream->writeFlag( debris != NULL ) )
{ {
stream->writeRangedU32(packed? SimObjectId((uintptr_t)debris): stream->writeRangedU32(mPacked? SimObjectId((uintptr_t)debris):
debris->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast); debris->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast);
} }
@ -1275,7 +1275,7 @@ bool ShapeBase::onNewDataBlock( GameBaseData *dptr, bool reload )
} }
} }
mObjBox = mDataBlock->mShape->bounds; mObjBox = mDataBlock->mShape->mBounds;
resetWorldBox(); resetWorldBox();
// Set the initial mesh hidden state. // Set the initial mesh hidden state.
@ -2801,7 +2801,7 @@ void ShapeBase::_renderBoundingBox( ObjectRenderInst *ri, SceneRenderState *stat
MatrixF mat; MatrixF mat;
getRenderImageTransform( ri->objectIndex, &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 ); 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; bool datablockChange = image.dataBlock != imageData;
if (datablockChange || (image.skinNameHandle != skinDesiredNameHandle)) if (datablockChange || (image.skinNameHandle != skinDesiredNameHandle))
{ {
MountedImage& image = mMountedImageList[i]; MountedImage& neoImage = mMountedImageList[i];
image.scriptAnimPrefix = scriptDesiredAnimPrefix; neoImage.scriptAnimPrefix = scriptDesiredAnimPrefix;
setImage( i, imageData, setImage( i, imageData,
skinDesiredNameHandle, image.loaded, skinDesiredNameHandle, neoImage.loaded,
image.ammo, image.triggerDown, image.altTriggerDown, neoImage.ammo, neoImage.triggerDown, neoImage.altTriggerDown,
image.motion, image.genericTrigger[0], image.genericTrigger[1], image.genericTrigger[2], image.genericTrigger[3], neoImage.motion, neoImage.genericTrigger[0], neoImage.genericTrigger[1], neoImage.genericTrigger[2], neoImage.genericTrigger[3],
image.target); neoImage.target);
} }
if (!datablockChange && image.scriptAnimPrefix != scriptDesiredAnimPrefix) if (!datablockChange && image.scriptAnimPrefix != scriptDesiredAnimPrefix)
{ {
// We don't have a new image, but we do have a new script anim prefix to work with. // 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. // Notify the image of this change.
MountedImage& image = mMountedImageList[i]; MountedImage& animImage = mMountedImageList[i];
image.scriptAnimPrefix = scriptDesiredAnimPrefix; animImage.scriptAnimPrefix = scriptDesiredAnimPrefix;
updateAnimThread(i, getImageShapeIndex(image)); updateAnimThread(i, getImageShapeIndex(animImage));
} }
bool isFiring = stream->readFlag(); bool isFiring = stream->readFlag();
@ -3586,8 +3586,8 @@ void ShapeBaseConvex::getFeatures(const MatrixF& mat, const VectorF& n, ConvexFe
U32 numVerts = emitString[currPos++]; U32 numVerts = emitString[currPos++];
for (i = 0; i < numVerts; i++) { for (i = 0; i < numVerts; i++) {
cf->mVertexList.increment(); cf->mVertexList.increment();
U32 index = emitString[currPos++]; U32 vListIDx = emitString[currPos++];
mat.mulP(pAccel->vertexList[index], &cf->mVertexList.last()); mat.mulP(pAccel->vertexList[vListIDx], &cf->mVertexList.last());
} }
U32 numEdges = emitString[currPos++]; U32 numEdges = emitString[currPos++];

View file

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

View file

@ -350,9 +350,9 @@ void MeshRenderSystem::rebuildBuffers()
U16 *pIndex; U16 *pIndex;
buffers.primitiveBuffer.lock(&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++; pIndex++;
} }

View file

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

View file

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

View file

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

View file

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

View file

@ -277,7 +277,7 @@ void VehicleData::packData(BitStream* stream)
stream->write(body.friction); stream->write(body.friction);
for (i = 0; i < Body::MaxSounds; i++) for (i = 0; i < Body::MaxSounds; i++)
if (stream->writeFlag(body.sound[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, body.sound[i]->getId(),DataBlockObjectIdFirst,
DataBlockObjectIdLast); DataBlockObjectIdLast);
@ -1364,7 +1364,7 @@ bool Vehicle::updateCollision(F32 dt)
mCollisionList.clear(); mCollisionList.clear();
CollisionState *state = mConvex.findClosestState(cmat, getScale(), mDataBlock->collisionTol); CollisionState *state = mConvex.findClosestState(cmat, getScale(), mDataBlock->collisionTol);
if (state && state->dist <= mDataBlock->collisionTol) if (state && state->mDist <= mDataBlock->collisionTol)
{ {
//resolveDisplacement(ns,state,dt); //resolveDisplacement(ns,state,dt);
mConvex.getCollisionInfo(cmat, getScale(), &mCollisionList, mDataBlock->collisionTol); mConvex.getCollisionInfo(cmat, getScale(), &mCollisionList, mDataBlock->collisionTol);
@ -1497,8 +1497,8 @@ bool Vehicle::resolveDisplacement(Rigid& ns,CollisionState *state, F32 dt)
{ {
PROFILE_SCOPE( Vehicle_ResolveDisplacement ); PROFILE_SCOPE( Vehicle_ResolveDisplacement );
SceneObject* obj = (state->a->getObject() == this)? SceneObject* obj = (state->mA->getObject() == this)?
state->b->getObject(): state->a->getObject(); state->mB->getObject(): state->mA->getObject();
if (obj->isDisplacable() && ((obj->getTypeMask() & ShapeBaseObjectType) != 0)) 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. // Determinw wheel radius from the shape's bounding box.
// The tire should be built with it's hub axis along the // The tire should be built with it's hub axis along the
// object's Y axis. // object's Y axis.
radius = shape->bounds.len_z() / 2; radius = shape->mBounds.len_z() / 2;
} }
return true; return true;
@ -400,7 +400,7 @@ bool WheeledVehicleData::preload(bool server, String &errorStr)
MatrixF imat(1); MatrixF imat(1);
SphereF sphere; SphereF sphere;
sphere.center = mShape->center; sphere.center = mShape->center;
sphere.radius = mShape->radius; sphere.radius = mShape->mRadius;
PlaneExtractorPolyList polyList; PlaneExtractorPolyList polyList;
polyList.mPlaneList = &rigidBody.mPlaneList; polyList.mPlaneList = &rigidBody.mPlaneList;
polyList.setTransform(&imat, Point3F(1,1,1)); polyList.setTransform(&imat, Point3F(1,1,1));
@ -477,7 +477,7 @@ void WheeledVehicleData::packData(BitStream* stream)
Parent::packData(stream); Parent::packData(stream);
if (stream->writeFlag(tireEmitter)) if (stream->writeFlag(tireEmitter))
stream->writeRangedU32(packed? SimObjectId((uintptr_t)tireEmitter): stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)tireEmitter):
tireEmitter->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast); tireEmitter->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast);
for (S32 i = 0; i < MaxSounds; i++) for (S32 i = 0; i < MaxSounds; i++)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -157,7 +157,7 @@ void afxEffectronData::packData(BitStream* stream)
stream->write(duration); stream->write(duration);
stream->write(n_loops); stream->write(n_loops);
pack_fx(stream, fx_list, packed); pack_fx(stream, fx_list, mPacked);
} }
void afxEffectronData::unpackData(BitStream* stream) void afxEffectronData::unpackData(BitStream* stream)
@ -407,9 +407,9 @@ U32 afxEffectron::packUpdate(NetConnection* conn, U32 mask, BitStream* stream)
if (stream->writeFlag(mask & InitialUpdateMask)) if (stream->writeFlag(mask & InitialUpdateMask))
{ {
// pack extra object's ghost index or scope id if not yet ghosted // 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); S32 ghost_idx = conn->getGhostIndex(net_extra);
if (stream->writeFlag(ghost_idx != -1)) if (stream->writeFlag(ghost_idx != -1))
stream->writeRangedU32(U32(ghost_idx), 0, NetConnection::MaxGhostCount); 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 if (stream->readFlag()) // is ghost_idx
{ {
S32 ghost_idx = stream->readRangedU32(0, NetConnection::MaxGhostCount); 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 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); Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet, bad datablockId(decal): %d", decalId);
*/ */
String errorStr; String sfxErrorStr;
if( !sfxResolve( &sound, errorStr ) ) if( !sfxResolve( &sound, sfxErrorStr) )
Con::errorf(ConsoleLogEntry::General, "afxMagicMissileData::preload: Invalid packet: %s", errorStr.c_str()); Con::errorf(ConsoleLogEntry::General, "afxMagicMissileData::preload: Invalid packet: %s", sfxErrorStr.c_str());
if (!lightDesc && lightDescId != 0) if (!lightDesc && lightDescId != 0)
if (Sim::findObject(lightDescId, lightDesc) == false) if (Sim::findObject(lightDescId, lightDesc) == false)
@ -1117,7 +1117,7 @@ bool afxMagicMissile::onAdd()
// Setup our bounding box // Setup our bounding box
if (bool(mDataBlock->projectileShape) == true) if (bool(mDataBlock->projectileShape) == true)
mObjBox = mDataBlock->projectileShape->bounds; mObjBox = mDataBlock->projectileShape->mBounds;
else else
mObjBox = Box3F(Point3F(0, 0, 0), Point3F(0, 0, 0)); mObjBox = Box3F(Point3F(0, 0, 0), Point3F(0, 0, 0));
resetWorldBox(); resetWorldBox();
@ -1864,7 +1864,7 @@ SceneObject* afxMagicMissile::get_default_launcher() const
if (mDataBlock->reverse_targeting) if (mDataBlock->reverse_targeting)
{ {
if (dynamic_cast<afxMagicSpell*>(choreographer)) if (dynamic_cast<afxMagicSpell*>(choreographer))
launch_cons_obj = ((afxMagicSpell*)choreographer)->target; launch_cons_obj = ((afxMagicSpell*)choreographer)->mTarget;
if (!launch_cons_obj) if (!launch_cons_obj)
{ {
Con::errorf("afxMagicMissile::get_launch_data(): missing target constraint object for reverse targeted missile."); 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 else
{ {
if (dynamic_cast<afxMagicSpell*>(choreographer)) if (dynamic_cast<afxMagicSpell*>(choreographer))
launch_cons_obj = ((afxMagicSpell*)choreographer)->caster; launch_cons_obj = ((afxMagicSpell*)choreographer)->mCaster;
if (!launch_cons_obj) if (!launch_cons_obj)
{ {
Con::errorf("afxMagicMissile::get_launch_data(): missing launch constraint object missile."); Con::errorf("afxMagicMissile::get_launch_data(): missing launch constraint object missile.");
@ -2036,17 +2036,17 @@ void afxMagicMissile::launch()
{ {
if (mDataBlock->reverse_targeting) if (mDataBlock->reverse_targeting)
{ {
missile_target = spell->caster; missile_target = spell->mCaster;
collide_exempt = spell->target; collide_exempt = spell->mTarget;
} }
else else
{ {
missile_target = spell->target; missile_target = spell->mTarget;
collide_exempt = spell->caster; collide_exempt = spell->mCaster;
} }
if (spell->caster) if (spell->mCaster)
processAfter(spell->caster); processAfter(spell->mCaster);
if (missile_target) if (missile_target)
deleteNotify(missile_target); deleteNotify(missile_target);
if (collide_exempt) 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); void validateType(SimObject *object, void *typePtr);
}; };
bool do_id_convert; bool mDo_id_convert;
public: public:
F32 casting_dur; F32 mCasting_dur;
F32 delivery_dur; F32 mDelivery_dur;
F32 linger_dur; F32 mLinger_dur;
// //
S32 n_casting_loops; S32 mNum_casting_loops;
S32 n_delivery_loops; S32 mNum_delivery_loops;
S32 n_linger_loops; S32 mNum_linger_loops;
// //
F32 extra_casting_time; F32 mExtra_casting_time;
F32 extra_delivery_time; F32 mExtra_delivery_time;
F32 extra_linger_time; F32 mExtra_linger_time;
// //
bool do_move_interrupts; bool mDo_move_interrupts;
F32 move_interrupt_speed; F32 mMove_interrupt_speed;
// //
afxMagicMissileData* missile_db; afxMagicMissileData* mMissile_db;
bool launch_on_server_signal; bool mLaunch_on_server_signal;
U32 primary_target_types; U32 mPrimary_target_types;
// //
afxEffectWrapperData* dummy_fx_entry; afxEffectWrapperData* mDummy_fx_entry;
// various effects lists // various effects lists
afxEffectList casting_fx_list; afxEffectList mCasting_fx_list;
afxEffectList launch_fx_list; afxEffectList mLaunch_fx_list;
afxEffectList delivery_fx_list; afxEffectList mDelivery_fx_list;
afxEffectList impact_fx_list; afxEffectList mImpact_fx_list;
afxEffectList linger_fx_list; afxEffectList mLinger_fx_list;
void pack_fx(BitStream* stream, const afxEffectList& fx, bool packed); void pack_fx(BitStream* stream, const afxEffectList& fx, bool packed);
void unpack_fx(BitStream* stream, afxEffectList& fx); void unpack_fx(BitStream* stream, afxEffectList& fx);
@ -222,39 +222,39 @@ private:
static StringTableEntry IMPACTED_OBJECT_CONS; static StringTableEntry IMPACTED_OBJECT_CONS;
private: private:
afxMagicSpellData* datablock; afxMagicSpellData* mDatablock;
SimObject* exeblock; SimObject* mExeblock;
afxMagicMissileData* missile_db; afxMagicMissileData* mMissile_db;
ShapeBase* caster; ShapeBase* mCaster;
SceneObject* target; SceneObject* mTarget;
SimObject* caster_field; SimObject* mCaster_field;
SimObject* target_field; SimObject* mTarget_field;
U16 caster_scope_id; U16 mCaster_scope_id;
U16 target_scope_id; U16 mTarget_scope_id;
bool target_is_shape; bool mTarget_is_shape;
bool constraints_initialized; bool mConstraints_initialized;
bool scoping_initialized; bool mScoping_initialized;
U8 spell_state; U8 mSpell_state;
F32 spell_elapsed; F32 mSpell_elapsed;
afxConstraintID listener_cons_id; afxConstraintID mListener_cons_id;
afxConstraintID caster_cons_id; afxConstraintID mCaster_cons_id;
afxConstraintID target_cons_id; afxConstraintID mTarget_cons_id;
afxConstraintID impacted_cons_id; afxConstraintID mImpacted_cons_id;
afxConstraintID camera_cons_id; afxConstraintID mCamera_cons_id;
SceneObject* camera_cons_obj; SceneObject* mCamera_cons_obj;
afxPhrase* phrases[NUM_PHRASES]; afxPhrase* mPhrases[NUM_PHRASES];
F32 tfactors[NUM_PHRASES]; F32 mTfactors[NUM_PHRASES];
bool notify_castbar; bool mNotify_castbar;
F32 overall_time_factor; F32 mOverall_time_factor;
U16 marks_mask; U16 mMarks_mask;
private: private:
void init(); void init();
@ -278,13 +278,13 @@ protected:
virtual void unpack_constraint_info(NetConnection* conn, BitStream* stream); virtual void unpack_constraint_info(NetConnection* conn, BitStream* stream);
private: private:
afxMagicMissile* missile; afxMagicMissile* mMissile;
bool missile_is_armed; bool mMissile_is_armed;
SceneObject* impacted_obj; SceneObject* mImpacted_obj;
Point3F impact_pos; Point3F mImpact_pos;
Point3F impact_norm; Point3F mImpact_norm;
U16 impacted_scope_id; U16 mImpacted_scope_id;
bool impacted_is_shape; bool mImpacted_is_shape;
void init_missile_s(afxMagicMissileData* mm); void init_missile_s(afxMagicMissileData* mm);
void launch_missile_s(); void launch_missile_s();
@ -353,15 +353,15 @@ public:
void postSpellEvent(U8 event); void postSpellEvent(U8 event);
void resolveTimeFactors(); void resolveTimeFactors();
void setTimeFactor(F32 f) { overall_time_factor = (f > 0) ? f : 1.0f; } void setTimeFactor(F32 f) { mOverall_time_factor = (f > 0) ? f : 1.0f; }
F32 getTimeFactor() { return overall_time_factor; } F32 getTimeFactor() { return mOverall_time_factor; }
void setTimeFactor(U8 phase, F32 f) { tfactors[phase] = (f > 0) ? f : 1.0f; } void setTimeFactor(U8 phase, F32 f) { mTfactors[phase] = (f > 0) ? f : 1.0f; }
F32 getTimeFactor(U8 phase) { return tfactors[phase]; } F32 getTimeFactor(U8 phase) { return mTfactors[phase]; }
ShapeBase* getCaster() const { return caster; } ShapeBase* getCaster() const { return mCaster; }
SceneObject* getTarget() const { return target; } SceneObject* getTarget() const { return mTarget; }
afxMagicMissile* getMissile() const { return missile; } afxMagicMissile* getMissile() const { return mMissile; }
SceneObject* getImpactedObject() const { return impacted_obj; } SceneObject* getImpactedObject() const { return mImpacted_obj; }
virtual void restoreObject(SceneObject*); virtual void restoreObject(SceneObject*);
@ -377,7 +377,7 @@ public:
inline bool afxMagicSpell::is_caster_moving() 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) inline bool afxMagicSpell::is_caster_client(ShapeBase* caster, GameConnection* conn)

View file

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

View file

@ -38,23 +38,23 @@ class afxEffectVector;
class afxPhrase class afxPhrase
{ {
protected: protected:
afxEffectList* init_fx_list; afxEffectList* mInit_fx_list;
F32 init_dur; F32 mInit_dur;
afxChoreographer* init_chor; afxChoreographer* mInit_chor;
F32 init_time_factor; F32 mInit_time_factor;
F32 extra_time; F32 mExtra_time;
afxEffectVector* fx; afxEffectVector* mFX;
afxEffectVector* fx2; afxEffectVector* mFX2;
bool on_server; bool mOn_server;
bool will_stop; bool mWill_stop;
F32 starttime; F32 mStartTime;
F32 dur; F32 mDur;
S32 n_loops; S32 mNum_loops;
S32 loop_cnt; S32 mLoop_cnt;
F32 extra_stoptime; F32 mExtra_stoptime;
void init_fx(S32 group_index=0); void init_fx(S32 group_index=0);
@ -73,13 +73,13 @@ public:
virtual bool recycle(F32 timestamp); virtual bool recycle(F32 timestamp);
virtual F32 elapsed(F32 timestamp); virtual F32 elapsed(F32 timestamp);
bool isEmpty() { return fx->empty(); } bool isEmpty() { return mFX->empty(); }
bool isInfinite() { return (init_dur < 0); } bool isInfinite() { return (mInit_dur < 0); }
F32 calcDoneTime(); F32 calcDoneTime();
F32 calcAfterLife(); F32 calcAfterLife();
bool willStop() { return will_stop; } bool willStop() { return mWill_stop; }
bool onServer() { return on_server; } bool onServer() { return mOn_server; }
S32 count() { return fx->count(); } 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_style);
stream->write(obj_type_mask); stream->write(obj_type_mask);
pack_fx(stream, main_fx_list, packed); pack_fx(stream, main_fx_list, mPacked);
pack_fx(stream, select_fx_list, packed); pack_fx(stream, select_fx_list, mPacked);
pack_fx(stream, deselect_fx_list, packed); pack_fx(stream, deselect_fx_list, mPacked);
} }
void afxSelectronData::unpackData(BitStream* stream) void afxSelectronData::unpackData(BitStream* stream)

View file

@ -116,7 +116,7 @@ void afxSpellBookData::packData(BitStream* stream)
stream->write(pages_per_book); stream->write(pages_per_book);
for (S32 i = 0; i < pages_per_book*spells_per_page; i++) 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) void afxSpellBookData::unpackData(BitStream* stream)

View file

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

View file

@ -397,7 +397,7 @@ bool afxModel::onAdd()
// setup our bounding box // setup our bounding box
if (mDataBlock->shape) if (mDataBlock->shape)
mObjBox = mDataBlock->shape->bounds; mObjBox = mDataBlock->shape->mBounds;
else else
mObjBox = Box3F(Point3F(-1, -1, -1), Point3F(1, 1, 1)); 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); stream->writeString(on_trig_cmd);
pack_fx(stream, fx_list, packed); pack_fx(stream, fx_list, mPacked);
} }
void afxPhraseEffectData::unpackData(BitStream* stream) void afxPhraseEffectData::unpackData(BitStream* stream)

View file

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

View file

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

View file

@ -89,10 +89,10 @@ bool afxEA_AnimClip::ea_start()
do_runtime_substitutions(); do_runtime_substitutions();
afxConstraint* pos_constraint = getPosConstraint(); 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); anim_lifetime = pos_constraint->getAnimClipDuration(clip_data->clip_name);
else else
anim_lifetime = full_lifetime; anim_lifetime = mFull_lifetime;
anim_tag = 0; anim_tag = 0;
lock_tag = 0; lock_tag = 0;
@ -127,8 +127,8 @@ bool afxEA_AnimClip::ea_update(F32 dt)
if (go_for_it) if (go_for_it)
{ {
F32 rate = clip_data->rate/prop_time_factor; F32 rate = clip_data->rate/mProp_time_factor;
F32 pos = mFmod(life_elapsed, anim_lifetime)/anim_lifetime; F32 pos = mFmod(mLife_elapsed, anim_lifetime)/anim_lifetime;
pos = mFmod(pos + clip_data->pos_offset, 1.0); pos = mFmod(pos + clip_data->pos_offset, 1.0);
if (clip_data->rate < 0) if (clip_data->rate < 0)
pos = 1.0f - pos; pos = 1.0f - pos;
@ -164,7 +164,7 @@ void afxEA_AnimClip::do_runtime_substitutions()
// clone the datablock and perform substitutions // clone the datablock and perform substitutions
afxAnimClipData* orig_db = clip_data; afxAnimClipData* orig_db = clip_data;
clip_data = new afxAnimClipData(*orig_db, true); 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 // clone the datablock and perform substitutions
afxAreaDamageData* orig_db = damage_data; afxAreaDamageData* orig_db = damage_data;
damage_data = new afxAreaDamageData(*orig_db, true); 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); char *posArg = Con::getArgBuffer(64);
dSprintf(posArg, 64, "%f %f %f", pos.x, pos.y, pos.z); dSprintf(posArg, 64, "%f %f %f", pos.x, pos.y, pos.z);
Con::executef(choreographer->getDataBlock(), "onInflictedAreaDamage", Con::executef(mChoreographer->getDataBlock(), "onInflictedAreaDamage",
choreographer->getIdString(), mChoreographer->getIdString(),
damaged->getIdString(), damaged->getIdString(),
Con::getFloatArg(damage), Con::getFloatArg(damage),
flavor, 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); dSprintf(posArg, 64, "%f %f %f", pos.x, pos.y, pos.z);
Con::executef(shape, "damage", Con::executef(shape, "damage",
choreographer->getIdString(), mChoreographer->getIdString(),
posArg, posArg,
Con::getFloatArg(damage), Con::getFloatArg(damage),
flavor); flavor);

View file

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

View file

@ -108,18 +108,18 @@ bool afxEA_Billboard::ea_update(F32 dt)
deleteNotify(bb); deleteNotify(bb);
///bb->setSequenceRateFactor(datablock->rate_factor/prop_time_factor); ///bb->setSequenceRateFactor(datablock->rate_factor/prop_time_factor);
bb->setSortPriority(datablock->sort_priority); bb->setSortPriority(mDatablock->sort_priority);
} }
if (bb) if (bb)
{ {
bb->live_color = updated_color; bb->live_color = mUpdated_color;
if (do_fades) if (mDo_fades)
{ {
bb->setFadeAmount(fade_value); bb->setFadeAmount(mFade_value);
} }
bb->setTransform(updated_xfm); bb->setTransform(mUpdated_xfm);
bb->setScale(updated_scale); bb->setScale(mUpdated_scale);
} }
return true; return true;
@ -162,7 +162,7 @@ void afxEA_Billboard::do_runtime_substitutions()
// clone the datablock and perform substitutions // clone the datablock and perform substitutions
afxBillboardData* orig_db = bb_data; afxBillboardData* orig_db = bb_data;
bb_data = new afxBillboardData(*orig_db, true); 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(); do_runtime_substitutions();
afxConstraintID obj_id = cons_mgr->getConstraintId(puppet_data->cam_def); afxConstraintID obj_id = mCons_mgr->getConstraintId(puppet_data->cam_def);
cam_cons = cons_mgr->getConstraint(obj_id); cam_cons = mCons_mgr->getConstraint(obj_id);
SceneObject* obj = (cam_cons) ? cam_cons->getSceneObject() : 0; SceneObject* obj = (cam_cons) ? cam_cons->getSceneObject() : 0;
if (obj && obj->isClientObject()) if (obj && obj->isClientObject())
@ -105,9 +105,9 @@ bool afxEA_CameraPuppet::ea_update(F32 dt)
{ {
SceneObject* obj = (cam_cons) ? cam_cons->getSceneObject() : 0; 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; return true;
@ -153,7 +153,7 @@ void afxEA_CameraPuppet::do_runtime_substitutions()
// clone the datablock and perform substitutions // clone the datablock and perform substitutions
afxCameraPuppetData* orig_db = puppet_data; afxCameraPuppetData* orig_db = puppet_data;
puppet_data = new afxCameraPuppetData(*orig_db, true); 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 (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."); Con::errorf("afxEA_CameraShake::ea_start() -- effect requires a finite lifetime.");
return false; return false;
@ -106,7 +106,7 @@ bool afxEA_CameraShake::ea_start()
if (dist < shake_data->camShakeRadius) if (dist < shake_data->camShakeRadius)
{ {
camera_shake = new CameraShake; camera_shake = new CameraShake;
camera_shake->setDuration(full_lifetime); camera_shake->setDuration(mFull_lifetime);
camera_shake->setFrequency(shake_data->camShakeFreq); camera_shake->setFrequency(shake_data->camShakeFreq);
F32 falloff = dist/shake_data->camShakeRadius; F32 falloff = dist/shake_data->camShakeRadius;
@ -161,7 +161,7 @@ void afxEA_CameraShake::do_runtime_substitutions()
// clone the datablock and perform substitutions // clone the datablock and perform substitutions
afxCameraShakeData* orig_db = shake_data; afxCameraShakeData* orig_db = shake_data;
shake_data = new afxCameraShakeData(*orig_db, true); 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(); afxConstraint* pos_constraint = getPosConstraint();
set_shape((pos_constraint) ? dynamic_cast<ShapeBase*>(pos_constraint->getSceneObject()) : 0); set_shape((pos_constraint) ? dynamic_cast<ShapeBase*>(pos_constraint->getSceneObject()) : 0);
if (choreographer && trigger_mask != 0) if (mChoreographer && trigger_mask != 0)
{ {
if (triggered) if (triggered)
{ {
choreographer->setTriggerMask(trigger_mask | choreographer->getTriggerMask()); mChoreographer->setTriggerMask(trigger_mask | mChoreographer->getTriggerMask());
triggered = false; triggered = false;
} }
else 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 // clone the datablock and perform substitutions
afxCollisionEventData* orig_db = script_data; afxCollisionEventData* orig_db = script_data;
script_data = new afxCollisionEventData(*orig_db, true); 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) void afxEA_CollisionEvent::collisionNotify(SceneObject* obj0, SceneObject* obj1, const VectorF& vel)
{ {
if (obj0 != shape || !choreographer || !choreographer->getDataBlock()) if (obj0 != shape || !mChoreographer || !mChoreographer->getDataBlock())
return; return;
if (script_data->method_name != ST_NULLSTRING) 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); dSprintf(arg_buf, 256, "%g %g %g", vel.x, vel.y, vel.z);
// CALL SCRIPT afxChoreographerData::method(%spell, %obj0, %obj1, %velocity) // CALL SCRIPT afxChoreographerData::method(%spell, %obj0, %obj1, %velocity)
Con::executef(choreographer->getDataBlock(), script_data->method_name, Con::executef(mChoreographer->getDataBlock(), script_data->method_name,
choreographer->getIdString(), mChoreographer->getIdString(),
(obj0) ? obj0->getIdString() : "", (obj0) ? obj0->getIdString() : "",
(obj1) ? obj1->getIdString() : "", (obj1) ? obj1->getIdString() : "",
arg_buf, arg_buf,

View file

@ -98,7 +98,7 @@ void afxEA_ConsoleMessage::do_runtime_substitutions()
// clone the datablock and perform substitutions // clone the datablock and perform substitutions
afxConsoleMessageData* orig_db = message_data; afxConsoleMessageData* orig_db = message_data;
message_data = new afxConsoleMessageData(*orig_db, true); 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) 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; next_dot_time = dot_delta_ms;
} }
@ -122,15 +122,15 @@ bool afxEA_Damage::ea_update(F32 dt)
if (aim_cons && aim_cons->getSceneObject()) if (aim_cons && aim_cons->getSceneObject())
impacted_obj_id = aim_cons->getSceneObject()->getId(); impacted_obj_id = aim_cons->getSceneObject()->getId();
if (choreographer) if (mChoreographer)
choreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount, 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, repeat_cnt, damage_data->ad_amount, damage_data->radius, impact_pos,
damage_data->impulse); damage_data->impulse);
repeat_cnt++; repeat_cnt++;
} }
else if (repeat_cnt < damage_data->repeats) else if (repeat_cnt < damage_data->repeats)
{ {
if (next_dot_time <= life_elapsed) if (next_dot_time <= mLife_elapsed)
{ {
// CONSTRAINT REMAPPING << // CONSTRAINT REMAPPING <<
afxConstraint* aim_cons = getAimConstraint(); afxConstraint* aim_cons = getAimConstraint();
@ -138,8 +138,8 @@ bool afxEA_Damage::ea_update(F32 dt)
impacted_obj_id = aim_cons->getSceneObject()->getId(); impacted_obj_id = aim_cons->getSceneObject()->getId();
// CONSTRAINT REMAPPING >> // CONSTRAINT REMAPPING >>
if (choreographer) if (mChoreographer)
choreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount, mChoreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount,
repeat_cnt, 0, 0, impact_pos, 0); repeat_cnt, 0, 0, impact_pos, 0);
next_dot_time += dot_delta_ms; next_dot_time += dot_delta_ms;
repeat_cnt++; repeat_cnt++;
@ -153,10 +153,10 @@ void afxEA_Damage::ea_finish(bool was_stopped)
{ {
if (started && (repeat_cnt < damage_data->repeats)) if (started && (repeat_cnt < damage_data->repeats))
{ {
if (next_dot_time <= life_elapsed) if (next_dot_time <= mLife_elapsed)
{ {
if (choreographer) if (mChoreographer)
choreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount, mChoreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount,
repeat_cnt, 0, 0, impact_pos, 0); repeat_cnt, 0, 0, impact_pos, 0);
} }
} }
@ -172,7 +172,7 @@ void afxEA_Damage::do_runtime_substitutions()
// clone the datablock and perform substitutions // clone the datablock and perform substitutions
afxDamageData* orig_db = damage_data; afxDamageData* orig_db = damage_data;
damage_data = new afxDamageData(*orig_db, true); 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() 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) void afxEA_Debris::ea_set_datablock(SimDataBlock* db)
@ -106,21 +106,21 @@ bool afxEA_Debris::ea_update(F32 dt)
{ {
if (exploded && debris) if (exploded && debris)
{ {
if (in_scope) if (mIn_scope)
{ {
updated_xfm = debris->getRenderTransform(); mUpdated_xfm = debris->getRenderTransform();
updated_xfm.getColumn(3, &updated_pos); mUpdated_xfm.getColumn(3, &mUpdated_pos);
} }
} }
if (!exploded && debris) if (!exploded && debris)
{ {
if (in_scope) if (mIn_scope)
{ {
Point3F dir_vec(0,1,0); 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()) if (!debris->registerObject())
{ {
delete debris; delete debris;
@ -165,7 +165,7 @@ void afxEA_Debris::do_runtime_substitutions()
// clone the datablock and perform substitutions // clone the datablock and perform substitutions
DebrisData* orig_db = debris_data; DebrisData* orig_db = debris_data;
debris_data = new DebrisData(*orig_db, true); 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(); do_runtime_substitutions();
explosion = new Explosion(); explosion = new Explosion();
explosion->setSubstitutionData(choreographer, group_index); explosion->setSubstitutionData(mChoreographer, mGroup_index);
explosion->setDataBlock(explosion_data); explosion->setDataBlock(explosion_data);
return true; return true;
@ -91,10 +91,10 @@ bool afxEA_Explosion::ea_update(F32 dt)
{ {
if (!exploded && explosion) if (!exploded && explosion)
{ {
if (in_scope) if (mIn_scope)
{ {
Point3F norm(0,0,1); updated_xfm.mulV(norm); Point3F norm(0,0,1); mUpdated_xfm.mulV(norm);
explosion->setInitialState(updated_pos, norm); explosion->setInitialState(mUpdated_pos, norm);
if (!explosion->registerObject()) if (!explosion->registerObject())
{ {
delete explosion; delete explosion;
@ -117,7 +117,7 @@ void afxEA_Explosion::ea_finish(bool was_stopped)
void afxEA_Explosion::do_runtime_substitutions() 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; typedef afxEffectWrapper Parent;
afxFootSwitchData* footfall_data; afxFootSwitchData* mFootfall_data;
Player* player; Player* mPlayer;
void do_runtime_substitutions(); void do_runtime_substitutions();
@ -62,38 +62,38 @@ public:
afxEA_FootSwitch::afxEA_FootSwitch() afxEA_FootSwitch::afxEA_FootSwitch()
{ {
footfall_data = 0; mFootfall_data = 0;
player = 0; mPlayer = 0;
} }
inline void afxEA_FootSwitch::set_overrides(Player* player) inline void afxEA_FootSwitch::set_overrides(Player* player)
{ {
if (footfall_data->override_all) if (mFootfall_data->override_all)
player->overrideFootfallFX(); player->overrideFootfallFX();
else else
player->overrideFootfallFX(footfall_data->override_decals, player->overrideFootfallFX(mFootfall_data->override_decals,
footfall_data->override_sounds, mFootfall_data->override_sounds,
footfall_data->override_dust); mFootfall_data->override_dust);
} }
inline void afxEA_FootSwitch::clear_overrides(Player* player) inline void afxEA_FootSwitch::clear_overrides(Player* player)
{ {
if (footfall_data->override_all) if (mFootfall_data->override_all)
player->restoreFootfallFX(); player->restoreFootfallFX();
else else
player->restoreFootfallFX(footfall_data->override_decals, player->restoreFootfallFX(mFootfall_data->override_decals,
footfall_data->override_sounds, mFootfall_data->override_sounds,
footfall_data->override_dust); mFootfall_data->override_dust);
} }
void afxEA_FootSwitch::ea_set_datablock(SimDataBlock* db) 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() bool afxEA_FootSwitch::ea_start()
{ {
if (!footfall_data) if (!mFootfall_data)
{ {
Con::errorf("afxEA_FootSwitch::ea_start() -- missing or incompatible datablock."); Con::errorf("afxEA_FootSwitch::ea_start() -- missing or incompatible datablock.");
return false; return false;
@ -102,25 +102,25 @@ bool afxEA_FootSwitch::ea_start()
do_runtime_substitutions(); do_runtime_substitutions();
afxConstraint* pos_cons = getPosConstraint(); afxConstraint* pos_cons = getPosConstraint();
player = (pos_cons) ? dynamic_cast<Player*>(pos_cons->getSceneObject()) : 0; mPlayer = (pos_cons) ? dynamic_cast<Player*>(pos_cons->getSceneObject()) : 0;
if (player) if (mPlayer)
set_overrides(player); set_overrides(mPlayer);
return true; return true;
} }
bool afxEA_FootSwitch::ea_update(F32 dt) bool afxEA_FootSwitch::ea_update(F32 dt)
{ {
if (!player) if (!mPlayer)
return true; return true;
afxConstraint* pos_cons = getPosConstraint(); afxConstraint* pos_cons = getPosConstraint();
Player* temp_player = (pos_cons) ? dynamic_cast<Player*>(pos_cons->getSceneObject()) : 0; 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; mPlayer = temp_player;
if (player) if (mPlayer)
set_overrides(player); set_overrides(mPlayer);
} }
return true; return true;
@ -128,24 +128,24 @@ bool afxEA_FootSwitch::ea_update(F32 dt)
void afxEA_FootSwitch::ea_finish(bool was_stopped) void afxEA_FootSwitch::ea_finish(bool was_stopped)
{ {
if (!player) if (!mPlayer)
return; return;
afxConstraint* pos_cons = getPosConstraint(); afxConstraint* pos_cons = getPosConstraint();
Player* temp_player = (pos_cons) ? dynamic_cast<Player*>(pos_cons->getSceneObject()) : 0; Player* temp_player = (pos_cons) ? dynamic_cast<Player*>(pos_cons->getSceneObject()) : 0;
if (temp_player == player) if (temp_player == mPlayer)
clear_overrides(player); clear_overrides(mPlayer);
} }
void afxEA_FootSwitch::do_runtime_substitutions() void afxEA_FootSwitch::do_runtime_substitutions()
{ {
// only clone the datablock if there are 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 // clone the datablock and perform substitutions
afxFootSwitchData* orig_db = footfall_data; afxFootSwitchData* orig_db = mFootfall_data;
footfall_data = new afxFootSwitchData(*orig_db, true); mFootfall_data = new afxFootSwitchData(*orig_db, true);
orig_db->performSubstitutions(footfall_data, choreographer, group_index); 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) if (ts_ctrl && !controller_data->preserve_pos)
{ {
Point3F screen_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(); const Point2I ext = gui_control->getExtent();
Point2I newpos(screen_pos.x - ext.x/2, screen_pos.y - ext.y/2); 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) 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) 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) if (mDo_fades)
gui_control->setFadeAmount(fade_value); gui_control->setFadeAmount(mFade_value);
return true; return true;
} }
@ -182,7 +182,7 @@ void afxEA_GuiController::do_runtime_substitutions()
// clone the datablock and perform substitutions // clone the datablock and perform substitutions
afxGuiControllerData* orig_db = controller_data; afxGuiControllerData* orig_db = controller_data;
controller_data = new afxGuiControllerData(*orig_db, true); 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: case USER_TEXT:
{ {
LinearColorF temp_clr = text_clr; LinearColorF temp_clr = text_clr;
if (do_fades) if (mDo_fades)
temp_clr.alpha = fade_value; temp_clr.alpha = mFade_value;
afxGuiTextHud::addTextItem(updated_pos, text_data->text_str, temp_clr); afxGuiTextHud::addTextItem(mUpdated_pos, text_data->text_str, temp_clr);
} }
break; break;
case SHAPE_NAME: case SHAPE_NAME:
@ -127,9 +127,9 @@ bool afxEA_GuiText::ea_update(F32 dt)
if (name && name[0] != '\0') if (name && name[0] != '\0')
{ {
LinearColorF temp_clr = text_clr; LinearColorF temp_clr = text_clr;
if (do_fades) if (mDo_fades)
temp_clr.alpha = fade_value; temp_clr.alpha = mFade_value;
afxGuiTextHud::addTextItem(updated_pos, name, temp_clr, cons_obj); afxGuiTextHud::addTextItem(mUpdated_pos, name, temp_clr, cons_obj);
} }
} }
break; break;
@ -146,7 +146,7 @@ void afxEA_GuiText::do_runtime_substitutions()
// clone the datablock and perform substitutions // clone the datablock and perform substitutions
afxGuiTextData* orig_db = text_data; afxGuiTextData* orig_db = text_data;
text_data = new afxGuiTextData(*orig_db, true); 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) if (!shooting)
{ {
start_time = elapsed; start_time = mElapsed;
shooting = true; shooting = true;
} }
else else
{ {
F32 next_shot = start_time + (shot_count+1)*shot_gap; 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(); launch_projectile();
next_shot += shot_gap; next_shot += shot_gap;
shot_count++; shot_count++;
@ -141,7 +141,7 @@ void afxEA_MachineGun::launch_projectile()
if (bullet_data->getSubstitutionCount() > 0) if (bullet_data->getSubstitutionCount() > 0)
{ {
next_bullet = new ProjectileData(*bullet_data, true); 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); projectile->onNewDataBlock(next_bullet, false);
@ -151,10 +151,10 @@ void afxEA_MachineGun::launch_projectile()
afxConstraint* pos_cons = getPosConstraint(); afxConstraint* pos_cons = getPosConstraint();
ShapeBase* src_obj = (pos_cons) ? (dynamic_cast<ShapeBase*>(pos_cons->getSceneObject())) : 0; 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.normalizeSafe();
dir_vec *= muzzle_vel; dir_vec *= muzzle_vel;
projectile->init(updated_pos, dir_vec, src_obj); projectile->init(mUpdated_pos, dir_vec, src_obj);
if (!projectile->registerObject()) if (!projectile->registerObject())
{ {
delete projectile; delete projectile;
@ -162,7 +162,7 @@ void afxEA_MachineGun::launch_projectile()
Con::errorf("afxEA_MachineGun::launch_projectile() -- projectile failed to register."); Con::errorf("afxEA_MachineGun::launch_projectile() -- projectile failed to register.");
} }
if (projectile) if (projectile)
projectile->setDataField(StringTable->insert("afxOwner"), 0, choreographer->getIdString()); projectile->setDataField(StringTable->insert("afxOwner"), 0, mChoreographer->getIdString());
} }
void afxEA_MachineGun::do_runtime_substitutions() void afxEA_MachineGun::do_runtime_substitutions()
@ -173,7 +173,7 @@ void afxEA_MachineGun::do_runtime_substitutions()
// clone the datablock and perform substitutions // clone the datablock and perform substitutions
afxMachineGunData* orig_db = gun_data; afxMachineGunData* orig_db = gun_data;
gun_data = new afxMachineGunData(*orig_db, true); 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); deleteNotify(model);
model->setSequenceRateFactor(datablock->rate_factor/prop_time_factor); model->setSequenceRateFactor(mDatablock->rate_factor/ mProp_time_factor);
model->setSortPriority(datablock->sort_priority); model->setSortPriority(mDatablock->sort_priority);
} }
if (model) if (model)
{ {
if (do_fades) if (mDo_fades)
{ {
model->setFadeAmount(fade_value); model->setFadeAmount(mFade_value);
} }
model->setTransform(updated_xfm); model->setTransform(mUpdated_xfm);
model->setScale(updated_scale); model->setScale(mUpdated_scale);
} }
return true; return true;
@ -141,10 +141,10 @@ void afxEA_Model::ea_finish(bool was_stopped)
if (!model) if (!model)
return; return;
if (in_scope && ew_timing.residue_lifetime > 0) if (mIn_scope && mEW_timing.residue_lifetime > 0)
{ {
clearNotify(model); 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; model = 0;
} }
else else
@ -203,7 +203,7 @@ void afxEA_Model::do_runtime_substitutions()
// clone the datablock and perform substitutions // clone the datablock and perform substitutions
afxModelData* orig_db = model_data; afxModelData* orig_db = model_data;
model_data = new afxModelData(*orig_db, true); 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; typedef afxEffectWrapper Parent;
afxMooringData* mooring_data; afxMooringData* mMooring_data;
afxMooring* obj; afxMooring* mObj;
void do_runtime_substitutions(); void do_runtime_substitutions();
@ -57,27 +57,27 @@ public:
afxEA_Mooring::afxEA_Mooring() afxEA_Mooring::afxEA_Mooring()
{ {
mooring_data = 0; mMooring_data = 0;
obj = 0; mObj = 0;
} }
afxEA_Mooring::~afxEA_Mooring() afxEA_Mooring::~afxEA_Mooring()
{ {
if (obj) if (mObj)
obj->deleteObject(); mObj->deleteObject();
if (mooring_data && mooring_data->isTempClone()) if (mMooring_data && mMooring_data->isTempClone())
delete mooring_data; delete mMooring_data;
mooring_data = 0; mMooring_data = 0;
} }
void afxEA_Mooring::ea_set_datablock(SimDataBlock* db) 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() bool afxEA_Mooring::ea_start()
{ {
if (!mooring_data) if (!mMooring_data)
{ {
Con::errorf("afxEA_Mooring::ea_start() -- missing or incompatible datablock."); Con::errorf("afxEA_Mooring::ea_start() -- missing or incompatible datablock.");
return false; return false;
@ -90,33 +90,33 @@ bool afxEA_Mooring::ea_start()
bool afxEA_Mooring::ea_update(F32 dt) 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, mObj = new afxMooring(mMooring_data->networking,
choreographer->getChoreographerId(), mChoreographer->getChoreographerId(),
datablock->effect_name); mDatablock->effect_name);
} }
else else
{ {
obj = new afxMooring(mooring_data->networking, 0, ST_NULLSTRING); mObj = new afxMooring(mMooring_data->networking, 0, ST_NULLSTRING);
} }
obj->onNewDataBlock(mooring_data, false); mObj->onNewDataBlock(mMooring_data, false);
if (!obj->registerObject()) if (!mObj->registerObject())
{ {
delete obj; delete mObj;
obj = 0; mObj = 0;
Con::errorf("afxEA_Mooring::ea_update() -- effect failed to register."); Con::errorf("afxEA_Mooring::ea_update() -- effect failed to register.");
return false; return false;
} }
deleteNotify(obj); deleteNotify(mObj);
} }
if (obj) if (mObj)
{ {
obj->setTransform(updated_xfm); mObj->setTransform(mUpdated_xfm);
} }
return true; return true;
@ -128,7 +128,7 @@ void afxEA_Mooring::ea_finish(bool was_stopped)
void afxEA_Mooring::onDeleteNotify(SimObject* obj) void afxEA_Mooring::onDeleteNotify(SimObject* obj)
{ {
if (this->obj == obj) if (mObj == obj)
obj = 0; obj = 0;
Parent::onDeleteNotify(obj); Parent::onDeleteNotify(obj);
@ -137,12 +137,12 @@ void afxEA_Mooring::onDeleteNotify(SimObject* obj)
void afxEA_Mooring::do_runtime_substitutions() void afxEA_Mooring::do_runtime_substitutions()
{ {
// only clone the datablock if there are 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 // clone the datablock and perform substitutions
afxMooringData* orig_db = mooring_data; afxMooringData* orig_db = mMooring_data;
mooring_data = new afxMooringData(*orig_db, true); mMooring_data = new afxMooringData(*orig_db, true);
orig_db->performSubstitutions(mooring_data, choreographer, group_index); orig_db->performSubstitutions(mMooring_data, mChoreographer, mGroup_index);
} }
} }

View file

@ -84,28 +84,28 @@ bool afxEA_ParticleEmitter::ea_start()
{ {
afxParticleEmitterVector* pe = new afxParticleEmitterVector(); afxParticleEmitterVector* pe = new afxParticleEmitterVector();
pe->onNewDataBlock(afx_emitter_db, false); pe->onNewDataBlock(afx_emitter_db, false);
pe->setAFXOwner(choreographer); pe->setAFXOwner(mChoreographer);
emitter = pe; emitter = pe;
} }
else if (dynamic_cast<afxParticleEmitterConeData*>(emitter_data)) else if (dynamic_cast<afxParticleEmitterConeData*>(emitter_data))
{ {
afxParticleEmitterCone* pe = new afxParticleEmitterCone(); afxParticleEmitterCone* pe = new afxParticleEmitterCone();
pe->onNewDataBlock(afx_emitter_db, false); pe->onNewDataBlock(afx_emitter_db, false);
pe->setAFXOwner(choreographer); pe->setAFXOwner(mChoreographer);
emitter = pe; emitter = pe;
} }
else if (dynamic_cast<afxParticleEmitterPathData*>(emitter_data)) else if (dynamic_cast<afxParticleEmitterPathData*>(emitter_data))
{ {
afxParticleEmitterPath* pe = new afxParticleEmitterPath(); afxParticleEmitterPath* pe = new afxParticleEmitterPath();
pe->onNewDataBlock(afx_emitter_db, false); pe->onNewDataBlock(afx_emitter_db, false);
pe->setAFXOwner(choreographer); pe->setAFXOwner(mChoreographer);
emitter = pe; emitter = pe;
} }
else if (dynamic_cast<afxParticleEmitterDiscData*>(emitter_data)) else if (dynamic_cast<afxParticleEmitterDiscData*>(emitter_data))
{ {
afxParticleEmitterDisc* pe = new afxParticleEmitterDisc(); afxParticleEmitterDisc* pe = new afxParticleEmitterDisc();
pe->onNewDataBlock(afx_emitter_db, false); pe->onNewDataBlock(afx_emitter_db, false);
pe->setAFXOwner(choreographer); pe->setAFXOwner(mChoreographer);
emitter = pe; emitter = pe;
} }
} }
@ -120,7 +120,7 @@ bool afxEA_ParticleEmitter::ea_start()
// here we find or create any required particle-pools // here we find or create any required particle-pools
if (emitter_data->pool_datablock) 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) if (!pool)
{ {
afxParticlePoolData* pool_data = emitter_data->pool_datablock; afxParticlePoolData* pool_data = emitter_data->pool_datablock;
@ -129,7 +129,7 @@ bool afxEA_ParticleEmitter::ea_start()
// clone the datablock and perform substitutions // clone the datablock and perform substitutions
afxParticlePoolData* orig_db = pool_data; afxParticlePoolData* orig_db = pool_data;
pool_data = new afxParticlePoolData(*orig_db, true); 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(); pool = new afxParticlePool();
@ -143,8 +143,8 @@ bool afxEA_ParticleEmitter::ea_start()
} }
if (pool) if (pool)
{ {
pool->setChoreographer(choreographer); pool->setChoreographer(mChoreographer);
choreographer->registerParticlePool(pool); mChoreographer->registerParticlePool(pool);
} }
} }
if (pool) if (pool)
@ -160,12 +160,12 @@ bool afxEA_ParticleEmitter::ea_start()
return false; return false;
} }
if (datablock->forced_bbox.isValidBox()) if (mDatablock->forced_bbox.isValidBox())
{ {
do_bbox_update = true; do_bbox_update = true;
} }
emitter->setSortPriority(datablock->sort_priority); emitter->setSortPriority(mDatablock->sort_priority);
deleteNotify(emitter); deleteNotify(emitter);
return true; return true;
@ -173,26 +173,26 @@ bool afxEA_ParticleEmitter::ea_start()
bool afxEA_ParticleEmitter::ea_update(F32 dt) bool afxEA_ParticleEmitter::ea_update(F32 dt)
{ {
if (emitter && in_scope) if (emitter && mIn_scope)
{ {
if (do_bbox_update) if (do_bbox_update)
{ {
Box3F bbox = emitter->getObjBox(); Box3F bbox = emitter->getObjBox();
bbox.minExtents = updated_pos + datablock->forced_bbox.minExtents; bbox.minExtents = mUpdated_pos + mDatablock->forced_bbox.minExtents;
bbox.maxExtents = updated_pos + datablock->forced_bbox.maxExtents; bbox.maxExtents = mUpdated_pos + mDatablock->forced_bbox.maxExtents;
emitter->setForcedObjBox(bbox); emitter->setForcedObjBox(bbox);
emitter->setTransform(emitter->getTransform()); emitter->setTransform(emitter->getTransform());
if (!datablock->update_forced_bbox) if (!mDatablock->update_forced_bbox)
do_bbox_update = false; do_bbox_update = false;
} }
if (do_fades) if (mDo_fades)
emitter->setFadeAmount(fade_value); 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; return true;
@ -209,7 +209,7 @@ void afxEA_ParticleEmitter::ea_finish(bool was_stopped)
// note - fully faded particles are not always // note - fully faded particles are not always
// invisible, so they are still kept alive and // invisible, so they are still kept alive and
// deleted via deleteWhenEmpty(). // deleted via deleteWhenEmpty().
if (ew_timing.fade_out_time > 0.0f) if (mEW_timing.fade_out_time > 0.0f)
emitter->setFadeAmount(0.0f); emitter->setFadeAmount(0.0f);
if (dynamic_cast<afxParticleEmitter*>(emitter)) if (dynamic_cast<afxParticleEmitter*>(emitter))
((afxParticleEmitter*)emitter)->setAFXOwner(0); ((afxParticleEmitter*)emitter)->setAFXOwner(0);
@ -240,32 +240,32 @@ void afxEA_ParticleEmitter::do_runtime_substitutions()
{ {
afxParticleEmitterVectorData* orig_db = (afxParticleEmitterVectorData*)emitter_data; afxParticleEmitterVectorData* orig_db = (afxParticleEmitterVectorData*)emitter_data;
emitter_data = new afxParticleEmitterVectorData(*orig_db, true); 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)) else if (dynamic_cast<afxParticleEmitterConeData*>(emitter_data))
{ {
afxParticleEmitterConeData* orig_db = (afxParticleEmitterConeData*)emitter_data; afxParticleEmitterConeData* orig_db = (afxParticleEmitterConeData*)emitter_data;
emitter_data = new afxParticleEmitterConeData(*orig_db, true); 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)) else if (dynamic_cast<afxParticleEmitterPathData*>(emitter_data))
{ {
afxParticleEmitterPathData* orig_db = (afxParticleEmitterPathData*)emitter_data; afxParticleEmitterPathData* orig_db = (afxParticleEmitterPathData*)emitter_data;
emitter_data = new afxParticleEmitterPathData(*orig_db, true); 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)) else if (dynamic_cast<afxParticleEmitterDiscData*>(emitter_data))
{ {
afxParticleEmitterDiscData* orig_db = (afxParticleEmitterDiscData*)emitter_data; afxParticleEmitterDiscData* orig_db = (afxParticleEmitterDiscData*)emitter_data;
emitter_data = new afxParticleEmitterDiscData(*orig_db, true); emitter_data = new afxParticleEmitterDiscData(*orig_db, true);
orig_db->performSubstitutions(emitter_data, choreographer, group_index); orig_db->performSubstitutions(emitter_data, mChoreographer, mGroup_index);
} }
} }
else else
{ {
ParticleEmitterData* orig_db = emitter_data; ParticleEmitterData* orig_db = emitter_data;
emitter_data = new ParticleEmitterData(*orig_db, true); 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) if (clone_particles)
@ -277,7 +277,7 @@ void afxEA_ParticleEmitter::do_runtime_substitutions()
// clone the datablock and perform substitutions // clone the datablock and perform substitutions
ParticleData* orig_db = emitter_data->particleDataBlocks[i]; ParticleData* orig_db = emitter_data->particleDataBlocks[i];
emitter_data->particleDataBlocks[i] = new ParticleData(*orig_db, true); 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) bool afxEA_PhraseEffect::ea_update(F32 dt)
{ {
if (fade_value >= 1.0f) if (mFade_value >= 1.0f)
{ {
// //
// Choreographer Triggers: // Choreographer Triggers:
@ -145,7 +145,7 @@ bool afxEA_PhraseEffect::ea_update(F32 dt)
// They must be set explicitly by calls to afxChoreographer // They must be set explicitly by calls to afxChoreographer
// console-methods, setTriggerBit(), or clearTriggerBit(). // 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: // Constraint Triggers:
@ -191,7 +191,7 @@ bool afxEA_PhraseEffect::ea_update(F32 dt)
{ {
for (S32 i = 0; i < active_phrases->size(); i++) 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++) 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 // clone the datablock and perform substitutions
afxPhraseEffectData* orig_db = phrase_fx_data; afxPhraseEffectData* orig_db = phrase_fx_data;
phrase_fx_data = new afxPhraseEffectData(*orig_db, true); 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); //afxPhrase* phrase = new afxPhrase(choreographer->isServerObject(), /*willStop=*/false);
bool will_stop = phrase_fx_data->phrase_type == afxPhraseEffectData::PHRASE_CONTINUOUS; bool will_stop = phrase_fx_data->phrase_type == afxPhraseEffectData::PHRASE_CONTINUOUS;
afxPhrase* phrase = new afxPhrase(choreographer->isServerObject(), will_stop); afxPhrase* phrase = new afxPhrase(mChoreographer->isServerObject(), will_stop);
phrase->init(phrase_fx_data->fx_list, datablock->ewd_timing.lifetime, choreographer, time_factor, phrase_fx_data->n_loops, group_index); 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); phrase->start(0, 0);
if (phrase->isEmpty()) if (phrase->isEmpty())
{ {
@ -272,10 +272,10 @@ void afxEA_PhraseEffect::trigger_new_phrase()
if (phrase_fx_data->on_trig_cmd != ST_NULLSTRING) if (phrase_fx_data->on_trig_cmd != ST_NULLSTRING)
{ {
char obj_str[32]; char obj_str[32];
dStrcpy(obj_str, Con::getIntArg(choreographer->getId()), 32); dStrcpy(obj_str, Con::getIntArg(mChoreographer->getId()), 32);
char index_str[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 buffer[1024];
char* b = buffer; char* b = buffer;
@ -331,9 +331,9 @@ void afxEA_PhraseEffect::update_active_phrases(F32 dt)
for (S32 i = 0; i < active_phrases->size(); i++) for (S32 i = 0; i < active_phrases->size(); i++)
{ {
afxPhrase* phrase = (*active_phrases)[i]; afxPhrase* phrase = (*active_phrases)[i];
if (phrase->expired(life_elapsed)) if (phrase->expired(mLife_elapsed))
phrase->recycle(life_elapsed); phrase->recycle(mLife_elapsed);
phrase->update(dt, life_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); set_cons_object((pos_constraint) ? pos_constraint->getSceneObject() : 0);
} }
if (do_fades) if (mDo_fades)
physical_zone->setFadeAmount(fade_value); physical_zone->setFadeAmount(mFade_value);
physical_zone->setTransform(updated_xfm); physical_zone->setTransform(mUpdated_xfm);
} }
return true; return true;
@ -172,7 +172,7 @@ void afxEA_PhysicalZone::do_runtime_substitutions()
// clone the datablock and perform substitutions // clone the datablock and perform substitutions
afxPhysicalZoneData* orig_db = zone_data; afxPhysicalZoneData* orig_db = zone_data;
zone_data = new afxPhysicalZoneData(*orig_db, true); 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 // clone the datablock and perform substitutions
afxPlayerMovementData* orig_db = movement_data; afxPlayerMovementData* orig_db = movement_data;
movement_data = new afxPlayerMovementData(*orig_db, true); 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(); do_runtime_substitutions();
afxConstraintID obj_id = cons_mgr->getConstraintId(mover_data->obj_def); afxConstraintID obj_id = mCons_mgr->getConstraintId(mover_data->obj_def);
obj_cons = cons_mgr->getConstraint(obj_id); obj_cons = mCons_mgr->getConstraint(obj_id);
Player* player = dynamic_cast<Player*>((obj_cons) ? obj_cons->getSceneObject() : 0); Player* player = dynamic_cast<Player*>((obj_cons) ? obj_cons->getSceneObject() : 0);
if (player) if (player)
@ -94,9 +94,9 @@ bool afxEA_PlayerPuppet::ea_update(F32 dt)
{ {
SceneObject* obj = (obj_cons) ? obj_cons->getSceneObject() : 0; 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; return true;
@ -138,7 +138,7 @@ void afxEA_PlayerPuppet::do_runtime_substitutions()
// clone the datablock and perform substitutions // clone the datablock and perform substitutions
afxPlayerPuppetData* orig_db = mover_data; afxPlayerPuppetData* orig_db = mover_data;
mover_data = new afxPlayerPuppetData(*orig_db, true); 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 class PointLightProxy : public PointLight
{ {
F32 fade_amt; F32 mFade_amt;
public: public:
PointLightProxy() { fade_amt = 1.0f; } PointLightProxy() { mFade_amt = 1.0f; }
void force_ghost() void force_ghost()
{ {
@ -79,7 +79,7 @@ public:
void setFadeAmount(F32 fade_amt) void setFadeAmount(F32 fade_amt)
{ {
this->fade_amt = fade_amt; mFade_amt = fade_amt;
mLight->setBrightness(mBrightness*fade_amt); mLight->setBrightness(mBrightness*fade_amt);
} }
@ -125,10 +125,10 @@ public:
void submitLights(LightManager* lm, bool staticLighting) 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; F32 mBrightness_save = mBrightness;
mBrightness *= fade_amt; mBrightness *= mFade_amt;
PointLight::submitLights(lm, staticLighting); PointLight::submitLights(lm, staticLighting);
mBrightness = mBrightness_save; mBrightness = mBrightness_save;
return; return;
@ -203,12 +203,12 @@ bool afxEA_T3DPointLight::ea_update(F32 dt)
light->setConstraintObject(cons_obj); light->setConstraintObject(cons_obj);
#endif #endif
light->setLiveColor(updated_color); light->setLiveColor(mUpdated_color);
if (do_fades) if (mDo_fades)
light->setFadeAmount(fade_value*updated_scale.x); 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. // scale should not be updated this way. It messes up the culling.
//light->setScale(updated_scale); //light->setScale(updated_scale);
@ -254,7 +254,7 @@ void afxEA_T3DPointLight::do_runtime_substitutions()
// clone the datablock and perform substitutions // clone the datablock and perform substitutions
afxT3DPointLightData* orig_db = light_data; afxT3DPointLightData* orig_db = light_data;
light_data = new afxT3DPointLightData(*orig_db, true); 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() 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) void afxEA_Projectile::ea_set_datablock(SimDataBlock* db)
@ -117,8 +117,8 @@ bool afxEA_Projectile::ea_start()
} }
else else
{ {
if (datablock->use_ghost_as_cons_obj && datablock->effect_name != ST_NULLSTRING) if (mDatablock->use_ghost_as_cons_obj && mDatablock->effect_name != ST_NULLSTRING)
projectile = new afxProjectile(afx_projectile_data->networking, choreographer->getChoreographerId(), datablock->effect_name); projectile = new afxProjectile(afx_projectile_data->networking, mChoreographer->getChoreographerId(), mDatablock->effect_name);
else else
projectile = new afxProjectile(afx_projectile_data->networking, 0, ST_NULLSTRING); projectile = new afxProjectile(afx_projectile_data->networking, 0, ST_NULLSTRING);
projectile->ignoreSourceTimeout = afx_projectile_data->ignore_src_timeout; projectile->ignoreSourceTimeout = afx_projectile_data->ignore_src_timeout;
@ -127,8 +127,8 @@ bool afxEA_Projectile::ea_start()
projectile->dynamicCollisionMask = afx_projectile_data->dynamicCollisionMask; projectile->dynamicCollisionMask = afx_projectile_data->dynamicCollisionMask;
projectile->staticCollisionMask = afx_projectile_data->staticCollisionMask; projectile->staticCollisionMask = afx_projectile_data->staticCollisionMask;
} }
afxConstraintID launch_pos_id = cons_mgr->getConstraintId(afx_projectile_data->launch_pos_def); afxConstraintID launch_pos_id = mCons_mgr->getConstraintId(afx_projectile_data->launch_pos_def);
launch_cons = cons_mgr->getConstraint(launch_pos_id); launch_cons = mCons_mgr->getConstraint(launch_pos_id);
launch_dir_bias = afx_projectile_data->launch_dir_bias; launch_dir_bias = afx_projectile_data->launch_dir_bias;
} }
@ -141,7 +141,7 @@ bool afxEA_Projectile::ea_update(F32 dt)
{ {
if (!launched && projectile) if (!launched && projectile)
{ {
if (in_scope) if (mIn_scope)
{ {
afxConstraint* pos_cons = getPosConstraint(); afxConstraint* pos_cons = getPosConstraint();
ShapeBase* src_obj = (pos_cons) ? (dynamic_cast<ShapeBase*>(pos_cons->getSceneObject())) : 0; 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: case afxProjectileData::OrientConstraint:
dir_vec.set(0,0,1); dir_vec.set(0,0,1);
updated_xfm.mulV(dir_vec); mUpdated_xfm.mulV(dir_vec);
break; break;
case afxProjectileData::LaunchDirField: case afxProjectileData::LaunchDirField:
dir_vec.set(0,0,1); dir_vec.set(0,0,1);
break; break;
case afxProjectileData::TowardPos2Constraint: case afxProjectileData::TowardPos2Constraint:
default: default:
dir_vec = updated_aim - updated_pos; dir_vec = mUpdated_aim - mUpdated_pos;
break; break;
} }
} }
else else
dir_vec = updated_aim - updated_pos; dir_vec = mUpdated_aim - mUpdated_pos;
dir_vec.normalizeSafe(); dir_vec.normalizeSafe();
if (!launch_dir_bias.isZero()) 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); projectile->init(launch_pos, dir_vec, (launch_obj) ? launch_obj : src_obj);
} }
else else
projectile->init(updated_pos, dir_vec, src_obj); projectile->init(mUpdated_pos, dir_vec, src_obj);
if (!projectile->registerObject()) if (!projectile->registerObject())
{ {
@ -197,7 +197,7 @@ bool afxEA_Projectile::ea_update(F32 dt)
deleteNotify(projectile); deleteNotify(projectile);
if (projectile) if (projectile)
projectile->setDataField(StringTable->insert("afxOwner"), 0, choreographer->getIdString()); projectile->setDataField(StringTable->insert("afxOwner"), 0, mChoreographer->getIdString());
} }
launched = true; launched = true;
@ -205,10 +205,10 @@ bool afxEA_Projectile::ea_update(F32 dt)
if (launched && projectile) if (launched && projectile)
{ {
if (in_scope) if (mIn_scope)
{ {
updated_xfm = projectile->getRenderTransform(); mUpdated_xfm = projectile->getRenderTransform();
updated_xfm.getColumn(3, &updated_pos); mUpdated_xfm.getColumn(3, &mUpdated_pos);
} }
} }
@ -247,7 +247,7 @@ void afxEA_Projectile::do_runtime_substitutions()
afxProjectileData* orig_db = (afxProjectileData*)projectile_data; afxProjectileData* orig_db = (afxProjectileData*)projectile_data;
afx_projectile_data = new afxProjectileData(*orig_db, true); afx_projectile_data = new afxProjectileData(*orig_db, true);
projectile_data = afx_projectile_data; projectile_data = afx_projectile_data;
orig_db->performSubstitutions(projectile_data, choreographer, group_index); orig_db->performSubstitutions(projectile_data, mChoreographer, mGroup_index);
} }
else else
{ {
@ -255,7 +255,7 @@ void afxEA_Projectile::do_runtime_substitutions()
ProjectileData* orig_db = projectile_data; ProjectileData* orig_db = projectile_data;
afx_projectile_data = 0; afx_projectile_data = 0;
projectile_data = new ProjectileData(*orig_db, true); 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) bool afxEA_ScriptEvent::ea_update(F32 dt)
{ {
if (!ran_script && choreographer != NULL) if (!ran_script && mChoreographer != NULL)
{ {
afxConstraint* pos_constraint = getPosConstraint(); 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); script_data->script_data);
ran_script = true; ran_script = true;
} }
@ -115,7 +115,7 @@ void afxEA_ScriptEvent::do_runtime_substitutions()
// clone the datablock and perform substitutions // clone the datablock and perform substitutions
afxScriptEventData* orig_db = script_data; afxScriptEventData* orig_db = script_data;
script_data = new afxScriptEventData(*orig_db, true); 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) if (!sound_handle)
{ {
sound_handle = SFX->createSource(sound_prof, &updated_xfm, 0); sound_handle = SFX->createSource(sound_prof, &mUpdated_xfm, 0);
if (sound_handle) if (sound_handle)
sound_handle->play(); sound_handle->play();
} }
if (sound_handle) if (sound_handle)
{ {
sound_handle->setTransform(updated_xfm); sound_handle->setTransform(mUpdated_xfm);
sound_handle->setVolume((in_scope) ? updated_scale.x*fade_value : 0.0f); sound_handle->setVolume((mIn_scope) ? mUpdated_scale.x*mFade_value : 0.0f);
deleteNotify(sound_handle); deleteNotify(sound_handle);
} }
@ -134,7 +134,7 @@ void afxEA_Sound::ea_finish(bool was_stopped)
void afxEA_Sound::do_runtime_substitutions() 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(); sound_desc = sound_prof->getDescription();
} }
@ -150,7 +150,7 @@ void afxEA_Sound::onDeleteNotify(SimObject* obj)
class afxEA_SoundDesc : public afxEffectAdapterDesc, public afxEffectDefs class afxEA_SoundDesc : public afxEffectAdapterDesc, public afxEffectDefs
{ {
static afxEA_SoundDesc desc; static afxEA_SoundDesc mDesc;
public: public:
virtual bool testEffectType(const SimDataBlock*) const; virtual bool testEffectType(const SimDataBlock*) const;
@ -162,7 +162,7 @@ public:
virtual afxEffectWrapper* create() const { return new afxEA_Sound; } 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 bool afxEA_SoundDesc::testEffectType(const SimDataBlock* db) const
{ {

View file

@ -66,10 +66,10 @@ public:
class SpotLightProxy : public SpotLight class SpotLightProxy : public SpotLight
{ {
F32 fade_amt; F32 mFade_amt;
public: public:
SpotLightProxy() { fade_amt = 1.0f; } SpotLightProxy() { mFade_amt = 1.0f; }
void force_ghost() void force_ghost()
{ {
@ -79,7 +79,7 @@ public:
void setFadeAmount(F32 fade_amt) void setFadeAmount(F32 fade_amt)
{ {
this->fade_amt = fade_amt; mFade_amt = fade_amt;
mLight->setBrightness(mBrightness*fade_amt); mLight->setBrightness(mBrightness*fade_amt);
} }
@ -130,10 +130,10 @@ public:
void submitLights(LightManager* lm, bool staticLighting) 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; F32 mBrightness_save = mBrightness;
mBrightness *= fade_amt; mBrightness *= mFade_amt;
SpotLight::submitLights(lm, staticLighting); SpotLight::submitLights(lm, staticLighting);
mBrightness = mBrightness_save; mBrightness = mBrightness_save;
return; return;
@ -207,12 +207,12 @@ bool afxEA_T3DSpotLight::ea_update(F32 dt)
light->setConstraintObject(cons_obj); light->setConstraintObject(cons_obj);
#endif #endif
light->setLiveColor(updated_color); light->setLiveColor(mUpdated_color);
if (do_fades) if (mDo_fades)
light->setFadeAmount(fade_value); light->setFadeAmount(mFade_value);
light->updateTransform(updated_xfm); light->updateTransform(mUpdated_xfm);
// scale should not be updated this way. It messes up the culling. // scale should not be updated this way. It messes up the culling.
//light->setScale(updated_scale); //light->setScale(updated_scale);
@ -258,7 +258,7 @@ void afxEA_T3DSpotLight::do_runtime_substitutions()
// clone the datablock and perform substitutions // clone the datablock and perform substitutions
afxT3DSpotLightData* orig_db = light_data; afxT3DSpotLightData* orig_db = light_data;
light_data = new afxT3DSpotLightData(*orig_db, true); 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(); do_runtime_substitutions();
// fades are handled using startFade() calls. // fades are handled using startFade() calls.
do_fades = false; mDo_fades = false;
return true; return true;
} }
@ -108,8 +108,8 @@ bool afxEA_StaticShape::ea_update(F32 dt)
{ {
// create and register effect // create and register effect
static_shape = new afxStaticShape(); static_shape = new afxStaticShape();
if (datablock->use_ghost_as_cons_obj && datablock->effect_name != ST_NULLSTRING) if (mDatablock->use_ghost_as_cons_obj && mDatablock->effect_name != ST_NULLSTRING)
static_shape->init(choreographer->getChoreographerId(), datablock->effect_name); static_shape->init(mChoreographer->getChoreographerId(), mDatablock->effect_name);
static_shape->onNewDataBlock(shape_data, false); static_shape->onNewDataBlock(shape_data, false);
if (!static_shape->registerObject()) if (!static_shape->registerObject())
@ -122,26 +122,26 @@ bool afxEA_StaticShape::ea_update(F32 dt)
deleteNotify(static_shape); deleteNotify(static_shape);
registerForCleanup(static_shape); registerForCleanup(static_shape);
if (ew_timing.fade_in_time > 0.0f) if (mEW_timing.fade_in_time > 0.0f)
static_shape->startFade(ew_timing.fade_in_time, 0, false); static_shape->startFade(mEW_timing.fade_in_time, 0, false);
} }
if (static_shape) if (static_shape)
{ {
if (!fade_out_started && elapsed > fade_out_start) if (!fade_out_started && mElapsed > mFade_out_start)
{ {
if (!do_spawn) if (!do_spawn)
{ {
if (ew_timing.fade_out_time > 0.0f) if (mEW_timing.fade_out_time > 0.0f)
static_shape->startFade(ew_timing.fade_out_time, 0, true); static_shape->startFade(mEW_timing.fade_out_time, 0, true);
} }
fade_out_started = true; fade_out_started = true;
} }
if (in_scope) if (mIn_scope)
{ {
static_shape->setTransform(updated_xfm); static_shape->setTransform(mUpdated_xfm);
static_shape->setScale(updated_scale); static_shape->setScale(mUpdated_scale);
} }
} }
@ -155,7 +155,7 @@ void afxEA_StaticShape::ea_finish(bool was_stopped)
if (do_spawn) 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); clearNotify(static_shape);
} }
else else
@ -204,13 +204,13 @@ void afxEA_StaticShape::do_runtime_substitutions()
{ {
afxStaticShapeData* orig_db = (afxStaticShapeData*)shape_data; afxStaticShapeData* orig_db = (afxStaticShapeData*)shape_data;
shape_data = new afxStaticShapeData(*orig_db, true); shape_data = new afxStaticShapeData(*orig_db, true);
orig_db->performSubstitutions(shape_data, choreographer, group_index); orig_db->performSubstitutions(shape_data, mChoreographer, mGroup_index);
} }
else else
{ {
StaticShapeData* orig_db = shape_data; StaticShapeData* orig_db = shape_data;
shape_data = new StaticShapeData(*orig_db, true); 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() 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 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() 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 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() afxEA_Zodiac::afxEA_Zodiac()
@ -170,13 +170,13 @@ bool afxEA_Zodiac::ea_start()
bool afxEA_Zodiac::ea_update(F32 dt) bool afxEA_Zodiac::ea_update(F32 dt)
{ {
if (!in_scope) if (!mIn_scope)
return true; return true;
//~~~~~~~~~~~~~~~~~~~~// //~~~~~~~~~~~~~~~~~~~~//
// Zodiac Color // Zodiac Color
zode_color = updated_color; zode_color = mUpdated_color;
if (live_color_factor > 0.0) if (live_color_factor > 0.0)
{ {
@ -190,15 +190,15 @@ bool afxEA_Zodiac::ea_update(F32 dt)
//Con::printf("LIVE-COLOR-FACTOR is ZERO"); //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 return true; // too transparent
if (zode_data->blend_flags == afxZodiacDefs::BLEND_SUBTRACTIVE) if (zode_data->blend_flags == afxZodiacDefs::BLEND_SUBTRACTIVE)
zode_color *= fade_value*live_fade_factor; zode_color *= mFade_value * mLive_fade_factor;
else else
zode_color.alpha *= fade_value*live_fade_factor; zode_color.alpha *= mFade_value * mLive_fade_factor;
} }
if (zode_color.alpha < 0.01f) if (zode_color.alpha < 0.01f)
@ -208,22 +208,22 @@ bool afxEA_Zodiac::ea_update(F32 dt)
// Zodiac // Zodiac
// scale and grow zode // 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 // 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_radius = afxEase::eq(t, 0.001f, zode_radius, 0.2f, 0.8f);
} }
// zode is shrinking // 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 = 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) if (zode_radius < 0.001f)
return true; // too small return true; // too small
@ -238,7 +238,7 @@ bool afxEA_Zodiac::ea_update(F32 dt)
//~~~~~~~~~~~~~~~~~~~~// //~~~~~~~~~~~~~~~~~~~~//
// Zodiac Position // Zodiac Position
zode_pos = updated_pos; zode_pos = mUpdated_pos;
//~~~~~~~~~~~~~~~~~~~~// //~~~~~~~~~~~~~~~~~~~~//
// Zodiac Rotation // Zodiac Rotation
@ -249,7 +249,7 @@ bool afxEA_Zodiac::ea_update(F32 dt)
if (orient_constraint) if (orient_constraint)
{ {
VectorF shape_vec; VectorF shape_vec;
updated_xfm.getColumn(1, &shape_vec); mUpdated_xfm.getColumn(1, &shape_vec);
shape_vec.z = 0.0f; shape_vec.z = 0.0f;
shape_vec.normalize(); shape_vec.normalize();
F32 pitch, yaw; 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); zode_angle = mFmod(zode_angle + zode_angle_offset, 360.0f);
//~~~~~~~~~~~~~~~~~~~~// //~~~~~~~~~~~~~~~~~~~~//
// post zodiac // post zodiac
if ((zode_data->zflags & afxZodiacDefs::SHOW_ON_TERRAIN) != 0) 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(); F32 alt_bias = calc_terrain_alt_bias();
if (alt_bias > 0.0f) 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 ((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(); F32 alt_bias = calc_interior_alt_bias();
if (alt_bias > 0.0f) if (alt_bias > 0.0f)
@ -310,17 +310,17 @@ bool afxEA_Zodiac::ea_update(F32 dt)
void afxEA_Zodiac::ea_finish(bool was_stopped) 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; return;
zode_color.alpha *= fade_value; zode_color.alpha *= mFade_value;
} }
if ((zode_data->zflags & afxZodiacDefs::SHOW_ON_TERRAIN) != 0) 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(); F32 alt_bias = calc_terrain_alt_bias();
if (alt_bias > 0.0f) if (alt_bias > 0.0f)
@ -332,20 +332,20 @@ void afxEA_Zodiac::ea_finish(bool was_stopped)
if (zode_data->altitude_fades) if (zode_data->altitude_fades)
zode_color.alpha *= alt_bias; zode_color.alpha *= alt_bias;
became_residue = true; 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); alt_clr, zode_angle);
} }
} }
else else
{ {
became_residue = true; 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); zode_color, zode_angle);
} }
} }
if ((zode_data->zflags & afxZodiacDefs::SHOW_ON_INTERIORS) != 0) 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(); F32 alt_bias = calc_interior_alt_bias();
if (alt_bias > 0.0f) if (alt_bias > 0.0f)
@ -361,7 +361,7 @@ void afxEA_Zodiac::ea_finish(bool was_stopped)
if (became_residue) if (became_residue)
temp_zode = new afxZodiacData(*zode_data, true); temp_zode = new afxZodiacData(*zode_data, true);
became_residue = 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); zode_vrange, alt_clr, zode_angle);
} }
@ -372,7 +372,7 @@ void afxEA_Zodiac::ea_finish(bool was_stopped)
if (became_residue) if (became_residue)
temp_zode = new afxZodiacData(*zode_data, true); temp_zode = new afxZodiacData(*zode_data, true);
became_residue = 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); zode_vrange, zode_color, zode_angle);
} }
} }
@ -387,7 +387,7 @@ void afxEA_Zodiac::do_runtime_substitutions()
// clone the datablock and perform substitutions // clone the datablock and perform substitutions
afxZodiacData* orig_db = zode_data; afxZodiacData* orig_db = zode_data;
zode_data = new afxZodiacData(*orig_db, true); 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) if (pzode)
{ {
//LinearColorF zode_color = zode_data->color; //LinearColorF zode_color = zode_data->color;
LinearColorF zode_color = updated_color; LinearColorF zode_color = mUpdated_color;
if (live_color_factor > 0.0) if (live_color_factor > 0.0)
zode_color.interpolate(zode_color, live_color, live_color_factor); zode_color.interpolate(zode_color, live_color, live_color_factor);
if (do_fades) if (mDo_fades)
{ {
if (zode_data->blend_flags == afxZodiacDefs::BLEND_SUBTRACTIVE) if (zode_data->blend_flags == afxZodiacDefs::BLEND_SUBTRACTIVE)
zode_color *= fade_value*live_fade_factor; zode_color *= mFade_value *mLive_fade_factor;
else else
zode_color.alpha *= fade_value*live_fade_factor; zode_color.alpha *= mFade_value * mLive_fade_factor;
} }
// scale and grow zode // 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*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 // 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_radius = afxEase::eq(t, 0.001f, zode_radius, 0.2f, 0.8f);
} }
// zode is shrinking // 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 = 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) if (zode_data->respect_ori_cons && !zode_data->use_full_xfm)
{ {
VectorF shape_vec; VectorF shape_vec;
updated_xfm.getColumn(1, &shape_vec); mUpdated_xfm.getColumn(1, &shape_vec);
shape_vec.normalize(); shape_vec.normalize();
F32 ang; F32 ang;
@ -246,7 +246,7 @@ bool afxEA_ZodiacPlane::ea_update(F32 dt)
zode_angle_offset = mRadToDeg(ang); 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); zode_angle = mFmod(zode_angle + zode_angle_offset, 360.0f);
aa_rot.angle = mDegToRad(zode_angle); aa_rot.angle = mDegToRad(zode_angle);
@ -258,13 +258,13 @@ bool afxEA_ZodiacPlane::ea_update(F32 dt)
pzode->setRadius(zode_radius); pzode->setRadius(zode_radius);
if (zode_data->use_full_xfm) if (zode_data->use_full_xfm)
{ {
updated_xfm.mul(spin_xfm); mUpdated_xfm.mul(spin_xfm);
pzode->setTransform(updated_xfm); pzode->setTransform(mUpdated_xfm);
} }
else else
pzode->setTransform(spin_xfm); pzode->setTransform(spin_xfm);
pzode->setPosition(updated_pos); pzode->setPosition(mUpdated_pos);
pzode->setScale(updated_scale); pzode->setScale(mUpdated_scale);
} }
return true; return true;
@ -307,7 +307,7 @@ void afxEA_ZodiacPlane::do_runtime_substitutions()
// clone the datablock and perform substitutions // clone the datablock and perform substitutions
afxZodiacPlaneData* orig_db = zode_data; afxZodiacPlaneData* orig_db = zode_data;
zode_data = new afxZodiacPlaneData(*orig_db, true); 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(); do_runtime_substitutions();
force_set_mgr = choreographer->getForceSetMgr(); force_set_mgr = mChoreographer->getForceSetMgr();
return true; return true;
} }
@ -109,7 +109,7 @@ bool afxEA_Force::ea_update(F32 dt)
{ {
delete force; delete force;
force = 0; 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; return false;
} }
force->onNewDataBlock(force_data, false); force->onNewDataBlock(force_data, false);
@ -123,8 +123,8 @@ bool afxEA_Force::ea_update(F32 dt)
if (force) // && in_scope) if (force) // && in_scope)
{ {
if (do_fades) if (mDo_fades)
force->setFadeAmount(fade_value); force->setFadeAmount(mFade_value);
force->update(dt); force->update(dt);
} }
@ -145,7 +145,7 @@ void afxEA_Force::ea_finish(bool was_stopped)
void afxEA_Force::do_runtime_substitutions() 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) afxForceSet::afxForceSet(const char* name)
{ {
this->name = (name) ? StringTable->insert(name) : ST_NULLSTRING; mName = (name) ? StringTable->insert(name) : ST_NULLSTRING;
update_dt = 10.0f; // seems like an ok maximum, force-xmods will probably lower it. mUpdate_dt = 10.0f; // seems like an ok maximum, force-xmods will probably lower it.
elapsed_dt = 0.0f; mElapsed_dt = 0.0f;
elapsed_ms = 0; mElapsed_ms = 0;
num_updates = 0; mNum_updates = 0;
last_num_updates = 0; mLast_num_updates = 0;
} }
void afxForceSet::remove(afxForce* force) 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; return;
} }
} }
@ -56,23 +56,23 @@ S32 afxForceSet::updateDT(F32 dt)
{ {
U32 now = Platform::getVirtualMilliseconds(); U32 now = Platform::getVirtualMilliseconds();
if (elapsed_ms == now) if (mElapsed_ms == now)
return last_num_updates; return mLast_num_updates;
elapsed_ms = now; mElapsed_ms = now;
elapsed_dt += dt; mElapsed_dt += dt;
if (elapsed_dt < update_dt) if (mElapsed_dt < mUpdate_dt)
{ {
last_num_updates = 0; mLast_num_updates = 0;
return 0; return 0;
} }
num_updates = mFloor(elapsed_dt/update_dt); mNum_updates = mFloor(mElapsed_dt/mUpdate_dt);
elapsed_dt -= update_dt*num_updates; mElapsed_dt -= mUpdate_dt*mNum_updates;
last_num_updates = num_updates; mLast_num_updates = mNum_updates;
return num_updates; return mNum_updates;
} }
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//

View file

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

View file

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

View file

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

View file

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

View file

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

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