1 // a laser goes from origin in direction angles
\r
2 // it has color 'colormod'
\r
3 // and stops when something is in the way
\r
4 .float cnt; // end effect
\r
6 .float state; // on-off
\r
7 .float count; // flags for the laser
\r
10 .float scale; // scaling factor of the thickness
\r
11 .float modelscale; // scaling factor of the dlight
\r
13 // TODO move these into a heade file
\r
14 float trace_dphitq3surfaceflags;
\r
15 float Q3SURFACEFLAG_SKY = 4; // sky surface (also has NOIMPACT and NOMARKS set)
\r
16 float Q3SURFACEFLAG_NOIMPACT = 16; // projectiles should remove themselves on impact (this is set on sky)
\r
22 InterpolateOrigin_Do();
\r
23 if(self.count & 0x80)
\r
25 traceline(self.origin, self.velocity, 0, self);
\r
29 makevectors(self.angles);
\r
30 traceline(self.origin, self.origin + v_forward * 32768, 0, self);
\r
31 if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)
\r
32 trace_endpos = self.origin + v_forward * 1048576;
\r
38 Draw_CylindricLine(self.origin, trace_endpos, self.scale, "particles/laserbeam", 0, time * 3, self.colormod, self.alpha, DRAWFLAG_NORMAL); // TODO make a texture to make the laser look smoother
\r
42 Draw_CylindricLine(self.origin, trace_endpos, self.scale, "particles/laserbeam", 0, time * 3, self.colormod, 0.5, DRAWFLAG_ADDITIVE); // TODO make a texture to make the laser look smoother
\r
45 if not(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT))
\r
48 pointparticles(self.cnt, trace_endpos, trace_plane_normal, drawframetime * 1000);
\r
49 if(self.colormod != '0 0 0' && self.modelscale != 0)
\r
50 R_AddDynamicLight(trace_endpos + trace_plane_normal * 1, self.modelscale, self.colormod * 5);
\r
57 InterpolateOrigin_Undo();
\r
59 // 30 bytes, or 13 bytes for just moving
\r
61 self.count = (f & 0xE0);
\r
63 if(self.count & 0x80)
\r
64 self.iflags = IFLAG_VELOCITY;
\r
66 self.iflags = IFLAG_ANGLES;
\r
70 self.origin_x = ReadCoord();
\r
71 self.origin_y = ReadCoord();
\r
72 self.origin_z = ReadCoord();
\r
76 self.colormod_x = ReadByte() / 255.0;
\r
77 self.colormod_y = ReadByte() / 255.0;
\r
78 self.colormod_z = ReadByte() / 255.0;
\r
80 self.alpha = ReadByte() / 255.0;
\r
84 self.modelscale = 50;
\r
87 self.scale *= ReadByte() / 16.0; // beam radius
\r
88 self.modelscale *= ReadByte() / 16.0; // dlight radius
\r
90 self.cnt = ReadShort() - 1; // effect number
\r
96 self.velocity_x = ReadCoord();
\r
97 self.velocity_y = ReadCoord();
\r
98 self.velocity_z = ReadCoord();
\r
102 self.angles_x = ReadAngle();
\r
103 self.angles_y = ReadAngle();
\r
107 self.state = ReadByte();
\r
108 InterpolateOrigin_Note();
\r
109 self.draw = Draw_Laser;
\r