Page 1 of 1

[FIXED 0.76.1] Bug in SetCameraWindow()

Posted: Wed May 13, 2009 4:03 pm
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.

Re: Bug in SetCameraWindow()

Posted: Tue Jun 02, 2009 11:37 am
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 ...