PMove: Fixed water movement code a bit so we don't sink while moving

This commit is contained in:
Marco Cawthorne 2021-02-16 11:02:39 +01:00
parent 8716784288
commit 89be1ea628
1 changed files with 10 additions and 12 deletions

View File

@ -322,7 +322,6 @@ PMove_AccelWater(float move_time, float premove)
flFriction = min(wish_speed - flFriction, serverkeyfloat("phy_wateraccelerate") * wish_speed * move_time);
self.velocity = self.velocity + normalize(vecWishVel) * flFriction;
return;
}
void
@ -471,6 +470,7 @@ PMove_Acceleration(float move_time, float premove)
if (self.waterlevel >= 2) {
PMove_AccelWater(move_time, premove);
return;
}
}
@ -701,6 +701,15 @@ PMove_Run(void)
input_buttons &= ~INPUT_BUTTON2;
}
/* move camera up (noclip, fly) when holding jump */
if (input_buttons & INPUT_BUTTON2) {
input_movevalues[2] = 240;
}
/* move camera down (noclip, fly) when holding crouching */
if (input_buttons & INPUT_BUTTON8) {
input_movevalues[2] = -240;
}
/* establish which water elements we're dealing in */
GamePMove_WaterMove(pl);
@ -708,17 +717,6 @@ PMove_Run(void)
if (self.waterlevel >= 2) {
PMove_CheckWaterJump();
}
/* move camera up (noclip, fly) when holding jump */
if (input_buttons & INPUT_BUTTON2) {
input_movevalues[2] = 240;
}
/* move camera down (noclip, fly) when holding crouching */
if (input_buttons & INPUT_BUTTON8) {
input_movevalues[2] = -240;
}
/* grappling hook stuff */
if (pl.hook.skin == 1) {
pl.velocity = (pl.hook.origin - pl.origin);