cleanups for sound assets

removed redundant get<foo>Profile calls, correctly used a few in proxmine
This commit is contained in:
AzaezelX 2021-11-27 00:32:25 -06:00
parent 3c30a905c3
commit 93faa243ac
11 changed files with 25 additions and 81 deletions

View file

@ -426,8 +426,8 @@ void ProximityMine::processTick( const Move* move )
mAnimThread = mShapeInstance->addThread();
mShapeInstance->setSequence( mAnimThread, mDataBlock->armingSequence, 0.0f );
}
if ( mDataBlock->getArmSound() )
SFX->playOnce( mDataBlock->getArmSoundAsset()->getSfxProfile(), &getRenderTransform() );
if ( mDataBlock->getArmSoundProfile() )
SFX->playOnce( mDataBlock->getArmSoundProfile(), &getRenderTransform() );
}
break;
@ -467,8 +467,8 @@ void ProximityMine::processTick( const Move* move )
mAnimThread = mShapeInstance->addThread();
mShapeInstance->setSequence( mAnimThread, mDataBlock->triggerSequence, 0.0f );
}
if ( mDataBlock->getTriggerSound() )
SFX->playOnce( mDataBlock->getTriggerSoundAsset()->getSfxProfile(), &getRenderTransform() );
if ( mDataBlock->getTriggerSoundProfile() )
SFX->playOnce( mDataBlock->getTriggerSoundProfile(), &getRenderTransform() );
if ( isServerObject() )
mDataBlock->onTriggered_callback( this, sql.mList[0] );

View file

@ -1172,27 +1172,27 @@ void RigidShape::updatePos(F32 dt)
if (collSpeed >= mDataBlock->softImpactSpeed)
impactSound = RigidShapeData::Body::SoftImpactSound;
if (impactSound != -1 && mDataBlock->getBodySounds(impactSound) != NULL)
SFX->playOnce(mDataBlock->getBodySoundProfile(impactSound), &getTransform());
if (impactSound != -1 && mDataBlock->getBodySoundsProfile(impactSound))
SFX->playOnce(mDataBlock->getBodySoundsProfile(impactSound), &getTransform());
}
// Water volume sounds
F32 vSpeed = getVelocity().len();
if (!inLiquid && mWaterCoverage >= 0.8f) {
if (vSpeed >= mDataBlock->hardSplashSoundVel)
SFX->playOnce(mDataBlock->getWaterSoundProfile(RigidShapeData::ImpactHard), &getTransform());
SFX->playOnce(mDataBlock->getWaterSoundsProfile(RigidShapeData::ImpactHard), &getTransform());
else
if (vSpeed >= mDataBlock->medSplashSoundVel)
SFX->playOnce(mDataBlock->getWaterSoundProfile(RigidShapeData::ImpactMedium), &getTransform());
SFX->playOnce(mDataBlock->getWaterSoundsProfile(RigidShapeData::ImpactMedium), &getTransform());
else
if (vSpeed >= mDataBlock->softSplashSoundVel)
SFX->playOnce(mDataBlock->getWaterSoundProfile(RigidShapeData::ImpactSoft), &getTransform());
SFX->playOnce(mDataBlock->getWaterSoundsProfile(RigidShapeData::ImpactSoft), &getTransform());
inLiquid = true;
}
else
if (inLiquid && mWaterCoverage < 0.8f) {
if (vSpeed >= mDataBlock->exitSplashSoundVel)
SFX->playOnce(mDataBlock->getWaterSoundProfile(RigidShapeData::ExitWater), &getTransform());
SFX->playOnce(mDataBlock->getWaterSoundsProfile(RigidShapeData::ExitWater), &getTransform());
inLiquid = false;
}
}

View file

@ -66,14 +66,6 @@ class RigidShapeData : public ShapeBaseData
DECLARE_SOUNDASSET_ARRAY(RigidShapeData, BodySounds, Body::Sounds::MaxSounds)
DECLARE_ASSET_ARRAY_SETGET(RigidShapeData, BodySounds);
SFXProfile* getBodySoundProfile(U32 id)
{
if (mBodySoundsAsset[id] != NULL)
return mBodySoundsAsset[id]->getSfxProfile();
return NULL;
}
enum RigidShapeConsts
{
VC_NUM_DUST_EMITTERS = 1,
@ -94,14 +86,6 @@ class RigidShapeData : public ShapeBaseData
DECLARE_SOUNDASSET_ARRAY(RigidShapeData, WaterSounds, Sounds::MaxSounds)
DECLARE_ASSET_ARRAY_SETGET(RigidShapeData, WaterSounds);
SFXProfile* getWaterSoundProfile(U32 id)
{
if (mWaterSoundsAsset[id] != NULL)
return mWaterSoundsAsset[id]->getSfxProfile();
return NULL;
}
F32 exitSplashSoundVel;
F32 softSplashSoundVel;
F32 medSplashSoundVel;

View file

@ -367,10 +367,10 @@ bool FlyingVehicle::onNewDataBlock(GameBaseData* dptr, bool reload)
SFX_DELETE( mEngineSound );
if ( mDataBlock->getFlyingSounds(FlyingVehicleData::EngineSound) )
mEngineSound = SFX->createSource( mDataBlock->getFlyingSoundProfile(FlyingVehicleData::EngineSound), &getTransform() );
mEngineSound = SFX->createSource( mDataBlock->getFlyingSoundsProfile(FlyingVehicleData::EngineSound), &getTransform() );
if ( mDataBlock->getFlyingSounds(FlyingVehicleData::JetSound))
mJetSound = SFX->createSource( mDataBlock->getFlyingSoundProfile(FlyingVehicleData::JetSound), &getTransform() );
mJetSound = SFX->createSource( mDataBlock->getFlyingSoundsProfile(FlyingVehicleData::JetSound), &getTransform() );
}
// Jet Sequences

View file

@ -47,13 +47,6 @@ struct FlyingVehicleData: public VehicleData {
};
DECLARE_SOUNDASSET_ARRAY(FlyingVehicleData, FlyingSounds, Sounds::MaxSounds);
DECLARE_ASSET_ARRAY_SETGET(FlyingVehicleData, FlyingSounds);
SFXProfile* getFlyingSoundProfile(U32 id)
{
if (mFlyingSoundsAsset[id] != NULL)
return mFlyingSoundsAsset[id]->getSfxProfile();
return NULL;
}
enum Jets {
// These enums index into a static name list.

View file

@ -543,13 +543,13 @@ bool HoverVehicle::onNewDataBlock(GameBaseData* dptr, bool reload)
SFX_DELETE( mJetSound );
if ( mDataBlock->getHoverSounds(HoverVehicleData::EngineSound) )
mEngineSound = SFX->createSource( mDataBlock->getHoverSoundProfile(HoverVehicleData::EngineSound), &getTransform() );
mEngineSound = SFX->createSource( mDataBlock->getHoverSoundsProfile(HoverVehicleData::EngineSound), &getTransform() );
if ( !mDataBlock->getHoverSounds(HoverVehicleData::FloatSound) )
mFloatSound = SFX->createSource( mDataBlock->getHoverSoundProfile(HoverVehicleData::FloatSound), &getTransform() );
mFloatSound = SFX->createSource( mDataBlock->getHoverSoundsProfile(HoverVehicleData::FloatSound), &getTransform() );
if ( mDataBlock->getHoverSounds(HoverVehicleData::JetSound) )
mJetSound = SFX->createSource( mDataBlock->getHoverSoundProfile(HoverVehicleData::JetSound), &getTransform() );
mJetSound = SFX->createSource( mDataBlock->getHoverSoundsProfile(HoverVehicleData::JetSound), &getTransform() );
}
// Todo: Uncomment if this is a "leaf" class

View file

@ -47,13 +47,6 @@ class HoverVehicleData : public VehicleData
MaxSounds
};
DECLARE_SOUNDASSET_ARRAY(HoverVehicleData, HoverSounds, Sounds::MaxSounds);
SFXProfile* getHoverSoundProfile(U32 id)
{
if (mHoverSoundsAsset[id] != NULL)
return mHoverSoundsAsset[id]->getSfxProfile();
return NULL;
}
enum Jets {
// These enums index into a static name list.

View file

@ -893,7 +893,7 @@ bool Vehicle::onNewDataBlock(GameBaseData* dptr,bool reload)
SFX_DELETE( mWakeSound );
if ( mDataBlock->getVehicleWaterSounds(VehicleData::Wake) != NULL )
mWakeSound = SFX->createSource( mDataBlock->getVehicleWaterSoundProfile(VehicleData::Wake), &getTransform() );
mWakeSound = SFX->createSource( mDataBlock->getVehicleWaterSoundsProfile(VehicleData::Wake), &getTransform() );
}
return true;
@ -1156,27 +1156,27 @@ void Vehicle::updatePos(F32 dt)
if (collSpeed >= mDataBlock->softImpactSpeed)
impactSound = VehicleData::Body::SoftImpactSound;
if (impactSound != -1 && mDataBlock->getVehicleBodySounds(impactSound) != NULL)
SFX->playOnce( mDataBlock->getVehicleBodySoundProfile(impactSound), &getTransform() );
if (impactSound != -1 && mDataBlock->getVehicleBodySoundsProfile(impactSound) != NULL)
SFX->playOnce( mDataBlock->getVehicleBodySoundsProfile(impactSound), &getTransform() );
}
// Water volume sounds
F32 vSpeed = getVelocity().len();
if (!inLiquid && mWaterCoverage >= 0.8f) {
if (vSpeed >= mDataBlock->hardSplashSoundVel)
SFX->playOnce( mDataBlock->getVehicleWaterSoundProfile(VehicleData::ImpactHard), &getTransform() );
SFX->playOnce( mDataBlock->getVehicleWaterSoundsProfile(VehicleData::ImpactHard), &getTransform() );
else
if (vSpeed >= mDataBlock->medSplashSoundVel)
SFX->playOnce( mDataBlock->getVehicleWaterSoundProfile(VehicleData::ImpactMedium), &getTransform() );
SFX->playOnce( mDataBlock->getVehicleWaterSoundsProfile(VehicleData::ImpactMedium), &getTransform() );
else
if (vSpeed >= mDataBlock->softSplashSoundVel)
SFX->playOnce( mDataBlock->getVehicleWaterSoundProfile(VehicleData::ImpactSoft), &getTransform() );
SFX->playOnce( mDataBlock->getVehicleWaterSoundsProfile(VehicleData::ImpactSoft), &getTransform() );
inLiquid = true;
}
else
if(inLiquid && mWaterCoverage < 0.8f) {
if (vSpeed >= mDataBlock->exitSplashSoundVel)
SFX->playOnce( mDataBlock->getVehicleWaterSoundProfile(VehicleData::ExitWater), &getTransform() );
SFX->playOnce( mDataBlock->getVehicleWaterSoundsProfile(VehicleData::ExitWater), &getTransform() );
inLiquid = false;
}
}

View file

@ -51,15 +51,6 @@ struct VehicleData : public RigidShapeData
DECLARE_SOUNDASSET_ARRAY(VehicleData, VehicleBodySounds, Body::Sounds::MaxSounds)
SFXProfile* getVehicleBodySoundProfile(U32 id)
{
if (mVehicleBodySoundsAsset[id] != NULL)
return mVehicleBodySoundsAsset[id]->getSfxProfile();
return NULL;
}
enum VehicleConsts
{
VC_NUM_DUST_EMITTERS = 1,
@ -82,14 +73,6 @@ struct VehicleData : public RigidShapeData
DECLARE_SOUNDASSET_ARRAY(VehicleData, VehicleWaterSounds, Sounds::MaxSounds)
SFXProfile* getVehicleWaterSoundProfile(U32 id)
{
if (mVehicleWaterSoundsAsset[id] != NULL)
return mVehicleWaterSoundsAsset[id]->getSfxProfile();
return NULL;
}
F32 exitSplashSoundVel;
F32 softSplashSoundVel;
F32 medSplashSoundVel;

View file

@ -686,13 +686,13 @@ bool WheeledVehicle::onNewDataBlock(GameBaseData* dptr, bool reload)
SFX_DELETE( mJetSound );
if ( mDataBlock->getWheeledVehicleSounds(WheeledVehicleData::EngineSound) )
mEngineSound = SFX->createSource( mDataBlock->getWheeledVehicleSound(WheeledVehicleData::EngineSound), &getTransform() );
mEngineSound = SFX->createSource( mDataBlock->getWheeledVehicleSoundsProfile(WheeledVehicleData::EngineSound), &getTransform() );
if ( mDataBlock->getWheeledVehicleSounds(WheeledVehicleData::SquealSound) )
mSquealSound = SFX->createSource( mDataBlock->getWheeledVehicleSound(WheeledVehicleData::SquealSound), &getTransform() );
mSquealSound = SFX->createSource( mDataBlock->getWheeledVehicleSoundsProfile(WheeledVehicleData::SquealSound), &getTransform() );
if ( mDataBlock->getWheeledVehicleSounds(WheeledVehicleData::JetSound) )
mJetSound = SFX->createSource( mDataBlock->getWheeledVehicleSound(WheeledVehicleData::JetSound), &getTransform() );
mJetSound = SFX->createSource( mDataBlock->getWheeledVehicleSoundsProfile(WheeledVehicleData::JetSound), &getTransform() );
}
scriptOnNewDataBlock();

View file

@ -121,15 +121,6 @@ struct WheeledVehicleData: public VehicleData
DECLARE_SOUNDASSET_ARRAY(WheeledVehicleData, WheeledVehicleSounds, Sounds::MaxSounds);
SFXProfile* getWheeledVehicleSound(U32 id)
{
if (mWheeledVehicleSoundsAsset[id] != NULL)
return mWheeledVehicleSoundsAsset[id]->getSfxProfile();
return NULL;
}
ParticleEmitterData* tireEmitter;
F32 maxWheelSpeed; // Engine torque is scale based on wheel speed