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: 2246
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 11: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 11: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 04:29:15
Jork: Exactly :)

Posted By: Cruentus on Mar 19 2004 at 14: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 05: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 16: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 26 2004 at 21: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 04 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
Spinning Corpses Simple Fix
Half-Life | Coding | Snippets
By: darkPhoenix | Sep 05 2008
 
Where do we go from here
General | News
By: MIFUNE | Jun 09 2008
 
The Input/Output system
Half-Life 2 | Level Design
By: nazitaco | Dec 23 2007
 
Where do we go from here
General | News
By: Rob_F | Nov 22 2007
 
Rescaling Half-Life
Half-Life | Coding | Shared Tutorials
By: christoph | Nov 12 2007
 
GameUI
Half-Life 2 | Coding | Client Side Tutorials
By: Evil_j | Oct 29 2007
 
3 State Zoom For Any Weapon
Half-Life 2 | Coding | Server Side Tutorials
By: Ennuified | Oct 18 2007
 
Storing weapons on ladder
Half-Life 2 | Coding | Snippets
By: cct | Sep 07 2007
 
CTF Gameplay Part 1
Half-Life | Coding | Shared Tutorials
By: DarkNight | Aug 28 2007
 
CTF Gameplay Part 1
Half-Life | Coding | Shared Tutorials
By: deedok | Aug 20 2007
 

Site Info
296 Approved Articless
5 Pending Articles
3940 Registered Members
2 People Online (37 guests)
About - Credits - Contact Us

Wavelength version: 3.0.0.9
Valid XHTML 1.0! Valid CSS!