]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/client/laser.qc
make the lasers less thick
[divverent/nexuiz.git] / data / qcsrc / client / laser.qc
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
5 .vector colormod;
6 .float state; // on-off
7
8 void Draw_Laser()
9 {
10         if(!self.state)
11                 return;
12         makevectors(self.angles);
13         traceline(self.origin, self.origin + v_forward * 32768, 0, self);
14         Draw_CylindricLine(self.origin, trace_endpos, 2, "particles/laserbeam", 1, self.colormod, DRAWFLAG_ADDITIVE); // TODO make a texture to make the laser look smoother
15         pointparticles(self.cnt, trace_endpos, trace_plane_normal, 256 * drawframetime);
16 }
17
18 void Ent_Laser()
19 {
20         float f;
21         // 30 bytes, or 13 bytes for just moving
22         f = ReadByte();
23         if(f & 1)
24         {
25                 self.origin_x = ReadCoord();
26                 self.origin_y = ReadCoord();
27                 self.origin_z = ReadCoord();
28                 self.colormod_x = ReadByte() / 255.0;
29                 self.colormod_y = ReadByte() / 255.0;
30                 self.colormod_z = ReadByte() / 255.0;
31                 self.cnt = ReadShort(); // effect number
32         }
33         if(f & 2)
34         {
35                 self.angles_x = ReadCoord();
36                 self.angles_y = ReadCoord();
37         }
38         if(f & 4)
39                 self.state = ReadByte();
40         self.draw = Draw_Laser;
41 }