mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-06 14:00:39 +00:00
misc fixes
utilize specialty case soundarray macros. slim duplicate entries in vehicle already hand;ed by rigidshape. create a gamebasedata::onnewdatablock which calls onremove and onadd for the db for those classes like wheeledvehicle that expect mounting logic to occur
This commit is contained in:
parent
54a2235128
commit
8821f62b0c
13 changed files with 98 additions and 420 deletions
|
|
@ -207,6 +207,27 @@ TriggerObjectType |
|
|||
CorpseObjectType;
|
||||
|
||||
|
||||
typedef RigidShapeData::Body::Sounds bodySounds;
|
||||
DefineEnumType(bodySounds);
|
||||
|
||||
ImplementEnumType(bodySounds, "enum types.\n"
|
||||
"@ingroup VehicleData\n\n")
|
||||
{ bodySounds::SoftImpactSound, "SoftImpactSound", "..." },
|
||||
{ bodySounds::HardImpactSound, "HardImpactSound", "..." },
|
||||
EndImplementEnumType;
|
||||
|
||||
typedef RigidShapeData::Sounds waterSounds;
|
||||
DefineEnumType(waterSounds);
|
||||
|
||||
ImplementEnumType(waterSounds, "enum types.\n"
|
||||
"@ingroup RigidShapeData\n\n")
|
||||
{ waterSounds::ExitWater, "ExitWater", "..." },
|
||||
{ waterSounds::ImpactSoft, "ImpactSoft", "..." },
|
||||
{ waterSounds::ImpactMedium, "ImpactMedium", "..." },
|
||||
{ waterSounds::ImpactHard, "ImpactHard", "..." },
|
||||
{ waterSounds::Wake, "Wake", "..." },
|
||||
EndImplementEnumType;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
RigidShapeData::RigidShapeData()
|
||||
|
|
@ -238,7 +259,7 @@ RigidShapeData::RigidShapeData()
|
|||
density = 4;
|
||||
|
||||
for (S32 i = 0; i < Body::MaxSounds; i++)
|
||||
INIT_ASSET_ARRAY(BodySounds, i);
|
||||
INIT_SOUNDASSET_ARRAY(BodySounds, i);
|
||||
|
||||
dustEmitter = NULL;
|
||||
dustID = 0;
|
||||
|
|
@ -257,7 +278,7 @@ RigidShapeData::RigidShapeData()
|
|||
enablePhysicsRep = true;
|
||||
|
||||
for (S32 i = 0; i < Sounds::MaxSounds; i++)
|
||||
INIT_ASSET_ARRAY(WaterSounds, i);
|
||||
INIT_SOUNDASSET_ARRAY(WaterSounds, i);
|
||||
|
||||
dragForce = 0;
|
||||
vertFactor = 0.25;
|
||||
|
|
@ -301,7 +322,7 @@ bool RigidShapeData::preload(bool server, String &errorStr)
|
|||
if (!server) {
|
||||
for (S32 i = 0; i < Body::MaxSounds; i++)
|
||||
{
|
||||
if (mBodySounds[i])
|
||||
if (getBodySounds(i) != StringTable->EmptyString())
|
||||
{
|
||||
_setBodySounds(getBodySounds(i), i);
|
||||
}
|
||||
|
|
@ -309,7 +330,7 @@ bool RigidShapeData::preload(bool server, String &errorStr)
|
|||
|
||||
for (S32 j = 0; j < Sounds::MaxSounds; j++)
|
||||
{
|
||||
if (mWaterSounds[j])
|
||||
if (getWaterSounds(j) != StringTable->EmptyString())
|
||||
{
|
||||
_setWaterSounds(getWaterSounds(j), j);
|
||||
}
|
||||
|
|
@ -371,7 +392,7 @@ void RigidShapeData::packData(BitStream* stream)
|
|||
stream->write(body.friction);
|
||||
for (U32 i = 0; i < Body::MaxSounds; ++i)
|
||||
{
|
||||
PACKDATA_ASSET_ARRAY(BodySounds, i);
|
||||
PACKDATA_SOUNDASSET_ARRAY(BodySounds, i);
|
||||
}
|
||||
|
||||
stream->write(minImpactSpeed);
|
||||
|
|
@ -391,8 +412,9 @@ void RigidShapeData::packData(BitStream* stream)
|
|||
stream->write(cameraLag);
|
||||
stream->write(cameraDecay);
|
||||
stream->write(cameraOffset);
|
||||
|
||||
stream->write( dustHeight );
|
||||
|
||||
stream->write(triggerDustHeight);
|
||||
stream->write(dustHeight);
|
||||
|
||||
stream->write(exitSplashSoundVel);
|
||||
stream->write(softSplashSoundVel);
|
||||
|
|
@ -403,7 +425,7 @@ void RigidShapeData::packData(BitStream* stream)
|
|||
// write the water sound profiles
|
||||
for (U32 i = 0; i < Sounds::MaxSounds; ++i)
|
||||
{
|
||||
PACKDATA_ASSET_ARRAY(WaterSounds, i);
|
||||
PACKDATA_SOUNDASSET_ARRAY(WaterSounds, i);
|
||||
}
|
||||
|
||||
if (stream->writeFlag( dustEmitter ))
|
||||
|
|
@ -434,7 +456,7 @@ void RigidShapeData::unpackData(BitStream* stream)
|
|||
|
||||
for (U32 i = 0; i < Body::Sounds::MaxSounds; i++)
|
||||
{
|
||||
UNPACKDATA_ASSET_ARRAY(BodySounds, i);
|
||||
UNPACKDATA_SOUNDASSET_ARRAY(BodySounds, i);
|
||||
}
|
||||
|
||||
stream->read(&minImpactSpeed);
|
||||
|
|
@ -455,6 +477,7 @@ void RigidShapeData::unpackData(BitStream* stream)
|
|||
stream->read(&cameraDecay);
|
||||
stream->read(&cameraOffset);
|
||||
|
||||
stream->read(&triggerDustHeight);
|
||||
stream->read( &dustHeight );
|
||||
|
||||
stream->read(&exitSplashSoundVel);
|
||||
|
|
@ -466,7 +489,7 @@ void RigidShapeData::unpackData(BitStream* stream)
|
|||
// write the water sound profiles
|
||||
for (U32 i = 0; i < Sounds::MaxSounds; ++i)
|
||||
{
|
||||
UNPACKDATA_ASSET_ARRAY(WaterSounds, i);
|
||||
UNPACKDATA_SOUNDASSET_ARRAY(WaterSounds, i);
|
||||
}
|
||||
|
||||
if( stream->readFlag() )
|
||||
|
|
@ -539,14 +562,14 @@ void RigidShapeData::initPersistFields()
|
|||
|
||||
addGroup( "Sounds" );
|
||||
|
||||
INITPERSISTFIELD_SOUNDASSET_ARRAY(BodySounds, Body::Sounds::MaxSounds, RigidShapeData, "Sounds for body.");
|
||||
INITPERSISTFIELD_SOUNDASSET_ENUMED(BodySounds, bodySounds, Body::Sounds::MaxSounds, RigidShapeData, "Sounds for body.");
|
||||
|
||||
addField("exitSplashSoundVelocity", TypeF32, Offset(exitSplashSoundVel, RigidShapeData), "The minimum velocity at which the exit splash sound will be played when emerging from water.\n");
|
||||
addField("softSplashSoundVelocity", TypeF32, Offset(softSplashSoundVel, RigidShapeData),"The minimum velocity at which the soft splash sound will be played when impacting water.\n");
|
||||
addField("mediumSplashSoundVelocity", TypeF32, Offset(medSplashSoundVel, RigidShapeData), "The minimum velocity at which the medium splash sound will be played when impacting water.\n");
|
||||
addField("hardSplashSoundVelocity", TypeF32, Offset(hardSplashSoundVel, RigidShapeData), "The minimum velocity at which the hard splash sound will be played when impacting water.\n");
|
||||
|
||||
INITPERSISTFIELD_SOUNDASSET_ARRAY(WaterSounds, Sounds::MaxSounds, RigidShapeData, "Sounds for interacting with water.");
|
||||
INITPERSISTFIELD_SOUNDASSET_ENUMED(WaterSounds, waterSounds, Sounds::MaxSounds, RigidShapeData, "Sounds for interacting with water.");
|
||||
|
||||
endGroup( "Sounds" );
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue