|
|
@ -215,47 +215,26 @@ void cyAvatar::OneShot(pyKey &seekKey, float duration, bool usePhysics, |
|
|
|
void cyAvatar::RunBehavior(pyKey &behKey, bool netForce, bool netProp) |
|
|
|
void cyAvatar::RunBehavior(pyKey &behKey, bool netForce, bool netProp) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// first there is someone to send to and make sure that we an avatar to send this to
|
|
|
|
// first there is someone to send to and make sure that we an avatar to send this to
|
|
|
|
if ( behKey.getKey() != nil && fRecvr.Count() > 0) |
|
|
|
if ( behKey.getKey() && fRecvr.Count() > 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// must determine if the behKey is pointing to Single or Multi Shot behavior
|
|
|
|
// must determine if the behKey is pointing to Single or Multi Shot behavior
|
|
|
|
if ( plOneShotMod::ConvertNoRef(behKey.getKey()->GetObjectPtr()) != nil ) |
|
|
|
if (plOneShotMod::ConvertNoRef(behKey.getKey()->GetObjectPtr())) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// create a message OneShotMessage
|
|
|
|
// create a message OneShotMessage
|
|
|
|
plOneShotMsg* pMsg = new plOneShotMsg; |
|
|
|
plOneShotMsg* pMsg = new plOneShotMsg; |
|
|
|
// check if this needs to be network forced to all clients
|
|
|
|
pMsg->SetBCastFlag(plMessage::kNetPropagate, netProp || netForce); |
|
|
|
if (netProp) |
|
|
|
pMsg->SetBCastFlag(plMessage::kNetForce, netForce); |
|
|
|
{ |
|
|
|
|
|
|
|
pMsg->SetBCastFlag(plMessage::kNetPropagate); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
pMsg->SetBCastFlag(plMessage::kNetPropagate, false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (netForce) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// set the network propagate flag to make sure it gets to the other clients
|
|
|
|
|
|
|
|
pMsg->SetBCastFlag(plMessage::kNetPropagate); |
|
|
|
|
|
|
|
pMsg->SetBCastFlag(plMessage::kNetForce); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
pMsg->SetBCastFlag(plMessage::kNetForce, false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pMsg->SetSender(fSender); |
|
|
|
pMsg->SetSender(fSender); |
|
|
|
pMsg->AddReceiver(behKey.getKey()); |
|
|
|
pMsg->AddReceiver(behKey.getKey()); |
|
|
|
int i; |
|
|
|
for (int i = 0; i < fRecvr.Count(); i++) { |
|
|
|
for ( i=0; i<fRecvr.Count(); i++ ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// make sure there is an avatar to set
|
|
|
|
// make sure there is an avatar to set
|
|
|
|
if ( fRecvr[i] != nil ) |
|
|
|
if (fRecvr[i]) { |
|
|
|
{ |
|
|
|
pMsg->fPlayerKey = fRecvr[i]; |
|
|
|
pMsg->fPlayerKey = (plKey)fRecvr[i]; |
|
|
|
pMsg->SendAndKeep(); // gotta keep the message so we can keep sending it
|
|
|
|
plgDispatch::MsgSend( pMsg ); // send off command for each valid avatar we find
|
|
|
|
// there should really only be one avatar, though...
|
|
|
|
// ... really, should only be one... though
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
pMsg->UnRef(); // done with our reference
|
|
|
|
} |
|
|
|
} |
|
|
|
// else if it is a Multistage guy
|
|
|
|
// else if it is a Multistage guy
|
|
|
|
else if ( plMultistageBehMod::ConvertNoRef(behKey.getKey()->GetObjectPtr()) != nil ) |
|
|
|
else if ( plMultistageBehMod::ConvertNoRef(behKey.getKey()->GetObjectPtr()) != nil ) |
|
|
|