mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 00:54:54 +00:00
Merge pull request #1497 from Azaezel/soundEnumExtendability
footstep and impact enum extension support
This commit is contained in:
commit
1286a517d5
2 changed files with 9 additions and 48 deletions
|
|
@ -6884,31 +6884,13 @@ void Player::playFootstepSound( bool triggeredLeft, Material* contactMaterial, S
|
||||||
// Play default sound.
|
// Play default sound.
|
||||||
|
|
||||||
S32 sound = -1;
|
S32 sound = -1;
|
||||||
if( contactMaterial && contactMaterial->mFootstepSoundId != -1 )
|
if (contactMaterial && (contactMaterial->mImpactSoundId>-1 && contactMaterial->mImpactSoundId<PlayerData::MaxSoundOffsets))
|
||||||
sound = contactMaterial->mFootstepSoundId;
|
sound = contactMaterial->mFootstepSoundId;
|
||||||
else if( contactObject && contactObject->getTypeMask() & VehicleObjectType )
|
else if( contactObject && contactObject->getTypeMask() & VehicleObjectType )
|
||||||
sound = 2;
|
sound = 2;
|
||||||
|
|
||||||
switch ( sound )
|
if (sound>=0)
|
||||||
{
|
SFX->playOnce(mDataBlock->sound[sound], &footMat);
|
||||||
case 0: // Soft
|
|
||||||
SFX->playOnce( mDataBlock->sound[PlayerData::FootSoft], &footMat );
|
|
||||||
break;
|
|
||||||
case 1: // Hard
|
|
||||||
SFX->playOnce( mDataBlock->sound[PlayerData::FootHard], &footMat );
|
|
||||||
break;
|
|
||||||
case 2: // Metal
|
|
||||||
SFX->playOnce( mDataBlock->sound[PlayerData::FootMetal], &footMat );
|
|
||||||
break;
|
|
||||||
case 3: // Snow
|
|
||||||
SFX->playOnce( mDataBlock->sound[PlayerData::FootSnow], &footMat );
|
|
||||||
break;
|
|
||||||
/*
|
|
||||||
default: //Hard
|
|
||||||
SFX->playOnce( mDataBlock->sound[PlayerData::FootHard], &footMat );
|
|
||||||
break;
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6933,36 +6915,13 @@ void Player:: playImpactSound()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
S32 sound = -1;
|
S32 sound = -1;
|
||||||
if( material && material->mImpactSoundId )
|
if (material && (material->mImpactSoundId>-1 && material->mImpactSoundId<PlayerData::MaxSoundOffsets))
|
||||||
sound = material->mImpactSoundId;
|
sound = material->mImpactSoundId;
|
||||||
else if( rInfo.object->getTypeMask() & VehicleObjectType )
|
else if( rInfo.object->getTypeMask() & VehicleObjectType )
|
||||||
sound = 2; // Play metal;
|
sound = 2; // Play metal;
|
||||||
|
|
||||||
switch( sound )
|
if (sound >= 0)
|
||||||
{
|
SFX->playOnce(mDataBlock->sound[PlayerData::ImpactStart + sound], &getTransform());
|
||||||
case 0:
|
|
||||||
//Soft
|
|
||||||
SFX->playOnce( mDataBlock->sound[ PlayerData::ImpactSoft ], &getTransform() );
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
//Hard
|
|
||||||
SFX->playOnce( mDataBlock->sound[ PlayerData::ImpactHard ], &getTransform() );
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
//Metal
|
|
||||||
SFX->playOnce( mDataBlock->sound[ PlayerData::ImpactMetal ], &getTransform() );
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
//Snow
|
|
||||||
SFX->playOnce( mDataBlock->sound[ PlayerData::ImpactSnow ], &getTransform() );
|
|
||||||
break;
|
|
||||||
/*
|
|
||||||
default:
|
|
||||||
//Hard
|
|
||||||
alxPlay(mDataBlock->sound[PlayerData::ImpactHard], &getTransform());
|
|
||||||
break;
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -190,13 +190,15 @@ struct PlayerData: public ShapeBaseData {
|
||||||
FootHard,
|
FootHard,
|
||||||
FootMetal,
|
FootMetal,
|
||||||
FootSnow,
|
FootSnow,
|
||||||
|
MaxSoundOffsets,
|
||||||
FootShallowSplash,
|
FootShallowSplash,
|
||||||
FootWading,
|
FootWading,
|
||||||
FootUnderWater,
|
FootUnderWater,
|
||||||
FootBubbles,
|
FootBubbles,
|
||||||
MoveBubbles,
|
MoveBubbles,
|
||||||
WaterBreath,
|
WaterBreath,
|
||||||
ImpactSoft,
|
ImpactStart,
|
||||||
|
ImpactSoft = ImpactStart,
|
||||||
ImpactHard,
|
ImpactHard,
|
||||||
ImpactMetal,
|
ImpactMetal,
|
||||||
ImpactSnow,
|
ImpactSnow,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue