mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 11:19:10 +00:00
Fixes for plAvatar
This commit is contained in:
@ -171,7 +171,7 @@ void plAGModifier::SetApplicator(plAGApplicator *newApp)
|
|||||||
|
|
||||||
plAGChannel *newChannel = newApp->GetChannel();
|
plAGChannel *newChannel = newApp->GetChannel();
|
||||||
|
|
||||||
hsAssert(newChannel = nil, "Trying to merge in new applicator which already has channel. Incomplete.");
|
hsAssert(!newChannel, "Trying to merge in new applicator which already has channel. Incomplete.");
|
||||||
|
|
||||||
// *** right now I just want to support the case of putting in a new applicator - not merging animations
|
// *** right now I just want to support the case of putting in a new applicator - not merging animations
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ bool plAnimStage::ISendNotify(uint32_t notifyMask, uint32_t notifyType, plArmatu
|
|||||||
int stageNum = genBrain ? genBrain->GetStageNum(this) : -1;
|
int stageNum = genBrain ? genBrain->GetStageNum(this) : -1;
|
||||||
msg->AddMultiStageEvent(stageNum, notifyType, armature->GetTarget(0)->GetKey());
|
msg->AddMultiStageEvent(stageNum, notifyType, armature->GetTarget(0)->GetKey());
|
||||||
|
|
||||||
if (! genBrain->RelayNotifyMsg(msg) )
|
if (!genBrain || !genBrain->RelayNotifyMsg(msg))
|
||||||
{
|
{
|
||||||
msg->UnRef(); // couldn't send; destroy...
|
msg->UnRef(); // couldn't send; destroy...
|
||||||
}
|
}
|
||||||
|
@ -177,20 +177,21 @@ plAvBrainClimb::~plAvBrainClimb()
|
|||||||
if(fExitStage)
|
if(fExitStage)
|
||||||
fExitStage->Detach(fAvMod);
|
fExitStage->Detach(fAvMod);
|
||||||
}
|
}
|
||||||
if(fUp) delete fUp;
|
delete fUp;
|
||||||
if(fDown) delete fDown;
|
delete fDown;
|
||||||
if(fLeft) delete fLeft;
|
delete fLeft;
|
||||||
if(fRight) delete fRight;
|
delete fRight;
|
||||||
if(fMountUp) delete fMountUp;
|
delete fMountUp;
|
||||||
if(fMountDown) delete fMountDown;
|
delete fMountDown;
|
||||||
if(fMountLeft) delete fMountLeft;
|
delete fMountLeft;
|
||||||
if(fMountRight) delete fMountRight;
|
delete fMountRight;
|
||||||
if(fDismountUp) delete fDismountUp;
|
delete fDismountUp;
|
||||||
if(fDismountLeft) delete fDismountLeft;
|
delete fDismountDown;
|
||||||
if(fDismountRight) delete fDismountRight;
|
delete fDismountLeft;
|
||||||
if(fIdle) delete fIdle;
|
delete fDismountRight;
|
||||||
// if(fRelease) delete fRelease;
|
delete fIdle;
|
||||||
// if(fFallOff) delete fFallOff;
|
delete fRelease;
|
||||||
|
delete fFallOff;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ACTIVATE
|
// ACTIVATE
|
||||||
|
@ -251,7 +251,7 @@ plKey plAvBrainCoop::GetRecipient()
|
|||||||
return fRecipients[0];
|
return fRecipients[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
void plAvBrainCoop::SetRecipient(plKey &recipient)
|
void plAvBrainCoop::SetRecipient(const plKey &recipient)
|
||||||
{
|
{
|
||||||
fRecipients.push_back(recipient);
|
fRecipients.push_back(recipient);
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ public:
|
|||||||
uint16_t GetInitiatorSerial();
|
uint16_t GetInitiatorSerial();
|
||||||
|
|
||||||
virtual plKey GetRecipient();
|
virtual plKey GetRecipient();
|
||||||
virtual void SetRecipient(plKey &recipient);
|
virtual void SetRecipient(const plKey &recipient);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t fInitiatorID;
|
uint32_t fInitiatorID;
|
||||||
|
@ -214,7 +214,7 @@ void plAvBrainGeneric::Activate(plArmatureModBase *avMod)
|
|||||||
fAvMod->SetReverseFBOnIdle(true);
|
fAvMod->SetReverseFBOnIdle(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool plAvBrainGeneric::IsRunningTask()
|
bool plAvBrainGeneric::IsRunningTask() const
|
||||||
{
|
{
|
||||||
if ( fStages->size() > 0 )
|
if ( fStages->size() > 0 )
|
||||||
return true;
|
return true;
|
||||||
|
@ -169,7 +169,7 @@ public:
|
|||||||
/** We're leaving the age. Clean up. */
|
/** We're leaving the age. Clean up. */
|
||||||
virtual bool LeaveAge();
|
virtual bool LeaveAge();
|
||||||
|
|
||||||
virtual bool IsRunningTask();
|
virtual bool IsRunningTask() const;
|
||||||
|
|
||||||
/** Compare the names of the anims in our stages.
|
/** Compare the names of the anims in our stages.
|
||||||
Return true on a match (order matters). */
|
Return true on a match (order matters). */
|
||||||
|
@ -232,9 +232,10 @@ public:
|
|||||||
const float plAvBrainSwim::kMinSwimDepth = 4.0f;
|
const float plAvBrainSwim::kMinSwimDepth = 4.0f;
|
||||||
|
|
||||||
plAvBrainSwim::plAvBrainSwim() :
|
plAvBrainSwim::plAvBrainSwim() :
|
||||||
fSwimStrategy(nil),
|
fSwimStrategy(nullptr),
|
||||||
fMode(kWalking),
|
fMode(kWalking),
|
||||||
fSurfaceDistance(0.f)
|
fSurfaceDistance(0.f),
|
||||||
|
fCurrentRegion(nullptr)
|
||||||
{
|
{
|
||||||
fSurfaceProbeMsg = new plLOSRequestMsg();
|
fSurfaceProbeMsg = new plLOSRequestMsg();
|
||||||
fSurfaceProbeMsg->SetReportType(plLOSRequestMsg::kReportHitOrMiss);
|
fSurfaceProbeMsg->SetReportType(plLOSRequestMsg::kReportHitOrMiss);
|
||||||
|
@ -701,10 +701,9 @@ hsColorRGBA plClothingOutfit::GetItemTint(plClothingItem *item, uint8_t layer /*
|
|||||||
bool plClothingOutfit::IMorphItem(plClothingItem *item, uint8_t layer, uint8_t delta, float weight)
|
bool plClothingOutfit::IMorphItem(plClothingItem *item, uint8_t layer, uint8_t delta, float weight)
|
||||||
{
|
{
|
||||||
uint32_t index = fItems.Find(item);
|
uint32_t index = fItems.Find(item);
|
||||||
if (index != fItems.kMissingIndex)
|
if (fAvatar && index != fItems.kMissingIndex)
|
||||||
{
|
{
|
||||||
int i;
|
for (uint8_t i = 0; i < fAvatar->GetNumLOD(); i++)
|
||||||
for (i = 0; i < fAvatar->GetNumLOD(); i++)
|
|
||||||
{
|
{
|
||||||
if (item->fMeshes[i]->fMorphSet == nil)
|
if (item->fMeshes[i]->fMorphSet == nil)
|
||||||
continue;
|
continue;
|
||||||
@ -1420,14 +1419,16 @@ bool plClothingOutfit::DirtySynchState(const plString& SDLStateName, uint32_t sy
|
|||||||
// we'll be good about this, but I wanted to get it working first.
|
// we'll be good about this, but I wanted to get it working first.
|
||||||
void plClothingOutfit::IInstanceSharedMeshes(plClothingItem *item)
|
void plClothingOutfit::IInstanceSharedMeshes(plClothingItem *item)
|
||||||
{
|
{
|
||||||
if (fAvatar)
|
if (!fAvatar)
|
||||||
fAvatar->ValidateMesh();
|
return;
|
||||||
|
|
||||||
|
fAvatar->ValidateMesh();
|
||||||
|
|
||||||
bool partialSort = (item->fCustomText.Find("NeedsSort") >= 0);
|
bool partialSort = (item->fCustomText.Find("NeedsSort") >= 0);
|
||||||
for (int i = 0; i < plClothingItem::kMaxNumLODLevels; i++)
|
for (int i = 0; i < plClothingItem::kMaxNumLODLevels; i++)
|
||||||
{
|
{
|
||||||
const plSceneObject *so = fAvatar->GetClothingSO(i);
|
const plSceneObject *so = fAvatar->GetClothingSO(i);
|
||||||
if (so != nil && item->fMeshes[i] != nil)
|
if (so && item->fMeshes[i])
|
||||||
{
|
{
|
||||||
plInstanceDrawInterface *idi = const_cast<plInstanceDrawInterface*>(plInstanceDrawInterface::ConvertNoRef(so->GetDrawInterface()));
|
plInstanceDrawInterface *idi = const_cast<plInstanceDrawInterface*>(plInstanceDrawInterface::ConvertNoRef(so->GetDrawInterface()));
|
||||||
if (idi)
|
if (idi)
|
||||||
|
@ -660,9 +660,6 @@ bool plAvOneShotTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, dou
|
|||||||
|
|
||||||
if(--fWaitFrames == 0)
|
if(--fWaitFrames == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
plSceneObject *handle = avatar->GetTarget(0);
|
|
||||||
|
|
||||||
avatar->DetachAnimation(fAnimInstance);
|
avatar->DetachAnimation(fAnimInstance);
|
||||||
avatar->GetRootAnimator()->Enable(false);
|
avatar->GetRootAnimator()->Enable(false);
|
||||||
plAvBrainHuman *humanBrain = plAvBrainHuman::ConvertNoRef(brain);
|
plAvBrainHuman *humanBrain = plAvBrainHuman::ConvertNoRef(brain);
|
||||||
|
@ -302,7 +302,8 @@ void plClothingSDLModifier::HandleSingleSDR(const plStateDataRecord *sdr, plClot
|
|||||||
{
|
{
|
||||||
uint8_t blend;
|
uint8_t blend;
|
||||||
faceBlends->Get(&blend, i);
|
faceBlends->Get(&blend, i);
|
||||||
clothing->fSkinBlends[i] = (float)blend / 255;
|
if (clothing)
|
||||||
|
clothing->fSkinBlends[i] = (float)blend / 255;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -327,11 +327,9 @@ void plCoopCoordinator::IStartGuest()
|
|||||||
const plSceneObject *targetBone = hostAv->FindBone(fSynchBone);
|
const plSceneObject *targetBone = hostAv->FindBone(fSynchBone);
|
||||||
if(targetBone)
|
if(targetBone)
|
||||||
{
|
{
|
||||||
plAvSeekMsg *seekMsg = new plAvSeekMsg( nil, nil,targetBone->GetKey(), 0, true, kAlignHandle, "", false, plAvSeekMsg::kSeekFlagNoWarpOnTimeout, GetKey());
|
plAvSeekMsg *seekMsg = new plAvSeekMsg(GetKey(), fGuestKey, targetBone->GetKey(), 0, true, kAlignHandle, "", false, plAvSeekMsg::kSeekFlagNoWarpOnTimeout, GetKey());
|
||||||
plAvTaskSeek *seekT = new plAvTaskSeek(seekMsg);
|
seekMsg->SetBCastFlag(plMessage::kPropagateToModifiers);
|
||||||
plAvTaskMsg *seekM = new plAvTaskMsg(GetKey(), fGuestKey, seekT);
|
seekMsg->Send();
|
||||||
seekM->SetBCastFlag(plMessage::kPropagateToModifiers);
|
|
||||||
seekM->Send();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -317,9 +317,12 @@ void plMatrixTimeScale::Dump(int indent, bool optimized, double time)
|
|||||||
// ctor ----------------------
|
// ctor ----------------------
|
||||||
// -----
|
// -----
|
||||||
plMatrixBlend::plMatrixBlend()
|
plMatrixBlend::plMatrixBlend()
|
||||||
: fChannelA(nil),
|
: fChannelA(nullptr),
|
||||||
fChannelB(nil),
|
fOptimizedA(nullptr),
|
||||||
fChannelBias(nil)
|
fChannelB(nullptr),
|
||||||
|
fOptimizedB(nullptr),
|
||||||
|
fChannelBias(nullptr),
|
||||||
|
fPriority(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -793,11 +796,8 @@ void plMatrixDelayedCorrectionApplicator::SetCorrection(hsMatrix44 &cor)
|
|||||||
bool plMatrixDelayedCorrectionApplicator::CanBlend(plAGApplicator *app)
|
bool plMatrixDelayedCorrectionApplicator::CanBlend(plAGApplicator *app)
|
||||||
{
|
{
|
||||||
plMatrixChannelApplicator *matChannelApp = plMatrixChannelApplicator::ConvertNoRef(app);
|
plMatrixChannelApplicator *matChannelApp = plMatrixChannelApplicator::ConvertNoRef(app);
|
||||||
|
if (matChannelApp)
|
||||||
if( plMatrixChannelApplicator::ConvertNoRef(app) )
|
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -875,11 +875,8 @@ void plMatrixDifferenceApp::Reset(double time)
|
|||||||
bool plMatrixDifferenceApp::CanBlend(plAGApplicator *app)
|
bool plMatrixDifferenceApp::CanBlend(plAGApplicator *app)
|
||||||
{
|
{
|
||||||
plMatrixChannelApplicator *matChannelApp = plMatrixChannelApplicator::ConvertNoRef(app);
|
plMatrixChannelApplicator *matChannelApp = plMatrixChannelApplicator::ConvertNoRef(app);
|
||||||
|
if (matChannelApp)
|
||||||
if( plMatrixChannelApplicator::ConvertNoRef(app) )
|
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,8 +214,9 @@ plAGChannel * plPointTimeScale::Detach(plAGChannel * channel)
|
|||||||
// ctor --------------------
|
// ctor --------------------
|
||||||
// -----
|
// -----
|
||||||
plPointBlend::plPointBlend()
|
plPointBlend::plPointBlend()
|
||||||
: fPointA(nil),
|
: fPointA(nullptr),
|
||||||
fPointB(nil)
|
fPointB(nullptr),
|
||||||
|
fChannelBias(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,14 +275,10 @@ const hsPoint3 &plPointBlend::Value(double time)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (fPointA)
|
if (fPointA) {
|
||||||
{
|
|
||||||
fResult = fPointA->Value(time);
|
fResult = fPointA->Value(time);
|
||||||
} else {
|
} else if (fPointB) {
|
||||||
if (fPointB)
|
fResult = fPointB->Value(time);
|
||||||
{
|
|
||||||
fResult = fPointA->Value(time);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fResult;
|
return fResult;
|
||||||
|
@ -82,24 +82,20 @@ void plQuatChannel::Value(hsQuat &quat, double time)
|
|||||||
// CANCOMBINE
|
// CANCOMBINE
|
||||||
bool plQuatChannel::CanCombine(plAGChannel *channelA)
|
bool plQuatChannel::CanCombine(plAGChannel *channelA)
|
||||||
{
|
{
|
||||||
return false;
|
|
||||||
if(plPointChannel::ConvertNoRef(channelA))
|
if(plPointChannel::ConvertNoRef(channelA))
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MAKECOMBINE
|
// MAKECOMBINE
|
||||||
plAGChannel * plQuatChannel::MakeCombine(plAGChannel *channelA)
|
plAGChannel * plQuatChannel::MakeCombine(plAGChannel *channelA)
|
||||||
{
|
{
|
||||||
if(plPointChannel::ConvertNoRef(channelA))
|
plPointChannel* channel = plPointChannel::ConvertNoRef(channelA);
|
||||||
{
|
if(channel)
|
||||||
return new plQuatPointCombine(this, (plPointChannel *)channelA);
|
return new plQuatPointCombine(this, channel);
|
||||||
} else {
|
else
|
||||||
return nil;
|
return nullptr;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MAKEBLEND
|
// MAKEBLEND
|
||||||
|
@ -302,20 +302,19 @@ plAvBrainGeneric *plSittingModifier::IBuildSitBrain(plKey avModKey, plKey seekKe
|
|||||||
{
|
{
|
||||||
plArmatureMod *avatar = plArmatureMod::ConvertNoRef(avModKey->ObjectIsLoaded());
|
plArmatureMod *avatar = plArmatureMod::ConvertNoRef(avModKey->ObjectIsLoaded());
|
||||||
plSceneObject *seekObj = plSceneObject::ConvertNoRef(seekKey->ObjectIsLoaded());
|
plSceneObject *seekObj = plSceneObject::ConvertNoRef(seekKey->ObjectIsLoaded());
|
||||||
hsMatrix44 animEndToStart;
|
|
||||||
hsMatrix44 sitGoal = seekObj->GetLocalToWorld();
|
|
||||||
hsMatrix44 candidateGoal;
|
|
||||||
float closestDist = 0.0f;
|
float closestDist = 0.0f;
|
||||||
uint8_t closestApproach = 0;
|
uint8_t closestApproach = 0;
|
||||||
hsPoint3 curPosition = avatar->GetTarget(0)->GetLocalToWorld().GetTranslate();
|
const char* sitAnimName = nullptr;
|
||||||
const char* sitAnimName = nil;
|
|
||||||
const char* standAnimName = "StandUpFront"; // always prefer to stand facing front
|
const char* standAnimName = "StandUpFront"; // always prefer to stand facing front
|
||||||
|
|
||||||
bool frontClear = fMiscFlags & kApproachFront;
|
bool frontClear = fMiscFlags & kApproachFront;
|
||||||
plAvBrainGeneric *brain = nil;
|
plAvBrainGeneric *brain = nullptr;
|
||||||
|
|
||||||
if(avatar)
|
if(avatar && seekObj)
|
||||||
{
|
{
|
||||||
|
hsMatrix44 sitGoal = seekObj->GetLocalToWorld();
|
||||||
|
hsPoint3 curPosition = avatar->GetTarget(0)->GetLocalToWorld().GetTranslate();
|
||||||
|
|
||||||
if(fMiscFlags & kApproachLeft && IIsClosestAnim("SitLeft", sitGoal, closestDist, curPosition, avatar))
|
if(fMiscFlags & kApproachLeft && IIsClosestAnim("SitLeft", sitGoal, closestDist, curPosition, avatar))
|
||||||
{
|
{
|
||||||
closestApproach = kApproachLeft;
|
closestApproach = kApproachLeft;
|
||||||
@ -323,6 +322,7 @@ plAvBrainGeneric *plSittingModifier::IBuildSitBrain(plKey avModKey, plKey seekKe
|
|||||||
if(!frontClear)
|
if(!frontClear)
|
||||||
standAnimName = "StandUpLeft";
|
standAnimName = "StandUpLeft";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(fMiscFlags & kApproachRight && IIsClosestAnim("SitRight", sitGoal, closestDist, curPosition, avatar))
|
if(fMiscFlags & kApproachRight && IIsClosestAnim("SitRight", sitGoal, closestDist, curPosition, avatar))
|
||||||
{
|
{
|
||||||
closestApproach = kApproachRight;
|
closestApproach = kApproachRight;
|
||||||
@ -330,6 +330,7 @@ plAvBrainGeneric *plSittingModifier::IBuildSitBrain(plKey avModKey, plKey seekKe
|
|||||||
if(!frontClear)
|
if(!frontClear)
|
||||||
standAnimName = "StandUpRight";
|
standAnimName = "StandUpRight";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(frontClear && IIsClosestAnim("SitFront", sitGoal, closestDist, curPosition, avatar))
|
if(frontClear && IIsClosestAnim("SitFront", sitGoal, closestDist, curPosition, avatar))
|
||||||
{
|
{
|
||||||
sitAnimName = "SitFront";
|
sitAnimName = "SitFront";
|
||||||
|
Reference in New Issue
Block a user