HIT Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: [C++] Fix Valve's bouncy crouch code  (Read 2845 times)

0 Members and 1 Guest are viewing this topic.

Shepard62700FR

  • Snark
  • **
  • Offline Offline
  • Posts: 4
    • View Profile
[C++] Fix Valve's bouncy crouch code
« on: January 01, 2009, 10:19:32 AM »

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: [Select]
if ( pmove->onground != -1 )
{
    for ( i = 0; i < 3; i++ )
    {
        newOrigin[i] += ( pmove->player_mins[1][i] - pmove->player_mins[0][i] );
    }
}
Change to :
Code: [Select]
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

Original Version at : http://articles.thewavelength.net/473/.
Logged

Nige111

  • Gonarch
  • ********
  • Offline Offline
  • Posts: 2601
  • Metal Gea.. I mean.. Shagohod?!
    • View Profile
    • Cake :D
Re: [C++] Fix Valve's bouncy crouch code
« Reply #1 on: January 01, 2009, 11:57:30 AM »

~snip~
« Last Edit: January 01, 2009, 05:19:44 PM by Nige111 »
Logged

Barnz

  • French Fries
  • Gonarch
  • ********
  • Offline Offline
  • Posts: 1420
    • View Profile
Re: [C++] Fix Valve's bouncy crouch code
« Reply #2 on: January 01, 2009, 12:25:11 PM »

He's not a FireArms devs, he just translated the tutorial.
Logged

Shepard62700FR

  • Snark
  • **
  • Offline Offline
  • Posts: 4
    • View Profile
Re: [C++] Fix Valve's bouncy crouch code
« Reply #3 on: January 01, 2009, 12:43:24 PM »

Original Version at : http://articles.thewavelength.net/473/.

I'm aren't a FireArms dev, I'm just a GoldSrc Mapper and coder.
Logged

bloodsurfer

  • The zxeno prophet
  • Gargantua
  • *******
  • Offline Offline
  • Posts: 521
  • Coding furiously
    • View Profile
Re: [C++] Fix Valve's bouncy crouch code
« Reply #4 on: January 01, 2009, 04:31:41 PM »

Oh thanks I always forgot about that one, added into BSR code =P

Btw if you don't want to get people confuse about tutorial you get/translate from other website, first ask their author and second put a sentence at the beginning of your post to say that you didn't make it.
Logged

Nige111

  • Gonarch
  • ********
  • Offline Offline
  • Posts: 2601
  • Metal Gea.. I mean.. Shagohod?!
    • View Profile
    • Cake :D
Re: [C++] Fix Valve's bouncy crouch code
« Reply #5 on: January 01, 2009, 05:19:36 PM »

Oh shit, my bad. D:
Logged