mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-10 06:02:10 +08:00
Merge 4281 update
This commit is contained in:
@@ -582,7 +582,8 @@ void SV_PlaybackEventFull( int flags, const edict_t *pInvoker, word eventindex,
|
||||
float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
|
||||
void SV_PlaybackReliableEvent( sizebuf_t *msg, word eventindex, float delay, event_args_t *args );
|
||||
int SV_BuildSoundMsg( sizebuf_t *msg, edict_t *ent, int chan, const char *sample, int vol, float attn, int flags, int pitch, const vec3_t pos );
|
||||
int SV_BoxInPVS( const vec3_t org, const vec3_t absmin, const vec3_t absmax );
|
||||
qboolean SV_BoxInPVS( const vec3_t org, const vec3_t absmin, const vec3_t absmax );
|
||||
void SV_QueueChangeLevel( const char *level, const char *landname );
|
||||
void SV_WriteEntityPatch( const char *filename );
|
||||
float SV_AngleMod( float ideal, float current, float speed );
|
||||
void SV_SpawnEntities( const char *mapname );
|
||||
|
||||
@@ -1228,13 +1228,13 @@ void SV_PutClientInServer( sv_client_t *cl )
|
||||
SetBits( ent->v.flags, FL_GODMODE|FL_NOTARGET );
|
||||
|
||||
cl->pViewEntity = NULL; // reset pViewEntity
|
||||
}
|
||||
|
||||
if( svgame.globals->cdAudioTrack )
|
||||
{
|
||||
MSG_BeginServerCmd( &msg, svc_stufftext );
|
||||
MSG_WriteString( &msg, va( "cd loop %3d\n", svgame.globals->cdAudioTrack ));
|
||||
svgame.globals->cdAudioTrack = 0;
|
||||
}
|
||||
if( svgame.globals->cdAudioTrack )
|
||||
{
|
||||
MSG_BeginServerCmd( &msg, svc_stufftext );
|
||||
MSG_WriteString( &msg, va( "cd loop %3d\n", svgame.globals->cdAudioTrack ));
|
||||
svgame.globals->cdAudioTrack = 0;
|
||||
}
|
||||
|
||||
#ifdef HACKS_RELATED_HLMODS
|
||||
@@ -1727,6 +1727,9 @@ static qboolean SV_Godmode_f( sv_client_t *cl )
|
||||
return true;
|
||||
|
||||
pEntity->v.flags = pEntity->v.flags ^ FL_GODMODE;
|
||||
if( pEntity->v.takedamage == DAMAGE_AIM )
|
||||
pEntity->v.takedamage = DAMAGE_NO;
|
||||
else pEntity->v.takedamage = DAMAGE_AIM;
|
||||
|
||||
if( !FBitSet( pEntity->v.flags, FL_GODMODE ))
|
||||
SV_ClientPrintf( cl, "godmode OFF\n" );
|
||||
|
||||
+41
-2
@@ -440,6 +440,42 @@ void SV_Reload_f( void )
|
||||
COM_LoadLevel( sv_hostmap->string, false );
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
SV_ChangeLevel_f
|
||||
|
||||
classic change level
|
||||
==================
|
||||
*/
|
||||
void SV_ChangeLevel_f( void )
|
||||
{
|
||||
if( Cmd_Argc() != 2 )
|
||||
{
|
||||
Con_Printf( S_USAGE "changelevel <mapname>\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
SV_QueueChangeLevel( Cmd_Argv( 1 ), NULL );
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
SV_ChangeLevel2_f
|
||||
|
||||
smooth change level
|
||||
==================
|
||||
*/
|
||||
void SV_ChangeLevel2_f( void )
|
||||
{
|
||||
if( Cmd_Argc() != 3 )
|
||||
{
|
||||
Con_Printf( S_USAGE "changelevel2 <mapname> <landmark>\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
SV_QueueChangeLevel( Cmd_Argv( 1 ), Cmd_Argv( 2 ));
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
SV_Kick_f
|
||||
@@ -802,6 +838,7 @@ void SV_InitHostCommands( void )
|
||||
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" );
|
||||
Cmd_AddCommand( "killsave", SV_DeleteSave_f, "delete a saved game file and saveshot" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -824,13 +861,14 @@ void SV_InitOperatorCommands( void )
|
||||
Cmd_AddCommand( "edict_usage", SV_EdictUsage_f, "show info about edicts usage" );
|
||||
Cmd_AddCommand( "entity_info", SV_EntityInfo_f, "show more info about edicts" );
|
||||
Cmd_AddCommand( "shutdownserver", SV_KillServer_f, "shutdown current server" );
|
||||
Cmd_AddCommand( "changelevel", SV_ChangeLevel_f, "change level" );
|
||||
Cmd_AddCommand( "changelevel2", SV_ChangeLevel2_f, "smooth change level" );
|
||||
|
||||
if( host.type == HOST_NORMAL )
|
||||
{
|
||||
Cmd_AddCommand( "save", SV_Save_f, "save the game to a file" );
|
||||
Cmd_AddCommand( "savequick", SV_QuickSave_f, "save the game to the quicksave" );
|
||||
Cmd_AddCommand( "autosave", SV_AutoSave_f, "save the game to 'autosave' file" );
|
||||
Cmd_AddCommand( "killsave", SV_DeleteSave_f, "delete a saved game file and saveshot" );
|
||||
}
|
||||
else if( host.type == HOST_DEDICATED )
|
||||
{
|
||||
@@ -857,12 +895,13 @@ void SV_KillOperatorCommands( void )
|
||||
Cmd_RemoveCommand( "edict_usage" );
|
||||
Cmd_RemoveCommand( "entity_info" );
|
||||
Cmd_RemoveCommand( "shutdownserver" );
|
||||
Cmd_RemoveCommand( "changelevel" );
|
||||
Cmd_RemoveCommand( "changelevel2" );
|
||||
|
||||
if( host.type == HOST_NORMAL )
|
||||
{
|
||||
Cmd_RemoveCommand( "save" );
|
||||
Cmd_RemoveCommand( "savequick" );
|
||||
Cmd_RemoveCommand( "killsave" );
|
||||
Cmd_RemoveCommand( "autosave" );
|
||||
}
|
||||
else if( host.type == HOST_DEDICATED )
|
||||
|
||||
+97
-78
@@ -653,13 +653,98 @@ SV_BoxInPVS
|
||||
check brush boxes in fat pvs
|
||||
==============
|
||||
*/
|
||||
int SV_BoxInPVS( const vec3_t org, const vec3_t absmin, const vec3_t absmax )
|
||||
qboolean SV_BoxInPVS( const vec3_t org, const vec3_t absmin, const vec3_t absmax )
|
||||
{
|
||||
if( !Mod_BoxVisible( absmin, absmax, Mod_GetPVSForPoint( org )))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
SV_ChangeLevel
|
||||
|
||||
Issue changing level
|
||||
=============
|
||||
*/
|
||||
void SV_QueueChangeLevel( const char *level, const char *landname )
|
||||
{
|
||||
int flags, smooth = false;
|
||||
char mapname[MAX_QPATH];
|
||||
char *spawn_entity;
|
||||
|
||||
// hold mapname to other place
|
||||
Q_strncpy( mapname, level, sizeof( mapname ));
|
||||
COM_StripExtension( mapname );
|
||||
|
||||
if( COM_CheckString( landname ))
|
||||
smooth = true;
|
||||
|
||||
// determine spawn entity classname
|
||||
if( svs.maxclients == 1 )
|
||||
spawn_entity = GI->sp_entity;
|
||||
else spawn_entity = GI->mp_entity;
|
||||
|
||||
flags = SV_MapIsValid( mapname, spawn_entity, landname );
|
||||
|
||||
if( FBitSet( flags, MAP_INVALID_VERSION ))
|
||||
{
|
||||
Con_Printf( S_ERROR "changelevel: %s is invalid or not supported\n", mapname );
|
||||
return;
|
||||
}
|
||||
|
||||
if( !FBitSet( flags, MAP_IS_EXIST ))
|
||||
{
|
||||
Con_Printf( S_ERROR "changelevel: map %s doesn't exist\n", mapname );
|
||||
return;
|
||||
}
|
||||
|
||||
if( smooth && !FBitSet( flags, MAP_HAS_LANDMARK ))
|
||||
{
|
||||
if( sv_validate_changelevel->value )
|
||||
{
|
||||
// NOTE: we find valid map but specified landmark it's doesn't exist
|
||||
// run simple changelevel like in q1, throw warning
|
||||
Con_Printf( S_WARN "changelevel: %s doesn't contain landmark [%s]. smooth transition was disabled\n", mapname, landname );
|
||||
smooth = false;
|
||||
}
|
||||
}
|
||||
|
||||
if( svs.maxclients > 1 )
|
||||
smooth = false; // multiplayer doesn't support smooth transition
|
||||
|
||||
if( smooth && !Q_stricmp( sv.name, level ))
|
||||
{
|
||||
Con_Printf( S_ERROR "can't changelevel with same map. Ignored.\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
if( !smooth && !FBitSet( flags, MAP_HAS_SPAWNPOINT ))
|
||||
{
|
||||
if( sv_validate_changelevel->value )
|
||||
{
|
||||
Con_Printf( S_ERROR "changelevel: %s doesn't have a valid spawnpoint. Ignored.\n", mapname );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// bad changelevel position invoke enables in one-way transition
|
||||
if( sv.framecount < 15 )
|
||||
{
|
||||
if( sv_validate_changelevel->value )
|
||||
{
|
||||
Con_Printf( S_WARN "an infinite changelevel was detected and will be disabled until a next save\\restore\n" );
|
||||
return; // lock with svs.spawncount here
|
||||
}
|
||||
}
|
||||
|
||||
SV_SkipUpdates ();
|
||||
|
||||
// changelevel will be executed on a next frame
|
||||
if( smooth ) COM_ChangeLevel( mapname, landname, sv.background ); // Smoothed Half-Life changelevel
|
||||
else COM_ChangeLevel( mapname, NULL, sv.background ); // Classic Quake changlevel
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
SV_WriteEntityPatch
|
||||
@@ -1314,11 +1399,8 @@ pfnChangeLevel
|
||||
*/
|
||||
void pfnChangeLevel( const char *level, const char *landmark )
|
||||
{
|
||||
int flags, smooth = false;
|
||||
static uint last_spawncount = 0;
|
||||
char mapname[MAX_QPATH];
|
||||
char landname[MAX_QPATH];
|
||||
char *spawn_entity;
|
||||
char *text;
|
||||
|
||||
if( !COM_CheckString( level ) || sv.state != ss_active )
|
||||
@@ -1328,10 +1410,6 @@ void pfnChangeLevel( const char *level, const char *landmark )
|
||||
if( svs.spawncount == last_spawncount )
|
||||
return;
|
||||
last_spawncount = svs.spawncount;
|
||||
|
||||
// hold mapname to other place
|
||||
Q_strncpy( mapname, level, sizeof( mapname ));
|
||||
COM_StripExtension( mapname );
|
||||
landname[0] ='\0';
|
||||
|
||||
#ifdef HACKS_RELATED_HLMODS
|
||||
@@ -1348,72 +1426,7 @@ void pfnChangeLevel( const char *level, const char *landmark )
|
||||
#else
|
||||
Q_strncpy( landname, landmark, sizeof( landname ));
|
||||
#endif
|
||||
if( COM_CheckString( landname ))
|
||||
smooth = true;
|
||||
|
||||
// determine spawn entity classname
|
||||
if( svs.maxclients == 1 )
|
||||
spawn_entity = GI->sp_entity;
|
||||
else spawn_entity = GI->mp_entity;
|
||||
|
||||
flags = SV_MapIsValid( mapname, spawn_entity, landname );
|
||||
|
||||
if( FBitSet( flags, MAP_INVALID_VERSION ))
|
||||
{
|
||||
Con_Printf( S_ERROR "changelevel: %s is invalid or not supported\n", mapname );
|
||||
return;
|
||||
}
|
||||
|
||||
if( !FBitSet( flags, MAP_IS_EXIST ))
|
||||
{
|
||||
Con_Printf( S_ERROR "changelevel: map %s doesn't exist\n", mapname );
|
||||
return;
|
||||
}
|
||||
|
||||
if( smooth && !FBitSet( flags, MAP_HAS_LANDMARK ))
|
||||
{
|
||||
if( sv_validate_changelevel->value )
|
||||
{
|
||||
// NOTE: we find valid map but specified landmark it's doesn't exist
|
||||
// run simple changelevel like in q1, throw warning
|
||||
Con_Printf( S_WARN "changelevel: %s doesn't contain landmark [%s]. smooth transition was disabled\n", mapname, landname );
|
||||
smooth = false;
|
||||
}
|
||||
}
|
||||
|
||||
if( svs.maxclients > 1 )
|
||||
smooth = false; // multiplayer doesn't support smooth transition
|
||||
|
||||
if( smooth && !Q_stricmp( sv.name, level ))
|
||||
{
|
||||
Con_Printf( S_ERROR "can't changelevel with same map. Ignored.\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
if( !smooth && !FBitSet( flags, MAP_HAS_SPAWNPOINT ))
|
||||
{
|
||||
if( sv_validate_changelevel->value )
|
||||
{
|
||||
Con_Printf( S_ERROR "changelevel: %s doesn't have a valid spawnpoint. Ignored.\n", mapname );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// bad changelevel position invoke enables in one-way transition
|
||||
if( sv.framecount < 15 )
|
||||
{
|
||||
if( sv_validate_changelevel->value )
|
||||
{
|
||||
Con_Printf( S_WARN "an infinite changelevel was detected and will be disabled until a next save\\restore\n" );
|
||||
return; // lock with svs.spawncount here
|
||||
}
|
||||
}
|
||||
|
||||
SV_SkipUpdates ();
|
||||
|
||||
// changelevel will be executed on a next frame
|
||||
if( smooth ) COM_ChangeLevel( mapname, landname, sv.background ); // Smoothed Half-Life changelevel
|
||||
else COM_ChangeLevel( mapname, NULL, sv.background ); // Classic Quake changlevel
|
||||
SV_QueueChangeLevel( level, landname );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2024,6 +2037,9 @@ int SV_BuildSoundMsg( sizebuf_t *msg, edict_t *ent, int chan, const char *sample
|
||||
}
|
||||
else
|
||||
{
|
||||
// TESTTEST
|
||||
if( *sample == '*' ) chan = CHAN_AUTO;
|
||||
|
||||
// precache_sound can be used twice: cache sounds when loading
|
||||
// and return sound index when server is active
|
||||
sound_idx = SV_SoundIndex( sample );
|
||||
@@ -2092,7 +2108,7 @@ void SV_StartSound( edict_t *ent, int chan, const char *sample, float vol, float
|
||||
msg_dest = MSG_ALL;
|
||||
else if( FBitSet( host.features, ENGINE_QUAKE_COMPATIBLE ))
|
||||
msg_dest = MSG_ALL;
|
||||
else msg_dest = MSG_PAS_R;
|
||||
else msg_dest = (svs.maxclients <= 1 ) ? MSG_ALL : MSG_PAS_R;
|
||||
|
||||
// always sending stop sound command
|
||||
if( FBitSet( flags, SND_STOP ))
|
||||
@@ -2113,7 +2129,7 @@ pfnEmitAmbientSound
|
||||
*/
|
||||
void pfnEmitAmbientSound( edict_t *ent, float *pos, const char *sample, float vol, float attn, int flags, int pitch )
|
||||
{
|
||||
int msg_dest = MSG_PAS_R;
|
||||
int msg_dest;
|
||||
|
||||
if( sv.state == ss_loading )
|
||||
SetBits( flags, SND_SPAWNING );
|
||||
@@ -4603,8 +4619,11 @@ qboolean SV_ParseEdict( char **pfile, edict_t *ent )
|
||||
}
|
||||
|
||||
// no reason to keep this data
|
||||
Mem_Free( pkvd[i].szKeyName );
|
||||
Mem_Free( pkvd[i].szValue );
|
||||
if( Mem_IsAllocatedExt( host.mempool, pkvd[i].szKeyName ))
|
||||
Mem_Free( pkvd[i].szKeyName );
|
||||
|
||||
if( Mem_IsAllocatedExt( host.mempool, pkvd[i].szValue ))
|
||||
Mem_Free( pkvd[i].szValue );
|
||||
}
|
||||
|
||||
if( classname )
|
||||
|
||||
@@ -673,6 +673,7 @@ void SV_ShutdownGame( void )
|
||||
|
||||
SV_FinalMessage( "", true );
|
||||
S_StopBackgroundTrack();
|
||||
CL_StopPlayback(); // stop demo too
|
||||
|
||||
if( GameState->newGame )
|
||||
{
|
||||
|
||||
@@ -782,6 +782,7 @@ Does not change the entities velocity at all
|
||||
trace_t SV_PushEntity( edict_t *ent, const vec3_t lpush, const vec3_t apush, int *blocked, float flDamage )
|
||||
{
|
||||
trace_t trace;
|
||||
qboolean monsterBlock;
|
||||
qboolean monsterClip;
|
||||
int type;
|
||||
vec3_t end;
|
||||
@@ -814,10 +815,14 @@ trace_t SV_PushEntity( edict_t *ent, const vec3_t lpush, const vec3_t apush, int
|
||||
|
||||
SV_LinkEdict( ent, true );
|
||||
|
||||
if( ent->v.movetype == MOVETYPE_WALK || ent->v.movetype == MOVETYPE_STEP || ent->v.movetype == MOVETYPE_PUSHSTEP )
|
||||
monsterBlock = true;
|
||||
else monsterBlock = false;
|
||||
|
||||
if( blocked )
|
||||
{
|
||||
// more accuracy blocking code
|
||||
if( flDamage <= 0.0f && FBitSet( host.features, ENGINE_PHYSICS_PUSHER_EXT ))
|
||||
if( monsterBlock )
|
||||
*blocked = !VectorCompareEpsilon( ent->v.origin, end, ON_EPSILON ); // can't move full distance
|
||||
else *blocked = true;
|
||||
}
|
||||
|
||||
@@ -347,7 +347,7 @@ static void pfnParticle( const float *origin, int color, float life, int zpos, i
|
||||
|
||||
if( !origin )
|
||||
{
|
||||
MsgDev( D_ERROR, "SV_StartParticle: NULL origin. Ignored\n" );
|
||||
Con_Reportf( S_ERROR "SV_StartParticle: NULL origin. Ignored\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user