Welcome, Guest! Login | Register

Fixing Valve's bouncy crouch code [Print this Article]
Posted by: Mazor
Date posted: Mar 07 2004
User Rating: N/A
Number of views: 5207
Number of comments: 7
Description: Notice how if you tap your crouch key very fast you bounce? This code will fix that.
Fixing bouncy crouch code is one thing that I feel every mod should do before they release. It prevents the fact that players can tap their crouch code and bounce their player up and down rappidly, moving their hit boxes around causing them to be harder to hit in critical areas like the head. Here is how you fix that:

Open pm_shared.c
Find the function PM_UnDuck()
Then find this code:
 CODE (C++) 

if ( pmove->onground != -1 )
{
    for ( i = 0; i < 3; i++ )
    {
        newOrigin[i] += ( pmove->player_mins[1][i] - pmove->player_mins[0][i] );
    }
}

Change that code block to look like this:
 CODE (C++) 

if ( pmove->onground != -1 && pmove->flags & FL_DUCKING && pmove->bInDuck == false)
{
    for ( i = 0; i < 3; i++ )
    {
        newOrigin[i] += ( pmove->player_mins[1][i] - pmove->player_mins[0][i] );
    }
}


Remember to compile both client and server dlls before you test this out!

Any questions? Email me: mazor@firearmsmod.com

-Cale 'Mazor' Dunlap
Programmer
Firearms Half-Life
http://www.firearmsmod.com

Rate This Article
This article has not yet been rated.

You have to register to rate this article.
User Comments Showing comments 1-7

Posted By: omega on Mar 14 2004 at 17:52:37
i think i know why i didn't approve it now..
it doesn't do anything noticable in stock source at all.

Posted By: Jorkapp on Mar 15 2004 at 17:06:07
It actually does something.

Using stock code, rapidly press the duck key. You'll go up and down like a madman, and will make it difficult to hit your head.

Implement this code, and unless you hold the duck key down, you won't go down.

Posted By: Mazor on Mar 16 2004 at 10:29:15
Jork: Exactly :)

Posted By: Cruentus on Mar 19 2004 at 20:47:56
This creates more problems then its worth, try jumping on a satchel charge once this code has been implemented, prepare for pogo vision.

Posted By: Mazor on Mar 26 2004 at 11:04:28
I put this code in FA because people exploited the hell out of the fact you can throw off the hitboxes by tapping the crouch key. Pogo vision is the last of my worries.

Posted By: jim_the_coder on Mar 26 2004 at 22:21:59
I tried it with someone, did a before and after; and I see how it can be exploited. Useful for me :)

Posted By: Jorkapp on Mar 27 2004 at 03:51:43
Works for me as well. Would hate to have that kind of exploit in a mod.


You must register to post a comment. If you have already registered, you must login.

Latest Articles
3rd person View in Multiplayer
Half-Life 2 | Coding | Client Side Tutorials
How to enable it in HL2DM

By: cct | Nov 13 2006

Making a Camera
Half-Life 2 | Level Design
This camera is good for when you join a map, it gives you a view of the map before you join a team

By: slackiller | Mar 05 2006

Making a camera , Part 2
Half-Life 2 | Level Design
these cameras are working monitors that turn on when a button is pushed.

By: slackiller | Mar 04 2006

Storing weapons on ladder
Half-Life 2 | Coding | Snippets
like Raven Sheild or BF2

By: British_Bomber | Dec 24 2005

Implementation of a string lookup table
Half-Life 2 | Coding | Snippets
A string lookup table is a set of functions that is used to convert strings to pre-defined values

By: deathz0rz | Nov 13 2005


Latest Comments
knock knock
General | News
By: MIFUNE | Dec 31 2017
 
knock knock
General | News
By: omega | Dec 22 2016
 
knock knock
General | News
By: MIFUNE | Oct 10 2015
 
New HL HUD Message System
Half-Life | Coding | Shared Tutorials
By: chbrules | Dec 31 2011
 
knock knock
General | News
By: Whistler | Nov 05 2011
 
Particle Engine tutorial part 4
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 18 2010
 
Particle Engine tutorial part 2
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 11 2010
 
Particle Engine tutorial part 3
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 11 2010
 
Game Movement Series #2: Analog Jumping and Floating
Half-Life 2 | Coding | Shared Tutorials
By: mars3554 | Oct 26 2009
 
Particle Engine tutorial part 5
Half-Life | Coding | Client Side Tutorials
By: Deadpool | Aug 02 2009
 

Site Info
297 Approved Articless
8 Pending Articles
3940 Registered Members
0 People Online (6 guests)
About - Credits - Contact Us

Wavelength version: 3.0.0.9
Valid XHTML 1.0! Valid CSS!