MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / playFootstepSound

Method playFootstepSound

Engine/source/T3D/player.cpp:7017–7061  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7015//-----------------------------------------------------------------------------
7016
7017void Player::playFootstepSound( bool triggeredLeft, Material* contactMaterial, SceneObject* contactObject )
7018{
7019 if (footfallSoundOverride > 0)
7020 return;
7021 MatrixF footMat = getTransform();
7022 if( mWaterCoverage > 0.0 )
7023 {
7024 // Treading water.
7025
7026 if ( mWaterCoverage < mDataBlock->footSplashHeight )
7027 SFX->playOnce( mDataBlock->getPlayerSoundProfile( PlayerData::FootShallowSplash ), &footMat );
7028 else
7029 {
7030 if ( mWaterCoverage < 1.0 )
7031 SFX->playOnce( mDataBlock->getPlayerSoundProfile( PlayerData::FootWading ), &footMat );
7032 else
7033 {
7034 if ( triggeredLeft )
7035 {
7036 SFX->playOnce( mDataBlock->getPlayerSoundProfile( PlayerData::FootUnderWater ), &footMat );
7037 SFX->playOnce( mDataBlock->getPlayerSoundProfile( PlayerData::FootBubbles ), &footMat );
7038 }
7039 }
7040 }
7041 }
7042 else if( contactMaterial && contactMaterial->getCustomFootstepSoundProfile())
7043 {
7044 // Footstep sound defined on material.
7045
7046 SFX->playOnce( contactMaterial->getCustomFootstepSoundProfile(), &footMat );
7047 }
7048 else
7049 {
7050 // Play default sound.
7051
7052 S32 sound = -1;
7053 if (contactMaterial && (contactMaterial->mFootstepSoundId > -1 && contactMaterial->mFootstepSoundId < PlayerData::WaterStart))
7054 sound = contactMaterial->mFootstepSoundId;
7055 else if( contactObject && contactObject->getTypeMask() & VehicleObjectType )
7056 sound = 2;
7057
7058 if (sound>=0)
7059 SFX->playOnce(mDataBlock->getPlayerSoundProfile(sound), &footMat);
7060 }
7061}
7062
7063void Player:: playImpactSound()
7064{

Callers

nothing calls this directly

Calls 2

getTypeMaskMethod · 0.80
playOnceMethod · 0.45

Tested by

no test coverage detected