Quake strafing

From Valve Developer Community
Jump to: navigation, search
English (en)
Edit

This method will allow you to make the Half-Life Half-Life more dynamic. All work is done on the client side. And add Quake Quake-style strafes. Open view.cpp in cl_dll and go down to the V_CalcViewRoll function.

Way

1. Add two new strings:

extern cvar_t *cl_rollspeed;
extern cvar_t *cl_rollangle;

2. Remove the lines:

float side;
side = V_CalcRoll ( viewentity->angles, pparams->simvel, pparams->movevars->rollangle, pparams->movevars->rollspeed );

3. Replace the line:

pparams->viewangles[ROLL] += side;

With:

 pparams->viewangles[ROLL] = V_CalcRoll (pparams->viewangles, pparams->simvel, cl_rollangle->value, cl_rollspeed->value ) * 4;

4. It remains only to declare two new variables cl_rollspeed and cl_rollangle. Go to hud.cpp and somewhere after the header files add two new lines:

 cvar_t *cl_rollspeed;
cvar_t *cl_rollangle;

5. Scroll down to void CHud
Init( void ) and stick it in there:

cl_rollangle = gEngfuncs.pfnRegisterVariable ( "cl_rollangle", "0.65", FCVAR_CLIENTDLL|FCVAR_ARCHIVE );
cl_rollspeed = gEngfuncs.pfnRegisterVariable ( "cl_rollspeed", "300", FCVAR_CLIENTDLL|FCVAR_ARCHIVE );

The screen will now tilt like Quake or DMC when strafes. You can change the number 4 to your liking, this is the tilt factor, that is, the larger this value, the more the screen tilts.