mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-20 04:34:48 +00:00
Merge pull request #793 from Azaezel/alpha40/explosionSoundfix
fix on-RPC-command explosion sounds not playing the first time
This commit is contained in:
commit
7a2b93dab4
|
|
@ -40,6 +40,9 @@
|
|||
#endif
|
||||
|
||||
#include "gui/editor/guiInspectorTypes.h"
|
||||
#ifndef _ASSET_PTR_H_
|
||||
#include "assets/assetPtr.h"
|
||||
#endif
|
||||
|
||||
#ifndef _BITSTREAM_H_
|
||||
#include "core/stream/bitStream.h"
|
||||
|
|
@ -57,6 +60,10 @@
|
|||
#include "sfx/sfxProfile.h"
|
||||
#endif // !_SFXPROFILE_H_
|
||||
|
||||
#ifndef _RESOURCEMANAGER_H_
|
||||
#include "core/resourceManager.h"
|
||||
#endif
|
||||
|
||||
#include "assetMacroHelpers.h"
|
||||
class SFXResource;
|
||||
|
||||
|
|
@ -178,6 +185,7 @@ public:
|
|||
StringTableEntry m##name##AssetId;\
|
||||
AssetPtr<SoundAsset> m##name##Asset = NULL;\
|
||||
SFXProfile* m##name##Profile = NULL;\
|
||||
SFXDescription* m##name##Desc = NULL;\
|
||||
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());}\
|
||||
|
|
@ -271,7 +279,15 @@ public: \
|
|||
SFXProfile* get##name##Profile()\
|
||||
{\
|
||||
if (get##name() != StringTable->EmptyString() && m##name##Asset.notNull())\
|
||||
return m##name##Asset->getSfxProfile();\
|
||||
m##name##Profile = m##name##Asset->getSfxProfile();\
|
||||
return m##name##Profile;\
|
||||
return NULL;\
|
||||
}\
|
||||
SFXDescription* get##name##Description()\
|
||||
{\
|
||||
if (get##name() != StringTable->EmptyString() && m##name##Asset.notNull())\
|
||||
m##name##Desc = m##name##Asset->getSfxDescription();\
|
||||
return m##name##Desc;\
|
||||
return NULL;\
|
||||
}\
|
||||
bool is##name##Valid() { return (get##name() != StringTable->EmptyString() && m##name##Asset->getStatus() == AssetBase::Ok); }
|
||||
|
|
@ -290,6 +306,31 @@ public: \
|
|||
|
||||
#endif // TORQUE_SHOW_LEGACY_FILE_FIELDS
|
||||
|
||||
//network send - datablock
|
||||
#define PACKDATA_SOUNDASSET(name)\
|
||||
if (stream->writeFlag(m##name##Asset.notNull()))\
|
||||
{\
|
||||
if (m##name##Profile)\
|
||||
m##name##Profile->packData(stream);\
|
||||
sfxWrite(stream, m##name##Desc);\
|
||||
}\
|
||||
else\
|
||||
stream->writeString(m##name##Name);
|
||||
|
||||
//network recieve - datablock
|
||||
#define UNPACKDATA_SOUNDASSET(name)\
|
||||
if (stream->readFlag())\
|
||||
{\
|
||||
if (m##name##Profile)\
|
||||
m##name##Profile->unpackData(stream);\
|
||||
sfxRead(stream, &m##name##Desc);\
|
||||
}\
|
||||
else\
|
||||
{\
|
||||
m##name##Name = stream->readSTString();\
|
||||
_set##name(m##name##Name);\
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Arrayed Asset Macros
|
||||
|
|
|
|||
|
|
@ -652,7 +652,7 @@ void ExplosionData::packData(BitStream* stream)
|
|||
|
||||
PACKDATA_ASSET(ExplosionShape);
|
||||
|
||||
PACKDATA_ASSET(Sound);
|
||||
PACKDATA_SOUNDASSET(Sound);
|
||||
|
||||
if (stream->writeFlag(particleEmitter))
|
||||
stream->writeRangedU32(particleEmitter->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast);
|
||||
|
|
@ -756,7 +756,7 @@ void ExplosionData::unpackData(BitStream* stream)
|
|||
|
||||
UNPACKDATA_ASSET(ExplosionShape);
|
||||
|
||||
UNPACKDATA_ASSET(Sound);
|
||||
UNPACKDATA_SOUNDASSET(Sound);
|
||||
|
||||
if (stream->readFlag())
|
||||
particleEmitterId = stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast);
|
||||
|
|
|
|||
Loading…
Reference in a new issue