From 26f14f439be932769b487f51ecf421f66317ae91 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 29 Nov 2009 02:57:09 +0000 Subject: [PATCH] - Fixed: The FPS meter cannot use I_MSTime(), because if the game is started with +vid_fps 1, it can need the time before the timer is ready to start. SVN r2009 (trunk) --- docs/rh-log.txt | 2 ++ src/sdl/i_system.cpp | 6 ++++++ src/sdl/i_system.h | 1 + src/v_video.cpp | 4 ++-- src/win32/i_system.cpp | 16 ++++++++++++++++ src/win32/i_system.h | 1 + 6 files changed, 28 insertions(+), 2 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index cb1dae7db..53b5891ef 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,6 @@ November 28, 2009 +- Fixed: The FPS meter cannot use I_MSTime(), because if the game is started + with +vid_fps 1, it can need the time before the timer is ready to start. - Initialize TempRenderTexture and the back buffer to black upon creation. - Fixed: Windowed mode always needs to draw to the temporary surface, even when not gamma correcting, so that D3DFB::GetCurrentScreen() can read from diff --git a/src/sdl/i_system.cpp b/src/sdl/i_system.cpp index 8d0a8b947..931b8a37d 100644 --- a/src/sdl/i_system.cpp +++ b/src/sdl/i_system.cpp @@ -124,6 +124,12 @@ unsigned int I_MSTime (void) return time - BaseTime; } +// Exactly the same thing, but based does no modification to the time. +unsigned int I_FPSTime() +{ + return SDL_GetTicks(); +} + // // I_GetTime // returns time in 1/35th second tics diff --git a/src/sdl/i_system.h b/src/sdl/i_system.h index 768240074..778af53f5 100644 --- a/src/sdl/i_system.h +++ b/src/sdl/i_system.h @@ -126,6 +126,7 @@ bool I_WriteIniFailed (); // [RH] Returns millisecond-accurate time unsigned int I_MSTime (void); +unsigned int I_FPSTime(); // Directory searching routines diff --git a/src/v_video.cpp b/src/v_video.cpp index ca8eb7fdc..d8187eb9d 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -838,7 +838,7 @@ void DFrameBuffer::DrawRateStuff () // Draws frame time and cumulative fps if (vid_fps) { - DWORD ms = I_MSTime (); + DWORD ms = I_FPSTime(); DWORD howlong = ms - LastMS; if (howlong >= 0) { @@ -876,7 +876,7 @@ void DFrameBuffer::DrawRateStuff () // Buffer can be NULL if we're doing hardware accelerated 2D if (buffer != NULL) { - buffer += (GetHeight()-1)*GetPitch(); + buffer += (GetHeight()-1) * GetPitch(); for (i = 0; i < tics*2; i += 2) buffer[i] = 0xff; for ( ; i < 20*2; i += 2) buffer[i] = 0x00; diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index d39cfc804..6320c33f5 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -280,6 +280,22 @@ unsigned int I_MSTime() return timeGetTime() - basetime; } +//========================================================================== +// +// I_FPSTime +// +// Returns the current system time in milliseconds. This is used by the FPS +// meter of DFrameBuffer::DrawRateStuff(). Since the screen can display +// before the play simulation is ready to begin, this needs to be +// separate from I_MSTime(). +// +//========================================================================== + +unsigned int I_FPSTime() +{ + return timeGetTime(); +} + //========================================================================== // // I_GetTimePolled diff --git a/src/win32/i_system.h b/src/win32/i_system.h index f268358d7..66b2bac7d 100644 --- a/src/win32/i_system.h +++ b/src/win32/i_system.h @@ -132,6 +132,7 @@ bool I_WriteIniFailed (); // [RH] Returns millisecond-accurate time unsigned int I_MSTime (void); +unsigned int I_FPSTime(); // [RH] Title banner to display during startup extern const IWADInfo *DoomStartupInfo;