]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Vector: inline cross function
authorTimePath <andrew.hardaker1995@gmail.com>
Wed, 11 Nov 2015 11:22:22 +0000 (22:22 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Wed, 11 Nov 2015 11:22:22 +0000 (22:22 +1100)
qcsrc/lib/vector.qh
qcsrc/lib/warpzone/mathlib.qc
qcsrc/lib/warpzone/mathlib.qh
qcsrc/menu/xonotic/crosshairpicker.qc

index 6cbaebdcdb124aa7e18626b084902c8834394749..0cda013c0e8238ba26e259c0a232befd690ee9de 100644 (file)
@@ -1,6 +1,17 @@
 #ifndef VECTOR_H
 #define VECTOR_H
 
+#define cross(a, b) ((a) >< (b))
+/*
+vector cross(vector a, vector b)
+{
+       return
+               '1 0 0' * (a.y * b.z - a.z * b.y)
+       +       '0 1 0' * (a.z * b.x - a.x * b.z)
+       +       '0 0 1' * (a.x * b.y - a.y * b.x);
+}
+*/
+
 const vector eX = '1 0 0';
 const vector eY = '0 1 0';
 const vector eZ = '0 0 1';
index 92b7ee14dd9080d2fac9d17527042f929cbe3433..ac3b65ff1a276a3dd35c36f1c12d206055fd9fb0 100644 (file)
@@ -290,11 +290,3 @@ int isunordered(float x, float y)
 {
        return !(x < y || x == y || x > y);
 }
-
-vector cross(vector a, vector b)
-{
-       return
-               '1 0 0' * (a.y * b.z - a.z * b.y)
-       +       '0 1 0' * (a.z * b.x - a.x * b.z)
-       +       '0 0 1' * (a.x * b.y - a.y * b.x);
-}
index 9acece2ab2befeacad137ddc049ac01b1b41f407..c3de3838dde28cb70ed0d9e915751554436ccd49 100644 (file)
@@ -115,7 +115,4 @@ const float M_2_SQRTPI = 1.12837916709551257390;  /* 2/sqrt(pi) */
 const float M_SQRT2    = 1.41421356237309504880;  /* sqrt(2) */
 const float M_SQRT1_2  = 0.70710678118654752440;  /* 1/sqrt(2) */
 
-// Non-<math.h> stuff follows here.
-vector cross(vector a, vector b);
-
 #endif
index 0ac826a44064cc4752b4c828a2b9c6c119e7a6e0..63da9cd92ae56980bf6db6ba9c29925eb08ab54e 100644 (file)
@@ -60,18 +60,17 @@ bool XonoticCrosshairPicker_cellIsValid(entity me, vector cell)
 
 void XonoticCrosshairPicker_cellDraw(entity me, vector cell, vector cellPos)
 {
-       vector sz;
-       string cross = strcat("/gfx/crosshair", crosshairpicker_cellToCrosshair(me, cell));
-       sz = draw_PictureSize(cross);
+       string s = strcat("/gfx/crosshair", crosshairpicker_cellToCrosshair(me, cell));
+       vector sz = draw_PictureSize(s);
        sz = globalToBoxSize(sz, me.size);
 
        float ar = sz.x / sz.y;
        sz.x = me.realCellSize.x;
        sz.y = sz.x / ar;
-       sz = sz * 0.95;
+       sz *= 0.95;
 
        vector crosshairPos = cellPos + 0.5 * me.realCellSize;
-       draw_Picture(crosshairPos - 0.5 * sz, cross, sz, SKINCOLOR_CROSSHAIRPICKER_CROSSHAIR, SKINALPHA_CROSSHAIRPICKER_CROSSHAIR);
+       draw_Picture(crosshairPos - 0.5 * sz, s, sz, SKINCOLOR_CROSSHAIRPICKER_CROSSHAIR, SKINALPHA_CROSSHAIRPICKER_CROSSHAIR);
 
        if(cvar("crosshair_dot"))
                draw_Picture(crosshairPos - 0.5 * sz * cvar("crosshair_dot_size"), "/gfx/crosshairdot", sz * cvar("crosshair_dot_size"), SKINCOLOR_CROSSHAIRPICKER_CROSSHAIR, SKINALPHA_CROSSHAIRPICKER_CROSSHAIR);