11 Jan 2011
This commit is contained in:
parent
793c3899ee
commit
8225a341f0
|
@ -557,7 +557,7 @@ void CL_BubbleTrail( const vec3_t start, const vec3_t end, float flWaterZ, int m
|
||||||
|
|
||||||
zspeed = Com_RandomLong( 80, 140 );
|
zspeed = Com_RandomLong( 80, 140 );
|
||||||
VectorSet( pTemp->entity.baseline.origin, speed * com.cos( angle ), speed * com.sin( angle ), zspeed );
|
VectorSet( pTemp->entity.baseline.origin, speed * com.cos( angle ), speed * com.sin( angle ), zspeed );
|
||||||
pTemp->die = cl.time + (( flWaterZ - origin[2]) / zspeed ) - 0.1f;
|
pTemp->die = cl.time + ((flWaterZ - (origin[2] - start[2])) / zspeed) - 0.1f;
|
||||||
pTemp->entity.curstate.frame = Com_RandomLong( 0, frameCount - 1 );
|
pTemp->entity.curstate.frame = Com_RandomLong( 0, frameCount - 1 );
|
||||||
// Set sprite scale
|
// Set sprite scale
|
||||||
pTemp->entity.curstate.scale = 1.0 / Com_RandomFloat( 4, 8 );
|
pTemp->entity.curstate.scale = 1.0 / Com_RandomFloat( 4, 8 );
|
||||||
|
|
|
@ -360,7 +360,7 @@ extern convar_t *sv_reconnect_limit;
|
||||||
extern convar_t *sv_lighting_modulate;
|
extern convar_t *sv_lighting_modulate;
|
||||||
extern convar_t *rcon_password;
|
extern convar_t *rcon_password;
|
||||||
extern convar_t *hostname;
|
extern convar_t *hostname;
|
||||||
extern convar_t *sv_stepheight;
|
extern convar_t *sv_stepsize;
|
||||||
extern convar_t *sv_rollangle;
|
extern convar_t *sv_rollangle;
|
||||||
extern convar_t *sv_rollspeed;
|
extern convar_t *sv_rollspeed;
|
||||||
extern convar_t *sv_maxspeed;
|
extern convar_t *sv_maxspeed;
|
||||||
|
|
|
@ -1007,7 +1007,6 @@ void SV_New_f( sv_client_t *cl )
|
||||||
{
|
{
|
||||||
// set up the entity for the client
|
// set up the entity for the client
|
||||||
ent = EDICT_NUM( playernum + 1 );
|
ent = EDICT_NUM( playernum + 1 );
|
||||||
ent->serialnumber = playernum + 1;
|
|
||||||
cl->edict = ent;
|
cl->edict = ent;
|
||||||
Mem_Set( &cl->lastcmd, 0, sizeof( cl->lastcmd ));
|
Mem_Set( &cl->lastcmd, 0, sizeof( cl->lastcmd ));
|
||||||
|
|
||||||
|
|
|
@ -98,13 +98,6 @@ static void SV_AddEntitiesToPacket( edict_t *pViewEnt, edict_t *pClient, client_
|
||||||
ent = EDICT_NUM( e );
|
ent = EDICT_NUM( e );
|
||||||
if( ent->free ) continue;
|
if( ent->free ) continue;
|
||||||
|
|
||||||
if( ent->serialnumber != e )
|
|
||||||
{
|
|
||||||
// this should never happens
|
|
||||||
MsgDev( D_NOTE, "fixing ent->serialnumber from %i to %i\n", ent->serialnumber, e );
|
|
||||||
ent->serialnumber = e;
|
|
||||||
}
|
|
||||||
|
|
||||||
// don't double add an entity through portals (already added)
|
// don't double add an entity through portals (already added)
|
||||||
if( ent->v.pushmsec == sv.net_framenum )
|
if( ent->v.pushmsec == sv.net_framenum )
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -658,7 +658,7 @@ edict_t *SV_AllocEdict( void )
|
||||||
pEdict = EDICT_NUM( i );
|
pEdict = EDICT_NUM( i );
|
||||||
// the first couple seconds of server time can involve a lot of
|
// the first couple seconds of server time can involve a lot of
|
||||||
// freeing and allocating, so relax the replacement policy
|
// freeing and allocating, so relax the replacement policy
|
||||||
if( pEdict->free && ( pEdict->freetime < 2.0 || sv_time() - pEdict->freetime > 0.5 ))
|
if( pEdict->free && ( pEdict->freetime < 2.0 || sv.time - pEdict->freetime > 0.5 ))
|
||||||
{
|
{
|
||||||
SV_InitEdict( pEdict );
|
SV_InitEdict( pEdict );
|
||||||
return pEdict;
|
return pEdict;
|
||||||
|
@ -778,13 +778,6 @@ sv_client_t *SV_ClientFromEdict( const edict_t *pEdict, qboolean spawned_only )
|
||||||
if( svs.clients[i].state != cs_spawned )
|
if( svs.clients[i].state != cs_spawned )
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( svs.clients[i].state < cs_connected )
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
client = svs.clients + i;
|
client = svs.clients + i;
|
||||||
|
|
||||||
return client;
|
return client;
|
||||||
|
@ -1273,11 +1266,14 @@ pfnEntitiesInPVS
|
||||||
edict_t *pfnEntitiesInPVS( edict_t *pplayer )
|
edict_t *pfnEntitiesInPVS( edict_t *pplayer )
|
||||||
{
|
{
|
||||||
edict_t *pEdict, *chain;
|
edict_t *pEdict, *chain;
|
||||||
|
vec3_t point, viewpoint;
|
||||||
int i, result;
|
int i, result;
|
||||||
|
|
||||||
if( !SV_IsValidEdict( pplayer ))
|
if( !SV_IsValidEdict( pplayer ))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
VectorAdd( pplayer->v.origin, pplayer->v.view_ofs, viewpoint );
|
||||||
|
|
||||||
for( chain = NULL, i = svgame.globals->maxClients + 1; i < svgame.numEntities; i++ )
|
for( chain = NULL, i = svgame.globals->maxClients + 1; i < svgame.numEntities; i++ )
|
||||||
{
|
{
|
||||||
pEdict = EDICT_NUM( i );
|
pEdict = EDICT_NUM( i );
|
||||||
|
@ -1286,8 +1282,16 @@ edict_t *pfnEntitiesInPVS( edict_t *pplayer )
|
||||||
if( pEdict->v.flags & FL_KILLME ) continue;
|
if( pEdict->v.flags & FL_KILLME ) continue;
|
||||||
|
|
||||||
if( Mod_GetType( pEdict->v.modelindex ) == mod_brush )
|
if( Mod_GetType( pEdict->v.modelindex ) == mod_brush )
|
||||||
result = SV_BoxInPVS( pplayer->v.origin, pEdict->v.absmin, pEdict->v.absmax );
|
{
|
||||||
else result = SV_OriginIn( DVIS_PVS, pplayer->v.origin, pEdict->v.origin );
|
result = SV_BoxInPVS( viewpoint, pEdict->v.absmin, pEdict->v.absmax );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
point[0] = pEdict->v.origin[0] + (pEdict->v.mins[0] + pEdict->v.maxs[0]) * 0.5f;
|
||||||
|
point[1] = pEdict->v.origin[1] + (pEdict->v.mins[1] + pEdict->v.maxs[1]) * 0.5f;
|
||||||
|
point[2] = pEdict->v.origin[2] + pEdict->v.mins[2] + 1;
|
||||||
|
result = SV_OriginIn( DVIS_PVS, viewpoint, point );
|
||||||
|
}
|
||||||
|
|
||||||
if( result )
|
if( result )
|
||||||
{
|
{
|
||||||
|
@ -1307,12 +1311,14 @@ pfnEntitiesInPHS
|
||||||
edict_t *pfnEntitiesInPHS( edict_t *pplayer )
|
edict_t *pfnEntitiesInPHS( edict_t *pplayer )
|
||||||
{
|
{
|
||||||
edict_t *pEdict, *chain;
|
edict_t *pEdict, *chain;
|
||||||
vec3_t checkPos;
|
vec3_t checkPos, hearpoint;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if( !SV_IsValidEdict( pplayer ))
|
if( !SV_IsValidEdict( pplayer ))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
VectorAdd( pplayer->v.origin, pplayer->v.view_ofs, hearpoint );
|
||||||
|
|
||||||
for( chain = NULL, i = svgame.globals->maxClients + 1; i < svgame.numEntities; i++ )
|
for( chain = NULL, i = svgame.globals->maxClients + 1; i < svgame.numEntities; i++ )
|
||||||
{
|
{
|
||||||
pEdict = EDICT_NUM( i );
|
pEdict = EDICT_NUM( i );
|
||||||
|
@ -1320,11 +1326,24 @@ edict_t *pfnEntitiesInPHS( edict_t *pplayer )
|
||||||
if( !SV_IsValidEdict( pEdict )) continue;
|
if( !SV_IsValidEdict( pEdict )) continue;
|
||||||
if( pEdict->v.flags & FL_KILLME ) continue;
|
if( pEdict->v.flags & FL_KILLME ) continue;
|
||||||
|
|
||||||
if( Mod_GetType( pEdict->v.modelindex ) == mod_brush )
|
if( pEdict->v.movetype == MOVETYPE_FOLLOW && SV_IsValidEdict( pEdict->v.aiment ))
|
||||||
VectorAverage( pEdict->v.absmin, pEdict->v.absmax, checkPos );
|
{
|
||||||
else VectorCopy( pEdict->v.origin, checkPos );
|
if(!( pEdict->v.aiment->v.flags & FL_KILLME ))
|
||||||
|
pEdict = pEdict->v.aiment;
|
||||||
|
}
|
||||||
|
|
||||||
if( SV_OriginIn( DVIS_PHS, pplayer->v.origin, checkPos ))
|
if( Mod_GetType( pEdict->v.modelindex ) == mod_brush )
|
||||||
|
{
|
||||||
|
VectorAverage( pEdict->v.absmin, pEdict->v.absmax, checkPos );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
checkPos[0] = pEdict->v.origin[0] + (pEdict->v.mins[0] + pEdict->v.maxs[0]) * 0.5f;
|
||||||
|
checkPos[1] = pEdict->v.origin[1] + (pEdict->v.mins[1] + pEdict->v.maxs[1]) * 0.5f;
|
||||||
|
checkPos[2] = pEdict->v.origin[2] + pEdict->v.mins[2] + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( SV_OriginIn( DVIS_PHS, hearpoint, checkPos ))
|
||||||
{
|
{
|
||||||
pEdict->v.chain = chain;
|
pEdict->v.chain = chain;
|
||||||
chain = pEdict;
|
chain = pEdict;
|
||||||
|
@ -2700,7 +2719,7 @@ pfnIndexOfEdict
|
||||||
*/
|
*/
|
||||||
int pfnIndexOfEdict( const edict_t *pEdict )
|
int pfnIndexOfEdict( const edict_t *pEdict )
|
||||||
{
|
{
|
||||||
if( !SV_IsValidEdict( pEdict ))
|
if( !SV_IsValidEdict( pEdict ) || !pEdict->pvPrivateData || ( pEdict->v.flags & FL_KILLME ))
|
||||||
return 0;
|
return 0;
|
||||||
return NUM_FOR_EDICT( pEdict );
|
return NUM_FOR_EDICT( pEdict );
|
||||||
}
|
}
|
||||||
|
@ -2713,12 +2732,16 @@ pfnPEntityOfEntIndex
|
||||||
*/
|
*/
|
||||||
edict_t* pfnPEntityOfEntIndex( int iEntIndex )
|
edict_t* pfnPEntityOfEntIndex( int iEntIndex )
|
||||||
{
|
{
|
||||||
|
edict_t *pEdict;
|
||||||
|
|
||||||
if( iEntIndex < 0 || iEntIndex >= svgame.numEntities )
|
if( iEntIndex < 0 || iEntIndex >= svgame.numEntities )
|
||||||
return NULL; // out of range
|
return NULL; // out of range
|
||||||
|
|
||||||
if( EDICT_NUM( iEntIndex )->free )
|
pEdict = EDICT_NUM( iEntIndex );
|
||||||
|
|
||||||
|
if( !SV_IsValidEdict( pEdict ) || !pEdict->pvPrivateData || ( pEdict->v.flags & FL_KILLME ))
|
||||||
return NULL;
|
return NULL;
|
||||||
return EDICT_NUM( iEntIndex );
|
return pEdict;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2739,9 +2762,21 @@ edict_t* pfnFindEntityByVars( entvars_t *pvars )
|
||||||
for( i = 0; i < svgame.numEntities; i++ )
|
for( i = 0; i < svgame.numEntities; i++ )
|
||||||
{
|
{
|
||||||
e = EDICT_NUM( i );
|
e = EDICT_NUM( i );
|
||||||
|
|
||||||
|
// g-cont. should we ignore invalid ents ?
|
||||||
|
if( e->free || !e->pvPrivateData || e->v.flags & FL_KILLME )
|
||||||
|
continue;
|
||||||
|
|
||||||
if( &e->v == pvars )
|
if( &e->v == pvars )
|
||||||
|
{
|
||||||
|
if( e->v.pContainingEntity != e )
|
||||||
|
{
|
||||||
|
MsgDev( D_NOTE, "fixing pContainingEntity for %s\n", SV_ClassName( e ));
|
||||||
|
e->v.pContainingEntity = e;
|
||||||
|
}
|
||||||
return e; // found it
|
return e; // found it
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2756,8 +2791,9 @@ static void *pfnGetModelPtr( edict_t* pEdict )
|
||||||
{
|
{
|
||||||
model_t *mod;
|
model_t *mod;
|
||||||
|
|
||||||
if( !pEdict || pEdict->free )
|
if( !SV_IsValidEdict( pEdict ) || !pEdict->pvPrivateData || pEdict->v.flags & FL_KILLME )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
mod = CM_ClipHandleToModel( pEdict->v.modelindex );
|
mod = CM_ClipHandleToModel( pEdict->v.modelindex );
|
||||||
return Mod_Extradata( mod );
|
return Mod_Extradata( mod );
|
||||||
}
|
}
|
||||||
|
@ -3046,7 +3082,7 @@ void pfnSetView( const edict_t *pClient, const edict_t *pViewent )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pViewent == NULL || pViewent->free )
|
if( !pViewent || pViewent->free || !pViewent->pvPrivateData || pViewent->v.flags & FL_KILLME )
|
||||||
{
|
{
|
||||||
MsgDev( D_ERROR, "PF_SetView: invalid viewent!\n" );
|
MsgDev( D_ERROR, "PF_SetView: invalid viewent!\n" );
|
||||||
return;
|
return;
|
||||||
|
@ -3168,7 +3204,6 @@ int pfnIsMapValid( char *filename )
|
||||||
char *spawn_entity;
|
char *spawn_entity;
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
// determine spawn entity classname
|
|
||||||
// determine spawn entity classname
|
// determine spawn entity classname
|
||||||
if( sv_maxclients->integer == 1 )
|
if( sv_maxclients->integer == 1 )
|
||||||
spawn_entity = GI->sp_entity;
|
spawn_entity = GI->sp_entity;
|
||||||
|
@ -3293,7 +3328,8 @@ int pfnNumberOfEntities( void )
|
||||||
|
|
||||||
for( i = 0; i < svgame.numEntities; i++ )
|
for( i = 0; i < svgame.numEntities; i++ )
|
||||||
{
|
{
|
||||||
if( !svgame.edicts[i].free )
|
if( svgame.edicts[i].free || ( svgame.edicts[i].v.flags & FL_KILLME ))
|
||||||
|
continue;
|
||||||
total++;
|
total++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3730,7 +3766,7 @@ int pfnCheckVisibility( const edict_t *ent, byte *pset )
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// NOTE: uncommenat this if you want to get more accuracy culling on large brushes
|
// NOTE: uncomment this if you want to get more accuracy culling on large brushes
|
||||||
if( Mod_GetType( ent->v.modelindex ) == mod_brush )
|
if( Mod_GetType( ent->v.modelindex ) == mod_brush )
|
||||||
{
|
{
|
||||||
if( !Mod_BoxVisible( ent->v.absmin, ent->v.absmax, pset ))
|
if( !Mod_BoxVisible( ent->v.absmin, ent->v.absmax, pset ))
|
||||||
|
|
|
@ -28,7 +28,7 @@ convar_t *sv_airaccelerate;
|
||||||
convar_t *sv_wateraccelerate;
|
convar_t *sv_wateraccelerate;
|
||||||
convar_t *sv_maxvelocity;
|
convar_t *sv_maxvelocity;
|
||||||
convar_t *sv_gravity;
|
convar_t *sv_gravity;
|
||||||
convar_t *sv_stepheight;
|
convar_t *sv_stepsize;
|
||||||
convar_t *sv_rollangle;
|
convar_t *sv_rollangle;
|
||||||
convar_t *sv_rollspeed;
|
convar_t *sv_rollspeed;
|
||||||
convar_t *sv_wallbounce;
|
convar_t *sv_wallbounce;
|
||||||
|
@ -195,7 +195,7 @@ void SV_UpdateMovevars( void )
|
||||||
svgame.movevars.edgefriction = sv_edgefriction->value;
|
svgame.movevars.edgefriction = sv_edgefriction->value;
|
||||||
svgame.movevars.waterfriction = sv_waterfriction->value;
|
svgame.movevars.waterfriction = sv_waterfriction->value;
|
||||||
svgame.movevars.bounce = sv_wallbounce->value;
|
svgame.movevars.bounce = sv_wallbounce->value;
|
||||||
svgame.movevars.stepsize = sv_stepheight->value;
|
svgame.movevars.stepsize = sv_stepsize->value;
|
||||||
svgame.movevars.maxvelocity = sv_maxvelocity->value;
|
svgame.movevars.maxvelocity = sv_maxvelocity->value;
|
||||||
svgame.movevars.zmax = sv_zmax->value;
|
svgame.movevars.zmax = sv_zmax->value;
|
||||||
svgame.movevars.waveHeight = sv_wateramp->value;
|
svgame.movevars.waveHeight = sv_wateramp->value;
|
||||||
|
@ -619,7 +619,7 @@ void SV_Init( void )
|
||||||
sv_footsteps = Cvar_Get ("mp_footsteps", "1", CVAR_PHYSICINFO, "can hear footsteps from other players" );
|
sv_footsteps = Cvar_Get ("mp_footsteps", "1", CVAR_PHYSICINFO, "can hear footsteps from other players" );
|
||||||
|
|
||||||
rcon_password = Cvar_Get( "rcon_password", "", 0, "remote connect password" );
|
rcon_password = Cvar_Get( "rcon_password", "", 0, "remote connect password" );
|
||||||
sv_stepheight = Cvar_Get( "sv_stepheight", "18", CVAR_ARCHIVE|CVAR_PHYSICINFO, "how high you can step up" );
|
sv_stepsize = Cvar_Get( "sv_stepsize", "18", CVAR_ARCHIVE|CVAR_PHYSICINFO, "how high you can step up" );
|
||||||
sv_newunit = Cvar_Get( "sv_newunit", "0", 0, "sets to 1 while new unit is loading" );
|
sv_newunit = Cvar_Get( "sv_newunit", "0", 0, "sets to 1 while new unit is loading" );
|
||||||
hostname = Cvar_Get( "hostname", "unnamed", CVAR_SERVERINFO|CVAR_SERVERNOTIFY|CVAR_ARCHIVE, "host name" );
|
hostname = Cvar_Get( "hostname", "unnamed", CVAR_SERVERINFO|CVAR_SERVERNOTIFY|CVAR_ARCHIVE, "host name" );
|
||||||
timeout = Cvar_Get( "timeout", "125", CVAR_SERVERNOTIFY, "connection timeout" );
|
timeout = Cvar_Get( "timeout", "125", CVAR_SERVERNOTIFY, "connection timeout" );
|
||||||
|
@ -628,7 +628,7 @@ void SV_Init( void )
|
||||||
allow_download = Cvar_Get( "allow_download", "0", CVAR_ARCHIVE, "allow download resources" );
|
allow_download = Cvar_Get( "allow_download", "0", CVAR_ARCHIVE, "allow download resources" );
|
||||||
sv_wallbounce = Cvar_Get( "sv_wallbounce", "1.0", CVAR_PHYSICINFO, "bounce factor for client with MOVETYPE_BOUNCE" );
|
sv_wallbounce = Cvar_Get( "sv_wallbounce", "1.0", CVAR_PHYSICINFO, "bounce factor for client with MOVETYPE_BOUNCE" );
|
||||||
sv_spectatormaxspeed = Cvar_Get( "sv_spectatormaxspeed", "500", CVAR_PHYSICINFO, "spectator maxspeed" );
|
sv_spectatormaxspeed = Cvar_Get( "sv_spectatormaxspeed", "500", CVAR_PHYSICINFO, "spectator maxspeed" );
|
||||||
sv_waterfriction = Cvar_Get( "sv_waterfriction", "4", CVAR_PHYSICINFO, "how fast you slow down in water" );
|
sv_waterfriction = Cvar_Get( "sv_waterfriction", "1", CVAR_PHYSICINFO, "how fast you slow down in water" );
|
||||||
sv_wateraccelerate = Cvar_Get( "sv_wateraccelerate", "10", CVAR_PHYSICINFO, "rate at which a player accelerates to sv_maxspeed while in the water" );
|
sv_wateraccelerate = Cvar_Get( "sv_wateraccelerate", "10", CVAR_PHYSICINFO, "rate at which a player accelerates to sv_maxspeed while in the water" );
|
||||||
sv_rollangle = Cvar_Get( "sv_rollangle", "2", CVAR_PHYSICINFO, "how much to tilt the view when strafing" );
|
sv_rollangle = Cvar_Get( "sv_rollangle", "2", CVAR_PHYSICINFO, "how much to tilt the view when strafing" );
|
||||||
sv_rollspeed = Cvar_Get( "sv_rollspeed", "200", CVAR_PHYSICINFO, "how much strafing is necessary to tilt the view" );
|
sv_rollspeed = Cvar_Get( "sv_rollspeed", "200", CVAR_PHYSICINFO, "how much strafing is necessary to tilt the view" );
|
||||||
|
@ -638,7 +638,7 @@ void SV_Init( void )
|
||||||
sv_maxspeed = Cvar_Get( "sv_maxspeed", "320", CVAR_PHYSICINFO, "maximum speed a player can accelerate to when on ground");
|
sv_maxspeed = Cvar_Get( "sv_maxspeed", "320", CVAR_PHYSICINFO, "maximum speed a player can accelerate to when on ground");
|
||||||
sv_accelerate = Cvar_Get( "sv_accelerate", "10", CVAR_PHYSICINFO, "rate at which a player accelerates to sv_maxspeed" );
|
sv_accelerate = Cvar_Get( "sv_accelerate", "10", CVAR_PHYSICINFO, "rate at which a player accelerates to sv_maxspeed" );
|
||||||
sv_friction = Cvar_Get( "sv_friction", "4", CVAR_PHYSICINFO, "how fast you slow down" );
|
sv_friction = Cvar_Get( "sv_friction", "4", CVAR_PHYSICINFO, "how fast you slow down" );
|
||||||
sv_edgefriction = Cvar_Get( "sv_edgefriction", "2", CVAR_PHYSICINFO, "how much you slow down when nearing a ledge you might fall off" );
|
sv_edgefriction = Cvar_Get( "edgefriction", "2", CVAR_PHYSICINFO, "how much you slow down when nearing a ledge you might fall off" );
|
||||||
sv_stopspeed = Cvar_Get( "sv_stopspeed", "100", CVAR_PHYSICINFO, "how fast you come to a complete stop" );
|
sv_stopspeed = Cvar_Get( "sv_stopspeed", "100", CVAR_PHYSICINFO, "how fast you come to a complete stop" );
|
||||||
sv_maxclients = Cvar_Get( "maxplayers", "1", CVAR_LATCH|CVAR_SERVERNOTIFY, "server clients limit" );
|
sv_maxclients = Cvar_Get( "maxplayers", "1", CVAR_LATCH|CVAR_SERVERNOTIFY, "server clients limit" );
|
||||||
sv_check_errors = Cvar_Get( "sv_check_errors", "0", CVAR_ARCHIVE, "ignore physic engine errors" );
|
sv_check_errors = Cvar_Get( "sv_check_errors", "0", CVAR_ARCHIVE, "ignore physic engine errors" );
|
||||||
|
|
|
@ -40,32 +40,46 @@ SV_CheckAllEnts
|
||||||
*/
|
*/
|
||||||
void SV_CheckAllEnts( void )
|
void SV_CheckAllEnts( void )
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
edict_t *e;
|
edict_t *e;
|
||||||
|
vec3_t point;
|
||||||
|
int i;
|
||||||
|
|
||||||
if( !sv_check_errors->integer ) return;
|
if( !sv_check_errors->integer || sv.state != ss_active )
|
||||||
|
return;
|
||||||
|
|
||||||
// see if any solid entities are inside the final position
|
// see if any solid entities are inside the final position
|
||||||
for( i = svgame.globals->maxClients + 1; i < svgame.numEntities; i++ )
|
for( i = svgame.globals->maxClients + 1; i < svgame.numEntities; i++ )
|
||||||
{
|
{
|
||||||
e = EDICT_NUM( i );
|
e = EDICT_NUM( i );
|
||||||
|
|
||||||
if( !SV_IsValidEdict( e )) continue;
|
if( e->free && e->pvPrivateData != NULL )
|
||||||
|
|
||||||
switch( e->v.movetype )
|
|
||||||
{
|
{
|
||||||
case MOVETYPE_PUSH:
|
MsgDev( D_ERROR, "Freed entity %s (%i) has private data.\n", SV_ClassName( e ), i );
|
||||||
case MOVETYPE_NONE:
|
|
||||||
case MOVETYPE_FOLLOW:
|
|
||||||
case MOVETYPE_NOCLIP:
|
|
||||||
case MOVETYPE_COMPOUND:
|
|
||||||
continue;
|
continue;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( SV_TestEntityPosition( e ))
|
if( !SV_IsValidEdict( e ))
|
||||||
MsgDev( D_INFO, "Stuck entity %s\n", SV_ClassName( e ));
|
continue;
|
||||||
|
|
||||||
|
if( e->v.flags & FL_KILLME )
|
||||||
|
{
|
||||||
|
MsgDev( D_ERROR, "Fantom entity %s (%i) detected.\n", SV_ClassName( e ), i );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !e->v.pContainingEntity || e->v.pContainingEntity != e )
|
||||||
|
{
|
||||||
|
MsgDev( D_ERROR, "Entity %s (%i) has invalid container, fixed.\n", SV_ClassName( e ), i );
|
||||||
|
e->v.pContainingEntity = e;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !e->pvPrivateData || !Mem_IsAllocated( svgame.mempool, e->pvPrivateData ))
|
||||||
|
{
|
||||||
|
MsgDev( D_ERROR, "Entity %s (%i) trashed private data.\n", SV_ClassName( e ), i );
|
||||||
|
e->pvPrivateData = NULL;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -737,7 +751,7 @@ static edict_t *SV_PushMove( edict_t *pusher, float movetime )
|
||||||
sv_pushed_t *p, *pushed_p;
|
sv_pushed_t *p, *pushed_p;
|
||||||
edict_t *check;
|
edict_t *check;
|
||||||
|
|
||||||
if( sv.state == ss_loading || VectorIsNull( pusher->v.velocity ))
|
if( VectorIsNull( pusher->v.velocity ))
|
||||||
{
|
{
|
||||||
pusher->v.ltime += movetime;
|
pusher->v.ltime += movetime;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -858,7 +872,7 @@ static edict_t *SV_PushRotate( edict_t *pusher, float movetime )
|
||||||
vec3_t org, org2, temp;
|
vec3_t org, org2, temp;
|
||||||
edict_t *check;
|
edict_t *check;
|
||||||
|
|
||||||
if( sv.state == ss_loading || VectorIsNull( pusher->v.avelocity ))
|
if( VectorIsNull( pusher->v.avelocity ))
|
||||||
{
|
{
|
||||||
pusher->v.ltime += movetime;
|
pusher->v.ltime += movetime;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1033,7 +1047,7 @@ void SV_Physics_Pusher( edict_t *ent )
|
||||||
// otherwise, just stay in place until the obstacle is gone
|
// otherwise, just stay in place until the obstacle is gone
|
||||||
if( pBlocker ) svgame.dllFuncs.pfnBlocked( ent, pBlocker );
|
if( pBlocker ) svgame.dllFuncs.pfnBlocked( ent, pBlocker );
|
||||||
|
|
||||||
if( thinktime > oldtime && thinktime <= ent->v.ltime || ( ent->v.flags & FL_ALWAYSTHINK ))
|
if( thinktime > oldtime && (( ent->v.flags & FL_ALWAYSTHINK ) || thinktime <= ent->v.ltime ))
|
||||||
{
|
{
|
||||||
ent->v.nextthink = 0.0f;
|
ent->v.nextthink = 0.0f;
|
||||||
svgame.globals->time = sv.time;
|
svgame.globals->time = sv.time;
|
||||||
|
@ -1502,7 +1516,7 @@ void SV_Physics_Step( edict_t *ent )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( svgame.force_retouch > 0 )
|
if( svgame.force_retouch != 0.0f )
|
||||||
{
|
{
|
||||||
trace = SV_Move(ent->v.origin, ent->v.mins, ent->v.maxs, ent->v.origin, MOVE_NORMAL, ent );
|
trace = SV_Move(ent->v.origin, ent->v.mins, ent->v.maxs, ent->v.origin, MOVE_NORMAL, ent );
|
||||||
if(( trace.fraction < 1.0f || trace.startsolid ) && SV_IsValidEdict( trace.ent ))
|
if(( trace.fraction < 1.0f || trace.startsolid ) && SV_IsValidEdict( trace.ent ))
|
||||||
|
@ -1546,7 +1560,7 @@ static void SV_Physics_Client( edict_t *ent )
|
||||||
default: return;
|
default: return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( svgame.force_retouch > 0 )
|
if( svgame.force_retouch != 0.0f )
|
||||||
{
|
{
|
||||||
// force retouch even for stationary
|
// force retouch even for stationary
|
||||||
SV_LinkEdict( ent, true );
|
SV_LinkEdict( ent, true );
|
||||||
|
@ -1570,7 +1584,7 @@ static void SV_Physics_Entity( edict_t *ent )
|
||||||
}
|
}
|
||||||
ent->v.flags &= ~FL_BASEVELOCITY;
|
ent->v.flags &= ~FL_BASEVELOCITY;
|
||||||
|
|
||||||
if( svgame.force_retouch > 0 )
|
if( svgame.force_retouch != 0.0f )
|
||||||
{
|
{
|
||||||
// force retouch even for stationary
|
// force retouch even for stationary
|
||||||
SV_LinkEdict( ent, true );
|
SV_LinkEdict( ent, true );
|
||||||
|
@ -1651,6 +1665,8 @@ void SV_Physics( void )
|
||||||
|
|
||||||
svgame.globals->time = sv.time;
|
svgame.globals->time = sv.time;
|
||||||
svgame.force_retouch = svgame.globals->force_retouch;
|
svgame.force_retouch = svgame.globals->force_retouch;
|
||||||
|
if( svgame.force_retouch != 0.0f )
|
||||||
|
svgame.globals->force_retouch = max( 0.0f, svgame.globals->force_retouch - 1.0f );
|
||||||
|
|
||||||
// let the progs know that a new frame has started
|
// let the progs know that a new frame has started
|
||||||
svgame.dllFuncs.pfnStartFrame();
|
svgame.dllFuncs.pfnStartFrame();
|
||||||
|
@ -1672,7 +1688,4 @@ void SV_Physics( void )
|
||||||
|
|
||||||
// at end of frame kill all entities which supposed to it
|
// at end of frame kill all entities which supposed to it
|
||||||
SV_FreeOldEntities();
|
SV_FreeOldEntities();
|
||||||
|
|
||||||
if( svgame.force_retouch > 0 )
|
|
||||||
svgame.globals->force_retouch = max( 0.0f, svgame.globals->force_retouch - 1.0f );
|
|
||||||
}
|
}
|
|
@ -248,47 +248,7 @@ static int pfnHullPointContents( struct hull_s *hull, int num, float *p )
|
||||||
|
|
||||||
static pmtrace_t pfnPlayerTrace( float *start, float *end, int traceFlags, int ignore_pe )
|
static pmtrace_t pfnPlayerTrace( float *start, float *end, int traceFlags, int ignore_pe )
|
||||||
{
|
{
|
||||||
#if 1
|
|
||||||
return PM_PlayerTrace( svgame.pmove, start, end, traceFlags, svgame.pmove->usehull, ignore_pe, NULL );
|
return PM_PlayerTrace( svgame.pmove, start, end, traceFlags, svgame.pmove->usehull, ignore_pe, NULL );
|
||||||
#else
|
|
||||||
float *mins;
|
|
||||||
float *maxs;
|
|
||||||
trace_t result;
|
|
||||||
edict_t *clent = EDICT_NUM( svgame.pmove->player_index + 1 );
|
|
||||||
pmtrace_t out;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if( VectorIsNAN( start ) || VectorIsNAN( end ))
|
|
||||||
Host_Error( "PlayerTrace: NAN errors detected ('%f %f %f', '%f %f %f'\n", start[0], start[1], start[2], end[0], end[1], end[2] );
|
|
||||||
|
|
||||||
svgame.pmove->usehull = bound( 0, svgame.pmove->usehull, 3 );
|
|
||||||
mins = svgame.pmove->player_mins[svgame.pmove->usehull];
|
|
||||||
maxs = svgame.pmove->player_maxs[svgame.pmove->usehull];
|
|
||||||
|
|
||||||
result = SV_Move( start, mins, maxs, end, MOVE_NORMAL, clent );
|
|
||||||
|
|
||||||
VectorCopy( result.vecEndPos, out.endpos );
|
|
||||||
VectorCopy( result.vecPlaneNormal, out.plane.normal );
|
|
||||||
out.plane.dist = result.flPlaneDist;
|
|
||||||
out.allsolid = result.fAllSolid;
|
|
||||||
out.startsolid = result.fStartSolid;
|
|
||||||
out.hitgroup = result.iHitgroup;
|
|
||||||
out.inopen = result.fInOpen;
|
|
||||||
out.inwater = result.fInWater;
|
|
||||||
out.fraction = result.flFraction;
|
|
||||||
out.ent = -1;
|
|
||||||
|
|
||||||
for( i = 0; result.pHit != NULL && i < svgame.pmove->numphysent; i++ )
|
|
||||||
{
|
|
||||||
if( svgame.pmove->physents[i].info == result.pHit->serialnumber )
|
|
||||||
{
|
|
||||||
out.ent = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return out;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static pmtrace_t *pfnTraceLine( float *start, float *end, int flags, int usehull, int ignore_pe )
|
static pmtrace_t *pfnTraceLine( float *start, float *end, int flags, int usehull, int ignore_pe )
|
||||||
|
|
|
@ -232,7 +232,7 @@ hull_t *SV_HullForBsp( edict_t *ent, const vec3_t mins, const vec3_t maxs, float
|
||||||
model = CM_ClipHandleToModel( ent->v.modelindex );
|
model = CM_ClipHandleToModel( ent->v.modelindex );
|
||||||
|
|
||||||
if( !model || model->type != mod_brush )
|
if( !model || model->type != mod_brush )
|
||||||
Host_Error( "Entity %i SOLID_BSP with a non bsp model %i\n", ent->serialnumber, model->type );
|
Host_Error( "Entity %i SOLID_BSP with a non bsp model %i\n", NUM_FOR_EDICT( ent ), model->type );
|
||||||
|
|
||||||
VectorSubtract( maxs, mins, size );
|
VectorSubtract( maxs, mins, size );
|
||||||
|
|
||||||
|
|
Reference in New Issue