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();
|
||||
|
||||
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
|
||||
|
||||
|
@ -309,7 +309,7 @@ bool plAnimStage::ISendNotify(uint32_t notifyMask, uint32_t notifyType, plArmatu
|
||||
int stageNum = genBrain ? genBrain->GetStageNum(this) : -1;
|
||||
msg->AddMultiStageEvent(stageNum, notifyType, armature->GetTarget(0)->GetKey());
|
||||
|
||||
if (! genBrain->RelayNotifyMsg(msg) )
|
||||
if (!genBrain || !genBrain->RelayNotifyMsg(msg))
|
||||
{
|
||||
msg->UnRef(); // couldn't send; destroy...
|
||||
}
|
||||
|
@ -177,20 +177,21 @@ plAvBrainClimb::~plAvBrainClimb()
|
||||
if(fExitStage)
|
||||
fExitStage->Detach(fAvMod);
|
||||
}
|
||||
if(fUp) delete fUp;
|
||||
if(fDown) delete fDown;
|
||||
if(fLeft) delete fLeft;
|
||||
if(fRight) delete fRight;
|
||||
if(fMountUp) delete fMountUp;
|
||||
if(fMountDown) delete fMountDown;
|
||||
if(fMountLeft) delete fMountLeft;
|
||||
if(fMountRight) delete fMountRight;
|
||||
if(fDismountUp) delete fDismountUp;
|
||||
if(fDismountLeft) delete fDismountLeft;
|
||||
if(fDismountRight) delete fDismountRight;
|
||||
if(fIdle) delete fIdle;
|
||||
// if(fRelease) delete fRelease;
|
||||
// if(fFallOff) delete fFallOff;
|
||||
delete fUp;
|
||||
delete fDown;
|
||||
delete fLeft;
|
||||
delete fRight;
|
||||
delete fMountUp;
|
||||
delete fMountDown;
|
||||
delete fMountLeft;
|
||||
delete fMountRight;
|
||||
delete fDismountUp;
|
||||
delete fDismountDown;
|
||||
delete fDismountLeft;
|
||||
delete fDismountRight;
|
||||
delete fIdle;
|
||||
delete fRelease;
|
||||
delete fFallOff;
|
||||
}
|
||||
|
||||
// ACTIVATE
|
||||
|
@ -251,7 +251,7 @@ plKey plAvBrainCoop::GetRecipient()
|
||||
return fRecipients[0];
|
||||
}
|
||||
|
||||
void plAvBrainCoop::SetRecipient(plKey &recipient)
|
||||
void plAvBrainCoop::SetRecipient(const plKey &recipient)
|
||||
{
|
||||
fRecipients.push_back(recipient);
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ public:
|
||||
uint16_t GetInitiatorSerial();
|
||||
|
||||
virtual plKey GetRecipient();
|
||||
virtual void SetRecipient(plKey &recipient);
|
||||
virtual void SetRecipient(const plKey &recipient);
|
||||
|
||||
private:
|
||||
uint32_t fInitiatorID;
|
||||
|
@ -214,7 +214,7 @@ void plAvBrainGeneric::Activate(plArmatureModBase *avMod)
|
||||
fAvMod->SetReverseFBOnIdle(true);
|
||||
}
|
||||
|
||||
bool plAvBrainGeneric::IsRunningTask()
|
||||
bool plAvBrainGeneric::IsRunningTask() const
|
||||
{
|
||||
if ( fStages->size() > 0 )
|
||||
return true;
|
||||
|
@ -169,7 +169,7 @@ public:
|
||||
/** We're leaving the age. Clean up. */
|
||||
virtual bool LeaveAge();
|
||||
|
||||
virtual bool IsRunningTask();
|
||||
virtual bool IsRunningTask() const;
|
||||
|
||||
/** Compare the names of the anims in our stages.
|
||||
Return true on a match (order matters). */
|
||||
|
@ -232,9 +232,10 @@ public:
|
||||
const float plAvBrainSwim::kMinSwimDepth = 4.0f;
|
||||
|
||||
plAvBrainSwim::plAvBrainSwim() :
|
||||
fSwimStrategy(nil),
|
||||
fSwimStrategy(nullptr),
|
||||
fMode(kWalking),
|
||||
fSurfaceDistance(0.f)
|
||||
fSurfaceDistance(0.f),
|
||||
fCurrentRegion(nullptr)
|
||||
{
|
||||
fSurfaceProbeMsg = new plLOSRequestMsg();
|
||||
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)
|
||||
{
|
||||
uint32_t index = fItems.Find(item);
|
||||
if (index != fItems.kMissingIndex)
|
||||
if (fAvatar && index != fItems.kMissingIndex)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < fAvatar->GetNumLOD(); i++)
|
||||
for (uint8_t i = 0; i < fAvatar->GetNumLOD(); i++)
|
||||
{
|
||||
if (item->fMeshes[i]->fMorphSet == nil)
|
||||
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.
|
||||
void plClothingOutfit::IInstanceSharedMeshes(plClothingItem *item)
|
||||
{
|
||||
if (fAvatar)
|
||||
fAvatar->ValidateMesh();
|
||||
if (!fAvatar)
|
||||
return;
|
||||
|
||||
fAvatar->ValidateMesh();
|
||||
|
||||
bool partialSort = (item->fCustomText.Find("NeedsSort") >= 0);
|
||||
for (int i = 0; i < plClothingItem::kMaxNumLODLevels; 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()));
|
||||
if (idi)
|
||||
|
@ -660,9 +660,6 @@ bool plAvOneShotTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, dou
|
||||
|
||||
if(--fWaitFrames == 0)
|
||||
{
|
||||
|
||||
plSceneObject *handle = avatar->GetTarget(0);
|
||||
|
||||
avatar->DetachAnimation(fAnimInstance);
|
||||
avatar->GetRootAnimator()->Enable(false);
|
||||
plAvBrainHuman *humanBrain = plAvBrainHuman::ConvertNoRef(brain);
|
||||
|
@ -302,7 +302,8 @@ void plClothingSDLModifier::HandleSingleSDR(const plStateDataRecord *sdr, plClot
|
||||
{
|
||||
uint8_t blend;
|
||||
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);
|
||||
if(targetBone)
|
||||
{
|
||||
plAvSeekMsg *seekMsg = new plAvSeekMsg( nil, nil,targetBone->GetKey(), 0, true, kAlignHandle, "", false, plAvSeekMsg::kSeekFlagNoWarpOnTimeout, GetKey());
|
||||
plAvTaskSeek *seekT = new plAvTaskSeek(seekMsg);
|
||||
plAvTaskMsg *seekM = new plAvTaskMsg(GetKey(), fGuestKey, seekT);
|
||||
seekM->SetBCastFlag(plMessage::kPropagateToModifiers);
|
||||
seekM->Send();
|
||||
plAvSeekMsg *seekMsg = new plAvSeekMsg(GetKey(), fGuestKey, targetBone->GetKey(), 0, true, kAlignHandle, "", false, plAvSeekMsg::kSeekFlagNoWarpOnTimeout, GetKey());
|
||||
seekMsg->SetBCastFlag(plMessage::kPropagateToModifiers);
|
||||
seekMsg->Send();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -317,9 +317,12 @@ void plMatrixTimeScale::Dump(int indent, bool optimized, double time)
|
||||
// ctor ----------------------
|
||||
// -----
|
||||
plMatrixBlend::plMatrixBlend()
|
||||
: fChannelA(nil),
|
||||
fChannelB(nil),
|
||||
fChannelBias(nil)
|
||||
: fChannelA(nullptr),
|
||||
fOptimizedA(nullptr),
|
||||
fChannelB(nullptr),
|
||||
fOptimizedB(nullptr),
|
||||
fChannelBias(nullptr),
|
||||
fPriority(0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -793,11 +796,8 @@ void plMatrixDelayedCorrectionApplicator::SetCorrection(hsMatrix44 &cor)
|
||||
bool plMatrixDelayedCorrectionApplicator::CanBlend(plAGApplicator *app)
|
||||
{
|
||||
plMatrixChannelApplicator *matChannelApp = plMatrixChannelApplicator::ConvertNoRef(app);
|
||||
|
||||
if( plMatrixChannelApplicator::ConvertNoRef(app) )
|
||||
{
|
||||
if (matChannelApp)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -875,11 +875,8 @@ void plMatrixDifferenceApp::Reset(double time)
|
||||
bool plMatrixDifferenceApp::CanBlend(plAGApplicator *app)
|
||||
{
|
||||
plMatrixChannelApplicator *matChannelApp = plMatrixChannelApplicator::ConvertNoRef(app);
|
||||
|
||||
if( plMatrixChannelApplicator::ConvertNoRef(app) )
|
||||
{
|
||||
if (matChannelApp)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -214,8 +214,9 @@ plAGChannel * plPointTimeScale::Detach(plAGChannel * channel)
|
||||
// ctor --------------------
|
||||
// -----
|
||||
plPointBlend::plPointBlend()
|
||||
: fPointA(nil),
|
||||
fPointB(nil)
|
||||
: fPointA(nullptr),
|
||||
fPointB(nullptr),
|
||||
fChannelBias(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@ -274,14 +275,10 @@ const hsPoint3 &plPointBlend::Value(double time)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (fPointA)
|
||||
{
|
||||
if (fPointA) {
|
||||
fResult = fPointA->Value(time);
|
||||
} else {
|
||||
if (fPointB)
|
||||
{
|
||||
fResult = fPointA->Value(time);
|
||||
}
|
||||
} else if (fPointB) {
|
||||
fResult = fPointB->Value(time);
|
||||
}
|
||||
}
|
||||
return fResult;
|
||||
|
@ -82,24 +82,20 @@ void plQuatChannel::Value(hsQuat &quat, double time)
|
||||
// CANCOMBINE
|
||||
bool plQuatChannel::CanCombine(plAGChannel *channelA)
|
||||
{
|
||||
return false;
|
||||
if(plPointChannel::ConvertNoRef(channelA))
|
||||
{
|
||||
return true;
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// MAKECOMBINE
|
||||
plAGChannel * plQuatChannel::MakeCombine(plAGChannel *channelA)
|
||||
{
|
||||
if(plPointChannel::ConvertNoRef(channelA))
|
||||
{
|
||||
return new plQuatPointCombine(this, (plPointChannel *)channelA);
|
||||
} else {
|
||||
return nil;
|
||||
}
|
||||
plPointChannel* channel = plPointChannel::ConvertNoRef(channelA);
|
||||
if(channel)
|
||||
return new plQuatPointCombine(this, channel);
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// MAKEBLEND
|
||||
|
@ -302,20 +302,19 @@ plAvBrainGeneric *plSittingModifier::IBuildSitBrain(plKey avModKey, plKey seekKe
|
||||
{
|
||||
plArmatureMod *avatar = plArmatureMod::ConvertNoRef(avModKey->ObjectIsLoaded());
|
||||
plSceneObject *seekObj = plSceneObject::ConvertNoRef(seekKey->ObjectIsLoaded());
|
||||
hsMatrix44 animEndToStart;
|
||||
hsMatrix44 sitGoal = seekObj->GetLocalToWorld();
|
||||
hsMatrix44 candidateGoal;
|
||||
float closestDist = 0.0f;
|
||||
uint8_t closestApproach = 0;
|
||||
hsPoint3 curPosition = avatar->GetTarget(0)->GetLocalToWorld().GetTranslate();
|
||||
const char* sitAnimName = nil;
|
||||
const char* sitAnimName = nullptr;
|
||||
const char* standAnimName = "StandUpFront"; // always prefer to stand facing front
|
||||
|
||||
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))
|
||||
{
|
||||
closestApproach = kApproachLeft;
|
||||
@ -323,6 +322,7 @@ plAvBrainGeneric *plSittingModifier::IBuildSitBrain(plKey avModKey, plKey seekKe
|
||||
if(!frontClear)
|
||||
standAnimName = "StandUpLeft";
|
||||
}
|
||||
|
||||
if(fMiscFlags & kApproachRight && IIsClosestAnim("SitRight", sitGoal, closestDist, curPosition, avatar))
|
||||
{
|
||||
closestApproach = kApproachRight;
|
||||
@ -330,6 +330,7 @@ plAvBrainGeneric *plSittingModifier::IBuildSitBrain(plKey avModKey, plKey seekKe
|
||||
if(!frontClear)
|
||||
standAnimName = "StandUpRight";
|
||||
}
|
||||
|
||||
if(frontClear && IIsClosestAnim("SitFront", sitGoal, closestDist, curPosition, avatar))
|
||||
{
|
||||
sitAnimName = "SitFront";
|
||||
|
Reference in New Issue
Block a user