[FIXED 0.76.1] Bug in SetCameraWindow()

Post any Bug Reports here
Post Reply
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

[FIXED 0.76.1] Bug in SetCameraWindow()

Post by Juutis »

I've known this for a while but never really bothered to figure out what causes it. Setting the FOV with the SetCameraWindow() command requires a weapon with zoomamount of 2 or greater to be armed.

CCameraManager::Tick:

Code: Select all

	int zoomamt = CCD->Weapons()->ZoomAmount();

	if(zoomamt > 0)
	{
		if(zooming)
		{
			if(zoommode)
			{
				if(FOV > (DEFAULTFOV/(float)zoomamt))
				{
					FOV -= ((dwTicks*0.001f) * 0.75f);
					if(FOV < (DEFAULTFOV/(float)zoomamt))
						FOV = (DEFAULTFOV/(float)zoomamt);
				}
			}
			else
			{
				FOV = DEFAULTFOV;
			}
		}
	}
	else
		FOV = DEFAULTFOV;
I commented the zoomamt check and the else-part and it fixed the problem, but as I'm not very familiar with the RF source it probably has some side effects like zooming not working properly with the built-in weapons or something. So I'd appreciate it if QoD or some other experienced guy could take a look at it.
Pain is only psychological.
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: Bug in SetCameraWindow()

Post by QuestOfDreams »

The problem here is not the check if(zoomamt > 0) (which is needed to protect from a division by zero) but the resetting of the FOV variable to DEFAULTFOV (which is simply defined as 2.0f). This is just plain wrong. FOV should be reset to the value you set by the SetFOV() member function or the value loaded from the camera.ini file. I've added a new member variable (m_DefaultFOV) to fix this problem ...
Post Reply