From 8cafc5adad92ae3d4f6c75260a1a1d509942447a Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Sun, 3 Feb 2013 02:39:32 +0200 Subject: [PATCH] Remove player model leaning from the code. It's too buggy, problematic, and not done the right way either --- data/qcsrc/server/cl_client.qc | 52 ---------------------------------- data/qcsrc/server/defs.qh | 1 - data/qcsrc/server/g_damage.qc | 13 --------- 3 files changed, 66 deletions(-) diff --git a/data/qcsrc/server/cl_client.qc b/data/qcsrc/server/cl_client.qc index aedf04db..2f0b07d2 100644 --- a/data/qcsrc/server/cl_client.qc +++ b/data/qcsrc/server/cl_client.qc @@ -942,7 +942,6 @@ void PutClientInServer (void) self.angles_z = 0; // never spawn tilted even if the spot says to self.fixangle = TRUE; // turn this way immediately - self.leanangle_damage_force = '0 0 0'; self.velocity = '0 0 0'; self.avelocity = '0 0 0'; self.punchangle = '0 0 0'; @@ -2672,57 +2671,6 @@ void PlayerPreThink (void) self.fixangle = TRUE; } - if(self.deadflag == DEAD_NO && !self.stat_eaten) // prevents bugs - { - // lean the player with damage and acceleration - // credits go to divVerent for these maths :) - vector L0, L1, LF, LA; - - LA = AnglesTransform_FromAngles(self.angles); - - // acceleration leaning - if(cvar("g_leanplayer_acceleration")) - { - // average velocity to obtain a smooth acceleration - float f; - f = frametime * cvar("g_leanplayer_acceleration_fade"); - self.avg_vel = self.avg_vel * (1 - f) + self.velocity * f; - } - - vector accel; - accel = self.velocity - self.avg_vel * cvar("g_leanplayer_acceleration"); // acceleration - - // bound angles to the specified limit - accel_x = bound(-cvar("g_leanplayer_acceleration_max"), accel_x, cvar("g_leanplayer_acceleration_max")); - accel_y = bound(-cvar("g_leanplayer_acceleration_max"), accel_y, cvar("g_leanplayer_acceleration_max")); - accel_z = bound(-cvar("g_leanplayer_acceleration_max"), accel_z, cvar("g_leanplayer_acceleration_max")); - - L0_x = vlen(accel) * -1; - L0_y = L1_y = vectoyaw(accel); - - L0 = AnglesTransform_FromAngles(L0); - L1 = AnglesTransform_FromAngles(L1); - LF = AnglesTransform_Multiply(AnglesTransform_Invert(L1), L0); - LA = AnglesTransform_Multiply(LA, LF); - // end of acceleration leaning - - // damage leaning - L0 = vectoangles(self.leanangle_damage_loc); - L1 = vectoangles(self.leanangle_damage_loc + self.leanangle_damage_force); - - L0 = AnglesTransform_FromAngles(L0); - L1 = AnglesTransform_FromAngles(L1); - LF = AnglesTransform_Multiply(AnglesTransform_Invert(L1), L0); - - LA = AnglesTransform_Multiply(LA, LF); - - // fade the player back to normal rotation each frame - self.leanangle_damage_force = self.leanangle_damage_force * cvar("g_leanplayer_damage_fade"); - // end of damage leaning - - self.angles = AnglesTransform_Normalize(AnglesTransform_ToAngles(LA), TRUE); - } - SetPlayerSize(); if(frametime) diff --git a/data/qcsrc/server/defs.qh b/data/qcsrc/server/defs.qh index 0109de5e..9bd4ed85 100644 --- a/data/qcsrc/server/defs.qh +++ b/data/qcsrc/server/defs.qh @@ -297,7 +297,6 @@ float timeoutStatus; // (values: 0, 1, 2) contains whether a timeout is not acti entity timeoutInitiator; // contains the entity of the player who started the last timeout float orig_slowmo; // contains the value of cvar("slowmo") so that, after timeout finished, it isn't set to slowmo 1 necessarily .vector lastV_angle; //used when pausing the game in order to force the player to keep his old view angle fixed -.vector leanangle_damage_loc, leanangle_damage_force; // used for leaning the player model entity timeoutHandler; //responsible for centerprinting the timeout countdowns and playing sounds void timeoutHandler_Think(); void evaluateTimeout(); diff --git a/data/qcsrc/server/g_damage.qc b/data/qcsrc/server/g_damage.qc index b0270d8c..1c7a4b2e 100644 --- a/data/qcsrc/server/g_damage.qc +++ b/data/qcsrc/server/g_damage.qc @@ -874,19 +874,6 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float } } } - - // lean the player based on the amount of damage taken - if(cvar("g_leanplayer_damage")) - if(targ.classname == "player" && WEP_VALID(DEATH_WEAPONOF(deathtype))) // only for damage caused by weapons - { - targ.leanangle_damage_loc = hitloc - targ.origin; - targ.leanangle_damage_force += force * cvar("g_leanplayer_damage"); // keep existing force if any - - // bound angles to the specified limit - targ.leanangle_damage_force_x = bound(-cvar("g_leanplayer_damage_max"), targ.leanangle_damage_force_x, cvar("g_leanplayer_damage_max")); - targ.leanangle_damage_force_y = bound(-cvar("g_leanplayer_damage_max"), targ.leanangle_damage_force_y, cvar("g_leanplayer_damage_max")); - targ.leanangle_damage_force_z = bound(-cvar("g_leanplayer_damage_max"), targ.leanangle_damage_force_z, cvar("g_leanplayer_damage_max")); - } } // apply push -- 2.39.2