mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-11 14:42:05 +08:00
Apply 4150 update
This commit is contained in:
+4
-21
@@ -113,24 +113,6 @@ typedef struct
|
||||
file_t *file;
|
||||
} server_log_t;
|
||||
|
||||
// like as entity_state_t in Quake
|
||||
typedef struct
|
||||
{
|
||||
char model[MAX_QPATH]; // name of static-entity model for right precache
|
||||
vec3_t origin;
|
||||
vec3_t angles;
|
||||
short sequence;
|
||||
short frame;
|
||||
short colormap;
|
||||
byte skin; // can't set contents! only real skin!
|
||||
byte body;
|
||||
float scale;
|
||||
byte rendermode;
|
||||
byte renderamt;
|
||||
color24 rendercolor;
|
||||
byte renderfx;
|
||||
} sv_static_entity_t;
|
||||
|
||||
typedef struct server_s
|
||||
{
|
||||
sv_state_t state; // precache commands are only valid during load
|
||||
@@ -159,8 +141,6 @@ typedef struct server_s
|
||||
char event_precache[MAX_EVENTS][MAX_QPATH];
|
||||
byte model_precache_flags[MAX_MODELS];
|
||||
model_t *models[MAX_MODELS];
|
||||
|
||||
sv_static_entity_t static_entities[MAX_STATIC_ENTITIES];
|
||||
int num_static_entities;
|
||||
|
||||
// run local lightstyles to let SV_LightPoint grab the actual information
|
||||
@@ -386,6 +366,7 @@ typedef struct
|
||||
int next_client_entities; // next client_entity to use
|
||||
entity_state_t *packet_entities; // [num_client_entities]
|
||||
entity_state_t *baselines; // [GI->max_edicts]
|
||||
entity_state_t *static_entities; // [MAX_STATIC_ENTITIES];
|
||||
|
||||
double last_heartbeat;
|
||||
challenge_t challenges[MAX_CHALLENGES]; // to prevent invalid IPs from connecting
|
||||
@@ -576,6 +557,7 @@ void SV_RequestMissingResources( void );
|
||||
// sv_frame.c
|
||||
//
|
||||
void SV_InactivateClients( void );
|
||||
int SV_FindBestBaselineForStatic( int index, entity_state_t **baseline, entity_state_t *to );
|
||||
void SV_WriteFrameToClient( sv_client_t *client, sizebuf_t *msg );
|
||||
void SV_BuildClientFrame( sv_client_t *client );
|
||||
void SV_SendMessagesToAll( void );
|
||||
@@ -612,8 +594,8 @@ const char *SV_GetString( string_t iString );
|
||||
sv_client_t *SV_ClientFromEdict( const edict_t *pEdict, qboolean spawned_only );
|
||||
int SV_MapIsValid( const char *filename, const char *spawn_entity, const char *landmark_name );
|
||||
void SV_StartSound( edict_t *ent, int chan, const char *sample, float vol, float attn, int flags, int pitch );
|
||||
void SV_CreateStaticEntity( struct sizebuf_s *msg, sv_static_entity_t *ent );
|
||||
edict_t *SV_FindGlobalEntity( string_t classname, string_t globalname );
|
||||
qboolean SV_CreateStaticEntity( struct sizebuf_s *msg, int index );
|
||||
void SV_SendUserReg( sizebuf_t *msg, sv_user_message_t *user );
|
||||
edict_t* pfnPEntityOfEntIndex( int iEntIndex );
|
||||
int pfnIndexOfEdict( const edict_t *pEdict );
|
||||
@@ -622,6 +604,7 @@ void SV_UpdateBaseVelocity( edict_t *ent );
|
||||
byte *pfnSetFatPVS( const float *org );
|
||||
byte *pfnSetFatPAS( const float *org );
|
||||
int pfnPrecacheModel( const char *s );
|
||||
int pfnModelIndex( const char *m );
|
||||
void pfnRemoveEntity( edict_t* e );
|
||||
void SV_RestartAmbientSounds( void );
|
||||
void SV_RestartDecals( void );
|
||||
|
||||
@@ -800,6 +800,7 @@ void SV_InitHostCommands( void )
|
||||
Cmd_AddCommand( "map_background", SV_MapBackground_f, "set background map" );
|
||||
Cmd_AddCommand( "load", SV_Load_f, "load a saved game file" );
|
||||
Cmd_AddCommand( "loadquick", SV_QuickLoad_f, "load a quick-saved game file" );
|
||||
Cmd_AddCommand( "reload", SV_Reload_f, "continue from latest save or restart level" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -818,7 +819,6 @@ void SV_InitOperatorCommands( void )
|
||||
Cmd_AddCommand( "clientinfo", SV_ClientInfo_f, "print user infostring (player num required)" );
|
||||
Cmd_AddCommand( "playersonly", SV_PlayersOnly_f, "freezes time, except for players" );
|
||||
Cmd_AddCommand( "restart", SV_Restart_f, "restarting current level" );
|
||||
Cmd_AddCommand( "reload", SV_Reload_f, "continue from latest save or restart level" );
|
||||
Cmd_AddCommand( "entpatch", SV_EntPatch_f, "write entity patch to allow external editing" );
|
||||
Cmd_AddCommand( "edict_usage", SV_EdictUsage_f, "show info about edicts usage" );
|
||||
Cmd_AddCommand( "entity_info", SV_EntityInfo_f, "show more info about edicts" );
|
||||
@@ -852,7 +852,6 @@ void SV_KillOperatorCommands( void )
|
||||
Cmd_RemoveCommand( "clientinfo" );
|
||||
Cmd_RemoveCommand( "playersonly" );
|
||||
Cmd_RemoveCommand( "restart" );
|
||||
Cmd_RemoveCommand( "reload" );
|
||||
Cmd_RemoveCommand( "entpatch" );
|
||||
Cmd_RemoveCommand( "edict_usage" );
|
||||
Cmd_RemoveCommand( "entity_info" );
|
||||
|
||||
@@ -172,6 +172,13 @@ Encode a client frame onto the network channel
|
||||
|
||||
=============================================================================
|
||||
*/
|
||||
/*
|
||||
=============
|
||||
SV_FindBestBaseline
|
||||
|
||||
trying to deltas with previous entities
|
||||
=============
|
||||
*/
|
||||
int SV_FindBestBaseline( sv_client_t *cl, int index, entity_state_t **baseline, entity_state_t *to, client_frame_t *frame, qboolean player )
|
||||
{
|
||||
int bestBitCount;
|
||||
@@ -205,6 +212,43 @@ int SV_FindBestBaseline( sv_client_t *cl, int index, entity_state_t **baseline,
|
||||
return index - bestfound;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
SV_FindBestBaselineForStatic
|
||||
|
||||
trying to deltas with previous static entities
|
||||
=============
|
||||
*/
|
||||
int SV_FindBestBaselineForStatic( int index, entity_state_t **baseline, entity_state_t *to )
|
||||
{
|
||||
int bestBitCount;
|
||||
int i, bitCount;
|
||||
int bestfound, j;
|
||||
|
||||
bestBitCount = j = Delta_TestBaseline( *baseline, to, false, sv.time );
|
||||
bestfound = index;
|
||||
|
||||
// lookup backward for previous 64 states and try to interpret current delta as baseline
|
||||
for( i = index - 1; bestBitCount > 0 && i >= 0 && ( index - i ) < ( MAX_CUSTOM_BASELINES - 1 ); i-- )
|
||||
{
|
||||
// don't worry about underflow in circular buffer
|
||||
entity_state_t *test = &svs.static_entities[i];
|
||||
|
||||
bitCount = Delta_TestBaseline( test, to, false, sv.time );
|
||||
|
||||
if( bitCount < bestBitCount )
|
||||
{
|
||||
bestBitCount = bitCount;
|
||||
bestfound = i;
|
||||
}
|
||||
}
|
||||
|
||||
// using delta from previous entity as baseline for current
|
||||
if( index != bestfound )
|
||||
*baseline = &svs.static_entities[bestfound];
|
||||
return index - bestfound;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
SV_EmitPacketEntities
|
||||
|
||||
+47
-65
@@ -497,39 +497,47 @@ SV_CreateStaticEntity
|
||||
NOTE: static entities only accepted when game is loading
|
||||
=======================
|
||||
*/
|
||||
void SV_CreateStaticEntity( sizebuf_t *msg, sv_static_entity_t *ent )
|
||||
qboolean SV_CreateStaticEntity( sizebuf_t *msg, int index )
|
||||
{
|
||||
int index;
|
||||
entity_state_t nullstate, *baseline;
|
||||
entity_state_t *state;
|
||||
int offset;
|
||||
|
||||
if( index >= ( MAX_STATIC_ENTITIES - 1 ))
|
||||
{
|
||||
if( !sv.static_ents_overflow )
|
||||
{
|
||||
Con_Printf( S_WARN "MAX_STATIC_ENTITIES limit exceeded (%d)\n", MAX_STATIC_ENTITIES );
|
||||
sv.static_ents_overflow = true;
|
||||
}
|
||||
|
||||
sv.ignored_static_ents++; // continue overflowed entities
|
||||
return false;
|
||||
}
|
||||
|
||||
// this can happens if serialized map contain too many static entities...
|
||||
if( MSG_GetNumBytesLeft( msg ) < 35 )
|
||||
if( MSG_GetNumBytesLeft( msg ) < 50 )
|
||||
{
|
||||
sv.ignored_static_ents++;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
index = SV_ModelIndex( ent->model );
|
||||
state = &svs.static_entities[index]; // allocate a new one
|
||||
memset( &nullstate, 0, sizeof( nullstate ));
|
||||
baseline = &nullstate;
|
||||
|
||||
// restore modelindex from modelname (already precached)
|
||||
state->modelindex = pfnModelIndex( STRING( state->messagenum ));
|
||||
state->entityType = ENTITY_NORMAL; // select delta-encode
|
||||
state->number = 0;
|
||||
|
||||
// trying to compress with previous delta's
|
||||
offset = SV_FindBestBaselineForStatic( index, &baseline, state );
|
||||
|
||||
MSG_BeginServerCmd( msg, svc_spawnstatic );
|
||||
MSG_WriteShort( msg, index );
|
||||
MSG_WriteWord( msg, ent->sequence );
|
||||
MSG_WriteWord( msg, ent->frame );
|
||||
MSG_WriteWord( msg, ent->colormap );
|
||||
MSG_WriteByte( msg, ent->skin );
|
||||
MSG_WriteByte( msg, ent->body );
|
||||
MSG_WriteCoord( msg, ent->scale );
|
||||
MSG_WriteVec3Coord( msg, ent->origin );
|
||||
MSG_WriteVec3Angles( msg, ent->angles );
|
||||
MSG_WriteByte( msg, ent->rendermode );
|
||||
MSG_WriteDeltaEntity( baseline, state, msg, true, DELTA_STATIC, sv.time, offset );
|
||||
|
||||
if( ent->rendermode != kRenderNormal )
|
||||
{
|
||||
MSG_WriteByte( msg, ent->renderamt );
|
||||
MSG_WriteByte( msg, ent->rendercolor.r );
|
||||
MSG_WriteByte( msg, ent->rendercolor.g );
|
||||
MSG_WriteByte( msg, ent->rendercolor.b );
|
||||
MSG_WriteByte( msg, ent->renderfx );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -541,18 +549,14 @@ Write all the static ents into demo
|
||||
*/
|
||||
void SV_RestartStaticEnts( void )
|
||||
{
|
||||
sv_static_entity_t *clent;
|
||||
int i;
|
||||
int i;
|
||||
|
||||
// remove all the static entities on the client
|
||||
R_ClearStaticEntities();
|
||||
|
||||
// resend them again
|
||||
for( i = 0; i < sv.num_static_entities; i++ )
|
||||
{
|
||||
clent = &sv.static_entities[i];
|
||||
SV_CreateStaticEntity( &sv.reliable_datagram, clent );
|
||||
}
|
||||
SV_CreateStaticEntity( &sv.reliable_datagram, i );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1835,42 +1839,18 @@ move entity to client
|
||||
*/
|
||||
static void pfnMakeStatic( edict_t *ent )
|
||||
{
|
||||
sv_static_entity_t *clent;
|
||||
entity_state_t *state;
|
||||
|
||||
if( !SV_IsValidEdict( ent ))
|
||||
return;
|
||||
|
||||
if( sv.num_static_entities >= MAX_STATIC_ENTITIES )
|
||||
{
|
||||
if( !sv.static_ents_overflow )
|
||||
{
|
||||
Con_Printf( S_WARN "MAX_STATIC_ENTITIES limit exceeded (%d)\n", MAX_STATIC_ENTITIES );
|
||||
sv.static_ents_overflow = true;
|
||||
}
|
||||
sv.ignored_static_ents++; // continue overflowed entities
|
||||
return;
|
||||
}
|
||||
// fill the entity state
|
||||
state = &svs.static_entities[sv.num_static_entities]; // allocate a new one
|
||||
svgame.dllFuncs.pfnCreateBaseline( false, NUM_FOR_EDICT( ent ), state, ent, 0, vec3_origin, vec3_origin );
|
||||
state->messagenum = ent->v.model; // member modelname
|
||||
|
||||
clent = &sv.static_entities[sv.num_static_entities++];
|
||||
|
||||
Q_strncpy( clent->model, STRING( ent->v.model ), sizeof( clent->model ));
|
||||
VectorCopy( ent->v.origin, clent->origin );
|
||||
VectorCopy( ent->v.angles, clent->angles );
|
||||
|
||||
clent->sequence = ent->v.sequence;
|
||||
clent->frame = ent->v.frame * 128;
|
||||
clent->colormap = ent->v.colormap;
|
||||
clent->skin = ent->v.skin;
|
||||
clent->body = ent->v.body;
|
||||
clent->scale = ent->v.scale;
|
||||
clent->rendermode = ent->v.rendermode;
|
||||
clent->renderamt = ent->v.renderamt;
|
||||
clent->rendercolor.r = ent->v.rendercolor[0];
|
||||
clent->rendercolor.g = ent->v.rendercolor[1];
|
||||
clent->rendercolor.b = ent->v.rendercolor[2];
|
||||
clent->renderfx = ent->v.renderfx;
|
||||
|
||||
SV_CreateStaticEntity( &sv.signon, clent );
|
||||
if( SV_CreateStaticEntity( &sv.signon, sv.num_static_entities ))
|
||||
sv.num_static_entities++;
|
||||
|
||||
// remove at end of the frame
|
||||
SetBits( ent->v.flags, FL_KILLME );
|
||||
@@ -1986,31 +1966,31 @@ int SV_BuildSoundMsg( sizebuf_t *msg, edict_t *ent, int chan, const char *sample
|
||||
|
||||
if( vol < 0 || vol > 255 )
|
||||
{
|
||||
Con_Printf( S_ERROR "SV_StartSound: volume = %i\n", vol );
|
||||
Con_Reportf( S_ERROR "SV_StartSound: volume = %i\n", vol );
|
||||
vol = bound( 0, vol, 255 );
|
||||
}
|
||||
|
||||
if( attn < 0.0f || attn > 4.0f )
|
||||
{
|
||||
Con_Printf( S_ERROR "SV_StartSound: attenuation %g must be in range 0-4\n", attn );
|
||||
Con_Reportf( S_ERROR "SV_StartSound: attenuation %g must be in range 0-4\n", attn );
|
||||
attn = bound( 0.0f, attn, 4.0f );
|
||||
}
|
||||
|
||||
if( chan < 0 || chan > 7 )
|
||||
{
|
||||
Con_Printf( S_ERROR "SV_StartSound: channel must be in range 0-7\n" );
|
||||
Con_Reportf( S_ERROR "SV_StartSound: channel must be in range 0-7\n" );
|
||||
chan = bound( 0, chan, 7 );
|
||||
}
|
||||
|
||||
if( pitch < 0 || pitch > 255 )
|
||||
{
|
||||
Con_Printf( S_ERROR "SV_StartSound: pitch = %i\n", pitch );
|
||||
Con_Reportf( S_ERROR "SV_StartSound: pitch = %i\n", pitch );
|
||||
pitch = bound( 0, pitch, 255 );
|
||||
}
|
||||
|
||||
if( !COM_CheckString( sample ))
|
||||
{
|
||||
Con_Printf( S_ERROR "SV_StartSound: passed NULL sample\n" );
|
||||
Con_Reportf( S_ERROR "SV_StartSound: passed NULL sample\n" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -4744,6 +4724,7 @@ void SV_UnloadProgs( void )
|
||||
Cvar_FullSet( "sv_background", "0", FCVAR_READ_ONLY );
|
||||
|
||||
// free entity baselines
|
||||
Z_Free( svs.static_entities );
|
||||
Z_Free( svs.baselines );
|
||||
svs.baselines = NULL;
|
||||
|
||||
@@ -4872,6 +4853,7 @@ qboolean SV_LoadProgs( const char *name )
|
||||
svgame.globals->maxEntities = GI->max_edicts;
|
||||
svgame.globals->maxClients = svs.maxclients;
|
||||
svgame.edicts = Mem_Calloc( svgame.mempool, sizeof( edict_t ) * GI->max_edicts );
|
||||
svs.static_entities = Z_Calloc( sizeof( entity_state_t ) * MAX_STATIC_ENTITIES );
|
||||
svs.baselines = Z_Calloc( sizeof( entity_state_t ) * GI->max_edicts );
|
||||
svgame.numEntities = svs.maxclients + 1; // clients + world
|
||||
|
||||
|
||||
@@ -378,7 +378,7 @@ void SV_CreateBaseline( void )
|
||||
{
|
||||
entity_state_t nullstate, *base;
|
||||
int playermodel;
|
||||
qboolean player;
|
||||
int delta_type;
|
||||
int entnum;
|
||||
|
||||
if( FBitSet( host.features, ENGINE_QUAKE_COMPATIBLE ))
|
||||
@@ -396,13 +396,13 @@ void SV_CreateBaseline( void )
|
||||
|
||||
if( entnum != 0 && entnum <= svs.maxclients )
|
||||
{
|
||||
player = true;
|
||||
delta_type = DELTA_PLAYER;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !pEdict->v.modelindex )
|
||||
continue; // invisible
|
||||
player = false;
|
||||
delta_type = DELTA_ENTITY;
|
||||
}
|
||||
|
||||
// take current state as baseline
|
||||
@@ -415,7 +415,7 @@ void SV_CreateBaseline( void )
|
||||
base->entityType = ENTITY_BEAM;
|
||||
else base->entityType = ENTITY_NORMAL;
|
||||
|
||||
svgame.dllFuncs.pfnCreateBaseline( player, entnum, base, pEdict, playermodel, host.player_mins[0], host.player_maxs[0] );
|
||||
svgame.dllFuncs.pfnCreateBaseline( delta_type, entnum, base, pEdict, playermodel, host.player_mins[0], host.player_maxs[0] );
|
||||
sv.last_valid_baseline = entnum;
|
||||
}
|
||||
|
||||
@@ -434,19 +434,19 @@ void SV_CreateBaseline( void )
|
||||
|
||||
if( entnum != 0 && entnum <= svs.maxclients )
|
||||
{
|
||||
player = true;
|
||||
delta_type = DELTA_PLAYER;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !pEdict->v.modelindex )
|
||||
continue; // invisible
|
||||
player = false;
|
||||
delta_type = DELTA_ENTITY;
|
||||
}
|
||||
|
||||
// take current state as baseline
|
||||
base = &svs.baselines[entnum];
|
||||
|
||||
MSG_WriteDeltaEntity( &nullstate, base, &sv.signon, true, player, 1.0f, 0 );
|
||||
MSG_WriteDeltaEntity( &nullstate, base, &sv.signon, true, delta_type, 1.0f, 0 );
|
||||
}
|
||||
|
||||
MSG_WriteUBitLong( &sv.signon, LAST_EDICT, MAX_ENTITY_BITS ); // end of baselines
|
||||
@@ -455,7 +455,7 @@ void SV_CreateBaseline( void )
|
||||
for( entnum = 0; entnum < sv.num_instanced; entnum++ )
|
||||
{
|
||||
base = &sv.instanced[entnum].baseline;
|
||||
MSG_WriteDeltaEntity( &nullstate, base, &sv.signon, true, false, 1.0f, 0 );
|
||||
MSG_WriteDeltaEntity( &nullstate, base, &sv.signon, true, DELTA_ENTITY, 1.0f, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -783,6 +783,7 @@ qboolean SV_SpawnServer( const char *mapname, const char *startspot, qboolean ba
|
||||
MSG_Init( &sv.spec_datagram, "Spectator Datagram", sv.spectator_buf, sizeof( sv.spectator_buf ));
|
||||
|
||||
// clearing all the baselines
|
||||
memset( svs.static_entities, 0, sizeof( entity_state_t ) * MAX_STATIC_ENTITIES );
|
||||
memset( svs.baselines, 0, sizeof( entity_state_t ) * GI->max_edicts );
|
||||
|
||||
// make cvars consistant
|
||||
|
||||
@@ -158,7 +158,7 @@ void SV_UpdateMovevars( qboolean initialize )
|
||||
if( sv_zmax.value < 256.0f ) Cvar_SetValue( "sv_zmax", 256.0f );
|
||||
|
||||
// clamp it right
|
||||
if( host.features & ENGINE_WRITE_LARGE_COORD )
|
||||
if( FBitSet( host.features, ENGINE_WRITE_LARGE_COORD ))
|
||||
{
|
||||
if( sv_zmax.value > 131070.0f )
|
||||
Cvar_SetValue( "sv_zmax", 131070.0f );
|
||||
@@ -599,7 +599,7 @@ void Host_ServerFrame( void )
|
||||
// if server is not active, do nothing
|
||||
if( !svs.initialized ) return;
|
||||
|
||||
if( sv.simulating || sv.state != ss_active )
|
||||
if( sv_fps.value != 0.0f && ( sv.simulating || sv.state != ss_active ))
|
||||
sv.time_residual += host.frametime;
|
||||
|
||||
if( sv_fps.value == 0.0f )
|
||||
|
||||
+42
-25
@@ -30,7 +30,7 @@ half-life implementation of saverestore system
|
||||
#define SAVEFILE_HEADER (('V'<<24)+('L'<<16)+('A'<<8)+'V') // little-endian "VALV"
|
||||
#define SAVEGAME_HEADER (('V'<<24)+('A'<<16)+('S'<<8)+'J') // little-endian "JSAV"
|
||||
#define SAVEGAME_VERSION 0x0071 // Version 0.71 GoldSrc compatible
|
||||
#define CLIENT_SAVEGAME_VERSION 0x0065 // Version 0.65
|
||||
#define CLIENT_SAVEGAME_VERSION 0x0067 // Version 0.67
|
||||
|
||||
#define SAVE_HEAPSIZE 0x400000 // reserve 4Mb for now
|
||||
#define SAVE_HASHSTRINGS 0xFFF // 4095 unique strings
|
||||
@@ -160,19 +160,40 @@ static TYPEDESCRIPTION gDecalEntry[] =
|
||||
|
||||
static TYPEDESCRIPTION gStaticEntry[] =
|
||||
{
|
||||
DEFINE_ARRAY( sv_static_entity_t, model, FIELD_CHARACTER, 64 ),
|
||||
DEFINE_FIELD( sv_static_entity_t, origin, FIELD_VECTOR ),
|
||||
DEFINE_FIELD( sv_static_entity_t, angles, FIELD_VECTOR ),
|
||||
DEFINE_FIELD( sv_static_entity_t, sequence, FIELD_SHORT ),
|
||||
DEFINE_FIELD( sv_static_entity_t, frame, FIELD_SHORT ),
|
||||
DEFINE_FIELD( sv_static_entity_t, colormap, FIELD_SHORT ),
|
||||
DEFINE_FIELD( sv_static_entity_t, skin, FIELD_CHARACTER ),
|
||||
DEFINE_FIELD( sv_static_entity_t, body, FIELD_CHARACTER ),
|
||||
DEFINE_FIELD( sv_static_entity_t, scale, FIELD_FLOAT ),
|
||||
DEFINE_FIELD( sv_static_entity_t, rendermode, FIELD_CHARACTER ),
|
||||
DEFINE_FIELD( sv_static_entity_t, renderamt, FIELD_CHARACTER ),
|
||||
DEFINE_ARRAY( sv_static_entity_t, rendercolor, FIELD_CHARACTER, sizeof( color24 )),
|
||||
DEFINE_FIELD( sv_static_entity_t, renderfx, FIELD_CHARACTER ),
|
||||
DEFINE_FIELD( entity_state_t, messagenum, FIELD_MODELNAME ), // HACKHACK: store model into messagenum
|
||||
DEFINE_FIELD( entity_state_t, origin, FIELD_VECTOR ),
|
||||
DEFINE_FIELD( entity_state_t, angles, FIELD_VECTOR ),
|
||||
DEFINE_FIELD( entity_state_t, sequence, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( entity_state_t, frame, FIELD_FLOAT ),
|
||||
DEFINE_FIELD( entity_state_t, colormap, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( entity_state_t, skin, FIELD_SHORT ),
|
||||
DEFINE_FIELD( entity_state_t, body, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( entity_state_t, scale, FIELD_FLOAT ),
|
||||
DEFINE_FIELD( entity_state_t, effects, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( entity_state_t, framerate, FIELD_FLOAT ),
|
||||
DEFINE_FIELD( entity_state_t, mins, FIELD_VECTOR ),
|
||||
DEFINE_FIELD( entity_state_t, maxs, FIELD_VECTOR ),
|
||||
DEFINE_FIELD( entity_state_t, rendermode, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( entity_state_t, renderamt, FIELD_FLOAT ),
|
||||
DEFINE_ARRAY( entity_state_t, rendercolor, FIELD_CHARACTER, sizeof( color24 )),
|
||||
DEFINE_FIELD( entity_state_t, renderfx, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( entity_state_t, controller, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( entity_state_t, blending, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( entity_state_t, solid, FIELD_SHORT ),
|
||||
DEFINE_FIELD( entity_state_t, animtime, FIELD_TIME ),
|
||||
DEFINE_FIELD( entity_state_t, movetype, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( entity_state_t, vuser1, FIELD_VECTOR ),
|
||||
DEFINE_FIELD( entity_state_t, vuser2, FIELD_VECTOR ),
|
||||
DEFINE_FIELD( entity_state_t, vuser3, FIELD_VECTOR ),
|
||||
DEFINE_FIELD( entity_state_t, vuser4, FIELD_VECTOR ),
|
||||
DEFINE_FIELD( entity_state_t, iuser1, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( entity_state_t, iuser2, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( entity_state_t, iuser3, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( entity_state_t, iuser4, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( entity_state_t, fuser1, FIELD_FLOAT ),
|
||||
DEFINE_FIELD( entity_state_t, fuser2, FIELD_FLOAT ),
|
||||
DEFINE_FIELD( entity_state_t, fuser3, FIELD_FLOAT ),
|
||||
DEFINE_FIELD( entity_state_t, fuser4, FIELD_FLOAT ),
|
||||
};
|
||||
|
||||
static TYPEDESCRIPTION gSoundEntry[] =
|
||||
@@ -1145,7 +1166,7 @@ static void SaveClientState( SAVERESTOREDATA *pSaveData, const char *level, int
|
||||
|
||||
// write client entities
|
||||
for( i = 0; i < header.entityCount; i++ )
|
||||
svgame.dllFuncs.pfnSaveWriteFields( pSaveData, "STATICENTITY", &sv.static_entities[i], gStaticEntry, ARRAYSIZE( gStaticEntry ));
|
||||
svgame.dllFuncs.pfnSaveWriteFields( pSaveData, "STATICENTITY", &svs.static_entities[i], gStaticEntry, ARRAYSIZE( gStaticEntry ));
|
||||
|
||||
// write sounds
|
||||
for( i = 0; i < header.soundCount; i++ )
|
||||
@@ -1188,7 +1209,6 @@ static void LoadClientState( SAVERESTOREDATA *pSaveData, const char *level, qboo
|
||||
int i, size, id, version;
|
||||
sv_client_t *cl = svs.clients;
|
||||
char name[MAX_QPATH];
|
||||
sv_static_entity_t staticEntry;
|
||||
soundlist_t soundEntry;
|
||||
decallist_t decalEntry;
|
||||
SAVE_CLIENT header;
|
||||
@@ -1248,22 +1268,19 @@ static void LoadClientState( SAVERESTOREDATA *pSaveData, const char *level, qboo
|
||||
// clear old entities
|
||||
if( !adjacent )
|
||||
{
|
||||
memset( sv.static_entities, 0, sizeof( sv.static_entities ));
|
||||
memset( svs.static_entities, 0, sizeof( entity_state_t ) * MAX_STATIC_ENTITIES );
|
||||
sv.num_static_entities = 0;
|
||||
}
|
||||
|
||||
// restore client entities
|
||||
for( i = 0; i < header.entityCount; i++ )
|
||||
{
|
||||
svgame.dllFuncs.pfnSaveReadFields( pSaveData, "STATICENTITY", &staticEntry, gStaticEntry, ARRAYSIZE( gStaticEntry ));
|
||||
id = sv.num_static_entities;
|
||||
svgame.dllFuncs.pfnSaveReadFields( pSaveData, "STATICENTITY", &svs.static_entities[id], gStaticEntry, ARRAYSIZE( gStaticEntry ));
|
||||
if( adjacent ) continue; // static entities won't loading from adjacent levels
|
||||
|
||||
if( i >= MAX_STATIC_ENTITIES )
|
||||
continue; // silently overflowed
|
||||
|
||||
SV_CreateStaticEntity( &sv.signon, &staticEntry );
|
||||
sv.static_entities[i] = staticEntry;
|
||||
sv.num_static_entities++;
|
||||
if( SV_CreateStaticEntity( &sv.signon, id ))
|
||||
sv.num_static_entities++;
|
||||
}
|
||||
|
||||
// restore sounds
|
||||
@@ -1558,7 +1575,7 @@ static int LoadGameState( char const *level, qboolean changelevel )
|
||||
|
||||
if( pent != NULL )
|
||||
{
|
||||
if( svgame.dllFuncs.pfnRestore( pent, pSaveData, false ) < 0 )
|
||||
if( svgame.dllFuncs.pfnRestore( pent, pSaveData, 0 ) < 0 )
|
||||
{
|
||||
SetBits( pent->v.flags, FL_KILLME );
|
||||
pTable->pent = NULL;
|
||||
|
||||
Reference in New Issue
Block a user