|
|
@ -1358,13 +1358,11 @@ bool PushWalk::PreCondition(double time, float elapsed) |
|
|
|
//
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
bool PushSimpleMultiStage(plArmatureMod *avatar, const char *enterAnim, const char *idleAnim, const char *exitAnim, |
|
|
|
static bool CanPushGenericBrain(plArmatureMod* avatar, const char** anims, size_t numAnims, plAvBrainGeneric::BrainType type) |
|
|
|
bool netPropagate, bool autoExit, plAGAnim::BodyUsage bodyUsage, plAvBrainGeneric::BrainType type /* = kGeneric */) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
plAvBrainHuman *huBrain = plAvBrainHuman::ConvertNoRef(avatar->FindBrainByClass(plAvBrainHuman::Index())); |
|
|
|
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() || |
|
|
|
if (!huBrain || !huBrain->fWalkingStrategy->IsOnGround() || !huBrain->fWalkingStrategy->HitGroundInThisAge() || huBrain->IsRunningTask() || |
|
|
|
!avatar->IsPhysicsEnabled() || avatar->FindMatchingGenericBrain(names, 3)) |
|
|
|
!avatar->IsPhysicsEnabled() || avatar->FindMatchingGenericBrain(anims, numAnims)) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
// XXX
|
|
|
|
// XXX
|
|
|
@ -1375,6 +1373,17 @@ bool PushSimpleMultiStage(plArmatureMod *avatar, const char *enterAnim, const ch |
|
|
|
return false; |
|
|
|
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
|
|
|
|
// 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
|
|
|
|
// key. otherwise, we'll loop until someone sends a message telling us explicitly to advance
|
|
|
|
plAnimStage::AdvanceType idleAdvance = autoExit ? plAnimStage::kAdvanceOnMove : plAnimStage::kAdvanceNone; |
|
|
|
plAnimStage::AdvanceType idleAdvance = autoExit ? plAnimStage::kAdvanceOnMove : plAnimStage::kAdvanceNone; |
|
|
@ -1412,6 +1421,33 @@ bool PushSimpleMultiStage(plArmatureMod *avatar, const char *enterAnim, const ch |
|
|
|
return true; |
|
|
|
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 AvatarEmote(plArmatureMod *avatar, const char *emoteName) |
|
|
|
{ |
|
|
|
{ |
|
|
|
bool result = false; |
|
|
|
bool result = false; |
|
|
|