diff --git a/engine/client/cl_cmds.c b/engine/client/cl_cmds.c index fc4c3c4d..66dd12a4 100644 --- a/engine/client/cl_cmds.c +++ b/engine/client/cl_cmds.c @@ -101,8 +101,8 @@ void CL_ScreenshotGetName( int lastnum, char *filename ) { int a, b, c, d; - if(!filename) return; - if(lastnum < 0 || lastnum > 9999) + if( !filename ) return; + if( lastnum < 0 || lastnum > 9999 ) { // bound com.sprintf( filename, "scrshots/%s/shot9999.%s", cl.configstrings[CS_NAME], SCRSHOT_TYPE ); @@ -140,10 +140,10 @@ void CL_ScreenShot_f( void ) string checkname; // scan for a free filename - for (i = 0; i <= 9999; i++ ) + for( i = 0; i <= 9999; i++ ) { CL_ScreenshotGetName( i, checkname ); - if(!FS_FileExists( checkname )) break; + if( !FS_FileExists( checkname )) break; } Con_ClearNotify(); @@ -154,9 +154,9 @@ void CL_EnvShot_f( void ) { string basename; - if(Cmd_Argc() < 2) + if( Cmd_Argc() < 2 ) { - Msg("Usage: envshot \n"); + Msg( "Usage: envshot \n" ); return; } @@ -169,9 +169,9 @@ void CL_SkyShot_f( void ) { string basename; - if(Cmd_Argc() < 2) + if( Cmd_Argc() < 2 ) { - Msg("Usage: envshot \n"); + Msg( "Usage: envshot \n" ); return; } @@ -210,7 +210,7 @@ void CL_SetSky_f( void ) { if(Cmd_Argc() < 2) { - Msg("Usage: sky \n"); + Msg( "Usage: sky \n" ); return; } 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; re->BeginFrame(); - re->RenderFrame(&cl.refdef); + re->RenderFrame( &cl.refdef ); re->EndFrame(); } } diff --git a/engine/client/cl_frame.c b/engine/client/cl_frame.c index 0853ac9e..842efdcb 100644 --- a/engine/client/cl_frame.c +++ b/engine/client/cl_frame.c @@ -334,7 +334,7 @@ void CL_ParseFrame( sizebuf_t *msg ) else cl.frame.valid = true; // valid delta parse } - cl.refdef.lerpfrac = CL_LerpPoint2 (); + cl.refdef.lerpfrac = CL_LerpPoint (); // clamp time cl.time = bound( cl.frame.servertime - cl.serverframetime, cl.time, cl.frame.servertime ); diff --git a/engine/client/cl_phys.c b/engine/client/cl_phys.c index c2a4f82f..2f7ef0c9 100644 --- a/engine/client/cl_phys.c +++ b/engine/client/cl_phys.c @@ -391,7 +391,7 @@ void CL_PredictMovement (void) if( step > 63 && step < 160 ) { cl.predicted_step = step; - cl.predicted_step_time = host.realtime - host.frametime * 500; + cl.predicted_step_time = cls.realtime - cls.frametime * 500; } } diff --git a/engine/common/con_utils.c b/engine/common/con_utils.c index f023f355..500c44f9 100644 --- a/engine/common/con_utils.c +++ b/engine/common/con_utils.c @@ -54,7 +54,9 @@ bool Cmd_GetMapList( const char *s, char *completedname, int length ) if( com.stricmp( ext, "bsp" )) continue; 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 ) { @@ -75,19 +77,19 @@ bool Cmd_GetMapList( const char *s, char *completedname, int length ) switch( ver ) { - case 39: com.strncpy((char *)buf, "Xash 3D", sizeof(buf)); break; - default: com.strncpy((char *)buf, "??", sizeof(buf)); break; + case 39: com.strncpy( buf, "Xash 3D", 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++; } - Msg("\n^3 %i maps found.\n", nummaps ); + Msg( "\n^3 %i maps found.\n", nummaps ); Mem_Free( t ); // cut shortestMatch to the amount common with s 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; } 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); if(!t) return false; - FS_FileBase(t->filenames[0], matchbuf ); - if(completedname && length) com.strncpy( completedname, matchbuf, length ); + FS_FileBase( t->filenames[0], matchbuf ); + if( completedname && length ) com.strncpy( completedname, matchbuf, length ); 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] ); - 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; - FS_FileBase(t->filenames[i], matchbuf ); - Msg("%16s\n", matchbuf ); + FS_FileBase( t->filenames[i], matchbuf ); + Msg( "%16s\n", matchbuf ); numfonts++; } - Msg("\n^3 %i fonts found.\n", numfonts ); - Mem_Free(t); + Msg( "\n^3 %i fonts found.\n", numfonts ); + Mem_Free( t ); // cut shortestMatch to the amount common with s - if(completedname && length) + if( completedname && length ) { 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; } } - return true; } @@ -152,35 +153,34 @@ bool Cmd_GetDemoList( const char *s, char *completedname, int length ) string matchbuf; int i, numdems; - t = FS_Search(va("demos/%s*.dem", s ), true); - if(!t) return false; + t = FS_Search( va( "demos/%s*.dem", s ), true); + if( !t ) return false; - FS_FileBase(t->filenames[0], matchbuf ); - if(completedname && length) com.strncpy( completedname, matchbuf, length ); - if(t->numfilenames == 1) return true; + FS_FileBase( t->filenames[0], matchbuf ); + if( completedname && length ) com.strncpy( completedname, matchbuf, length ); + 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] ); - if( com.stricmp(ext, "dem" )) continue; - FS_FileBase(t->filenames[i], matchbuf ); - Msg("%16s\n", matchbuf ); + if( com.stricmp( ext, "dem" )) continue; + FS_FileBase( t->filenames[i], matchbuf ); + Msg( "%16s\n", matchbuf ); numdems++; } - Msg("\n^3 %i demos found.\n", numdems ); - Mem_Free(t); + Msg( "\n^3 %i demos found.\n", numdems ); + Mem_Free( t ); // cut shortestMatch to the amount common with s - if(completedname && length) + if( completedname && length ) { 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; } } - return true; } @@ -197,31 +197,31 @@ bool Cmd_GetProgsList( const char *s, char *completedname, int length ) string matchbuf; 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; 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; - 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] ); - if( com.stricmp(ext, "dat" )) continue; - FS_FileBase(t->filenames[i], matchbuf ); - Msg("%16s\n", matchbuf ); + if( com.stricmp( ext, "dat" )) continue; + FS_FileBase( t->filenames[i], matchbuf ); + Msg( "%16s\n", matchbuf ); numprogs++; } - Msg("\n^3 %i progs found.\n", numprogs ); - Mem_Free(t); + Msg( "\n^3 %i progs found.\n", numprogs ); + Mem_Free( t ); // cut shortestMatch to the amount common with s if( completedname && length ) { 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; } } diff --git a/engine/host.c b/engine/host.c index 775b42db..af79f54a 100644 --- a/engine/host.c +++ b/engine/host.c @@ -323,33 +323,11 @@ Returns false if the time is too short to run a frame */ bool Host_FilterTime( double time ) { - double timecap, timeleft; - host.realtime += time; - if( timescale->value < 0.0f ) - Cvar_SetValue( "timescale", 0.0f ); - 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 ); + if( host.realtime - host.oldrealtime < 1.0 / host_maxfps->value ) + return false; // framerate is too high - // 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.oldrealtime = host.realtime; @@ -358,14 +336,12 @@ bool Host_FilterTime( double time ) host.frametime = host_framerate->value; } else - { - // don't allow really short frames - if( host.frametime > (1.0 / host_minfps->value )) - host.frametime = (1.0 / host_minfps->value); + { // don't allow really long or short frames + if( host.frametime > 0.1f ) + host.frametime = 0.1f; + if( host.frametime < 0.001f ) + host.frametime = 0.001f; } - - host.frametime = bound( 0, host.frametime * timescale->value, 0.1f ); - return true; } @@ -386,7 +362,7 @@ void Host_Frame( double time ) return; Host_EventLoop (); // process all system events - Cbuf_Execute (); // execure commands + Cbuf_Execute (); // execute commands SV_Frame ( time ); // server frame CL_Frame ( time ); // client frame diff --git a/engine/server/sv_phys.c b/engine/server/sv_phys.c index aaaf2b1d..deff92c9 100644 --- a/engine/server/sv_phys.c +++ b/engine/server/sv_phys.c @@ -1771,5 +1771,5 @@ void SV_Physics( void ) // decrement svgame.globals->numEntities if the highest number entities died 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; } \ No newline at end of file diff --git a/physic/cm_utils.c b/physic/cm_utils.c index 1d83dc0b..d0bc6485 100644 --- a/physic/cm_utils.c +++ b/physic/cm_utils.c @@ -11,12 +11,12 @@ long _ftol2( double dblSource ) return _ftol( dblSource ); } -void* Palloc (int size ) +void* Palloc( int size ) { return Mem_Alloc( physpool, size ); } -void Pfree (void *ptr, int size ) +void Pfree( void *ptr, int size ) { if( ptr ) Mem_Free( ptr ); } \ No newline at end of file diff --git a/render/r_backend2.c b/render/r_backend2.c index f5af4ee9..84f42fd1 100644 --- a/render/r_backend2.c +++ b/render/r_backend2.c @@ -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] ); 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] ); if( r_physbdebug->integer == 1 ) ConvertPositionToGame( p1 ); - pglColor4ubv( (byte *)color ); + pglColor4fv( UnpackRGBA( color )); pglVertex3fv( p0 ); pglVertex3fv( p1 ); diff --git a/todo.log b/todo.log index 36ebc985..61018655 100644 --- a/todo.log +++ b/todo.log @@ -92,3 +92,4 @@ Beta 13.12.08 4. Quake2XP (Effects, Glass, Shadows) 5. Tenebrae (Mirrors, Cubemap Projection, Bump) 6. Darkplaces ALL!!!!!!!!!!!!!!!111111111111 +7. Qfusion (portals) \ No newline at end of file