本文整理汇总了C++中plKey::ObjectIsLoaded方法的典型用法代码示例。如果您正苦于以下问题:C++ plKey::ObjectIsLoaded方法的具体用法?C++ plKey::ObjectIsLoaded怎么用?C++ plKey::ObjectIsLoaded使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plKey
的用法示例。
在下文中一共展示了plKey::ObjectIsLoaded方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateDetectorsInScene
void plSimulationMgr::UpdateDetectorsInScene(plKey world, plKey avatar, hsPoint3& pos, bool entering)
{
// search thru the actors in a scene looking for convex hull detectors and see if the avatar is inside it
// ... and then send appropiate collision message if needed
NxScene* scene = GetScene(world);
plSceneObject* avObj = plSceneObject::ConvertNoRef(avatar->ObjectIsLoaded());
const plCoordinateInterface* ci = avObj->GetCoordinateInterface();
hsPoint3 soPos = ci->GetWorldPos();
if (scene)
{
uint32_t numActors = scene->getNbActors();
NxActor** actors = scene->getActors();
for (int i = 0; i < numActors; i++)
{
plPXPhysical* physical = (plPXPhysical*)actors[i]->userData;
if (physical && physical->DoDetectorHullWorkaround())
{
if ( physical->IsObjectInsideHull(pos) )
{
physical->SetInsideConvexHull(entering);
// we are entering this world... say we entered this detector
ISendCollisionMsg(physical->GetObjectKey(), avatar, entering);
}
}
}
}
}
示例2: NukeKeyAndObject
bool plPluginResManager::NukeKeyAndObject(plKey& objectKey)
{
class plPublicRefKey : public plKeyImp
{
public:
uint16_t GetRefCount() const { return fRefCount; }
};
plKeyImp* keyData = (plKeyImp*)objectKey;
// Check the ref count on the object. Nobody should have a ref to it
// except the key
hsKeyedObject* object = objectKey->ObjectIsLoaded();
if (object != nil)
{
if (keyData->GetActiveRefs())
// Somebody still has a ref to this object, so we can't nuke it
return false;
}
// Nobody has a ref to the object, so we're clear to nuke
keyData->SetObjectPtr(nil);
// Check the key. The refcount should be 1 at this point, for the copy
// we're holding in this function. Nobody else should be holding the key
// now that the object is gone.
if (((plPublicRefKey*)keyData)->GetRefCount() > 1)
return false;
// Nuke out the key as well
objectKey = nil;
// All done!
return true;
}
示例3: EatKey
virtual bool EatKey(const plKey& key)
{
plBitmap* bmap = plBitmap::ConvertNoRef(key->ObjectIsLoaded());
if (bmap != nil)
fTELog->AddTexture(bmap);
return true; // Always continue
}
示例4: MakeCCRInvisible
//
// a remote ccr is turning [in]visible
//
void plNetClientMgr::MakeCCRInvisible(plKey avKey, int level)
{
if (!avKey)
{
ErrorMsg("Failed to make remote CCR Invisible, nil avatar key");
return;
}
if (level<0)
{
ErrorMsg("Failed to make remote CCR Invisible, negative level");
return;
}
if (!avKey->ObjectIsLoaded() || !avKey->ObjectIsLoaded()->IsFinal())
{
hsAssert(false, "avatar not loaded or final");
return;
}
plAvatarStealthModeMsg *msg = new plAvatarStealthModeMsg();
msg->SetSender(avKey);
msg->fLevel = level;
if (GetCCRLevel()<level) // I'm a lower level than him, so he's invisible to me
msg->fMode = plAvatarStealthModeMsg::kStealthCloaked;
else
{
// he's visible to me
if (AmCCR() && level > 0)
msg->fMode = plAvatarStealthModeMsg::kStealthCloakedButSeen; // draw as semi-invis
else
msg->fMode = plAvatarStealthModeMsg::kStealthVisible;
}
DebugMsg("Handled MakeCCRInvisible - sending stealth msg");;
// This fxn is called when avatar SDL state is received from the server,
// so this msg will inherit the 'non-local' status of the parent sdl msg.
// That means that the avatar linkSound won't receive it, since the linkSound
// is set as localOnly.
// So, terminate the remote cascade and start a new (local) cascade.
msg->SetBCastFlag(plMessage::kNetStartCascade);
msg->Send();
}
示例5: SetTarget
void plAvTaskSeek::SetTarget(plKey target)
{
hsAssert(target, "Bad key to seek task");
if(target)
{
fSeekObject = plSceneObject::ConvertNoRef(target->ObjectIsLoaded());
}
else
{
fSeekObject = nil;
}
}
示例6: ISendNetMsg
//
// write to net msg and send to server
//
void plSDLModifier::ISendNetMsg(plStateDataRecord*& state, plKey senderKey, uint32_t sendFlags)
{
hsAssert(senderKey, "nil senderKey?");
plSynchedObject* sobj = plSynchedObject::ConvertNoRef(senderKey->ObjectIsLoaded());
if (sobj && (sobj->IsInSDLVolatileList(GetSDLName())))
state->SetFlags(state->GetFlags() | plStateDataRecord::kVolatile);
bool dirtyOnly = (sendFlags & plSynchedObject::kForceFullSend) == 0;
bool broadcast = (sendFlags & plSynchedObject::kBCastToClients) != 0;
int writeOptions=0;
// if (dirtyOnly)
writeOptions |= plSDL::kDirtyOnly;
if (broadcast)
writeOptions |= plSDL::kBroadcast;
writeOptions |= plSDL::kTimeStampOnRead;
// send to server
plNetMsgSDLState* msg = state->PrepNetMsg(0, writeOptions);
msg->SetNetProtocol(kNetProtocolCli2Game);
msg->ObjectInfo()->SetUoid(senderKey->GetUoid());
if (sendFlags & plSynchedObject::kNewState)
msg->SetBit(plNetMessage::kNewSDLState);
if (sendFlags & plSynchedObject::kUseRelevanceRegions)
msg->SetBit(plNetMessage::kUseRelevanceRegions);
if (sendFlags & plSynchedObject::kDontPersistOnServer)
msg->SetPersistOnServer(false);
if (sendFlags & plSynchedObject::kIsAvatarState)
msg->SetIsAvatarState(true);
if (broadcast && plNetClientApp::GetInstance())
{
msg->SetPlayerID(plNetClientApp::GetInstance()->GetPlayerID());
}
plNetClientApp::GetInstance()->SendMsg(msg);
msg->UnRef();
fSentOrRecvdState = true;
}
示例7: SetSceneObject
void plWinAudible::SetSceneObject(plKey obj)
{
plKey oldKey = nil;
// remove old SDL mod
if (fSDLMod && fSceneObj && fSceneObj != obj)
{
oldKey = fSceneObj;
plSceneObject* so=plSceneObject::ConvertNoRef(fSceneObj->ObjectIsLoaded());
if (so)
so->RemoveModifier(fSDLMod);
delete fSDLMod;
fSDLMod=nil;
}
fSceneObj = obj;
plSceneObject* so=plSceneObject::ConvertNoRef(obj ? obj->ObjectIsLoaded() : nil);
if (so)
{
so->RemoveModifier(fSDLMod);
delete fSDLMod;
fSDLMod=new plSoundSDLModifier;
so->AddModifier(fSDLMod);
}
for( int i = 0; i < fSoundObjs.Count(); i++ )
{
if( fSoundObjs[ i ] != nil && fSoundObjs[ i ]->GetKey() != nil )
{
if( obj != nil )
{
plGenRefMsg *replaceMsg = new plGenRefMsg( fSoundObjs[ i ]->GetKey(), plRefMsg::kOnReplace, 0, plSound::kRefParentSceneObject );
hsgResMgr::ResMgr()->AddViaNotify( obj, replaceMsg, plRefFlags::kPassiveRef );
}
else if( oldKey != nil )
fSoundObjs[ i ]->GetKey()->Release( oldKey );
}
}
}
示例8: hsAssert
bool plCommonObjLib::RemoveObjectAndKey( plKey &key )
{
if (!key)
{
hsAssert( false, "Received RemoveObjectAndKey() call for a key that is invalid. Nillifying key anyway." );
key = nil;
return true;
}
hsKeyedObject *object = hsKeyedObject::ConvertNoRef( key->ObjectIsLoaded() );
if( object == nil )
{
hsAssert( false, "Received RemoveObjectAndKey() call for a key that isn't loaded. Nillifying key anyway." );
key = nil;
return true;
}
int idx = fObjects.Find( object );
if( idx == fObjects.kMissingIndex )
{
hsAssert( false, "Trying to RemoveObjectAndKey() for a common object not in the lib." );
key = nil;
return true;
}
// Unref and remove from our list
fObjects[ idx ]->GetKey()->UnRefObject();
fObjects.Remove( idx );
// Nuke out the key and its object
if( !plPluginResManager::ResMgr()->NukeKeyAndObject( key ) )
{
hsAssert( false, "Trouble nuking out the key for this texture. Problems abound...." );
return false;
}
// All done!
return true;
}