04 Jul 2009

This commit is contained in:
g-cont 2009-07-04 00:00:00 +04:00 committed by Alibek Omarov
parent 484f41f4a6
commit 06a8901a0b
9 changed files with 66 additions and 89 deletions

View File

@ -101,8 +101,8 @@ void CL_ScreenshotGetName( int lastnum, char *filename )
{ {
int a, b, c, d; int a, b, c, d;
if(!filename) return; if( !filename ) return;
if(lastnum < 0 || lastnum > 9999) if( lastnum < 0 || lastnum > 9999 )
{ {
// bound // bound
com.sprintf( filename, "scrshots/%s/shot9999.%s", cl.configstrings[CS_NAME], SCRSHOT_TYPE ); com.sprintf( filename, "scrshots/%s/shot9999.%s", cl.configstrings[CS_NAME], SCRSHOT_TYPE );
@ -140,10 +140,10 @@ void CL_ScreenShot_f( void )
string checkname; string checkname;
// scan for a free filename // scan for a free filename
for (i = 0; i <= 9999; i++ ) for( i = 0; i <= 9999; i++ )
{ {
CL_ScreenshotGetName( i, checkname ); CL_ScreenshotGetName( i, checkname );
if(!FS_FileExists( checkname )) break; if( !FS_FileExists( checkname )) break;
} }
Con_ClearNotify(); Con_ClearNotify();
@ -154,9 +154,9 @@ void CL_EnvShot_f( void )
{ {
string basename; string basename;
if(Cmd_Argc() < 2) if( Cmd_Argc() < 2 )
{ {
Msg("Usage: envshot <shotname>\n"); Msg( "Usage: envshot <shotname>\n" );
return; return;
} }
@ -169,9 +169,9 @@ void CL_SkyShot_f( void )
{ {
string basename; string basename;
if(Cmd_Argc() < 2) if( Cmd_Argc() < 2 )
{ {
Msg("Usage: envshot <shotname>\n"); Msg( "Usage: envshot <shotname>\n" );
return; return;
} }
@ -210,7 +210,7 @@ void CL_SetSky_f( void )
{ {
if(Cmd_Argc() < 2) if(Cmd_Argc() < 2)
{ {
Msg("Usage: sky <shadername>\n"); Msg( "Usage: sky <shadername>\n" );
return; return;
} }
re->RegisterShader( Cmd_Argv(1), SHADER_SKY ); re->RegisterShader( Cmd_Argv(1), SHADER_SKY );
@ -252,7 +252,7 @@ void SCR_TimeRefresh_f( void )
cl.refdef.viewangles[1] = i / 128.0 * 360.0f; cl.refdef.viewangles[1] = i / 128.0 * 360.0f;
re->BeginFrame(); re->BeginFrame();
re->RenderFrame(&cl.refdef); re->RenderFrame( &cl.refdef );
re->EndFrame(); re->EndFrame();
} }
} }

View File

@ -334,7 +334,7 @@ void CL_ParseFrame( sizebuf_t *msg )
else cl.frame.valid = true; // valid delta parse else cl.frame.valid = true; // valid delta parse
} }
cl.refdef.lerpfrac = CL_LerpPoint2 (); cl.refdef.lerpfrac = CL_LerpPoint ();
// clamp time // clamp time
cl.time = bound( cl.frame.servertime - cl.serverframetime, cl.time, cl.frame.servertime ); cl.time = bound( cl.frame.servertime - cl.serverframetime, cl.time, cl.frame.servertime );

View File

@ -391,7 +391,7 @@ void CL_PredictMovement (void)
if( step > 63 && step < 160 ) if( step > 63 && step < 160 )
{ {
cl.predicted_step = step; cl.predicted_step = step;
cl.predicted_step_time = host.realtime - host.frametime * 500; cl.predicted_step_time = cls.realtime - cls.frametime * 500;
} }
} }

View File

@ -54,7 +54,9 @@ bool Cmd_GetMapList( const char *s, char *completedname, int length )
if( com.stricmp( ext, "bsp" )) continue; if( com.stricmp( ext, "bsp" )) continue;
com.strncpy( message, "^1error^7", sizeof( message )); com.strncpy( message, "^1error^7", sizeof( message ));
wad = WAD_Open( t->filenames[i], "rb" ); if( WAD_Check( t->filenames[i] ) == 1 )
wad = WAD_Open( t->filenames[i], "rb" );
else wad = NULL;
if( wad ) if( wad )
{ {
@ -75,19 +77,19 @@ bool Cmd_GetMapList( const char *s, char *completedname, int length )
switch( ver ) switch( ver )
{ {
case 39: com.strncpy((char *)buf, "Xash 3D", sizeof(buf)); break; case 39: com.strncpy( buf, "Xash 3D", sizeof( buf )); break;
default: com.strncpy((char *)buf, "??", sizeof(buf)); break; default: com.strncpy( buf, "??", sizeof( buf )); break;
} }
Msg("%16s (%s) ^3%s^7\n", matchbuf, buf, message ); Msg( "%16s (%s) ^3%s^7\n", matchbuf, buf, message );
nummaps++; nummaps++;
} }
Msg("\n^3 %i maps found.\n", nummaps ); Msg( "\n^3 %i maps found.\n", nummaps );
Mem_Free( t ); Mem_Free( t );
// cut shortestMatch to the amount common with s // cut shortestMatch to the amount common with s
for( i = 0; matchbuf[i]; i++ ) for( i = 0; matchbuf[i]; i++ )
{ {
if(com.tolower(completedname[i]) != com.tolower(matchbuf[i])) if(com.tolower( completedname[i] ) != com.tolower( matchbuf[i] ))
completedname[i] = 0; completedname[i] = 0;
} }
return true; return true;
@ -109,33 +111,32 @@ bool Cmd_GetFontList( const char *s, char *completedname, int length )
t = FS_Search(va("gfx/fonts/%s*.*", s ), true); t = FS_Search(va("gfx/fonts/%s*.*", s ), true);
if(!t) return false; if(!t) return false;
FS_FileBase(t->filenames[0], matchbuf ); FS_FileBase( t->filenames[0], matchbuf );
if(completedname && length) com.strncpy( completedname, matchbuf, length ); if( completedname && length ) com.strncpy( completedname, matchbuf, length );
if( t->numfilenames == 1 ) return true; if( t->numfilenames == 1 ) return true;
for(i = 0, numfonts = 0; i < t->numfilenames; i++) for( i = 0, numfonts = 0; i < t->numfilenames; i++ )
{ {
const char *ext = FS_FileExtension( t->filenames[i] ); const char *ext = FS_FileExtension( t->filenames[i] );
if( com.stricmp(ext, "png" ) && com.stricmp(ext, "dds" ) && com.stricmp(ext, "tga" )) if( com.stricmp( ext, "png" ) && com.stricmp( ext, "dds" ) && com.stricmp( ext, "tga" ))
continue; continue;
FS_FileBase(t->filenames[i], matchbuf ); FS_FileBase( t->filenames[i], matchbuf );
Msg("%16s\n", matchbuf ); Msg( "%16s\n", matchbuf );
numfonts++; numfonts++;
} }
Msg("\n^3 %i fonts found.\n", numfonts ); Msg( "\n^3 %i fonts found.\n", numfonts );
Mem_Free(t); Mem_Free( t );
// cut shortestMatch to the amount common with s // cut shortestMatch to the amount common with s
if(completedname && length) if( completedname && length )
{ {
for( i = 0; matchbuf[i]; i++ ) for( i = 0; matchbuf[i]; i++ )
{ {
if(com.tolower(completedname[i]) != com.tolower(matchbuf[i])) if(com.tolower( completedname[i] ) != com.tolower( matchbuf[i] ))
completedname[i] = 0; completedname[i] = 0;
} }
} }
return true; return true;
} }
@ -152,35 +153,34 @@ bool Cmd_GetDemoList( const char *s, char *completedname, int length )
string matchbuf; string matchbuf;
int i, numdems; int i, numdems;
t = FS_Search(va("demos/%s*.dem", s ), true); t = FS_Search( va( "demos/%s*.dem", s ), true);
if(!t) return false; if( !t ) return false;
FS_FileBase(t->filenames[0], matchbuf ); FS_FileBase( t->filenames[0], matchbuf );
if(completedname && length) com.strncpy( completedname, matchbuf, length ); if( completedname && length ) com.strncpy( completedname, matchbuf, length );
if(t->numfilenames == 1) return true; if( t->numfilenames == 1 ) return true;
for(i = 0, numdems = 0; i < t->numfilenames; i++) for( i = 0, numdems = 0; i < t->numfilenames; i++ )
{ {
const char *ext = FS_FileExtension( t->filenames[i] ); const char *ext = FS_FileExtension( t->filenames[i] );
if( com.stricmp(ext, "dem" )) continue; if( com.stricmp( ext, "dem" )) continue;
FS_FileBase(t->filenames[i], matchbuf ); FS_FileBase( t->filenames[i], matchbuf );
Msg("%16s\n", matchbuf ); Msg( "%16s\n", matchbuf );
numdems++; numdems++;
} }
Msg("\n^3 %i demos found.\n", numdems ); Msg( "\n^3 %i demos found.\n", numdems );
Mem_Free(t); Mem_Free( t );
// cut shortestMatch to the amount common with s // cut shortestMatch to the amount common with s
if(completedname && length) if( completedname && length )
{ {
for( i = 0; matchbuf[i]; i++ ) for( i = 0; matchbuf[i]; i++ )
{ {
if(com.tolower(completedname[i]) != com.tolower(matchbuf[i])) if( com.tolower( completedname[i] ) != com.tolower( matchbuf[i] ))
completedname[i] = 0; completedname[i] = 0;
} }
} }
return true; return true;
} }
@ -197,31 +197,31 @@ bool Cmd_GetProgsList( const char *s, char *completedname, int length )
string matchbuf; string matchbuf;
int i, numprogs; int i, numprogs;
t = FS_Search(va("%s/%s*.dat", GI->vprogs_dir, s ), true); t = FS_Search( va( "%s/%s*.dat", GI->vprogs_dir, s ), true);
if( !t ) return false; if( !t ) return false;
FS_FileBase( t->filenames[0], matchbuf ); FS_FileBase( t->filenames[0], matchbuf );
if(completedname && length) com.strncpy( completedname, matchbuf, length ); if( completedname && length ) com.strncpy( completedname, matchbuf, length );
if( t->numfilenames == 1 ) return true; if( t->numfilenames == 1 ) return true;
for(i = 0, numprogs = 0; i < t->numfilenames; i++) for( i = 0, numprogs = 0; i < t->numfilenames; i++ )
{ {
const char *ext = FS_FileExtension( t->filenames[i] ); const char *ext = FS_FileExtension( t->filenames[i] );
if( com.stricmp(ext, "dat" )) continue; if( com.stricmp( ext, "dat" )) continue;
FS_FileBase(t->filenames[i], matchbuf ); FS_FileBase( t->filenames[i], matchbuf );
Msg("%16s\n", matchbuf ); Msg( "%16s\n", matchbuf );
numprogs++; numprogs++;
} }
Msg("\n^3 %i progs found.\n", numprogs ); Msg( "\n^3 %i progs found.\n", numprogs );
Mem_Free(t); Mem_Free( t );
// cut shortestMatch to the amount common with s // cut shortestMatch to the amount common with s
if( completedname && length ) if( completedname && length )
{ {
for( i = 0; matchbuf[i]; i++ ) for( i = 0; matchbuf[i]; i++ )
{ {
if(com.tolower(completedname[i]) != com.tolower(matchbuf[i])) if( com.tolower( completedname[i] ) != com.tolower( matchbuf[i] ))
completedname[i] = 0; completedname[i] = 0;
} }
} }

View File

@ -323,33 +323,11 @@ Returns false if the time is too short to run a frame
*/ */
bool Host_FilterTime( double time ) bool Host_FilterTime( double time )
{ {
double timecap, timeleft;
host.realtime += time; host.realtime += time;
if( timescale->value < 0.0f ) if( host.realtime - host.oldrealtime < 1.0 / host_maxfps->value )
Cvar_SetValue( "timescale", 0.0f ); return false; // framerate is too high
if( host_minfps->integer < 10 )
Cvar_SetValue( "host_minfps", 10.0f );
if( host_maxfps->integer < host_minfps->integer )
Cvar_SetValue( "host_maxfps", host_minfps->integer );
// check if framerate is too high
// default to sys_ticrate (server framerate - presumably low) unless we have a good reason to run faster
timecap = host_ticrate->value;
if( host.state == HOST_FRAME )
timecap = 1.0 / host_maxfps->integer;
timeleft = host.oldrealtime + timecap - host.realtime;
if( timeleft > 0 )
{
// don't totally hog the CPU
if( timeleft >= 0.02 )
Sys_Sleep( 1 );
return false;
}
// LordHavoc: copy into host_realframetime as well
host.realframetime = host.frametime = host.realtime - host.oldrealtime; host.realframetime = host.frametime = host.realtime - host.oldrealtime;
host.oldrealtime = host.realtime; host.oldrealtime = host.realtime;
@ -358,14 +336,12 @@ bool Host_FilterTime( double time )
host.frametime = host_framerate->value; host.frametime = host_framerate->value;
} }
else else
{ { // don't allow really long or short frames
// don't allow really short frames if( host.frametime > 0.1f )
if( host.frametime > (1.0 / host_minfps->value )) host.frametime = 0.1f;
host.frametime = (1.0 / host_minfps->value); if( host.frametime < 0.001f )
host.frametime = 0.001f;
} }
host.frametime = bound( 0, host.frametime * timescale->value, 0.1f );
return true; return true;
} }
@ -386,7 +362,7 @@ void Host_Frame( double time )
return; return;
Host_EventLoop (); // process all system events Host_EventLoop (); // process all system events
Cbuf_Execute (); // execure commands Cbuf_Execute (); // execute commands
SV_Frame ( time ); // server frame SV_Frame ( time ); // server frame
CL_Frame ( time ); // client frame CL_Frame ( time ); // client frame

View File

@ -1771,5 +1771,5 @@ void SV_Physics( void )
// decrement svgame.globals->numEntities if the highest number entities died // decrement svgame.globals->numEntities if the highest number entities died
for( ; EDICT_NUM( svgame.globals->numEntities - 1)->free; svgame.globals->numEntities-- ); for( ; EDICT_NUM( svgame.globals->numEntities - 1)->free; svgame.globals->numEntities-- );
if( !sv_playersonly->integer ) sv.time += sv.frametime; // if( !sv_playersonly->integer ) sv.time += sv.frametime;
} }

View File

@ -11,12 +11,12 @@ long _ftol2( double dblSource )
return _ftol( dblSource ); return _ftol( dblSource );
} }
void* Palloc (int size ) void* Palloc( int size )
{ {
return Mem_Alloc( physpool, size ); return Mem_Alloc( physpool, size );
} }
void Pfree (void *ptr, int size ) void Pfree( void *ptr, int size )
{ {
if( ptr ) Mem_Free( ptr ); if( ptr ) Mem_Free( ptr );
} }

View File

@ -1845,12 +1845,12 @@ static void RB_DrawLine( int color, int numpoints, const float *points, const in
VectorSet( p0, points[i*3+0], points[i*3+1], points[i*3+2] ); VectorSet( p0, points[i*3+0], points[i*3+1], points[i*3+2] );
if( r_physbdebug->integer == 1 ) ConvertPositionToGame( p0 ); if( r_physbdebug->integer == 1 ) ConvertPositionToGame( p0 );
for (i = 0; i < numpoints; i ++) for( i = 0; i < numpoints; i++ )
{ {
VectorSet( p1, points[i*3+0], points[i*3+1], points[i*3+2] ); VectorSet( p1, points[i*3+0], points[i*3+1], points[i*3+2] );
if( r_physbdebug->integer == 1 ) ConvertPositionToGame( p1 ); if( r_physbdebug->integer == 1 ) ConvertPositionToGame( p1 );
pglColor4ubv( (byte *)color ); pglColor4fv( UnpackRGBA( color ));
pglVertex3fv( p0 ); pglVertex3fv( p0 );
pglVertex3fv( p1 ); pglVertex3fv( p1 );

View File

@ -92,3 +92,4 @@ Beta 13.12.08
4. Quake2XP (Effects, Glass, Shadows) 4. Quake2XP (Effects, Glass, Shadows)
5. Tenebrae (Mirrors, Cubemap Projection, Bump) 5. Tenebrae (Mirrors, Cubemap Projection, Bump)
6. Darkplaces ALL!!!!!!!!!!!!!!!111111111111 6. Darkplaces ALL!!!!!!!!!!!!!!!111111111111
7. Qfusion (portals)