From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Sat, 27 May 2023 18:45:31 +0000 (+0200) Subject: while dropping in battle royale limit the horizontal wishdir to 90 degrees to make... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=278101abffba44578a92ce1eb29f00c267c9f2b7;p=xonotic%2Fxonotic-data.pk3dir.git while dropping in battle royale limit the horizontal wishdir to 90 degrees to make turning backwards easier --- diff --git a/qcsrc/common/gamemodes/gamemode/br/sv_br.qc b/qcsrc/common/gamemodes/gamemode/br/sv_br.qc index 41bbcbe08..e166f3aca 100644 --- a/qcsrc/common/gamemodes/gamemode/br/sv_br.qc +++ b/qcsrc/common/gamemodes/gamemode/br/sv_br.qc @@ -589,7 +589,21 @@ MUTATOR_HOOKFUNCTION(br, PM_Physics) makevectors(player.v_angle); // horizontal wishvel as usual vector wishvel = v_forward * CS(player).movement.x + v_right * CS(player).movement.y; - wishvel = normalize(wishvel) * min(1, vlen(wishvel) / maxairspeed); + + // except make turning backwards easier by limiting the maximum turning angle to 90 degrees + vector wish_angles = vectoangles(vec2(wishvel)); + vector vel_angles = vectoangles(vec2(player.velocity)); + + float diff_angle = wish_angles.y - vel_angles.y; + if(diff_angle > 180) + diff_angle -= 360; + if(diff_angle < -180) + diff_angle += 360; + + wish_angles.y = (vel_angles.y + bound(-90, diff_angle, 90) + 360) % 360; + makevectors(wish_angles); + + wishvel = normalize(v_forward) * min(1, vlen(wishvel) / maxairspeed); // vertical wishvel using forward movement and the previously calculated ratio wishvel.z = pitch_ratio_wish * bound(0, CS(player).movement.x / maxairspeed, 1); // apply turn acceleration to wishvel