2008-05-20 22:00:00 +02:00
|
|
|
|
//=======================================================================
|
|
|
|
|
// Copyright XashXT Group 2008 <20>
|
2008-05-23 22:00:00 +02:00
|
|
|
|
// sv_progs.c - server.dat interface
|
2008-05-20 22:00:00 +02:00
|
|
|
|
//=======================================================================
|
|
|
|
|
|
2008-06-09 22:00:00 +02:00
|
|
|
|
#include "common.h"
|
2008-05-20 22:00:00 +02:00
|
|
|
|
#include "server.h"
|
2008-07-23 22:00:00 +02:00
|
|
|
|
#include "byteorder.h"
|
2008-11-27 22:00:00 +01:00
|
|
|
|
#include "matrix_lib.h"
|
2008-08-15 22:00:00 +02:00
|
|
|
|
#include "const.h"
|
2008-05-22 22:00:00 +02:00
|
|
|
|
|
2008-08-15 22:00:00 +02:00
|
|
|
|
void SV_BeginIncreaseEdicts( void )
|
2008-05-20 22:00:00 +02:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
edict_t *ent;
|
|
|
|
|
|
|
|
|
|
// links don't survive the transition, so unlink everything
|
2008-12-15 22:00:00 +01:00
|
|
|
|
for( i = 0, ent = svg.edicts; i < svs.globals->maxEntities; i++, ent++ )
|
2008-05-20 22:00:00 +02:00
|
|
|
|
{
|
2008-12-15 22:00:00 +01:00
|
|
|
|
if( !ent->free ) SV_UnlinkEdict( svg.edicts + i ); // free old entity
|
|
|
|
|
Mem_Set( &ent->pvEngineData->clusternums, 0, sizeof( ent->pvEngineData->clusternums ));
|
2008-05-20 22:00:00 +02:00
|
|
|
|
}
|
|
|
|
|
SV_ClearWorld();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SV_EndIncreaseEdicts(void)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
edict_t *ent;
|
|
|
|
|
|
2008-12-15 22:00:00 +01:00
|
|
|
|
for( i = 0, ent = svg.edicts; i < svs.globals->maxEntities; i++, ent++ )
|
2008-05-20 22:00:00 +02:00
|
|
|
|
{
|
|
|
|
|
// link every entity except world
|
2008-12-15 22:00:00 +01:00
|
|
|
|
if( !ent->free ) SV_LinkEdict(ent);
|
2008-05-20 22:00:00 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-08-15 22:00:00 +02:00
|
|
|
|
void SV_RestoreEdict( edict_t *ent )
|
|
|
|
|
{
|
|
|
|
|
// link it into the bsp tree
|
|
|
|
|
SV_LinkEdict( ent );
|
|
|
|
|
SV_CreatePhysBody( ent );
|
|
|
|
|
SV_SetPhysForce( ent ); // restore forces ...
|
|
|
|
|
SV_SetMassCentre( ent ); // and mass force
|
|
|
|
|
|
2008-12-15 22:00:00 +01:00
|
|
|
|
if( ent->v.ambient ) // restore loopsound
|
|
|
|
|
ent->pvEngineData->s.soundindex = SV_SoundIndex( STRING( ent->v.ambient ));
|
2008-05-20 22:00:00 +02:00
|
|
|
|
}
|