From 9391fcad4e836039042108415e098a0cab737425 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Wed, 26 Jul 2017 20:01:44 +0100 Subject: [PATCH] core -- heartbeat call to arcaneFX::advanceTime() from within clientProcess(). misc -- various other function references --- Engine/source/T3D/fx/particle.h | 8 ++++ Engine/source/T3D/player.cpp | 72 +++++++++++++++++++++++++++++++++ Engine/source/T3D/player.h | 10 +++++ Engine/source/app/game.cpp | 10 +++++ 4 files changed, 100 insertions(+) diff --git a/Engine/source/T3D/fx/particle.h b/Engine/source/T3D/fx/particle.h index 35a0c9792..36b8dd11a 100644 --- a/Engine/source/T3D/fx/particle.h +++ b/Engine/source/T3D/fx/particle.h @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _PARTICLE_H_ #define _PARTICLE_H_ @@ -97,6 +102,9 @@ class ParticleData : public SimDataBlock static void initPersistFields(); bool reload(char errorBuffer[256]); + public: + bool loadParameters(); + bool reload(String &errorStr); }; //***************************************************************************** diff --git a/Engine/source/T3D/player.cpp b/Engine/source/T3D/player.cpp index 6b4e00aef..832937f0e 100644 --- a/Engine/source/T3D/player.cpp +++ b/Engine/source/T3D/player.cpp @@ -20,6 +20,10 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #include "platform/platform.h" #include "T3D/player.h" @@ -1656,6 +1660,8 @@ Player::Player() mLastAbsoluteYaw = 0.0f; mLastAbsolutePitch = 0.0f; mLastAbsoluteRoll = 0.0f; + + afx_init(); } Player::~Player() @@ -6188,6 +6194,7 @@ U32 Player::packUpdate(NetConnection *con, U32 mask, BitStream *stream) mArmAnimation.action != mDataBlock->lookAction))) { stream->writeInt(mArmAnimation.action,PlayerData::ActionAnimBits); } + retMask = afx_packUpdate(con, mask, stream, retMask); // The rest of the data is part of the control object packet update. // If we're controlled by this client, we don't need to send it. @@ -6292,6 +6299,7 @@ void Player::unpackUpdate(NetConnection *con, BitStream *stream) mArmAnimation.action = action; } + afx_unpackUpdate(con, stream); // Done if controlled by client ( and not initial update ) if(stream->readFlag()) return; @@ -6819,6 +6827,7 @@ void Player::consoleInit() Con::addVariable("$player::extendedMoveHeadPosRotIndex", TypeS32, &smExtendedMoveHeadPosRotIndex, "@brief The ExtendedMove position/rotation index used for head movements.\n\n" "@ingroup GameObjects\n"); + afx_consoleInit(); } //-------------------------------------------------------------------------- @@ -7172,6 +7181,69 @@ void Player::renderConvex( ObjectRenderInst *ri, SceneRenderState *state, BaseMa GFX->leaveDebugEvent(); } +// static +bool Player::sCorpsesHiddenFromRayCast = true; // this default matches stock Torque behavior. + +// static +void Player::afx_consoleInit() +{ + Con::addVariable("pref::Player::corpsesHiddenFromRayCast", TypeBool, &sCorpsesHiddenFromRayCast); +} + +void Player::afx_init() +{ + overrideLookAnimation = false; + armLookOverridePos = 0.5f; + headVLookOverridePos = 0.5f; + headHLookOverridePos = 0.5f; + ignore_updates = false; + fx_c_triggers = 0; + mark_fx_c_triggers = 0; + fx_s_triggers = 0; + move_trigger_states = 0; + z_velocity = 0.0f; + mark_idle = false; + idle_timer = 0.0f; + mark_s_landing = false; + speed_bias = 1.0f; + speed_bias_goal = 1.0f; + override_movement = 0; + movement_data.zero(); + movement_op = 1; + last_movement_tag = 0; + footfallDecalOverride = 0; + footfallSoundOverride = 0; + footfallDustOverride = 0; + noFootfallFX = false; +} + +U32 Player::afx_packUpdate(NetConnection* con, U32 mask, BitStream* stream, U32 retMask) +{ +#if 0 + if (stream->writeFlag(mask & LookOverrideMask)) +#else + if (stream->writeFlag(mask & ActionMask)) +#endif + stream->writeFlag(overrideLookAnimation); + + if (stream->writeFlag(mask & TriggerMask)) + stream->write(fx_s_triggers); + + return retMask; +} + +void Player::afx_unpackUpdate(NetConnection* con, BitStream* stream) +{ + if (stream->readFlag()) // LookOverrideMask + overrideLookAnimation = stream->readFlag(); + + if (stream->readFlag()) // TriggerMask + { + U32 mask; + stream->read(&mask); + mark_fx_c_triggers = mask; + } +} #ifdef TORQUE_OPENVR void Player::setControllers(Vector controllerList) { diff --git a/Engine/source/T3D/player.h b/Engine/source/T3D/player.h index ac10f2db9..a49f3baf4 100644 --- a/Engine/source/T3D/player.h +++ b/Engine/source/T3D/player.h @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _PLAYER_H_ #define _PLAYER_H_ @@ -780,6 +785,11 @@ public: virtual void prepRenderImage( SceneRenderState* state ); virtual void renderConvex( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat ); virtual void renderMountedImage( U32 imageSlot, TSRenderState &rstate, SceneRenderState *state ); +private: + static void afx_consoleInit(); + void afx_init(); + U32 afx_packUpdate(NetConnection*, U32 mask, BitStream*, U32 retMask); + void afx_unpackUpdate(NetConnection*, BitStream*); }; typedef Player::Pose PlayerPose; diff --git a/Engine/source/app/game.cpp b/Engine/source/app/game.cpp index 5b2070887..b2b107d8c 100644 --- a/Engine/source/app/game.cpp +++ b/Engine/source/app/game.cpp @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "platform/platformInput.h" @@ -49,6 +54,8 @@ #include "gfx/gfxTextureManager.h" #include "sfx/sfxSystem.h" +// Including this header provides access to certain system-level AFX methods. +#include "afx/arcaneFX.h" #ifdef TORQUE_PLAYER // See matching #ifdef in editor/editor.cpp bool gEditingMission = false; @@ -235,6 +242,9 @@ ConsoleFunctionGroupEnd(Platform); bool clientProcess(U32 timeDelta) { + // Required heartbeat call on the client side which must come + // before the advanceTime() calls are made to the scene objects. + arcaneFX::advanceTime(timeDelta); bool ret = true; #ifndef TORQUE_TGB_ONLY