Check out Half-Life Re-imagined competition results!
Check out Skewing textures in Hammer, our newest tutorial!
Say hello to timadam, our newest member!
Function names are in REDFiles are in ORANGE This tutorial will show you how to achieve the view rolling effect while strafing, as in DMC and AHL. In fact, this code is the same code used in the DMC modification, I'm just showing you how to make it work for HLDM. Its quite easy actually, so lets get started... Open hud.cpp first... go to around line 84, where you'll see this code:
After that set of code, add this:
Now, go in the function CHud::Init() and find these lines:
Those should be right at the end of that function, before the final }. After that code, add this to initialize the cvar variables we defined above:
Now thats it for hud.cpp, now open view.cpp Find the V_CalcViewRoll() function in that file around line 389, right above these lines:
Add this code to define the cvar's as external variables so the linker can make use of them at compile time:
Now that you defined the variables and initialized them with some sort of value, you can begin to use them, so go inside the function V_CalcViewRoll() to find the line:
After that little bit of code, add this line to make everything complete:
That should complete it. This will give you the view rolling when the player strafes from side to side. If desired, the user can customize how much and how fast they want to roll by changing the cvars: cl_rollangle, and cl_rollspeed. The defaults are as follows: cl_rollangle = 0.65 and cl_rollspeed = 300. If you would like to change these to fit your needs, go right ahead. If not, enjoy! Questions, comments, snotty remarks, e-mail em here: mazor579@hotmail.com |