r4351 - trunk/data/qcsrc/client
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Fri Sep 5 05:03:46 EDT 2008
Author: div0
Date: 2008-09-05 05:03:44 -0400 (Fri, 05 Sep 2008)
New Revision: 4351
Modified:
trunk/data/qcsrc/client/View.qc
Log:
better csqc portal display
Modified: trunk/data/qcsrc/client/View.qc
===================================================================
--- trunk/data/qcsrc/client/View.qc 2008-09-05 08:25:50 UTC (rev 4350)
+++ trunk/data/qcsrc/client/View.qc 2008-09-05 09:03:44 UTC (rev 4351)
@@ -17,9 +17,12 @@
}
entity porto;
+vector polyline[16];
+float Q3SURFACEFLAG_SLICK = 2; // low friction surface
void Porto_Draw()
{
- vector v0, v1, v2, dir, ang;
+ vector p, dir, ang, q, nextdir;
+ float idx, portal_number, portal1_idx;
if(activeweapon != WEP_PORTO)
return;
@@ -32,33 +35,57 @@
dir = v_forward;
}
- v0 = view_origin;
- traceline(v0, v0 + 65536 * dir, TRUE, world);
- if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
- return;
- v1 = trace_endpos;
+ p = view_origin;
- dir = dir - 2 * (dir * trace_plane_normal) * trace_plane_normal; // mirror dir at trace_plane_normal
+ polyline[0] = p;
+ idx = 1;
+ portal_number = 0;
+ nextdir = dir;
- ang = vectoangles(trace_plane_normal, dir);
- ang_x = -ang_x;
- makevectors(ang);
- if(!CheckWireframeBox(porto, v1 - 48 * v_right - 48 * v_up + 16 * v_forward, 96 * v_right, 96 * v_up, 96 * v_forward))
- return;
+ for(;;)
+ {
+ dir = nextdir;
+ traceline(p, p + 65536 * dir, TRUE, world);
+ if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
+ return;
+ nextdir = dir - 2 * (dir * trace_plane_normal) * trace_plane_normal; // mirror dir at trace_plane_normal
+ p = trace_endpos;
+ polyline[idx] = p;
+ ++idx;
+ if(idx >= 16)
+ return;
+ if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK)
+ continue;
+ ++portal_number;
+ ang = vectoangles(trace_plane_normal, dir);
+ ang_x = -ang_x;
+ makevectors(ang);
+ if(!CheckWireframeBox(porto, p - 48 * v_right - 48 * v_up + 16 * v_forward, 96 * v_right, 96 * v_up, 96 * v_forward))
+ return;
+ if(portal_number == 1)
+ portal1_idx = idx;
+ if(portal_number >= 2)
+ break;
+ }
- traceline(v1, v1 + 65536 * dir, TRUE, world);
- if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
- return;
- v2 = trace_endpos;
+ while(idx >= 2)
+ {
+ p = polyline[idx-2];
+ q = polyline[idx-1];
+ if(idx == 2)
+ p = p - '0 0 16';
+ if(idx-1 >= portal1_idx)
+ {
+ Draw_CylindricLine(p, q, 4, "", 1, 0, '0 0 1', 0.5, DRAWFLAG_NORMAL);
+ }
+ else
+ {
+ Draw_CylindricLine(p, q, 4, "", 1, 0, '1 0 0', 0.5, DRAWFLAG_NORMAL);
+ }
+ --idx;
+ }
+}
- ang = vectoangles(trace_plane_normal, -1 * dir);
- ang_x = -ang_x;
- makevectors(ang);
- if(!CheckWireframeBox(porto, v2 - 48 * v_right - 48 * v_up + 16 * v_forward, 96 * v_right, 96 * v_up, 96 * v_forward))
- return;
-
- Draw_CylindricLine(v1, v2, 4, "", 1, 0, '1 0 0', 0.5, DRAWFLAG_NORMAL);
-}
float DPCONTENTS_SOLID = 1; // hit a bmodel, not a bounding box
float DPCONTENTS_BODY = 32; // hit a bounding box, not a bmodel
float DPCONTENTS_PLAYERCLIP = 256; // blocks player movement
More information about the nexuiz-commits
mailing list