X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=sys_sdl.c;h=4a908537cce4c72f4c56ac3efae71c0481a0c43e;hb=f5b602ea082842a416c64c63e2b3e00585624945;hp=702cfaf881a85c7c801c72b22e476723f89af3af;hpb=cd7454f9df6b152a24c5a28750041d27023fbc1f;p=xonotic%2Fdarkplaces.git diff --git a/sys_sdl.c b/sys_sdl.c index 702cfaf8..4a908537 100644 --- a/sys_sdl.c +++ b/sys_sdl.c @@ -1,3 +1,4 @@ +#include "quakedef.h" #ifdef WIN32 #include @@ -10,8 +11,6 @@ #include -#include "quakedef.h" - #include // ======================================================================= @@ -54,6 +53,8 @@ void Sys_PrintToTerminal(const char *text) // BUG: for some reason, NDELAY also affects stdout (1) when used on stdin (0). int origflags = fcntl (1, F_GETFL, 0); fcntl (1, F_SETFL, origflags & ~FNDELAY); +#else +#define write _write #endif while(*text) { @@ -88,6 +89,10 @@ double Sys_DoubleTime (void) if (newtime - oldtime < -0.01) Con_Printf("Sys_DoubleTime: time stepped backwards (went from %f to %f, difference %f)\n", oldtime, newtime, newtime - oldtime); } + else if (newtime > oldtime + 1800) + { + Con_Printf("Sys_DoubleTime: time stepped forward (went from %f to %f, difference %f)\n", oldtime, newtime, newtime - oldtime); + } else curtime += newtime - oldtime; oldtime = newtime; @@ -108,11 +113,11 @@ char *Sys_ConsoleInput(void) while (_kbhit ()) { c = _getch (); - putch (c); + _putch (c); if (c == '\r') { text[len] = 0; - putch ('\n'); + _putch ('\n'); len = 0; return text; } @@ -120,8 +125,8 @@ char *Sys_ConsoleInput(void) { if (len) { - putch (' '); - putch (c); + _putch (' '); + _putch (c); len--; text[len] = 0; } @@ -155,11 +160,9 @@ char *Sys_ConsoleInput(void) return NULL; } -void Sys_Sleep(int milliseconds) +void Sys_Sleep(int microseconds) { - if (milliseconds < 1) - milliseconds = 1; - SDL_Delay(milliseconds); + SDL_Delay(microseconds / 1000); } char *Sys_GetClipboardData (void) @@ -174,11 +177,11 @@ char *Sys_GetClipboardData (void) if ((hClipboardData = GetClipboardData (CF_TEXT)) != 0) { - if ((cliptext = GlobalLock (hClipboardData)) != 0) + if ((cliptext = (char *)GlobalLock (hClipboardData)) != 0) { size_t allocsize; allocsize = GlobalSize (hClipboardData) + 1; - data = Z_Malloc (allocsize); + data = (char *)Z_Malloc (allocsize); strlcpy (data, cliptext, allocsize); GlobalUnlock (hClipboardData); }