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
17 InterpolateOrigin_Do();
22 trace_endpos = self.velocity,
23 trace_dphitq3surfaceflags = 0;
26 traceline(self.origin, self.velocity, 0, self);
32 makevectors(self.angles);
33 trace_endpos = self.origin + v_forward * 1048576;
34 trace_dphitq3surfaceflags = Q3SURFACEFLAG_SKY;
38 makevectors(self.angles);
39 traceline(self.origin, self.origin + v_forward * 32768, 0, self);
40 if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)
41 trace_endpos = self.origin + v_forward * 1048576;
48 Draw_CylindricLine(self.origin, trace_endpos, self.scale, "particles/laserbeam", 0, time * 3, self.colormod, self.alpha, DRAWFLAG_NORMAL, view_origin);
52 Draw_CylindricLine(self.origin, trace_endpos, self.scale, "particles/laserbeam", 0, time * 3, self.colormod, 0.5, DRAWFLAG_ADDITIVE, view_origin);
55 if not(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT))
58 pointparticles(self.cnt, trace_endpos, trace_plane_normal, drawframetime * 1000);
59 if(self.colormod != '0 0 0' && self.modelscale != 0)
60 adddynamiclight(trace_endpos + trace_plane_normal * 1, self.modelscale, self.colormod * 5);
67 InterpolateOrigin_Undo();
69 // 30 bytes, or 13 bytes for just moving
71 self.count = (f & 0xF0);
74 self.iflags = IFLAG_VELOCITY | IFLAG_ORIGIN;
76 self.iflags = IFLAG_ANGLES | IFLAG_ORIGIN;
80 self.origin_x = ReadCoord();
81 self.origin_y = ReadCoord();
82 self.origin_z = ReadCoord();
83 setorigin(self, self.origin);
87 self.colormod_x = ReadByte() / 255.0;
88 self.colormod_y = ReadByte() / 255.0;
89 self.colormod_z = ReadByte() / 255.0;
91 self.alpha = ReadByte() / 255.0;
98 self.scale *= ReadByte() / 16.0; // beam radius
99 self.modelscale *= ReadByte() / 16.0; // dlight radius
101 if((f & 0x80) || !(f & 0x10))
102 self.cnt = ReadShort() - 1; // effect number
110 self.velocity_x = ReadCoord();
111 self.velocity_y = ReadCoord();
112 self.velocity_z = ReadCoord();
116 self.angles_x = ReadAngle();
117 self.angles_y = ReadAngle();
121 self.state = ReadByte();
122 InterpolateOrigin_Note();
123 self.draw = Draw_Laser;