Browse Source

Apply 4097 update

pull/2/head
Alibek Omarov 7 years ago
parent
commit
9bab7d222a
  1. 2
      engine/client/cl_game.c
  2. 2
      engine/client/cl_gameui.c
  3. 11
      engine/client/cl_main.c
  4. 4
      engine/client/cl_parse.c
  5. 4
      engine/client/cl_pmove.c
  6. 2
      engine/client/cl_scrn.c
  7. 4
      engine/client/gl_image.c
  8. 5
      engine/client/gl_rmain.c
  9. 7
      engine/client/gl_vidnt.c
  10. 2
      engine/common/cmd.c
  11. 4
      engine/common/console.c
  12. 5
      engine/common/crtlib.c
  13. 2
      engine/common/filesystem.c
  14. 34
      engine/common/host.c
  15. 2
      engine/common/hpak.c
  16. 2
      engine/common/mod_bmodel.c
  17. 2
      engine/common/sys_win.c
  18. 13
      engine/common/zone.c
  19. 2
      engine/menu_int.h
  20. 3
      engine/server/sv_cmds.c
  21. 22
      engine/server/sv_frame.c
  22. 4
      engine/server/sv_game.c

2
engine/client/cl_game.c

@ -237,7 +237,7 @@ void CL_InitCDAudio( const char *filename ) @@ -237,7 +237,7 @@ void CL_InitCDAudio( const char *filename )
if( ++c > MAX_CDTRACKS - 1 )
{
MsgDev( D_WARN, "CD_Init: too many tracks %i in %s\n", filename, MAX_CDTRACKS );
MsgDev( D_WARN, "CD_Init: too many tracks %i in %s\n", MAX_CDTRACKS, filename );
break;
}
}

2
engine/client/cl_gameui.c

@ -985,6 +985,8 @@ static ui_enginefuncs_t gEngfuncs = @@ -985,6 +985,8 @@ static ui_enginefuncs_t gEngfuncs =
GL_ProcessTexture,
COM_CompareFileTime,
VID_GetModeString,
COM_SaveFile,
FS_Delete,
};
void UI_UnloadProgs( void )

11
engine/client/cl_main.c

@ -195,7 +195,7 @@ int CL_GetFragmentSize( void *unused ) @@ -195,7 +195,7 @@ int CL_GetFragmentSize( void *unused )
if( Netchan_IsLocal( &cls.netchan ))
return FRAGMENT_LOCAL_SIZE;
return bound( FRAGMENT_MIN_SIZE, cl_dlmax->value, FRAGMENT_MAX_SIZE );
return FRAGMENT_MIN_SIZE;
}
/*
@ -1091,7 +1091,7 @@ void CL_CheckForResend( void ) @@ -1091,7 +1091,7 @@ void CL_CheckForResend( void )
if( cls.connect_retry == CL_TEST_RETRIES_NORESPONCE )
{
// too many fails use default connection method
Msg( "hi-speed coonection is failed, use default method\n" );
Con_Printf( "hi-speed connection is failed, use default method\n" );
Netchan_OutOfBandPrint( NS_CLIENT, adr, "getchallenge\n" );
Cvar_SetValue( "cl_dlmax", FRAGMENT_MIN_SIZE );
cls.connect_time = host.realtime;
@ -1801,7 +1801,7 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg ) @@ -1801,7 +1801,7 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
if( cls.connect_retry >= CL_TEST_RETRIES )
{
// too many fails use default connection method
Msg( "hi-speed coonection is failed, use default method\n" );
Con_Printf( "hi-speed connection is failed, use default method\n" );
Netchan_OutOfBandPrint( NS_CLIENT, from, "getchallenge\n" );
Cvar_SetValue( "cl_dlmax", FRAGMENT_MIN_SIZE );
cls.connect_time = host.realtime;
@ -1833,7 +1833,7 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg ) @@ -1833,7 +1833,7 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
if( cls.connect_retry >= CL_TEST_RETRIES )
{
// too many fails use default connection method
Msg( "hi-speed coonection is failed, use default method\n" );
Con_Printf( "hi-speed connection is failed, use default method\n" );
Netchan_OutOfBandPrint( NS_CLIENT, from, "getchallenge\n" );
Cvar_SetValue( "cl_dlmax", FRAGMENT_MIN_SIZE );
cls.connect_time = host.realtime;
@ -2216,7 +2216,8 @@ void CL_ProcessFile( qboolean successfully_received, const char *filename ) @@ -2216,7 +2216,8 @@ void CL_ProcessFile( qboolean successfully_received, const char *filename )
}
else
{
Con_Printf( "Downloaded %i bytes for purported %i byte file, ignoring download\n", p->nDownloadSize );
Con_Printf( "Downloaded %i bytes for purported %i byte file, ignoring download\n",
cls.netchan.tempbuffersize, p->nDownloadSize );
}
if( cls.netchan.tempbuffer )

4
engine/client/cl_parse.c

@ -730,7 +730,7 @@ void CL_BatchResourceRequest( qboolean initialize ) @@ -730,7 +730,7 @@ void CL_BatchResourceRequest( qboolean initialize )
if( !COM_IsSafeFileToDownload( p->szFileName ))
{
CL_RemoveFromResourceList( p );
MsgDev( D_WARN, "Invalid file type...skipping download of %s\n", p );
MsgDev( D_WARN, "Invalid file type...skipping download of %s\n", p->szFileName );
Mem_Free( p );
break;
}
@ -1039,7 +1039,7 @@ void CL_CreateCustomizationList( void ) @@ -1039,7 +1039,7 @@ void CL_CreateCustomizationList( void )
pResource = &cl.resourcelist[i];
if( !COM_CreateCustomization( &pPlayer->customdata, pResource, cl.playernum, 0, NULL, NULL ))
Con_Printf( "problem with client customization %i, ignoring...", pResource );
Con_Printf( "problem with client customization %s, ignoring...", pResource->szFileName );
}
}

4
engine/client/cl_pmove.c

@ -1220,6 +1220,7 @@ void CL_PredictMovement( qboolean repredicting ) @@ -1220,6 +1220,7 @@ void CL_PredictMovement( qboolean repredicting )
int i, stoppoint;
qboolean runfuncs;
double f = 1.0;
cl_entity_t *ent;
double time;
if( cls.state != ca_active || cls.spectator )
@ -1349,8 +1350,7 @@ void CL_PredictMovement( qboolean repredicting ) @@ -1349,8 +1350,7 @@ void CL_PredictMovement( qboolean repredicting )
if( FBitSet( to->client.flags, FL_ONGROUND ))
{
cl_entity_t *ent = CL_GetEntityByIndex( cl.local.lastground );
ent = CL_GetEntityByIndex( cl.local.lastground );
cl.local.onground = cl.local.lastground;
cl.local.moving = false;

2
engine/client/cl_scrn.c

@ -126,7 +126,7 @@ void SCR_NetSpeeds( void ) @@ -126,7 +126,7 @@ void SCR_NetSpeeds( void )
if( !host.allow_console )
return;
if( !net_speeds->value || cls.demoplayback || cls.state != ca_active )
if( !net_speeds->value || cls.state != ca_active )
return;
// prevent to get too big values at max

4
engine/client/gl_image.c

@ -311,9 +311,9 @@ void R_SetTextureParameters( void ) @@ -311,9 +311,9 @@ void R_SetTextureParameters( void )
if( GL_Support( GL_TEXTURE_LOD_BIAS ))
{
if( gl_texture_lodbias->value < -glConfig.max_texture_lod_bias )
Cvar_SetValue( "gl_mipmap_bias", -glConfig.max_texture_lod_bias );
Cvar_SetValue( "gl_texture_lodbias", -glConfig.max_texture_lod_bias );
else if( gl_texture_lodbias->value > glConfig.max_texture_lod_bias )
Cvar_SetValue( "gl_mipmap_bias", glConfig.max_texture_lod_bias );
Cvar_SetValue( "gl_texture_lodbias", glConfig.max_texture_lod_bias );
}
ClearBits( gl_texture_anisotropy->flags, FCVAR_CHANGED );

5
engine/client/gl_rmain.c

@ -1119,10 +1119,7 @@ void R_EndFrame( void ) @@ -1119,10 +1119,7 @@ void R_EndFrame( void )
R_Set2DMode( false );
if( !pwglSwapBuffers( glw_state.hDC ))
{
Con_Printf( S_ERROR "failed to swap buffers\n" );
Host_NewInstance( va("#%s", GI->gamefolder ), "stopped" );
}
Sys_Error( "failed to swap buffers\nCheck your video driver and as possible of reinstall it" );
}
/*

7
engine/client/gl_vidnt.c

@ -361,7 +361,10 @@ static void CALLBACK GL_DebugOutput( GLuint source, GLuint type, GLuint id, GLui @@ -361,7 +361,10 @@ static void CALLBACK GL_DebugOutput( GLuint source, GLuint type, GLuint id, GLui
Con_Printf( S_OPENGL_NOTE "%s\n", message );
break;
case GL_DEBUG_TYPE_OTHER_ARB:
default: Con_Printf( S_OPENGL_NOTE "%s\n", message );
default:
if( host_developer.value < DEV_EXTENDED )
return;
Con_Printf( S_OPENGL_NOTE "%s\n", message );
break;
}
}
@ -904,7 +907,7 @@ void VID_CreateFakeWindow( void ) @@ -904,7 +907,7 @@ void VID_CreateFakeWindow( void )
pwglGetPixelFormatAttribiv = GL_GetProcAddress( "wglGetPixelFormatAttribivARB" );
pwglChoosePixelFormat = GL_GetProcAddress( "wglChoosePixelFormatARB" );
// destory now it's no longer needed
// destroy now it's no longer needed
VID_DestroyFakeWindow();
}

2
engine/common/cmd.c

@ -328,7 +328,7 @@ void Cmd_Echo_f( void ) @@ -328,7 +328,7 @@ void Cmd_Echo_f( void )
int i;
for( i = 1; i < Cmd_Argc(); i++ )
Con_Printf( Cmd_Argv( i ));
Con_Printf( "%s", Cmd_Argv( i ));
Con_Printf( "\n" );
}

4
engine/common/console.c

@ -1940,9 +1940,9 @@ void Con_DrawDebug( void ) @@ -1940,9 +1940,9 @@ void Con_DrawDebug( void )
if( scr_download->value != -1.0f )
{
Q_snprintf( dlstring, sizeof( dlstring ), "Downloading [%d remaining]: ^2%s^7 %5.1f%%",
Q_snprintf( dlstring, sizeof( dlstring ), "Downloading [%d remaining]: ^2%s^7 %5.1f%% time %.f secs",
host.downloadcount, host.downloadfile, scr_download->value, Sys_DoubleTime() - timeStart );
x = glState.width - 400;
x = glState.width - 500;
y = con.curFont->charHeight * 1.05f;
Con_DrawString( x, y, dlstring, g_color_table[7] );
}

5
engine/common/crtlib.c

@ -569,8 +569,9 @@ int Q_vsnprintf( char *buffer, size_t buffersize, const char *format, va_list ar @@ -569,8 +569,9 @@ int Q_vsnprintf( char *buffer, size_t buffersize, const char *format, va_list ar
// to prevent crash while output
__except( EXCEPTION_EXECUTE_HANDLER )
{
memset( buffer, 0, buffersize );
result = -1;
Q_strncpy( buffer, "^1sprintf throw exception^7\n", buffersize );
// memset( buffer, 0, buffersize );
result = buffersize;
}
if( result < 0 || result >= buffersize )

2
engine/common/filesystem.c

@ -1502,7 +1502,7 @@ static file_t *FS_SysOpen( const char *filepath, const char *mode ) @@ -1502,7 +1502,7 @@ static file_t *FS_SysOpen( const char *filepath, const char *mode )
opt |= O_BINARY;
break;
default:
MsgDev( D_ERROR, "FS_SysOpen: %s: unknown char in mode (%c)\n", filepath, mode, mode[ind] );
MsgDev( D_ERROR, "FS_SysOpen: %s: unknown char (%c) in mode (%s)\n", filepath, mode[ind], mode );
break;
}
}

34
engine/common/host.c

@ -30,10 +30,10 @@ host_parm_t host; // host parms @@ -30,10 +30,10 @@ host_parm_t host; // host parms
sysinfo_t SI;
CVAR_DEFINE( host_developer, "developer", "0", 0, "engine is in development-mode" );
CVAR_DEFINE_AUTO( sys_ticrate, "100", 0, "framerate in dedicated mode" );
convar_t *host_gameloaded;
convar_t *host_clientloaded;
convar_t *host_limitlocal;
convar_t host_developer;
convar_t *host_maxfps;
convar_t *host_framerate;
convar_t *con_gamemaps;
@ -130,7 +130,7 @@ void Host_CheckSleep( void ) @@ -130,7 +130,7 @@ void Host_CheckSleep( void )
if( host.type == HOST_DEDICATED )
{
// let the dedicated server some sleep
// Sys_Sleep( 1 );
Sys_Sleep( 1 );
}
else
{
@ -393,13 +393,20 @@ double Host_CalcFPS( void ) @@ -393,13 +393,20 @@ double Host_CalcFPS( void )
// NOTE: we should play demos with same fps as it was recorded
if( CL_IsPlaybackDemo() || CL_IsRecordDemo( ))
{
fps = CL_GetDemoFramerate();
}
else if( Host_IsLocalGame( ))
{
fps = host_maxfps->value;
}
else if( host.type == HOST_DEDICATED )
{
fps = sys_ticrate.value;
}
else
{
fps = host_maxfps->value;
if( fps == 0.0 ) fps = HOST_FPS; // default for multiplayer
fps = bound( MIN_FPS, fps, MAX_FPS );
}
@ -439,9 +446,17 @@ qboolean Host_FilterTime( float time ) @@ -439,9 +446,17 @@ qboolean Host_FilterTime( float time )
// limit fps to withing tolerable range
fps = bound( MIN_FPS, fps, MAX_FPS );
if( host.type == HOST_DEDICATED )
{
if(( host.realtime - oldtime ) < ( 1.0 / ( fps + 1.0 )))
return false;
}
else
{
if(( host.realtime - oldtime ) < ( 1.0 / fps ))
return false;
}
}
host.frametime = host.realtime - oldtime;
host.realframetime = bound( MIN_FRAMETIME, host.frametime, MAX_FRAMETIME );
@ -589,6 +604,7 @@ void Host_InitCommon( const char *hostname, qboolean bChangeGame ) @@ -589,6 +604,7 @@ void Host_InitCommon( const char *hostname, qboolean bChangeGame )
{
MEMORYSTATUS lpBuffer;
char dev_level[4];
char ticrate[16];
char progname[128];
char cmdline[128];
qboolean parse_cmdline = false;
@ -596,6 +612,7 @@ void Host_InitCommon( const char *hostname, qboolean bChangeGame ) @@ -596,6 +612,7 @@ void Host_InitCommon( const char *hostname, qboolean bChangeGame )
int developer = 0;
string szRootPath;
char *in, *out;
double fps;
lpBuffer.dwLength = sizeof( MEMORYSTATUS );
GlobalMemoryStatus( &lpBuffer );
@ -713,6 +730,8 @@ void Host_InitCommon( const char *hostname, qboolean bChangeGame ) @@ -713,6 +730,8 @@ void Host_InitCommon( const char *hostname, qboolean bChangeGame )
// member console allowing
host.allow_console_init = host.allow_console;
timeBeginPeriod( 1 );
Con_CreateConsole(); // system console used by dedicated server or show fatal errors
// NOTE: this message couldn't be passed into game console but it doesn't matter
@ -731,6 +750,13 @@ void Host_InitCommon( const char *hostname, qboolean bChangeGame ) @@ -731,6 +750,13 @@ void Host_InitCommon( const char *hostname, qboolean bChangeGame )
// share developer level across all dlls
Q_snprintf( dev_level, sizeof( dev_level ), "%i", developer );
Cvar_DirectSet( &host_developer, dev_level );
Cvar_RegisterVariable( &sys_ticrate );
if( Sys_GetParmFromCmdLine( "-sys_ticrate", ticrate ))
{
fps = bound( MIN_FPS, atof( ticrate ), MAX_FPS );
Cvar_SetValue( "sys_ticrate", fps );
}
Con_Init(); // early console running to catch all the messages
Cmd_AddCommand( "exec", Host_Exec_f, "execute a script file" );
@ -787,7 +813,7 @@ int EXPORT Host_Main( const char *progname, int bChangeGame, pfnChangeGame func @@ -787,7 +813,7 @@ int EXPORT Host_Main( const char *progname, int bChangeGame, pfnChangeGame func
Cmd_AddCommand ( "crash", Host_Crash_f, "a way to force a bus error for development reasons");
}
host_maxfps = Cvar_Get( "fps_max", "100", FCVAR_ARCHIVE, "host fps upper limit" );
host_maxfps = Cvar_Get( "fps_max", "72", FCVAR_ARCHIVE, "host fps upper limit" );
host_framerate = Cvar_Get( "host_framerate", "0", 0, "locks frame timing to this value in seconds" );
host_gameloaded = Cvar_Get( "host_gameloaded", "0", FCVAR_READ_ONLY, "inidcates a loaded game.dll" );
host_clientloaded = Cvar_Get( "host_clientloaded", "0", FCVAR_READ_ONLY, "inidcates a loaded client.dll" );

2
engine/common/hpak.c

@ -1023,7 +1023,7 @@ void HPAK_Extract_f( void ) @@ -1023,7 +1023,7 @@ void HPAK_Extract_f( void )
if( entry->disksize <= 0 || entry->disksize >= HPAK_MAX_SIZE )
{
MsgDev( D_WARN, "Unable to extract data, size invalid: %s\n", nDataSize );
MsgDev( D_WARN, "Unable to extract data, size invalid: %s\n", Q_memprint( entry->disksize ));
continue;
}

2
engine/common/mod_bmodel.c

@ -1528,7 +1528,7 @@ static void Mod_LoadEntities( dbspmodel_t *bmod ) @@ -1528,7 +1528,7 @@ static void Mod_LoadEntities( dbspmodel_t *bmod )
{
if( ft1 > ft2 )
{
Con_Printf( S_WARN "Entity patch is older than bsp. Ignored.\n", entfilename );
Con_Printf( S_WARN "Entity patch is older than bsp. Ignored.\n" );
}
else if(( entpatch = FS_LoadFile( entfilename, &entpatchsize, true )) != NULL )
{

2
engine/common/sys_win.c

@ -114,7 +114,7 @@ freeze application for some time @@ -114,7 +114,7 @@ freeze application for some time
*/
void Sys_Sleep( int msec )
{
msec = bound( 1, msec, 1000 );
msec = bound( 0, msec, 1000 );
Sleep( msec );
}

13
engine/common/zone.c

@ -164,11 +164,16 @@ static const char *Mem_CheckFilename( const char *filename ) @@ -164,11 +164,16 @@ static const char *Mem_CheckFilename( const char *filename )
const char *out = filename;
int i;
if( !out ) return dummy;
if( !COM_CheckString( out ))
return dummy;
for( i = 0; i < 128; i++, out++ )
if( out == '\0' ) break; // valid name
if( i == 128 ) return dummy;
return filename;
{
if( *out == '\0' )
return filename; // valid name
}
return dummy;
}
static void Mem_FreeBlock( memheader_t *mem, const char *filename, int fileline )

2
engine/menu_int.h

@ -162,6 +162,8 @@ typedef struct ui_enginefuncs_s @@ -162,6 +162,8 @@ typedef struct ui_enginefuncs_s
int (*pfnCompareFileTime)( char *filename1, char *filename2, int *iCompare );
const char *(*pfnGetModeString)( int vid_mode );
int (*COM_SaveFile)( const char *filename, const void *data, long len );
int (*COM_RemoveFile)( const char *filepath );
} ui_enginefuncs_t;
typedef struct

3
engine/server/sv_cmds.c

@ -72,9 +72,12 @@ void SV_BroadcastPrintf( sv_client_t *ignore, char *fmt, ... ) @@ -72,9 +72,12 @@ void SV_BroadcastPrintf( sv_client_t *ignore, char *fmt, ... )
}
}
if( host.type == HOST_DEDICATED )
{
// echo to console
Con_DPrintf( string );
}
}
/*
=================

22
engine/server/sv_frame.c

@ -60,8 +60,8 @@ static void SV_AddEntitiesToPacket( edict_t *pViewEnt, edict_t *pClient, client_ @@ -60,8 +60,8 @@ static void SV_AddEntitiesToPacket( edict_t *pViewEnt, edict_t *pClient, client_
byte *clientpvs;
byte *clientphs;
qboolean fullvis = false;
sv_client_t *netclient;
sv_client_t *cl = NULL;
qboolean player;
entity_state_t *state;
int e;
@ -101,15 +101,29 @@ static void SV_AddEntitiesToPacket( edict_t *pViewEnt, edict_t *pClient, client_ @@ -101,15 +101,29 @@ static void SV_AddEntitiesToPacket( edict_t *pViewEnt, edict_t *pClient, client_
if( CHECKVISBIT( ents->sended, e ))
continue;
if( e >= 1 && e <= svs.maxclients )
player = 1;
else player = 0;
if( player )
{
sv_client_t *cl = &svs.clients[e - 1];
if( cl->state != cs_spawned )
continue;
if( FBitSet( cl->flags, FCL_HLTV_PROXY ))
continue;
}
if( FBitSet( ent->v.effects, EF_REQUEST_PHS ))
pset = clientphs;
else pset = clientpvs;
state = &ents->entities[ents->num_entities];
netclient = SV_ClientFromEdict( ent, true );
// add entity to the net packet
if( svgame.dllFuncs.pfnAddToFullPack( state, e, ent, pClient, sv.hostflags, ( netclient != NULL ), pset ))
if( svgame.dllFuncs.pfnAddToFullPack( state, e, ent, pClient, sv.hostflags, player, pset ))
{
// to prevent adds it twice through portals
SETVISBIT( ents->sended, e );
@ -807,7 +821,7 @@ void SV_SendClientMessages( void ) @@ -807,7 +821,7 @@ void SV_SendClientMessages( void )
{
cl = sv.current_client;
if( !cl->state || FBitSet( cl->flags, FCL_FAKECLIENT ))
if( cl->state <= cs_zombie || FBitSet( cl->flags, FCL_FAKECLIENT ))
continue;
if( FBitSet( cl->flags, FCL_SKIP_NET_MESSAGE ))

4
engine/server/sv_game.c

@ -874,6 +874,10 @@ void SV_InitEdict( edict_t *pEdict ) @@ -874,6 +874,10 @@ void SV_InitEdict( edict_t *pEdict )
SV_FreePrivateData( pEdict );
memset( &pEdict->v, 0, sizeof( entvars_t ));
pEdict->v.pContainingEntity = pEdict;
pEdict->v.controller[0] = 0x7F;
pEdict->v.controller[1] = 0x7F;
pEdict->v.controller[2] = 0x7F;
pEdict->v.controller[3] = 0x7F;
pEdict->free = false;
}

Loading…
Cancel
Save