engine: server: remove recalculating viewpoint for PVS hack, as it causes issues with inconsistency between real and "restored" view positions
This commit is contained in:
parent
9150b770e4
commit
677b0170aa
1 changed files with 14 additions and 67 deletions
|
@ -30,10 +30,8 @@ GNU General Public License for more details.
|
||||||
static int GAME_EXPORT pfnModelIndex( const char *m );
|
static int GAME_EXPORT pfnModelIndex( const char *m );
|
||||||
|
|
||||||
// fatpvs stuff
|
// fatpvs stuff
|
||||||
static byte fatpvs[MAX_MAP_LEAFS/8];
|
static byte fatphs[(MAX_MAP_LEAFS+7)/8];
|
||||||
static byte fatphs[MAX_MAP_LEAFS/8];
|
static byte clientpvs[(MAX_MAP_LEAFS+7)/8]; // for find client in PVS
|
||||||
static byte clientpvs[MAX_MAP_LEAFS/8]; // for find client in PVS
|
|
||||||
static vec3_t viewPoint[MAX_CLIENTS];
|
|
||||||
|
|
||||||
// exports
|
// exports
|
||||||
typedef void (__cdecl *LINK_ENTITY_FUNC)( entvars_t *pev );
|
typedef void (__cdecl *LINK_ENTITY_FUNC)( entvars_t *pev );
|
||||||
|
@ -339,11 +337,12 @@ static qboolean SV_CheckClientVisiblity( sv_client_t *cl, const byte *mask )
|
||||||
if( !mask ) return true; // GoldSrc rules
|
if( !mask ) return true; // GoldSrc rules
|
||||||
|
|
||||||
clientnum = cl - svs.clients;
|
clientnum = cl - svs.clients;
|
||||||
VectorCopy( viewPoint[clientnum], vieworg );
|
|
||||||
|
|
||||||
// Invasion issues: wrong camera position received in ENGINE_SET_PVS
|
// Invasion issues: wrong camera position received in ENGINE_SET_PVS
|
||||||
if( cl->pViewEntity && !VectorCompare( vieworg, cl->pViewEntity->v.origin ))
|
if( cl->pViewEntity )
|
||||||
VectorCopy( cl->pViewEntity->v.origin, vieworg );
|
VectorCopy( cl->pViewEntity->v.origin, vieworg );
|
||||||
|
else
|
||||||
|
VectorCopy( cl->edict->v.origin, vieworg );
|
||||||
|
|
||||||
leaf = Mod_PointInLeaf( vieworg, sv.worldmodel->nodes );
|
leaf = Mod_PointInLeaf( vieworg, sv.worldmodel->nodes );
|
||||||
|
|
||||||
|
@ -4278,43 +4277,16 @@ so we can't use a single PVS point
|
||||||
*/
|
*/
|
||||||
static byte *GAME_EXPORT pfnSetFatPVS( const float *org )
|
static byte *GAME_EXPORT pfnSetFatPVS( const float *org )
|
||||||
{
|
{
|
||||||
qboolean fullvis = false;
|
static byte fatpvs[(MAX_MAP_LEAFS+7)/8];
|
||||||
|
qboolean fullvis = false, merge = false;
|
||||||
|
|
||||||
if( !sv.worldmodel->visdata || sv_novis.value || !org || CL_DisableVisibility( ))
|
if( !sv.worldmodel->visdata || sv_novis.value || !org || CL_DisableVisibility( ))
|
||||||
fullvis = true;
|
fullvis = true;
|
||||||
|
|
||||||
// portals can't change viewpoint!
|
if( FBitSet( sv.hostflags, SVF_MERGE_VISIBILITY ))
|
||||||
if( !FBitSet( sv.hostflags, SVF_MERGE_VISIBILITY ))
|
merge = true;
|
||||||
{
|
|
||||||
vec3_t viewPos, offset;
|
|
||||||
qboolean client_active = pfnGetCurrentPlayer() != -1;
|
|
||||||
|
|
||||||
// see code from client.cpp for understanding:
|
Mod_FatPVS( org, FATPVS_RADIUS, fatpvs, world.fatbytes, merge, fullvis );
|
||||||
// org = pView->v.origin + pView->v.view_ofs;
|
|
||||||
// if ( pView->v.flags & FL_DUCKING )
|
|
||||||
// {
|
|
||||||
// org = org + ( VEC_HULL_MIN - VEC_DUCK_HULL_MIN );
|
|
||||||
// }
|
|
||||||
// so we have unneeded duck calculations who have affect when player
|
|
||||||
// is ducked into water. Remove offset to restore right PVS position
|
|
||||||
if( client_active && FBitSet( sv.current_client->edict->v.flags, FL_DUCKING ))
|
|
||||||
{
|
|
||||||
VectorSubtract( svgame.pmove->player_mins[0], svgame.pmove->player_mins[1], offset );
|
|
||||||
VectorSubtract( org, offset, viewPos );
|
|
||||||
}
|
|
||||||
else VectorCopy( org, viewPos );
|
|
||||||
|
|
||||||
// build a new PVS frame
|
|
||||||
Mod_FatPVS( viewPos, FATPVS_RADIUS, fatpvs, world.fatbytes, false, fullvis );
|
|
||||||
|
|
||||||
if( client_active )
|
|
||||||
VectorCopy( viewPos, viewPoint[pfnGetCurrentPlayer()] );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// merge PVS
|
|
||||||
Mod_FatPVS( org, FATPVS_RADIUS, fatpvs, world.fatbytes, true, fullvis );
|
|
||||||
}
|
|
||||||
|
|
||||||
return fatpvs;
|
return fatpvs;
|
||||||
}
|
}
|
||||||
|
@ -4329,40 +4301,15 @@ so we can't use a single PHS point
|
||||||
*/
|
*/
|
||||||
static byte *GAME_EXPORT pfnSetFatPAS( const float *org )
|
static byte *GAME_EXPORT pfnSetFatPAS( const float *org )
|
||||||
{
|
{
|
||||||
qboolean fullvis = false;
|
qboolean fullvis = false, merge = false;
|
||||||
|
|
||||||
if( !sv.worldmodel->visdata || sv_novis.value || !org || CL_DisableVisibility( ))
|
if( !sv.worldmodel->visdata || sv_novis.value || !org || CL_DisableVisibility( ))
|
||||||
fullvis = true;
|
fullvis = true;
|
||||||
|
|
||||||
// portals can't change viewpoint!
|
if( FBitSet( sv.hostflags, SVF_MERGE_VISIBILITY ))
|
||||||
if( !FBitSet( sv.hostflags, SVF_MERGE_VISIBILITY ))
|
merge = true;
|
||||||
{
|
|
||||||
vec3_t viewPos, offset;
|
|
||||||
qboolean client_active = pfnGetCurrentPlayer() != -1;
|
|
||||||
|
|
||||||
// see code from client.cpp for understanding:
|
Mod_FatPVS( org, FATPHS_RADIUS, fatphs, world.fatbytes, merge, fullvis );
|
||||||
// org = pView->v.origin + pView->v.view_ofs;
|
|
||||||
// if ( pView->v.flags & FL_DUCKING )
|
|
||||||
// {
|
|
||||||
// org = org + ( VEC_HULL_MIN - VEC_DUCK_HULL_MIN );
|
|
||||||
// }
|
|
||||||
// so we have unneeded duck calculations who have affect when player
|
|
||||||
// is ducked into water. Remove offset to restore right PVS position
|
|
||||||
if( client_active && FBitSet( sv.current_client->edict->v.flags, FL_DUCKING ))
|
|
||||||
{
|
|
||||||
VectorSubtract( svgame.pmove->player_mins[0], svgame.pmove->player_mins[1], offset );
|
|
||||||
VectorSubtract( org, offset, viewPos );
|
|
||||||
}
|
|
||||||
else VectorCopy( org, viewPos );
|
|
||||||
|
|
||||||
// build a new PHS frame
|
|
||||||
Mod_FatPVS( viewPos, FATPHS_RADIUS, fatphs, world.fatbytes, false, fullvis );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// merge PHS
|
|
||||||
Mod_FatPVS( org, FATPHS_RADIUS, fatphs, world.fatbytes, true, fullvis );
|
|
||||||
}
|
|
||||||
|
|
||||||
return fatphs;
|
return fatphs;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue