Phase 1: Add a #define test

This commit is contained in:
Marc Chapman 2018-01-23 20:24:35 +00:00
parent 35d649b57e
commit 1c2effd7fa
6 changed files with 36 additions and 3 deletions

View file

@ -41,7 +41,9 @@
#include "T3D/aiConnection.h" #include "T3D/aiConnection.h"
#endif #endif
#ifdef TORQUE_AFX_ENABLED
#include "afx/arcaneFX.h" #include "afx/arcaneFX.h"
#endif
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Ghost update relative priority values // Ghost update relative priority values
@ -256,8 +258,10 @@ GameBase::GameBase()
GameBase::~GameBase() GameBase::~GameBase()
{ {
#ifdef TORQUE_AFX_ENABLED
if (scope_registered) if (scope_registered)
arcaneFX::unregisterScopedObject(this); arcaneFX::unregisterScopedObject(this);
#endif
} }
@ -270,6 +274,7 @@ bool GameBase::onAdd()
// Datablock must be initialized on the server. // Datablock must be initialized on the server.
// Client datablock are initialized by the initial update. // Client datablock are initialized by the initial update.
#ifdef TORQUE_AFX_ENABLED
if (isClientObject()) if (isClientObject())
{ {
if (scope_id > 0 && !scope_registered) if (scope_id > 0 && !scope_registered)
@ -280,6 +285,10 @@ bool GameBase::onAdd()
if ( mDataBlock && !onNewDataBlock( mDataBlock, false ) ) if ( mDataBlock && !onNewDataBlock( mDataBlock, false ) )
return false; return false;
} }
#else
if ( isServerObject() && mDataBlock && !onNewDataBlock( mDataBlock, false ) )
return false;
#endif
setProcessTick( true ); setProcessTick( true );
@ -288,8 +297,10 @@ bool GameBase::onAdd()
void GameBase::onRemove() void GameBase::onRemove()
{ {
#ifdef TORQUE_AFX_ENABLED
if (scope_registered) if (scope_registered)
arcaneFX::unregisterScopedObject(this); arcaneFX::unregisterScopedObject(this);
#endif
// EDITOR FEATURE: Remove us from the reload signal of our datablock. // EDITOR FEATURE: Remove us from the reload signal of our datablock.
if ( mDataBlock ) if ( mDataBlock )
mDataBlock->mReloadSignal.remove( this, &GameBase::_onDatablockModified ); mDataBlock->mReloadSignal.remove( this, &GameBase::_onDatablockModified );
@ -314,9 +325,11 @@ bool GameBase::onNewDataBlock( GameBaseData *dptr, bool reload )
if ( !mDataBlock ) if ( !mDataBlock )
return false; return false;
#ifdef TORQUE_AFX_ENABLED
// Don't set mask when new datablock is a temp-clone. // Don't set mask when new datablock is a temp-clone.
if (mDataBlock->isTempClone()) if (mDataBlock->isTempClone())
return true; return true;
#endif
setMaskBits(DataBlockMask); setMaskBits(DataBlockMask);
return true; return true;
@ -570,11 +583,13 @@ U32 GameBase::packUpdate( NetConnection *connection, U32 mask, BitStream *stream
stream->writeFlag(mIsAiControlled); stream->writeFlag(mIsAiControlled);
#endif #endif
#ifdef TORQUE_AFX_ENABLED
if (stream->writeFlag(mask & ScopeIdMask)) if (stream->writeFlag(mask & ScopeIdMask))
{ {
if (stream->writeFlag(scope_refs > 0)) if (stream->writeFlag(scope_refs > 0))
stream->writeInt(scope_id, SCOPE_ID_BITS); stream->writeInt(scope_id, SCOPE_ID_BITS);
} }
#endif
return retMask; return retMask;
} }
@ -613,11 +628,13 @@ void GameBase::unpackUpdate(NetConnection *con, BitStream *stream)
mTicksSinceLastMove = 0; mTicksSinceLastMove = 0;
mIsAiControlled = stream->readFlag(); mIsAiControlled = stream->readFlag();
#endif #endif
#ifdef TORQUE_AFX_ENABLED
if (stream->readFlag()) if (stream->readFlag())
{ {
scope_id = (stream->readFlag()) ? (U16) stream->readInt(SCOPE_ID_BITS) : 0; scope_id = (stream->readFlag()) ? (U16) stream->readInt(SCOPE_ID_BITS) : 0;
scope_refs = 0; scope_refs = 0;
} }
#endif
} }
void GameBase::onMount( SceneObject *obj, S32 node ) void GameBase::onMount( SceneObject *obj, S32 node )

View file

@ -61,7 +61,9 @@
#include "core/stream/fileStream.h" #include "core/stream/fileStream.h"
#endif #endif
#ifdef TORQUE_AFX_ENABLED
#include "afx/arcaneFX.h" #include "afx/arcaneFX.h"
#endif
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
#define MAX_MOVE_PACKET_SENDS 4 #define MAX_MOVE_PACKET_SENDS 4
@ -2452,6 +2454,7 @@ DefineEngineMethod( GameConnection, getVisibleGhostDistance, F32, (),,
return object->getVisibleGhostDistance(); return object->getVisibleGhostDistance();
} }
#ifdef TORQUE_AFX_ENABLED
// The object selection code here is, in part, based, on functionality described // The object selection code here is, in part, based, on functionality described
// in the following resource: // in the following resource:
// Object Selection in Torque by Dave Myers // Object Selection in Torque by Dave Myers
@ -2580,6 +2583,7 @@ void GameConnection::onDeleteNotify(SimObject* obj)
Parent::onDeleteNotify(obj); Parent::onDeleteNotify(obj);
} }
#endif
#ifdef AFX_CAP_DATABLOCK_CACHE #ifdef AFX_CAP_DATABLOCK_CACHE

View file

@ -54,8 +54,10 @@
#include "gfx/gfxTextureManager.h" #include "gfx/gfxTextureManager.h"
#include "sfx/sfxSystem.h" #include "sfx/sfxSystem.h"
// Including this header provides access to certain system-level AFX methods. #ifdef TORQUE_AFX_ENABLED
#include "afx/arcaneFX.h" #include "afx/arcaneFX.h"
#endif
#ifdef TORQUE_PLAYER #ifdef TORQUE_PLAYER
// See matching #ifdef in editor/editor.cpp // See matching #ifdef in editor/editor.cpp
bool gEditingMission = false; bool gEditingMission = false;
@ -242,9 +244,11 @@ ConsoleFunctionGroupEnd(Platform);
bool clientProcess(U32 timeDelta) bool clientProcess(U32 timeDelta)
{ {
#ifdef TORQUE_AFX_ENABLED
// Required heartbeat call on the client side which must come // Required heartbeat call on the client side which must come
// before the advanceTime() calls are made to the scene objects. // before the advanceTime() calls are made to the scene objects.
arcaneFX::advanceTime(timeDelta); arcaneFX::advanceTime(timeDelta);
#endif
bool ret = true; bool ret = true;
#ifndef TORQUE_TGB_ONLY #ifndef TORQUE_TGB_ONLY

View file

@ -515,9 +515,9 @@ public:
TypeValidator *validator; ///< Validator, if any. TypeValidator *validator; ///< Validator, if any.
SetDataNotify setDataFn; ///< Set data notify Fn SetDataNotify setDataFn; ///< Set data notify Fn
GetDataNotify getDataFn; ///< Get data notify Fn GetDataNotify getDataFn; ///< Get data notify Fn
WriteDataNotify writeDataFn; ///< Function to determine whether data should be written or not.
bool doNotSubstitute; bool doNotSubstitute;
bool keepClearSubsOnly; bool keepClearSubsOnly;
WriteDataNotify writeDataFn; ///< Function to determine whether data should be written or not.
}; };
typedef Vector<Field> FieldList; typedef Vector<Field> FieldList;

View file

@ -33,7 +33,9 @@
#include "console/consoleTypes.h" #include "console/consoleTypes.h"
#include "console/engineAPI.h" #include "console/engineAPI.h"
#ifdef TORQUE_AFX_ENABLED
#include "afx/arcaneFX.h" #include "afx/arcaneFX.h"
#endif
IMPLEMENT_CONOBJECT(NetObject); IMPLEMENT_CONOBJECT(NetObject);
@ -53,9 +55,11 @@ NetObject::NetObject()
mPrevDirtyList = NULL; mPrevDirtyList = NULL;
mNextDirtyList = NULL; mNextDirtyList = NULL;
mDirtyMaskBits = 0; mDirtyMaskBits = 0;
#ifdef TORQUE_AFX_ENABLED
scope_id = 0; scope_id = 0;
scope_refs = 0; scope_refs = 0;
scope_registered = false; scope_registered = false;
#endif
} }
NetObject::~NetObject() NetObject::~NetObject()
@ -470,6 +474,8 @@ DefineEngineMethod( NetObject, isServerObject, bool, (),,
//{ //{
// return object->isServerObject(); // return object->isServerObject();
//} //}
#ifdef TORQUE_AFX_ENABLED
U16 NetObject::addScopeRef() U16 NetObject::addScopeRef()
{ {
if (scope_refs == 0) if (scope_refs == 0)
@ -492,4 +498,4 @@ void NetObject::removeScopeRef()
onScopeIdChange(); onScopeIdChange();
} }
} }
#endif

View file

@ -50,7 +50,9 @@
#include "gfx/gfxDrawUtil.h" #include "gfx/gfxDrawUtil.h"
#ifdef TORQUE_AFX_ENABLED
#include "afx/arcaneFX.h" #include "afx/arcaneFX.h"
#endif
#include "afx/ce/afxZodiacMgr.h" #include "afx/ce/afxZodiacMgr.h"
#include "gfx/gfxTransformSaver.h" #include "gfx/gfxTransformSaver.h"
#include "gfx/bitmap/gBitmap.h" #include "gfx/bitmap/gBitmap.h"