X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fcl_physics.qc;h=95dba951df6efb1109ab3c1f29d810c8b348a099;hb=5cfaa1de9500e179e6b7fb5b9e48f9410d16aee4;hp=b675c56e962ed9d94a5f8fddbdd01c3d619ff073;hpb=3a264e945a45a04f4566feb9e9a91e0d5266361e;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/cl_physics.qc b/qcsrc/server/cl_physics.qc index b675c56e9..95dba951d 100644 --- a/qcsrc/server/cl_physics.qc +++ b/qcsrc/server/cl_physics.qc @@ -169,10 +169,7 @@ void PlayerJump (void) self.flags &~= FL_ONGROUND; self.flags &~= FL_JUMPRELEASED; - if (self.crouch) - setanim(self, self.anim_duckjump, FALSE, TRUE, TRUE); - else if (self.animstate_startframe != self.anim_melee_x || (self.animstate_startframe == self.anim_melee_x && time - self.animstate_starttime >= 21/20)) // jump animation shouldn't override melee until we have animation blending (or until the anim finished, 21/20 = numframes/fps) - setanim(self, self.anim_jump, FALSE, TRUE, TRUE); + animdecide_setaction(self, ANIMACTION_JUMP, TRUE); if(g_jump_grunt) PlayerSound(playersound_jump, CH_PLAYER, VOICETYPE_PLAYERSOUND); @@ -875,6 +872,12 @@ void SV_PlayerPhysics() MUTATOR_CALLHOOK(PlayerPhysics); + if(self.player_blocked) + { + self.movement = '0 0 0'; + self.disableclientprediction = 1; + } + maxspd_mod = 1; swampspd_mod = 1; @@ -882,6 +885,10 @@ void SV_PlayerPhysics() swampspd_mod = self.swamp_slowdown; //cvar("g_balance_swamp_moverate"); } + // conveyors: first fix velocity + if(self.conveyor.state) + self.velocity -= self.conveyor.movedir; + if(self.classname != "player") { maxspd_mod = autocvar_sv_spectator_speed_multiplier; @@ -1064,7 +1071,7 @@ void SV_PlayerPhysics() PM_Accelerate(wishdir, wishspeed, wishspeed, autocvar_sv_accelerate*maxspd_mod, 1, 0, 0, 0); } } - else if ((self.items & IT_JETPACK) && self.BUTTON_HOOK && (!autocvar_g_jetpack_fuel || self.ammo_fuel >= 0.01 || self.items & IT_UNLIMITED_WEAPON_AMMO)) + else if ((self.items & IT_JETPACK) && self.BUTTON_HOOK && (!autocvar_g_jetpack_fuel || self.ammo_fuel >= 0.01 || self.items & IT_UNLIMITED_WEAPON_AMMO) && !self.freezetag_frozen) { //makevectors(self.v_angle_y * '0 1 0'); makevectors(self.v_angle); @@ -1166,7 +1173,7 @@ void SV_PlayerPhysics() else if (self.flags & FL_ONGROUND) { // we get here if we ran out of ammo - if((self.items & IT_JETPACK) && self.BUTTON_HOOK && !(buttons_prev & 32)) + if((self.items & IT_JETPACK) && self.BUTTON_HOOK && !(buttons_prev & 32) && self.ammo_fuel < 0.01) sprint(self, "You don't have any fuel for the ^2Jetpack\n"); // walking @@ -1211,6 +1218,28 @@ void SV_PlayerPhysics() self.velocity = self.velocity * f; else self.velocity = '0 0 0'; + /* + Mathematical analysis time! + + Our goal is to invert this mess. + + For the two cases we get: + v = v0 * (1 - frametime * (autocvar_sv_stopspeed / v0) * autocvar_sv_friction) + = v0 - frametime * autocvar_sv_stopspeed * autocvar_sv_friction + v0 = v + frametime * autocvar_sv_stopspeed * autocvar_sv_friction + and + v = v0 * (1 - frametime * autocvar_sv_friction) + v0 = v / (1 - frametime * autocvar_sv_friction) + + These cases would be chosen ONLY if: + v0 < autocvar_sv_stopspeed + v + frametime * autocvar_sv_stopspeed * autocvar_sv_friction < autocvar_sv_stopspeed + v < autocvar_sv_stopspeed * (1 - frametime * autocvar_sv_friction) + and, respectively: + v0 >= autocvar_sv_stopspeed + v / (1 - frametime * autocvar_sv_friction) >= autocvar_sv_stopspeed + v >= autocvar_sv_stopspeed * (1 - frametime * autocvar_sv_friction) + */ } // acceleration @@ -1227,7 +1256,7 @@ void SV_PlayerPhysics() { float wishspeed0; // we get here if we ran out of ammo - if((self.items & IT_JETPACK) && self.BUTTON_HOOK && !(buttons_prev & 32)) + if((self.items & IT_JETPACK) && self.BUTTON_HOOK && !(buttons_prev & 32) && self.ammo_fuel < 0.01) sprint(self, "You don't have any fuel for the ^2Jetpack\n"); if(maxspd_mod < 1) @@ -1339,6 +1368,10 @@ void SV_PlayerPhysics() if(self.flags & FL_ONGROUND) self.lastground = time; + // conveyors: then break velocity again + if(self.conveyor.state) + self.velocity += self.conveyor.movedir; + self.lastflags = self.flags; self.lastclassname = self.classname; }