don't send the effect number for infinite non-collisiontesting lasers
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / laser.qc
index 6703b1b11f82ad1b96d7e387d33b36d2b44b7996..9bc5dce9d9f6c75a8b4929547eedef1a34ac8ef9 100644 (file)
@@ -22,14 +22,28 @@ void Draw_Laser()
        InterpolateOrigin_Do();
        if(self.count & 0x80)
        {
-               traceline(self.origin, self.velocity, 0, self);
+               if(self.count & 0x10)
+               {
+                       trace_endpos = self.velocity,
+                       trace_dphitq3surfaceflags = 0;
+               }
+               else
+                       traceline(self.origin, self.velocity, 0, self);
        }
        else
        {
-               makevectors(self.angles);
-               traceline(self.origin, self.origin + v_forward * 32768, 0, self);
-               if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)
+               if(self.count & 0x10)
+               {
                        trace_endpos = self.origin + v_forward * 1048576;
+                       trace_dphitq3surfaceflags = Q3SURFACEFLAG_SKY;
+               }
+               else
+               {
+                       makevectors(self.angles);
+                       traceline(self.origin, self.origin + v_forward * 32768, 0, self);
+                       if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)
+                               trace_endpos = self.origin + v_forward * 1048576;
+               }
        }
        if(self.scale != 0)
        {
@@ -58,7 +72,7 @@ void Ent_Laser()
 
        // 30 bytes, or 13 bytes for just moving
        f = ReadByte();
-       self.count = (f & 0xE0);
+       self.count = (f & 0xF0);
 
        if(self.count & 0x80)
                self.iflags = IFLAG_VELOCITY;
@@ -87,7 +101,10 @@ void Ent_Laser()
                        self.scale *= ReadByte() / 16.0; // beam radius
                        self.modelscale *= ReadByte() / 16.0; // dlight radius
                }
-               self.cnt = ReadShort() - 1; // effect number
+               if((f & 0x80) || !(f & 0x10))
+                       self.cnt = ReadShort() - 1; // effect number
+               else
+                       self.cnt = 0;
        }
        if(f & 2)
        {