X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fmutators%2Fgamemode_ctf.qc;h=d40263fb72f41bd7b754d42a849aa288dc55f2ca;hb=6f37a8f8076a572097afb13de2c367a72717c927;hp=2e6eb4ff732533e927fc4359459ea5fec9f940f6;hpb=77f03e6ce033bef39ac19e0e7cb6e606ffcb26db;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/mutators/gamemode_ctf.qc b/qcsrc/server/mutators/gamemode_ctf.qc index 2e6eb4ff7..d40263fb7 100644 --- a/qcsrc/server/mutators/gamemode_ctf.qc +++ b/qcsrc/server/mutators/gamemode_ctf.qc @@ -1,3 +1,13 @@ +#include "gamemode_ctf.qh" +#include "../_.qh" + +#include "gamemode.qh" + +#include "../vehicles/vehicles_def.qh" + +#include "../../warpzonelib/common.qh" +#include "../../warpzonelib/mathlib.qh" + // ================================================================ // Official capture the flag game mode coding, reworked by Samual // Last updated: September, 2012 @@ -89,13 +99,11 @@ float ctf_CheckPassDirection(vector head_center, vector passer_center, vector pa makevectors(passer_angle); // find the closest point on the enemy to the center of the attack - float ang; // angle between shotdir and h float h; // hypotenuse, which is the distance between attacker to head float a; // adjacent side, which is the distance between attacker and the point on w_shotdir that is closest to head.origin h = vlen(head_center - passer_center); - ang = acos(dotproduct(normalize(head_center - passer_center), v_forward)); - a = h * cos(ang); + a = h * (normalize(head_center - passer_center) * v_forward); vector nearest_on_line = (passer_center + a * v_forward); float distance_from_line = vlen(nearest_to_passer - nearest_on_line); @@ -645,7 +653,7 @@ void ctf_CheckStalemate(void) } } -void ctf_FlagDamage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) +void ctf_FlagDamage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) { if(ITEM_DAMAGE_NEEDKILL(deathtype)) {