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) \
37 w_prop(WEP_HLAC, hlac, float, weaponstartoverride, weaponstartoverride)
40 HLAC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
44 void spawnfunc_weapon_hlac() { weapon_defaultspawnfunc(WEP_HLAC); }
46 void W_HLAC_Touch (void)
52 self.event_damage = func_null;
54 isprimary = !(self.projectiledeathtype & HITTYPE_SECONDARY);
56 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);
61 void W_HLAC_Attack (void)
66 W_DecreaseAmmo(ammo_cells, WEP_CVAR_PRI(hlac, ammo), autocvar_g_balance_hlac_reload_ammo);
68 spread = WEP_CVAR_PRI(hlac, spread_min) + (WEP_CVAR_PRI(hlac, spread_add) * self.misc_bulletcounter);
69 spread = min(spread,WEP_CVAR_PRI(hlac, spread_max));
71 spread = spread * WEP_CVAR_PRI(hlac, spread_crouchmod);
73 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_A, WEP_CVAR_PRI(hlac, damage));
74 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
75 if (!autocvar_g_norecoil)
77 self.punchangle_x = random () - 0.5;
78 self.punchangle_y = random () - 0.5;
82 missile.owner = missile.realowner = self;
83 missile.classname = "hlacbolt";
84 missile.bot_dodge = TRUE;
86 missile.bot_dodgerating = WEP_CVAR_PRI(hlac, damage);
88 missile.movetype = MOVETYPE_FLY;
89 PROJECTILE_MAKETRIGGER(missile);
91 setorigin (missile, w_shotorg);
92 setsize(missile, '0 0 0', '0 0 0');
94 W_SetupProjectileVelocity(missile, WEP_CVAR_PRI(hlac, speed), spread);
95 //missile.angles = vectoangles (missile.velocity); // csqc
97 missile.touch = W_HLAC_Touch;
98 missile.think = SUB_Remove;
100 missile.nextthink = time + WEP_CVAR_PRI(hlac, lifetime);
102 missile.flags = FL_PROJECTILE;
103 missile.projectiledeathtype = WEP_HLAC;
105 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
107 other = missile; MUTATOR_CALLHOOK(EditProjectile);
110 void W_HLAC_Attack2f (void)
115 spread = WEP_CVAR_SEC(hlac, spread);
119 spread = spread * WEP_CVAR_SEC(hlac, spread_crouchmod);
121 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(hlac, damage));
122 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
125 missile.owner = missile.realowner = self;
126 missile.classname = "hlacbolt";
127 missile.bot_dodge = TRUE;
129 missile.bot_dodgerating = WEP_CVAR_SEC(hlac, damage);
131 missile.movetype = MOVETYPE_FLY;
132 PROJECTILE_MAKETRIGGER(missile);
134 setorigin (missile, w_shotorg);
135 setsize(missile, '0 0 0', '0 0 0');
137 W_SetupProjectileVelocity(missile, WEP_CVAR_SEC(hlac, speed), spread);
138 //missile.angles = vectoangles (missile.velocity); // csqc
140 missile.touch = W_HLAC_Touch;
141 missile.think = SUB_Remove;
143 missile.nextthink = time + WEP_CVAR_SEC(hlac, lifetime);
145 missile.flags = FL_PROJECTILE;
146 missile.missile_flags = MIF_SPLASH;
147 missile.projectiledeathtype = WEP_HLAC | HITTYPE_SECONDARY;
149 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
151 other = missile; MUTATOR_CALLHOOK(EditProjectile);
154 void W_HLAC_Attack2 (void)
158 W_DecreaseAmmo(ammo_cells, WEP_CVAR_SEC(hlac, ammo), autocvar_g_balance_hlac_reload_ammo);
160 for(i=WEP_CVAR_SEC(hlac, shots);i>0;--i)
163 if (!autocvar_g_norecoil)
165 self.punchangle_x = random () - 0.5;
166 self.punchangle_y = random () - 0.5;
173 if(self.weapon != self.switchweapon) // abort immediately if switching
179 if (self.BUTTON_ATCK)
181 if (!WEP_ACTION(self.weapon, WR_CHECKAMMO1))
182 if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
184 W_SwitchWeapon_Force(self, w_getbestweapon(self));
189 ATTACK_FINISHED(self) = time + WEP_CVAR_PRI(hlac, refire) * W_WeaponRateFactor();
191 self.misc_bulletcounter = self.misc_bulletcounter + 1;
192 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), HLAC_fire1_02);
196 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hlac, animtime), w_ready);
200 float w_hlac(float req)
207 self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), FALSE);
212 if(autocvar_g_balance_hlac_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo))) // forced reload
213 WEP_ACTION(self.weapon, WR_RELOAD);
214 else if (self.BUTTON_ATCK)
216 if (weapon_prepareattack(0, WEP_CVAR_PRI(hlac, refire)))
218 self.misc_bulletcounter = 0;
220 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), HLAC_fire1_02);
224 else if (self.BUTTON_ATCK2 && WEP_CVAR(hlac, secondary))
226 if (weapon_prepareattack(1, WEP_CVAR_SEC(hlac, refire)))
229 weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(hlac, animtime), w_ready);
237 precache_model ("models/weapons/g_hlac.md3");
238 precache_model ("models/weapons/v_hlac.md3");
239 precache_model ("models/weapons/h_hlac.iqm");
240 precache_sound ("weapons/lasergun_fire.wav");
241 HLAC_SETTINGS(WEP_SKIPCVAR, WEP_SET_PROP)
246 self.current_ammo = ammo_cells;
251 ammo_amount = self.ammo_cells >= WEP_CVAR_PRI(hlac, ammo);
252 ammo_amount += self.(weapon_load[WEP_HLAC]) >= WEP_CVAR_PRI(hlac, ammo);
257 ammo_amount = self.ammo_cells >= WEP_CVAR_SEC(hlac, ammo);
258 ammo_amount += self.(weapon_load[WEP_HLAC]) >= WEP_CVAR_SEC(hlac, ammo);
263 HLAC_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
268 W_Reload(min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), "weapons/reload.wav");
271 case WR_SUICIDEMESSAGE:
273 return WEAPON_HLAC_SUICIDE;
277 return WEAPON_HLAC_MURDER;
284 float w_hlac(float req)
288 case WR_IMPACTEFFECT:
291 org2 = w_org + w_backoff * 6;
292 pointparticles(particleeffectnum("laser_impact"), org2, w_backoff * 1000, 1);
294 sound(self, CH_SHOTS, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM);
300 precache_sound("weapons/laserimpact.wav");