From ee1558ddc0664f2fa549a36e86e9748da225f584 Mon Sep 17 00:00:00 2001 From: lordhavoc Date: Sun, 9 Jun 2002 00:20:49 +0000 Subject: [PATCH] timer now simply returns same time twice if the time input wraps, and posts a warning about this occurring, rather than doing a Sys_Error cleaned up lots of code, mostly timer related. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@1930 d7cf8633-e32d-0410-b094-e92efae38249 --- sys_win.c | 138 ++++++++++++++++++++---------------------------------- 1 file changed, 50 insertions(+), 88 deletions(-) diff --git a/sys_win.c b/sys_win.c index 8715a607..f239daf6 100644 --- a/sys_win.c +++ b/sys_win.c @@ -8,7 +8,7 @@ of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -28,10 +28,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "conproc.h" #include "direct.h" -#define CONSOLE_ERROR_TIMEOUT 60.0 // # of seconds to wait on Sys_Error running - // dedicated before exiting -#define PAUSE_SLEEP 50 // sleep time on pause or minimization -#define NOT_FOCUS_SLEEP 20 // sleep time when not focus +// # of seconds to wait on Sys_Error running dedicated before exiting +#define CONSOLE_ERROR_TIMEOUT 60.0 +// sleep time on pause or minimization +#define PAUSE_SLEEP 50 +// sleep time when not focus +#define NOT_FOCUS_SLEEP 20 int starttime; qboolean ActiveApp, Minimized; @@ -59,7 +61,7 @@ QFile *sys_handles[MAX_HANDLES]; int findhandle (void) { int i; - + for (i=1 ; i= ' ') { - WriteFile(houtput, &ch, 1, &dummy, NULL); + WriteFile(houtput, &ch, 1, &dummy, NULL); text[len] = ch; len = (len + 1) & 0xff; } @@ -451,7 +422,7 @@ void Sys_Sleep (void) void Sys_SendKeyEvents (void) { - MSG msg; + MSG msg; while (PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE)) { @@ -461,8 +432,8 @@ void Sys_SendKeyEvents (void) if (!GetMessage (&msg, NULL, 0, 0)) Sys_Quit (); - TranslateMessage (&msg); - DispatchMessage (&msg); + TranslateMessage (&msg); + DispatchMessage (&msg); } } @@ -470,7 +441,7 @@ void Sys_SendKeyEvents (void) /* ============================================================================== - WINDOWS CRAP +WINDOWS CRAP ============================================================================== */ @@ -499,9 +470,9 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin static char cwd[1024]; int t; - /* previous instances do not exist in Win32 */ - if (hPrevInstance) - return 0; + /* previous instances do not exist in Win32 */ + if (hPrevInstance) + return 0; global_hInstance = hInstance; global_nCmdShow = nCmdShow; @@ -593,22 +564,13 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin // because sound is off until we become active S_BlockSound (); -#if WIN32_USETIMEGETTIME - // make sure the timer is high precision, otherwise NT gets 18ms resolution - // LordHavoc: - // Windows 2000 Advanced Server (and possibly other versions) - // apparently have a broken timer, because it runs at more like 10x speed - // if this isn't used, heh - timeBeginPeriod (1); -#endif - Host_Init (); Sys_Shared_LateInit(); oldtime = Sys_DoubleTime (); - /* main window message loop */ + /* main window message loop */ while (1) { if (cls.state != ca_dedicated) @@ -628,7 +590,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin oldtime = newtime; } - /* return success of application */ - return true; + /* return success of application */ + return true; } -- 2.39.2