[nexuiz-commits] r6315 - in trunk/data/qcsrc: client common
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Fri Mar 27 04:24:32 EDT 2009
Author: tzork
Date: 2009-03-27 04:24:26 -0400 (Fri, 27 Mar 2009)
New Revision: 6315
Added:
trunk/data/qcsrc/client/effects.qc
Modified:
trunk/data/qcsrc/client/Main.qc
trunk/data/qcsrc/client/progs.src
trunk/data/qcsrc/common/constants.qh
Log:
Add TE_CSQC_LIGHTNINGARC
Modified: trunk/data/qcsrc/client/Main.qc
===================================================================
--- trunk/data/qcsrc/client/Main.qc 2009-03-27 07:18:15 UTC (rev 6314)
+++ trunk/data/qcsrc/client/Main.qc 2009-03-27 08:24:26 UTC (rev 6315)
@@ -56,7 +56,7 @@
}
#pragma target FTE
#endif
-
+
float i;
CSQC_CheckEngine();
dprint_load();
@@ -114,7 +114,7 @@
teams = Sort_Spawn();
players = Sort_Spawn();
-
+
GetTeam(COLOR_SPECTATOR, true); // add specs first
cvar_clientsettemp("_supports_weaponpriority", "1");
@@ -292,7 +292,7 @@
// Tokenize String
//argc = tokenize(strMessage);
argc = tokenize_sane(strMessage);
-
+
// Acquire Command
local string strCmd;
strCmd = argv(0);
@@ -498,7 +498,7 @@
{
print("Invalid command. For a list of supported commands, try cl_cmd help.\n");
}
-
+
return;
}
@@ -512,7 +512,7 @@
{
local float bSkipKey;
bSkipKey = false;
-
+
if(menu_visible)
if(menu_action(bInputType, nPrimary, nSecondary))
return TRUE;
@@ -605,7 +605,7 @@
if(o.sort_prev)
Sbar_UpdatePlayerPos(o); // if not registered, we cannot do this yet!
-
+
self.entremove = Ent_RemovePlayerScore;
}
@@ -613,7 +613,7 @@
{
float i;
entity o;
-
+
self.team = ReadByte();
o = self.owner = GetTeam(self.team, true);
@@ -669,7 +669,7 @@
}
else
angles_held_status = 0;
-
+
if(newspectatee_status != spectatee_status)
{
// clear race stuff
@@ -779,7 +779,7 @@
error(strcat("unknown entity type in CSQC_Ent_Update: ", ftos(self.enttype), "\n"));
break;
}
-
+
time = savetime;
};
// Destructor, but does NOT deallocate the entity by calling remove(). Also
@@ -829,7 +829,7 @@
print(ColorTranslateRGB(strMessage));
}
-// CSQC_Parse_CenterPrint : Provides the centerprint string in the first parameter that the server provided.
+// CSQC_Parse_CenterPrint : Provides the centerprint string in the first parameter that the server provided.
void CSQC_Parse_CenterPrint(string strMessage)
{
centerprint(strMessage);
@@ -1019,12 +1019,16 @@
Net_ReadNexgunBeamParticle();
bHandled = true;
break;
+ case TE_CSQC_LIGHTNINGARC:
+ Net_ReadLightningarc();
+ bHandled = true;
+ break;
default:
// No special logic for this temporary entity; return 0 so the engine can handle it
bHandled = false;
break;
}
-
+
return bHandled;
}
@@ -1053,13 +1057,13 @@
keys = db_get(binddb, command);
if(csqc_flags & CSQC_FLAG_READPICTURE)
{
- if (!keys)
+ if (!keys)
{
n = tokenize_insane(findkeysforcommand(command)); // uses '...' strings
for(j = 0; j < n; ++j)
{
k = stof(argv(j));
- if(k != -1)
+ if(k != -1)
{
if ("" == keys)
keys = keynumtostring(k);
@@ -1069,12 +1073,12 @@
++l;
if (sbar_showbinds_limit > 0 && sbar_showbinds_limit >= l) break;
}
-
+
}
db_put(binddb, command, keys);
}
}
-
+
if ("" == keys) {
if (sbar_showbinds > 1)
return strcat(text, " (not bound)");
Added: trunk/data/qcsrc/client/effects.qc
===================================================================
--- trunk/data/qcsrc/client/effects.qc (rev 0)
+++ trunk/data/qcsrc/client/effects.qc 2009-03-27 08:24:26 UTC (rev 6315)
@@ -0,0 +1,100 @@
+/*
+.vector fx_start;
+.vector fx_end;
+.float fx_with;
+.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);
+ Draw_CylindricLine(self.fx_start, self.fx_end, self.fx_with, self.fx_texture, (self.fx_with/256), 0, '1 1 1', 1, DRAWFLAG_ADDITIVE);
+
+}
+void b_make(vector s,vector e, string t,float l,float z)
+{
+ entity b;
+ b = spawn();
+ b.fx_texture = t;
+ b.fx_start = s;
+ b.fx_end = e;
+ b.fx_with = z;
+ b.think = SUB_Remove;
+ b.nextthink = time + l;
+ b.draw = b_draw;
+
+ //b.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP;
+}
+*/
+
+void cl_effetcs_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;
+
+ length = vlen(from - to);
+ if(length < 1)
+ return;
+
+ steps = floor(length / seglength);
+ if(steps < 1)
+ {
+ te_lightning1(world,from,to);
+ return;
+ }
+
+ steplength = length / steps;
+ direction = normalize(to - from);
+ pos_l = from;
+ if(length > seglength)
+ {
+ for(i = 1; i < steps; i += 1)
+ {
+ drift = drifts * (1 - (i / steps)) + drifte * (i / steps);
+ dirnew = normalize(direction * (1 - drift) + randomvec() * drift);
+ pos = pos_l + dirnew * steplength;
+ te_lightning1(world,pos_l,pos);
+ //b_make(pos_l, pos,"particles/lightning2",0.25,64);
+ if(random() < branchfactor)
+ cl_effetcs_lightningarc(pos, pos + (dirnew * length * 0.25),seglength,drifts,drifte,min(branchfactor + branchfactor_add,1),branchfactor_add);
+
+ pos_l = pos;
+ }
+ te_lightning1(world,pos_l,to);
+ //b_make(pos_l, to,"particles/lightning2",0.25,64);
+
+ }
+ else
+ te_lightning1(world,from,to);
+ //b_make(from, to,"particles/lightning2",0.25,64);
+
+}
+
+void Net_ReadLightningarc()
+{
+ vector from, to;
+
+ from_x = ReadCoord(); from_y = ReadCoord(); from_z = ReadCoord();
+ to_x = ReadCoord(); to_y = ReadCoord(); to_z = ReadCoord();
+
+ if(cvar("cl_effects_lightningarc_simple"))
+ {
+ te_lightning1(world,from,to);
+ }
+ else
+ {
+ float seglength, drifts, drifte, branchfactor, branchfactor_add;
+
+ seglength = cvar("cl_effects_lightningarc_segmentlength");
+ drifts = cvar("cl_effects_lightningarc_drift_start");
+ drifte = cvar("cl_effects_lightningarc_drift_end");
+ branchfactor = cvar("cl_effects_lightningarc_branchfactor_start");
+ branchfactor = cvar("cl_effects_lightningarc_branchfactor_add");
+
+ cl_effetcs_lightningarc(from,to,seglength,drifts,drifte,branchfactor,branchfactor_add);
+ }
+
+}
Modified: trunk/data/qcsrc/client/progs.src
===================================================================
--- trunk/data/qcsrc/client/progs.src 2009-03-27 07:18:15 UTC (rev 6314)
+++ trunk/data/qcsrc/client/progs.src 2009-03-27 08:24:26 UTC (rev 6315)
@@ -34,6 +34,7 @@
gibs.qc
damage.qc
casings.qc
+effects.qc
Main.qc
View.qc
Modified: trunk/data/qcsrc/common/constants.qh
===================================================================
--- trunk/data/qcsrc/common/constants.qh 2009-03-27 07:18:15 UTC (rev 6314)
+++ trunk/data/qcsrc/common/constants.qh 2009-03-27 08:24:26 UTC (rev 6315)
@@ -46,7 +46,8 @@
const float TE_CSQC_RACE = 101;
const float TE_CSQC_SPAWN = 102;
const float TE_CSQC_ZCURVEPARTICLES = 103;
-const float TE_CSQC_NEXGUNBEAMPARTICLE = 104;
+const float TE_CSQC_NEXGUNBEAMPARTICLE = 104;
+const float TE_CSQC_LIGHTNINGARC = 105;
const float RACE_NET_CHECKPOINT_HIT_QUALIFYING = 0; // byte checkpoint, short time, short recordtime, string recordholder
const float RACE_NET_CHECKPOINT_CLEAR = 1;
More information about the nexuiz-commits
mailing list