]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/client/laser.qc
laser beam texture
[divverent/nexuiz.git] / data / qcsrc / client / laser.qc
1 // a laser goes from origin in direction velocity
2 // it has color 'colormod'
3 // and stops when something is in the way
4 .float cnt; // end effect
5 .vector colormod;
6
7 void Draw_Laser()
8 {
9         traceline(self.origin, self.origin + self.velocity, 0, self);
10         Draw_CylindricLine(self.origin, trace_endpos, 4, "particles/laserbeam", 1, self.colormod, DRAWFLAG_ADDITIVE); // TODO make a texture to make the laser look smoother
11         pointparticles(self.cnt, trace_endpos, trace_plane_normal, 256 * drawframetime);
12 }
13
14 void Ent_Laser()
15 {
16         float f;
17         // 30 bytes, or 13 bytes for just moving
18         f = ReadByte();
19         if(f & 1)
20         {
21                 self.origin_x = ReadCoord();
22                 self.origin_y = ReadCoord();
23                 self.origin_z = ReadCoord();
24                 self.colormod_x = ReadByte() / 255.0;
25                 self.colormod_y = ReadByte() / 255.0;
26                 self.colormod_z = ReadByte() / 255.0;
27                 self.cnt = ReadShort(); // effect number
28         }
29         if(f & 2)
30         {
31                 self.velocity_x = ReadCoord();
32                 self.velocity_y = ReadCoord();
33                 self.velocity_z = ReadCoord();
34         }
35         self.draw = Draw_Laser;
36 }