mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 16:14:38 +00:00
footstep and impact enum extension support
Removes hardcoded case statements in favor of an offset-driven approach.
This commit is contained in:
parent
c44d827c41
commit
62506214d0
2 changed files with 7 additions and 47 deletions
|
|
@ -6878,26 +6878,8 @@ void Player::playFootstepSound( bool triggeredLeft, Material* contactMaterial, S
|
||||||
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;
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6922,36 +6904,13 @@ void Player:: playImpactSound()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
S32 sound = -1;
|
S32 sound = -1;
|
||||||
if( material && material->mImpactSoundId )
|
if( material && (material->mImpactSoundId>=0) )
|
||||||
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;
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,8 @@ struct PlayerData: public ShapeBaseData {
|
||||||
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