r4375 - in trunk/data/qcsrc: common server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sat Sep 6 10:55:02 EDT 2008
Author: div0
Date: 2008-09-06 10:55:01 -0400 (Sat, 06 Sep 2008)
New Revision: 4375
Modified:
trunk/data/qcsrc/common/util.qc
trunk/data/qcsrc/common/util.qh
trunk/data/qcsrc/server/portals.qc
Log:
work around vectoangles weirdness by only portaling angles from -89 to +89
problem is that straight-up and straight-down angles cannot be uniquely specified, and portals sometimes WANT to make the player come out upside down. This avoids the problem of interpreting the non-unique angles right ALMOST... maybe I find a better idea later
Modified: trunk/data/qcsrc/common/util.qc
===================================================================
--- trunk/data/qcsrc/common/util.qc 2008-09-06 13:45:24 UTC (rev 4374)
+++ trunk/data/qcsrc/common/util.qc 2008-09-06 14:55:01 UTC (rev 4375)
@@ -633,9 +633,9 @@
return 1;
}
-// a makevectors that inverts vectoangles
void fixedmakevectors(vector a)
{
+ // a makevectors that actually inverts vectoangles
a_x = -a_x;
makevectors(a);
}
Modified: trunk/data/qcsrc/common/util.qh
===================================================================
--- trunk/data/qcsrc/common/util.qh 2008-09-06 13:45:24 UTC (rev 4374)
+++ trunk/data/qcsrc/common/util.qh 2008-09-06 14:55:01 UTC (rev 4375)
@@ -70,4 +70,6 @@
float CheckWireframeBox(entity forent, vector v0, vector dvx, vector dvy, vector dvz);
void fixedmakevectors(vector a);
+#define fixedvectoangles2 vectoangles2
+#define fixedvectoangles vectoangles
#endif
Modified: trunk/data/qcsrc/server/portals.qc
===================================================================
--- trunk/data/qcsrc/server/portals.qc 2008-09-06 13:45:24 UTC (rev 4374)
+++ trunk/data/qcsrc/server/portals.qc 2008-09-06 14:55:01 UTC (rev 4375)
@@ -18,9 +18,8 @@
{
vector m_forward, m_up;
fixedmakevectors(t2); m_forward = v_forward; m_up = v_up;
- m_forward = Portal_Transform_Apply(t1, m_forward);
- m_up = Portal_Transform_Apply(t1, m_up);
- return vectoangles2(m_forward, m_up);
+ m_forward = Portal_Transform_Apply(t1, m_forward); m_up = Portal_Transform_Apply(t1, m_up);
+ return fixedvectoangles2(m_forward, m_up);
}
vector Portal_Transform_Invert(vector transform)
@@ -29,7 +28,7 @@
fixedmakevectors(transform);
// we want angles that turn v_forward into '1 0 0', v_right into '0 1 0' and v_up into '0 0 1'
// but these are orthogonal unit vectors!
- // so to invert, we can simply vectoangles the TRANSPOSED matrix
+ // so to invert, we can simply fixedvectoangles the TRANSPOSED matrix
// TODO is this always -transform?
i_forward_x = v_forward_x;
i_forward_y = -v_right_x;
@@ -39,7 +38,7 @@
i_up_z = v_up_z;
#ifdef DEBUG
vector v;
- v = vectoangles2(i_forward, i_up);
+ v = fixedvectoangles2(i_forward, i_up);
print("Transform: ", vtos(transform), "\n");
print("Inverted: ", vtos(v), "\n");
print("Verify: ", vtos(Portal_Transform_Multiply(v, transform)), "\n");
@@ -48,7 +47,7 @@
print("Verify: ", vtos(v_right), "\n");
print("Verify: ", vtos(v_up), "\n");
#endif
- return vectoangles2(i_forward, i_up);
+ return fixedvectoangles2(i_forward, i_up);
}
vector Portal_Transform_TurnDirection(vector transform)
@@ -56,7 +55,7 @@
// turn 180 degrees around v_up
// changes in-direction to out-direction
fixedmakevectors(transform);
- return vectoangles2(-1 * v_forward, 1 * v_up);
+ return fixedvectoangles2(-1 * v_forward, 1 * v_up);
}
vector Portal_Transform_Divide(vector to_transform, vector from_transform)
@@ -127,7 +126,7 @@
if(player.classname == "player")
{
ang = player.v_angle;
- ang_x = -ang_x;
+ ang_x = bound(-89, mod(-ang_x + 180, 360) - 180, 89);
ang = Portal_Transform_Multiply(transform, ang);
ang_z = player.angles_z;
}
@@ -527,7 +526,7 @@
}
org = trace_endpos;
- ang = vectoangles2(trace_plane_normal, dir);
+ ang = fixedvectoangles2(trace_plane_normal, dir);
fixedmakevectors(ang);
portal = Portal_Spawn(own, org, ang);
@@ -559,7 +558,7 @@
}
org = trace_endpos;
- ang = vectoangles2(trace_plane_normal, dir);
+ ang = fixedvectoangles2(trace_plane_normal, dir);
fixedmakevectors(ang);
portal = Portal_Spawn(own, org, ang);
More information about the nexuiz-commits
mailing list