2 #include "../dpdefs/csprogsdefs.qh"
3 #include "../common/buffs.qh"
4 #include "../csqcmodellib/interpolate.qh"
6 #include "../csqcmodellib/cl_model.qh"
12 // a laser goes from origin in direction angles
13 // it has color 'colormod'
14 // and stops when something is in the way
15 .int cnt; // end effect
18 .int count; // flags for the laser
21 .float scale; // scaling factor of the thickness
22 .float modelscale; // scaling factor of the dlight
28 InterpolateOrigin_Do();
33 trace_endpos = self.velocity;
34 trace_dphitq3surfaceflags = 0;
37 traceline(self.origin, self.velocity, 0, self);
43 makevectors(self.angles);
44 trace_endpos = self.origin + v_forward * 1048576;
45 trace_dphitq3surfaceflags = Q3SURFACEFLAG_SKY;
49 makevectors(self.angles);
50 traceline(self.origin, self.origin + v_forward * 32768, 0, self);
51 if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)
52 trace_endpos = self.origin + v_forward * 1048576;
59 Draw_CylindricLine(self.origin, trace_endpos, self.scale, "particles/laserbeam", 0, time * 3, self.colormod, self.alpha, DRAWFLAG_NORMAL, view_origin);
63 Draw_CylindricLine(self.origin, trace_endpos, self.scale, "particles/laserbeam", 0, time * 3, self.colormod, 0.5, DRAWFLAG_ADDITIVE, view_origin);
66 if (!(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT)))
69 pointparticles(self.cnt, trace_endpos, trace_plane_normal, drawframetime * 1000);
70 if(self.colormod != '0 0 0' && self.modelscale != 0)
71 adddynamiclight(trace_endpos + trace_plane_normal * 1, self.modelscale, self.colormod * 5);
77 InterpolateOrigin_Undo();
79 // 30 bytes, or 13 bytes for just moving
81 self.count = (f & 0xF0);
84 self.iflags = IFLAG_VELOCITY | IFLAG_ORIGIN;
86 self.iflags = IFLAG_ANGLES | IFLAG_ORIGIN;
90 self.origin_x = ReadCoord();
91 self.origin_y = ReadCoord();
92 self.origin_z = ReadCoord();
93 setorigin(self, self.origin);
97 self.colormod_x = ReadByte() / 255.0;
98 self.colormod_y = ReadByte() / 255.0;
99 self.colormod_z = ReadByte() / 255.0;
101 self.alpha = ReadByte() / 255.0;
105 self.modelscale = 50;
108 self.scale *= ReadByte() / 16.0; // beam radius
109 self.modelscale *= ReadByte() / 16.0; // dlight radius
111 if((f & 0x80) || !(f & 0x10))
112 self.cnt = ReadShort() - 1; // effect number
120 self.velocity_x = ReadCoord();
121 self.velocity_y = ReadCoord();
122 self.velocity_z = ReadCoord();
126 self.angles_x = ReadAngle();
127 self.angles_y = ReadAngle();
131 self.state = ReadByte();
132 InterpolateOrigin_Note();
133 self.draw = Draw_Laser;