mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 08:34:40 +00:00
* Improved logic to better handle the callback kickoff for actionAnimations happening
* Also adds animation name to callback so you can work off which animation triggered it
This commit is contained in:
parent
b31a5eafe2
commit
af7b5cdb34
2 changed files with 17 additions and 7 deletions
|
|
@ -264,7 +264,7 @@ IMPLEMENT_CALLBACK( PlayerData, onLeaveLiquid, void, ( Player* obj, const char*
|
||||||
"@param obj The Player object\n"
|
"@param obj The Player object\n"
|
||||||
"@param type The type of liquid the player has left\n" );
|
"@param type The type of liquid the player has left\n" );
|
||||||
|
|
||||||
IMPLEMENT_CALLBACK( PlayerData, animationDone, void, ( Player* obj ), ( obj ),
|
IMPLEMENT_CALLBACK( PlayerData, animationDone, void, ( Player* obj, const char * animName), ( obj, animName),
|
||||||
"@brief Called on the server when a scripted animation completes.\n\n"
|
"@brief Called on the server when a scripted animation completes.\n\n"
|
||||||
"@param obj The Player object\n"
|
"@param obj The Player object\n"
|
||||||
"@see Player::setActionThread() for setting a scripted animation and its 'hold' parameter to "
|
"@see Player::setActionThread() for setting a scripted animation and its 'hold' parameter to "
|
||||||
|
|
@ -1584,6 +1584,7 @@ Player::Player()
|
||||||
mActionAnimation.holdAtEnd = false;
|
mActionAnimation.holdAtEnd = false;
|
||||||
mActionAnimation.animateOnServer = false;
|
mActionAnimation.animateOnServer = false;
|
||||||
mActionAnimation.atEnd = false;
|
mActionAnimation.atEnd = false;
|
||||||
|
mActionAnimation.callbackTripped = false;
|
||||||
mState = MoveState;
|
mState = MoveState;
|
||||||
mJetting = false;
|
mJetting = false;
|
||||||
mFalling = false;
|
mFalling = false;
|
||||||
|
|
@ -3848,7 +3849,7 @@ void Player::setActionThread(U32 action,bool forward,bool hold,bool wait,bool fs
|
||||||
mActionAnimation.atEnd = false;
|
mActionAnimation.atEnd = false;
|
||||||
mActionAnimation.delayTicks = (S32)sNewAnimationTickTime;
|
mActionAnimation.delayTicks = (S32)sNewAnimationTickTime;
|
||||||
mActionAnimation.atEnd = false;
|
mActionAnimation.atEnd = false;
|
||||||
|
mActionAnimation.callbackTripped = false;
|
||||||
if (sUseAnimationTransitions && (action != PlayerData::LandAnim || !(mDataBlock->landSequenceTime > 0.0f && !mDataBlock->transitionToLand)) && (isGhost()/* || mActionAnimation.animateOnServer*/))
|
if (sUseAnimationTransitions && (action != PlayerData::LandAnim || !(mDataBlock->landSequenceTime > 0.0f && !mDataBlock->transitionToLand)) && (isGhost()/* || mActionAnimation.animateOnServer*/))
|
||||||
{
|
{
|
||||||
// The transition code needs the timeScale to be set in the
|
// The transition code needs the timeScale to be set in the
|
||||||
|
|
@ -4001,14 +4002,22 @@ void Player::updateActionThread()
|
||||||
if (mMountPending)
|
if (mMountPending)
|
||||||
mMountPending = (isMounted() ? 0 : (mMountPending - 1));
|
mMountPending = (isMounted() ? 0 : (mMountPending - 1));
|
||||||
|
|
||||||
|
if (isServerObject() && (mActionAnimation.action >= PlayerData::NumTableActionAnims) && mActionAnimation.atEnd)
|
||||||
|
{
|
||||||
|
//The scripting language will get a call back when a script animation has finished...
|
||||||
|
// example: When the chat menu animations are done playing...
|
||||||
|
bool tripCallback = false;
|
||||||
|
if ((!mActionAnimation.holdAtEnd)||(mActionAnimation.holdAtEnd && !mActionAnimation.callbackTripped))
|
||||||
|
tripCallback = true;
|
||||||
|
if (tripCallback)
|
||||||
|
mDataBlock->animationDone_callback(this, mActionAnimation.thread->getSequenceName());
|
||||||
|
mActionAnimation.callbackTripped = true;
|
||||||
|
}
|
||||||
|
|
||||||
if ((mActionAnimation.action == PlayerData::NullAnimation) ||
|
if ((mActionAnimation.action == PlayerData::NullAnimation) ||
|
||||||
((!mActionAnimation.waitForEnd || mActionAnimation.atEnd) &&
|
((!mActionAnimation.waitForEnd || mActionAnimation.atEnd) &&
|
||||||
(!mActionAnimation.holdAtEnd && (mActionAnimation.delayTicks -= !mMountPending) <= 0)))
|
(!mActionAnimation.holdAtEnd && (mActionAnimation.delayTicks -= !mMountPending) <= 0)))
|
||||||
{
|
{
|
||||||
//The scripting language will get a call back when a script animation has finished...
|
|
||||||
// example: When the chat menu animations are done playing...
|
|
||||||
if ( isServerObject() && mActionAnimation.action >= PlayerData::NumTableActionAnims )
|
|
||||||
mDataBlock->animationDone_callback( this );
|
|
||||||
pickActionAnimation();
|
pickActionAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -376,7 +376,7 @@ struct PlayerData: public ShapeBaseData {
|
||||||
DECLARE_CALLBACK( void, doDismount, ( Player* obj ) );
|
DECLARE_CALLBACK( void, doDismount, ( Player* obj ) );
|
||||||
DECLARE_CALLBACK( void, onEnterLiquid, ( Player* obj, F32 coverage, const char* type ) );
|
DECLARE_CALLBACK( void, onEnterLiquid, ( Player* obj, F32 coverage, const char* type ) );
|
||||||
DECLARE_CALLBACK( void, onLeaveLiquid, ( Player* obj, const char* type ) );
|
DECLARE_CALLBACK( void, onLeaveLiquid, ( Player* obj, const char* type ) );
|
||||||
DECLARE_CALLBACK( void, animationDone, ( Player* obj ) );
|
DECLARE_CALLBACK( void, animationDone, ( Player* obj, const char* animName) );
|
||||||
DECLARE_CALLBACK( void, onEnterMissionArea, ( Player* obj ) );
|
DECLARE_CALLBACK( void, onEnterMissionArea, ( Player* obj ) );
|
||||||
DECLARE_CALLBACK( void, onLeaveMissionArea, ( Player* obj ) );
|
DECLARE_CALLBACK( void, onLeaveMissionArea, ( Player* obj ) );
|
||||||
/// @}
|
/// @}
|
||||||
|
|
@ -501,6 +501,7 @@ protected:
|
||||||
bool holdAtEnd;
|
bool holdAtEnd;
|
||||||
bool animateOnServer;
|
bool animateOnServer;
|
||||||
bool atEnd;
|
bool atEnd;
|
||||||
|
bool callbackTripped;
|
||||||
} mActionAnimation;
|
} mActionAnimation;
|
||||||
|
|
||||||
struct ArmAnimation {
|
struct ArmAnimation {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue