Page 2 of 5

Posted: Sun Nov 23, 2003 2:05 am
by Lax
one moment

Posted: Sun Nov 23, 2003 2:13 am
by Lax

Code: Select all

[color=red]
	if (Elapsed)
	{[/color]
		// less than one second?
		if (Elapsed<1000)
		{
			// elapsed 150 ms
			// extrapolate. how many frame arrays would fit in one second?
			FPS=(float)(1000.0f/(float)Elapsed); 
			// 6.66667=1000/150
			// now multiply by the number of frames we've gone through
			// Frames 10
			FPS*=(float)Frames;
			// 66.6667= FPS * 10
	//		FPS=
		}
		else
		{
			// Frames = 100
			// Elapsed = 2000ms
			// FPS = 100 / (2000/1000) = 50

			// interpolate. how many seconds did it take for our frame array?
			FPS=(float)Frames/(float)((float)Elapsed/1000.0f); // Frames / number of seconds
		}
[color=red]	}
	else
		FPS=999.0f;[/color]
	// advance frame count
	CurrentFrame++; 
That should do it. I'll have zip fixed asap

Posted: Sun Nov 23, 2003 2:19 am
by Lax
Bad connection problems tonight I'll fix it in cvs and zip tomorrow

Posted: Sun Nov 23, 2003 12:44 pm
by Lax
http://macroquest2.com/phpBB2/viewtopic ... 8534#28534

The issue should be resolved as of today with this change, please let me know if it is not. Case considered closed until reported otherwise

Posted: Sun Nov 23, 2003 12:49 pm
by psychotik
still crashing, trying to get spew back :P

Posted: Sun Nov 23, 2003 12:57 pm
by Lax
Ah shit. now I see.

Code: Select all

VOID ProcessFrame()
{
	// Update frame array
	DWORD Now=FrameArray[CurrentFrame]=GetTickCount();

	DWORD FirstFrame=0;
	DWORD Frames=CurrentFrame;
	if (bFrameArrayFilled)
	{
		FirstFrame=CurrentFrame+1;
		if (FirstFrame>FRAME_COUNT)
		{
			FirstFrame=FRAME_COUNT;
		}
		Frames=FRAME_COUNT;
	}
	// Calculate time this frame
	DWORD LastFrame=CurrentFrame-1;
	if (LastFrame>FRAME_COUNT)
	{
		if (bFrameArrayFilled)
		{
			LastFrame=FRAME_COUNT;
			FrameTime=Now-FrameArray[LastFrame];
		}
		else
			FrameTime=0;
	}
	else
		FrameTime=Now-FrameArray[LastFrame];

	// Calculate FPS
	// Get amount of time between first frame and now
	DWORD Elapsed=Now-FrameArray[FirstFrame];


	if (Elapsed)
	{
		// less than one second?
		if (Elapsed<1000)
		{
			// elapsed 150 ms
			// extrapolate. how many frame arrays would fit in one second?
			FPS=(float)(1000.0f/(float)Elapsed); 
			// 6.66667=1000/150
			// now multiply by the number of frames we've gone through
			// Frames 10
			FPS*=(float)Frames;
			// 66.6667= FPS * 10
	//		FPS=
		}
		else
		{
			// Frames = 100
			// Elapsed = 2000ms
			// FPS = 100 / (2000/1000) = 50

			// interpolate. how many seconds did it take for our frame array?
			FPS=(float)Frames/(float)((float)Elapsed/1000.0f); // Frames / number of seconds
		}
	}
	else
		FPS=999.0f;
	// advance frame count
	if (++CurrentFrame>FRAME_COUNT)
	{
		CurrentFrame=0;
		bFrameArrayFilled=1;
	}
}
There you go, that'll fix it. Replace your function with that. Updating zip in a second

Posted: Sun Nov 23, 2003 1:04 pm
by psychotik
works, thanks for putting up with us lax :)

Posted: Sun Nov 23, 2003 1:07 pm
by Lax
thanks for your patience and help solving the problem ;) Zip updated with this fixed.

Posted: Sun Nov 23, 2003 1:57 pm
by gnome001
/cheer. happy to be of service.

been testing for the past hour and is working great

Excellent Interior Design Advice

Posted: Thu Aug 10, 2023 11:02 pm
by FrankJScott
Why don't you Google it! before you post

High Rated Product Guide

Posted: Fri Aug 18, 2023 7:12 pm
by FrankJScott
Why don't you Google it! before you post

High Rated Product Site

Posted: Tue Dec 19, 2023 11:35 am
by FrankJScott
Please try Google before asking about New Product Website 89a61d1

Recommended Product Website

Posted: Sun Dec 24, 2023 6:17 pm
by FrankJScott
Please try Google before asking about Best Product Blog 8dec9a8

Re: lockup with the fps limiter 11/21

Posted: Sun Oct 26, 2025 4:54 am
by xyilla

Re: lockup with the fps limiter 11/21

Posted: Sun Oct 26, 2025 4:56 am
by xyilla