mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 19:29:09 +00:00
@ -1358,13 +1358,11 @@ bool PushWalk::PreCondition(double time, float elapsed)
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool PushSimpleMultiStage(plArmatureMod *avatar, const char *enterAnim, const char *idleAnim, const char *exitAnim,
|
||||
bool netPropagate, bool autoExit, plAGAnim::BodyUsage bodyUsage, plAvBrainGeneric::BrainType type /* = kGeneric */)
|
||||
static bool CanPushGenericBrain(plArmatureMod* avatar, const char** anims, size_t numAnims, plAvBrainGeneric::BrainType type)
|
||||
{
|
||||
plAvBrainHuman *huBrain = plAvBrainHuman::ConvertNoRef(avatar->FindBrainByClass(plAvBrainHuman::Index()));
|
||||
const char *names[3] = {enterAnim, idleAnim, exitAnim};
|
||||
if (!huBrain || !huBrain->fWalkingStrategy->IsOnGround() || !huBrain->fWalkingStrategy->HitGroundInThisAge() || huBrain->IsRunningTask() ||
|
||||
!avatar->IsPhysicsEnabled() || avatar->FindMatchingGenericBrain(names, 3))
|
||||
!avatar->IsPhysicsEnabled() || avatar->FindMatchingGenericBrain(anims, numAnims))
|
||||
return false;
|
||||
|
||||
// XXX
|
||||
@ -1375,6 +1373,17 @@ bool PushSimpleMultiStage(plArmatureMod *avatar, const char *enterAnim, const ch
|
||||
return false;
|
||||
}
|
||||
|
||||
// still here??? W00T!
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PushSimpleMultiStage(plArmatureMod *avatar, const char *enterAnim, const char *idleAnim, const char *exitAnim,
|
||||
bool netPropagate, bool autoExit, plAGAnim::BodyUsage bodyUsage, plAvBrainGeneric::BrainType type /* = kGeneric */)
|
||||
{
|
||||
const char* names[3] = {enterAnim, idleAnim, exitAnim};
|
||||
if (!CanPushGenericBrain(avatar, names, arrsize(names), type))
|
||||
return false;
|
||||
|
||||
// if autoExit is true, then we will immediately exit the idle loop when the user hits a move
|
||||
// key. otherwise, we'll loop until someone sends a message telling us explicitly to advance
|
||||
plAnimStage::AdvanceType idleAdvance = autoExit ? plAnimStage::kAdvanceOnMove : plAnimStage::kAdvanceNone;
|
||||
@ -1412,6 +1421,33 @@ bool PushSimpleMultiStage(plArmatureMod *avatar, const char *enterAnim, const ch
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PushRepeatEmote(plArmatureMod* avatar, const plString& anim)
|
||||
{
|
||||
const char* names[1] = { anim.c_str() };
|
||||
if (!CanPushGenericBrain(avatar, names, arrsize(names), plAvBrainGeneric::kGeneric))
|
||||
return false;
|
||||
|
||||
plAnimStageVec* v = new plAnimStageVec;
|
||||
plAnimStage* theStage = new plAnimStage(anim, 0,
|
||||
plAnimStage::kForwardAuto, plAnimStage::kBackNone,
|
||||
plAnimStage::kAdvanceOnMove, plAnimStage::kRegressNone,
|
||||
-1);
|
||||
v->push_back(theStage);
|
||||
|
||||
plAvBrainGeneric* b = new plAvBrainGeneric(v, nullptr, nullptr, nullptr, plAvBrainGeneric::kExitAnyTask | plAvBrainGeneric::kExitNewBrain,
|
||||
2.0f, 2.0f, plAvBrainGeneric::kMoveStandstill);
|
||||
|
||||
b->SetBodyUsage(plAGAnim::kBodyFull);
|
||||
b->SetType(plAvBrainGeneric::kGeneric);
|
||||
|
||||
plAvTaskBrain* bt = new plAvTaskBrain(b);
|
||||
plAvTaskMsg* btm = new plAvTaskMsg(plAvatarMgr::GetInstance()->GetKey(), avatar->GetKey(), bt);
|
||||
btm->SetBCastFlag(plMessage::kNetPropagate, true);
|
||||
btm->Send();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AvatarEmote(plArmatureMod *avatar, const char *emoteName)
|
||||
{
|
||||
bool result = false;
|
||||
|
@ -402,7 +402,7 @@ public:
|
||||
bool PushSimpleMultiStage(plArmatureMod *avatar, const char *enterAnim, const char *idleAnim,
|
||||
const char *exitAnim, bool netPropagate, bool autoExit, plAGAnim::BodyUsage bodyUsage,
|
||||
plAvBrainGeneric::BrainType type = plAvBrainGeneric::kGeneric);
|
||||
|
||||
bool PushRepeatEmote(plArmatureMod* avatar, const plString& anim);
|
||||
bool AvatarEmote(plArmatureMod *avatar, const char *emoteName);
|
||||
|
||||
|
||||
|
@ -101,7 +101,7 @@ bool plAvTaskSeek::fLogProcess = false;
|
||||
|
||||
void plAvTaskSeek::IInitDefaults()
|
||||
{
|
||||
fSeekObject = nil;
|
||||
fSeekObject = nullptr;
|
||||
fMovingTarget = false;
|
||||
fAlign = kAlignHandle;
|
||||
fAnimName = "";
|
||||
@ -114,7 +114,8 @@ void plAvTaskSeek::IInitDefaults()
|
||||
fMaxSidleAngle = kDefaultMaxSidleAngle;
|
||||
fFlags = kSeekFlagForce3rdPersonOnStart;
|
||||
fState = kSeekRunNormal;
|
||||
fNotifyFinishedKey = nil;
|
||||
fNotifyFinishedKey = nullptr;
|
||||
fFinishMsg = nullptr;
|
||||
}
|
||||
// plAvTaskSeek ------------
|
||||
// -------------
|
||||
@ -158,6 +159,7 @@ plAvTaskSeek::plAvTaskSeek(plAvSeekMsg *msg)
|
||||
fFlags &= ~kSeekFlagRotationOnly;
|
||||
|
||||
fNotifyFinishedKey = msg->fFinishKey;
|
||||
fFinishMsg = msg->fFinishMsg;
|
||||
}
|
||||
|
||||
// plAvTaskSeek ------------------------
|
||||
@ -303,6 +305,9 @@ void plAvTaskSeek::Finish(plArmatureMod *avatar, plArmatureBrain *brain, double
|
||||
//inform controller we are done seeking
|
||||
if (avatar->GetController())
|
||||
avatar->GetController()->SetSeek(false);
|
||||
|
||||
if (fFinishMsg)
|
||||
fFinishMsg->Send();
|
||||
}
|
||||
|
||||
void plAvTaskSeek::LeaveAge(plArmatureMod *avatar)
|
||||
|
@ -156,6 +156,7 @@ protected:
|
||||
plString fAnimName; // an (optional) anim to use to line up our target
|
||||
// so you can say "seek to a place where your hand
|
||||
// will be here after you play animation foo"
|
||||
plMessage* fFinishMsg;
|
||||
|
||||
hsPoint3 fPosition; // our current position
|
||||
hsQuat fRotation; // our current rotation
|
||||
|
Reference in New Issue
Block a user