]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sys_win.c
fixed r_drawentities 0 which was forgetting to enlarge the farclip based on the world...
[xonotic/darkplaces.git] / sys_win.c
index f239daf6b0aeb957b4f54f77f1e793c9da276b77..dee6bc51c618064dde845be98bc64287948415c3 100644 (file)
--- a/sys_win.c
+++ b/sys_win.c
@@ -36,7 +36,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #define NOT_FOCUS_SLEEP        20
 
 int                    starttime;
-qboolean       ActiveApp, Minimized;
 
 static qboolean                sc_return_on_enter = false;
 HANDLE                         hinput, houtput;
@@ -178,6 +177,8 @@ SYSTEM IO
 ===============================================================================
 */
 
+void SleepUntilInput (int time);
+
 void Sys_Error (char *error, ...)
 {
        va_list         argptr;
@@ -324,12 +325,10 @@ double Sys_DoubleTime (void)
        }
 
        if (newtime < oldtime)
-               Con_Printf("Sys_DoubleTime: time running backwards??\n");
+               Con_Printf("Sys_DoubleTime: time stepped backwards (went from %f to %f, difference %f)\n", oldtime, newtime, newtime - oldtime);
        else
-       {
                curtime += newtime - oldtime;
-               oldtime = newtime;
-       }
+       oldtime = newtime;
 
        return curtime;
 }
@@ -465,7 +464,7 @@ static char *empty_string = "";
 
 int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
 {
-       double                  oldtime, newtime;
+       double                  frameoldtime, framenewtime;
        MEMORYSTATUS    lpBuffer;
        static  char    cwd[1024];
        int                             t;
@@ -568,7 +567,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
 
        Sys_Shared_LateInit();
 
-       oldtime = Sys_DoubleTime ();
+       frameoldtime = Sys_DoubleTime ();
 
        /* main window message loop */
        while (1)
@@ -576,18 +575,18 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
                if (cls.state != ca_dedicated)
                {
                // yield the CPU for a little while when paused, minimized, or not the focus
-                       if ((cl.paused && !ActiveApp) || Minimized)
+                       if ((cl.paused && !vid_activewindow) || vid_hidden)
                        {
                                SleepUntilInput (PAUSE_SLEEP);
                                scr_skipupdate = 1;             // no point in bothering to draw
                        }
-                       else if (!ActiveApp)
+                       else if (!vid_activewindow)
                                SleepUntilInput (NOT_FOCUS_SLEEP);
                }
 
-               newtime = Sys_DoubleTime ();
-               Host_Frame (newtime - oldtime);
-               oldtime = newtime;
+               framenewtime = Sys_DoubleTime ();
+               Host_Frame (framenewtime - frameoldtime);
+               frameoldtime = framenewtime;
        }
 
        /* return success of application */