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
10 .float scale; // scaling factor of the thickness
11 .float modelscale; // scaling factor of the dlight
13 // TODO move these into a heade file
14 float trace_dphitq3surfaceflags;
15 float Q3SURFACEFLAG_SKY = 4; // sky surface (also has NOIMPACT and NOMARKS set)
16 float Q3SURFACEFLAG_NOIMPACT = 16; // projectiles should remove themselves on impact (this is set on sky)
22 InterpolateOrigin_Do();
25 traceline(self.origin, self.velocity, 0, self);
29 makevectors(self.angles);
30 traceline(self.origin, self.origin + v_forward * 32768, 0, self);
31 if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)
32 trace_endpos = self.origin + v_forward * 1048576;
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
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
45 if not(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT))
48 pointparticles(self.cnt, trace_endpos, trace_plane_normal, drawframetime * 1000);
49 if(self.colormod != '0 0 0' && self.modelscale != 0)
50 R_AddDynamicLight(trace_endpos + trace_plane_normal * 1, self.modelscale, self.colormod * 5);
57 InterpolateOrigin_Undo();
59 // 30 bytes, or 13 bytes for just moving
61 self.count = (f & 0xE0);
64 self.iflags = IFLAG_VELOCITY;
66 self.iflags = IFLAG_ANGLES;
70 self.origin_x = ReadCoord();
71 self.origin_y = ReadCoord();
72 self.origin_z = ReadCoord();
76 self.colormod_x = ReadByte() / 255.0;
77 self.colormod_y = ReadByte() / 255.0;
78 self.colormod_z = ReadByte() / 255.0;
80 self.alpha = ReadByte() / 255.0;
87 self.scale *= ReadByte() / 16.0; // beam radius
88 self.modelscale *= ReadByte() / 16.0; // dlight radius
90 self.cnt = ReadShort() - 1; // effect number
96 self.velocity_x = ReadCoord();
97 self.velocity_y = ReadCoord();
98 self.velocity_z = ReadCoord();
102 self.angles_x = ReadAngle();
103 self.angles_y = ReadAngle();
107 self.state = ReadByte();
108 InterpolateOrigin_Note();
109 self.draw = Draw_Laser;