Bläddra i källkod

uninitialized variables-t3d

AzaezelX 5 år sedan
förälder
incheckning
fabd5864fa

+ 1 - 1
Engine/source/T3D/assets/ImageAsset.cpp

@@ -103,7 +103,7 @@ EndImplementEnumType;
 
 
 //-----------------------------------------------------------------------------
-ImageAsset::ImageAsset() : AssetBase(), mImage(nullptr), mUseMips(true), mIsHDRImage(false), mIsValidImage(false)
+ImageAsset::ImageAsset() : AssetBase(), mImage(nullptr), mUseMips(true), mIsHDRImage(false), mIsValidImage(false), mImageType(Albedo)
 {
    mImageFileName = StringTable->EmptyString();
 }

+ 3 - 0
Engine/source/T3D/cameraSpline.cpp

@@ -36,6 +36,7 @@ CameraSpline::Knot::Knot()
    mSpeed = 0.0f;
    mType = NORMAL;
    mPath = SPLINE;
+   mDistance = 0.0f;
    prev = NULL; next = NULL;
 };
 
@@ -46,6 +47,7 @@ CameraSpline::Knot::Knot(const Knot &k)
    mSpeed    = k.mSpeed;
    mType = k.mType;
    mPath = k.mPath;
+   mDistance = k.mDistance;
    prev = NULL; next = NULL;
 }
 
@@ -56,6 +58,7 @@ CameraSpline::Knot::Knot(const Point3F &p, const QuatF &r, F32 s, Knot::Type typ
    mSpeed    = s;
    mType = type;
    mPath = path;
+   mDistance = 0.0f;
    prev = NULL; next = NULL;
 }
 

+ 2 - 2
Engine/source/T3D/convexShape.h

@@ -50,7 +50,7 @@ protected:
 
 public:
 
-	ConvexShapeCollisionConvex() { mType = ConvexShapeCollisionConvexType; }
+   ConvexShapeCollisionConvex() { pShape = NULL; mType = ConvexShapeCollisionConvexType; }
 
 	ConvexShapeCollisionConvex( const ConvexShapeCollisionConvex& cv ) {
 		mType      = ConvexShapeCollisionConvexType;
@@ -297,4 +297,4 @@ protected:
 
 };
 
-#endif // _CONVEXSHAPE_H_
+#endif // _CONVEXSHAPE_H_

+ 5 - 0
Engine/source/T3D/debris.cpp

@@ -157,6 +157,9 @@ DebrisData::DebrisData(const DebrisData& other, bool temp_clone) : GameBaseData(
    explosion = other.explosion;
    dMemcpy( emitterList, other.emitterList, sizeof( emitterList ) );
    dMemcpy( emitterIDList, other.emitterIDList, sizeof( emitterIDList ) ); // -- for pack/unpack of emitterList ptrs
+   mShatter = other.mShatter;
+   mProbBreak = other.mProbBreak;
+   mProbDepth = other.mProbDepth;
 }
 
 DebrisData::~DebrisData()
@@ -533,6 +536,8 @@ Debris::Debris()
    mInitialTrans.identity();
    mRadius = 0.2f;
    mStatic = false;
+   mElasticity = 0.5f;
+   mFriction = 0.5f;
 
    dMemset( mEmitterList, 0, sizeof( mEmitterList ) );
 

+ 17 - 0
Engine/source/T3D/decal/decalInstance.cpp

@@ -24,6 +24,23 @@
 #include "T3D/decal/decalInstance.h"
 #include "scene/sceneRenderState.h"
 
+DecalInstance::DecalInstance()
+   : mDataBlock(NULL),
+   mRotAroundNormal(0.0f),
+   mSize(0.0f),
+   mCreateTime(0),
+   mVisibility(1.0f),
+   mLastAlpha(1.0f),
+   mTextureRectIdx(0),
+   mVerts(NULL),
+   mIndices(NULL),
+   mVertCount(0),
+   mIndxCount(0),
+   mFlags(0),
+   mRenderPriority(0),
+   mId(-1),
+   mCustomTex(NULL)
+{}
 void DecalInstance::getWorldMatrix( MatrixF *outMat, bool flip )
 {
    outMat->setPosition( mPosition );

+ 1 - 1
Engine/source/T3D/decal/decalInstance.h

@@ -87,7 +87,7 @@ class DecalInstance
       /// Calculates the size of this decal onscreen in pixels, used for LOD.
       F32 calcPixelSize( U32 viewportHeight, const Point3F &cameraPos, F32 worldToScreenScaleY ) const;
    		
-	   DecalInstance() : mId(-1) {}   
+      DecalInstance();
 };
 
 #endif // _DECALINSTANCE_H_

+ 4 - 0
Engine/source/T3D/fx/explosion.cpp

@@ -238,6 +238,9 @@ ExplosionData::ExplosionData()
    explosionScale.set(1.0f, 1.0f, 1.0f);
    playSpeed = 1.0f;
 
+   explosionShape = NULL;
+   explosionAnimation = -1;
+
    dMemset( emitterList, 0, sizeof( emitterList ) );
    dMemset( emitterIDList, 0, sizeof( emitterIDList ) );
    dMemset( debrisList, 0, sizeof( debrisList ) );
@@ -924,6 +927,7 @@ Explosion::Explosion()
    ss_index = 0;
    mDataBlock = 0;
    soundProfile_clone = 0;
+   mRandomVal = 0;
 }
 
 Explosion::~Explosion()

+ 11 - 1
Engine/source/T3D/fx/fxFoliageReplicator.cpp

@@ -286,6 +286,7 @@ fxFoliageReplicator::fxFoliageReplicator()
    // Reset Foliage Count.
    mCurrentFoliageCount = 0;
 
+   dMemset(&mFrustumRenderSet, 0, sizeof(mFrustumRenderSet));
    // Reset Creation Area Angle Animation.
    mCreationAreaAngle = 0;
 
@@ -299,8 +300,15 @@ fxFoliageReplicator::fxFoliageReplicator()
 
    // Reset Frame Serial ID.
    mFrameSerialID = 0;
-
+   mQuadTreeLevels = 0;
+   mNextAllocatedNodeIdx = 0;
    mAlphaLookup = NULL;
+   mFadeInGradient = 0.0f;
+   mFadeOutGradient = 0.0f;
+   mGlobalSwayPhase = 0.0f;
+   mGlobalSwayTimeRatio = 1.0f;
+   mGlobalLightPhase = 0.0f;
+   mGlobalLightTimeRatio = 1.0f;
 
    mDirty = true;
 
@@ -317,6 +325,8 @@ fxFoliageReplicator::fxFoliageReplicator()
    mFoliageShaderTrueBillboardSC = NULL;
    mFoliageShaderGroundAlphaSC = NULL;
    mFoliageShaderAmbientColorSC = NULL;
+   mDiffuseTextureSC = NULL;
+   mAlphaMapTextureSC = NULL;
 
    mShaderData = NULL;
 }

+ 4 - 1
Engine/source/T3D/fx/lightning.cpp

@@ -248,7 +248,7 @@ LightningData::LightningData()
       strikeTextureNames[i] = NULL;
       strikeTextures[i] = NULL;
    }
-
+   numThunders = 0;
    mNumStrikeTextures = 0;
 }
 
@@ -371,6 +371,7 @@ Lightning::Lightning()
    mNetFlags.set(Ghostable|ScopeAlways);
    mTypeMask |= StaticObjectType|EnvironmentObjectType;
 
+   mDataBlock = NULL;
    mLastThink = 0;
 
    mStrikeListHead  = NULL;
@@ -1041,6 +1042,8 @@ LightningBolt::LightningBolt()
    maxMinorAngle = 15.0f;
    fadeTime = 0.2f;
    renderTime = 0.125;
+   dMemset(&mMajorNodes, 0, sizeof(mMajorNodes));
+   percentFade = 0.0f;
 }
 
 //--------------------------------------------------------------------------

+ 2 - 1
Engine/source/T3D/fx/particleEmitter.cpp

@@ -846,6 +846,7 @@ ParticleEmitterData::ParticleEmitterData(const ParticleEmitterData& other, bool
    textureName = other.textureName;
    textureHandle = other.textureHandle; // -- TextureHandle loads using textureName
    highResOnly = other.highResOnly;
+   glow = other.glow;
    renderReflection = other.renderReflection;
    fade_color = other.fade_color;
    fade_size = other.fade_size;
@@ -965,7 +966,7 @@ ParticleEmitter::ParticleEmitter()
    pos_pe.set(0,0,0);
    sort_priority = 0;
    mDataBlock = 0;
-   
+   std::fill_n(sizes, ParticleData::PDC_NUM_KEYS, 0.0f);
 #if defined(AFX_CAP_PARTICLE_POOLS)
    pool = 0;
 #endif 

+ 1 - 0
Engine/source/T3D/fx/ribbon.cpp

@@ -170,6 +170,7 @@ void RibbonData::unpackData(BitStream* stream)
 //
 Ribbon::Ribbon()
 {
+   mDataBlock = NULL;
    mTypeMask |= StaticObjectType;
 
    VECTOR_SET_ASSOCIATION(mSegmentPoints);

+ 0 - 3
Engine/source/T3D/fx/ribbonNode.h

@@ -37,9 +37,6 @@ class RibbonNodeData : public GameBaseData
 {
    typedef GameBaseData Parent;
 
-public:
-   F32 timeMultiple;
-
 public:
    RibbonNodeData();
    ~RibbonNodeData();

+ 3 - 1
Engine/source/T3D/fx/splash.cpp

@@ -309,6 +309,7 @@ Splash::Splash()
 
    mDelayMS = 0;
    mCurrMS = 0;
+   mRandAngle = 0;
    mEndingMS = 1000;
    mActive = false;
    mRadius = 0.0;
@@ -319,7 +320,8 @@ Splash::Splash()
    mElapsedTime = 0.0;
 
    mInitialNormal.set( 0.0, 0.0, 1.0 );
-
+   mFade = 0;
+   mFog = 0;
    // Only allocated client side.
    mNetFlags.set( IsGhost );
 }

+ 2 - 0
Engine/source/T3D/gameBase/gameBase.cpp

@@ -254,6 +254,8 @@ GameBase::GameBase()
    mTicksSinceLastMove = 0;
    mIsAiControlled = false;
 #endif
+   mTickCount = 0;
+   mCameraFov = 90.f;
 }
 
 GameBase::~GameBase()

+ 1 - 0
Engine/source/T3D/gameBase/moveList.cpp

@@ -26,6 +26,7 @@
 
 MoveList::MoveList()
 {
+   mConnection = NULL;
    mControlMismatch = false;
    reset();
 }

+ 2 - 0
Engine/source/T3D/guiMaterialPreview.cpp

@@ -61,6 +61,8 @@ GuiMaterialPreview::GuiMaterialPreview()
    // By default don't do dynamic reflection
    // updates for this viewport.
    mReflectPriority = 0.0f;
+   mMountedModel = NULL;
+   mSkinTag = 0;
 }
 
 GuiMaterialPreview::~GuiMaterialPreview()

+ 1 - 0
Engine/source/T3D/physics/physicsForce.cpp

@@ -43,6 +43,7 @@ ConsoleDocClass( PhysicsForce,
 PhysicsForce::PhysicsForce()
    :
       mWorld( NULL ),
+      mForce(0.0f),
       mPhysicsTick( false ),
       mBody( NULL )
 {

+ 8 - 0
Engine/source/T3D/player.cpp

@@ -311,6 +311,11 @@ PlayerData::PlayerData()
    jumpEnergyDrain = 0.0f;
    minJumpEnergy = 0.0f;
    jumpSurfaceAngle = 78.0f;
+   jumpSurfaceCos = mCos(mDegToRad(jumpSurfaceAngle));
+
+   for (U32 i = 0; i < NumRecoilSequences; i++)
+      recoilSequence[i] = -1;
+
    jumpDelay = 30;
    minJumpSpeed = 500.0f;
    maxJumpSpeed = 2.0f * minJumpSpeed;
@@ -370,6 +375,9 @@ PlayerData::PlayerData()
 
    actionCount = 0;
    lookAction = 0;
+   dMemset(spineNode, 0, sizeof(spineNode));
+
+   pickupDelta = 0.0f;
 
    // size of bounding box
    boxSize.set(1.0f, 1.0f, 2.3f);

+ 1 - 0
Engine/source/T3D/rigidShape.cpp

@@ -253,6 +253,7 @@ RigidShapeData::RigidShapeData()
 
    dustEmitter = NULL;
    dustID = 0;
+   triggerDustHeight = 3.0;
    dustHeight = 1.0;
 
    dMemset( splashEmitterList, 0, sizeof( splashEmitterList ) );

+ 1 - 1
Engine/source/T3D/shapeBase.h

@@ -111,7 +111,7 @@ class ShapeBaseConvex : public Convex
    Box3F       box;
 
   public:
-   ShapeBaseConvex() { mType = ShapeBaseConvexType; nodeTransform = 0; }
+   ShapeBaseConvex() :pShapeBase(NULL), transform(NULL), hullId(NULL), nodeTransform(0) { mType = ShapeBaseConvexType; }
    ShapeBaseConvex(const ShapeBaseConvex& cv) {
       mObject    = cv.mObject;
       pShapeBase = cv.pShapeBase;

+ 4 - 0
Engine/source/T3D/shapeImage.cpp

@@ -134,6 +134,8 @@ ShapeBaseImageData::StateData::StateData()
    recoil = NoRecoil;
    sound = 0;
    emitter = NULL;
+   shapeSequence = NULL;
+   shapeSequenceScale = true;
    script = 0;
    ignoreLoadedForReady = false;
    
@@ -1396,6 +1398,7 @@ ShapeBase::MountedImage::MountedImage()
    dataBlock = 0;
    nextImage = InvalidImagePtr;
    delayTime = 0;
+   rDT = 0.0f;
    ammo = false;
    target = false;
    triggerDown = false;
@@ -1408,6 +1411,7 @@ ShapeBase::MountedImage::MountedImage()
    motion = false;
    lightStart = 0;
    lightInfo = NULL;
+   dMemset(emitter, 0, sizeof(emitter));
 
    for (U32 i=0; i<ShapeBaseImageData::MaxGenericTriggers; ++i)
    {

+ 1 - 0
Engine/source/T3D/turret/aiTurretShape.cpp

@@ -119,6 +119,7 @@ AITurretShapeData::AITurretShapeData()
    }
    isAnimated = false;
    statesLoaded = false;
+   fireState = -1;
 }
 
 void AITurretShapeData::initPersistFields()

+ 9 - 3
Engine/source/T3D/turret/turretShape.cpp

@@ -114,17 +114,21 @@ TurretShapeData::TurretShapeData()
 
    headingNode = -1;
    pitchNode = -1;
-
-   for (U32 i=0; i<NumMirrorDirectionNodes; ++i)
+   U32 i = 0;
+   for (i=0; i<NumMirrorDirectionNodes; ++i)
    {
       pitchNodes[i] = -1;
       headingNodes[i] = -1;
    }
 
-   for (U32 i=0; i<ShapeBase::MaxMountedImages; ++i)
+   for (i=0; i<ShapeBase::MaxMountedImages; ++i)
    {
       weaponMountNode[i] = -1;
    }
+   for (i = 0; i < NumRecoilSequences;i++)
+      recoilSequence[i] = -1;
+   pitchSequence = -1;
+   headingSequence = -1;
 }
 
 void TurretShapeData::initPersistFields()
@@ -284,6 +288,8 @@ TurretShape::TurretShape()
 
    // For the Item class
    mSubclassItemHandlesScene = true;
+   mRecoilThread = NULL;
+   mImageStateThread = NULL;
 }
 
 TurretShape::~TurretShape()

+ 5 - 0
Engine/source/T3D/vehicles/flyingVehicle.cpp

@@ -322,6 +322,7 @@ ConsoleDocClass( FlyingVehicle,
 
 FlyingVehicle::FlyingVehicle()
 {
+   mDataBlock = NULL;
    mSteering.set(0,0);
    mThrottle = 0;
    mJetting = false;
@@ -332,6 +333,10 @@ FlyingVehicle::FlyingVehicle()
    mBackMaintainOn = false;
    mBottomMaintainOn = false;
    createHeightOn = false;
+   mCeilingFactor = 1.0f;
+   mThrustDirection = FlyingVehicle::ThrustForward;
+   for (U32 i=0;i< JetAnimCount;i++)
+      mJetSeq[i] = -1;
 
    for (S32 i = 0; i < JetAnimCount; i++)
       mJetThread[i] = 0;

+ 0 - 1
Engine/source/T3D/vehicles/flyingVehicle.h

@@ -77,7 +77,6 @@ struct FlyingVehicleData: public VehicleData {
 
    // Initialized in preload
    ClippedPolyList rigidBody;
-   S32 surfaceCount;
    F32 maxSpeed;
 
    enum JetNodes {

+ 12 - 6
Engine/source/T3D/vehicles/hoverVehicle.cpp

@@ -139,6 +139,7 @@ HoverVehicleData::HoverVehicleData()
    dustTrailID = 0;
    dustTrailOffset.set( 0.0f, 0.0f, 0.0f );
    dustTrailFreqMod = 15.0f;
+   maxThrustSpeed = 0;
    triggerTrailHeight = 2.5f;
 
    floatingGravMag = 1;
@@ -436,24 +437,29 @@ void HoverVehicleData::unpackData(BitStream* stream)
 //
 HoverVehicle::HoverVehicle()
 {
+   mDataBlock = NULL;
    // Todo: ScopeAlways?
    mNetFlags.set(Ghostable);
 
    mFloating      = false;
-   mForwardThrust = 0;
-   mReverseThrust = 0;
-   mLeftThrust    = 0;
-   mRightThrust   = 0;
+   mThrustLevel   = 0.0f;
+   mForwardThrust = 0.0f;
+   mReverseThrust = 0.0f;
+   mLeftThrust    = 0.0f;
+   mRightThrust   = 0.0f;
 
    mJetSound    = NULL;
    mEngineSound = NULL;
    mFloatSound  = NULL;
-
+   mThrustDirection = HoverVehicle::ThrustForward;
    mDustTrailEmitter = NULL;
 
    mBackMaintainOn = false;
    for (S32 i = 0; i < JetAnimCount; i++)
-      mJetThread[i] = 0;
+   {
+      mJetSeq[i] = -1;
+      mJetThread[i] = NULL;
+   }
 }
 
 HoverVehicle::~HoverVehicle()

+ 1 - 1
Engine/source/T3D/vehicles/wheeledVehicle.cpp

@@ -304,7 +304,7 @@ WheeledVehicleData::WheeledVehicleData()
    brakeLightSequence = -1;
    steeringSequence = -1;
    wheelCount = 0;
-
+   dMemset(&wheel, 0, sizeof(wheel));
    for (S32 i = 0; i < MaxSounds; i++)
       sound[i] = 0;
 }