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();
27 trace_endpos = self.velocity,
28 trace_dphitq3surfaceflags = 0;
31 traceline(self.origin, self.velocity, 0, self);
37 makevectors(self.angles);
38 trace_endpos = self.origin + v_forward * 1048576;
39 trace_dphitq3surfaceflags = Q3SURFACEFLAG_SKY;
43 makevectors(self.angles);
44 traceline(self.origin, self.origin + v_forward * 32768, 0, self);
45 if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)
46 trace_endpos = self.origin + v_forward * 1048576;
53 Draw_CylindricLine(self.origin, trace_endpos, self.scale, "particles/laserbeam", 0, time * 3, self.colormod, self.alpha, DRAWFLAG_NORMAL, view_origin);
57 Draw_CylindricLine(self.origin, trace_endpos, self.scale, "particles/laserbeam", 0, time * 3, self.colormod, 0.5, DRAWFLAG_ADDITIVE, view_origin);
60 if not(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT))
63 pointparticles(self.cnt, trace_endpos, trace_plane_normal, drawframetime * 1000);
64 if(self.colormod != '0 0 0' && self.modelscale != 0)
65 R_AddDynamicLight(trace_endpos + trace_plane_normal * 1, self.modelscale, self.colormod * 5);
72 InterpolateOrigin_Undo();
74 // 30 bytes, or 13 bytes for just moving
76 self.count = (f & 0xF0);
79 self.iflags = IFLAG_VELOCITY;
81 self.iflags = IFLAG_ANGLES;
85 self.origin_x = ReadCoord();
86 self.origin_y = ReadCoord();
87 self.origin_z = ReadCoord();
91 self.colormod_x = ReadByte() / 255.0;
92 self.colormod_y = ReadByte() / 255.0;
93 self.colormod_z = ReadByte() / 255.0;
95 self.alpha = ReadByte() / 255.0;
102 self.scale *= ReadByte() / 16.0; // beam radius
103 self.modelscale *= ReadByte() / 16.0; // dlight radius
105 if((f & 0x80) || !(f & 0x10))
106 self.cnt = ReadShort() - 1; // effect number
114 self.velocity_x = ReadCoord();
115 self.velocity_y = ReadCoord();
116 self.velocity_z = ReadCoord();
120 self.angles_x = ReadAngle();
121 self.angles_y = ReadAngle();
125 self.state = ReadByte();
126 InterpolateOrigin_Note();
127 self.draw = Draw_Laser;