diff options
author | Jack Palevich <jackpal@google.com> | 2010-12-16 19:06:00 -0800 |
---|---|---|
committer | Jack Palevich <jackpal@google.com> | 2010-12-16 19:06:00 -0800 |
commit | 296fe63c4f6f1f28e0e50b51f6aa8d92e1919991 (patch) | |
tree | 254e2a7a3bf3b517d0987cd5256469040ac50716 /quake/src/WinQuake/host.cpp | |
parent | d6e5c0c7191348931592653048274a1091af1e5f (diff) | |
download | quake-296fe63c4f6f1f28e0e50b51f6aa8d92e1919991.tar.gz |
Avoid visual corruption if the game runs too fast.
If we run too fast while not in timedemo mode the game will
return immediately rather than rendering a frame.
If we go ahead and return to GLSurfaceView, it will swap the GL buffer
without having drawn anything into it, which will lead to garbage
being displayed.
The work-around is to detect that the game has decided to not render
anything, sleep for a ms and then try again.
Change-Id: Iba9d759547ddbc30534db963f5c47011038cc246
Diffstat (limited to 'quake/src/WinQuake/host.cpp')
-rw-r--r-- | quake/src/WinQuake/host.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/quake/src/WinQuake/host.cpp b/quake/src/WinQuake/host.cpp index 670d7a0..f1af56a 100644 --- a/quake/src/WinQuake/host.cpp +++ b/quake/src/WinQuake/host.cpp @@ -42,6 +42,7 @@ double host_time; double realtime; // without any filtering or bounding double oldrealtime; // last frame run int host_framecount; +qboolean host_framethrottled; // Running too fast int host_hunklevel; @@ -644,7 +645,8 @@ void _Host_Frame (float time) rand (); // decide the simulation time - if (!Host_FilterTime (time)) + host_framethrottled = !Host_FilterTime (time); + if (host_framethrottled) return; // don't run too fast, or packets will flood out // get new key events |