mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 08:15:44 +00:00
More Implements
-Most Vehicles and FX classes -Vehicle classes may need more preloads for assets.
This commit is contained in:
parent
1ea693fea6
commit
704eb27600
14 changed files with 191 additions and 147 deletions
|
|
@ -152,7 +152,7 @@ HoverVehicleData::HoverVehicleData()
|
|||
jetEmitter[j] = 0;
|
||||
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
sound[i] = 0;
|
||||
INIT_SOUNDASSET_ARRAY(HoverSounds, i);
|
||||
}
|
||||
|
||||
HoverVehicleData::~HoverVehicleData()
|
||||
|
|
@ -232,14 +232,8 @@ void HoverVehicleData::initPersistFields()
|
|||
addField( "pitchForce", TypeF32, Offset(pitchForce, HoverVehicleData),
|
||||
"Pitch (rotation about the X-axis) force applied when steering in the y-axis direction." );
|
||||
|
||||
addField( "jetSound", TYPEID< SFXProfile >(), Offset(sound[JetSound], HoverVehicleData),
|
||||
"Looping sound played when the vehicle is jetting." );
|
||||
addField( "engineSound", TYPEID< SFXProfile >(), Offset(sound[EngineSound], HoverVehicleData),
|
||||
"Looping engine sound.\nThe volume is dynamically adjusted based on the "
|
||||
"current thrust level." );
|
||||
addField( "floatSound", TYPEID< SFXProfile >(), Offset(sound[FloatSound], HoverVehicleData),
|
||||
"Looping sound played while the vehicle is floating.\n\n@see stabMinLen" );
|
||||
|
||||
INITPERSISTFIELD_SOUNDASSET_ARRAY(HoverSounds, Sounds::MaxSounds, HoverVehicleData, "Sounds for hover vehicle.");
|
||||
|
||||
addField( "dustTrailEmitter", TYPEID< ParticleEmitterData >(), Offset(dustTrailEmitter, HoverVehicleData),
|
||||
"Emitter to generate particles for the vehicle's dust trail.\nThe trail "
|
||||
"of dust particles is generated only while the vehicle is moving." );
|
||||
|
|
@ -312,8 +306,11 @@ bool HoverVehicleData::preload(bool server, String &errorStr)
|
|||
// Resolve objects transmitted from server
|
||||
if (!server) {
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
if (sound[i])
|
||||
Sim::findObject(SimObjectId((uintptr_t)sound[i]),sound[i]);
|
||||
if (mHoverSounds[i])
|
||||
{
|
||||
_setHoverSounds(getHoverSounds(i), i);
|
||||
}
|
||||
|
||||
for (S32 j = 0; j < MaxJetEmitters; j++)
|
||||
if (jetEmitter[j])
|
||||
Sim::findObject(SimObjectId((uintptr_t)jetEmitter[j]),jetEmitter[j]);
|
||||
|
|
@ -361,9 +358,9 @@ void HoverVehicleData::packData(BitStream* stream)
|
|||
stream->write(dustTrailFreqMod);
|
||||
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
if (stream->writeFlag(sound[i]))
|
||||
stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)sound[i]):
|
||||
sound[i]->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast);
|
||||
{
|
||||
PACKDATA_SOUNDASSET_ARRAY(HoverSounds, i);
|
||||
}
|
||||
|
||||
for (S32 j = 0; j < MaxJetEmitters; j++)
|
||||
{
|
||||
|
|
@ -410,9 +407,9 @@ void HoverVehicleData::unpackData(BitStream* stream)
|
|||
stream->read(&dustTrailFreqMod);
|
||||
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
sound[i] = stream->readFlag()?
|
||||
(SFXProfile*)(uintptr_t)stream->readRangedU32(DataBlockObjectIdFirst,
|
||||
DataBlockObjectIdLast): 0;
|
||||
{
|
||||
UNPACKDATA_SOUNDASSET_ARRAY(HoverSounds, i);
|
||||
}
|
||||
|
||||
for (S32 j = 0; j < MaxJetEmitters; j++) {
|
||||
jetEmitter[j] = NULL;
|
||||
|
|
@ -539,14 +536,14 @@ bool HoverVehicle::onNewDataBlock(GameBaseData* dptr, bool reload)
|
|||
SFX_DELETE( mFloatSound );
|
||||
SFX_DELETE( mJetSound );
|
||||
|
||||
if ( mDataBlock->sound[HoverVehicleData::EngineSound] )
|
||||
mEngineSound = SFX->createSource( mDataBlock->sound[HoverVehicleData::EngineSound], &getTransform() );
|
||||
if ( mDataBlock->getHoverSounds(HoverVehicleData::EngineSound) )
|
||||
mEngineSound = SFX->createSource( mDataBlock->getHoverSoundProfile(HoverVehicleData::EngineSound), &getTransform() );
|
||||
|
||||
if ( !mDataBlock->sound[HoverVehicleData::FloatSound] )
|
||||
mFloatSound = SFX->createSource( mDataBlock->sound[HoverVehicleData::FloatSound], &getTransform() );
|
||||
if ( !mDataBlock->getHoverSounds(HoverVehicleData::FloatSound) )
|
||||
mFloatSound = SFX->createSource( mDataBlock->getHoverSoundProfile(HoverVehicleData::FloatSound), &getTransform() );
|
||||
|
||||
if ( mDataBlock->sound[HoverVehicleData::JetSound] )
|
||||
mJetSound = SFX->createSource( mDataBlock->sound[HoverVehicleData::JetSound], &getTransform() );
|
||||
if ( mDataBlock->getHoverSounds(HoverVehicleData::JetSound) )
|
||||
mJetSound = SFX->createSource( mDataBlock->getHoverSoundProfile(HoverVehicleData::JetSound), &getTransform() );
|
||||
}
|
||||
|
||||
// Todo: Uncomment if this is a "leaf" class
|
||||
|
|
|
|||
|
|
@ -46,7 +46,15 @@ class HoverVehicleData : public VehicleData
|
|||
FloatSound,
|
||||
MaxSounds
|
||||
};
|
||||
SFXProfile* sound[MaxSounds];
|
||||
DECLARE_SOUNDASSET_ARRAY(HoverVehicleData, HoverSounds, Sounds::MaxSounds);
|
||||
DECLARE_SOUNDASSET_ARRAY_SETGET(HoverVehicleData, HoverSounds);
|
||||
SFXProfile* getHoverSoundProfile(U32 id)
|
||||
{
|
||||
if (mHoverSoundsAsset[id] != NULL)
|
||||
return mHoverSoundsAsset[id]->getSfxProfile();
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
enum Jets {
|
||||
// These enums index into a static name list.
|
||||
|
|
|
|||
|
|
@ -166,7 +166,9 @@ VehicleData::VehicleData()
|
|||
powerSteering = false;
|
||||
|
||||
for (S32 i = 0; i < Body::MaxSounds; i++)
|
||||
body.sound[i] = 0;
|
||||
{
|
||||
INIT_SOUNDASSET_ARRAY(VehicleBodySounds, i);
|
||||
}
|
||||
|
||||
dustEmitter = NULL;
|
||||
dustID = 0;
|
||||
|
|
@ -189,7 +191,8 @@ VehicleData::VehicleData()
|
|||
medSplashSoundVel = 2.0;
|
||||
hardSplashSoundVel = 3.0;
|
||||
|
||||
dMemset(waterSound, 0, sizeof(waterSound));
|
||||
for (S32 i = 0; i < Sounds::MaxSounds; i++)
|
||||
INIT_SOUNDASSET_ARRAY(VehicleWaterSounds, i);
|
||||
|
||||
collDamageThresholdVel = 20;
|
||||
collDamageMultiplier = 0.05f;
|
||||
|
|
@ -215,8 +218,10 @@ bool VehicleData::preload(bool server, String &errorStr)
|
|||
// Resolve objects transmitted from server
|
||||
if (!server) {
|
||||
for (S32 i = 0; i < Body::MaxSounds; i++)
|
||||
if (body.sound[i])
|
||||
Sim::findObject(SimObjectId((uintptr_t)body.sound[i]),body.sound[i]);
|
||||
if (mVehicleBodySounds[i])
|
||||
{
|
||||
_setVehicleBodySounds(getVehicleBodySounds(i), i);
|
||||
}
|
||||
}
|
||||
|
||||
if( !dustEmitter && dustID != 0 )
|
||||
|
|
@ -264,10 +269,9 @@ void VehicleData::packData(BitStream* stream)
|
|||
stream->write(body.restitution);
|
||||
stream->write(body.friction);
|
||||
for (i = 0; i < Body::MaxSounds; i++)
|
||||
if (stream->writeFlag(body.sound[i]))
|
||||
stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)body.sound[i]):
|
||||
body.sound[i]->getId(),DataBlockObjectIdFirst,
|
||||
DataBlockObjectIdLast);
|
||||
{
|
||||
PACKDATA_SOUNDASSET_ARRAY(VehicleBodySounds, i);
|
||||
}
|
||||
|
||||
stream->write(minImpactSpeed);
|
||||
stream->write(softImpactSpeed);
|
||||
|
|
@ -308,9 +312,10 @@ void VehicleData::packData(BitStream* stream)
|
|||
stream->write(enablePhysicsRep);
|
||||
|
||||
// write the water sound profiles
|
||||
for(i = 0; i < MaxSounds; i++)
|
||||
if(stream->writeFlag(waterSound[i]))
|
||||
stream->writeRangedU32(waterSound[i]->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast);
|
||||
for (i = 0; i < MaxSounds; i++)
|
||||
{
|
||||
PACKDATA_SOUNDASSET_ARRAY(VehicleWaterSounds, i);
|
||||
}
|
||||
|
||||
if (stream->writeFlag( dustEmitter ))
|
||||
{
|
||||
|
|
@ -359,11 +364,9 @@ void VehicleData::unpackData(BitStream* stream)
|
|||
stream->read(&body.restitution);
|
||||
stream->read(&body.friction);
|
||||
S32 i;
|
||||
for (i = 0; i < Body::MaxSounds; i++) {
|
||||
body.sound[i] = NULL;
|
||||
if (stream->readFlag())
|
||||
body.sound[i] = (SFXProfile*)(uintptr_t)stream->readRangedU32(DataBlockObjectIdFirst,
|
||||
DataBlockObjectIdLast);
|
||||
for (i = 0; i < Body::MaxSounds; i++)
|
||||
{
|
||||
UNPACKDATA_SOUNDASSET_ARRAY(VehicleBodySounds, i);
|
||||
}
|
||||
|
||||
stream->read(&minImpactSpeed);
|
||||
|
|
@ -405,12 +408,10 @@ void VehicleData::unpackData(BitStream* stream)
|
|||
stream->read(&enablePhysicsRep);
|
||||
|
||||
// write the water sound profiles
|
||||
for(i = 0; i < MaxSounds; i++)
|
||||
if(stream->readFlag())
|
||||
{
|
||||
U32 id = stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast);
|
||||
waterSound[i] = dynamic_cast<SFXProfile*>( Sim::findObject(id) );
|
||||
}
|
||||
for (i = 0; i < Sounds::MaxSounds; i++)
|
||||
{
|
||||
UNPACKDATA_SOUNDASSET_ARRAY(VehicleWaterSounds, i);
|
||||
}
|
||||
|
||||
if( stream->readFlag() )
|
||||
{
|
||||
|
|
@ -491,15 +492,8 @@ void VehicleData::initPersistFields()
|
|||
addField( "bodyFriction", TypeF32, Offset(body.friction, VehicleData),
|
||||
"Collision friction coefficient.\nHow well this object will slide against "
|
||||
"objects it collides with." );
|
||||
addField( "softImpactSound", TYPEID< SFXProfile >(), Offset(body.sound[Body::SoftImpactSound], VehicleData),
|
||||
"@brief Sound to play on a 'soft' impact.\n\n"
|
||||
"This sound is played if the impact speed is < hardImpactSpeed and >= "
|
||||
"softImpactSpeed.\n\n"
|
||||
"@see softImpactSpeed" );
|
||||
addField( "hardImpactSound", TYPEID< SFXProfile >(), Offset(body.sound[Body::HardImpactSound], VehicleData),
|
||||
"@brief Sound to play on a 'hard' impact.\n\n"
|
||||
"This sound is played if the impact speed >= hardImpactSpeed.\n\n"
|
||||
"@see hardImpactSpeed" );
|
||||
|
||||
INITPERSISTFIELD_SOUNDASSET_ARRAY(VehicleBodySounds, Body::Sounds::MaxSounds, VehicleData, "Sounds for vehicle body impacts.");
|
||||
|
||||
addField( "minImpactSpeed", TypeF32, Offset(minImpactSpeed, VehicleData),
|
||||
"Minimum collision speed for the onImpact callback to be invoked." );
|
||||
|
|
@ -596,18 +590,8 @@ void VehicleData::initPersistFields()
|
|||
addField( "hardSplashSoundVelocity", TypeF32, Offset(hardSplashSoundVel, VehicleData),
|
||||
"Minimum velocity when entering the water for the imapactWaterHard sound "
|
||||
"to play.\n\n@see impactWaterHard" );
|
||||
addField( "exitingWater", TYPEID< SFXProfile >(), Offset(waterSound[ExitWater], VehicleData),
|
||||
"Sound to play when exiting the water." );
|
||||
addField( "impactWaterEasy", TYPEID< SFXProfile >(), Offset(waterSound[ImpactSoft], VehicleData),
|
||||
"Sound to play when entering the water with speed >= softSplashSoundVelocity "
|
||||
"and < mediumSplashSoundVelocity." );
|
||||
addField( "impactWaterMedium", TYPEID< SFXProfile >(), Offset(waterSound[ImpactMedium], VehicleData),
|
||||
"Sound to play when entering the water with speed >= mediumSplashSoundVelocity "
|
||||
"and < hardSplashSoundVelocity." );
|
||||
addField( "impactWaterHard", TYPEID< SFXProfile >(), Offset(waterSound[ImpactHard], VehicleData),
|
||||
"Sound to play when entering the water with speed >= hardSplashSoundVelocity." );
|
||||
addField( "waterWakeSound", TYPEID< SFXProfile >(), Offset(waterSound[Wake], VehicleData),
|
||||
"Looping sound to play while moving through the water." );
|
||||
|
||||
INITPERSISTFIELD_SOUNDASSET_ARRAY(WaterSounds, Sounds::MaxSounds, VehicleData, "Sounds for interacting with water.");
|
||||
|
||||
addField( "collDamageThresholdVel", TypeF32, Offset(collDamageThresholdVel, VehicleData),
|
||||
"Minimum collision velocity to cause damage to this vehicle.\nCurrently unused." );
|
||||
|
|
@ -876,8 +860,8 @@ bool Vehicle::onNewDataBlock(GameBaseData* dptr,bool reload)
|
|||
// costs and makes the system easier to understand.
|
||||
SFX_DELETE( mWakeSound );
|
||||
|
||||
if ( mDataBlock->waterSound[VehicleData::Wake] )
|
||||
mWakeSound = SFX->createSource( mDataBlock->waterSound[VehicleData::Wake], &getTransform() );
|
||||
if ( mDataBlock->getVehicleWaterSounds(VehicleData::Wake) != NULL )
|
||||
mWakeSound = SFX->createSource( mDataBlock->getVehicleWaterSoundProfile(VehicleData::Wake), &getTransform() );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -1140,27 +1124,27 @@ void Vehicle::updatePos(F32 dt)
|
|||
if (collSpeed >= mDataBlock->softImpactSpeed)
|
||||
impactSound = VehicleData::Body::SoftImpactSound;
|
||||
|
||||
if (impactSound != -1 && mDataBlock->body.sound[impactSound] != NULL)
|
||||
SFX->playOnce( mDataBlock->body.sound[impactSound], &getTransform() );
|
||||
if (impactSound != -1 && mDataBlock->getVehicleBodySounds(impactSound) != NULL)
|
||||
SFX->playOnce( mDataBlock->getVehicleBodySoundProfile(impactSound), &getTransform() );
|
||||
}
|
||||
|
||||
// Water volume sounds
|
||||
F32 vSpeed = getVelocity().len();
|
||||
if (!inLiquid && mWaterCoverage >= 0.8f) {
|
||||
if (vSpeed >= mDataBlock->hardSplashSoundVel)
|
||||
SFX->playOnce( mDataBlock->waterSound[VehicleData::ImpactHard], &getTransform() );
|
||||
SFX->playOnce( mDataBlock->getVehicleWaterSoundProfile(VehicleData::ImpactHard), &getTransform() );
|
||||
else
|
||||
if (vSpeed >= mDataBlock->medSplashSoundVel)
|
||||
SFX->playOnce( mDataBlock->waterSound[VehicleData::ImpactMedium], &getTransform() );
|
||||
SFX->playOnce( mDataBlock->getVehicleWaterSoundProfile(VehicleData::ImpactMedium), &getTransform() );
|
||||
else
|
||||
if (vSpeed >= mDataBlock->softSplashSoundVel)
|
||||
SFX->playOnce( mDataBlock->waterSound[VehicleData::ImpactSoft], &getTransform() );
|
||||
SFX->playOnce( mDataBlock->getVehicleWaterSoundProfile(VehicleData::ImpactSoft), &getTransform() );
|
||||
inLiquid = true;
|
||||
}
|
||||
else
|
||||
if(inLiquid && mWaterCoverage < 0.8f) {
|
||||
if (vSpeed >= mDataBlock->exitSplashSoundVel)
|
||||
SFX->playOnce( mDataBlock->waterSound[VehicleData::ExitWater], &getTransform() );
|
||||
SFX->playOnce( mDataBlock->getVehicleWaterSoundProfile(VehicleData::ExitWater), &getTransform() );
|
||||
inLiquid = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,11 +45,22 @@ struct VehicleData : public RigidShapeData
|
|||
HardImpactSound,
|
||||
MaxSounds,
|
||||
};
|
||||
SFXProfile* sound[MaxSounds];
|
||||
F32 restitution;
|
||||
F32 friction;
|
||||
} body;
|
||||
|
||||
DECLARE_SOUNDASSET_ARRAY(VehicleData, VehicleBodySounds, Body::Sounds::MaxSounds)
|
||||
DECLARE_SOUNDASSET_ARRAY_SETGET(VehicleData, VehicleBodySounds);
|
||||
|
||||
SFXProfile* getVehicleBodySoundProfile(U32 id)
|
||||
{
|
||||
if (mVehicleBodySoundsAsset[id] != NULL)
|
||||
return mVehicleBodySoundsAsset[id]->getSfxProfile();
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
enum VehicleConsts
|
||||
{
|
||||
VC_NUM_DUST_EMITTERS = 1,
|
||||
|
|
@ -69,7 +80,18 @@ struct VehicleData : public RigidShapeData
|
|||
Wake,
|
||||
MaxSounds
|
||||
};
|
||||
SFXProfile* waterSound[MaxSounds];
|
||||
|
||||
DECLARE_SOUNDASSET_ARRAY(VehicleData, VehicleWaterSounds, Sounds::MaxSounds)
|
||||
DECLARE_SOUNDASSET_ARRAY_SETGET(VehicleData, VehicleWaterSounds);
|
||||
|
||||
SFXProfile* getVehicleWaterSoundProfile(U32 id)
|
||||
{
|
||||
if (mVehicleWaterSoundsAsset[id] != NULL)
|
||||
return mVehicleWaterSoundsAsset[id]->getSfxProfile();
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
F32 exitSplashSoundVel;
|
||||
F32 softSplashSoundVel;
|
||||
F32 medSplashSoundVel;
|
||||
|
|
|
|||
|
|
@ -301,7 +301,7 @@ WheeledVehicleData::WheeledVehicleData()
|
|||
wheelCount = 0;
|
||||
dMemset(&wheel, 0, sizeof(wheel));
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
sound[i] = 0;
|
||||
INIT_SOUNDASSET_ARRAY(WheeledVehicleSounds, i);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -335,10 +335,9 @@ bool WheeledVehicleData::preload(bool server, String &errorStr)
|
|||
if (!server) {
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
{
|
||||
if (!sfxResolve(&sound[i], errorStr))
|
||||
if (mWheeledVehicleSounds[i])
|
||||
{
|
||||
delete si;
|
||||
return false;
|
||||
_setWheeledVehicleSounds(getWheeledVehicleSounds(i), i);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -438,16 +437,7 @@ bool WheeledVehicleData::mirrorWheel(Wheel* we)
|
|||
|
||||
void WheeledVehicleData::initPersistFields()
|
||||
{
|
||||
addField( "jetSound", TYPEID< SFXTrack >(), Offset(sound[JetSound], WheeledVehicleData),
|
||||
"Looping sound played when the vehicle is jetting." );
|
||||
addField( "engineSound", TYPEID< SFXTrack >(), Offset(sound[EngineSound], WheeledVehicleData),
|
||||
"@brief Looping engine sound.\n\n"
|
||||
"The pitch is dynamically adjusted based on the current engine RPM" );
|
||||
addField("squealSound", TYPEID< SFXTrack >(), Offset(sound[SquealSound], WheeledVehicleData),
|
||||
"@brief Looping sound played while any of the wheels is slipping.\n\n"
|
||||
"The volume is dynamically adjusted based on how much the wheels are slipping." );
|
||||
addField("WheelImpactSound", TYPEID< SFXTrack >(), Offset(sound[WheelImpactSound], WheeledVehicleData),
|
||||
"Sound played when the wheels impact the ground.\nCurrently unused." );
|
||||
INITPERSISTFIELD_SOUNDASSET_ARRAY(WheeledVehicleSounds, Sounds::MaxSounds, WheeledVehicleData, "Sounds related to wheeled vehicle.");
|
||||
|
||||
addField("tireEmitter",TYPEID< ParticleEmitterData >(), Offset(tireEmitter, WheeledVehicleData),
|
||||
"ParticleEmitterData datablock used to generate particles from each wheel "
|
||||
|
|
@ -481,7 +471,9 @@ void WheeledVehicleData::packData(BitStream* stream)
|
|||
tireEmitter->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast);
|
||||
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
sfxWrite( stream, sound[ i ] );
|
||||
{
|
||||
PACKDATA_SOUNDASSET_ARRAY(WheeledVehicleSounds, i);
|
||||
}
|
||||
|
||||
stream->write(maxWheelSpeed);
|
||||
stream->write(engineTorque);
|
||||
|
|
@ -498,7 +490,9 @@ void WheeledVehicleData::unpackData(BitStream* stream)
|
|||
DataBlockObjectIdLast): 0;
|
||||
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
sfxRead( stream, &sound[ i ] );
|
||||
{
|
||||
UNPACKDATA_SOUNDASSET_ARRAY(WheeledVehicleSounds, i);
|
||||
}
|
||||
|
||||
stream->read(&maxWheelSpeed);
|
||||
stream->read(&engineTorque);
|
||||
|
|
@ -683,14 +677,14 @@ bool WheeledVehicle::onNewDataBlock(GameBaseData* dptr, bool reload)
|
|||
SFX_DELETE( mSquealSound );
|
||||
SFX_DELETE( mJetSound );
|
||||
|
||||
if ( mDataBlock->sound[WheeledVehicleData::EngineSound] )
|
||||
mEngineSound = SFX->createSource( mDataBlock->sound[WheeledVehicleData::EngineSound], &getTransform() );
|
||||
if ( mDataBlock->getWheeledVehicleSounds(WheeledVehicleData::EngineSound) )
|
||||
mEngineSound = SFX->createSource( mDataBlock->getWheeledVehicleSound(WheeledVehicleData::EngineSound), &getTransform() );
|
||||
|
||||
if ( mDataBlock->sound[WheeledVehicleData::SquealSound] )
|
||||
mSquealSound = SFX->createSource( mDataBlock->sound[WheeledVehicleData::SquealSound], &getTransform() );
|
||||
if ( mDataBlock->getWheeledVehicleSounds(WheeledVehicleData::SquealSound) )
|
||||
mSquealSound = SFX->createSource( mDataBlock->getWheeledVehicleSound(WheeledVehicleData::SquealSound), &getTransform() );
|
||||
|
||||
if ( mDataBlock->sound[WheeledVehicleData::JetSound] )
|
||||
mJetSound = SFX->createSource( mDataBlock->sound[WheeledVehicleData::JetSound], &getTransform() );
|
||||
if ( mDataBlock->getWheeledVehicleSounds(WheeledVehicleData::JetSound) )
|
||||
mJetSound = SFX->createSource( mDataBlock->getWheeledVehicleSound(WheeledVehicleData::JetSound), &getTransform() );
|
||||
}
|
||||
|
||||
scriptOnNewDataBlock();
|
||||
|
|
|
|||
|
|
@ -118,7 +118,17 @@ struct WheeledVehicleData: public VehicleData
|
|||
WheelImpactSound,
|
||||
MaxSounds,
|
||||
};
|
||||
SFXTrack* sound[MaxSounds];
|
||||
DECLARE_SOUNDASSET_ARRAY(WheeledVehicleData, WheeledVehicleSounds, Sounds::MaxSounds);
|
||||
DECLARE_SOUNDASSET_ARRAY_SETGET(WheeledVehicleData, WheeledVehicleSounds);
|
||||
|
||||
SFXProfile* getWheeledVehicleSound(U32 id)
|
||||
{
|
||||
if (mWheeledVehicleSoundsAsset[id] != NULL)
|
||||
return mWheeledVehicleSoundsAsset[id]->getSfxProfile();
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
ParticleEmitterData* tireEmitter;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue