X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fclient%2Fhook.qc;h=07123f06b5ec278b9bb1d609a7e9e8d195032836;hp=8436ff6225a0ccc0e546bf5007fccec05720c394;hb=9ae63d858415772fdb60bd549758825103c0ba17;hpb=6dc9591eba337374f2b4348a6a6deaa1cb6887d0 diff --git a/qcsrc/client/hook.qc b/qcsrc/client/hook.qc index 8436ff6225..07123f06b5 100644 --- a/qcsrc/client/hook.qc +++ b/qcsrc/client/hook.qc @@ -1,39 +1,20 @@ -#include "hud.qh" -#include "noise.qh" -#include "../warpzonelib/common.qh" +#include "hook.qh" +#include "_all.qh" -.float HookType; // ENT_CLIENT_* -.vector origin; -.vector velocity; -.float HookSilent; -.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) -{ - // I want to draw a quad... - // from and to are MIDPOINTS. +#include "hud.qh" - vector axis, thickdir, A, B, C, D; - float length_tex; +#include "../common/teams.qh" - axis = normalize(to - from); - length_tex = aspect * vlen(to - from) / thickness; +#include "../csqcmodellib/interpolate.qh" - // direction is perpendicular to the view normal, and perpendicular to the axis - thickdir = normalize(cross(axis, vieworg - from)); +#include "../warpzonelib/common.qh" - A = from - thickdir * (thickness / 2); - B = from + thickdir * (thickness / 2); - C = to + thickdir * (thickness / 2); - D = to - thickdir * (thickness / 2); - - 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; @@ -49,8 +30,8 @@ void Draw_GrapplingHook_trace_callback(vector start, vector hit, vector end) 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; @@ -63,7 +44,7 @@ void Draw_GrapplingHook() 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; } @@ -180,18 +161,18 @@ void Draw_GrapplingHook() 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(); @@ -243,11 +224,11 @@ void Ent_ReadHook(float bIsNew, float type) 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; } } @@ -255,10 +236,4 @@ void Ent_ReadHook(float bIsNew, float type) 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!