5 /* ammotype */ IT_CELLS,
7 /* flags */ WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH,
8 /* rating */ BOT_PICKUP_RATING_MID,
11 /* fullname */ _("Heavy Laser Assault Cannon")
14 #define HLAC_SETTINGS(w_cvar,w_prop) \
15 w_cvar(WEP_HLAC, hlac, MO_BOTH, ammo) \
16 w_cvar(WEP_HLAC, hlac, MO_BOTH, animtime) \
17 w_cvar(WEP_HLAC, hlac, MO_BOTH, damage) \
18 w_cvar(WEP_HLAC, hlac, MO_BOTH, edgedamage) \
19 w_cvar(WEP_HLAC, hlac, MO_BOTH, force) \
20 w_cvar(WEP_HLAC, hlac, MO_BOTH, lifetime) \
21 w_cvar(WEP_HLAC, hlac, MO_BOTH, radius) \
22 w_cvar(WEP_HLAC, hlac, MO_BOTH, refire) \
23 w_cvar(WEP_HLAC, hlac, MO_BOTH, speed) \
24 w_cvar(WEP_HLAC, hlac, MO_BOTH, spread_crouchmod) \
25 w_cvar(WEP_HLAC, hlac, MO_PRI, spread_add) \
26 w_cvar(WEP_HLAC, hlac, MO_PRI, spread_max) \
27 w_cvar(WEP_HLAC, hlac, MO_PRI, spread_min) \
28 w_cvar(WEP_HLAC, hlac, MO_NONE, secondary) \
29 w_cvar(WEP_HLAC, hlac, MO_SEC, shots) \
30 w_cvar(WEP_HLAC, hlac, MO_SEC, spread) \
31 w_prop(WEP_HLAC, hlac, float, reloading_ammo, reload_ammo) \
32 w_prop(WEP_HLAC, hlac, float, reloading_time, reload_time) \
33 w_prop(WEP_HLAC, hlac, float, switchdelay_raise, switchdelay_raise) \
34 w_prop(WEP_HLAC, hlac, float, switchdelay_drop, switchdelay_drop) \
35 w_prop(WEP_HLAC, hlac, string, weaponreplace, weaponreplace) \
36 w_prop(WEP_HLAC, hlac, float, weaponstart, weaponstart)
39 HLAC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
43 void spawnfunc_weapon_hlac() { weapon_defaultspawnfunc(WEP_HLAC); }
45 void W_HLAC_Touch (void)
51 self.event_damage = func_null;
53 isprimary = !(self.projectiledeathtype & HITTYPE_SECONDARY);
55 RadiusDamage(self, self.realowner, WEP_CVAR_BOTH(hlac, isprimary, damage), WEP_CVAR_BOTH(hlac, isprimary, edgedamage), WEP_CVAR_BOTH(hlac, isprimary, radius), world, world, WEP_CVAR_BOTH(hlac, isprimary, force), self.projectiledeathtype, other);
60 void W_HLAC_Attack (void)
65 W_DecreaseAmmo(ammo_cells, WEP_CVAR_PRI(hlac, ammo), autocvar_g_balance_hlac_reload_ammo);
67 spread = WEP_CVAR_PRI(hlac, spread_min) + (WEP_CVAR_PRI(hlac, spread_add) * self.misc_bulletcounter);
68 spread = min(spread,WEP_CVAR_PRI(hlac, spread_max));
70 spread = spread * WEP_CVAR_PRI(hlac, spread_crouchmod);
72 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_A, WEP_CVAR_PRI(hlac, damage));
73 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
74 if (!autocvar_g_norecoil)
76 self.punchangle_x = random () - 0.5;
77 self.punchangle_y = random () - 0.5;
81 missile.owner = missile.realowner = self;
82 missile.classname = "hlacbolt";
83 missile.bot_dodge = TRUE;
85 missile.bot_dodgerating = WEP_CVAR_PRI(hlac, damage);
87 missile.movetype = MOVETYPE_FLY;
88 PROJECTILE_MAKETRIGGER(missile);
90 setorigin (missile, w_shotorg);
91 setsize(missile, '0 0 0', '0 0 0');
93 W_SetupProjectileVelocity(missile, WEP_CVAR_PRI(hlac, speed), spread);
94 //missile.angles = vectoangles (missile.velocity); // csqc
96 missile.touch = W_HLAC_Touch;
97 missile.think = SUB_Remove;
99 missile.nextthink = time + WEP_CVAR_PRI(hlac, lifetime);
101 missile.flags = FL_PROJECTILE;
102 missile.projectiledeathtype = WEP_HLAC;
104 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
106 other = missile; MUTATOR_CALLHOOK(EditProjectile);
109 void W_HLAC_Attack2f (void)
114 spread = WEP_CVAR_SEC(hlac, spread);
118 spread = spread * WEP_CVAR_SEC(hlac, spread_crouchmod);
120 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(hlac, damage));
121 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
124 missile.owner = missile.realowner = self;
125 missile.classname = "hlacbolt";
126 missile.bot_dodge = TRUE;
128 missile.bot_dodgerating = WEP_CVAR_SEC(hlac, damage);
130 missile.movetype = MOVETYPE_FLY;
131 PROJECTILE_MAKETRIGGER(missile);
133 setorigin (missile, w_shotorg);
134 setsize(missile, '0 0 0', '0 0 0');
136 W_SetupProjectileVelocity(missile, WEP_CVAR_SEC(hlac, speed), spread);
137 //missile.angles = vectoangles (missile.velocity); // csqc
139 missile.touch = W_HLAC_Touch;
140 missile.think = SUB_Remove;
142 missile.nextthink = time + WEP_CVAR_SEC(hlac, lifetime);
144 missile.flags = FL_PROJECTILE;
145 missile.missile_flags = MIF_SPLASH;
146 missile.projectiledeathtype = WEP_HLAC | HITTYPE_SECONDARY;
148 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
150 other = missile; MUTATOR_CALLHOOK(EditProjectile);
153 void W_HLAC_Attack2 (void)
157 W_DecreaseAmmo(ammo_cells, WEP_CVAR_SEC(hlac, ammo), autocvar_g_balance_hlac_reload_ammo);
159 for(i=WEP_CVAR_SEC(hlac, shots);i>0;--i)
162 if (!autocvar_g_norecoil)
164 self.punchangle_x = random () - 0.5;
165 self.punchangle_y = random () - 0.5;
172 if(self.weapon != self.switchweapon) // abort immediately if switching
178 if (self.BUTTON_ATCK)
180 if (!WEP_ACTION(self.weapon, WR_CHECKAMMO1))
181 if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
183 W_SwitchWeapon_Force(self, w_getbestweapon(self));
188 ATTACK_FINISHED(self) = time + WEP_CVAR_PRI(hlac, refire) * W_WeaponRateFactor();
190 self.misc_bulletcounter = self.misc_bulletcounter + 1;
191 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), HLAC_fire1_02);
195 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hlac, animtime), w_ready);
199 float w_hlac(float req)
206 self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), FALSE);
211 if(autocvar_g_balance_hlac_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo))) // forced reload
212 WEP_ACTION(self.weapon, WR_RELOAD);
213 else if (self.BUTTON_ATCK)
215 if (weapon_prepareattack(0, WEP_CVAR_PRI(hlac, refire)))
217 self.misc_bulletcounter = 0;
219 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), HLAC_fire1_02);
223 else if (self.BUTTON_ATCK2 && WEP_CVAR(hlac, secondary))
225 if (weapon_prepareattack(1, WEP_CVAR_SEC(hlac, refire)))
228 weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(hlac, animtime), w_ready);
236 precache_model ("models/weapons/g_hlac.md3");
237 precache_model ("models/weapons/v_hlac.md3");
238 precache_model ("models/weapons/h_hlac.iqm");
239 precache_sound ("weapons/lasergun_fire.wav");
240 HLAC_SETTINGS(WEP_SKIPCVAR, WEP_SET_PROP)
245 self.current_ammo = ammo_cells;
250 ammo_amount = self.ammo_cells >= WEP_CVAR_PRI(hlac, ammo);
251 ammo_amount += self.(weapon_load[WEP_HLAC]) >= WEP_CVAR_PRI(hlac, ammo);
256 ammo_amount = self.ammo_cells >= WEP_CVAR_SEC(hlac, ammo);
257 ammo_amount += self.(weapon_load[WEP_HLAC]) >= WEP_CVAR_SEC(hlac, ammo);
262 HLAC_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
267 W_Reload(min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), "weapons/reload.wav");
270 case WR_SUICIDEMESSAGE:
272 return WEAPON_HLAC_SUICIDE;
276 return WEAPON_HLAC_MURDER;
283 float w_hlac(float req)
287 case WR_IMPACTEFFECT:
290 org2 = w_org + w_backoff * 6;
291 pointparticles(particleeffectnum("laser_impact"), org2, w_backoff * 1000, 1);
293 sound(self, CH_SHOTS, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM);
299 precache_sound("weapons/laserimpact.wav");