Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions Engine/source/T3D/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ PlayerData::PlayerData()

physicsPlayerType = StringTable->EmptyString();
mControlMap = StringTable->EmptyString();
mDynamicAnimsStart = NumTableActionAnims;
dMemset( actionList, 0, sizeof(actionList) );
}

Expand Down Expand Up @@ -512,7 +513,7 @@ bool PlayerData::preload(bool server, String &errorStr)
// Extract ground transform velocity from animations
// Get the named ones first so they can be indexed directly.
ActionAnimation *dp = &actionList[0];
for (S32 i = 0; i < NumTableActionAnims; i++,dp++)
for (S32 i = 0; i < mDynamicAnimsStart; i++,dp++)
{
ActionAnimationDef *sp = &ActionAnimationList[i];
dp->name = sp->name;
Expand Down Expand Up @@ -690,7 +691,7 @@ bool PlayerData::isTableSequence(S32 seq)
{
// The sequences from the table must already have
// been loaded for this to work.
for (S32 i = 0; i < NumTableActionAnims; i++)
for (S32 i = 0; i < mDynamicAnimsStart; i++)
if (actionList[i].sequence == seq)
return true;
return false;
Expand Down Expand Up @@ -2801,7 +2802,7 @@ void Player::updateMove(const Move* move)

// Cancel any script driven animations if we are going to move.
if (moveVec.x + moveVec.y + moveVec.z != 0.0f &&
(mActionAnimation.action >= PlayerData::NumTableActionAnims
(mActionAnimation.action >= mDataBlock->mDynamicAnimsStart
|| mActionAnimation.action == PlayerData::LandAnim))
mActionAnimation.action = PlayerData::NullAnimation;
}
Expand Down Expand Up @@ -3711,7 +3712,7 @@ bool Player::inSittingAnim()
U32 action = mActionAnimation.action;
if (mActionAnimation.thread && action < mDataBlock->actionCount) {
const char * name = mDataBlock->actionList[action].name;
if (!dStricmp(name, "Sitting") || !dStricmp(name, "Scoutroot"))
if (name && (!dStricmp(name, "Sitting") || !dStricmp(name, "Scoutroot")))
return true;
}
return false;
Expand Down Expand Up @@ -3956,7 +3957,7 @@ void Player::updateActionThread()
if (mMountPending)
mMountPending = (isMounted() ? 0 : (mMountPending - 1));

if (isServerObject() && (mActionAnimation.action >= PlayerData::NumTableActionAnims) && mActionAnimation.atEnd)
if (isServerObject() && (mActionAnimation.action >= mDataBlock->mDynamicAnimsStart) && 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...
Expand Down Expand Up @@ -4057,7 +4058,7 @@ void Player::pickActionAnimation()
// Go into root position unless something was set explicitly
// from a script.
if (mActionAnimation.action != PlayerData::RootAnim &&
mActionAnimation.action < PlayerData::NumTableActionAnims)
mActionAnimation.action < mDataBlock->mDynamicAnimsStart)
setActionThread(PlayerData::RootAnim,true,false,false);
return;
}
Expand Down Expand Up @@ -5956,7 +5957,7 @@ void Player::getMuzzlePointAI(U32 imageSlot, Point3F* point)

// If we are in one of the standard player animations, adjust the
// muzzle to point in the direction we are looking.
if (mActionAnimation.action < PlayerData::NumTableActionAnims)
if (mActionAnimation.action < mDataBlock->mDynamicAnimsStart)
{
MatrixF xmat;
xmat.set(EulerF(mHead.x, 0, 0));
Expand Down Expand Up @@ -6340,7 +6341,7 @@ U32 Player::packUpdate(NetConnection *con, U32 mask, BitStream *stream)

if (stream->writeFlag(mask & ActionMask &&
mActionAnimation.action != PlayerData::NullAnimation &&
mActionAnimation.action >= PlayerData::NumTableActionAnims)) {
mActionAnimation.action >= mDataBlock->mDynamicAnimsStart)) {
stream->writeInt(mActionAnimation.action,PlayerData::ActionAnimBits);
stream->writeFlag(mActionAnimation.holdAtEnd);
stream->writeFlag(mActionAnimation.atEnd);
Expand Down
4 changes: 2 additions & 2 deletions Engine/source/T3D/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ struct PlayerData: public ShapeBaseData /*protected AssetPtrCallback < already i
ActionAnimBits = 9,
NullAnimation = (1 << ActionAnimBits) - 1
};

int mDynamicAnimsStart;
static ActionAnimationDef ActionAnimationList[NumTableActionAnims];
ActionAnimation actionList[NumActionAnims];
U32 actionCount;
Expand Down Expand Up @@ -402,9 +402,9 @@ struct PlayerData: public ShapeBaseData /*protected AssetPtrCallback < already i

class Player: public ShapeBase
{
public:
typedef ShapeBase Parent;

public:
enum Pose {
StandPose = 0,
SprintPose,
Expand Down
Loading