-.float HookType; // ENT_CLIENT_*
-.vector origin;
-.vector velocity;
-.float HookSilent;
-.float HookRange;
+#include "hud.qh"
+#include "noise.qh"
+#include "../warpzonelib/common.qh"
+
+entityclass(Hook)
+class(Hook) .float HookType; // ENT_CLIENT_*
+class(Hook) .vector origin;
+class(Hook) .vector velocity;
+class(Hook) .float HookSilent;
+class(Hook) .float HookRange;
void Draw_CylindricLine(vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float theAlpha, float drawflag, vector vieworg)
{
Draw_GrapplingHook_trace_callback_rnd += 0.25 * vlen(hit - start) / 8;
}
-.float teleport_time;
+class(Hook) .float teleport_time;
void Draw_GrapplingHook()
{
vector a, b, atrans;
string tex;
vector rgb;
float t;
- float s;
+ int s;
vector vs;
float intensity, offset;
case ENT_CLIENT_HOOK:
vs = hook_shotorigin[s];
break;
- case ENT_CLIENT_LGBEAM:
- vs = electro_shotorigin[s];
- break;
- case ENT_CLIENT_GAUNTLET:
- vs = gauntlet_shotorigin[s];
+ case ENT_CLIENT_ARC_BEAM:
+ vs = lightning_shotorigin[s];
break;
}
{
default:
case ENT_CLIENT_HOOK:
- a = view_origin + view_forward * vs_x + view_right * -vs_y + view_up * vs_z;
+ a = view_origin + view_forward * vs.x + view_right * -vs.y + view_up * vs.z;
b = self.origin;
break;
- case ENT_CLIENT_LGBEAM:
- case ENT_CLIENT_GAUNTLET:
+ case ENT_CLIENT_ARC_BEAM:
if(self.HookRange)
b = view_origin + view_forward * self.HookRange;
else
b = view_origin + view_forward * vlen(self.velocity - self.origin); // honor original length of beam!
WarpZone_TraceLine(view_origin, b, MOVE_NORMAL, world);
b = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
- a = view_origin + view_forward * vs_x + view_right * -vs_y + view_up * vs_z;
+ a = view_origin + view_forward * vs.x + view_right * -vs.y + view_up * vs.z;
break;
}
}
a = self.velocity;
b = self.origin;
break;
- case ENT_CLIENT_LGBEAM:
- case ENT_CLIENT_GAUNTLET:
+ case ENT_CLIENT_ARC_BEAM:
a = self.origin;
b = self.velocity;
break;
default: tex = "particles/hook_white"; rgb = getcsqcplayercolor(self.sv_entnum); break;
}
break;
- case ENT_CLIENT_LGBEAM:
+ case ENT_CLIENT_ARC_BEAM: // todo
intensity = bound(0.2, 1 + Noise_Pink(self, frametime) * 1 + Noise_Burst(self, frametime, 0.03) * 0.3, 2);
offset = Noise_Brown(self, frametime) * 10;
tex = "particles/lgbeam";
rgb = '1 1 1';
break;
- case ENT_CLIENT_GAUNTLET:
- intensity = 1;
- offset = Noise_White(self, frametime);
- tex = "particles/gauntletbeam";
- rgb = '1 1 1';
- break;
}
Draw_GrapplingHook_trace_callback_tex = tex;
self.drawmask = 0;
}
break;
- case ENT_CLIENT_LGBEAM:
- case ENT_CLIENT_GAUNTLET:
+ case ENT_CLIENT_ARC_BEAM:
setorigin(self, a); // beam origin!
break;
}
default:
case ENT_CLIENT_HOOK:
break;
- case ENT_CLIENT_LGBEAM:
- pointparticles(particleeffectnum("electro_lightning"), trace_endpos, normalize(atrans - trace_endpos), frametime * intensity);
- break;
- case ENT_CLIENT_GAUNTLET:
- pointparticles(particleeffectnum("gauntlet_lightning"), b, normalize(a - b), frametime * intensity);
+ case ENT_CLIENT_ARC_BEAM:
+ pointparticles(particleeffectnum("electro_lightning"), trace_endpos, normalize(atrans - trace_endpos), frametime * intensity); // todo: new effect
break;
}
}
{
self.HookType = type;
- float sf;
- sf = ReadByte();
+ int sf = ReadByte();
self.HookSilent = (sf & 0x80);
self.iflags = IFLAG_VELOCITY | IFLAG_ORIGIN;
if(sf & 1)
{
- float myowner = ReadByte();
+ int myowner = ReadByte();
self.owner = playerslots[myowner - 1];
self.sv_entnum = myowner;
switch(self.HookType)
{
default:
case ENT_CLIENT_HOOK:
- case ENT_CLIENT_GAUNTLET:
self.HookRange = 0;
break;
- case ENT_CLIENT_LGBEAM:
+ case ENT_CLIENT_ARC_BEAM:
self.HookRange = ReadCoord();
break;
}
setmodel(self, "models/hook.md3");
self.drawmask = MASK_NORMAL;
break;
- case ENT_CLIENT_LGBEAM:
+ case ENT_CLIENT_ARC_BEAM:
sound (self, CH_SHOTS_SINGLE, "weapons/lgbeam_fly.wav", VOL_BASE, ATTEN_NORM);
break;
- case ENT_CLIENT_GAUNTLET:
- sound (self, CH_SHOTS_SINGLE, "weapons/gauntletbeam_fly.wav", VOL_BASE, ATTEN_NORM);
- break;
}
}
void Hook_Precache()
{
precache_sound("weapons/lgbeam_fly.wav");
- precache_sound("weapons/gauntletbeam_fly.wav");
precache_model("models/hook.md3");
}