]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/warpzonelib/common.qc
make warpzonelib depend less on Nexuiz
[divverent/nexuiz.git] / data / qcsrc / warpzonelib / common.qc
1 vector WarpZone_TransformVAngles(vector t, vector ang)
2 {
3         float roll;
4         roll = ang_z;
5         ang_z = 0;
6         ang = AnglesTransform_Normalize(AnglesTransform_ApplyToVAngles(t, ang), TRUE);
7         ang_z = roll;
8         return ang;
9 }
10
11 vector WarpZoneLib_BoxTouchesBrush_mins;
12 vector WarpZoneLib_BoxTouchesBrush_maxs;
13 entity WarpZoneLib_BoxTouchesBrush_ent;
14 entity WarpZoneLib_BoxTouchesBrush_ignore;
15 float WarpZoneLib_BoxTouchesBrush_Recurse()
16 {
17         float s;
18         entity se;
19         float f;
20
21         tracebox('0 0 0', WarpZoneLib_BoxTouchesBrush_mins, WarpZoneLib_BoxTouchesBrush_maxs, '0 0 0', MOVE_NOMONSTERS, WarpZoneLib_BoxTouchesBrush_ignore);
22 #ifdef CSQC
23         if (trace_networkentity)
24         {
25                 dprint("hit a network ent, cannot continue WarpZoneLib_BoxTouchesBrush\n");
26                 // we cannot continue, as a player blocks us...
27                 // so, abort
28                 return 0;
29         }
30 #endif
31         if not(trace_ent)
32                 return 0;
33         if (trace_ent == WarpZoneLib_BoxTouchesBrush_ent)
34                 return 1;
35
36         
37
38         se = trace_ent;
39         s = se.solid;
40         se.solid = SOLID_NOT;
41         f = WarpZoneLib_BoxTouchesBrush_Recurse();
42         se.solid = s;
43
44         return f;
45 }
46
47 float WarpZoneLib_BoxTouchesBrush(vector mi, vector ma, entity e, entity ig)
48 {
49     float f, s;
50
51     if not(e.modelindex)
52         return 1;
53
54     s = e.solid;
55     e.solid = SOLID_BSP;
56     WarpZoneLib_BoxTouchesBrush_mins = mi;
57     WarpZoneLib_BoxTouchesBrush_maxs = ma;
58     WarpZoneLib_BoxTouchesBrush_ent = e;
59     WarpZoneLib_BoxTouchesBrush_ignore = ig;
60     f = WarpZoneLib_BoxTouchesBrush_Recurse();
61     e.solid = s;
62
63     return f;
64 }