Merge branch 'TorqueGameEngines:development' into Sir-Skurpsalot-player_fixes_&_tweaks

This commit is contained in:
Sir-Skurpsalot 2026-05-02 19:14:04 -06:00 committed by GitHub
commit 80eaaff7fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 2723 additions and 2305 deletions

View file

@ -465,6 +465,7 @@ PlayerData::PlayerData()
physicsPlayerType = StringTable->EmptyString();
mControlMap = StringTable->EmptyString();
mDynamicAnimsStart = NumTableActionAnims;
dMemset( actionList, 0, sizeof(actionList) );
}
@ -516,7 +517,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;
@ -694,7 +695,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;
@ -2834,7 +2835,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;
}
@ -3729,7 +3730,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;
@ -3979,7 +3980,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...
@ -4080,7 +4081,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;
}
@ -5978,7 +5979,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));
@ -6362,7 +6363,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);