#include "../lib/warpzone/common.qh"
entityclass(Hook);
-class(Hook) .float HookType; // ENT_CLIENT_*
+class(Hook) .entity HookType; // ENT_CLIENT_*
class(Hook) .vector origin;
class(Hook) .vector velocity;
class(Hook) .float HookSilent;
self.teleport_time = 0;
}
- InterpolateOrigin_Do();
+ InterpolateOrigin_Do(this);
int s = W_GetGunAlignment(world);
switch(self.HookType)
{
default:
- case ENT_CLIENT_HOOK:
+ case NET_ENT_CLIENT_HOOK:
vs = hook_shotorigin[s];
break;
- case ENT_CLIENT_ARC_BEAM:
+ case NET_ENT_CLIENT_ARC_BEAM:
vs = lightning_shotorigin[s];
break;
}
switch(self.HookType)
{
default:
- case ENT_CLIENT_HOOK:
+ case NET_ENT_CLIENT_HOOK:
a = view_origin + view_forward * vs.x + view_right * -vs.y + view_up * vs.z;
b = self.origin;
break;
- case ENT_CLIENT_ARC_BEAM:
+ case NET_ENT_CLIENT_ARC_BEAM:
if(self.HookRange)
b = view_origin + view_forward * self.HookRange;
else
switch(self.HookType)
{
default:
- case ENT_CLIENT_HOOK:
+ case NET_ENT_CLIENT_HOOK:
a = self.velocity;
b = self.origin;
break;
- case ENT_CLIENT_ARC_BEAM:
+ case NET_ENT_CLIENT_ARC_BEAM:
a = self.origin;
b = self.velocity;
break;
switch(self.HookType)
{
default:
- case ENT_CLIENT_HOOK:
+ case NET_ENT_CLIENT_HOOK:
intensity = 1;
offset = 0;
switch(t)
default: tex = "particles/hook_white"; rgb = getcsqcplayercolor(self.sv_entnum); break;
}
break;
- case ENT_CLIENT_ARC_BEAM: // todo
+ case NET_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";
Draw_GrapplingHook_trace_callback_rnd = offset;
Draw_GrapplingHook_trace_callback_rgb = rgb;
Draw_GrapplingHook_trace_callback_a = intensity;
- WarpZone_TraceBox_ThroughZone(a, '0 0 0', '0 0 0', b, ((self.HookType == ENT_CLIENT_HOOK) ? MOVE_NOTHING : MOVE_NORMAL), world, world, Draw_GrapplingHook_trace_callback);
+ WarpZone_TraceBox_ThroughZone(a, '0 0 0', '0 0 0', b, ((self.HookType == NET_ENT_CLIENT_HOOK) ? MOVE_NOTHING : MOVE_NORMAL), world, world, Draw_GrapplingHook_trace_callback);
Draw_GrapplingHook_trace_callback_tex = string_null;
atrans = WarpZone_TransformOrigin(WarpZone_trace_transform, a);
switch(self.HookType)
{
default:
- case ENT_CLIENT_HOOK:
+ case NET_ENT_CLIENT_HOOK:
if(vlen(trace_endpos - atrans) > 0.5)
{
setorigin(self, trace_endpos); // hook endpoint!
self.drawmask = 0;
}
break;
- case ENT_CLIENT_ARC_BEAM:
+ case NET_ENT_CLIENT_ARC_BEAM:
setorigin(self, a); // beam origin!
break;
}
switch(self.HookType)
{
default:
- case ENT_CLIENT_HOOK:
+ case NET_ENT_CLIENT_HOOK:
break;
- case ENT_CLIENT_ARC_BEAM:
- pointparticles(particleeffectnum(EFFECT_ARC_LIGHTNING2), trace_endpos, normalize(atrans - trace_endpos), frametime * intensity); // todo: new effect
+ case NET_ENT_CLIENT_ARC_BEAM:
+ pointparticles(EFFECT_ARC_LIGHTNING2, trace_endpos, normalize(atrans - trace_endpos), frametime * intensity); // todo: new effect
break;
}
}
sound (self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
}
-void Ent_ReadHook(float bIsNew, float type)
-{SELFPARAM();
- self.HookType = type;
+NET_HANDLE(ENT_CLIENT_HOOK, bool bIsNew)
+{
+ self.HookType = NET_ENT_CLIENT_HOOK;
int sf = ReadByte();
self.HookSilent = (sf & 0x80);
self.iflags = IFLAG_VELOCITY | IFLAG_ORIGIN;
- InterpolateOrigin_Undo();
+ InterpolateOrigin_Undo(self);
if(sf & 1)
{
switch(self.HookType)
{
default:
- case ENT_CLIENT_HOOK:
+ case NET_ENT_CLIENT_HOOK:
self.HookRange = 0;
break;
- case ENT_CLIENT_ARC_BEAM:
+ case NET_ENT_CLIENT_ARC_BEAM:
self.HookRange = ReadCoord();
break;
}
self.velocity_z = ReadCoord();
}
- InterpolateOrigin_Note();
+ InterpolateOrigin_Note(this);
if(bIsNew || !self.teleport_time)
{
switch(self.HookType)
{
default:
- case ENT_CLIENT_HOOK:
+ case NET_ENT_CLIENT_HOOK:
// for the model
setmodel(self, MDL_HOOK);
self.drawmask = MASK_NORMAL;
break;
- case ENT_CLIENT_ARC_BEAM:
+ case NET_ENT_CLIENT_ARC_BEAM:
sound (self, CH_SHOTS_SINGLE, SND_LGBEAM_FLY, VOL_BASE, ATTEN_NORM);
break;
}
}
self.teleport_time = time + 10;
+ return true;
}
// TODO: hook: temporarily transform self.origin for drawing the model along warpzones!