From 0c65f9ee8ebf365ca35a55007842350a053f6705 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Tue, 23 Jan 2018 20:24:35 +0000 Subject: [PATCH] Phase 1: Add a #define test --- Engine/source/T3D/gameBase/gameBase.cpp | 17 +++++++++++++++++ Engine/source/T3D/gameBase/gameConnection.cpp | 4 ++++ Engine/source/app/game.cpp | 6 +++++- Engine/source/console/consoleObject.h | 2 +- Engine/source/sim/netObject.cpp | 8 +++++++- Engine/source/terrain/terrRender.cpp | 2 ++ 6 files changed, 36 insertions(+), 3 deletions(-) diff --git a/Engine/source/T3D/gameBase/gameBase.cpp b/Engine/source/T3D/gameBase/gameBase.cpp index 4a98742c1..23b8a67bb 100644 --- a/Engine/source/T3D/gameBase/gameBase.cpp +++ b/Engine/source/T3D/gameBase/gameBase.cpp @@ -41,7 +41,9 @@ #include "T3D/aiConnection.h" #endif +#ifdef TORQUE_AFX_ENABLED #include "afx/arcaneFX.h" +#endif //---------------------------------------------------------------------------- // Ghost update relative priority values @@ -256,8 +258,10 @@ GameBase::GameBase() GameBase::~GameBase() { +#ifdef TORQUE_AFX_ENABLED if (scope_registered) arcaneFX::unregisterScopedObject(this); +#endif } @@ -270,6 +274,7 @@ bool GameBase::onAdd() // Datablock must be initialized on the server. // Client datablock are initialized by the initial update. +#ifdef TORQUE_AFX_ENABLED if (isClientObject()) { if (scope_id > 0 && !scope_registered) @@ -280,6 +285,10 @@ bool GameBase::onAdd() if ( mDataBlock && !onNewDataBlock( mDataBlock, false ) ) return false; } +#else + if ( isServerObject() && mDataBlock && !onNewDataBlock( mDataBlock, false ) ) + return false; +#endif setProcessTick( true ); @@ -288,8 +297,10 @@ bool GameBase::onAdd() void GameBase::onRemove() { +#ifdef TORQUE_AFX_ENABLED if (scope_registered) arcaneFX::unregisterScopedObject(this); +#endif // EDITOR FEATURE: Remove us from the reload signal of our datablock. if ( mDataBlock ) mDataBlock->mReloadSignal.remove( this, &GameBase::_onDatablockModified ); @@ -314,9 +325,11 @@ bool GameBase::onNewDataBlock( GameBaseData *dptr, bool reload ) if ( !mDataBlock ) return false; +#ifdef TORQUE_AFX_ENABLED // Don't set mask when new datablock is a temp-clone. if (mDataBlock->isTempClone()) return true; +#endif setMaskBits(DataBlockMask); return true; @@ -570,11 +583,13 @@ U32 GameBase::packUpdate( NetConnection *connection, U32 mask, BitStream *stream stream->writeFlag(mIsAiControlled); #endif +#ifdef TORQUE_AFX_ENABLED if (stream->writeFlag(mask & ScopeIdMask)) { if (stream->writeFlag(scope_refs > 0)) stream->writeInt(scope_id, SCOPE_ID_BITS); } +#endif return retMask; } @@ -613,11 +628,13 @@ void GameBase::unpackUpdate(NetConnection *con, BitStream *stream) mTicksSinceLastMove = 0; mIsAiControlled = stream->readFlag(); #endif +#ifdef TORQUE_AFX_ENABLED if (stream->readFlag()) { scope_id = (stream->readFlag()) ? (U16) stream->readInt(SCOPE_ID_BITS) : 0; scope_refs = 0; } +#endif } void GameBase::onMount( SceneObject *obj, S32 node ) diff --git a/Engine/source/T3D/gameBase/gameConnection.cpp b/Engine/source/T3D/gameBase/gameConnection.cpp index d39b5c249..b1da7bf8f 100644 --- a/Engine/source/T3D/gameBase/gameConnection.cpp +++ b/Engine/source/T3D/gameBase/gameConnection.cpp @@ -61,7 +61,9 @@ #include "core/stream/fileStream.h" #endif +#ifdef TORQUE_AFX_ENABLED #include "afx/arcaneFX.h" +#endif //---------------------------------------------------------------------------- #define MAX_MOVE_PACKET_SENDS 4 @@ -2452,6 +2454,7 @@ DefineEngineMethod( GameConnection, getVisibleGhostDistance, F32, (),, return object->getVisibleGhostDistance(); } +#ifdef TORQUE_AFX_ENABLED // The object selection code here is, in part, based, on functionality described // in the following resource: // Object Selection in Torque by Dave Myers @@ -2580,6 +2583,7 @@ void GameConnection::onDeleteNotify(SimObject* obj) Parent::onDeleteNotify(obj); } +#endif #ifdef AFX_CAP_DATABLOCK_CACHE diff --git a/Engine/source/app/game.cpp b/Engine/source/app/game.cpp index b2b107d8c..05f63e84c 100644 --- a/Engine/source/app/game.cpp +++ b/Engine/source/app/game.cpp @@ -54,8 +54,10 @@ #include "gfx/gfxTextureManager.h" #include "sfx/sfxSystem.h" -// Including this header provides access to certain system-level AFX methods. +#ifdef TORQUE_AFX_ENABLED #include "afx/arcaneFX.h" +#endif + #ifdef TORQUE_PLAYER // See matching #ifdef in editor/editor.cpp bool gEditingMission = false; @@ -242,9 +244,11 @@ ConsoleFunctionGroupEnd(Platform); bool clientProcess(U32 timeDelta) { +#ifdef TORQUE_AFX_ENABLED // Required heartbeat call on the client side which must come // before the advanceTime() calls are made to the scene objects. arcaneFX::advanceTime(timeDelta); +#endif bool ret = true; #ifndef TORQUE_TGB_ONLY diff --git a/Engine/source/console/consoleObject.h b/Engine/source/console/consoleObject.h index 2ff2bc5a3..0cf34e237 100644 --- a/Engine/source/console/consoleObject.h +++ b/Engine/source/console/consoleObject.h @@ -515,9 +515,9 @@ public: TypeValidator *validator; ///< Validator, if any. SetDataNotify setDataFn; ///< Set data notify Fn GetDataNotify getDataFn; ///< Get data notify Fn + WriteDataNotify writeDataFn; ///< Function to determine whether data should be written or not. bool doNotSubstitute; bool keepClearSubsOnly; - WriteDataNotify writeDataFn; ///< Function to determine whether data should be written or not. }; typedef Vector FieldList; diff --git a/Engine/source/sim/netObject.cpp b/Engine/source/sim/netObject.cpp index 76564fb16..dc3cea5f3 100644 --- a/Engine/source/sim/netObject.cpp +++ b/Engine/source/sim/netObject.cpp @@ -33,7 +33,9 @@ #include "console/consoleTypes.h" #include "console/engineAPI.h" +#ifdef TORQUE_AFX_ENABLED #include "afx/arcaneFX.h" +#endif IMPLEMENT_CONOBJECT(NetObject); @@ -53,9 +55,11 @@ NetObject::NetObject() mPrevDirtyList = NULL; mNextDirtyList = NULL; mDirtyMaskBits = 0; +#ifdef TORQUE_AFX_ENABLED scope_id = 0; scope_refs = 0; scope_registered = false; +#endif } NetObject::~NetObject() @@ -470,6 +474,8 @@ DefineEngineMethod( NetObject, isServerObject, bool, (),, //{ // return object->isServerObject(); //} + +#ifdef TORQUE_AFX_ENABLED U16 NetObject::addScopeRef() { if (scope_refs == 0) @@ -492,4 +498,4 @@ void NetObject::removeScopeRef() onScopeIdChange(); } } - +#endif diff --git a/Engine/source/terrain/terrRender.cpp b/Engine/source/terrain/terrRender.cpp index 15c294611..bb0ba8f5d 100644 --- a/Engine/source/terrain/terrRender.cpp +++ b/Engine/source/terrain/terrRender.cpp @@ -50,7 +50,9 @@ #include "gfx/gfxDrawUtil.h" +#ifdef TORQUE_AFX_ENABLED #include "afx/arcaneFX.h" +#endif #include "afx/ce/afxZodiacMgr.h" #include "gfx/gfxTransformSaver.h" #include "gfx/bitmap/gBitmap.h"