mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-06 14:00:39 +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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue