-.float HookType; // ENT_CLIENT_*
-.vector origin;
-.vector velocity;
-.float HookSilent;
-.float HookRange;
+#include "hook.qh"
+#include "_all.qh"
-void Draw_CylindricLine(vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float theAlpha, float drawflag, vector vieworg)
-{
- // I want to draw a quad...
- // from and to are MIDPOINTS.
-
- vector axis, thickdir, A, B, C, D;
- float length_tex;
+#include "hud.qh"
- axis = normalize(to - from);
- length_tex = aspect * vlen(to - from) / thickness;
+#include "../common/teams.qh"
- // direction is perpendicular to the view normal, and perpendicular to the axis
- thickdir = normalize(cross(axis, vieworg - from));
+#include "../csqcmodellib/interpolate.qh"
- A = from - thickdir * (thickness / 2);
- B = from + thickdir * (thickness / 2);
- C = to + thickdir * (thickness / 2);
- D = to - thickdir * (thickness / 2);
+#include "../warpzonelib/common.qh"
- R_BeginPolygon(texture, drawflag);
- R_PolygonVertex(A, '0 0 0' + shift * '1 0 0', rgb, theAlpha);
- R_PolygonVertex(B, '0 1 0' + shift * '1 0 0', rgb, theAlpha);
- R_PolygonVertex(C, '0 1 0' + (shift + length_tex) * '1 0 0', rgb, theAlpha);
- R_PolygonVertex(D, '0 0 0' + (shift + length_tex) * '1 0 0', rgb, theAlpha);
- R_EndPolygon();
-}
+entityclass(Hook);
+class(Hook) .float HookType; // ENT_CLIENT_*
+class(Hook) .vector origin;
+class(Hook) .vector velocity;
+class(Hook) .float HookSilent;
+class(Hook) .float HookRange;
string Draw_GrapplingHook_trace_callback_tex;
float Draw_GrapplingHook_trace_callback_rnd;
Draw_GrapplingHook_trace_callback_rnd += 0.25 * vlen(hit - start) / 8;
}
-.float teleport_time;
-void Draw_GrapplingHook()
+class(Hook) .float teleport_time;
+void Draw_GrapplingHook(entity this)
{
vector a, b, atrans;
string tex;
if(self.teleport_time)
if(time > self.teleport_time)
{
- sound (self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, ATTEN_NORM); // safeguard
+ sound (self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM); // safeguard
self.teleport_time = 0;
}
case ENT_CLIENT_HOOK:
break;
case ENT_CLIENT_ARC_BEAM:
- pointparticles(particleeffectnum("electro_lightning"), trace_endpos, normalize(atrans - trace_endpos), frametime * intensity); // todo: new effect
+ pointparticles(particleeffectnum(EFFECT_ARC_LIGHTNING2), trace_endpos, normalize(atrans - trace_endpos), frametime * intensity); // todo: new effect
break;
}
}
void Remove_GrapplingHook()
-{
- sound (self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, ATTEN_NORM);
+{SELFPARAM();
+ sound (self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
}
void Ent_ReadHook(float bIsNew, float type)
-{
+{SELFPARAM();
self.HookType = type;
int sf = ReadByte();
default:
case ENT_CLIENT_HOOK:
// for the model
- setmodel(self, "models/hook.md3");
+ setmodel(self, MDL_HOOK);
self.drawmask = MASK_NORMAL;
break;
case ENT_CLIENT_ARC_BEAM:
- sound (self, CH_SHOTS_SINGLE, "weapons/lgbeam_fly.wav", VOL_BASE, ATTEN_NORM);
+ sound (self, CH_SHOTS_SINGLE, SND_LGBEAM_FLY, VOL_BASE, ATTEN_NORM);
break;
}
}
self.teleport_time = time + 10;
}
-void Hook_Precache()
-{
- precache_sound("weapons/lgbeam_fly.wav");
- precache_model("models/hook.md3");
-}
-
// TODO: hook: temporarily transform self.origin for drawing the model along warpzones!