X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fclient%2Feffects.qc;h=c0c378fd1a42c4cb5fb697902e8bdca4c743539c;hp=c35a3a94a7577dc7724a3ebe0330e08cf6c19bf3;hb=99c1b6ca80a69e112d410ee493d62f757b2c6df8;hpb=0ee74987765518ffed584a790f90607c3f3f8e71 diff --git a/qcsrc/client/effects.qc b/qcsrc/client/effects.qc index c35a3a94a..c0c378fd1 100644 --- a/qcsrc/client/effects.qc +++ b/qcsrc/client/effects.qc @@ -1,3 +1,6 @@ +#include "effects.qh" +#include "_all.qh" + /* .vector fx_start; .vector fx_end; @@ -5,9 +8,6 @@ .string fx_texture; .float fx_lifetime; -void SUB_Remove() -{ remove(self); } - void b_draw() { //Draw_CylindricLine(self.fx_start, self.fx_end, self.fx_with, self.fx_texture, 0, time * 3, '1 1 1', 0.7, DRAWFLAG_ADDITIVE, view_origin); @@ -30,7 +30,7 @@ void b_make(vector s,vector e, string t,float l,float z) } */ -void cl_effetcs_lightningarc(vector from, vector to,float seglength,float drifts,float drifte,float branchfactor,float branchfactor_add) +void cl_effects_lightningarc(vector from, vector to,float seglength,float drifts,float drifte,float branchfactor,float branchfactor_add) { vector direction,dirnew, pos, pos_l; float length, steps, steplength, i,drift; @@ -39,7 +39,9 @@ void cl_effetcs_lightningarc(vector from, vector to,float seglength,float drifts if(length < 1) return; - steps = floor(length / seglength); + // Use at most 16 te_lightning1 segments, as these eat up beam list segments. + // TODO: Change this to R_BeginPolygon code, then we no longer have this limit. + steps = min(16, floor(length / seglength)); if(steps < 1) { te_lightning1(world,from,to); @@ -57,8 +59,9 @@ void cl_effetcs_lightningarc(vector from, vector to,float seglength,float drifts dirnew = normalize(direction * (1 - drift) + randomvec() * drift); pos = pos_l + dirnew * steplength; te_lightning1(world,pos_l,pos); - if(random() < branchfactor) - cl_effetcs_lightningarc(pos, pos + (dirnew * length * 0.25),seglength,drifts,drifte,min(branchfactor + branchfactor_add,1),branchfactor_add); + // WTF endless recursion if branchfactor is 1.0 (possibly due to adding branchfactor_add). FIXME + // if(random() < branchfactor) + // cl_effects_lightningarc(pos, pos + (dirnew * length * 0.25),seglength,drifts,drifte,min(branchfactor + branchfactor_add,1),branchfactor_add); pos_l = pos; } @@ -74,8 +77,8 @@ void Net_ReadLightningarc() { vector from, to; - from_x = ReadCoord(); from_y = ReadCoord(); from_z = ReadCoord(); - to_x = ReadCoord(); to_y = ReadCoord(); to_z = ReadCoord(); + from.x = ReadCoord(); from.y = ReadCoord(); from.z = ReadCoord(); + to.x = ReadCoord(); to.y = ReadCoord(); to.z = ReadCoord(); if(autocvar_cl_effects_lightningarc_simple) { @@ -91,7 +94,7 @@ void Net_ReadLightningarc() branchfactor = autocvar_cl_effects_lightningarc_branchfactor_start; branchfactor_add = autocvar_cl_effects_lightningarc_branchfactor_add; - cl_effetcs_lightningarc(from,to,seglength,drifts,drifte,branchfactor,branchfactor_add); + cl_effects_lightningarc(from,to,seglength,drifts,drifte,branchfactor,branchfactor_add); } }