Halflife: [HL1] [REQUEST] Add viewroll and old viewmodel bob

Created on 9 Sep 2014  路  17Comments  路  Source: ValveSoftware/halflife

After version 1.1.1.0 (i think), the viewroll when strafing left and right was removed, alongside the old viewmodel bob. Video demonstration (0.38-0.50s): http://youtu.be/uKkJPFmDW9Q?t=38s

All 17 comments

I love that rolling effect too, so I've coded it back. If you are interested in adding it by yourself, here you have my code.

To add view rolling to the client code do the following
Open the client project (for windows) or just edit the files and compile them with the script (for linux)

First of all we are going to add 2 cvars to control the speed of rolling and the max rotation angle, so open hud.cpp, go to the line 85

cvar_t *cl_lw = NULL;

and add this after it:

cvar_t *cl_rollangle;
cvar_t *cl_rollspeed;

Now, go to line 320

HOOK_MESSAGE( VGUIMenu );

after that line, add

cl_viewrollangle = CVAR_CREATE ( "cl_viewrollangle", "0.65", FCVAR_CLIENTDLL | FCVAR_ARCHIVE );
cl_viewrollspeed = CVAR_CREATE ( "cl_viewrollspeed", "300", FCVAR_CLIENTDLL | FCVAR_ARCHIVE );

Well, now save the file, and now go to view.cpp and find the function

void V_CalcViewRoll ( struct ref_params_s *pparams )

before that line, add this, to use the cvars defined in hud.cpp:

extern cvar_t *cl_viewrollangle;
extern cvar_t *cl_viewrollspeed;

finally, inside the function, after

if ( !viewentity )
return;

add this code to calculate the view rolling based on the cvars values

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

Now compile the client library and you will have the old view rolling effect back.

@L453rh4wk would you make a pull request with what you posted? @alfred-valve has been accepting some patches at his personal discretion.

Thanks, you're awesome dude! Now I gotta find a way to get rid of that god awful walk animation...

I've found a way to reproduce the same walking anim.
Go to view.cpp, and locate the function called

void V_CalcNormalRefdef ( struct ref_params_s *pparams )

Inside that function find this block of code:

// throw in a little tilt.
view->angles[YAW] -= bob * 0.5;
view->angles[ROLL] -= bob * 1;
view->angles[PITCH] -= bob * 0.3;

After it, add this line and recompile

VectorCopy( view->angles, view->curstate.angles );

You deserve a medal good sir

I'm glad to help the half-life community :)

@L453rh4wk Did you find that yourself or have you made a Google search and came accross this : http://am.half-lifecreations.com/forums/index.php?topic=288.0 ?

@L453rh4wk I can't find hud.cpp plz help

How can I do that ? I don't understand nothing of programming.

1>c:\users\geninho\desktop\src_dll\cl_dll\hud.cpp(323): error C2065: 'cl_viewrollangle' : undeclared identifier
1>c:\users\geninho\desktop\src_dll\cl_dll\hud.cpp(324): error C2065: 'cl_viewrollspeed' : undeclared identifier

Looks like the lines starting with extern are missing.

cvar_t *cl_rollangle;
cvar_t *cl_rollspeed;

They don't match with

cl_viewrollangle = CVAR_CREATE ( "cl_viewrollangle", "0.65", FCVAR_CLIENTDLL | FCVAR_ARCHIVE );
cl_viewrollspeed = CVAR_CREATE ( "cl_viewrollspeed", "300", FCVAR_CLIENTDLL | FCVAR_ARCHIVE );

That's why you are having an error when attempting to build the solution.
The fix is to simply change cl_rollangle and cl_rollspeed to cl_viewrollangle and cl_viewrollspeed.

I'm bumping this with hopes. It would be a great addition in my opinion. With a simple command such as:

cl_bob_old "1"

I'm bumping this with hopes. It would be a great addition in my opinion. With a simple command such as:

cl_bob_old "1"

@BlackShadow This feature is in my PR #2900

No need to promote your own mod. Bringing old bob is a simple trick. What we want is bringing old bob in official version.

That's why I opened the PR

Was this page helpful?
0 / 5 - 0 ratings

Related issues

perforatorRU picture perforatorRU  路  3Comments

LuckyStrikeOriginal picture LuckyStrikeOriginal  路  4Comments

DreaDk picture DreaDk  路  4Comments

twisterniq picture twisterniq  路  4Comments

ghost picture ghost  路  4Comments