mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-25 07:04:45 +00:00
Merge bc7c55b980 into a181f488b2
This commit is contained in:
commit
50b66dc429
|
|
@ -59,33 +59,52 @@
|
|||
|
||||
IMPLEMENT_CONOBJECT(SoundAsset);
|
||||
|
||||
ConsoleType(SoundAssetPtr, TypeSoundAssetPtr, const char*, ASSET_ID_FIELD_PREFIX)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// REFACTOR
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_STRUCT(AssetPtr<SoundAsset>, AssetPtrSoundAsset, , "")
|
||||
END_IMPLEMENT_STRUCT
|
||||
|
||||
ConsoleType(SoundAssetPtr, TypeSoundAssetPtr, AssetPtr<SoundAsset>, ASSET_ID_FIELD_PREFIX)
|
||||
|
||||
ConsoleGetType(TypeSoundAssetPtr)
|
||||
{
|
||||
// Fetch asset Id.
|
||||
return *((const char**)(dptr));
|
||||
return (*((AssetPtr<SoundAsset>*)dptr)).getAssetId();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleSetType(TypeSoundAssetPtr)
|
||||
{
|
||||
// Was a single argument specified?
|
||||
if (argc == 1)
|
||||
{
|
||||
// Yes, so fetch field value.
|
||||
*((const char**)dptr) = StringTable->insert(argv[0]);
|
||||
const char* pFieldValue = argv[0];
|
||||
|
||||
// Fetch asset pointer.
|
||||
AssetPtr<SoundAsset>* pAssetPtr = dynamic_cast<AssetPtr<SoundAsset>*>((AssetPtrBase*)(dptr));
|
||||
|
||||
// Is the asset pointer the correct type?
|
||||
if (pAssetPtr == NULL)
|
||||
{
|
||||
Con::warnf("(TypeSoundAssetPtrRefactor) - Failed to set asset Id '%d'.", pFieldValue);
|
||||
return;
|
||||
}
|
||||
|
||||
// Set asset.
|
||||
pAssetPtr->setAssetId(pFieldValue);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Warn.
|
||||
Con::warnf("(TypeSoundAssetPtr) - Cannot set multiple args to a single asset.");
|
||||
Con::warnf("(TypeSoundAssetPtrRefactor) - Cannot set multiple args to a single asset.");
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// REFACTOR END
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleType(assetIdString, TypeSoundAssetId, const char*, ASSET_ID_FIELD_PREFIX)
|
||||
|
|
@ -122,7 +141,6 @@ const String SoundAsset::mErrCodeStrings[] =
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
SoundAsset::SoundAsset()
|
||||
: AssetBase()
|
||||
{
|
||||
dMemset(mPlaylist.mSlots.mReplayMode, 0, sizeof(mPlaylist.mSlots.mReplayMode));
|
||||
dMemset(mPlaylist.mSlots.mTransitionIn, 0, sizeof(mPlaylist.mSlots.mTransitionIn));
|
||||
|
|
@ -134,7 +152,7 @@ SoundAsset::SoundAsset()
|
|||
for (U32 i = 0; i < SFXPlayList::NUM_SLOTS; i++)
|
||||
{
|
||||
mSoundFile[i] = StringTable->EmptyString();
|
||||
mSoundPath[i] = StringTable->EmptyString();
|
||||
mSoundResource[i] = NULL;
|
||||
|
||||
mPlaylist.mSlots.mTransitionOut[i] = SFXPlayList::TRANSITION_Wait;
|
||||
mPlaylist.mSlots.mVolumeScale.mValue[i] = 1.f;
|
||||
|
|
@ -173,7 +191,8 @@ SoundAsset::SoundAsset()
|
|||
mProfileDesc.mPriority = 1.0f;
|
||||
mProfileDesc.mSourceGroup = NULL;
|
||||
mProfileDesc.mFadeInEase = EaseF();
|
||||
mProfileDesc.mReverb = SFXSoundReverbProperties();
|
||||
mProfileDesc.mSourceGroup = dynamic_cast<SFXSource*>(Sim::findObject("AudioChannelMaster"));
|
||||
|
||||
dMemset(mProfileDesc.mParameters, 0, sizeof(mProfileDesc.mParameters));
|
||||
mIsPlaylist = false;
|
||||
|
||||
|
|
@ -183,21 +202,25 @@ SoundAsset::SoundAsset()
|
|||
mPlaylist.mLoopMode = SFXPlayList::LOOP_All;
|
||||
mPlaylist.mActiveSlots = 1;
|
||||
|
||||
mResolvedTrack = NULL;
|
||||
mResolvedDescription = NULL;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
SoundAsset::~SoundAsset()
|
||||
{
|
||||
|
||||
for (U32 i = 0; i < SFXPlayList::NUM_SLOTS; i++)
|
||||
if (mResolvedTrack)
|
||||
{
|
||||
if(mSFXProfile[i].isProperlyAdded() && !mSFXProfile[i].isDeleted())
|
||||
mSFXProfile[i].unregisterObject();
|
||||
if (mResolvedTrack->isProperlyAdded() && !mResolvedTrack->isDeleted())
|
||||
mResolvedTrack->deleteObject();
|
||||
}
|
||||
|
||||
if (mPlaylist.isProperlyAdded() && !mPlaylist.isDeleted())
|
||||
mPlaylist.unregisterObject();
|
||||
if (mResolvedDescription)
|
||||
{
|
||||
if (mResolvedDescription->isProperlyAdded() && !mResolvedDescription->isDeleted())
|
||||
mResolvedDescription->deleteObject();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -323,15 +346,37 @@ void SoundAsset::initPersistFields()
|
|||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void SoundAsset::onRemove()
|
||||
{
|
||||
for (U32 i = 0; i < SFXPlayList::SFXPlaylistSettings::NUM_SLOTS; i++)
|
||||
{
|
||||
if (mSoundFile[i] == StringTable->EmptyString())
|
||||
break;
|
||||
|
||||
Torque::FS::RemoveChangeNotification(mSoundFile[i], this, &SoundAsset::_onResourceChanged);
|
||||
}
|
||||
|
||||
Parent::onRemove();
|
||||
}
|
||||
|
||||
void SoundAsset::inspectPostApply()
|
||||
{
|
||||
Parent::inspectPostApply();
|
||||
|
||||
refreshAsset();
|
||||
}
|
||||
|
||||
void SoundAsset::copyTo(SimObject* object)
|
||||
{
|
||||
// Call to parent.
|
||||
Parent::copyTo(object);
|
||||
|
||||
}
|
||||
|
||||
void SoundAsset::initializeAsset(void)
|
||||
{
|
||||
Parent::initializeAsset();
|
||||
|
||||
for (U32 i = 0; i < SFXPlayList::SFXPlaylistSettings::NUM_SLOTS; i++)
|
||||
{
|
||||
if (i == 0 && mSoundFile[i] == StringTable->EmptyString())
|
||||
|
|
@ -340,10 +385,12 @@ void SoundAsset::initializeAsset(void)
|
|||
if (mSoundFile[i] == StringTable->EmptyString())
|
||||
break;
|
||||
|
||||
mSoundPath[i] = getOwned() ? expandAssetFilePath(mSoundFile[i]) : mSoundPath[i];
|
||||
if (!Torque::FS::IsFile(mSoundPath[i]))
|
||||
Con::errorf("SoundAsset::initializeAsset (%s)[%d] could not find %s!", getAssetName(), i, mSoundPath[i]);
|
||||
mSoundFile[i] = expandAssetFilePath(mSoundFile[i]);
|
||||
if (getOwned())
|
||||
Torque::FS::AddChangeNotification(mSoundFile[i], this, &SoundAsset::_onResourceChanged);
|
||||
}
|
||||
|
||||
populateSFXTrack();
|
||||
}
|
||||
|
||||
void SoundAsset::_onResourceChanged(const Torque::Path &path)
|
||||
|
|
@ -351,132 +398,47 @@ void SoundAsset::_onResourceChanged(const Torque::Path &path)
|
|||
for (U32 i = 0; i < SFXPlayList::NUM_SLOTS; i++)
|
||||
{
|
||||
|
||||
if (path != Torque::Path(mSoundPath[i]))
|
||||
if (path != Torque::Path(mSoundFile[i]))
|
||||
return;
|
||||
}
|
||||
|
||||
refreshAsset();
|
||||
}
|
||||
|
||||
void SoundAsset::onAssetRefresh(void)
|
||||
{
|
||||
for (U32 i = 0; i < SFXPlayList::SFXPlaylistSettings::NUM_SLOTS; i++)
|
||||
{
|
||||
if (i == 0 && mSoundFile[i] == StringTable->EmptyString())
|
||||
return;
|
||||
if (!isProperlyAdded())
|
||||
return;
|
||||
|
||||
if (mSoundFile[i] == StringTable->EmptyString())
|
||||
break;
|
||||
|
||||
mSoundPath[i] = getOwned() ? expandAssetFilePath(mSoundFile[i]) : mSoundPath[i];
|
||||
}
|
||||
Parent::onAssetRefresh();
|
||||
|
||||
populateSFXTrack();
|
||||
}
|
||||
|
||||
U32 SoundAsset::load()
|
||||
{
|
||||
if (mLoadedState == AssetErrCode::Ok) return mLoadedState;
|
||||
if (mLoadedState == AssetErrCode::Ok)
|
||||
return mLoadedState;
|
||||
|
||||
// find out how many active slots we have.
|
||||
U32 numSlots = 0;
|
||||
for (U32 i = 0; i < SFXPlayList::SFXPlaylistSettings::NUM_SLOTS; i++)
|
||||
if (!mResolvedTrack)
|
||||
{
|
||||
if (i == 0 && mSoundPath[i] == StringTable->EmptyString())
|
||||
return false;
|
||||
|
||||
if (mSoundPath[i] == StringTable->EmptyString())
|
||||
break;
|
||||
|
||||
numSlots++;
|
||||
}
|
||||
|
||||
if (mProfileDesc.mSourceGroup == NULL)
|
||||
mProfileDesc.mSourceGroup = dynamic_cast<SFXSource*>(Sim::findObject("AudioChannelMaster"));
|
||||
|
||||
if (numSlots > 1)
|
||||
{
|
||||
mIsPlaylist = true;
|
||||
|
||||
for (U32 i = 0; i < numSlots; i++)
|
||||
if (mIsPlaylist)
|
||||
{
|
||||
if (mSoundPath[i])
|
||||
{
|
||||
if (!Torque::FS::IsFile(mSoundPath[i]))
|
||||
{
|
||||
Con::errorf("SoundAsset::initializeAsset: Attempted to load file %s but it was not valid!", mSoundFile[i]);
|
||||
mLoadedState = BadFileReference;
|
||||
mSFXProfile[i].setDescription(NULL);
|
||||
mSFXProfile[i].setSoundFileName(StringTable->insert(StringTable->EmptyString()));
|
||||
mSFXProfile[i].setPreload(false);
|
||||
return mLoadedState;
|
||||
}
|
||||
else
|
||||
{
|
||||
SFXProfile* trackProfile = new SFXProfile();
|
||||
trackProfile->setDescription(&mProfileDesc);
|
||||
trackProfile->setSoundFileName(mSoundPath[i]);
|
||||
trackProfile->setPreload(mPreload);
|
||||
|
||||
mSFXProfile[i] = *trackProfile;
|
||||
mSFXProfile[i].registerObject(String::ToString("%s_profile_track%d", getAssetName()).c_str());
|
||||
|
||||
mPlaylist.mSlots.mTrack[i] = trackProfile;
|
||||
|
||||
}
|
||||
}
|
||||
mResolvedTrack = buildPlaylist();
|
||||
}
|
||||
else
|
||||
{
|
||||
mResolvedTrack = buildProfile();
|
||||
}
|
||||
|
||||
mPlaylist.setDescription(&mProfileDesc);
|
||||
mPlaylist.registerObject(String::ToString("%s_playlist", getAssetName()).c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mSoundPath[0])
|
||||
{
|
||||
if (!Torque::FS::IsFile(mSoundPath[0]))
|
||||
{
|
||||
Con::errorf("SoundAsset::initializeAsset: Attempted to load file %s but it was not valid!", mSoundFile[0]);
|
||||
mLoadedState = BadFileReference;
|
||||
mSFXProfile[0].setDescription(NULL);
|
||||
mSFXProfile[0].setSoundFileName(StringTable->insert(StringTable->EmptyString()));
|
||||
mSFXProfile[0].setPreload(false);
|
||||
return mLoadedState;
|
||||
}
|
||||
else
|
||||
{
|
||||
mSFXProfile[0].setDescription(&mProfileDesc);
|
||||
mSFXProfile[0].setSoundFileName(mSoundPath[0]);
|
||||
mSFXProfile[0].setPreload(mPreload);
|
||||
|
||||
mSFXProfile[0].registerObject(String::ToString("%s_profile", getAssetName()).c_str());
|
||||
}
|
||||
|
||||
}
|
||||
mResolvedTrack->registerObject(String::ToString("%s_profile_track", getAssetName()).c_str());
|
||||
}
|
||||
|
||||
mChangeSignal.trigger();
|
||||
mLoadedState = Ok;
|
||||
return mLoadedState;
|
||||
}
|
||||
|
||||
bool SoundAsset::_setSoundFile(void* object, const char* index, const char* data)
|
||||
{
|
||||
SoundAsset* pData = static_cast<SoundAsset*>(object);
|
||||
|
||||
U32 id = 0;
|
||||
if (index)
|
||||
id = dAtoui(index);
|
||||
|
||||
// Update.
|
||||
pData->mSoundFile[id] = StringTable->insert(data, true);
|
||||
if (pData->mSoundFile[id] == StringTable->EmptyString())
|
||||
pData->mSoundPath[id] = StringTable->EmptyString();
|
||||
|
||||
// Refresh the asset.
|
||||
pData->refreshAsset();
|
||||
return true;
|
||||
}
|
||||
|
||||
StringTableEntry SoundAsset::getAssetIdByFileName(StringTableEntry fileName)
|
||||
StringTableEntry SoundAsset::getAssetIdByFilename(StringTableEntry fileName)
|
||||
{
|
||||
if (fileName == StringTable->EmptyString())
|
||||
return StringTable->EmptyString();
|
||||
|
|
@ -492,7 +454,7 @@ StringTableEntry SoundAsset::getAssetIdByFileName(StringTableEntry fileName)
|
|||
SoundAsset* soundAsset = AssetDatabase.acquireAsset<SoundAsset>(query.mAssetList[i]);
|
||||
if (soundAsset)
|
||||
{
|
||||
if (soundAsset->getSoundPath() == fileName)
|
||||
if (soundAsset->getSoundFile() == fileName)
|
||||
soundAssetId = soundAsset->getAssetId();
|
||||
|
||||
AssetDatabase.releaseAsset(query.mAssetList[i]);
|
||||
|
|
@ -519,7 +481,7 @@ U32 SoundAsset::getAssetById(StringTableEntry assetId, AssetPtr<SoundAsset>* sou
|
|||
}
|
||||
}
|
||||
|
||||
U32 SoundAsset::getAssetByFileName(StringTableEntry fileName, AssetPtr<SoundAsset>* soundAsset)
|
||||
U32 SoundAsset::getAssetByFilename(StringTableEntry fileName, AssetPtr<SoundAsset>* soundAsset)
|
||||
{
|
||||
AssetQuery query;
|
||||
U32 foundAssetcount = AssetDatabase.findAssetType(&query, "SoundAsset");
|
||||
|
|
@ -534,7 +496,7 @@ U32 SoundAsset::getAssetByFileName(StringTableEntry fileName, AssetPtr<SoundAsse
|
|||
for (U32 i = 0; i < foundAssetcount; i++)
|
||||
{
|
||||
SoundAsset* tSoundAsset = AssetDatabase.acquireAsset<SoundAsset>(query.mAssetList[i]);
|
||||
if (tSoundAsset && tSoundAsset->getSoundPath() == fileName)
|
||||
if (tSoundAsset && tSoundAsset->getSoundFile() == fileName)
|
||||
{
|
||||
soundAsset->setAssetId(query.mAssetList[i]);
|
||||
AssetDatabase.releaseAsset(query.mAssetList[i]);
|
||||
|
|
@ -548,9 +510,162 @@ U32 SoundAsset::getAssetByFileName(StringTableEntry fileName, AssetPtr<SoundAsse
|
|||
return AssetErrCode::Failed;
|
||||
}
|
||||
|
||||
void SoundAsset::buildDescription()
|
||||
{
|
||||
if (!mResolvedDescription)
|
||||
{
|
||||
mResolvedDescription = new SFXDescription;
|
||||
// calls on add which should validate the description. but do it on mProfileDesc before applying values anyway.
|
||||
mResolvedDescription->registerObject(String::ToString("%s_profile_description", getAssetName()).c_str());
|
||||
}
|
||||
|
||||
mProfileDesc.validate();
|
||||
|
||||
mResolvedDescription->mPitch = mProfileDesc.mPitch;
|
||||
mResolvedDescription->mVolume = mProfileDesc.mVolume;
|
||||
mResolvedDescription->mIs3D = mProfileDesc.mIs3D;
|
||||
mResolvedDescription->mIsLooping = mProfileDesc.mIsLooping;
|
||||
mResolvedDescription->mIsStreaming = mProfileDesc.mIsStreaming;
|
||||
mResolvedDescription->mUseHardware = mProfileDesc.mUseHardware;
|
||||
mResolvedDescription->mMinDistance = mProfileDesc.mMinDistance;
|
||||
mResolvedDescription->mMaxDistance = mProfileDesc.mMaxDistance;
|
||||
mResolvedDescription->mConeInsideAngle = mProfileDesc.mConeInsideAngle;
|
||||
mResolvedDescription->mConeOutsideAngle = mProfileDesc.mConeOutsideAngle;
|
||||
mResolvedDescription->mConeOutsideVolume = mProfileDesc.mConeOutsideVolume;
|
||||
mResolvedDescription->mRolloffFactor = mProfileDesc.mRolloffFactor;
|
||||
mResolvedDescription->mFadeInTime = mProfileDesc.mFadeInTime;
|
||||
mResolvedDescription->mFadeOutTime = mProfileDesc.mFadeOutTime;
|
||||
mResolvedDescription->mFadeLoops = mProfileDesc.mFadeLoops;
|
||||
mResolvedDescription->mScatterDistance = mProfileDesc.mScatterDistance;
|
||||
mResolvedDescription->mStreamPacketSize = mProfileDesc.mStreamPacketSize;
|
||||
mResolvedDescription->mStreamReadAhead = mProfileDesc.mStreamReadAhead;
|
||||
mResolvedDescription->mPriority = mProfileDesc.mPriority;
|
||||
mResolvedDescription->mSourceGroup = mProfileDesc.mSourceGroup;
|
||||
mResolvedDescription->mFadeInEase = mProfileDesc.mFadeInEase;
|
||||
mResolvedDescription->mSourceGroup = mProfileDesc.mSourceGroup;
|
||||
}
|
||||
|
||||
SFXProfile* SoundAsset::buildProfile()
|
||||
{
|
||||
SFXProfile* profile = new SFXProfile(mResolvedDescription, mSoundFile[0], mPreload);
|
||||
mSoundResource[0] = profile->getResource();
|
||||
return profile;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// BUILD PLAYLIST
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
SFXPlayList* SoundAsset::buildPlaylist()
|
||||
{
|
||||
SFXPlayList* pl = new SFXPlayList();
|
||||
|
||||
pl->mRandomMode = mPlaylist.mRandomMode;
|
||||
pl->mLoopMode = mPlaylist.mLoopMode;
|
||||
pl->mNumSlotsToPlay = mPlaylist.mNumSlotsToPlay;
|
||||
pl->mTrace = mPlaylist.mTrace;
|
||||
pl->mSlots = mPlaylist.mSlots;
|
||||
|
||||
// Build child tracks for each valid slot
|
||||
for (U32 i = 0; i < SFXPlayList::SFXPlaylistSettings::NUM_SLOTS; ++i)
|
||||
{
|
||||
if (mSoundFile[i] == StringTable->EmptyString())
|
||||
continue;
|
||||
|
||||
// Build child SFXProfile
|
||||
SFXProfile* child = new SFXProfile(mResolvedDescription, mSoundFile[i], mPreload);
|
||||
mSoundResource[i] = child->getResource();
|
||||
pl->mSlots.mTrack[i] = child;
|
||||
}
|
||||
|
||||
return pl;
|
||||
}
|
||||
|
||||
void SoundAsset::populateSFXTrack(void)
|
||||
{
|
||||
U32 count = 0;
|
||||
for (U32 i = 0; i < SFXPlayList::SFXPlaylistSettings::NUM_SLOTS; ++i)
|
||||
if (mSoundFile[i] != StringTable->EmptyString() && Torque::FS::IsFile(mSoundFile[i]))
|
||||
++count;
|
||||
|
||||
mIsPlaylist = (count > 1);
|
||||
|
||||
buildDescription();
|
||||
|
||||
if (mResolvedTrack && mResolvedDescription)
|
||||
{
|
||||
if (SFX)
|
||||
SFX->notifyDescriptionChanged(mResolvedDescription);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
mResolvedTrack = NULL;
|
||||
|
||||
// reset loaded state.
|
||||
mLoadedState = AssetErrCode::NotLoaded;
|
||||
}
|
||||
|
||||
void SoundAsset::setSoundFile(StringTableEntry pSoundFile, U32 slot)
|
||||
{
|
||||
AssertFatal(pSoundFile != NULL, "Cannot use a NULL sound file.");
|
||||
|
||||
pSoundFile = StringTable->insert(pSoundFile);
|
||||
|
||||
if (pSoundFile == mSoundFile[slot])
|
||||
return;
|
||||
|
||||
mSoundFile[slot] = getOwned() ? expandAssetFilePath(pSoundFile) : StringTable->insert(pSoundFile);;
|
||||
|
||||
refreshAsset();
|
||||
}
|
||||
|
||||
void SoundAsset::onTamlPreWrite(void)
|
||||
{
|
||||
// Call parent.
|
||||
Parent::onTamlPreWrite();
|
||||
|
||||
for (U32 i = 0; i < SFXPlayList::SFXPlaylistSettings::NUM_SLOTS; i++)
|
||||
{
|
||||
if (mSoundFile[i] == StringTable->EmptyString())
|
||||
break;
|
||||
|
||||
mSoundFile[i] = collapseAssetFilePath(mSoundFile[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void SoundAsset::onTamlPostWrite(void)
|
||||
{
|
||||
for (U32 i = 0; i < SFXPlayList::SFXPlaylistSettings::NUM_SLOTS; i++)
|
||||
{
|
||||
if (mSoundFile[i] == StringTable->EmptyString())
|
||||
break;
|
||||
|
||||
mSoundFile[i] = expandAssetFilePath(mSoundFile[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void SoundAsset::onTamlCustomWrite(TamlCustomNodes& customNodes)
|
||||
{
|
||||
// Debug Profiling.
|
||||
PROFILE_SCOPE(SoundAsset_OnTamlCustomWrite);
|
||||
|
||||
// Call parent.
|
||||
Parent::onTamlCustomRead(customNodes);
|
||||
}
|
||||
|
||||
void SoundAsset::onTamlCustomRead(const TamlCustomNodes& customNodes)
|
||||
{
|
||||
// Debug Profiling.
|
||||
PROFILE_SCOPE(SoundAsset_OnTamlCustomRead);
|
||||
|
||||
// Call parent.
|
||||
Parent::onTamlCustomRead(customNodes);
|
||||
}
|
||||
|
||||
DefineEngineMethod(SoundAsset, getSoundPath, const char*, (), , "")
|
||||
{
|
||||
return object->getSoundPath();
|
||||
return object->getSoundFile();
|
||||
}
|
||||
|
||||
DefineEngineMethod(SoundAsset, playSound, S32, (Point3F position), (Point3F::Zero),
|
||||
|
|
@ -581,7 +696,7 @@ DefineEngineStaticMethod(SoundAsset, getAssetIdByFilename, const char*, (const c
|
|||
"Queries the Asset Database to see if any asset exists that is associated with the provided file path.\n"
|
||||
"@return The AssetId of the associated asset, if any.")
|
||||
{
|
||||
return SoundAsset::getAssetIdByFileName(StringTable->insert(filePath));
|
||||
return SoundAsset::getAssetIdByFilename(StringTable->insert(filePath));
|
||||
}
|
||||
IMPLEMENT_CONOBJECT(GuiInspectorTypeSoundAssetPtr);
|
||||
|
||||
|
|
|
|||
|
|
@ -87,16 +87,7 @@ class SoundAsset : public AssetBase
|
|||
typedef AssetPtr<SoundAsset> ConcreteAssetPtr;
|
||||
|
||||
protected:
|
||||
StringTableEntry mSoundFile[SFXPlayList::SFXPlaylistSettings::NUM_SLOTS];
|
||||
StringTableEntry mSoundPath[SFXPlayList::SFXPlaylistSettings::NUM_SLOTS];
|
||||
SFXProfile mSFXProfile[SFXPlayList::SFXPlaylistSettings::NUM_SLOTS];
|
||||
|
||||
SFXDescription mProfileDesc;
|
||||
SFXPlayList mPlaylist;
|
||||
// subtitles
|
||||
StringTableEntry mSubtitleString;
|
||||
bool mPreload;
|
||||
bool mIsPlaylist;
|
||||
|
||||
//SFXPlayList::SlotData mSlots;
|
||||
|
||||
/*These will be needed in the refactor!
|
||||
|
|
@ -121,9 +112,6 @@ protected:
|
|||
F32 mPriority;
|
||||
*/
|
||||
|
||||
typedef Signal<void()> SoundAssetChanged;
|
||||
SoundAssetChanged mChangeSignal;
|
||||
|
||||
public:
|
||||
enum SoundAssetErrCode
|
||||
{
|
||||
|
|
@ -142,179 +130,150 @@ public:
|
|||
if (errCode > SoundAssetErrCode::Extended) return "undefined error";
|
||||
return mErrCodeStrings[errCode - Parent::Extended];
|
||||
};
|
||||
|
||||
private:
|
||||
StringTableEntry mSoundFile[SFXPlayList::SFXPlaylistSettings::NUM_SLOTS];
|
||||
Resource<SFXResource> mSoundResource[SFXPlayList::SFXPlaylistSettings::NUM_SLOTS];
|
||||
|
||||
SFXDescription mProfileDesc;
|
||||
|
||||
SFXPlayList mPlaylist;
|
||||
// subtitles
|
||||
StringTableEntry mSubtitleString;
|
||||
bool mPreload;
|
||||
bool mIsPlaylist;
|
||||
SFXTrack* mResolvedTrack;
|
||||
SFXDescription* mResolvedDescription;
|
||||
|
||||
public:
|
||||
SoundAsset();
|
||||
virtual ~SoundAsset();
|
||||
|
||||
/// Engine.
|
||||
static void initPersistFields();
|
||||
void onRemove() override;
|
||||
void inspectPostApply() override;
|
||||
void copyTo(SimObject* object) override;
|
||||
|
||||
//SFXResource* getSound() { return mSoundResource; }
|
||||
Resource<SFXResource> getSoundResource(const U32 slotId = 0) { load(); return mSFXProfile[slotId].getResource(); }
|
||||
Resource<SFXResource> getSoundResource(const U32 slotId = 0) { load(); return mSoundResource[slotId]; }
|
||||
|
||||
/// Declare Console Object.
|
||||
DECLARE_CONOBJECT(SoundAsset);
|
||||
|
||||
static bool _setSoundFile(void* object, const char* index, const char* data);
|
||||
// asset Base load
|
||||
U32 load() override;
|
||||
inline StringTableEntry getSoundPath(const U32 slotId = 0) const { return mSoundPath[slotId]; };
|
||||
SFXProfile* getSfxProfile(const U32 slotId = 0) { return &mSFXProfile[slotId]; }
|
||||
SFXPlayList* getSfxPlaylist() { return &mPlaylist; }
|
||||
SFXTrack* getSFXTrack() { load(); return mIsPlaylist ? dynamic_cast<SFXTrack*>(&mPlaylist) : dynamic_cast<SFXTrack*>(&mSFXProfile[0]); }
|
||||
SFXDescription* getSfxDescription() { return &mProfileDesc; }
|
||||
|
||||
void setSoundFile(StringTableEntry pSoundFile, U32 slot = 0);
|
||||
inline StringTableEntry getSoundFile(U32 slot = 0) { return mSoundFile[slot]; }
|
||||
inline StringTableEntry getRelativeSoundFile(U32 slot = 0) { return collapseAssetFilePath(mSoundFile[slot]); }
|
||||
|
||||
SFXTrack* getSFXTrack() { load(); return mResolvedTrack; }
|
||||
SFXDescription* getSfxDescription() { return mResolvedDescription ? mResolvedDescription : &mProfileDesc; }
|
||||
bool isPlaylist(){ return mIsPlaylist; }
|
||||
|
||||
bool isLoop() { return mProfileDesc.mIsLooping; }
|
||||
bool is3D() { return mProfileDesc.mIs3D; }
|
||||
|
||||
static StringTableEntry getAssetIdByFileName(StringTableEntry fileName);
|
||||
static StringTableEntry getAssetIdByFilename(StringTableEntry fileName);
|
||||
static U32 getAssetById(StringTableEntry assetId, AssetPtr<SoundAsset>* materialAsset);
|
||||
static U32 getAssetByFileName(StringTableEntry fileName, AssetPtr<SoundAsset>* matAsset);
|
||||
static U32 getAssetByFilename(StringTableEntry fileName, AssetPtr<SoundAsset>* matAsset);
|
||||
|
||||
void buildDescription();
|
||||
SFXProfile* buildProfile();
|
||||
SFXPlayList* buildPlaylist();
|
||||
|
||||
void populateSFXTrack(void);
|
||||
|
||||
protected:
|
||||
void initializeAsset(void) override;
|
||||
void _onResourceChanged(const Torque::Path & path);
|
||||
void onAssetRefresh(void) override;
|
||||
// Asset Base callback
|
||||
void initializeAsset(void) override;
|
||||
void _onResourceChanged(const Torque::Path & path);
|
||||
void onAssetRefresh(void) override;
|
||||
|
||||
/// Taml callbacks.
|
||||
void onTamlPreWrite(void) override;
|
||||
void onTamlPostWrite(void) override;
|
||||
void onTamlCustomWrite(TamlCustomNodes& customNodes) override;
|
||||
void onTamlCustomRead(const TamlCustomNodes& customNodes) override;
|
||||
|
||||
protected:
|
||||
static bool _setSoundFile(void* obj, const char* index, const char* data) { U32 idx = 0; if (index) idx = dAtoi(index); static_cast<SoundAsset*>(obj)->setSoundFile(data, idx); return false; }
|
||||
|
||||
};
|
||||
|
||||
DefineConsoleType(TypeSoundAssetPtr, SoundAsset)
|
||||
DECLARE_STRUCT(AssetPtr<SoundAsset>)
|
||||
DefineConsoleType(TypeSoundAssetPtr, AssetPtr<SoundAsset>)
|
||||
|
||||
DefineConsoleType(TypeSoundAssetId, String)
|
||||
|
||||
#pragma region Singular Asset Macros
|
||||
|
||||
//Singular assets
|
||||
/// <Summary>
|
||||
/// Declares a sound asset
|
||||
/// This establishes the assetId, asset and legacy filepath fields, along with supplemental getter and setter functions
|
||||
/// </Summary>
|
||||
#define DECLARE_SOUNDASSET(className, name) public: \
|
||||
Resource<SFXResource> m##name;\
|
||||
StringTableEntry m##name##Name; \
|
||||
StringTableEntry m##name##AssetId;\
|
||||
AssetPtr<SoundAsset> m##name##Asset = NULL;\
|
||||
SFXTrack* m##name##Profile = NULL;\
|
||||
SFXDescription* m##name##Desc = NULL;\
|
||||
SimObjectId m##name##SFXId = 0;\
|
||||
public: \
|
||||
const StringTableEntry get##name##File() const { return m##name##Name; }\
|
||||
void set##name##File(const FileName &_in) { m##name##Name = StringTable->insert(_in.c_str());}\
|
||||
const AssetPtr<SoundAsset> & get##name##Asset() const { return m##name##Asset; }\
|
||||
void set##name##Asset(const AssetPtr<SoundAsset> &_in) { m##name##Asset = _in;}\
|
||||
\
|
||||
bool _set##name(StringTableEntry _in)\
|
||||
{\
|
||||
if(m##name##AssetId != _in || m##name##Name != _in)\
|
||||
{\
|
||||
if (_in == NULL || !String::compare(_in,StringTable->EmptyString()))\
|
||||
{\
|
||||
m##name##Name = StringTable->EmptyString();\
|
||||
m##name##AssetId = StringTable->EmptyString();\
|
||||
m##name##Asset = NULL;\
|
||||
m##name = NULL;\
|
||||
return true;\
|
||||
}\
|
||||
\
|
||||
if (AssetDatabase.isDeclaredAsset(_in))\
|
||||
{\
|
||||
m##name##AssetId = _in;\
|
||||
\
|
||||
U32 assetState = SoundAsset::getAssetById(m##name##AssetId, &m##name##Asset);\
|
||||
\
|
||||
if (SoundAsset::Ok == assetState)\
|
||||
{\
|
||||
m##name##Name = StringTable->EmptyString();\
|
||||
}\
|
||||
}\
|
||||
else\
|
||||
{\
|
||||
StringTableEntry assetId = SoundAsset::getAssetIdByFileName(_in);\
|
||||
if (assetId != StringTable->EmptyString())\
|
||||
{\
|
||||
m##name##AssetId = assetId;\
|
||||
if(SoundAsset::getAssetById(m##name##AssetId, &m##name##Asset) == SoundAsset::Ok)\
|
||||
{\
|
||||
m##name##Name = StringTable->EmptyString();\
|
||||
}\
|
||||
}\
|
||||
else\
|
||||
{\
|
||||
m##name##Name = _in;\
|
||||
m##name##AssetId = StringTable->EmptyString();\
|
||||
m##name##Asset = NULL;\
|
||||
}\
|
||||
}\
|
||||
}\
|
||||
if (get##name() != StringTable->EmptyString() && m##name##Asset.notNull())\
|
||||
{\
|
||||
m##name = m##name##Asset->getSoundResource();\
|
||||
}\
|
||||
else\
|
||||
{\
|
||||
m##name = NULL;\
|
||||
}\
|
||||
if(get##name() == StringTable->EmptyString())\
|
||||
return true;\
|
||||
\
|
||||
if(get##name() == StringTable->EmptyString())\
|
||||
return true;\
|
||||
if (m##name##Asset.notNull() && m##name##Asset->getStatus() != SoundAsset::Ok)\
|
||||
{\
|
||||
Con::errorf("%s(%s)::_set%s() - sound asset failure\"%s\" due to [%s]", macroText(className), getName(), macroText(name), _in, SoundAsset::getAssetErrstrn(m##name##Asset->getStatus()).c_str());\
|
||||
return false; \
|
||||
}\
|
||||
else if (!m##name && (m##name##Name != StringTable->EmptyString() && !Sim::findObject(m##name##Name)))\
|
||||
{\
|
||||
Con::errorf("%s(%s)::_set%s() - Couldn't load sound \"%s\"", macroText(className), getName(), macroText(name), _in);\
|
||||
return false;\
|
||||
}\
|
||||
return true;\
|
||||
}\
|
||||
\
|
||||
const StringTableEntry get##name() const\
|
||||
{\
|
||||
if (m##name##Asset && (m##name##Asset->getSoundPath() != StringTable->EmptyString()))\
|
||||
return m##name##Asset->getSoundPath();\
|
||||
else if (m##name##AssetId != StringTable->EmptyString())\
|
||||
return m##name##AssetId;\
|
||||
else if (m##name##Name != StringTable->EmptyString())\
|
||||
return StringTable->insert(m##name##Name);\
|
||||
else\
|
||||
return StringTable->EmptyString();\
|
||||
}\
|
||||
Resource<SFXResource> get##name##Resource() \
|
||||
{\
|
||||
return m##name;\
|
||||
}\
|
||||
SFXTrack* get##name##Profile()\
|
||||
{\
|
||||
if (get##name() != StringTable->EmptyString() && m##name##Asset.notNull()){\
|
||||
m##name##Profile = m##name##Asset->getSFXTrack(); \
|
||||
return m##name##Profile;\
|
||||
}\
|
||||
return NULL;\
|
||||
}\
|
||||
#define DECLARE_SOUNDASSET(className, name) \
|
||||
private: \
|
||||
AssetPtr<SoundAsset> m##name##Asset; \
|
||||
StringTableEntry m##name##File = StringTable->EmptyString(); \
|
||||
public: \
|
||||
void _set##name(StringTableEntry _in){ \
|
||||
if(m##name##Asset.getAssetId() == _in) \
|
||||
return; \
|
||||
if(get##name##File() == _in) \
|
||||
return; \
|
||||
if(_in == NULL || !String::compare(_in,StringTable->EmptyString())) \
|
||||
{ \
|
||||
m##name##Asset = NULL; \
|
||||
m##name##File = ""; \
|
||||
return; \
|
||||
} \
|
||||
if(!AssetDatabase.isDeclaredAsset(_in)) \
|
||||
{ \
|
||||
StringTableEntry soundAssetId = StringTable->EmptyString(); \
|
||||
AssetQuery query; \
|
||||
S32 foundAssetcount = AssetDatabase.findAssetLooseFile(&query, _in); \
|
||||
if (foundAssetcount != 0) \
|
||||
{ \
|
||||
soundAssetId = query.mAssetList[0]; \
|
||||
} \
|
||||
else if(Torque::FS::IsFile(_in)) \
|
||||
{ \
|
||||
soundAssetId = SoundAsset::getAssetIdByFilename(_in); \
|
||||
if (soundAssetId == StringTable->EmptyString()) \
|
||||
{ \
|
||||
SoundAsset* privateSound = new SoundAsset(); \
|
||||
privateSound->setSoundFile(_in); \
|
||||
soundAssetId = AssetDatabase.addPrivateAsset(privateSound); \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
Con::warnf("%s::%s: Could not find asset for: %s, there is no fallback for sound assets.", #className, #name, _in); \
|
||||
soundAssetId = StringTable->EmptyString(); \
|
||||
} \
|
||||
m##name##Asset = soundAssetId; \
|
||||
m##name##File = _in; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
m##name##Asset = _in; \
|
||||
m##name##File = get##name##File(); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
inline StringTableEntry _get##name(void) const { return m##name##Asset.getAssetId(); } \
|
||||
AssetPtr<SoundAsset> get##name##Asset(void) { return m##name##Asset; } \
|
||||
static bool _set##name##Data(void* obj, const char* index, const char* data) { static_cast<className*>(obj)->_set##name(_getStringTable()->insert(data)); return false;} \
|
||||
StringTableEntry get##name##File(){ return m##name##Asset.notNull() ? m##name##Asset->getSoundFile() : ""; } \
|
||||
SFXDescription* get##name##Description()\
|
||||
{\
|
||||
if (get##name() != StringTable->EmptyString() && m##name##Asset.notNull()){\
|
||||
m##name##Desc = m##name##Asset->getSfxDescription();\
|
||||
return m##name##Desc;}\
|
||||
if (m##name##Asset.notNull())\
|
||||
return m##name##Asset->getSfxDescription();\
|
||||
return NULL;\
|
||||
}\
|
||||
bool is##name##Valid() { return (get##name() != StringTable->EmptyString() && m##name##Asset && m##name##Asset->getStatus() == AssetBase::Ok); }
|
||||
SimObjectPtr<SFXTrack> get##name##SFXTrack(){ return m##name##Asset.notNull() ? m##name##Asset->getSFXTrack() : NULL; }
|
||||
|
||||
#ifdef TORQUE_SHOW_LEGACY_FILE_FIELDS
|
||||
|
||||
#define INITPERSISTFIELD_SOUNDASSET(name, consoleClass, docs) \
|
||||
addProtectedField(assetText(name, File), TypeSoundFilename, Offset(m##name##Name, consoleClass), _set##name##Data, & defaultProtectedGetFn, assetText(name, docs)); \
|
||||
addProtectedField(assetText(name, Asset), TypeSoundAssetId, Offset(m##name##AssetId, consoleClass), _set##name##Data, & defaultProtectedGetFn, assetText(name, asset reference.));
|
||||
|
||||
#else
|
||||
|
||||
#define INITPERSISTFIELD_SOUNDASSET(name, consoleClass, docs) \
|
||||
addProtectedField(assetText(name, File), TypeSoundFilename, Offset(m##name##Name, consoleClass), _set##name##Data, & defaultProtectedGetFn, assetText(name, docs), AbstractClassRep::FIELD_HideInInspectors); \
|
||||
addProtectedField(assetText(name, Asset), TypeSoundAssetId, Offset(m##name##AssetId, consoleClass), _set##name##Data, & defaultProtectedGetFn, assetText(name, asset reference.));
|
||||
|
||||
#endif // TORQUE_SHOW_LEGACY_FILE_FIELDS
|
||||
#define INITPERSISTFIELD_SOUNDASSET(name, consoleClass, docs) \
|
||||
addProtectedField(assetText(name, Asset), TypeSoundAssetPtr, Offset(m##name##Asset, consoleClass), _set##name##Data, &defaultProtectedGetFn, assetDoc(name, asset docs.)); \
|
||||
addProtectedField(assetText(name, File), TypeFilename, Offset(m##name##File, consoleClass), _set##name##Data, &defaultProtectedGetFn, assetDoc(name, file docs.));
|
||||
|
||||
//network send - datablock
|
||||
#define PACKDATA_SOUNDASSET(name)\
|
||||
|
|
@ -374,136 +333,74 @@ public: \
|
|||
m##name##SFXId[index] = 0;\
|
||||
}
|
||||
|
||||
#define DECLARE_SOUNDASSET_ARRAY(className,name,max) public: \
|
||||
static const U32 sm##name##Count = max;\
|
||||
Resource<SFXResource> m##name[max];\
|
||||
StringTableEntry m##name##Name[max]; \
|
||||
StringTableEntry m##name##AssetId[max];\
|
||||
AssetPtr<SoundAsset> m##name##Asset[max];\
|
||||
SFXTrack* m##name##Profile[max];\
|
||||
SimObjectId m##name##SFXId[max];\
|
||||
public: \
|
||||
const StringTableEntry get##name##File(const U32& index) const { return m##name##Name[index]; }\
|
||||
void set##name##File(const FileName &_in, const U32& index) { m##name##Name[index] = StringTable->insert(_in.c_str());}\
|
||||
const AssetPtr<SoundAsset> & get##name##Asset(const U32& index) const { return m##name##Asset[index]; }\
|
||||
void set##name##Asset(const AssetPtr<SoundAsset> &_in, const U32& index) { m##name##Asset[index] = _in;}\
|
||||
\
|
||||
bool _set##name(StringTableEntry _in, const U32& index)\
|
||||
{\
|
||||
if(m##name##AssetId[index] != _in || m##name##Name[index] != _in)\
|
||||
{\
|
||||
if(index >= sm##name##Count || index < 0) \
|
||||
return false;\
|
||||
if (_in == NULL || !String::compare(_in,StringTable->EmptyString()))\
|
||||
{\
|
||||
m##name##Name[index] = StringTable->EmptyString();\
|
||||
m##name##AssetId[index] = StringTable->EmptyString();\
|
||||
m##name##Asset[index] = NULL;\
|
||||
m##name[index] = NULL;\
|
||||
return true;\
|
||||
}\
|
||||
else if(_in[0] == '$' || _in[0] == '#')\
|
||||
{\
|
||||
m##name##Name[index] = _in;\
|
||||
m##name##AssetId[index] = StringTable->EmptyString();\
|
||||
m##name##Asset[index] = NULL;\
|
||||
m##name[index] = NULL;\
|
||||
return true;\
|
||||
}\
|
||||
\
|
||||
if (AssetDatabase.isDeclaredAsset(_in))\
|
||||
{\
|
||||
m##name##AssetId[index] = _in;\
|
||||
\
|
||||
U32 assetState = SoundAsset::getAssetById(m##name##AssetId[index], &m##name##Asset[index]);\
|
||||
\
|
||||
if (SoundAsset::Ok == assetState)\
|
||||
{\
|
||||
m##name##Name[index] = StringTable->EmptyString();\
|
||||
}\
|
||||
}\
|
||||
else\
|
||||
{\
|
||||
StringTableEntry assetId = SoundAsset::getAssetIdByFileName(_in);\
|
||||
if (assetId != StringTable->EmptyString())\
|
||||
{\
|
||||
m##name##AssetId[index] = assetId;\
|
||||
if(SoundAsset::getAssetById(m##name##AssetId[index], &m##name##Asset[index]) == SoundAsset::Ok)\
|
||||
{\
|
||||
m##name##Name[index] = StringTable->EmptyString();\
|
||||
}\
|
||||
}\
|
||||
else\
|
||||
{\
|
||||
m##name##Name[index] = _in;\
|
||||
m##name##AssetId[index] = StringTable->EmptyString();\
|
||||
m##name##Asset[index] = NULL;\
|
||||
}\
|
||||
}\
|
||||
}\
|
||||
if (get##name(index) != StringTable->EmptyString() && m##name##Asset[index].notNull())\
|
||||
{\
|
||||
m##name[index] = m##name##Asset[index]->getSoundResource();\
|
||||
}\
|
||||
else\
|
||||
{\
|
||||
m##name[index] = NULL;\
|
||||
}\
|
||||
if(get##name(index) == StringTable->EmptyString())\
|
||||
return true;\
|
||||
\
|
||||
if (m##name##Asset[index].notNull() && m##name##Asset[index]->getStatus() != SoundAsset::Ok)\
|
||||
{\
|
||||
Con::errorf("%s(%s)::_set%s(%i) - sound asset failure\"%s\" due to [%s]", macroText(className), getName(), macroText(name),index, _in, SoundAsset::getAssetErrstrn(m##name##Asset[index]->getStatus()).c_str());\
|
||||
return false; \
|
||||
}\
|
||||
else if (!m##name[index] && (m##name##Name[index] != StringTable->EmptyString() && !Sim::findObject(m##name##Name[index])))\
|
||||
{\
|
||||
Con::errorf("%s(%s)::_set%s(%i) - Couldn't load sound \"%s\"", macroText(className), getName(), macroText(name),index, _in);\
|
||||
return false;\
|
||||
}\
|
||||
return true;\
|
||||
}\
|
||||
\
|
||||
const StringTableEntry get##name(const U32& index) const\
|
||||
{\
|
||||
if (m##name##Asset[index] && (m##name##Asset[index]->getSoundPath() != StringTable->EmptyString()))\
|
||||
return m##name##Asset[index]->getSoundPath();\
|
||||
else if (m##name##AssetId[index] != StringTable->EmptyString())\
|
||||
return m##name##AssetId[index];\
|
||||
else if (m##name##Name[index] != StringTable->EmptyString())\
|
||||
return StringTable->insert(m##name##Name[index]);\
|
||||
else\
|
||||
return StringTable->EmptyString();\
|
||||
}\
|
||||
Resource<SFXResource> get##name##Resource(const U32& id) \
|
||||
{\
|
||||
if(id >= sm##name##Count || id < 0)\
|
||||
return ResourceManager::get().load( "" );\
|
||||
return m##name[id];\
|
||||
}\
|
||||
SFXTrack* get##name##Profile(const U32& id)\
|
||||
{\
|
||||
if (m##name##Asset[id].notNull())\
|
||||
return m##name##Asset[id]->getSFXTrack(); \
|
||||
return NULL;\
|
||||
}\
|
||||
bool is##name##Valid(const U32& id) {return (get##name(id) != StringTable->EmptyString() && m##name##Asset[id] && m##name##Asset[id]->getStatus() == AssetBase::Ok); }
|
||||
#define DECLARE_SOUNDASSET_ARRAY(className,name,max)\
|
||||
private: \
|
||||
AssetPtr<SoundAsset> m##name##Asset[max]; \
|
||||
StringTableEntry m##name##File[max] = {StringTable->EmptyString() }; \
|
||||
public: \
|
||||
void _set##name(StringTableEntry _in, const U32& index){ \
|
||||
if(m##name##Asset[index].getAssetId() == _in) \
|
||||
return; \
|
||||
if(get##name##File(index) == _in) \
|
||||
return; \
|
||||
if(_in == NULL || !String::compare(_in,StringTable->EmptyString())) \
|
||||
{ \
|
||||
m##name##Asset[index] = NULL; \
|
||||
m##name##File[index] = ""; \
|
||||
return; \
|
||||
} \
|
||||
if(!AssetDatabase.isDeclaredAsset(_in)) \
|
||||
{ \
|
||||
StringTableEntry soundAssetId = StringTable->EmptyString(); \
|
||||
AssetQuery query; \
|
||||
S32 foundAssetcount = AssetDatabase.findAssetLooseFile(&query, _in); \
|
||||
if (foundAssetcount != 0) \
|
||||
{ \
|
||||
soundAssetId = query.mAssetList[0]; \
|
||||
} \
|
||||
else if(Torque::FS::IsFile(_in)) \
|
||||
{ \
|
||||
soundAssetId = SoundAsset::getAssetIdByFilename(_in); \
|
||||
if (soundAssetId == StringTable->EmptyString()) \
|
||||
{ \
|
||||
SoundAsset* privateSound = new SoundAsset(); \
|
||||
privateSound->setSoundFile(_in); \
|
||||
soundAssetId = AssetDatabase.addPrivateAsset(privateSound); \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
Con::warnf("%s::%s: Could not find asset for: %s, there is no fallback for sound assets.", #className, #name, _in); \
|
||||
soundAssetId = StringTable->EmptyString(); \
|
||||
} \
|
||||
m##name##Asset[index] = soundAssetId; \
|
||||
m##name##File[index] = _in; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
m##name##Asset[index] = _in; \
|
||||
m##name##File[index] = get##name##File(index); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
inline StringTableEntry _get##name(const U32& index) const { return m##name##Asset[index].getAssetId(); } \
|
||||
AssetPtr<SoundAsset> get##name##Asset(const U32& index) { return m##name##Asset[index]; } \
|
||||
static bool _set##name##Data(void* obj, const char* index, const char* data) { static_cast<className*>(obj)->_set##name(_getStringTable()->insert(data), dAtoi(index)); return false; } \
|
||||
StringTableEntry get##name##File(const U32& index) { return m##name##Asset[index].notNull() ? m##name##Asset[index]->getSoundFile() : ""; } \
|
||||
SFXDescription* get##name##Description(const U32& index) \
|
||||
{ \
|
||||
if (m##name##Asset[index].notNull()) \
|
||||
return m##name##Asset[index]->getSfxDescription(); \
|
||||
return NULL; \
|
||||
} \
|
||||
SimObjectPtr<SFXTrack> get##name##SFXTrack(const U32& index) { return m##name##Asset[index].notNull() ? m##name##Asset[index]->getSFXTrack() : NULL; }
|
||||
|
||||
|
||||
#ifdef TORQUE_SHOW_LEGACY_FILE_FIELDS
|
||||
|
||||
#define INITPERSISTFIELD_IMAGEASSET_ARRAY(name, arraySize, consoleClass, docs) \
|
||||
addProtectedField(#name, TypeSoundFilename, Offset(m##name##Name, consoleClass), _set##name##Data, &defaultProtectedGetFn, arraySize, assetDoc(name, docs)); \
|
||||
addProtectedField(assetText(name, Asset), TypeImageAssetId, Offset(m##name##AssetId, consoleClass), _set##name##Data, &defaultProtectedGetFn, arraySize, assetDoc(name, asset docs.));
|
||||
|
||||
#else
|
||||
|
||||
#define INITPERSISTFIELD_SOUNDASSET_ARRAY(name, arraySize, consoleClass, docs) \
|
||||
addProtectedField(#name, TypeSoundFilename, Offset(m##name##Name, consoleClass), _set##name##Data, &defaultProtectedGetFn, arraySize, assetDoc(name, docs), AbstractClassRep::FIELD_HideInInspectors); \
|
||||
addProtectedField(assetText(name, Asset), TypeSoundAssetId, Offset(m##name##AssetId, consoleClass), _set##name##Data, &defaultProtectedGetFn, arraySize, assetDoc(name, asset docs.));
|
||||
addProtectedField(#name, TypeSoundFilename, Offset(m##name##File, consoleClass), _set##name##Data, &defaultProtectedGetFn, arraySize, assetDoc(name, docs), AbstractClassRep::FIELD_HideInInspectors); \
|
||||
addProtectedField(assetText(name, Asset), TypeSoundAssetPtr, Offset(m##name##Asset, consoleClass), _set##name##Data, &defaultProtectedGetFn, arraySize, assetDoc(name, asset docs.));\
|
||||
addProtectedField(assetText(name, File), TypeSoundFilename, Offset(m##name##File, consoleClass), _set##name##Data, &defaultProtectedGetFn, arraySize, assetDoc(name, docs), AbstractClassRep::FIELD_HideInInspectors); \
|
||||
|
||||
#endif
|
||||
|
||||
#define LOAD_SOUNDASSET_ARRAY(name, index)\
|
||||
if (m##name##AssetId[index] != StringTable->EmptyString())\
|
||||
|
|
@ -530,8 +427,8 @@ if (m##name##AssetId[index] != StringTable->EmptyString())\
|
|||
const char* enumString = castConsoleTypeToString(static_cast<enumType>(itter));\
|
||||
if (enumString && enumString[0])\
|
||||
{\
|
||||
addField(assetEnumNameConcat(enumString, File), TypeSoundFilename, Offset(m##name##Name[0], consoleClass) + sizeof(m##name##Name[0])*i, assetText(name, docs), AbstractClassRep::FIELD_HideInInspectors); \
|
||||
addField(assetEnumNameConcat(enumString, Asset), TypeSoundAssetId, Offset(m##name##AssetId[0], consoleClass) + sizeof(m##name##AssetId[0])*i, assetText(name, asset reference.));\
|
||||
addField(assetEnumNameConcat(enumString, Asset), TypeSoundAssetPtr, Offset(m##name##Asset[0], consoleClass) + sizeof(m##name##Asset[0])*i, assetText(name, asset reference.));\
|
||||
addField(assetEnumNameConcat(enumString, File), TypeSoundFilename, Offset(m##name##File[0], consoleClass) + sizeof(m##name##File[0])*i, assetText(name, docs), AbstractClassRep::FIELD_HideInInspectors); \
|
||||
}\
|
||||
}
|
||||
|
||||
|
|
@ -544,5 +441,11 @@ if (m##name##AssetId[index] != StringTable->EmptyString())\
|
|||
|
||||
#pragma endregion
|
||||
|
||||
|
||||
#pragma region Refactor Macros
|
||||
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#endif // _ASSET_BASE_H_
|
||||
|
||||
|
|
|
|||
|
|
@ -3292,30 +3292,19 @@ Torque::Path AssetImporter::importSoundAsset(AssetImportObject* assetItem)
|
|||
|
||||
StringTableEntry assetName = StringTable->insert(assetItem->assetName.c_str());
|
||||
|
||||
String soundFileName = assetItem->filePath.getFileName() + "." + assetItem->filePath.getExtension();
|
||||
String assetPath = targetPath + "/" + soundFileName;
|
||||
String soundFileName = assetItem->filePath.getFullFileName();
|
||||
String assetPath = "@" + soundFileName;
|
||||
String tamlPath = targetPath + "/" + assetName + ".asset.taml";
|
||||
String originalPath = assetItem->filePath.getFullPath().c_str();
|
||||
|
||||
char qualifiedFromFile[2048];
|
||||
char qualifiedToFile[2048];
|
||||
|
||||
#ifndef TORQUE_SECURE_VFS
|
||||
Platform::makeFullPathName(originalPath.c_str(), qualifiedFromFile, sizeof(qualifiedFromFile));
|
||||
Platform::makeFullPathName(assetPath.c_str(), qualifiedToFile, sizeof(qualifiedToFile));
|
||||
#else
|
||||
dStrcpy(qualifiedFromFile, originalPath.c_str(), sizeof(qualifiedFromFile));
|
||||
dStrcpy(qualifiedToFile, assetPath.c_str(), sizeof(qualifiedToFile));
|
||||
#endif
|
||||
|
||||
newAsset->setAssetName(assetName);
|
||||
newAsset->_setSoundFile(newAsset, "0", soundFileName.c_str());
|
||||
newAsset->setSoundFile(assetPath.c_str());
|
||||
|
||||
//If it's not a re-import, check that the file isn't being in-place imported. If it isn't, store off the original
|
||||
//file path for reimporting support later
|
||||
if (!isReimport && String::compare(qualifiedFromFile, qualifiedToFile) && Torque::FS::IsFile(qualifiedFromFile))
|
||||
if (!isReimport)
|
||||
{
|
||||
newAsset->setDataField(StringTable->insert("originalFilePath"), nullptr, qualifiedFromFile);
|
||||
newAsset->setDataField(StringTable->insert("originalFilePath"), nullptr, originalPath.c_str());
|
||||
}
|
||||
|
||||
Taml tamlWriter;
|
||||
|
|
@ -3328,18 +3317,6 @@ Torque::Path AssetImporter::importSoundAsset(AssetImportObject* assetItem)
|
|||
return "";
|
||||
}
|
||||
|
||||
if (!isReimport)
|
||||
{
|
||||
bool isInPlace = !String::compare(qualifiedFromFile, qualifiedToFile);
|
||||
|
||||
if (!isInPlace && !Torque::FS::CopyFile(qualifiedFromFile, qualifiedToFile, !isReimport))
|
||||
{
|
||||
dSprintf(importLogBuffer, sizeof(importLogBuffer), "Error! Unable to copy file %s", assetItem->filePath.getFullPath().c_str());
|
||||
activityLog.push_back(importLogBuffer);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
return tamlPath;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -230,9 +230,6 @@ ExplosionData::ExplosionData()
|
|||
|
||||
faceViewer = false;
|
||||
|
||||
INIT_ASSET(Sound);
|
||||
|
||||
//soundProfile = NULL;
|
||||
particleEmitter = NULL;
|
||||
particleEmitterId = 0;
|
||||
|
||||
|
|
@ -310,7 +307,7 @@ ExplosionData::ExplosionData(const ExplosionData& other, bool temp_clone) : Game
|
|||
faceViewer = other.faceViewer;
|
||||
particleDensity = other.particleDensity;
|
||||
particleRadius = other.particleRadius;
|
||||
CLONE_ASSET(Sound);
|
||||
mSoundAsset = other.mSoundAsset;
|
||||
particleEmitter = other.particleEmitter;
|
||||
particleEmitterId = other.particleEmitterId; // -- for pack/unpack of particleEmitter ptr
|
||||
explosionScale = other.explosionScale;
|
||||
|
|
@ -675,8 +672,7 @@ void ExplosionData::packData(BitStream* stream)
|
|||
|
||||
PACKDATA_ASSET_REFACTOR(ExplosionShape);
|
||||
|
||||
//PACKDATA_SOUNDASSET(Sound);
|
||||
PACKDATA_ASSET(Sound);
|
||||
PACKDATA_ASSET_REFACTOR(Sound);
|
||||
|
||||
if (stream->writeFlag(particleEmitter))
|
||||
stream->writeRangedU32(particleEmitter->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast);
|
||||
|
|
@ -780,7 +776,7 @@ void ExplosionData::unpackData(BitStream* stream)
|
|||
|
||||
UNPACKDATA_ASSET_REFACTOR(ExplosionShape);
|
||||
|
||||
UNPACKDATA_ASSET(Sound);
|
||||
UNPACKDATA_ASSET_REFACTOR(Sound);
|
||||
|
||||
if (stream->readFlag())
|
||||
particleEmitterId = stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast);
|
||||
|
|
@ -886,10 +882,11 @@ bool ExplosionData::preload(bool server, String &errorStr)
|
|||
if (!server)
|
||||
{
|
||||
|
||||
if (!isSoundValid())
|
||||
if (!getSoundSFXTrack())
|
||||
{
|
||||
//return false; -TODO: trigger asset download
|
||||
}
|
||||
|
||||
if (!particleEmitter && particleEmitterId != 0)
|
||||
{
|
||||
if (Sim::findObject(particleEmitterId, particleEmitter) == false)
|
||||
|
|
@ -1432,7 +1429,7 @@ bool Explosion::explode()
|
|||
resetWorldBox();
|
||||
}
|
||||
|
||||
SFXProfile* sound_prof = static_cast<SFXProfile*>(mDataBlock->getSoundProfile());
|
||||
SFXProfile* sound_prof = static_cast<SFXProfile*>(mDataBlock->getSoundSFXTrack().getPointer());
|
||||
if (sound_prof)
|
||||
{
|
||||
soundProfile_clone = sound_prof->cloneAndPerformSubstitutions(ss_object, ss_index);
|
||||
|
|
|
|||
|
|
@ -71,7 +71,6 @@ class ExplosionData : public GameBaseData, protected AssetPtrCallback {
|
|||
F32 particleRadius;
|
||||
|
||||
DECLARE_SOUNDASSET(ExplosionData, Sound);
|
||||
DECLARE_ASSET_SETGET(ExplosionData, Sound);
|
||||
|
||||
ParticleEmitterData* particleEmitter;
|
||||
S32 particleEmitterId;
|
||||
|
|
|
|||
|
|
@ -238,13 +238,6 @@ void LightningStrikeEvent::process(NetConnection*)
|
|||
//
|
||||
LightningData::LightningData()
|
||||
{
|
||||
INIT_ASSET(StrikeSound);
|
||||
|
||||
for (S32 i = 0; i < MaxThunders; i++)
|
||||
{
|
||||
INIT_SOUNDASSET_ARRAY(ThunderSound, i);
|
||||
}
|
||||
|
||||
for (S32 i = 0; i < MaxTextures; i++)
|
||||
{
|
||||
strikeTextureNames[i] = NULL;
|
||||
|
|
@ -297,13 +290,13 @@ bool LightningData::preload(bool server, String &errorStr)
|
|||
{
|
||||
for (S32 i = 0; i < MaxThunders; i++)
|
||||
{
|
||||
if (!isThunderSoundValid(i))
|
||||
if (!getThunderSoundSFXTrack(i))
|
||||
{
|
||||
//return false; -TODO: trigger asset download
|
||||
}
|
||||
|
||||
}
|
||||
if (!isStrikeSoundValid())
|
||||
if (!getStrikeSoundSFXTrack())
|
||||
{
|
||||
//return false; -TODO: trigger asset download
|
||||
}
|
||||
|
|
@ -332,7 +325,7 @@ void LightningData::packData(BitStream* stream)
|
|||
U32 i;
|
||||
for (i = 0; i < MaxThunders; i++)
|
||||
{
|
||||
PACKDATA_SOUNDASSET_ARRAY(ThunderSound, i);
|
||||
PACKDATA_ASSET_ARRAY(ThunderSound, i);
|
||||
}
|
||||
|
||||
stream->writeInt(mNumStrikeTextures, 4);
|
||||
|
|
@ -340,7 +333,7 @@ void LightningData::packData(BitStream* stream)
|
|||
for (i = 0; i < MaxTextures; i++)
|
||||
stream->writeString(strikeTextureNames[i]);
|
||||
|
||||
PACKDATA_ASSET(StrikeSound);
|
||||
PACKDATA_ASSET_REFACTOR(StrikeSound);
|
||||
}
|
||||
|
||||
void LightningData::unpackData(BitStream* stream)
|
||||
|
|
@ -350,7 +343,7 @@ void LightningData::unpackData(BitStream* stream)
|
|||
U32 i;
|
||||
for (i = 0; i < MaxThunders; i++)
|
||||
{
|
||||
UNPACKDATA_SOUNDASSET_ARRAY(ThunderSound, i);
|
||||
UNPACKDATA_ASSET_ARRAY(ThunderSound, i);
|
||||
}
|
||||
|
||||
mNumStrikeTextures = stream->readInt(4);
|
||||
|
|
@ -358,7 +351,7 @@ void LightningData::unpackData(BitStream* stream)
|
|||
for (i = 0; i < MaxTextures; i++)
|
||||
strikeTextureNames[i] = stream->readSTString();
|
||||
|
||||
UNPACKDATA_ASSET(StrikeSound);
|
||||
UNPACKDATA_ASSET_REFACTOR(StrikeSound);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -584,7 +577,7 @@ void Lightning::scheduleThunder(Strike* newStrike)
|
|||
if (t <= 0.03f) {
|
||||
// If it's really close, just play it...
|
||||
U32 thunder = sgLightningRand.randI(0, mDataBlock->numThunders - 1);
|
||||
SFX->playOnce(mDataBlock->getThunderSoundProfile(thunder));
|
||||
SFX->playOnce(mDataBlock->getThunderSoundSFXTrack(thunder));
|
||||
} else {
|
||||
Thunder* pThunder = new Thunder;
|
||||
pThunder->tRemaining = t;
|
||||
|
|
@ -651,7 +644,7 @@ void Lightning::advanceTime(F32 dt)
|
|||
|
||||
// Play the sound...
|
||||
U32 thunder = sgLightningRand.randI(0, mDataBlock->numThunders - 1);
|
||||
SFX->playOnce(mDataBlock->getThunderSoundProfile(thunder));
|
||||
SFX->playOnce(mDataBlock->getThunderSoundSFXTrack(thunder));
|
||||
} else {
|
||||
pThunderWalker = &((*pThunderWalker)->next);
|
||||
}
|
||||
|
|
@ -735,9 +728,9 @@ void Lightning::processEvent(LightningStrikeEvent* pEvent)
|
|||
MatrixF trans(true);
|
||||
trans.setPosition( strikePoint );
|
||||
|
||||
if (mDataBlock->getStrikeSoundProfile())
|
||||
if (mDataBlock->getStrikeSoundSFXTrack())
|
||||
{
|
||||
SFX->playOnce(mDataBlock->getStrikeSoundProfile(), &trans );
|
||||
SFX->playOnce(mDataBlock->getStrikeSoundSFXTrack(), &trans );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,10 +65,7 @@ class LightningData : public GameBaseData
|
|||
public:
|
||||
|
||||
DECLARE_SOUNDASSET_ARRAY(LightningData, ThunderSound, MaxThunders);
|
||||
DECLARE_ASSET_ARRAY_SETGET(LightningData, ThunderSound);
|
||||
|
||||
DECLARE_SOUNDASSET(LightningData, StrikeSound);
|
||||
DECLARE_ASSET_SETGET(LightningData, StrikeSound);
|
||||
|
||||
StringTableEntry strikeTextureNames[MaxTextures];
|
||||
|
||||
|
|
|
|||
|
|
@ -127,8 +127,6 @@ ConsoleDocClass( PrecipitationData,
|
|||
//----------------------------------------------------------
|
||||
PrecipitationData::PrecipitationData()
|
||||
{
|
||||
INIT_ASSET(Sound);
|
||||
|
||||
mDropShaderName = StringTable->EmptyString();
|
||||
|
||||
mSplashShaderName = StringTable->EmptyString();
|
||||
|
|
@ -175,7 +173,7 @@ bool PrecipitationData::preload( bool server, String &errorStr )
|
|||
return false;
|
||||
if (!server)
|
||||
{
|
||||
if (!isSoundValid())
|
||||
if (!getSoundSFXTrack())
|
||||
{
|
||||
//return false; -TODO: trigger asset download
|
||||
}
|
||||
|
|
@ -188,7 +186,7 @@ void PrecipitationData::packData(BitStream* stream)
|
|||
{
|
||||
Parent::packData(stream);
|
||||
|
||||
PACKDATA_ASSET(Sound);
|
||||
PACKDATA_ASSET_REFACTOR(Sound);
|
||||
|
||||
PACKDATA_ASSET_REFACTOR(Drop);
|
||||
|
||||
|
|
@ -205,7 +203,7 @@ void PrecipitationData::unpackData(BitStream* stream)
|
|||
{
|
||||
Parent::unpackData(stream);
|
||||
|
||||
UNPACKDATA_ASSET(Sound);
|
||||
UNPACKDATA_ASSET_REFACTOR(Sound);
|
||||
|
||||
UNPACKDATA_ASSET_REFACTOR(Drop);
|
||||
|
||||
|
|
@ -587,9 +585,9 @@ bool Precipitation::onNewDataBlock( GameBaseData *dptr, bool reload )
|
|||
{
|
||||
SFX_DELETE( mAmbientSound );
|
||||
|
||||
if ( mDataBlock->getSoundProfile())
|
||||
if ( mDataBlock->getSoundSFXTrack())
|
||||
{
|
||||
mAmbientSound = SFX->createSource(mDataBlock->getSoundProfile(), &getTransform() );
|
||||
mAmbientSound = SFX->createSource(mDataBlock->getSoundSFXTrack(), &getTransform() );
|
||||
if ( mAmbientSound )
|
||||
mAmbientSound->play();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ class PrecipitationData : public GameBaseData
|
|||
|
||||
public:
|
||||
DECLARE_SOUNDASSET(PrecipitationData, Sound);
|
||||
DECLARE_ASSET_SETGET(PrecipitationData, Sound);
|
||||
|
||||
DECLARE_IMAGEASSET(PrecipitationData, Drop, GFXStaticTextureSRGBProfile) ///< Texture for drop particles
|
||||
|
||||
|
|
|
|||
|
|
@ -67,11 +67,6 @@ ConsoleDocClass( Splash,
|
|||
//--------------------------------------------------------------------------
|
||||
SplashData::SplashData()
|
||||
{
|
||||
//soundProfile = NULL;
|
||||
//soundProfileId = 0;
|
||||
|
||||
INIT_ASSET(Sound);
|
||||
|
||||
scale.set(1, 1, 1);
|
||||
|
||||
dMemset( emitterList, 0, sizeof( emitterList ) );
|
||||
|
|
@ -171,7 +166,7 @@ void SplashData::packData(BitStream* stream)
|
|||
{
|
||||
Parent::packData(stream);
|
||||
|
||||
PACKDATA_ASSET(Sound);
|
||||
PACKDATA_ASSET_REFACTOR(Sound);
|
||||
|
||||
mathWrite(*stream, scale);
|
||||
stream->write(delayMS);
|
||||
|
|
@ -224,7 +219,7 @@ void SplashData::unpackData(BitStream* stream)
|
|||
{
|
||||
Parent::unpackData(stream);
|
||||
|
||||
UNPACKDATA_ASSET(Sound);
|
||||
UNPACKDATA_ASSET_REFACTOR(Sound);
|
||||
|
||||
mathRead(*stream, &scale);
|
||||
stream->read(&delayMS);
|
||||
|
|
@ -280,7 +275,7 @@ bool SplashData::preload(bool server, String &errorStr)
|
|||
|
||||
if (!server)
|
||||
{
|
||||
if (!isSoundValid())
|
||||
if (!getSoundSFXTrack())
|
||||
{
|
||||
Con::errorf(ConsoleLogEntry::General, "SplashData::preload: Invalid Sound asset.");
|
||||
//return false;
|
||||
|
|
@ -689,7 +684,7 @@ void Splash::spawnExplosion()
|
|||
|
||||
/// could just play the explosion one, but explosion could be weapon specific,
|
||||
/// splash sound could be liquid specific. food for thought.
|
||||
SFXTrack* sound_prof = mDataBlock->getSoundProfile();
|
||||
SFXTrack* sound_prof = mDataBlock->getSoundSFXTrack();
|
||||
if (sound_prof)
|
||||
{
|
||||
SFX->playOnce(sound_prof, &getTransform());
|
||||
|
|
|
|||
|
|
@ -96,7 +96,6 @@ public:
|
|||
//S32 soundProfileId;
|
||||
|
||||
DECLARE_SOUNDASSET(SplashData, Sound);
|
||||
DECLARE_ASSET_SETGET(SplashData, Sound);
|
||||
|
||||
ParticleEmitterData* emitterList[NUM_EMITTERS];
|
||||
S32 emitterIDList[NUM_EMITTERS];
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ U32 LevelInfo::packUpdate(NetConnection *conn, U32 mask, BitStream *stream)
|
|||
mathWrite( *stream, mAmbientLightBlendCurve );
|
||||
|
||||
sfxWrite( stream, mSoundAmbience );
|
||||
stream->writeInt( mSoundDistanceModel, 1 );
|
||||
stream->writeInt( mSoundDistanceModel, 2);
|
||||
|
||||
PACK_ASSET_REFACTOR(conn, AccuTexture);
|
||||
|
||||
|
|
@ -251,7 +251,7 @@ void LevelInfo::unpackUpdate(NetConnection *conn, BitStream *stream)
|
|||
String errorStr;
|
||||
if( !sfxReadAndResolve( stream, &mSoundAmbience, errorStr ) )
|
||||
Con::errorf( "%s", errorStr.c_str() );
|
||||
mSoundDistanceModel = ( SFXDistanceModel ) stream->readInt( 1 );
|
||||
mSoundDistanceModel = ( SFXDistanceModel ) stream->readInt(2);
|
||||
|
||||
if( isProperlyAdded() )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -421,9 +421,6 @@ PlayerData::PlayerData()
|
|||
boxHeadBackPercentage = 0;
|
||||
boxHeadFrontPercentage = 1;
|
||||
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
INIT_SOUNDASSET_ARRAY(PlayerSound, i);
|
||||
|
||||
footPuffEmitter = NULL;
|
||||
footPuffID = 0;
|
||||
footPuffNumParts = 15;
|
||||
|
|
@ -471,7 +468,7 @@ bool PlayerData::preload(bool server, String &errorStr)
|
|||
if (!server) {
|
||||
for (U32 i = 0; i < MaxSounds; ++i)
|
||||
{
|
||||
if (!isPlayerSoundValid(i))
|
||||
if (!getPlayerSoundSFXTrack(i))
|
||||
{
|
||||
//return false; -TODO: trigger asset download
|
||||
}
|
||||
|
|
@ -1266,8 +1263,7 @@ void PlayerData::packData(BitStream* stream)
|
|||
stream->write(minImpactSpeed);
|
||||
stream->write(minLateralImpactSpeed);
|
||||
|
||||
for (U32 i = 0; i < MaxSounds; i++)
|
||||
PACKDATA_SOUNDASSET_ARRAY(PlayerSound, i);
|
||||
PACKDATA_ASSET_ARRAY_REFACTOR(PlayerSound, MaxSounds);
|
||||
|
||||
mathWrite(*stream, boxSize);
|
||||
mathWrite(*stream, crouchBoxSize);
|
||||
|
|
@ -1447,8 +1443,7 @@ void PlayerData::unpackData(BitStream* stream)
|
|||
stream->read(&minImpactSpeed);
|
||||
stream->read(&minLateralImpactSpeed);
|
||||
|
||||
for (U32 i = 0; i < MaxSounds; i++)
|
||||
UNPACKDATA_SOUNDASSET_ARRAY(PlayerSound, i);
|
||||
UNPACKDATA_ASSET_ARRAY_REFACTOR(PlayerSound, MaxSounds);
|
||||
|
||||
mathRead(*stream, &boxSize);
|
||||
mathRead(*stream, &crouchBoxSize);
|
||||
|
|
@ -1895,11 +1890,11 @@ bool Player::onNewDataBlock( GameBaseData *dptr, bool reload )
|
|||
SFX_DELETE( mMoveBubbleSound );
|
||||
SFX_DELETE( mWaterBreathSound );
|
||||
|
||||
if ( mDataBlock->getPlayerSound(PlayerData::MoveBubbles) )
|
||||
mMoveBubbleSound = SFX->createSource( mDataBlock->getPlayerSoundProfile(PlayerData::MoveBubbles) );
|
||||
if ( mDataBlock->getPlayerSoundSFXTrack(PlayerData::MoveBubbles) )
|
||||
mMoveBubbleSound = SFX->createSource( mDataBlock->getPlayerSoundSFXTrack(PlayerData::MoveBubbles) );
|
||||
|
||||
if ( mDataBlock->getPlayerSound(PlayerData::WaterBreath) )
|
||||
mWaterBreathSound = SFX->createSource( mDataBlock->getPlayerSoundProfile(PlayerData::WaterBreath) );
|
||||
if ( mDataBlock->getPlayerSoundSFXTrack(PlayerData::WaterBreath) )
|
||||
mWaterBreathSound = SFX->createSource( mDataBlock->getPlayerSoundSFXTrack(PlayerData::WaterBreath) );
|
||||
}
|
||||
|
||||
mObjBox.maxExtents.x = mDataBlock->boxSize.x * 0.5f;
|
||||
|
|
@ -3223,7 +3218,7 @@ void Player::updateMove(const Move* move)
|
|||
{
|
||||
// exit-water splash sound happens for client only
|
||||
if ( getSpeed() >= mDataBlock->exitSplashSoundVel && !isMounted() )
|
||||
SFX->playOnce( mDataBlock->getPlayerSoundProfile(PlayerData::ExitWater), &getTransform() );
|
||||
SFX->playOnce( mDataBlock->getPlayerSoundSFXTrack(PlayerData::ExitWater), &getTransform() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -6998,26 +6993,26 @@ void Player::playFootstepSound( bool triggeredLeft, Material* contactMaterial, S
|
|||
// Treading water.
|
||||
|
||||
if ( mWaterCoverage < mDataBlock->footSplashHeight )
|
||||
SFX->playOnce( mDataBlock->getPlayerSoundProfile( PlayerData::FootShallowSplash ), &footMat );
|
||||
SFX->playOnce( mDataBlock->getPlayerSoundSFXTrack( PlayerData::FootShallowSplash ), &footMat );
|
||||
else
|
||||
{
|
||||
if ( mWaterCoverage < 1.0 )
|
||||
SFX->playOnce( mDataBlock->getPlayerSoundProfile( PlayerData::FootWading ), &footMat );
|
||||
SFX->playOnce( mDataBlock->getPlayerSoundSFXTrack( PlayerData::FootWading ), &footMat );
|
||||
else
|
||||
{
|
||||
if ( triggeredLeft )
|
||||
{
|
||||
SFX->playOnce( mDataBlock->getPlayerSoundProfile( PlayerData::FootUnderWater ), &footMat );
|
||||
SFX->playOnce( mDataBlock->getPlayerSoundProfile( PlayerData::FootBubbles ), &footMat );
|
||||
SFX->playOnce( mDataBlock->getPlayerSoundSFXTrack( PlayerData::FootUnderWater ), &footMat );
|
||||
SFX->playOnce( mDataBlock->getPlayerSoundSFXTrack( PlayerData::FootBubbles ), &footMat );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( contactMaterial && contactMaterial->getCustomFootstepSoundProfile())
|
||||
else if( contactMaterial && contactMaterial->getCustomFootstepSoundSFXTrack())
|
||||
{
|
||||
// Footstep sound defined on material.
|
||||
|
||||
SFX->playOnce( contactMaterial->getCustomFootstepSoundProfile(), &footMat );
|
||||
SFX->playOnce( contactMaterial->getCustomFootstepSoundSFXTrack(), &footMat );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -7030,7 +7025,7 @@ void Player::playFootstepSound( bool triggeredLeft, Material* contactMaterial, S
|
|||
sound = 2;
|
||||
|
||||
if (sound>=0)
|
||||
SFX->playOnce(mDataBlock->getPlayerSoundProfile(sound), &footMat);
|
||||
SFX->playOnce(mDataBlock->getPlayerSoundSFXTrack(sound), &footMat);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -7050,8 +7045,8 @@ void Player:: playImpactSound()
|
|||
{
|
||||
Material* material = ( rInfo.material ? dynamic_cast< Material* >( rInfo.material->getMaterial() ) : 0 );
|
||||
|
||||
if( material && material->getCustomImpactSoundProfile() )
|
||||
SFX->playOnce( material->getCustomImpactSoundProfile(), &getTransform() );
|
||||
if( material && material->getCustomImpactSoundSFXTrack() )
|
||||
SFX->playOnce( material->getCustomImpactSoundSFXTrack(), &getTransform() );
|
||||
else
|
||||
{
|
||||
S32 sound = -1;
|
||||
|
|
@ -7061,7 +7056,7 @@ void Player:: playImpactSound()
|
|||
sound = 2; // Play metal;
|
||||
|
||||
if (sound >= 0)
|
||||
SFX->playOnce(mDataBlock->getPlayerSoundProfile(PlayerData::ImpactSoft + sound), &getTransform());
|
||||
SFX->playOnce(mDataBlock->getPlayerSoundSFXTrack(PlayerData::ImpactSoft + sound), &getTransform());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -7215,11 +7210,11 @@ bool Player::collidingWithWater( Point3F &waterHeight )
|
|||
void Player::createSplash( Point3F &pos, F32 speed )
|
||||
{
|
||||
if ( speed >= mDataBlock->hardSplashSoundVel )
|
||||
SFX->playOnce( mDataBlock->getPlayerSoundProfile(PlayerData::ImpactWaterHard), &getTransform() );
|
||||
SFX->playOnce( mDataBlock->getPlayerSoundSFXTrack(PlayerData::ImpactWaterHard), &getTransform() );
|
||||
else if ( speed >= mDataBlock->medSplashSoundVel )
|
||||
SFX->playOnce( mDataBlock->getPlayerSoundProfile(PlayerData::ImpactWaterMedium), &getTransform() );
|
||||
SFX->playOnce( mDataBlock->getPlayerSoundSFXTrack(PlayerData::ImpactWaterMedium), &getTransform() );
|
||||
else
|
||||
SFX->playOnce( mDataBlock->getPlayerSoundProfile(PlayerData::ImpactWaterEasy), &getTransform() );
|
||||
SFX->playOnce( mDataBlock->getPlayerSoundSFXTrack(PlayerData::ImpactWaterEasy), &getTransform() );
|
||||
|
||||
if( mDataBlock->splash )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -147,8 +147,6 @@ ProjectileData::ProjectileData()
|
|||
{
|
||||
mProjectileShapeAsset.registerRefreshNotify(this);
|
||||
|
||||
INIT_ASSET(ProjectileSound);
|
||||
|
||||
explosion = NULL;
|
||||
explosionId = 0;
|
||||
|
||||
|
|
@ -220,7 +218,7 @@ ProjectileData::ProjectileData(const ProjectileData& other, bool temp_clone) : G
|
|||
splashId = other.splashId; // -- for pack/unpack of splash ptr
|
||||
decal = other.decal;
|
||||
decalId = other.decalId; // -- for pack/unpack of decal ptr
|
||||
CLONE_ASSET(ProjectileSound);
|
||||
mProjectileSoundAsset = other.mProjectileSoundAsset;
|
||||
lightDesc = other.lightDesc;
|
||||
lightDescId = other.lightDescId; // -- for pack/unpack of lightDesc ptr
|
||||
mProjectileShapeAsset = other.mProjectileShapeAsset;// -- TSShape loads using mProjectileShapeName
|
||||
|
|
@ -412,7 +410,7 @@ bool ProjectileData::preload(bool server, String &errorStr)
|
|||
if (Sim::findObject(decalId, decal) == false)
|
||||
Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet, bad datablockId(decal): %d", decalId);
|
||||
|
||||
if (!isProjectileSoundValid())
|
||||
if (!getProjectileSoundSFXTrack())
|
||||
{
|
||||
//return false; -TODO: trigger asset download
|
||||
}
|
||||
|
|
@ -477,7 +475,7 @@ void ProjectileData::packData(BitStream* stream)
|
|||
if (stream->writeFlag(decal != NULL))
|
||||
stream->writeRangedU32(decal->getId(), DataBlockObjectIdFirst,
|
||||
DataBlockObjectIdLast);
|
||||
PACKDATA_ASSET(ProjectileSound);
|
||||
PACKDATA_ASSET_REFACTOR(ProjectileSound);
|
||||
|
||||
if ( stream->writeFlag(lightDesc != NULL))
|
||||
stream->writeRangedU32(lightDesc->getId(), DataBlockObjectIdFirst,
|
||||
|
|
@ -539,7 +537,7 @@ void ProjectileData::unpackData(BitStream* stream)
|
|||
if (stream->readFlag())
|
||||
decalId = stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast);
|
||||
|
||||
UNPACKDATA_ASSET(ProjectileSound);
|
||||
UNPACKDATA_ASSET_REFACTOR(ProjectileSound);
|
||||
|
||||
if (stream->readFlag())
|
||||
lightDescId = stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast);
|
||||
|
|
@ -928,8 +926,8 @@ bool Projectile::onNewDataBlock( GameBaseData *dptr, bool reload )
|
|||
|
||||
SFX_DELETE( mSound );
|
||||
|
||||
if ( mDataBlock->getProjectileSound() )
|
||||
mSound = SFX->createSource( mDataBlock->getProjectileSoundProfile() );
|
||||
if ( mDataBlock->getProjectileSoundSFXTrack() )
|
||||
mSound = SFX->createSource( mDataBlock->getProjectileSoundSFXTrack() );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -1143,7 +1141,7 @@ void Projectile::explode( const Point3F &p, const Point3F &n, const U32 collideT
|
|||
|
||||
void Projectile::updateSound()
|
||||
{
|
||||
if (!mDataBlock->isProjectileSoundValid())
|
||||
if (!mDataBlock->getProjectileSoundSFXTrack())
|
||||
return;
|
||||
|
||||
if ( mSound )
|
||||
|
|
|
|||
|
|
@ -116,7 +116,6 @@ public:
|
|||
S32 decalId; // (impact) Decal ID
|
||||
|
||||
DECLARE_SOUNDASSET(ProjectileData, ProjectileSound);
|
||||
DECLARE_ASSET_SETGET(ProjectileData, ProjectileSound);
|
||||
|
||||
LightDescription *lightDesc;
|
||||
S32 lightDescId;
|
||||
|
|
|
|||
|
|
@ -82,8 +82,6 @@ ProximityMineData::ProximityMineData()
|
|||
triggerSequence( -1 ),
|
||||
explosionOffset( 0.05f )
|
||||
{
|
||||
INIT_ASSET(ArmSound);
|
||||
INIT_ASSET(TriggerSound);
|
||||
}
|
||||
|
||||
void ProximityMineData::initPersistFields()
|
||||
|
|
@ -134,11 +132,11 @@ bool ProximityMineData::preload( bool server, String& errorStr )
|
|||
|
||||
if ( !server )
|
||||
{
|
||||
if(!isArmSoundValid() )
|
||||
if(!getArmSoundSFXTrack() )
|
||||
{
|
||||
//return false; -TODO: trigger asset download
|
||||
}
|
||||
if(!isTriggerSoundValid() )
|
||||
if(!getTriggerSoundSFXTrack() )
|
||||
{
|
||||
//return false; -TODO: trigger asset download
|
||||
}
|
||||
|
|
@ -159,14 +157,14 @@ void ProximityMineData::packData( BitStream* stream )
|
|||
Parent::packData( stream );
|
||||
|
||||
stream->write( armingDelay );
|
||||
PACKDATA_ASSET(ArmSound);
|
||||
PACKDATA_ASSET_REFACTOR(ArmSound);
|
||||
|
||||
stream->write( autoTriggerDelay );
|
||||
stream->writeFlag( triggerOnOwner );
|
||||
stream->write( triggerRadius );
|
||||
stream->write( triggerSpeed );
|
||||
stream->write( triggerDelay );
|
||||
PACKDATA_ASSET(TriggerSound);
|
||||
PACKDATA_ASSET_REFACTOR(TriggerSound);
|
||||
}
|
||||
|
||||
void ProximityMineData::unpackData( BitStream* stream )
|
||||
|
|
@ -174,14 +172,14 @@ void ProximityMineData::unpackData( BitStream* stream )
|
|||
Parent::unpackData(stream);
|
||||
|
||||
stream->read( &armingDelay );
|
||||
UNPACKDATA_ASSET(ArmSound);
|
||||
UNPACKDATA_ASSET_REFACTOR(ArmSound);
|
||||
|
||||
stream->read( &autoTriggerDelay );
|
||||
triggerOnOwner = stream->readFlag();
|
||||
stream->read( &triggerRadius );
|
||||
stream->read( &triggerSpeed );
|
||||
stream->read( &triggerDelay );
|
||||
UNPACKDATA_ASSET(TriggerSound);
|
||||
UNPACKDATA_ASSET_REFACTOR(TriggerSound);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
@ -429,8 +427,8 @@ void ProximityMine::processTick( const Move* move )
|
|||
mAnimThread = mShapeInstance->addThread();
|
||||
mShapeInstance->setSequence( mAnimThread, mDataBlock->armingSequence, 0.0f );
|
||||
}
|
||||
if ( mDataBlock->getArmSoundProfile() )
|
||||
SFX->playOnce( mDataBlock->getArmSoundProfile(), &getRenderTransform() );
|
||||
if ( mDataBlock->getArmSoundSFXTrack() )
|
||||
SFX->playOnce( mDataBlock->getArmSoundSFXTrack(), &getRenderTransform() );
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -470,8 +468,8 @@ void ProximityMine::processTick( const Move* move )
|
|||
mAnimThread = mShapeInstance->addThread();
|
||||
mShapeInstance->setSequence( mAnimThread, mDataBlock->triggerSequence, 0.0f );
|
||||
}
|
||||
if ( mDataBlock->getTriggerSoundProfile() )
|
||||
SFX->playOnce( mDataBlock->getTriggerSoundProfile(), &getRenderTransform() );
|
||||
if ( mDataBlock->getTriggerSoundSFXTrack() )
|
||||
SFX->playOnce( mDataBlock->getTriggerSoundSFXTrack(), &getRenderTransform() );
|
||||
|
||||
if ( isServerObject() )
|
||||
mDataBlock->onTriggered_callback( this, sql.mList[0] );
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ public:
|
|||
F32 armingDelay;
|
||||
S32 armingSequence;
|
||||
DECLARE_SOUNDASSET(ProximityMineData, ArmSound);
|
||||
DECLARE_ASSET_SETGET(ProximityMineData, ArmSound);
|
||||
|
||||
F32 autoTriggerDelay;
|
||||
bool triggerOnOwner;
|
||||
|
|
@ -55,7 +54,6 @@ public:
|
|||
F32 triggerDelay;
|
||||
S32 triggerSequence;
|
||||
DECLARE_SOUNDASSET(ProximityMineData, TriggerSound);
|
||||
DECLARE_ASSET_SETGET(ProximityMineData, TriggerSound);
|
||||
|
||||
F32 explosionOffset;
|
||||
|
||||
|
|
|
|||
|
|
@ -254,9 +254,6 @@ RigidShapeData::RigidShapeData()
|
|||
drag = 0.7f;
|
||||
density = 4;
|
||||
|
||||
for (S32 i = 0; i < Body::MaxSounds; i++)
|
||||
INIT_SOUNDASSET_ARRAY(BodySounds, i);
|
||||
|
||||
dustEmitter = NULL;
|
||||
dustID = 0;
|
||||
triggerDustHeight = 3.0;
|
||||
|
|
@ -273,9 +270,6 @@ RigidShapeData::RigidShapeData()
|
|||
hardSplashSoundVel = 3.0;
|
||||
enablePhysicsRep = true;
|
||||
|
||||
for (S32 i = 0; i < Sounds::MaxSounds; i++)
|
||||
INIT_SOUNDASSET_ARRAY(WaterSounds, i);
|
||||
|
||||
dragForce = 0.01f;
|
||||
vertFactor = 0.25;
|
||||
|
||||
|
|
@ -348,7 +342,7 @@ bool RigidShapeData::preload(bool server, String &errorStr)
|
|||
if (!server) {
|
||||
for (S32 i = 0; i < Body::MaxSounds; i++)
|
||||
{
|
||||
if (!isBodySoundsValid(i))
|
||||
if (!getBodySoundsSFXTrack(i))
|
||||
{
|
||||
//return false; -TODO: trigger asset download
|
||||
}
|
||||
|
|
@ -356,7 +350,7 @@ bool RigidShapeData::preload(bool server, String &errorStr)
|
|||
|
||||
for (S32 j = 0; j < Sounds::MaxSounds; j++)
|
||||
{
|
||||
if (!isWaterSoundsValid(j))
|
||||
if (!getWaterSoundsSFXTrack(j))
|
||||
{
|
||||
//return false; -TODO: trigger asset download
|
||||
}
|
||||
|
|
@ -419,10 +413,8 @@ void RigidShapeData::packData(BitStream* stream)
|
|||
|
||||
stream->write(body.restitution);
|
||||
stream->write(body.friction);
|
||||
for (U32 i = 0; i < Body::MaxSounds; ++i)
|
||||
{
|
||||
PACKDATA_SOUNDASSET_ARRAY(BodySounds, i);
|
||||
}
|
||||
|
||||
PACKDATA_ASSET_ARRAY_REFACTOR(BodySounds, Body::MaxSounds);
|
||||
|
||||
stream->write(minImpactSpeed);
|
||||
stream->write(softImpactSpeed);
|
||||
|
|
@ -452,10 +444,7 @@ void RigidShapeData::packData(BitStream* stream)
|
|||
stream->write(enablePhysicsRep);
|
||||
|
||||
// write the water sound profiles
|
||||
for (U32 i = 0; i < Sounds::MaxSounds; ++i)
|
||||
{
|
||||
PACKDATA_SOUNDASSET_ARRAY(WaterSounds, i);
|
||||
}
|
||||
PACKDATA_ASSET_ARRAY_REFACTOR(WaterSounds, Sounds::MaxSounds);
|
||||
|
||||
if (stream->writeFlag( dustEmitter ))
|
||||
stream->writeRangedU32( dustEmitter->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast );
|
||||
|
|
@ -483,10 +472,7 @@ void RigidShapeData::unpackData(BitStream* stream)
|
|||
stream->read(&body.restitution);
|
||||
stream->read(&body.friction);
|
||||
|
||||
for (U32 i = 0; i < Body::Sounds::MaxSounds; i++)
|
||||
{
|
||||
UNPACKDATA_SOUNDASSET_ARRAY(BodySounds, i);
|
||||
}
|
||||
UNPACKDATA_ASSET_ARRAY_REFACTOR(BodySounds, Body::Sounds::MaxSounds);
|
||||
|
||||
stream->read(&minImpactSpeed);
|
||||
stream->read(&softImpactSpeed);
|
||||
|
|
@ -516,10 +502,7 @@ void RigidShapeData::unpackData(BitStream* stream)
|
|||
stream->read(&enablePhysicsRep);
|
||||
|
||||
// write the water sound profiles
|
||||
for (U32 i = 0; i < Sounds::MaxSounds; ++i)
|
||||
{
|
||||
UNPACKDATA_SOUNDASSET_ARRAY(WaterSounds, i);
|
||||
}
|
||||
UNPACKDATA_ASSET_ARRAY_REFACTOR(WaterSounds, Sounds::MaxSounds);
|
||||
|
||||
if( stream->readFlag() )
|
||||
dustID = (S32) stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast);
|
||||
|
|
@ -1210,27 +1193,27 @@ void RigidShape::updatePos(F32 dt)
|
|||
if (collSpeed >= mDataBlock->softImpactSpeed)
|
||||
impactSound = RigidShapeData::Body::SoftImpactSound;
|
||||
|
||||
if (impactSound != -1 && mDataBlock->getBodySoundsProfile(impactSound))
|
||||
SFX->playOnce(mDataBlock->getBodySoundsProfile(impactSound), &getTransform());
|
||||
if (impactSound != -1 && mDataBlock->getBodySoundsSFXTrack(impactSound))
|
||||
SFX->playOnce(mDataBlock->getBodySoundsSFXTrack(impactSound), &getTransform());
|
||||
}
|
||||
|
||||
// Water volume sounds
|
||||
F32 vSpeed = getVelocity().len();
|
||||
if (!inLiquid && mWaterCoverage >= 0.8f) {
|
||||
if (vSpeed >= mDataBlock->hardSplashSoundVel)
|
||||
SFX->playOnce(mDataBlock->getWaterSoundsProfile(RigidShapeData::ImpactHard), &getTransform());
|
||||
SFX->playOnce(mDataBlock->getWaterSoundsSFXTrack(RigidShapeData::ImpactHard), &getTransform());
|
||||
else
|
||||
if (vSpeed >= mDataBlock->medSplashSoundVel)
|
||||
SFX->playOnce(mDataBlock->getWaterSoundsProfile(RigidShapeData::ImpactMedium), &getTransform());
|
||||
SFX->playOnce(mDataBlock->getWaterSoundsSFXTrack(RigidShapeData::ImpactMedium), &getTransform());
|
||||
else
|
||||
if (vSpeed >= mDataBlock->softSplashSoundVel)
|
||||
SFX->playOnce(mDataBlock->getWaterSoundsProfile(RigidShapeData::ImpactSoft), &getTransform());
|
||||
SFX->playOnce(mDataBlock->getWaterSoundsSFXTrack(RigidShapeData::ImpactSoft), &getTransform());
|
||||
inLiquid = true;
|
||||
}
|
||||
else
|
||||
if (inLiquid && mWaterCoverage < 0.8f) {
|
||||
if (vSpeed >= mDataBlock->exitSplashSoundVel)
|
||||
SFX->playOnce(mDataBlock->getWaterSoundsProfile(RigidShapeData::ExitWater), &getTransform());
|
||||
SFX->playOnce(mDataBlock->getWaterSoundsSFXTrack(RigidShapeData::ExitWater), &getTransform());
|
||||
inLiquid = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,7 +83,6 @@ class RigidShapeData : public ShapeBaseData
|
|||
MaxSounds
|
||||
};
|
||||
DECLARE_SOUNDASSET_ARRAY(RigidShapeData, WaterSounds, Sounds::MaxSounds)
|
||||
DECLARE_ASSET_ARRAY_SETGET(RigidShapeData, WaterSounds);
|
||||
|
||||
F32 exitSplashSoundVel;
|
||||
F32 softSplashSoundVel;
|
||||
|
|
|
|||
|
|
@ -223,8 +223,6 @@ SFXEmitter::SFXEmitter()
|
|||
mInstanceDescription = &mDescription;
|
||||
mLocalProfile = NULL;
|
||||
|
||||
INIT_ASSET(Sound);
|
||||
|
||||
mObjBox.minExtents.set( -1.f, -1.f, -1.f );
|
||||
mObjBox.maxExtents.set( 1.f, 1.f, 1.f );
|
||||
}
|
||||
|
|
@ -408,15 +406,10 @@ U32 SFXEmitter::packUpdate(NetConnection* con, U32 mask, BitStream* stream)
|
|||
stream->writeAffineTransform(mObjToWorld);
|
||||
|
||||
// track
|
||||
if (stream->writeFlag(mask & DirtyUpdateMask)){
|
||||
PACK_ASSET(con, Sound);
|
||||
if (stream->writeFlag(mDirty.test(Track))){
|
||||
PACK_ASSET_REFACTOR(con, Sound);
|
||||
}
|
||||
//if (stream->writeFlag(mDirty.test(Track)))
|
||||
// sfxWrite( stream, mTrack );
|
||||
|
||||
// filename
|
||||
//if( stream->writeFlag( mDirty.test( Filename ) ) )
|
||||
// stream->writeString( mLocalProfile.mFilename );
|
||||
if (!stream->writeFlag(mUseTrackDescriptionOnly))
|
||||
{
|
||||
// volume
|
||||
|
|
@ -521,21 +514,10 @@ void SFXEmitter::unpackUpdate( NetConnection *conn, BitStream *stream )
|
|||
}
|
||||
|
||||
// track
|
||||
if (stream->readFlag()) // DirtyUpdateMask
|
||||
if (_readDirtyFlag(stream, Track)) // DirtyUpdateMask
|
||||
{
|
||||
initialUpdate = false;
|
||||
UNPACK_ASSET(conn, Sound);
|
||||
UNPACK_ASSET_REFACTOR(conn, Sound);
|
||||
}
|
||||
/*if (_readDirtyFlag(stream, Track))
|
||||
{
|
||||
String errorStr;
|
||||
if( !sfxReadAndResolve( stream, &mTrack, errorStr ) )
|
||||
Con::errorf( "%s", errorStr.c_str() );
|
||||
}
|
||||
|
||||
// filename
|
||||
if ( _readDirtyFlag( stream, Filename ) )
|
||||
mLocalProfile.mFilename = stream->readSTString();*/
|
||||
|
||||
mUseTrackDescriptionOnly = stream->readFlag();
|
||||
if (!mUseTrackDescriptionOnly)
|
||||
|
|
@ -775,7 +757,7 @@ void SFXEmitter::_update()
|
|||
SFXStatus prevState = mSource ? mSource->getStatus() : SFXStatusNull;
|
||||
|
||||
// are we overriding the asset properties?
|
||||
bool useTrackDescriptionOnly = (mUseTrackDescriptionOnly && mSoundAsset.notNull() && getSoundProfile());
|
||||
bool useTrackDescriptionOnly = (mUseTrackDescriptionOnly && mSoundAsset.notNull() && getSoundSFXTrack());
|
||||
|
||||
if (mSoundAsset.notNull())
|
||||
{
|
||||
|
|
@ -784,7 +766,7 @@ void SFXEmitter::_update()
|
|||
else
|
||||
mInstanceDescription = &mDescription;
|
||||
|
||||
mLocalProfile = getSoundProfile();
|
||||
mLocalProfile = getSoundSFXTrack();
|
||||
|
||||
// Make sure all the settings are valid.
|
||||
mInstanceDescription->validate();
|
||||
|
|
@ -798,12 +780,12 @@ void SFXEmitter::_update()
|
|||
if( mDirty.test( Track | Is3D | IsLooping | IsStreaming | TrackOnly ) )
|
||||
{
|
||||
SFX_DELETE( mSource );
|
||||
if (getSoundProfile())
|
||||
if (getSoundSFXTrack())
|
||||
{
|
||||
mSource = SFX->createSource(mLocalProfile, &transform, &velocity);
|
||||
if (!mSource)
|
||||
Con::errorf("SFXEmitter::_update() - failed to create sound for track %i (%s)",
|
||||
getSoundProfile()->getId(), getSoundProfile()->getName());
|
||||
getSoundSFXTrack()->getId(), getSoundSFXTrack()->getName());
|
||||
|
||||
// If we're supposed to play when the emitter is
|
||||
// added to the scene then also restart playback
|
||||
|
|
@ -820,7 +802,7 @@ void SFXEmitter::_update()
|
|||
// is toggled on a local profile sound. It makes the
|
||||
// editor feel responsive and that things are working.
|
||||
if( gEditingMission &&
|
||||
(SoundAsset::getAssetErrCode(mSoundAsset) || !mSoundAsset->getSfxProfile()) &&
|
||||
(SoundAsset::getAssetErrCode(mSoundAsset)) &&
|
||||
mPlayOnAdd &&
|
||||
mDirty.test( IsLooping ) )
|
||||
prevState = SFXStatusPlaying;
|
||||
|
|
@ -1222,7 +1204,7 @@ void SFXEmitter::setScale( const VectorF &scale )
|
|||
{
|
||||
F32 maxDistance;
|
||||
|
||||
if( mUseTrackDescriptionOnly && mSoundAsset.notNull() && getSoundProfile())
|
||||
if( mUseTrackDescriptionOnly && mSoundAsset.notNull())
|
||||
maxDistance = mSoundAsset->getSfxDescription()->mMaxDistance;
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -122,9 +122,8 @@ class SFXEmitter : public SceneObject
|
|||
BitSet32 mDirty;
|
||||
|
||||
DECLARE_SOUNDASSET(SFXEmitter, Sound);
|
||||
DECLARE_ASSET_NET_SETGET(SFXEmitter, Sound, DirtyUpdateMask);
|
||||
/// returns the shape asset used for this object
|
||||
StringTableEntry getTypeHint() const override { return (getSoundAsset()) ? getSoundAsset()->getAssetName() : StringTable->EmptyString(); }
|
||||
StringTableEntry getTypeHint() const override { return (mSoundAsset.notNull()) ? mSoundAsset->getAssetName() : StringTable->EmptyString(); }
|
||||
|
||||
/// The sound source for the emitter.
|
||||
SFXSource *mSource;
|
||||
|
|
|
|||
|
|
@ -267,7 +267,6 @@ struct ShapeBaseImageData: public GameBaseData, protected AssetPtrCallback
|
|||
//SFXTrack* sound;
|
||||
F32 emitterTime; ///<
|
||||
S32 emitterNode[MaxShapes]; ///< Node ID on the shape to emit from
|
||||
SoundAsset* sound;
|
||||
SFXTrack* soundTrack; ///<Holdover for special, non-asset cases like SFXPlaylists
|
||||
};
|
||||
/// @name State Data
|
||||
|
|
@ -328,7 +327,6 @@ struct ShapeBaseImageData: public GameBaseData, protected AssetPtrCallback
|
|||
bool stateIgnoreLoadedForReady [MaxStates];
|
||||
|
||||
DECLARE_SOUNDASSET_ARRAY(ShapeBaseImageData, stateSound, MaxStates);
|
||||
DECLARE_ASSET_ARRAY_SETGET(ShapeBaseImageData, stateSound);
|
||||
|
||||
//SFXTrack* stateSound [MaxStates];
|
||||
const char* stateScript [MaxStates];
|
||||
|
|
|
|||
|
|
@ -132,7 +132,6 @@ ShapeBaseImageData::StateData::StateData()
|
|||
loaded = IgnoreLoaded;
|
||||
spin = IgnoreSpin;
|
||||
recoil = NoRecoil;
|
||||
sound = NULL;
|
||||
soundTrack = NULL;
|
||||
emitter = NULL;
|
||||
shapeSequence = NULL;
|
||||
|
|
@ -255,8 +254,6 @@ ShapeBaseImageData::ShapeBaseImageData()
|
|||
|
||||
stateShapeSequence[i] = 0;
|
||||
stateScaleShapeSequence[i] = false;
|
||||
|
||||
INIT_SOUNDASSET_ARRAY(stateSound, i);
|
||||
stateScript[i] = 0;
|
||||
stateEmitter[i] = 0;
|
||||
stateEmitterTime[i] = 0;
|
||||
|
|
@ -421,7 +418,7 @@ bool ShapeBaseImageData::preload(bool server, String &errorStr)
|
|||
if (!Sim::findObject(SimObjectId((uintptr_t)state[i].emitter), state[i].emitter))
|
||||
Con::errorf(ConsoleLogEntry::General, "Error, unable to load emitter for image datablock");
|
||||
|
||||
if (!isstateSoundValid(i))
|
||||
if (!getstateSoundSFXTrack(i))
|
||||
{
|
||||
//return false; -TODO: trigger asset download
|
||||
}
|
||||
|
|
@ -577,37 +574,7 @@ void ShapeBaseImageData::handleStateSoundTrack(const U32& stateId)
|
|||
return;
|
||||
|
||||
StateData& s = state[stateId];
|
||||
|
||||
s.sound = getstateSoundAsset(stateId);
|
||||
|
||||
if (s.sound == NULL)
|
||||
{
|
||||
if (mstateSoundName[stateId] != StringTable->EmptyString())
|
||||
{
|
||||
//ok, so we've got some sort of special-case here like a fallback or SFXPlaylist. So do the hook-up now
|
||||
SFXTrack* sndTrack;
|
||||
if (!Sim::findObject(mstateSoundName[stateId], sndTrack))
|
||||
{
|
||||
Con::errorf("ShapeBaseImageData::onAdd() - attempted to find sound %s but failed!", mstateSoundName[stateId]);
|
||||
}
|
||||
else
|
||||
{
|
||||
s.soundTrack = sndTrack;
|
||||
}
|
||||
}
|
||||
else if (mstateSoundSFXId[stateId] != 0)
|
||||
{
|
||||
SFXTrack* sndTrack;
|
||||
if (!Sim::findObject(mstateSoundSFXId[stateId], sndTrack))
|
||||
{
|
||||
Con::errorf("ShapeBaseImageData::onAdd() - attempted to find sound %i but failed!", mstateSoundSFXId[stateId]);
|
||||
}
|
||||
else
|
||||
{
|
||||
s.soundTrack = sndTrack;
|
||||
}
|
||||
}
|
||||
}
|
||||
s.soundTrack = getstateSoundSFXTrack(stateId);
|
||||
}
|
||||
|
||||
S32 ShapeBaseImageData::lookupState(const char* name)
|
||||
|
|
@ -1162,7 +1129,7 @@ void ShapeBaseImageData::packData(BitStream* stream)
|
|||
}
|
||||
}
|
||||
|
||||
PACKDATA_SOUNDASSET_ARRAY(stateSound, i);
|
||||
PACKDATA_ASSET_ARRAY(stateSound, i);
|
||||
}
|
||||
stream->write(maxConcurrentSounds);
|
||||
stream->writeFlag(useRemainderDT);
|
||||
|
|
@ -1364,7 +1331,7 @@ void ShapeBaseImageData::unpackData(BitStream* stream)
|
|||
else
|
||||
s.emitter = 0;
|
||||
|
||||
UNPACKDATA_SOUNDASSET_ARRAY(stateSound, i);
|
||||
UNPACKDATA_ASSET_ARRAY(stateSound, i);
|
||||
handleStateSoundTrack(i);
|
||||
}
|
||||
}
|
||||
|
|
@ -2776,7 +2743,7 @@ void ShapeBase::setImageState(U32 imageSlot, U32 newState, bool force)
|
|||
// Delete any loooping sounds that were in the previous state.
|
||||
// this is the crazy bit =/ needs to know prev state in order to stop sounds.
|
||||
// lastState does not return an id for the prev state so we keep track of it.
|
||||
if (lastState->sound && lastState->sound->getSFXTrack()->getDescription()->mIsLooping)
|
||||
if (lastState->soundTrack && lastState->soundTrack->getDescription()->mIsLooping)
|
||||
{
|
||||
for (Vector<SFXSource*>::iterator i = image.mSoundSources.begin(); i != image.mSoundSources.end(); i++)
|
||||
SFX_DELETE((*i));
|
||||
|
|
@ -2787,11 +2754,6 @@ void ShapeBase::setImageState(U32 imageSlot, U32 newState, bool force)
|
|||
// Play sound
|
||||
if (isGhost())
|
||||
{
|
||||
if (stateData.sound)
|
||||
{
|
||||
const Point3F& velocity = getVelocity();
|
||||
image.addSoundSource(SFX->createSource(stateData.sound->getSFXTrack(), &getRenderTransform(), &velocity));
|
||||
}
|
||||
if (stateData.soundTrack)
|
||||
{
|
||||
const Point3F& velocity = getVelocity();
|
||||
|
|
|
|||
|
|
@ -124,9 +124,6 @@ FlyingVehicleData::FlyingVehicleData()
|
|||
for (S32 j = 0; j < MaxJetEmitters; j++)
|
||||
jetEmitter[j] = 0;
|
||||
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
INIT_SOUNDASSET_ARRAY(FlyingSounds, i);
|
||||
|
||||
vertThrustMultiple = 1.0;
|
||||
}
|
||||
|
||||
|
|
@ -141,7 +138,7 @@ bool FlyingVehicleData::preload(bool server, String &errorStr)
|
|||
if (!server) {
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
{
|
||||
if (!isFlyingSoundsValid(i))
|
||||
if (!getFlyingSoundsSFXTrack(i))
|
||||
{
|
||||
//return false; -TODO: trigger asset download
|
||||
}
|
||||
|
|
@ -258,10 +255,7 @@ void FlyingVehicleData::packData(BitStream* stream)
|
|||
{
|
||||
Parent::packData(stream);
|
||||
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
{
|
||||
PACKDATA_SOUNDASSET_ARRAY(FlyingSounds, i);
|
||||
}
|
||||
PACKDATA_ASSET_ARRAY_REFACTOR(FlyingSounds, MaxSounds);
|
||||
|
||||
for (S32 j = 0; j < MaxJetEmitters; j++)
|
||||
{
|
||||
|
|
@ -293,10 +287,7 @@ void FlyingVehicleData::unpackData(BitStream* stream)
|
|||
{
|
||||
Parent::unpackData(stream);
|
||||
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
{
|
||||
UNPACKDATA_SOUNDASSET_ARRAY(FlyingSounds, i);
|
||||
}
|
||||
UNPACKDATA_ASSET_ARRAY_REFACTOR(FlyingSounds, MaxSounds);
|
||||
|
||||
for (S32 j = 0; j < MaxJetEmitters; j++) {
|
||||
jetEmitter[j] = NULL;
|
||||
|
|
@ -385,11 +376,11 @@ bool FlyingVehicle::onNewDataBlock(GameBaseData* dptr, bool reload)
|
|||
SFX_DELETE( mJetSound );
|
||||
SFX_DELETE( mEngineSound );
|
||||
|
||||
if ( mDataBlock->getFlyingSounds(FlyingVehicleData::EngineSound) )
|
||||
mEngineSound = SFX->createSource( mDataBlock->getFlyingSoundsProfile(FlyingVehicleData::EngineSound), &getTransform() );
|
||||
if ( mDataBlock->getFlyingSoundsSFXTrack(FlyingVehicleData::EngineSound) )
|
||||
mEngineSound = SFX->createSource( mDataBlock->getFlyingSoundsSFXTrack(FlyingVehicleData::EngineSound), &getTransform() );
|
||||
|
||||
if ( mDataBlock->getFlyingSounds(FlyingVehicleData::JetSound))
|
||||
mJetSound = SFX->createSource( mDataBlock->getFlyingSoundsProfile(FlyingVehicleData::JetSound), &getTransform() );
|
||||
if ( mDataBlock->getFlyingSoundsSFXTrack(FlyingVehicleData::JetSound))
|
||||
mJetSound = SFX->createSource( mDataBlock->getFlyingSoundsSFXTrack(FlyingVehicleData::JetSound), &getTransform() );
|
||||
}
|
||||
|
||||
// Jet Sequences
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ struct FlyingVehicleData: public VehicleData {
|
|||
MaxSounds,
|
||||
};
|
||||
DECLARE_SOUNDASSET_ARRAY(FlyingVehicleData, FlyingSounds, Sounds::MaxSounds);
|
||||
DECLARE_ASSET_ARRAY_SETGET(FlyingVehicleData, FlyingSounds);
|
||||
|
||||
enum Jets {
|
||||
// These enums index into a static name list.
|
||||
|
|
|
|||
|
|
@ -158,9 +158,6 @@ HoverVehicleData::HoverVehicleData()
|
|||
|
||||
for (S32 j = 0; j < MaxJetEmitters; j++)
|
||||
jetEmitter[j] = 0;
|
||||
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
INIT_SOUNDASSET_ARRAY(HoverSounds, i);
|
||||
}
|
||||
|
||||
HoverVehicleData::~HoverVehicleData()
|
||||
|
|
@ -313,7 +310,7 @@ bool HoverVehicleData::preload(bool server, String &errorStr)
|
|||
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
{
|
||||
if (!isHoverSoundsValid(i))
|
||||
if (!getHoverSoundsSFXTrack(i))
|
||||
{
|
||||
//return false; -TODO: trigger asset download
|
||||
}
|
||||
|
|
@ -365,10 +362,7 @@ void HoverVehicleData::packData(BitStream* stream)
|
|||
stream->write(triggerTrailHeight);
|
||||
stream->write(dustTrailFreqMod);
|
||||
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
{
|
||||
PACKDATA_SOUNDASSET_ARRAY(HoverSounds, i);
|
||||
}
|
||||
PACKDATA_ASSET_ARRAY_REFACTOR(HoverSounds, MaxSounds);
|
||||
|
||||
for (S32 j = 0; j < MaxJetEmitters; j++)
|
||||
{
|
||||
|
|
@ -414,10 +408,7 @@ void HoverVehicleData::unpackData(BitStream* stream)
|
|||
stream->read(&triggerTrailHeight);
|
||||
stream->read(&dustTrailFreqMod);
|
||||
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
{
|
||||
UNPACKDATA_SOUNDASSET_ARRAY(HoverSounds, i);
|
||||
}
|
||||
UNPACKDATA_ASSET_ARRAY_REFACTOR(HoverSounds, MaxSounds);
|
||||
|
||||
for (S32 j = 0; j < MaxJetEmitters; j++) {
|
||||
jetEmitter[j] = NULL;
|
||||
|
|
@ -539,14 +530,14 @@ bool HoverVehicle::onNewDataBlock(GameBaseData* dptr, bool reload)
|
|||
SFX_DELETE( mFloatSound );
|
||||
SFX_DELETE( mJetSound );
|
||||
|
||||
if ( mDataBlock->getHoverSounds(HoverVehicleData::EngineSound) )
|
||||
mEngineSound = SFX->createSource( mDataBlock->getHoverSoundsProfile(HoverVehicleData::EngineSound), &getTransform() );
|
||||
if ( mDataBlock->getHoverSoundsSFXTrack(HoverVehicleData::EngineSound) )
|
||||
mEngineSound = SFX->createSource( mDataBlock->getHoverSoundsSFXTrack(HoverVehicleData::EngineSound), &getTransform() );
|
||||
|
||||
if ( !mDataBlock->getHoverSounds(HoverVehicleData::FloatSound) )
|
||||
mFloatSound = SFX->createSource( mDataBlock->getHoverSoundsProfile(HoverVehicleData::FloatSound), &getTransform() );
|
||||
if ( !mDataBlock->getHoverSoundsSFXTrack(HoverVehicleData::FloatSound) )
|
||||
mFloatSound = SFX->createSource( mDataBlock->getHoverSoundsSFXTrack(HoverVehicleData::FloatSound), &getTransform() );
|
||||
|
||||
if ( mDataBlock->getHoverSounds(HoverVehicleData::JetSound) )
|
||||
mJetSound = SFX->createSource( mDataBlock->getHoverSoundsProfile(HoverVehicleData::JetSound), &getTransform() );
|
||||
if ( mDataBlock->getHoverSoundsSFXTrack(HoverVehicleData::JetSound) )
|
||||
mJetSound = SFX->createSource( mDataBlock->getHoverSoundsSFXTrack(HoverVehicleData::JetSound), &getTransform() );
|
||||
}
|
||||
|
||||
// Todo: Uncomment if this is a "leaf" class
|
||||
|
|
|
|||
|
|
@ -882,27 +882,27 @@ void Vehicle::updatePos(F32 dt)
|
|||
if (collSpeed >= mDataBlock->softImpactSpeed)
|
||||
impactSound = RigidShapeData::Body::SoftImpactSound;
|
||||
|
||||
if (impactSound != -1 && mDataBlock->getBodySoundsProfile(impactSound) != NULL)
|
||||
SFX->playOnce( mDataBlock->getBodySoundsProfile(impactSound), &getTransform() );
|
||||
if (impactSound != -1 && mDataBlock->getBodySoundsSFXTrack(impactSound) != NULL)
|
||||
SFX->playOnce( mDataBlock->getBodySoundsSFXTrack(impactSound), &getTransform() );
|
||||
}
|
||||
|
||||
// Water volume sounds
|
||||
F32 vSpeed = getVelocity().len();
|
||||
if (!inLiquid && mWaterCoverage >= 0.8f) {
|
||||
if (vSpeed >= mDataBlock->hardSplashSoundVel)
|
||||
SFX->playOnce( mDataBlock->getWaterSoundsProfile(RigidShapeData::ImpactHard), &getTransform() );
|
||||
SFX->playOnce( mDataBlock->getBodySoundsSFXTrack(RigidShapeData::ImpactHard), &getTransform() );
|
||||
else
|
||||
if (vSpeed >= mDataBlock->medSplashSoundVel)
|
||||
SFX->playOnce( mDataBlock->getWaterSoundsProfile(RigidShapeData::ImpactMedium), &getTransform() );
|
||||
SFX->playOnce( mDataBlock->getBodySoundsSFXTrack(RigidShapeData::ImpactMedium), &getTransform() );
|
||||
else
|
||||
if (vSpeed >= mDataBlock->softSplashSoundVel)
|
||||
SFX->playOnce( mDataBlock->getWaterSoundsProfile(RigidShapeData::ImpactSoft), &getTransform() );
|
||||
SFX->playOnce( mDataBlock->getBodySoundsSFXTrack(RigidShapeData::ImpactSoft), &getTransform() );
|
||||
inLiquid = true;
|
||||
}
|
||||
else
|
||||
if(inLiquid && mWaterCoverage < 0.8f) {
|
||||
if (vSpeed >= mDataBlock->exitSplashSoundVel)
|
||||
SFX->playOnce( mDataBlock->getWaterSoundsProfile(RigidShapeData::ExitWater), &getTransform() );
|
||||
SFX->playOnce( mDataBlock->getBodySoundsSFXTrack(RigidShapeData::ExitWater), &getTransform() );
|
||||
inLiquid = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -312,8 +312,6 @@ WheeledVehicleData::WheeledVehicleData()
|
|||
steeringSequence = -1;
|
||||
wheelCount = 0;
|
||||
dMemset(&wheel, 0, sizeof(wheel));
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
INIT_SOUNDASSET_ARRAY(WheeledVehicleSounds, i);
|
||||
mDownForce = 0;
|
||||
}
|
||||
|
||||
|
|
@ -348,7 +346,7 @@ bool WheeledVehicleData::preload(bool server, String &errorStr)
|
|||
if (!server) {
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
{
|
||||
if (!isWheeledVehicleSoundsValid(i))
|
||||
if (!getWheeledVehicleSoundsSFXTrack(i))
|
||||
{
|
||||
//return false; -TODO: trigger asset download
|
||||
}
|
||||
|
|
@ -493,10 +491,7 @@ void WheeledVehicleData::packData(BitStream* stream)
|
|||
stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)tireEmitter):
|
||||
tireEmitter->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast);
|
||||
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
{
|
||||
PACKDATA_SOUNDASSET_ARRAY(WheeledVehicleSounds, i);
|
||||
}
|
||||
PACKDATA_ASSET_ARRAY_REFACTOR(WheeledVehicleSounds, MaxSounds);
|
||||
|
||||
stream->write(maxWheelSpeed);
|
||||
stream->write(engineTorque);
|
||||
|
|
@ -513,10 +508,8 @@ void WheeledVehicleData::unpackData(BitStream* stream)
|
|||
(ParticleEmitterData*)(uintptr_t)stream->readRangedU32(DataBlockObjectIdFirst,
|
||||
DataBlockObjectIdLast): 0;
|
||||
|
||||
for (S32 i = 0; i < MaxSounds; i++)
|
||||
{
|
||||
UNPACKDATA_SOUNDASSET_ARRAY(WheeledVehicleSounds, i);
|
||||
}
|
||||
UNPACKDATA_ASSET_ARRAY_REFACTOR(WheeledVehicleSounds, MaxSounds);
|
||||
|
||||
|
||||
stream->read(&maxWheelSpeed);
|
||||
stream->read(&engineTorque);
|
||||
|
|
@ -700,14 +693,14 @@ bool WheeledVehicle::onNewDataBlock(GameBaseData* dptr, bool reload)
|
|||
SFX_DELETE( mSquealSound );
|
||||
SFX_DELETE( mJetSound );
|
||||
|
||||
if ( mDataBlock->getWheeledVehicleSounds(WheeledVehicleData::EngineSound) )
|
||||
mEngineSound = SFX->createSource( mDataBlock->getWheeledVehicleSoundsProfile(WheeledVehicleData::EngineSound), &getTransform() );
|
||||
if ( mDataBlock->getWheeledVehicleSoundsSFXTrack(WheeledVehicleData::EngineSound) )
|
||||
mEngineSound = SFX->createSource( mDataBlock->getWheeledVehicleSoundsSFXTrack(WheeledVehicleData::EngineSound), &getTransform() );
|
||||
|
||||
if ( mDataBlock->getWheeledVehicleSounds(WheeledVehicleData::SquealSound) )
|
||||
mSquealSound = SFX->createSource( mDataBlock->getWheeledVehicleSoundsProfile(WheeledVehicleData::SquealSound), &getTransform() );
|
||||
if ( mDataBlock->getWheeledVehicleSoundsSFXTrack(WheeledVehicleData::SquealSound) )
|
||||
mSquealSound = SFX->createSource( mDataBlock->getWheeledVehicleSoundsSFXTrack(WheeledVehicleData::SquealSound), &getTransform() );
|
||||
|
||||
if ( mDataBlock->getWheeledVehicleSounds(WheeledVehicleData::JetSound) )
|
||||
mJetSound = SFX->createSource( mDataBlock->getWheeledVehicleSoundsProfile(WheeledVehicleData::JetSound), &getTransform() );
|
||||
if ( mDataBlock->getWheeledVehicleSoundsSFXTrack(WheeledVehicleData::JetSound) )
|
||||
mJetSound = SFX->createSource( mDataBlock->getWheeledVehicleSoundsSFXTrack(WheeledVehicleData::JetSound), &getTransform() );
|
||||
}
|
||||
|
||||
scriptOnNewDataBlock(reload);
|
||||
|
|
|
|||
|
|
@ -141,8 +141,6 @@ U32 Projectile::smProjectileWarpTicks = 5;
|
|||
//
|
||||
afxMagicMissileData::afxMagicMissileData()
|
||||
{
|
||||
INIT_ASSET(ProjectileSound);
|
||||
|
||||
/* From stock Projectile code...
|
||||
explosion = NULL;
|
||||
explosionId = 0;
|
||||
|
|
@ -247,9 +245,9 @@ afxMagicMissileData::afxMagicMissileData()
|
|||
|
||||
afxMagicMissileData::afxMagicMissileData(const afxMagicMissileData& other, bool temp_clone) : GameBaseData(other, temp_clone)
|
||||
{
|
||||
mProjectileShapeAsset = other.mProjectileShapeAsset;
|
||||
mProjectileShapeAsset = other.mProjectileShapeAsset;
|
||||
projectileShape = other.projectileShape; // -- TSShape loads using projectileShapeName
|
||||
CLONE_ASSET(ProjectileSound);
|
||||
mProjectileSoundAsset = other.mProjectileSoundAsset;
|
||||
splash = other.splash;
|
||||
splashId = other.splashId; // -- for pack/unpack of splash ptr
|
||||
lightDesc = other.lightDesc;
|
||||
|
|
@ -522,7 +520,7 @@ bool afxMagicMissileData::preload(bool server, String &errorStr)
|
|||
Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet, bad datablockId(decal): %d", decalId);
|
||||
*/
|
||||
|
||||
if (!isProjectileSoundValid())
|
||||
if (!getProjectileSoundSFXTrack())
|
||||
{
|
||||
//return false; -TODO: trigger asset download
|
||||
}
|
||||
|
|
@ -622,7 +620,7 @@ void afxMagicMissileData::packData(BitStream* stream)
|
|||
DataBlockObjectIdLast);
|
||||
*/
|
||||
|
||||
PACKDATA_ASSET(ProjectileSound);
|
||||
PACKDATA_ASSET_REFACTOR(ProjectileSound);
|
||||
|
||||
if ( stream->writeFlag(lightDesc != NULL))
|
||||
stream->writeRangedU32(lightDesc->getId(), DataBlockObjectIdFirst,
|
||||
|
|
@ -728,7 +726,7 @@ void afxMagicMissileData::unpackData(BitStream* stream)
|
|||
decalId = stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast);
|
||||
*/
|
||||
|
||||
UNPACKDATA_ASSET(ProjectileSound);
|
||||
UNPACKDATA_ASSET_REFACTOR(ProjectileSound);
|
||||
|
||||
if (stream->readFlag())
|
||||
lightDescId = stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast);
|
||||
|
|
@ -1152,8 +1150,7 @@ bool afxMagicMissile::onNewDataBlock(GameBaseData* dptr, bool reload)
|
|||
|
||||
SFX_DELETE( mSound );
|
||||
|
||||
if (mDataBlock->getProjectileSound())
|
||||
mSound = SFX->createSource(mDataBlock->getProjectileSoundProfile());
|
||||
mSound = SFX->createSource(mDataBlock->getProjectileSoundSFXTrack());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -1988,7 +1985,7 @@ void afxMagicMissile::get_launch_data(Point3F& pos, Point3F& vel)
|
|||
|
||||
void afxMagicMissile::updateSound()
|
||||
{
|
||||
if (!mDataBlock->isProjectileSoundValid())
|
||||
if (!mDataBlock->getProjectileSoundAsset().isNull())
|
||||
return;
|
||||
|
||||
if ( mSound )
|
||||
|
|
|
|||
|
|
@ -124,7 +124,6 @@ public:
|
|||
S32 splashId; // Water splash ID
|
||||
|
||||
DECLARE_SOUNDASSET(afxMagicMissileData, ProjectileSound);
|
||||
DECLARE_ASSET_SETGET(afxMagicMissileData, ProjectileSound);
|
||||
|
||||
LightDescription *lightDesc;
|
||||
S32 lightDescId;
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ void WindDeformationHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
{
|
||||
accumTime = new Var( "accumTime", "float" );
|
||||
accumTime->uniform = true;
|
||||
accumTime->constSortPos = cspPass;
|
||||
accumTime->constSortPos = cspScene;
|
||||
}
|
||||
|
||||
// Get the transform to world space.
|
||||
|
|
|
|||
|
|
@ -258,8 +258,7 @@ void GuiButtonBaseCtrl::onMouseDown(const GuiEvent& event)
|
|||
if (mProfile->mCanKeyFocus)
|
||||
setFirstResponder();
|
||||
|
||||
if (mProfile->isSoundButtonDownValid())
|
||||
SFX->playOnce(mProfile->getSoundButtonDownProfile());
|
||||
SFX->playOnce(mProfile->getSoundButtonDownSFXTrack());
|
||||
|
||||
mMouseDownPoint = event.mousePoint;
|
||||
mMouseDragged = false;
|
||||
|
|
@ -299,8 +298,7 @@ void GuiButtonBaseCtrl::onMouseEnter(const GuiEvent& event)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (mProfile->isSoundButtonOverValid())
|
||||
SFX->playOnce(mProfile->getSoundButtonOverProfile());
|
||||
SFX->playOnce(mProfile->getSoundButtonOverSFXTrack());
|
||||
|
||||
mHighlighted = true;
|
||||
messageSiblings(mRadioGroup);
|
||||
|
|
@ -388,8 +386,7 @@ bool GuiButtonBaseCtrl::onKeyDown(const GuiEvent& event)
|
|||
if ((event.keyCode == KEY_RETURN || event.keyCode == KEY_SPACE)
|
||||
&& event.modifier == 0)
|
||||
{
|
||||
if (mProfile->isSoundButtonDownValid())
|
||||
SFX->playOnce(mProfile->getSoundButtonDownProfile());
|
||||
SFX->playOnce(mProfile->getSoundButtonDownSFXTrack());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -282,7 +282,6 @@ GuiMLTextCtrl::GuiMLTextCtrl()
|
|||
{
|
||||
mActive = true;
|
||||
//mInitialText = StringTable->EmptyString();
|
||||
INIT_ASSET(DeniedSound);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
|
@ -344,8 +343,6 @@ bool GuiMLTextCtrl::onAdd()
|
|||
if (!mTextBuffer.length() && mInitialText[0] != 0)
|
||||
setText(mInitialText, dStrlen(mInitialText)+1);
|
||||
|
||||
_setDeniedSound(getDeniedSound());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -964,8 +961,8 @@ void GuiMLTextCtrl::insertChars(const char* inputChars,
|
|||
if (numCharsToInsert <= 0)
|
||||
{
|
||||
// Play the "Denied" sound:
|
||||
if ( numInputChars > 0 && getDeniedSoundProfile())
|
||||
SFX->playOnce(getDeniedSoundProfile());
|
||||
if ( numInputChars > 0)
|
||||
SFX->playOnce(getDeniedSoundSFXTrack());
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -265,7 +265,6 @@ class GuiMLTextCtrl : public GuiControl
|
|||
|
||||
// Too many chars sound:
|
||||
DECLARE_SOUNDASSET(GuiMLTextCtrl, DeniedSound);
|
||||
DECLARE_ASSET_SETGET(GuiMLTextCtrl, DeniedSound);
|
||||
// Typeout over time
|
||||
bool mUseTypeOverTime;
|
||||
U32 mTypeOverTimeStartMS;
|
||||
|
|
|
|||
|
|
@ -205,8 +205,7 @@ void GuiSliderCtrl::onMouseDown(const GuiEvent &event)
|
|||
setFirstResponder();
|
||||
mDepressed = true;
|
||||
|
||||
if (mProfile->isSoundButtonDownValid())
|
||||
SFX->playOnce(mProfile->getSoundButtonDownProfile());
|
||||
SFX->playOnce(mProfile->getSoundButtonDownSFXTrack());
|
||||
|
||||
Point2I curMousePos = globalToLocalCoord( event.mousePoint );
|
||||
F32 value;
|
||||
|
|
@ -262,11 +261,9 @@ void GuiSliderCtrl::onMouseEnter(const GuiEvent &event)
|
|||
}
|
||||
else
|
||||
{
|
||||
if( mActive && mProfile->mSoundButtonOver )
|
||||
if( mActive )
|
||||
{
|
||||
//F32 pan = (F32(event.mousePoint.x)/F32(getRoot()->getWidth())*2.0f-1.0f)*0.8f;
|
||||
if (mProfile->isSoundButtonOverValid())
|
||||
SFX->playOnce(mProfile->getSoundButtonOverProfile());
|
||||
SFX->playOnce(mProfile->getSoundButtonOverSFXTrack());
|
||||
}
|
||||
|
||||
mMouseOver = true;
|
||||
|
|
|
|||
|
|
@ -244,8 +244,6 @@ GuiControlProfile::GuiControlProfile(void) :
|
|||
mTextOffset(0,0),
|
||||
mBitmapArrayRects(0)
|
||||
{
|
||||
INIT_ASSET(SoundButtonDown);
|
||||
INIT_ASSET(SoundButtonOver);
|
||||
mLoadCount = 0;
|
||||
mUseCount = 0;
|
||||
|
||||
|
|
@ -321,21 +319,6 @@ GuiControlProfile::GuiControlProfile(void) :
|
|||
mUseBitmapArray = def->mUseBitmapArray;
|
||||
mTextOffset = def->mTextOffset;
|
||||
|
||||
// default sound
|
||||
_setSoundButtonDown(def->getSoundButtonDown());
|
||||
if (getSoundButtonDown() != StringTable->EmptyString())
|
||||
{
|
||||
if (!getSoundButtonDownProfile())
|
||||
Con::errorf(ConsoleLogEntry::General, "GuiControlProfile: Can't get default button pressed sound asset.");
|
||||
}
|
||||
|
||||
_setSoundButtonOver(def->getSoundButtonOver());
|
||||
if (getSoundButtonOver() != StringTable->EmptyString())
|
||||
{
|
||||
if (!getSoundButtonOverProfile())
|
||||
Con::errorf(ConsoleLogEntry::General, "GuiControlProfile: Can't get default button hover sound asset.");
|
||||
}
|
||||
|
||||
//used by GuiTextCtrl
|
||||
mModal = def->mModal;
|
||||
mAlignment = def->mAlignment;
|
||||
|
|
|
|||
|
|
@ -467,10 +467,8 @@ public:
|
|||
Vector<RectI> mBitmapArrayRects; ///< Used for controls which use an array of bitmaps such as checkboxes
|
||||
|
||||
DECLARE_SOUNDASSET(GuiControlProfile, SoundButtonDown); ///< Sound played when a button is pressed.
|
||||
DECLARE_ASSET_SETGET(GuiControlProfile, SoundButtonDown);
|
||||
|
||||
DECLARE_SOUNDASSET(GuiControlProfile, SoundButtonOver); ///< Sound played when a button is hovered.
|
||||
DECLARE_ASSET_SETGET(GuiControlProfile, SoundButtonOver);
|
||||
|
||||
StringTableEntry mChildrenProfileName; ///< The name of the profile to use for the children controls
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ ConsoleDocClass( GuiAudioCtrl,
|
|||
|
||||
GuiAudioCtrl::GuiAudioCtrl()
|
||||
{
|
||||
INIT_ASSET(Sound);
|
||||
mTickPeriodMS = 100;
|
||||
mLastThink = 0;
|
||||
mCurrTick = 0;
|
||||
|
|
@ -85,7 +84,7 @@ void GuiAudioCtrl::processTick()
|
|||
{
|
||||
mCurrTick = 0;
|
||||
mLastThink = 0;
|
||||
if (isSoundValid())
|
||||
if (getSoundAsset().notNull())
|
||||
{
|
||||
_update();
|
||||
}
|
||||
|
|
@ -154,14 +153,11 @@ void GuiAudioCtrl::_update()
|
|||
|
||||
if (testCondition() && isAwake())
|
||||
{
|
||||
bool useTrackDescriptionOnly = (mUseTrackDescriptionOnly && getSoundProfile());
|
||||
bool useTrackDescriptionOnly = mUseTrackDescriptionOnly;
|
||||
|
||||
if (getSoundProfile())
|
||||
if (mSoundPlaying == NULL)
|
||||
{
|
||||
if (mSoundPlaying == NULL)
|
||||
{
|
||||
mSoundPlaying = SFX->createSource(getSoundProfile(), &(SFX->getListener().getTransform()));
|
||||
}
|
||||
mSoundPlaying = SFX->createSource(getSoundSFXTrack(), &(SFX->getListener().getTransform()));
|
||||
}
|
||||
|
||||
if ( mSoundPlaying && !mSoundPlaying->isPlaying())
|
||||
|
|
|
|||
|
|
@ -84,7 +84,6 @@ protected:
|
|||
|
||||
public:
|
||||
DECLARE_SOUNDASSET(GuiAudioCtrl, Sound);
|
||||
DECLARE_ASSET_SETGET(GuiAudioCtrl, Sound);
|
||||
GuiAudioCtrl();
|
||||
~GuiAudioCtrl();
|
||||
// GuiControl.
|
||||
|
|
|
|||
|
|
@ -228,8 +228,6 @@ Material::Material()
|
|||
|
||||
mFootstepSoundId = -1; mImpactSoundId = -1;
|
||||
mImpactFXIndex = -1;
|
||||
INIT_ASSET(CustomFootstepSound);
|
||||
INIT_ASSET(CustomImpactSound);
|
||||
mFriction = 0.0;
|
||||
|
||||
mDirectSoundOcclusion = 1.f;
|
||||
|
|
|
|||
|
|
@ -356,9 +356,7 @@ public:
|
|||
/// If defined, overrides mFootstepSoundId.
|
||||
/// @see mFootstepSoundId
|
||||
DECLARE_SOUNDASSET(Material, CustomFootstepSound);
|
||||
DECLARE_ASSET_SETGET(Material, CustomFootstepSound);
|
||||
DECLARE_SOUNDASSET(Material, CustomImpactSound);
|
||||
DECLARE_ASSET_SETGET(Material, CustomImpactSound);
|
||||
|
||||
F32 mFriction; ///< Friction coefficient when moving along surface.
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,6 @@ SFXAmbience::SFXAmbience()
|
|||
mEnvironment( NULL )
|
||||
{
|
||||
dMemset( mState, 0, sizeof( mState ) );
|
||||
INIT_ASSET(SoundTrack);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -133,7 +132,6 @@ bool SFXAmbience::onAdd()
|
|||
|
||||
Sim::getSFXAmbienceSet()->addObject( this );
|
||||
|
||||
_setSoundTrack(getSoundTrack());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -153,7 +151,7 @@ bool SFXAmbience::preload( bool server, String& errorStr )
|
|||
if( !sfxResolve( &mEnvironment, errorStr ) )
|
||||
return false;
|
||||
|
||||
if (!isSoundTrackValid())
|
||||
if (!getSoundTrackSFXTrack())
|
||||
{
|
||||
//return false; -TODO: trigger asset download
|
||||
}
|
||||
|
|
@ -173,7 +171,7 @@ void SFXAmbience::packData( BitStream* stream )
|
|||
Parent::packData( stream );
|
||||
|
||||
sfxWrite( stream, mEnvironment );
|
||||
PACKDATA_ASSET(SoundTrack);
|
||||
PACKDATA_ASSET_REFACTOR(SoundTrack);
|
||||
|
||||
stream->write( mRolloffFactor );
|
||||
stream->write( mDopplerFactor );
|
||||
|
|
@ -189,7 +187,7 @@ void SFXAmbience::unpackData( BitStream* stream )
|
|||
Parent::unpackData( stream );
|
||||
|
||||
sfxRead( stream, &mEnvironment );
|
||||
UNPACKDATA_ASSET(SoundTrack);
|
||||
UNPACKDATA_ASSET_REFACTOR(SoundTrack);
|
||||
|
||||
stream->read( &mRolloffFactor );
|
||||
stream->read( &mDopplerFactor );
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@ class SFXAmbience : public SimDataBlock
|
|||
|
||||
/// Sound track to play when inside the ambient space.
|
||||
DECLARE_SOUNDASSET(SFXAmbience, SoundTrack);
|
||||
DECLARE_ASSET_SETGET(SFXAmbience, SoundTrack);
|
||||
|
||||
/// Reverb environment to apply when inside the ambient space.
|
||||
SFXEnvironment* mEnvironment;
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ inline F32 SFXDistanceAttenuation( SFXDistanceModel model, F32 minDistance, F32
|
|||
distance = getMax( distance, minDistance );
|
||||
distance = getMin( distance, maxDistance );
|
||||
|
||||
gain = ( 1 - ( distance - minDistance ) / ( maxDistance - minDistance ) );
|
||||
gain = ( 1 - rolloffFactor * ( distance - minDistance ) / ( maxDistance - minDistance ) );
|
||||
break;
|
||||
|
||||
case SFXDistanceModelLogarithmic:
|
||||
|
|
@ -363,8 +363,8 @@ public:
|
|||
flGain = 0.0f;
|
||||
flGainHF = 0.0f;
|
||||
flGainLF = 0.0000f;
|
||||
flDecayTime = 0.0f;
|
||||
flDecayHFRatio = 0.0f;
|
||||
flDecayTime = 0.1f;
|
||||
flDecayHFRatio = 0.1f;
|
||||
flDecayLFRatio = 0.0f;
|
||||
flReflectionsGain = 0.0f;
|
||||
flReflectionsDelay = 0.0f;
|
||||
|
|
@ -372,15 +372,17 @@ public:
|
|||
flLateReverbGain = 0.0f;
|
||||
flLateReverbDelay = 0.0f;
|
||||
dMemset(flLateReverbPan, 0, sizeof(flLateReverbPan));
|
||||
flEchoTime = 0.0f;
|
||||
flEchoTime = 0.075f;
|
||||
flEchoDepth = 0.0f;
|
||||
flModulationTime = 0.0f;
|
||||
flModulationTime = 0.04f;
|
||||
flModulationDepth = 0.0f;
|
||||
flAirAbsorptionGainHF = 0.0f;
|
||||
flAirAbsorptionGainHF = 0.892f;
|
||||
flHFReference = 0.0f;
|
||||
flLFReference = 0.0f;
|
||||
flRoomRolloffFactor = 0.0f;
|
||||
iDecayHFLimit = 0;
|
||||
|
||||
validate();
|
||||
}
|
||||
|
||||
void validate()
|
||||
|
|
|
|||
|
|
@ -173,7 +173,6 @@ SFXDescription::SFXDescription( const SFXDescription& desc )
|
|||
mStreamPacketSize( desc.mStreamPacketSize ),
|
||||
mUseReverb( desc.mUseReverb ),
|
||||
mStreamReadAhead( desc.mStreamReadAhead ),
|
||||
mReverb( desc.mReverb ),
|
||||
mScatterDistance( desc.mScatterDistance ),
|
||||
mPriority( desc.mPriority )
|
||||
{
|
||||
|
|
@ -206,7 +205,6 @@ SFXDescription::SFXDescription(const SFXDescription& other, bool temp_clone)
|
|||
mStreamPacketSize( other.mStreamPacketSize ),
|
||||
mStreamReadAhead( other.mStreamReadAhead ),
|
||||
mUseReverb( other.mUseReverb ),
|
||||
mReverb( other.mReverb ),
|
||||
mPriority( other.mPriority ),
|
||||
mScatterDistance( other.mScatterDistance )
|
||||
{
|
||||
|
|
@ -390,54 +388,12 @@ void SFXDescription::initPersistFields()
|
|||
|
||||
addGroup( "Reverb" );
|
||||
|
||||
addField("useCustomReverb", TypeBool, Offset(mUseReverb, SFXDescription),
|
||||
addField("allowReverb", TypeBool, Offset(mUseReverb, SFXDescription),
|
||||
"If true, use the reverb properties defined here on sounds.\n"
|
||||
"By default, sounds will be assigned a generic reverb profile. By setting this flag to true, "
|
||||
"a custom reverb setup can be defined using the \"Reverb\" properties that will then be assigned "
|
||||
"to sounds playing with the description.\n\n"
|
||||
"@ref SFX_reverb");
|
||||
addFieldV("reverbDensity", TypeRangedF32, Offset(mReverb.flDensity, SFXDescription), &CommonValidators::PositiveFloat,
|
||||
"Density of reverb environment.");
|
||||
addFieldV("reverbDiffusion", TypeRangedF32, Offset(mReverb.flDiffusion, SFXDescription), &CommonValidators::PositiveFloat,
|
||||
"Environment diffusion.");
|
||||
addFieldV("reverbGain", TypeRangedF32, Offset(mReverb.flGain, SFXDescription), &CommonValidators::PositiveFloat,
|
||||
"Reverb Gain Level.");
|
||||
addFieldV("reverbGainHF", TypeRangedF32, Offset(mReverb.flGainHF, SFXDescription), &CommonValidators::PositiveFloat,
|
||||
"Reverb Gain to high frequencies");
|
||||
addFieldV("reverbGainLF", TypeRangedF32, Offset(mReverb.flGainLF, SFXDescription), &CommonValidators::PositiveFloat,
|
||||
"Reverb Gain to high frequencies");
|
||||
addFieldV("reverbDecayTime", TypeRangedF32, Offset(mReverb.flDecayTime, SFXDescription), &CommonValidators::PositiveFloat,
|
||||
"Decay time for the reverb.");
|
||||
addFieldV("reverbDecayHFRatio", TypeRangedF32, Offset(mReverb.flDecayHFRatio, SFXDescription), &CommonValidators::PositiveFloat,
|
||||
"High frequency decay time ratio.");
|
||||
addFieldV("reverbDecayLFRatio", TypeRangedF32, Offset(mReverb.flDecayLFRatio, SFXDescription), &CommonValidators::PositiveFloat,
|
||||
"High frequency decay time ratio.");
|
||||
addFieldV("reflectionsGain", TypeRangedF32, Offset(mReverb.flReflectionsGain, SFXDescription), &CommonValidators::PositiveFloat,
|
||||
"Reflection Gain.");
|
||||
addFieldV("reflectionDelay", TypeRangedF32, Offset(mReverb.flReflectionsDelay, SFXDescription), &CommonValidators::PositiveFloat,
|
||||
"How long to delay reflections.");
|
||||
addFieldV("lateReverbGain", TypeRangedF32, Offset(mReverb.flLateReverbGain, SFXDescription), &CommonValidators::PositiveFloat,
|
||||
"Late reverb gain amount.");
|
||||
addFieldV("lateReverbDelay", TypeRangedF32, Offset(mReverb.flLateReverbDelay, SFXDescription), &CommonValidators::PositiveFloat,
|
||||
"Late reverb delay time.");
|
||||
addFieldV("reverbEchoTime", TypeRangedF32, Offset(mReverb.flEchoTime, SFXDescription), &CommonValidators::PositiveFloat,
|
||||
"Reverb echo time.");
|
||||
addFieldV("reverbEchoDepth", TypeRangedF32, Offset(mReverb.flEchoDepth, SFXDescription), &CommonValidators::PositiveFloat,
|
||||
"Reverb echo depth.");
|
||||
addFieldV("reverbModTime", TypeRangedF32, Offset(mReverb.flModulationTime, SFXDescription), &CommonValidators::PositiveFloat,
|
||||
"Reverb Modulation time.");
|
||||
addFieldV("reverbModDepth", TypeRangedF32, Offset(mReverb.flModulationDepth, SFXDescription), &CommonValidators::NormalizedFloat,
|
||||
"Reverb Modulation Depth.");
|
||||
addFieldV("airAbsorbtionGainHF", TypeRangedF32, Offset(mReverb.flAirAbsorptionGainHF, SFXDescription), &CommonValidators::PositiveFloat,
|
||||
"High Frequency air absorbtion");
|
||||
addFieldV("reverbHFRef", TypeRangedF32, Offset(mReverb.flHFReference, SFXDescription), &CommonValidators::PositiveFloat,
|
||||
"Reverb High Frequency Reference.");
|
||||
addFieldV("reverbLFRef", TypeRangedF32, Offset(mReverb.flLFReference, SFXDescription), &CommonValidators::PositiveFloat,
|
||||
"Reverb Low Frequency Reference.");
|
||||
addFieldV("roomRolloffFactor", TypeRangedF32, Offset(mReverb.flRoomRolloffFactor, SFXDescription), &CommonValidators::NegDefaultF32,
|
||||
"Rolloff factor for reverb.");
|
||||
addFieldV("decayHFLimit", TypeRangedS32, Offset(mReverb.iDecayHFLimit, SFXDescription), &CommonValidators::PositiveInt,
|
||||
"High Frequency decay limit.");
|
||||
endGroup("Reverb");
|
||||
|
||||
Parent::initPersistFields();
|
||||
|
|
@ -495,11 +451,6 @@ void SFXDescription::validate()
|
|||
mConeInsideAngle = mClamp( mConeInsideAngle, 0, 360 );
|
||||
mConeOutsideAngle = mClamp( mConeOutsideAngle, mConeInsideAngle, 360 );
|
||||
mConeOutsideVolume = mClampF( mConeOutsideVolume, 0, 1 );
|
||||
|
||||
if( !mIs3D )
|
||||
mUseReverb = false;
|
||||
|
||||
mReverb.validate();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -534,30 +485,6 @@ void SFXDescription::packData( BitStream *stream )
|
|||
|
||||
stream->writeFloat( mConeOutsideVolume, 6 );
|
||||
|
||||
if( mUseReverb )
|
||||
{
|
||||
stream->write(mReverb.flDensity);
|
||||
stream->write(mReverb.flDiffusion);
|
||||
stream->write(mReverb.flGain);
|
||||
stream->write(mReverb.flGainHF);
|
||||
stream->write(mReverb.flGainLF);
|
||||
stream->write(mReverb.flDecayTime);
|
||||
stream->write(mReverb.flDecayHFRatio);
|
||||
stream->write(mReverb.flDecayLFRatio);
|
||||
stream->write(mReverb.flReflectionsGain);
|
||||
stream->write(mReverb.flReflectionsDelay);
|
||||
stream->write(mReverb.flLateReverbGain);
|
||||
stream->write(mReverb.flLateReverbDelay);
|
||||
stream->write(mReverb.flEchoTime);
|
||||
stream->write(mReverb.flEchoDepth);
|
||||
stream->write(mReverb.flModulationTime);
|
||||
stream->write(mReverb.flModulationDepth);
|
||||
stream->write(mReverb.flAirAbsorptionGainHF);
|
||||
stream->write(mReverb.flHFReference);
|
||||
stream->write(mReverb.flLFReference);
|
||||
stream->write(mReverb.flRoomRolloffFactor);
|
||||
stream->write(mReverb.iDecayHFLimit);
|
||||
}
|
||||
}
|
||||
|
||||
stream->write( mFadeInTime );
|
||||
|
|
@ -607,30 +534,6 @@ void SFXDescription::unpackData( BitStream *stream )
|
|||
|
||||
mConeOutsideVolume = stream->readFloat( 6 );
|
||||
|
||||
if( mUseReverb )
|
||||
{
|
||||
stream->read(&mReverb.flDensity);
|
||||
stream->read(&mReverb.flDiffusion);
|
||||
stream->read(&mReverb.flGain);
|
||||
stream->read(&mReverb.flGainHF);
|
||||
stream->read(&mReverb.flGainLF);
|
||||
stream->read(&mReverb.flDecayTime);
|
||||
stream->read(&mReverb.flDecayHFRatio);
|
||||
stream->read(&mReverb.flDecayLFRatio);
|
||||
stream->read(&mReverb.flReflectionsGain);
|
||||
stream->read(&mReverb.flReflectionsDelay);
|
||||
stream->read(&mReverb.flLateReverbGain);
|
||||
stream->read(&mReverb.flLateReverbDelay);
|
||||
stream->read(&mReverb.flEchoTime);
|
||||
stream->read(&mReverb.flEchoDepth);
|
||||
stream->read(&mReverb.flModulationTime);
|
||||
stream->read(&mReverb.flModulationDepth);
|
||||
stream->read(&mReverb.flAirAbsorptionGainHF);
|
||||
stream->read(&mReverb.flHFReference);
|
||||
stream->read(&mReverb.flLFReference);
|
||||
stream->read(&mReverb.flRoomRolloffFactor);
|
||||
stream->read(&mReverb.iDecayHFLimit);
|
||||
}
|
||||
}
|
||||
|
||||
stream->read( &mFadeInTime );
|
||||
|
|
|
|||
|
|
@ -171,9 +171,6 @@ class SFXDescription : public SimDataBlock
|
|||
/// Only relevant if "isStreaming" is true.
|
||||
U32 mStreamReadAhead;
|
||||
|
||||
/// Reverb properties for sound playback.
|
||||
SFXSoundReverbProperties mReverb;
|
||||
|
||||
/// Parameters to which sources playing with this description should automatically
|
||||
/// connect when created.
|
||||
StringTableEntry mParameters[ MaxNumParameters ];
|
||||
|
|
@ -202,4 +199,4 @@ class SFXDescription : public SimDataBlock
|
|||
};
|
||||
|
||||
|
||||
#endif // _SFXDESCRIPTION_H_
|
||||
#endif // _SFXDESCRIPTION_H_
|
||||
|
|
|
|||
|
|
@ -261,10 +261,8 @@ bool SFXSound::_allocVoice( SFXDevice* device )
|
|||
_setCone( mConeInsideAngle, mConeOutsideAngle, mConeOutsideVolume );
|
||||
}
|
||||
|
||||
// Set reverb, if enabled.
|
||||
|
||||
if( mDescription->mUseReverb )
|
||||
mVoice->setReverb( mDescription->mReverb );
|
||||
// Set reverb, if the source group allows it.
|
||||
mVoice->setReverb(getSourceGroup()->getDescription()->mUseReverb);
|
||||
|
||||
// Update the duration... it shouldn't have changed, but
|
||||
// its probably better that we're accurate if it did.
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ void SFXSoundscapeManager::update()
|
|||
|
||||
if( !soundscape->_isOverridden() )
|
||||
{
|
||||
SFXTrack* track = ambience->getSoundTrackProfile();
|
||||
SFXTrack* track = ambience->getSoundTrackSFXTrack();
|
||||
if( !soundscape->mSource || soundscape->mSource->getTrack() != track )
|
||||
{
|
||||
if( soundscape->mSource != NULL )
|
||||
|
|
|
|||
|
|
@ -1621,13 +1621,13 @@ DefineEngineFunction( sfxPlayOnce, S32, (StringTableEntry assetId, const char* a
|
|||
|
||||
if (String::isEmpty(arg0) || !tempSoundAsset->is3D())
|
||||
{
|
||||
source = SFX->playOnce(tempSoundAsset->getSfxProfile());
|
||||
source = SFX->playOnce(tempSoundAsset->getSFXTrack());
|
||||
}
|
||||
else
|
||||
{
|
||||
MatrixF transform;
|
||||
transform.set(EulerF(0, 0, 0), Point3F(dAtof(arg0), dAtof(arg1), dAtof(arg2)));
|
||||
source = SFX->playOnce(tempSoundAsset->getSfxProfile(), &transform, NULL, dAtof(arg3));
|
||||
source = SFX->playOnce(tempSoundAsset->getSFXTrack(), &transform, NULL, dAtof(arg3));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ class SFXVoice : public StrongRefBase,
|
|||
|
||||
/// Set the reverb properties for playback of this sound.
|
||||
/// @note Has no effect on devices that do not support reverb.
|
||||
virtual void setReverb( const SFXSoundReverbProperties& reverb ) {}
|
||||
virtual void setReverb( bool useReverb ) {}
|
||||
|
||||
/// Set the priority of this voice. Default 1.0.
|
||||
/// @note Has no effect on devices that do not support voice management.
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ void EyeSpaceDepthOutHLSL::processVert( Vector<ShaderComponent*> &componentLis
|
|||
eyePos->setType("float3");
|
||||
eyePos->setName("eyePosWorld");
|
||||
eyePos->uniform = true;
|
||||
eyePos->constSortPos = cspPass;
|
||||
eyePos->constSortPos = cspScene;
|
||||
}
|
||||
|
||||
meta->addStatement( new GenOp( " @ = float4( @.xyz - @, 1 );\r\n", outWSEyeVec, wsPosition, eyePos ) );
|
||||
|
|
@ -74,7 +74,7 @@ void EyeSpaceDepthOutHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
vEye->setType("float3");
|
||||
vEye->setName("vEye");
|
||||
vEye->uniform = true;
|
||||
vEye->constSortPos = cspPass;
|
||||
vEye->constSortPos = cspScene;
|
||||
|
||||
// Expose the depth to the depth format feature
|
||||
Var *depthOut = new Var;
|
||||
|
|
@ -99,7 +99,7 @@ void EyeSpaceDepthOutHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
farDist->setType("float4");
|
||||
farDist->setName("oneOverFarplane");
|
||||
farDist->uniform = true;
|
||||
farDist->constSortPos = cspPass;
|
||||
farDist->constSortPos = cspScene;
|
||||
}
|
||||
|
||||
meta->addStatement( new GenOp( " @ = length( @.xyz / @.w ) * @.x;\r\n", depthOutDecl, wsEyeVec, wsEyeVec, farDist ) );
|
||||
|
|
|
|||
|
|
@ -593,7 +593,7 @@ Var* ShaderFeatureHLSL::getModelView( Vector<ShaderComponent*> &componentList,
|
|||
viewProj->setType( "float4x4" );
|
||||
viewProj->setName( "viewProj" );
|
||||
viewProj->uniform = true;
|
||||
viewProj->constSortPos = cspPass;
|
||||
viewProj->constSortPos = cspScene;
|
||||
}
|
||||
|
||||
modelview = new Var;
|
||||
|
|
@ -893,7 +893,7 @@ Var* ShaderFeatureHLSL::getSurface(Vector<ShaderComponent*>& componentList, Mult
|
|||
{
|
||||
wsEyePos = new Var("eyePosWorld", "float3");
|
||||
wsEyePos->uniform = true;
|
||||
wsEyePos->constSortPos = cspPass;
|
||||
wsEyePos->constSortPos = cspScene;
|
||||
}
|
||||
|
||||
Var *wsPosition = getInWsPosition(componentList);
|
||||
|
|
@ -1867,7 +1867,7 @@ void ReflectCubeFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
{
|
||||
eyePos = new Var( "eyePosWorld", "float3" );
|
||||
eyePos->uniform = true;
|
||||
eyePos->constSortPos = cspPass;
|
||||
eyePos->constSortPos = cspScene;
|
||||
}
|
||||
|
||||
// eye to vert
|
||||
|
|
@ -2152,7 +2152,7 @@ void RTLightingFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
{
|
||||
eyePos = new Var( "eyePosWorld", "float3" );
|
||||
eyePos->uniform = true;
|
||||
eyePos->constSortPos = cspPass;
|
||||
eyePos->constSortPos = cspScene;
|
||||
}
|
||||
|
||||
//Temporarily disabled while we figure out how to better handle normals without a normal map
|
||||
|
|
@ -2237,43 +2237,43 @@ void RTLightingFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
Var *inLightPos = new Var( "inLightPos", "float4" );
|
||||
inLightPos->uniform = true;
|
||||
inLightPos->arraySize = 4;
|
||||
inLightPos->constSortPos = cspPotentialPrimitive;
|
||||
inLightPos->constSortPos = cspLightBuffer;
|
||||
|
||||
Var * inLightConfigData = new Var( "inLightConfigData", "float4" );
|
||||
inLightConfigData->uniform = true;
|
||||
inLightConfigData->arraySize = 4;
|
||||
inLightConfigData->constSortPos = cspPotentialPrimitive;
|
||||
inLightConfigData->constSortPos = cspLightBuffer;
|
||||
|
||||
Var *inLightColor = new Var( "inLightColor", "float4" );
|
||||
inLightColor->uniform = true;
|
||||
inLightColor->arraySize = 4;
|
||||
inLightColor->constSortPos = cspPotentialPrimitive;
|
||||
inLightColor->constSortPos = cspLightBuffer;
|
||||
|
||||
Var *inLightSpotDir = new Var( "inLightSpotDir", "float4" );
|
||||
inLightSpotDir->uniform = true;
|
||||
inLightSpotDir->arraySize = 4;
|
||||
inLightSpotDir->constSortPos = cspPotentialPrimitive;
|
||||
inLightSpotDir->constSortPos = cspLightBuffer;
|
||||
|
||||
Var * lightSpotParams = new Var( "inlightSpotParams", "float2" );
|
||||
lightSpotParams->uniform = true;
|
||||
lightSpotParams->arraySize = 4;
|
||||
lightSpotParams->constSortPos = cspPotentialPrimitive;
|
||||
lightSpotParams->constSortPos = cspLightBuffer;
|
||||
|
||||
Var* hasVectorLight = new Var("hasVectorLight", "int");
|
||||
hasVectorLight->uniform = true;
|
||||
hasVectorLight->constSortPos = cspPotentialPrimitive;
|
||||
hasVectorLight->constSortPos = cspLightBuffer;
|
||||
|
||||
Var* vectorLightDirection = new Var("vectorLightDirection", "float4");
|
||||
vectorLightDirection->uniform = true;
|
||||
vectorLightDirection->constSortPos = cspPotentialPrimitive;
|
||||
vectorLightDirection->constSortPos = cspLightBuffer;
|
||||
|
||||
Var* vectorLightColor = new Var("vectorLightColor", "float4");
|
||||
vectorLightColor->uniform = true;
|
||||
vectorLightColor->constSortPos = cspPotentialPrimitive;
|
||||
vectorLightColor->constSortPos = cspLightBuffer;
|
||||
|
||||
Var* vectorLightBrightness = new Var("vectorLightBrightness", "float");
|
||||
vectorLightBrightness->uniform = true;
|
||||
vectorLightBrightness->constSortPos = cspPotentialPrimitive;
|
||||
vectorLightBrightness->constSortPos = cspLightBuffer;
|
||||
|
||||
Var* surface = getSurface(componentList, meta, fd);
|
||||
if (!surface)
|
||||
|
|
@ -2289,7 +2289,7 @@ void RTLightingFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
{
|
||||
ambient = new Var("ambient", "float4");
|
||||
ambient->uniform = true;
|
||||
ambient->constSortPos = cspPass;
|
||||
ambient->constSortPos = cspScene;
|
||||
}
|
||||
|
||||
Var* lighting = new Var("lighting", "float4");
|
||||
|
|
@ -2349,12 +2349,12 @@ void FogFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
{
|
||||
eyePos = new Var( "eyePosWorld", "float3" );
|
||||
eyePos->uniform = true;
|
||||
eyePos->constSortPos = cspPass;
|
||||
eyePos->constSortPos = cspScene;
|
||||
}
|
||||
|
||||
Var *fogData = new Var( "fogData", "float3" );
|
||||
fogData->uniform = true;
|
||||
fogData->constSortPos = cspPass;
|
||||
fogData->constSortPos = cspScene;
|
||||
|
||||
Var *wsPosition = new Var( "fogPos", "float3" );
|
||||
getWsPosition( componentList,
|
||||
|
|
@ -2393,7 +2393,7 @@ void FogFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
fogColor->setType( "float4" );
|
||||
fogColor->setName( "fogColor" );
|
||||
fogColor->uniform = true;
|
||||
fogColor->constSortPos = cspPass;
|
||||
fogColor->constSortPos = cspScene;
|
||||
|
||||
// Get the out color.
|
||||
Var *color = (Var*) LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
|
||||
|
|
@ -2429,12 +2429,12 @@ void FogFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
{
|
||||
eyePos = new Var( "eyePosWorld", "float3" );
|
||||
eyePos->uniform = true;
|
||||
eyePos->constSortPos = cspPass;
|
||||
eyePos->constSortPos = cspScene;
|
||||
}
|
||||
|
||||
Var *fogData = new Var( "fogData", "float3" );
|
||||
fogData->uniform = true;
|
||||
fogData->constSortPos = cspPass;
|
||||
fogData->constSortPos = cspScene;
|
||||
|
||||
/// Get the fog amount.
|
||||
fogAmount = new Var( "fogAmount", "float" );
|
||||
|
|
@ -2695,7 +2695,7 @@ void FoliageFeatureHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
{
|
||||
eyePos = new Var( "eyePosWorld", "float3" );
|
||||
eyePos->uniform = true;
|
||||
eyePos->constSortPos = cspPass;
|
||||
eyePos->constSortPos = cspScene;
|
||||
}
|
||||
|
||||
// All actual work is offloaded to this method.
|
||||
|
|
@ -2832,7 +2832,7 @@ void ImposterVertFeatureHLSL::processVert( Vector<ShaderComponent*> &component
|
|||
{
|
||||
eyePos = new Var( "eyePosWorld", "float3" );
|
||||
eyePos->uniform = true;
|
||||
eyePos->constSortPos = cspPass;
|
||||
eyePos->constSortPos = cspScene;
|
||||
}
|
||||
|
||||
// Declare the outputs from this feature.
|
||||
|
|
@ -3153,7 +3153,7 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
|
|||
eyePos->setType("float3");
|
||||
eyePos->setName("eyePosWorld");
|
||||
eyePos->uniform = true;
|
||||
eyePos->constSortPos = cspPass;
|
||||
eyePos->constSortPos = cspScene;
|
||||
}
|
||||
|
||||
Var* accumTime = (Var*)LangElement::find("accumTime");
|
||||
|
|
@ -3161,7 +3161,7 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
|
|||
{
|
||||
accumTime = new Var("accumTime", "float");
|
||||
accumTime->uniform = true;
|
||||
accumTime->constSortPos = cspPass;
|
||||
accumTime->constSortPos = cspScene;
|
||||
}
|
||||
|
||||
Var* dampness = (Var*)LangElement::find("dampness");
|
||||
|
|
@ -3169,7 +3169,7 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
|
|||
{
|
||||
dampness = new Var("dampness", "float");
|
||||
dampness->uniform = true;
|
||||
dampness->constSortPos = cspPass;
|
||||
dampness->constSortPos = cspScene;
|
||||
}
|
||||
|
||||
String computeForwardProbes = String(" @ = computeForwardProbes(@,@,@,@,@,@,@,@,@,\r\n\t\t");
|
||||
|
|
@ -3185,7 +3185,7 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
|
|||
{
|
||||
ambient = new Var("ambient","float4");
|
||||
ambient->uniform = true;
|
||||
ambient->constSortPos = cspPass;
|
||||
ambient->constSortPos = cspScene;
|
||||
}
|
||||
meta->addStatement(new GenOp(" @.rgb *= @.rgb;\r\n", ibl, ambient));
|
||||
meta->addStatement(new GenOp(" @ = @;\r\n", curColor, ibl));
|
||||
|
|
|
|||
|
|
@ -73,10 +73,14 @@ enum ConstantSortPosition
|
|||
cspUninit = 0,
|
||||
/// Updated before every draw primitive call.
|
||||
cspPrimitive,
|
||||
/// Potentially updated every draw primitive call, but not necessarily (lights for example)
|
||||
/// Potentially updated every draw primitive call
|
||||
cspPotentialPrimitive,
|
||||
/// Updated one per pass
|
||||
/// Unique buffer just for lights.
|
||||
cspLightBuffer,
|
||||
/// Updated per pass
|
||||
cspPass,
|
||||
/// per scene const buffers (should only be set once)
|
||||
cspScene,
|
||||
/// Count var, do not use
|
||||
csp_Count
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
<SoundAsset
|
||||
AssetName="buttonClick"
|
||||
sourceGroup="AudioChannelDefault"
|
||||
MaxDistance="100">
|
||||
sourceGroup="AudioChannelGui"
|
||||
originalFilePath="core/gui/sounds/buttonClick.wav">
|
||||
<SoundAsset.slots>
|
||||
<slots_beginarray
|
||||
SoundFile="@assetFile=buttonClick.wav"
|
||||
MaxDistance="100"/>
|
||||
SoundFile="@assetFile=@buttonClick.wav"/>
|
||||
</SoundAsset.slots>
|
||||
</SoundAsset>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
<SoundAsset
|
||||
AssetName="buttonHover"
|
||||
sourceGroup="AudioChannelDefault"
|
||||
MaxDistance="100">
|
||||
sourceGroup="AudioChannelGui"
|
||||
originalFilePath="core/gui/sounds/buttonHover.wav">
|
||||
<SoundAsset.slots>
|
||||
<slots_beginarray
|
||||
SoundFile="@assetFile=buttonHover.wav"
|
||||
MaxDistance="100"/>
|
||||
SoundFile="@assetFile=@buttonHover.wav"/>
|
||||
</SoundAsset.slots>
|
||||
</SoundAsset>
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ function Core_SFX::onCreate(%this)
|
|||
{
|
||||
exec("./scripts/audio." @ $TorqueScriptFileExtension);
|
||||
exec("./scripts/audioData." @ $TorqueScriptFileExtension);
|
||||
exec("./scripts/audioStates." @ $TorqueScriptFileExtension);
|
||||
exec("./scripts/audioEnvironments." @ $TorqueScriptFileExtension);
|
||||
exec("./scripts/audioAmbience." @ $TorqueScriptFileExtension);
|
||||
exec("./scripts/audioDescriptions." @ $TorqueScriptFileExtension);
|
||||
exec("./scripts/audioEnvironments." @ $TorqueScriptFileExtension);
|
||||
exec("./scripts/audioStates." @ $TorqueScriptFileExtension);
|
||||
exec("./scripts/audioOptions." @ $TorqueScriptFileExtension);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,13 @@ singleton SFXDescription( AudioChannel )
|
|||
sourceGroup = AudioChannelMaster;
|
||||
};
|
||||
|
||||
singleton SFXDescription( AudioEffectChannel )
|
||||
{
|
||||
sourceGroup = AudioChannelMaster;
|
||||
allowReverb = true;
|
||||
};
|
||||
|
||||
|
||||
singleton SFXSource( AudioChannelDefault )
|
||||
{
|
||||
description = AudioChannel;
|
||||
|
|
@ -45,7 +52,7 @@ singleton SFXSource( AudioChannelGui )
|
|||
};
|
||||
singleton SFXSource( AudioChannelEffects )
|
||||
{
|
||||
description = AudioChannel;
|
||||
description = AudioEffectChannel;
|
||||
};
|
||||
singleton SFXSource( AudioChannelMessages )
|
||||
{
|
||||
|
|
@ -66,7 +73,7 @@ AudioChannelMusic.play();
|
|||
AudioChannelMessages.play();
|
||||
|
||||
// Stop in-game effects channels.
|
||||
AudioChannelEffects.stop();
|
||||
AudioChannelEffects.play();
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Master SFXDescriptions.
|
||||
|
|
|
|||
|
|
@ -22,23 +22,28 @@
|
|||
|
||||
singleton SFXAmbience( AudioAmbienceDefault )
|
||||
{
|
||||
environment = AudioEnvOff;
|
||||
environment = "AudioEnvGeneric";
|
||||
dopplerFactor = "1";
|
||||
};
|
||||
|
||||
singleton SFXAmbience( AudioAmbienceOutside )
|
||||
{
|
||||
environment = AudioEnvPlain;
|
||||
environment = "AudioEnvPlain";
|
||||
states[ 0 ] = AudioLocationOutside;
|
||||
dopplerFactor = "1";
|
||||
};
|
||||
|
||||
singleton SFXAmbience( AudioAmbienceInside )
|
||||
{
|
||||
environment = AudioEnvRoom;
|
||||
environment = "AudioEnvRoom";
|
||||
states[ 0 ] = AudioLocationInside;
|
||||
dopplerFactor = "1";
|
||||
};
|
||||
|
||||
singleton SFXAmbience( AudioAmbienceUnderwater )
|
||||
{
|
||||
environment = AudioEnvUnderwater;
|
||||
states[ 0 ] = AudioLocationUnderwater;
|
||||
environment = "AudioEnvUnderwater";
|
||||
states[0] = AudioLocationUnderwater;
|
||||
dopplerFactor = "0.5";
|
||||
speedOfSound = "1500.0";
|
||||
};
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -170,8 +170,8 @@ singleton GuiControlProfile( GuiMenuButtonProfile )
|
|||
justify = "center";
|
||||
canKeyFocus = false;
|
||||
hasBitmapArray = false;
|
||||
soundButtonDown = "UI:buttonClick";
|
||||
soundButtonOver = "UI:buttonHover";
|
||||
soundButtonDownAsset = "UI:buttonClick";
|
||||
soundButtonOverAsset = "UI:buttonHover";
|
||||
category = "BaseUI";
|
||||
fontColors[0] = "200 200 200 255";
|
||||
fontColors[2] = "108 108 108 255";
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
<SoundAsset
|
||||
AssetName="buttonClick"
|
||||
soundFile="@assetFile=buttonClick.wav"
|
||||
PitchAdjust="1"
|
||||
VolumeAdjust="1"
|
||||
is3D="false"
|
||||
minDistance="1"
|
||||
maxDistance="100"
|
||||
sourceGroup="AudioChannelGui"
|
||||
/>
|
||||
<SoundAsset
|
||||
AssetName="buttonClick"
|
||||
originalFilePath="data/UI/sounds/buttonClick.wav">
|
||||
<SoundAsset.slots>
|
||||
<slots_beginarray
|
||||
SoundFile="@assetFile=@buttonClick.wav"/>
|
||||
</SoundAsset.slots>
|
||||
</SoundAsset>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
<SoundAsset
|
||||
AssetName="buttonHover"
|
||||
soundFile="@assetFile=buttonHover.wav"
|
||||
PitchAdjust="1"
|
||||
VolumeAdjust="1"
|
||||
is3D="false"
|
||||
minDistance="1"
|
||||
maxDistance="100"
|
||||
sourceGroup="AudioChannelGui"
|
||||
/>
|
||||
<SoundAsset
|
||||
AssetName="buttonHover"
|
||||
sourceGroup="AudioChannelGui"
|
||||
originalFilePath="data/UI/sounds/buttonHover.wav">
|
||||
<SoundAsset.slots>
|
||||
<slots_beginarray
|
||||
SoundFile="@assetFile=@buttonHover.wav"/>
|
||||
</SoundAsset.slots>
|
||||
</SoundAsset>
|
||||
|
|
|
|||
|
|
@ -13,6 +13,54 @@ function SoundAsset::onChanged(%this)
|
|||
sfxStop($PreviewSoundSource);
|
||||
}
|
||||
|
||||
function SoundAsset::onShowActionMenu(%this)
|
||||
{
|
||||
GenericAsset::onShowActionMenu(%this);
|
||||
|
||||
%assetId = %this.getAssetId();
|
||||
|
||||
EditAssetPopup.objectData = %assetId;
|
||||
EditAssetPopup.objectType = AssetDatabase.getAssetType(%assetId);
|
||||
|
||||
EditAssetPopup.reloadItems();
|
||||
|
||||
EditAssetPopup.showPopup(Canvas);
|
||||
}
|
||||
|
||||
|
||||
function SoundAsset::onEditProperties(%this)
|
||||
{
|
||||
Canvas.pushDialog(AssetBrowser_editAsset);
|
||||
|
||||
AssetBrowser_editAssetWindow.text = "Asset Properties - " @ %this.getAssetId();
|
||||
|
||||
AssetEditInspector.tempAsset = %this.deepClone();
|
||||
|
||||
AssetEditInspector.inspect(%this);
|
||||
AssetBrowser_editAsset.editedObjectData = %this.getAssetId();
|
||||
AssetBrowser_editAsset.editedObject = %this;
|
||||
AssetBrowser_editAsset.editedObjectType = AssetDatabase.getAssetType(%this.getAssetId());
|
||||
|
||||
//remove some of the groups we don't need:
|
||||
for(%i=0; %i < AssetEditInspector.getCount(); %i++)
|
||||
{
|
||||
%caption = AssetEditInspector.getObject(%i).caption;
|
||||
|
||||
if(%caption $= "Ungrouped" || %caption $= "Object" || %caption $= "Editing"
|
||||
|| %caption $= "Persistence" || %caption $= "Dynamic Fields")
|
||||
{
|
||||
AssetEditInspector.remove(AssetEditInspector.getObject(%i));
|
||||
%i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Called when the AssetType has it's properties saved from the onEditProperties process
|
||||
function SoundAsset::onSaveProperties(%this)
|
||||
{
|
||||
%this.refreshAsset();
|
||||
}
|
||||
|
||||
function SoundAsset::buildBrowserElement(%this, %previewData)
|
||||
{
|
||||
%previewData.assetName = %this.assetName;
|
||||
|
|
|
|||
Loading…
Reference in a new issue