Exemple #1
0
 virtual bool    IsInteresting( const plKey &objectKey )
 {
     if( objectKey->GetUoid().GetClassType() == plPythonFileMod::Index() )
         return true;
     if( objectKey->GetUoid().GetClassType() == plSceneObject::Index() &&
         objectKey->GetUoid().GetObjectName().Compare( plSDL::kAgeSDLObjectName ) == 0 )
         return true;
     return false;
 }
Exemple #2
0
        virtual bool  EatKey( const plKey& key )
        {
            if( key->GetUoid().IsValid() && key->GetUoid().GetClassType() == fClassType &&
                key->GetUoid().GetObjectName().Find( fObjName ) >= 0 )
            {
                fFoundKeys.push_back( key );
            }

            return true;
        }
Exemple #3
0
    virtual bool  EatKey( const plKey& key )
    {
        if( key->GetUoid().GetClassType() == fClassType &&
            NameMatches( fObjName.c_str(), key->GetUoid().GetObjectName().c_str(), fSubstr ) )
        {
            fFoundKey = key;
            return false;
        }

        return true;
    }
Exemple #4
0
    virtual bool    EatKey( const plKey& key )
    {
        if( fCurrType != key->GetUoid().GetClassType() )
        {
            fCurrType = key->GetUoid().GetClassType();
            const char *className = plFactory::GetNameOfClass( fCurrType );
            fCurrTypeItem = AddLeaf( fTree, fCurrItem, className != nil ? className : "<unknown>", nil );
        }

        if( !fFilter )
            AddLeaf( fTree, fCurrTypeItem, key->GetUoid().GetObjectName().c_str(), new plKeyInfo( key, fCurrPage ) );
        return true;
    }
Exemple #5
0
//
// Determine the net group for a given object (based on paging unit)
//
plNetGroupId plNetClientMgr::SelectNetGroup(plSynchedObject* objIn, plKey roomKey)
{
    if( objIn->GetSynchFlags() & plSynchedObject::kHasConstantNetGroup )
        return objIn->GetNetGroup();

    return plNetGroupId(roomKey->GetUoid().GetLocation(), 0);
}
Exemple #6
0
 virtual bool    IsInteresting( const plKey &objectKey )
 {
     if( objectKey->GetUoid().GetClassType() == plCubicEnvironmap::Index() ||
         objectKey->GetUoid().GetClassType() == plMipmap::Index() )
     {
         return true;
     }
     return false;
 }
Exemple #7
0
 virtual bool EatKey(const plKey& key)
 {
     if (key->GetUoid().GetClassType() == plSceneNode::Index())
     {
         plSceneNode* sn = plSceneNode::ConvertNoRef(key->ObjectIsLoaded());
         if (sn != nil)
             sn->OptimizeDrawables();
     }
     return true;    // Always continue
 }
Exemple #8
0
void plPageOptimizer::KeyedObjectProc(plKey key)
{
    plString keyName = key->GetName();
    const char* className = plFactory::GetNameOfClass(key->GetUoid().GetClassType());

    // For now, ignore any key that isn't in the location we're looking at.  That means stuff like textures.
    if (fInstance->fLoc != key->GetUoid().GetLocation())
        return;

    KeySet& loadedKeys = fInstance->fLoadedKeys;
    KeyVec& loadOrder = fInstance->fKeyLoadOrder;

    KeySet::iterator it = loadedKeys.lower_bound(key);
    if (it != loadedKeys.end() && *it == key)
    {
        printf("Keyed object %s(%s) loaded more than once\n", keyName.c_str(), className);
    }
    else
    {
        loadedKeys.insert(it, key);
        loadOrder.push_back(key);
    }
}
Exemple #9
0
//
// 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;
}
Exemple #10
0
//
// save or load a key.  return the key.
//
const plKey plSynchedValueBase::ISaveOrLoad(const plKey key, bool32 save, hsStream* stream, hsResMgr* mgr)
{
    if (save)
    {   
        if (key)
        {
            stream->WriteByte(1);
            // I need to write a key to MY stream...
#if 0       // DEBUG
            plStringBuffer<char> buf = key->GetName()->ToIso8859_1();
            stream->WriteLE32(buf.GetSize());
            stream->Write(buf.GetSize(), buf.GetData());
#endif
            key->GetUoid().Write(stream);
        }
        else
        {
            stream->WriteByte(0);
        }
        return key;
    }
    else
    {   
        int32_t has=stream->ReadByte();
        if (has)
        {
            // read a key from MY stream
#if 0       // DEBUG
            int32_t len = stream->ReadLE32();
            char tmp[256];
            hsAssert(len<256, "key name overflow");
            stream->Read(len, tmp);
#endif
            plUoid uoid;
            uoid.Read(stream);
            return mgr->FindKey(uoid);
        }
        else
            return (nil);
    }
    return nil;
}
Exemple #11
0
// plCaptureRender::Capture
bool plCaptureRender::Capture(const plKey& ack, uint16_t width, uint16_t height)
{
    // Create our render target
    const uint16_t flags = plRenderTarget::kIsOffscreen;
    const uint8_t bitDepth(32);
    const uint8_t zDepth(-1);
    const uint8_t stencilDepth(-1);
    plRenderTarget* rt = new plRenderTarget(flags, width, height, bitDepth, zDepth, stencilDepth);

    static int idx=0;
    ST::string buff = ST::format("tRT{}", idx++);
    hsgResMgr::ResMgr()->NewKey(buff, rt, ack->GetUoid().GetLocation());


    // Create a render request and render request message
    plCaptureRenderRequest* req = new plCaptureRenderRequest;

    const float pri(-100.f);
    req->SetPriority(pri);

    req->SetRenderTarget(rt);

    const uint32_t renderState 
        = plPipeline::kRenderNormal
        | plPipeline::kRenderClearColor
        | plPipeline::kRenderClearDepth;
    req->SetRenderState(renderState);

    // Set the Ack to be our requestor
    req->RequestAck(ack);

    // Submit
    plRenderRequestMsg* msg = new plRenderRequestMsg(ack, req);
    hsRefCnt_SafeUnRef(req);
    msg->Send();

    return true;
}
void plNetMsgRoomsList::AddRoom(plKey rmKey)
{
    fRooms.push_back(rmKey->GetUoid().GetLocation());
    fRoomNames.push_back(rmKey->GetName());
}