From 1be16938d890b6cefb5c5a176ea1dd886a479321 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 24 May 2020 02:19:47 +1000 Subject: [PATCH] Alternate fix for jittery view while floating in the water frozen: make use of waterlevel and cancel any sinking effects while frozen --- qcsrc/common/physics/player.qc | 14 ++++---------- qcsrc/ecs/systems/physics.qc | 6 +++--- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/qcsrc/common/physics/player.qc b/qcsrc/common/physics/player.qc index 16abe38c8..a04331d3d 100644 --- a/qcsrc/common/physics/player.qc +++ b/qcsrc/common/physics/player.qc @@ -616,11 +616,7 @@ void PM_check_frozen(entity this) { if (!PHYS_FROZEN(this)) return; - if (PHYS_DODGING_FROZEN(this) -#ifdef SVQC - && IS_REAL_CLIENT(this) -#endif - ) + if (PHYS_DODGING_FROZEN(this) && IS_CLIENT(this)) { // bind movement to a very slow speed so dodging can use .movement for directional calculations PHYS_CS(this).movement_x = bound(-2, PHYS_CS(this).movement.x, 2); @@ -630,13 +626,11 @@ void PM_check_frozen(entity this) else PHYS_CS(this).movement = '0 0 0'; - vector midpoint = ((this.absmin + this.absmax) * 0.5); - if (pointcontents(midpoint) == CONTENT_WATER) + if(this.waterlevel >= WATERLEVEL_SWIMMING) { this.velocity = this.velocity * 0.5; - - if (pointcontents(midpoint + '0 0 16') == CONTENT_WATER) - this.velocity_z = 200; + if(this.waterlevel >= WATERLEVEL_SUBMERGED) + this.velocity.z = 160; } } diff --git a/qcsrc/ecs/systems/physics.qc b/qcsrc/ecs/systems/physics.qc index 41506ec31..e8c30dda5 100644 --- a/qcsrc/ecs/systems/physics.qc +++ b/qcsrc/ecs/systems/physics.qc @@ -196,7 +196,7 @@ void sys_phys_simulate(entity this, float dt) if (this.com_phys_water) { // water jump only in certain situations // this mimics quakeworld code - if (this.com_in_jump && this.waterlevel == WATERLEVEL_SWIMMING && this.velocity_z >= -180 && !this.viewloc) { + if (this.com_in_jump && this.waterlevel == WATERLEVEL_SWIMMING && this.velocity_z >= -180 && !this.viewloc && !PHYS_FROZEN(this)) { vector yawangles = '0 1 0' * this.v_angle.y; vector forward, right, up; MAKE_VECTORS(yawangles, forward, right, up); @@ -222,7 +222,7 @@ void sys_phys_simulate(entity this, float dt) vector wishvel = forward * PHYS_CS(this).movement.x + right * PHYS_CS(this).movement.y + '0 0 1' * PHYS_CS(this).movement.z * (this.com_phys_vel_2d ? 0 : 1); - if (this.com_phys_water) { + if (this.com_phys_water && !PHYS_FROZEN(this)) { if (PHYS_INPUT_BUTTON_CROUCH(this)) { wishvel.z = -PHYS_MAXSPEED(this); } @@ -337,7 +337,7 @@ void sys_phys_simulate(entity this, float dt) } // holding jump button swims upward slowly - if (this.com_in_jump && !this.viewloc) { + if (this.com_in_jump && !this.viewloc && !PHYS_FROZEN(this)) { // was: // lava: 50 // slime: 80 -- 2.39.2