Raptor007 / aq2-tng

Action Quake 2: The Next Generation. Raptor007's sandbox for testing changes. When verified stable, this code is pushed to the official aq2-tng repo:
https://github.com/aq2-tng/aq2-tng/tree/bots
4 stars 2 forks source link

Speedhack with legs damage. cl_maxfps 1 BUG #42

Closed stan0x closed 7 years ago

stan0x commented 7 years ago

If hit in the legs or leg damage from falling and set ¨cl_maxfps 1¨ u can walk fast again. Some people use this with smart binds while bandage so they can make benefit of if like a speed hack.

Also bandage feels a lot different with low fps against high fps. Maybe its a good way +speed is forced while there is legs damage.

Raptor007 commented 7 years ago

I'm pretty sure this can be solved in p_client.c ClientThink: https://github.com/Raptor007/aq2-tng/blob/4bea2afda22a7f2d01df1dd720e4569a8b8f8943/source/p_client.c#L2802

First I'll investigate the possibility that cl_maxfps 1 can prevent ClientThink from happening when (framenum/framediv)%6 <= 2, the frames needed to induce stumbling: https://github.com/Raptor007/aq2-tng/blob/4bea2afda22a7f2d01df1dd720e4569a8b8f8943/source/p_client.c#L2899 If that's the case, I can make stumbling happen based on elapsed frames since last stumble start.

Raptor007 commented 7 years ago

The old AQ2 code for stumbling reduced the velocity for the next frame while trying to avoid interfering with velocity that comes from other sources, such as falling or standing on a moving platform. Clients could avoid these velocity reductions with cl_maxfps 1, and I verified that the same cheat works in 1.52 as well.

Fixed: It would be a mess to try to make the old stumble code robust against changing client rates without breaking other velocity changes, so I decided it would be simpler to redesign it. Now on the stumble frames, it acts as though the client was simply attempting to move with less velocity, by the same degree that the old method would have reduced their velocity: https://github.com/Raptor007/aq2-tng/commit/ccf2fb0bb60d95d070a25bee0234f2a216da770b

Interesting side note: leg_damage is always 0 or 1, so this will sound will never play: https://github.com/Raptor007/aq2-tng/blob/4bea2afda22a7f2d01df1dd720e4569a8b8f8943/source/p_client.c#L2907 Perhaps this was supposed to check leghits > 1, but since 1.52 also didn't have pain sounds associated with leg damage, I don't think I should "fix" the noisy leg damage feature.

Raptor007 commented 7 years ago

I had to tweak this a little more because Quake2 crouched walking and running are the same speed, but AQ2 stumbling should also apply when crouched: https://github.com/Raptor007/aq2-tng/commit/7c1e6ee8a007e45c2191bfcf76d0d5f1d0569b9f

Raptor007 commented 7 years ago

I need to get rid of the "really stop jumping" part because it prevents sv slap and other sources of damage from throwing a player with hurt legs into the air.

Raptor007 commented 7 years ago

Tweaked to more closely match 1.52 (without its cheat vulnerability) and I was able to clean up the leg damage jump prevention too: https://github.com/Raptor007/aq2-tng/commit/fc892c78706055c45acc43a087a7307e25d80812

It's still a little faster to get across the map with leg damage than 1.52 was, but at this point it's close enough for me.

Raptor007 commented 7 years ago

Maybe when frame%6==5 it should use leghits to partially slow down.

Raptor007 commented 7 years ago

I did some more tweaking and testing, and it is now an almost perfect match for 1.52 stumble speed, including multiple levels of leghits: https://github.com/Raptor007/aq2-tng/commit/cdbcf811d3c990b0e4cbd04a6fd1f417f8e5036e