I tried again and managed to get that code working but only when I used
a cheap hack.
For some reason I cannot just do pvsBuffer[ x ] |= *pvs[ x ] since it'll
just crash, I can however
memcpy it into a buffer and do the bitwise OR later.

Should I do this with PAS aswell?

[EMAIL PROTECTED] wrote:
What you need to do is merge the PVS/PAS of the bot and the player.  
SetupVisibility() is where the server DLL can set the PVS to be used in 
AddToFullPack().  The default implementation just asks the engine to calculate 
the PVS for the current view entitity.  You could ask the engine to calculate 
the PVS for two viewpoints, but if the engine's implementation of 
SV_SetFatPVS() is the same as Quake's then this won't work: the PVS is cleared 
at the start of each call.  What you can do is memcopy() the PVS calculated 
into a buffer and bitwise-or each additional PVS you need, then return a 
pointer to the buffer.  I'm almost certain this would work, although I haven't 
tested it :)

Something like this (again, untested):

void SetupVisibility( edict_t *pViewEntity, edict_t *pClient, unsigned char 
**pvs, unsigned char **pas )
{
    Vector org;
    edict_t *pView = pClient;
    static unsigned char visBuffer[MAX_MAP_LEAFS / 8];

    // Find the client's PVS
    if ( pViewEntity )
    {
        pView = pViewEntity;
    }

    org = pView->v.origin + pView->v.view_ofs;
    if ( pView->v.flags & FL_DUCKING )
    {
        org = org + ( VEC_HULL_MIN - VEC_DUCK_HULL_MIN );
    }

    *pvs = ENGINE_SET_PVS ( (float *)&org );
    *pas = ENGINE_SET_PAS ( (float *)&org );

    memcpy( visBuffer, pvs, MAX_MAP_LEAFS / 8 );

    for (/* each additional viewpoint */)
    {
        *pvs = ENGINE_SET_PVS( /* viewpoint */ );
        for (int i = 0; i < sizeof pvsBuffer; i++)
            pvsBuffer[i] |= pvs[i];
    }

    *pvs = pvsBuffer;
}


From: TheLazy1 <[EMAIL PROTECTED]>
What I'm trying to do is add split screen play to half-life deathmatch,
currently I have the client rendering from the view of a bot which in
the future will be controlled by additional players through player 1.
The problem is that once player one leaves the area of the player two
bot, the entities in the bot's view disappear.

    // Ignore if not the host and not touching a PVS/PAS leaf
    // If pSet is NULL, then the test will always succeed and the entity
will be added to the update
    if ( ent != host )
    {
        if ( !ENGINE_CHECK_VISIBILITY( (const struct edict_s *)ent, pSet ) )
        {
            return 0;
        }
    }

Commenting that code "fixes" the problem but also causes the client to
render every entity in the level causing a noticable drop in performance.
Are there any ways around this?


_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders




-----------------------------------------
Email sent from www.ntlworld.com
Virus-checked using McAfee(R) Software
Visit www.ntlworld.com/security for more information


_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders




_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to