Zooming the Field of View

 

This is my first tutorial, so don’t kill me if there’s any mistake...

I will show you how to zoom the FOV (Field of View) like in Q3A: As long as you hold down the 3rd mouse button, the FOV will zoom in.

All changes take place in Client.c.

 

At the top of the file, right after the includes, add this:

 

float ZoomMultiplikator = 1.0;

 

Go to the Client_SendMove() – Function and insert the following lines:

 

if (IsKeyDown(KeyLut[VK_MBUTTON], hWnd)) 

{

ZoomMultiplikator = 0.5; // Zoom camera in

}

else

ZoomMultiplikator = 1.0;

           

If you’re using the VWeap-Entity by Thomas Werth, you could also do it like this:

 

if (IsKeyDown(KeyLut[VK_MBUTTON], hWnd)) 

{

            if(b1stPerson==GE_TRUE) // only zoom if the player is in 1st person view

ZoomMultiplikator = 0.5; // Zoom camera in

}

else

ZoomMultiplikator = 1.0;

 

Now go to the SetupCamera() – Function and change it to this:

 

static void SetupCamera(geCamera *Camera, geRect *Rect, geXForm3d *XForm)

{

            geCamera_SetWorldSpaceXForm(Camera, XForm);

            geCamera_SetAttributes(Camera, 2.0f*ZoomMultiplikator, Rect);

}

 

That’s it.

If it doesn’t work, e-mail me:

vexator_deluxe@gmx.de

 

By Matthias Ferch a/k/a <VEXATOR>

 

 

 

 

r Player FOV