mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 15:14:35 +00:00
moar refactors
This commit is contained in:
parent
4d893f51cf
commit
22037bf94f
10 changed files with 65 additions and 60 deletions
|
|
@ -86,6 +86,26 @@ if (m##name##AssetId != StringTable->EmptyString())\
|
|||
_set##name(netconn->unpackNetStringHandleU(stream).getString());\
|
||||
}
|
||||
|
||||
//network send - datablock
|
||||
#define PACKDATA_ASSET_ARRAY_REFACTOR(name, max)\
|
||||
for (i = 0; i < max; i++)\
|
||||
{\
|
||||
if (stream->writeFlag(m##name##Asset[i].notNull()))\
|
||||
{\
|
||||
stream->writeString(m##name##Asset[i].getAssetId()); \
|
||||
}\
|
||||
}
|
||||
|
||||
//network recieve - datablock
|
||||
#define UNPACKDATA_ASSET_ARRAY_REFACTOR(name, max)\
|
||||
for (i = 0; i < max; i++)\
|
||||
{\
|
||||
if (stream->readFlag())\
|
||||
{\
|
||||
m##name##Asset[i] = stream->readSTString();\
|
||||
}\
|
||||
}
|
||||
|
||||
#define DEF_ASSET_BINDS_REFACTOR(className,name)\
|
||||
DefineEngineMethod(className, get##name, StringTableEntry, (), , "get name")\
|
||||
{\
|
||||
|
|
|
|||
|
|
@ -96,11 +96,6 @@ SplashData::SplashData()
|
|||
explosionId = 0;
|
||||
|
||||
U32 i;
|
||||
for (i = 0; i < NUM_TEX; i++)
|
||||
{
|
||||
INIT_IMAGEASSET_ARRAY(Texture, GFXStaticTextureSRGBProfile, i);
|
||||
}
|
||||
|
||||
for( i=0; i<NUM_TIME_KEYS; i++ )
|
||||
times[i] = 1.0;
|
||||
|
||||
|
|
@ -133,7 +128,7 @@ void SplashData::initPersistFields()
|
|||
addField("times", TypeF32, Offset(times, SplashData), NUM_TIME_KEYS, "Times to transition through the splash effect. Up to 4 allowed. Values are 0.0 - 1.0, and corrispond to the life of the particle where 0 is first created and 1 is end of lifespace.\n" );
|
||||
addField("colors", TypeColorF, Offset(colors, SplashData), NUM_TIME_KEYS, "Color values to set the splash effect, rgba. Up to 4 allowed. Will transition through colors based on values set in the times value. Example: colors[0] = \"0.6 1.0 1.0 0.5\".\n" );
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET_ARRAY(Texture, NUM_TEX, SplashData, "Image to use as the texture for the splash effect.\n");
|
||||
INITPERSISTFIELD_IMAGEASSET_ARRAY_REFACTOR(Texture, NUM_TEX, SplashData, "Image to use as the texture for the splash effect.\n");
|
||||
|
||||
addField("texWrap", TypeF32, Offset(texWrap, SplashData), "Amount to wrap the texture around the splash ring, 0.0f - 1.0f.\n");
|
||||
addField("texFactor", TypeF32, Offset(texFactor, SplashData), "Factor in which to apply the texture to the splash ring, 0.0f - 1.0f.\n");
|
||||
|
|
@ -207,10 +202,7 @@ void SplashData::packData(BitStream* stream)
|
|||
stream->write( times[i] );
|
||||
}
|
||||
|
||||
for( i=0; i<NUM_TEX; i++ )
|
||||
{
|
||||
PACKDATA_ASSET_ARRAY(Texture, i);
|
||||
}
|
||||
PACKDATA_ASSET_ARRAY_REFACTOR(Texture, NUM_TEX);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
|
@ -263,10 +255,7 @@ void SplashData::unpackData(BitStream* stream)
|
|||
stream->read( ×[i] );
|
||||
}
|
||||
|
||||
for( i=0; i<NUM_TEX; i++ )
|
||||
{
|
||||
UNPACKDATA_ASSET_ARRAY(Texture, i);
|
||||
}
|
||||
UNPACKDATA_ASSET_ARRAY_REFACTOR(Texture, NUM_TEX);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
|
@ -299,9 +288,9 @@ bool SplashData::preload(bool server, String &errorStr)
|
|||
|
||||
for( i=0; i<NUM_TEX; i++ )
|
||||
{
|
||||
if (mTexture[i].isNull())
|
||||
if (mTextureAsset[i].isNull())
|
||||
{
|
||||
_setTexture(getTexture(i), i);
|
||||
_setTexture(_getTexture(i), i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,9 +122,7 @@ public:
|
|||
F32 times[ NUM_TIME_KEYS ];
|
||||
LinearColorF colors[ NUM_TIME_KEYS ];
|
||||
|
||||
DECLARE_IMAGEASSET_ARRAY(SplashData, Texture, NUM_TEX, onTextureChanged);
|
||||
DECLARE_IMAGEASSET_ARRAY_SETGET(SplashData, Texture)
|
||||
void onTextureChanged() {}
|
||||
DECLARE_IMAGEASSET_ARRAY_REFACTOR(SplashData, Texture, GFXStaticTextureSRGBProfile, NUM_TEX)
|
||||
|
||||
ExplosionData* explosion;
|
||||
S32 explosionId;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue