1 // a laser goes from origin in direction angles
2 // it has color 'colormod'
3 // and stops when something is in the way
4 .float cnt; // end effect
6 .float state; // on-off
7 .float count; // flags for the laser
11 // TODO move these into a heade file
12 float trace_dphitq3surfaceflags;
13 float Q3SURFACEFLAG_SKY = 4; // sky surface (also has NOIMPACT and NOMARKS set)
14 float Q3SURFACEFLAG_NOIMPACT = 16; // projectiles should remove themselves on impact (this is set on sky)
20 InterpolateOrigin_Do();
23 traceline(self.origin, self.velocity, 0, self);
27 makevectors(self.angles);
28 traceline(self.origin, self.origin + v_forward * 32768, 0, self);
29 if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)
30 trace_endpos = self.origin + v_forward * 1048576;
34 Draw_CylindricLine(self.origin, trace_endpos, 2, "particles/laserbeam", 0, time * 3, self.colormod, self.alpha, DRAWFLAG_NORMAL); // TODO make a texture to make the laser look smoother
38 Draw_CylindricLine(self.origin, trace_endpos, 2, "particles/laserbeam", 0, time * 3, self.colormod, 0.5, DRAWFLAG_ADDITIVE); // TODO make a texture to make the laser look smoother
40 if not(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT))
43 pointparticles(self.cnt, trace_endpos, trace_plane_normal, drawframetime * 1000);
44 if(self.colormod != '0 0 0')
45 R_AddDynamicLight(trace_endpos + trace_plane_normal * 1, 50, self.colormod * 5);
52 InterpolateOrigin_Undo();
54 // 30 bytes, or 13 bytes for just moving
56 self.count = (f & 0xC0);
59 self.iflags = IFLAG_VELOCITY;
61 self.iflags = IFLAG_ANGLES;
65 self.origin_x = ReadCoord();
66 self.origin_y = ReadCoord();
67 self.origin_z = ReadCoord();
71 self.colormod_x = ReadByte() / 255.0;
72 self.colormod_y = ReadByte() / 255.0;
73 self.colormod_z = ReadByte() / 255.0;
75 self.alpha = ReadByte() / 255.0;
78 self.cnt = ReadShort() - 1; // effect number
84 self.velocity_x = ReadCoord();
85 self.velocity_y = ReadCoord();
86 self.velocity_z = ReadCoord();
90 self.angles_x = ReadCoord();
91 self.angles_y = ReadCoord();
95 self.state = ReadByte();
96 InterpolateOrigin_Note();
97 self.draw = Draw_Laser;