Quake strafing: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (→‎top: clean up, replaced: {{Language subpage → {{langsp)
m (Multipage removal)
Line 1: Line 1:
{{langsp}}
{{LanguageBar}}
 
This method will allow you to make the {{hl|4}} more dynamic. All work is done on the client side. And add {{quake|4|addtext=-style}} strafes.
This method will allow you to make the {{hl|4}} more dynamic. All work is done on the client side. And add {{quake|4|addtext=-style}} strafes.
Open ''view.cpp'' in ''cl_dll'' and go down to the ''V_CalcViewRoll'' function.  
Open ''view.cpp'' in ''cl_dll'' and go down to the ''V_CalcViewRoll'' function.  
Line 28: Line 29:


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.
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.
[[Category:GoldSrc_Programming]]
[[Category:GoldSrc_Tutorials]]

Revision as of 10:18, 12 July 2024

English (en)Translate (Translate)

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.