mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
Merge branch 'development' of https://github.com/TorqueGameEngines/Torque3D into aiSubsystem
This commit is contained in:
commit
20976b485c
28 changed files with 176 additions and 84 deletions
|
|
@ -370,7 +370,7 @@ public: \
|
||||||
|
|
||||||
#pragma region Arrayed Asset Macros
|
#pragma region Arrayed Asset Macros
|
||||||
|
|
||||||
#define DECLARE_SHAPEASSET_ARRAY(className,name,max) public: \
|
#define DECLARE_SHAPEASSET_ARRAY(className,name,max,changeFunc) public: \
|
||||||
static const U32 sm##name##Count = max;\
|
static const U32 sm##name##Count = max;\
|
||||||
Resource<TSShape>m##name[max];\
|
Resource<TSShape>m##name[max];\
|
||||||
StringTableEntry m##name##Name[max]; \
|
StringTableEntry m##name##Name[max]; \
|
||||||
|
|
@ -384,6 +384,10 @@ public: \
|
||||||
\
|
\
|
||||||
bool _set##name(StringTableEntry _in, const U32& index)\
|
bool _set##name(StringTableEntry _in, const U32& index)\
|
||||||
{\
|
{\
|
||||||
|
if (m##name##Asset[index].notNull())\
|
||||||
|
{\
|
||||||
|
m##name##Asset[index]->getChangedSignal().remove(this, &className::changeFunc);\
|
||||||
|
}\
|
||||||
if(m##name##AssetId[index] != _in || m##name##Name[index] != _in)\
|
if(m##name##AssetId[index] != _in || m##name##Name[index] != _in)\
|
||||||
{\
|
{\
|
||||||
if(index >= sm##name##Count || index < 0)\
|
if(index >= sm##name##Count || index < 0)\
|
||||||
|
|
@ -430,6 +434,8 @@ public: \
|
||||||
if (get##name(index) != StringTable->EmptyString() && m##name##Asset[index].notNull())\
|
if (get##name(index) != StringTable->EmptyString() && m##name##Asset[index].notNull())\
|
||||||
{\
|
{\
|
||||||
m##name[index] = m##name##Asset[index]->getShapeResource();\
|
m##name[index] = m##name##Asset[index]->getShapeResource();\
|
||||||
|
\
|
||||||
|
m##name##Asset[index]->getChangedSignal().notify(this, &className::changeFunc);\
|
||||||
}\
|
}\
|
||||||
else\
|
else\
|
||||||
{\
|
{\
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,10 @@ public:
|
||||||
void onPerformSubstitutions() override;
|
void onPerformSubstitutions() override;
|
||||||
bool allowSubstitutions() const override { return true; }
|
bool allowSubstitutions() const override { return true; }
|
||||||
|
|
||||||
void onShapeChanged() {}
|
void onShapeChanged()
|
||||||
|
{
|
||||||
|
reloadOnLocalClient();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,10 @@ public:
|
||||||
ExplosionData* cloneAndPerformSubstitutions(const SimObject*, S32 index=0);
|
ExplosionData* cloneAndPerformSubstitutions(const SimObject*, S32 index=0);
|
||||||
bool allowSubstitutions() const override { return true; }
|
bool allowSubstitutions() const override { return true; }
|
||||||
|
|
||||||
void onShapeChanged() {}
|
void onShapeChanged()
|
||||||
|
{
|
||||||
|
reloadOnLocalClient();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -852,8 +852,11 @@ void GroundCover::unpackUpdate( NetConnection *connection, BitStream *stream )
|
||||||
// It's sloppy, but it works for now.
|
// It's sloppy, but it works for now.
|
||||||
_freeCells();
|
_freeCells();
|
||||||
|
|
||||||
if ( isProperlyAdded() )
|
if (isProperlyAdded())
|
||||||
|
{
|
||||||
_initMaterial();
|
_initMaterial();
|
||||||
|
_initShapes();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -341,7 +341,7 @@ protected:
|
||||||
RectF mBillboardRects[MAX_COVERTYPES];
|
RectF mBillboardRects[MAX_COVERTYPES];
|
||||||
|
|
||||||
/// The cover shape filenames.
|
/// The cover shape filenames.
|
||||||
DECLARE_SHAPEASSET_ARRAY(GroundCover, Shape, MAX_COVERTYPES);
|
DECLARE_SHAPEASSET_ARRAY(GroundCover, Shape, MAX_COVERTYPES, onShapeChanged);
|
||||||
DECLARE_ASSET_ARRAY_NET_SETGET(GroundCover, Shape, -1);
|
DECLARE_ASSET_ARRAY_NET_SETGET(GroundCover, Shape, -1);
|
||||||
|
|
||||||
/// The cover shape instances.
|
/// The cover shape instances.
|
||||||
|
|
@ -409,6 +409,12 @@ protected:
|
||||||
S32 randSeed );
|
S32 randSeed );
|
||||||
|
|
||||||
void _debugRender( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat );
|
void _debugRender( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat );
|
||||||
|
|
||||||
|
void onShapeChanged()
|
||||||
|
{
|
||||||
|
_initShapes();
|
||||||
|
setMaskBits(U32(-1));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _GROUNDCOVER_H_
|
#endif // _GROUNDCOVER_H_
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,10 @@ class ParticleData : public SimDataBlock
|
||||||
static bool protectedSetSizes(void* object, const char* index, const char* data);
|
static bool protectedSetSizes(void* object, const char* index, const char* data);
|
||||||
static bool protectedSetTimes(void* object, const char* index, const char* data);
|
static bool protectedSetTimes(void* object, const char* index, const char* data);
|
||||||
|
|
||||||
void onImageChanged() {}
|
void onImageChanged()
|
||||||
|
{
|
||||||
|
reloadOnLocalClient();
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ParticleData();
|
ParticleData();
|
||||||
|
|
|
||||||
|
|
@ -69,8 +69,14 @@ class PrecipitationData : public GameBaseData
|
||||||
void packData(BitStream* stream) override;
|
void packData(BitStream* stream) override;
|
||||||
void unpackData(BitStream* stream) override;
|
void unpackData(BitStream* stream) override;
|
||||||
|
|
||||||
void onDropChanged() {}
|
void onDropChanged()
|
||||||
void onSplashChanged() {}
|
{
|
||||||
|
reloadOnLocalClient();
|
||||||
|
}
|
||||||
|
void onSplashChanged()
|
||||||
|
{
|
||||||
|
reloadOnLocalClient();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Raindrop
|
struct Raindrop
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,10 @@ public:
|
||||||
|
|
||||||
DECLARE_IMAGEASSET_ARRAY(SplashData, Texture, NUM_TEX, onTextureChanged);
|
DECLARE_IMAGEASSET_ARRAY(SplashData, Texture, NUM_TEX, onTextureChanged);
|
||||||
DECLARE_IMAGEASSET_ARRAY_SETGET(SplashData, Texture)
|
DECLARE_IMAGEASSET_ARRAY_SETGET(SplashData, Texture)
|
||||||
void onTextureChanged() {}
|
void onTextureChanged()
|
||||||
|
{
|
||||||
|
reloadOnLocalClient();
|
||||||
|
}
|
||||||
|
|
||||||
ExplosionData* explosion;
|
ExplosionData* explosion;
|
||||||
S32 explosionId;
|
S32 explosionId;
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,10 @@ protected:
|
||||||
void _makePrimBuffer( GFXPrimitiveBufferHandle *pb, U32 count );
|
void _makePrimBuffer( GFXPrimitiveBufferHandle *pb, U32 count );
|
||||||
void _renderCorona( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat );
|
void _renderCorona( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat );
|
||||||
|
|
||||||
void onImageChanged() {}
|
void onImageChanged()
|
||||||
|
{
|
||||||
|
reloadOnLocalClient();
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,10 @@ public:
|
||||||
void packData( BitStream *stream ) override;
|
void packData( BitStream *stream ) override;
|
||||||
void unpackData( BitStream *stream ) override;
|
void unpackData( BitStream *stream ) override;
|
||||||
|
|
||||||
void onShapeChanged() {}
|
void onShapeChanged()
|
||||||
|
{
|
||||||
|
reloadOnLocalClient();
|
||||||
|
}
|
||||||
|
|
||||||
DECLARE_CONOBJECT( PhysicsDebrisData );
|
DECLARE_CONOBJECT( PhysicsDebrisData );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,10 @@ public:
|
||||||
SimObjectRef< ExplosionData > explosion;
|
SimObjectRef< ExplosionData > explosion;
|
||||||
SimObjectRef< PhysicsShapeData > destroyedShape;
|
SimObjectRef< PhysicsShapeData > destroyedShape;
|
||||||
|
|
||||||
void onShapeChanged() {}
|
void onShapeChanged()
|
||||||
|
{
|
||||||
|
reloadOnLocalClient();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef PhysicsShapeData::SimType PhysicsSimType;
|
typedef PhysicsShapeData::SimType PhysicsSimType;
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ struct PlayerData: public ShapeBaseData {
|
||||||
/// that we don't create a TSThread on the player if we don't
|
/// that we don't create a TSThread on the player if we don't
|
||||||
/// need to.
|
/// need to.
|
||||||
|
|
||||||
DECLARE_SHAPEASSET_ARRAY(PlayerData, ShapeFP, ShapeBase::MaxMountedImages); ///< Used to render with mounted images in first person [optional]
|
DECLARE_SHAPEASSET_ARRAY(PlayerData, ShapeFP, ShapeBase::MaxMountedImages, onShapeChanged); ///< Used to render with mounted images in first person [optional]
|
||||||
DECLARE_ASSET_ARRAY_SETGET(PlayerData, ShapeFP);
|
DECLARE_ASSET_ARRAY_SETGET(PlayerData, ShapeFP);
|
||||||
|
|
||||||
StringTableEntry imageAnimPrefixFP; ///< Passed along to mounted images to modify
|
StringTableEntry imageAnimPrefixFP; ///< Passed along to mounted images to modify
|
||||||
|
|
@ -372,6 +372,11 @@ struct PlayerData: public ShapeBaseData {
|
||||||
void packData(BitStream* stream) override;
|
void packData(BitStream* stream) override;
|
||||||
void unpackData(BitStream* stream) override;
|
void unpackData(BitStream* stream) override;
|
||||||
|
|
||||||
|
void onShapeChanged()
|
||||||
|
{
|
||||||
|
reloadOnLocalClient();
|
||||||
|
}
|
||||||
|
|
||||||
/// @name Callbacks
|
/// @name Callbacks
|
||||||
/// @{
|
/// @{
|
||||||
DECLARE_CALLBACK( void, onPoseChange, ( Player* obj, const char* oldPose, const char* newPose ) );
|
DECLARE_CALLBACK( void, onPoseChange, ( Player* obj, const char* oldPose, const char* newPose ) );
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@
|
||||||
#include "T3D/decal/decalData.h"
|
#include "T3D/decal/decalData.h"
|
||||||
#include "T3D/lightDescription.h"
|
#include "T3D/lightDescription.h"
|
||||||
#include "console/engineAPI.h"
|
#include "console/engineAPI.h"
|
||||||
|
#include "T3D/rigidShape.h"
|
||||||
|
|
||||||
|
|
||||||
IMPLEMENT_CO_DATABLOCK_V1(ProjectileData);
|
IMPLEMENT_CO_DATABLOCK_V1(ProjectileData);
|
||||||
|
|
@ -163,6 +164,7 @@ ProjectileData::ProjectileData()
|
||||||
scale.set( 1.0f, 1.0f, 1.0f );
|
scale.set( 1.0f, 1.0f, 1.0f );
|
||||||
|
|
||||||
isBallistic = false;
|
isBallistic = false;
|
||||||
|
mExplodeOnTmeout = false;
|
||||||
|
|
||||||
velInheritFactor = 1.0f;
|
velInheritFactor = 1.0f;
|
||||||
muzzleVelocity = 50;
|
muzzleVelocity = 50;
|
||||||
|
|
@ -203,6 +205,7 @@ ProjectileData::ProjectileData(const ProjectileData& other, bool temp_clone) : G
|
||||||
muzzleVelocity = other.muzzleVelocity;
|
muzzleVelocity = other.muzzleVelocity;
|
||||||
impactForce = other.impactForce;
|
impactForce = other.impactForce;
|
||||||
isBallistic = other.isBallistic;
|
isBallistic = other.isBallistic;
|
||||||
|
mExplodeOnTmeout = other.mExplodeOnTmeout;
|
||||||
bounceElasticity = other.bounceElasticity;
|
bounceElasticity = other.bounceElasticity;
|
||||||
bounceFriction = other.bounceFriction;
|
bounceFriction = other.bounceFriction;
|
||||||
gravityMod = other.gravityMod;
|
gravityMod = other.gravityMod;
|
||||||
|
|
@ -285,6 +288,8 @@ void ProjectileData::initPersistFields()
|
||||||
addProtectedFieldV("fadeDelay", TypeRangedS32, Offset(fadeDelay, ProjectileData), &setFadeDelay, &getScaledValue, &CommonValidators::NaturalNumber,
|
addProtectedFieldV("fadeDelay", TypeRangedS32, Offset(fadeDelay, ProjectileData), &setFadeDelay, &getScaledValue, &CommonValidators::NaturalNumber,
|
||||||
"@brief Amount of time, in milliseconds, before the projectile begins to fade out.\n\n"
|
"@brief Amount of time, in milliseconds, before the projectile begins to fade out.\n\n"
|
||||||
"This value must be smaller than the projectile's lifetime to have an affect.");
|
"This value must be smaller than the projectile's lifetime to have an affect.");
|
||||||
|
addField("explodeOnTmeout", TypeBool, Offset(mExplodeOnTmeout, ProjectileData),
|
||||||
|
"@brief Detetmines if the projectile should explode on timeout");
|
||||||
addField("isBallistic", TypeBool, Offset(isBallistic, ProjectileData),
|
addField("isBallistic", TypeBool, Offset(isBallistic, ProjectileData),
|
||||||
"@brief Detetmines if the projectile should be affected by gravity and whether or not "
|
"@brief Detetmines if the projectile should be affected by gravity and whether or not "
|
||||||
"it bounces before exploding.\n\n");
|
"it bounces before exploding.\n\n");
|
||||||
|
|
@ -455,6 +460,7 @@ void ProjectileData::packData(BitStream* stream)
|
||||||
stream->write(armingDelay);
|
stream->write(armingDelay);
|
||||||
stream->write(fadeDelay);
|
stream->write(fadeDelay);
|
||||||
|
|
||||||
|
stream->writeFlag(mExplodeOnTmeout);
|
||||||
if(stream->writeFlag(isBallistic))
|
if(stream->writeFlag(isBallistic))
|
||||||
{
|
{
|
||||||
stream->write(gravityMod);
|
stream->write(gravityMod);
|
||||||
|
|
@ -514,6 +520,7 @@ void ProjectileData::unpackData(BitStream* stream)
|
||||||
stream->read(&armingDelay);
|
stream->read(&armingDelay);
|
||||||
stream->read(&fadeDelay);
|
stream->read(&fadeDelay);
|
||||||
|
|
||||||
|
mExplodeOnTmeout = stream->readFlag();
|
||||||
isBallistic = stream->readFlag();
|
isBallistic = stream->readFlag();
|
||||||
if(isBallistic)
|
if(isBallistic)
|
||||||
{
|
{
|
||||||
|
|
@ -611,6 +618,7 @@ Projectile::Projectile()
|
||||||
mProjectileShape( NULL ),
|
mProjectileShape( NULL ),
|
||||||
mActivateThread( NULL ),
|
mActivateThread( NULL ),
|
||||||
mMaintainThread( NULL ),
|
mMaintainThread( NULL ),
|
||||||
|
mHasHit(false),
|
||||||
mHasExploded( false ),
|
mHasExploded( false ),
|
||||||
mFadeValue( 1.0f )
|
mFadeValue( 1.0f )
|
||||||
{
|
{
|
||||||
|
|
@ -1128,10 +1136,18 @@ void Projectile::processTick( const Move *move )
|
||||||
|
|
||||||
void Projectile::simulate( F32 dt )
|
void Projectile::simulate( F32 dt )
|
||||||
{
|
{
|
||||||
if ( isServerObject() && mCurrTick >= mDataBlock->lifetime )
|
if ( isServerObject() )
|
||||||
{
|
{
|
||||||
deleteObject();
|
if (mCurrTick >= (mDataBlock->lifetime - TickMs))
|
||||||
return;
|
{
|
||||||
|
if (mDataBlock->mExplodeOnTmeout)
|
||||||
|
explode(mCurrPosition, Point3F::UnitZ, VehicleObjectType);
|
||||||
|
}
|
||||||
|
if (mCurrTick >= mDataBlock->lifetime || (mHasHit && mCurrTick < mDataBlock->armingDelay))
|
||||||
|
{
|
||||||
|
deleteObject();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( mHasExploded )
|
if ( mHasExploded )
|
||||||
|
|
@ -1168,8 +1184,15 @@ void Projectile::simulate( F32 dt )
|
||||||
if ( mPhysicsWorld )
|
if ( mPhysicsWorld )
|
||||||
hit = mPhysicsWorld->castRay( oldPosition, newPosition, &rInfo, Point3F( newPosition - oldPosition) * mDataBlock->impactForce );
|
hit = mPhysicsWorld->castRay( oldPosition, newPosition, &rInfo, Point3F( newPosition - oldPosition) * mDataBlock->impactForce );
|
||||||
else
|
else
|
||||||
|
{
|
||||||
hit = getContainer()->castRay(oldPosition, newPosition, dynamicCollisionMask | staticCollisionMask, &rInfo);
|
hit = getContainer()->castRay(oldPosition, newPosition, dynamicCollisionMask | staticCollisionMask, &rInfo);
|
||||||
|
if (hit && rInfo.object->getTypeMask() & VehicleObjectType)
|
||||||
|
{
|
||||||
|
RigidShape* aRigid = dynamic_cast<RigidShape*>(rInfo.object);
|
||||||
|
if (aRigid)
|
||||||
|
aRigid->applyImpulse(rInfo.point, Point3F(newPosition - oldPosition) * mDataBlock->impactForce);
|
||||||
|
}
|
||||||
|
}
|
||||||
if ( hit )
|
if ( hit )
|
||||||
{
|
{
|
||||||
// make sure the client knows to bounce
|
// make sure the client knows to bounce
|
||||||
|
|
@ -1237,6 +1260,8 @@ void Projectile::simulate( F32 dt )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mCurrVelocity = Point3F::Zero;
|
mCurrVelocity = Point3F::Zero;
|
||||||
|
newPosition = oldPosition = rInfo.point + rInfo.normal * 0.05f;
|
||||||
|
mHasHit = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,9 +87,9 @@ public:
|
||||||
/// Force imparted on a hit object.
|
/// Force imparted on a hit object.
|
||||||
F32 impactForce;
|
F32 impactForce;
|
||||||
|
|
||||||
|
bool mExplodeOnTmeout;
|
||||||
/// Should it arc?
|
/// Should it arc?
|
||||||
bool isBallistic;
|
bool isBallistic;
|
||||||
|
|
||||||
/// How HIGH should it bounce (parallel to normal), [0,1]
|
/// How HIGH should it bounce (parallel to normal), [0,1]
|
||||||
F32 bounceElasticity;
|
F32 bounceElasticity;
|
||||||
/// How much momentum should be lost when it bounces (perpendicular to normal), [0,1]
|
/// How much momentum should be lost when it bounces (perpendicular to normal), [0,1]
|
||||||
|
|
@ -154,7 +154,10 @@ public:
|
||||||
ProjectileData(const ProjectileData&, bool = false);
|
ProjectileData(const ProjectileData&, bool = false);
|
||||||
bool allowSubstitutions() const override { return true; }
|
bool allowSubstitutions() const override { return true; }
|
||||||
|
|
||||||
void onShapeChanged() {}
|
void onShapeChanged()
|
||||||
|
{
|
||||||
|
reloadOnLocalClient();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -274,7 +277,7 @@ protected:
|
||||||
|
|
||||||
LightInfo *mLight;
|
LightInfo *mLight;
|
||||||
LightState mLightState;
|
LightState mLightState;
|
||||||
|
bool mHasHit;
|
||||||
bool mHasExploded; ///< Prevent rendering, lighting, and duplicate explosions.
|
bool mHasExploded; ///< Prevent rendering, lighting, and duplicate explosions.
|
||||||
F32 mFadeValue; ///< set in processTick, interpolation between fadeDelay and lifetime
|
F32 mFadeValue; ///< set in processTick, interpolation between fadeDelay and lifetime
|
||||||
///< in data block
|
///< in data block
|
||||||
|
|
|
||||||
|
|
@ -347,7 +347,7 @@ bool ShapeBaseData::preload(bool server, String &errorStr)
|
||||||
|
|
||||||
S32 i;
|
S32 i;
|
||||||
U32 assetStatus = ShapeAsset::getAssetErrCode(mShapeAsset);
|
U32 assetStatus = ShapeAsset::getAssetErrCode(mShapeAsset);
|
||||||
if (assetStatus == AssetBase::Ok|| assetStatus == AssetBase::UsingFallback)
|
if (assetStatus == AssetBase::Ok || assetStatus == AssetBase::UsingFallback)
|
||||||
{
|
{
|
||||||
if (!server && !mShape->preloadMaterialList(mShape.getPath()) && NetConnection::filesWereDownloaded())
|
if (!server && !mShape->preloadMaterialList(mShape.getPath()) && NetConnection::filesWereDownloaded())
|
||||||
shapeError = true;
|
shapeError = true;
|
||||||
|
|
@ -910,7 +910,17 @@ void ShapeBaseData::unpackData(BitStream* stream)
|
||||||
silent_bbox_check = stream->readFlag();
|
silent_bbox_check = stream->readFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
void ShapeBaseData::onShapeChanged()
|
||||||
|
{
|
||||||
|
reloadOnLocalClient();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShapeBaseData::onDebrisChanged()
|
||||||
|
{
|
||||||
|
reloadOnLocalClient();
|
||||||
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -380,7 +380,7 @@ struct ShapeBaseImageData: public GameBaseData {
|
||||||
F32 scriptAnimTransitionTime; ///< The amount of time to transition between the previous sequence and new sequence
|
F32 scriptAnimTransitionTime; ///< The amount of time to transition between the previous sequence and new sequence
|
||||||
///< when the script prefix has changed.
|
///< when the script prefix has changed.
|
||||||
|
|
||||||
DECLARE_SHAPEASSET_ARRAY(ShapeBaseImageData, Shape, MaxShapes); ///< Name of shape to render.
|
DECLARE_SHAPEASSET_ARRAY(ShapeBaseImageData, Shape, MaxShapes, onShapeChanged); ///< Name of shape to render.
|
||||||
DECLARE_ASSET_ARRAY_SETGET(ShapeBaseImageData, Shape);
|
DECLARE_ASSET_ARRAY_SETGET(ShapeBaseImageData, Shape);
|
||||||
|
|
||||||
//DECLARE_SHAPEASSET(ShapeBaseImageData, ShapeFP); ///< Name of shape to render in first person (optional).
|
//DECLARE_SHAPEASSET(ShapeBaseImageData, ShapeFP); ///< Name of shape to render in first person (optional).
|
||||||
|
|
@ -507,6 +507,11 @@ struct ShapeBaseImageData: public GameBaseData {
|
||||||
|
|
||||||
void handleStateSoundTrack(const U32& stateId);
|
void handleStateSoundTrack(const U32& stateId);
|
||||||
|
|
||||||
|
void onShapeChanged()
|
||||||
|
{
|
||||||
|
reloadOnLocalClient();
|
||||||
|
}
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
/// @name Callbacks
|
/// @name Callbacks
|
||||||
|
|
@ -684,8 +689,8 @@ public:
|
||||||
Vector<TextureTagRemapping> txr_tag_remappings;
|
Vector<TextureTagRemapping> txr_tag_remappings;
|
||||||
bool silent_bbox_check;
|
bool silent_bbox_check;
|
||||||
|
|
||||||
void onShapeChanged() {}
|
void onShapeChanged();
|
||||||
void onDebrisChanged() {}
|
void onDebrisChanged();
|
||||||
public:
|
public:
|
||||||
ShapeBaseData(const ShapeBaseData&, bool = false);
|
ShapeBaseData(const ShapeBaseData&, bool = false);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,10 @@ struct WheeledVehicleTire: public SimDataBlock
|
||||||
void packData(BitStream* stream) override;
|
void packData(BitStream* stream) override;
|
||||||
void unpackData(BitStream* stream) override;
|
void unpackData(BitStream* stream) override;
|
||||||
|
|
||||||
void onShapeChanged() {}
|
void onShapeChanged()
|
||||||
|
{
|
||||||
|
reloadOnLocalClient();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,10 @@ protected:
|
||||||
public:
|
public:
|
||||||
enum { MaxLifetimeTicks = 4095 };
|
enum { MaxLifetimeTicks = 4095 };
|
||||||
|
|
||||||
void onShapeChanged() {}
|
void onShapeChanged()
|
||||||
|
{
|
||||||
|
reloadOnLocalClient();
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// variables set in datablock definition:
|
// variables set in datablock definition:
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,10 @@ public:
|
||||||
|
|
||||||
static void initPersistFields();
|
static void initPersistFields();
|
||||||
|
|
||||||
void onChangeTexture() {}
|
void onChangeTexture()
|
||||||
|
{
|
||||||
|
reloadOnLocalClient();
|
||||||
|
}
|
||||||
|
|
||||||
DECLARE_CONOBJECT(afxBillboardData);
|
DECLARE_CONOBJECT(afxBillboardData);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,10 @@ public:
|
||||||
|
|
||||||
static void initPersistFields();
|
static void initPersistFields();
|
||||||
|
|
||||||
void onShapeChanged() {}
|
void onShapeChanged()
|
||||||
|
{
|
||||||
|
reloadOnLocalClient();
|
||||||
|
}
|
||||||
void onSequenceChanged() {}
|
void onSequenceChanged() {}
|
||||||
|
|
||||||
DECLARE_CONOBJECT(afxModelData);
|
DECLARE_CONOBJECT(afxModelData);
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,10 @@ public:
|
||||||
|
|
||||||
static void convertGradientRangeFromDegrees(Point2F& gradrange, const Point2F& gradrange_deg);
|
static void convertGradientRangeFromDegrees(Point2F& gradrange, const Point2F& gradrange_deg);
|
||||||
|
|
||||||
void onImageChanged() {}
|
void onImageChanged()
|
||||||
|
{
|
||||||
|
reloadOnLocalClient();
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DECLARE_IMAGEASSET(afxZodiacData, Texture, onImageChanged, AFX_GFXZodiacTextureProfile);
|
DECLARE_IMAGEASSET(afxZodiacData, Texture, onImageChanged, AFX_GFXZodiacTextureProfile);
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,10 @@ public:
|
||||||
FACES_BITS = 3
|
FACES_BITS = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
void onImageChanged() {}
|
void onImageChanged()
|
||||||
|
{
|
||||||
|
reloadOnLocalClient();
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DECLARE_IMAGEASSET(afxZodiacPlaneData, Texture, onImageChanged, AFX_GFXZodiacTextureProfile);
|
DECLARE_IMAGEASSET(afxZodiacPlaneData, Texture, onImageChanged, AFX_GFXZodiacTextureProfile);
|
||||||
|
|
|
||||||
|
|
@ -425,39 +425,42 @@ void SimDataBlock::write(Stream &stream, U32 tabStop, U32 flags)
|
||||||
// MARK: ---- API ----
|
// MARK: ---- API ----
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
void SimDataBlock::reloadOnLocalClient()
|
||||||
DefineEngineMethod( SimDataBlock, reloadOnLocalClient, void, (),,
|
|
||||||
"Reload the datablock. This can only be used with a local client configuration." )
|
|
||||||
{
|
{
|
||||||
// Make sure we're running a local client.
|
// Make sure we're running a local client.
|
||||||
|
|
||||||
GameConnection* localClient = GameConnection::getLocalClientConnection();
|
GameConnection* localClient = GameConnection::getLocalClientConnection();
|
||||||
if( !localClient )
|
if (!localClient)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Do an in-place pack/unpack/preload.
|
// Do an in-place pack/unpack/preload.
|
||||||
|
|
||||||
if( !object->preload( true, NetConnection::getErrorBuffer() ) )
|
if (!preload(true, NetConnection::getErrorBuffer()))
|
||||||
{
|
{
|
||||||
Con::errorf( NetConnection::getErrorBuffer() );
|
Con::errorf(NetConnection::getErrorBuffer());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
U8 buffer[ 16384 ];
|
U8 buffer[16384];
|
||||||
BitStream stream( buffer, 16384 );
|
BitStream stream(buffer, 16384);
|
||||||
|
|
||||||
object->packData( &stream );
|
packData(&stream);
|
||||||
stream.setPosition(0);
|
stream.setPosition(0);
|
||||||
object->unpackData( &stream );
|
unpackData(&stream);
|
||||||
|
|
||||||
if( !object->preload( false, NetConnection::getErrorBuffer() ) )
|
if (!preload(false, NetConnection::getErrorBuffer()))
|
||||||
{
|
{
|
||||||
Con::errorf( NetConnection::getErrorBuffer() );
|
Con::errorf(NetConnection::getErrorBuffer());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trigger a post-apply so that change notifications respond.
|
// Trigger a post-apply so that change notifications respond.
|
||||||
object->inspectPostApply();
|
inspectPostApply();
|
||||||
|
}
|
||||||
|
DefineEngineMethod( SimDataBlock, reloadOnLocalClient, void, (),,
|
||||||
|
"Reload the datablock. This can only be used with a local client configuration." )
|
||||||
|
{
|
||||||
|
object->reloadOnLocalClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -176,6 +176,8 @@ public:
|
||||||
/// Used by the console system to automatically tell datablock classes apart
|
/// Used by the console system to automatically tell datablock classes apart
|
||||||
/// from non-datablock classes.
|
/// from non-datablock classes.
|
||||||
static const bool __smIsDatablock = true;
|
static const bool __smIsDatablock = true;
|
||||||
|
|
||||||
|
void reloadOnLocalClient();
|
||||||
protected:
|
protected:
|
||||||
struct SubstitutionStatement
|
struct SubstitutionStatement
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,10 @@ public:
|
||||||
return theSignal;
|
return theSignal;
|
||||||
}
|
}
|
||||||
|
|
||||||
void onShapeChanged() {}
|
void onShapeChanged()
|
||||||
|
{
|
||||||
|
reloadOnLocalClient();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Vector<ForestItemData*> ForestItemDataVector;
|
typedef Vector<ForestItemData*> ForestItemDataVector;
|
||||||
|
|
|
||||||
|
|
@ -111,8 +111,12 @@ function handleConnectionErrorMessage(%msgType, %msgString, %msgError)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Disconnect
|
// Disconnect
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
function disconnect()
|
function disconnect()
|
||||||
|
{
|
||||||
|
callOnModules("disconnect");
|
||||||
|
}
|
||||||
|
|
||||||
|
function Core_ClientServer::disconnect(%this)
|
||||||
{
|
{
|
||||||
// We need to stop the client side simulation
|
// We need to stop the client side simulation
|
||||||
// else physics resources will not cleanup properly.
|
// else physics resources will not cleanup properly.
|
||||||
|
|
|
||||||
|
|
@ -24,3 +24,12 @@ function ToolsModule::onDestroy(%this)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ToolsModule::disconnect(%this)
|
||||||
|
{
|
||||||
|
if ( isObject( Editor ) && Editor.isEditorEnabled() )
|
||||||
|
{
|
||||||
|
EditorGui.saveAs = false; //whatever edits we were doing are irrelevent now
|
||||||
|
Editor.close(MainMenuGui);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -164,40 +164,3 @@ function toggleEditor(%make)
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// The editor action maps are defined in editor.bind.tscript
|
// The editor action maps are defined in editor.bind.tscript
|
||||||
GlobalActionMap.bind(keyboard, "f11", fastLoadWorldEdit);
|
GlobalActionMap.bind(keyboard, "f11", fastLoadWorldEdit);
|
||||||
|
|
||||||
|
|
||||||
// The scenario:
|
|
||||||
// The editor is open and the user closes the level by any way other than
|
|
||||||
// the file menu ( exit level ), eg. typing disconnect() in the console.
|
|
||||||
//
|
|
||||||
// The problem:
|
|
||||||
// Editor::close() is not called in this scenario which means onEditorDisable
|
|
||||||
// is not called on objects which hook into it and also gEditingMission will no
|
|
||||||
// longer be valid.
|
|
||||||
//
|
|
||||||
// The solution:
|
|
||||||
// Override the stock disconnect() function which is in game scripts from here
|
|
||||||
// in tools so we avoid putting our code in there.
|
|
||||||
//
|
|
||||||
// Disclaimer:
|
|
||||||
// If you think of a better way to do this feel free. The thing which could
|
|
||||||
// be dangerous about this is that no one will ever realize this code overriding
|
|
||||||
// a fairly standard and core game script from a somewhat random location.
|
|
||||||
// If it 'did' have unforscene sideeffects who would ever find it?
|
|
||||||
|
|
||||||
package EditorDisconnectOverride
|
|
||||||
{
|
|
||||||
function disconnect()
|
|
||||||
{
|
|
||||||
if ( isObject( Editor ) && Editor.isEditorEnabled() )
|
|
||||||
{
|
|
||||||
EditorGui.saveAs = false; //whatever edits we were doing are irrelevent now
|
|
||||||
%mainMenuGUI = ProjectSettings.value("UI/mainMenuName");
|
|
||||||
if (isObject( %mainMenuGUI ))
|
|
||||||
Editor.close( %mainMenuGUI );
|
|
||||||
}
|
|
||||||
|
|
||||||
Parent::disconnect();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
activatePackage( EditorDisconnectOverride );
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue