1 #ifndef VEHICLE_BUMBLEBEE_WEAPONS_H
2 #define VEHICLE_BUMBLEBEE_WEAPONS_H
4 #include "../../weapons/all.qh"
10 REGISTER_NET_LINKED(ENT_CLIENT_BUMBLE_RAYGUN)
14 float autocvar_g_vehicle_bumblebee_cannon_cost;
15 float autocvar_g_vehicle_bumblebee_cannon_damage;
16 float autocvar_g_vehicle_bumblebee_cannon_radius;
17 float autocvar_g_vehicle_bumblebee_cannon_refire;
18 float autocvar_g_vehicle_bumblebee_cannon_speed;
19 float autocvar_g_vehicle_bumblebee_cannon_spread;
20 float autocvar_g_vehicle_bumblebee_cannon_force;
22 bool bumble_raygun_send(entity this, entity to, int sf);
24 void bumblebee_fire_cannon(entity _gun, string _tagname, entity _owner)
26 vector v = gettaginfo(_gun, gettagindex(_gun, _tagname));
27 vehicles_projectile(EFFECT_BIGPLASMA_MUZZLEFLASH.eent_eff_name, SND(VEH_BUMBLEBEE_FIRE),
28 v, normalize(v_forward + randomvec() * autocvar_g_vehicle_bumblebee_cannon_spread) * autocvar_g_vehicle_bumblebee_cannon_speed,
29 autocvar_g_vehicle_bumblebee_cannon_damage, autocvar_g_vehicle_bumblebee_cannon_radius, autocvar_g_vehicle_bumblebee_cannon_force, 0,
30 DEATH_VH_BUMB_GUN.m_id, PROJECTILE_BUMBLE_GUN, 0, true, true, _owner);
33 bool bumble_raygun_send(entity this, entity to, float sf)
35 WriteHeader(MSG_ENTITY, ENT_CLIENT_BUMBLE_RAYGUN);
37 WriteByte(MSG_ENTITY, sf);
40 WriteByte(MSG_ENTITY, num_for_edict(self.realowner));
41 WriteByte(MSG_ENTITY, self.realowner.team);
42 WriteByte(MSG_ENTITY, self.cnt);
47 WriteCoord(MSG_ENTITY, self.hook_start_x);
48 WriteCoord(MSG_ENTITY, self.hook_start_y);
49 WriteCoord(MSG_ENTITY, self.hook_start_z);
54 WriteCoord(MSG_ENTITY, self.hook_end_x);
55 WriteCoord(MSG_ENTITY, self.hook_end_y);
56 WriteCoord(MSG_ENTITY, self.hook_end_z);
66 void bumble_raygun_draw(entity this);
68 NET_HANDLE(ENT_CLIENT_BUMBLE_RAYGUN, bool isnew)
74 self.cnt = ReadByte();
75 self.team = ReadByte();
76 self.cnt = ReadByte();
79 self.colormod = '1 0 0';
81 self.colormod = '0 1 0';
83 self.traileffect = EFFECT_BUMBLEBEE_HEAL_MUZZLEFLASH.m_id;
84 self.lip = particleeffectnum(EFFECT_BUMBLEBEE_HEAL_IMPACT);
86 self.draw = bumble_raygun_draw;
92 self.origin_x = ReadCoord();
93 self.origin_y = ReadCoord();
94 self.origin_z = ReadCoord();
95 setorigin(self, self.origin);
100 self.move_origin_x = ReadCoord();
101 self.move_origin_y = ReadCoord();
102 self.move_origin_z = ReadCoord();
107 .float bumble_raygun_nextdraw;
108 void bumble_raygun_draw(entity this)
112 vector _vtmp1, _vtmp2;
114 _len = vlen(self.origin - self.move_origin);
115 _dir = normalize(self.move_origin - self.origin);
117 if(self.bumble_raygun_nextdraw < time)
119 boxparticles(particleeffectnum(Effects_from(self.traileffect)), self, self.origin, self.origin + _dir * -64, _dir * -_len , _dir * -_len, 1, PARTICLES_USEALPHA);
120 boxparticles(self.lip, self, self.move_origin, self.move_origin + _dir * -64, _dir * -200 , _dir * -200, 1, PARTICLES_USEALPHA);
121 self.bumble_raygun_nextdraw = time + 0.1;
125 for(i = -0.1; i < 0.2; i += 0.1)
127 df = DRAWFLAG_NORMAL; //((random() < 0.5) ? DRAWFLAG_ADDITIVE : DRAWFLAG_SCREEN);
128 sz = 5 + random() * 5;
129 al = 0.25 + random() * 0.5;
130 _vtmp1 = self.origin + _dir * _len * (0.25 + i);
131 _vtmp1 += (randomvec() * (_len * 0.2) * (frametime * 2)); //self.raygun_l1;
132 Draw_CylindricLine(self.origin, _vtmp1, sz, "gfx/colors/white.tga", 1, 1, self.colormod, al, df, view_origin);
134 _vtmp2 = self.origin + _dir * _len * (0.5 + i);
135 _vtmp2 += (randomvec() * (_len * 0.2) * (frametime * 5)); //self.raygun_l2;
136 Draw_CylindricLine(_vtmp1, _vtmp2, sz, "gfx/colors/white.tga", 1, 1, self.colormod, al, df, view_origin);
138 _vtmp1 = self.origin + _dir * _len * (0.75 + i);
139 _vtmp1 += randomvec() * (_len * 0.2) * (frametime * 10); //self.raygun_l3;
140 Draw_CylindricLine(_vtmp2, _vtmp1, sz, "gfx/colors/white.tga", 1, 1, self.colormod, al, df, view_origin);
142 Draw_CylindricLine(_vtmp1, self.move_origin + randomvec() * 32, sz, "gfx/colors/white.tga", 1, 1, self.colormod, al, df, view_origin);