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, reloading_ammo, reload_ammo) \
32 w_prop(WEP_HLAC, hlac, reloading_time, reload_time) \
33 w_prop(WEP_HLAC, hlac, switchdelay_raise, switchdelay_raise) \
34 w_prop(WEP_HLAC, hlac, switchdelay_drop, switchdelay_drop)
37 HLAC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
41 void spawnfunc_weapon_hlac() { weapon_defaultspawnfunc(WEP_HLAC); }
43 void W_HLAC_Touch (void)
49 self.event_damage = func_null;
51 isprimary = !(self.projectiledeathtype & HITTYPE_SECONDARY);
53 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);
58 void W_HLAC_Attack (void)
63 W_DecreaseAmmo(ammo_cells, WEP_CVAR_PRI(hlac, ammo), autocvar_g_balance_hlac_reload_ammo);
65 spread = WEP_CVAR_PRI(hlac, spread_min) + (WEP_CVAR_PRI(hlac, spread_add) * self.misc_bulletcounter);
66 spread = min(spread,WEP_CVAR_PRI(hlac, spread_max));
68 spread = spread * WEP_CVAR_PRI(hlac, spread_crouchmod);
70 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_A, WEP_CVAR_PRI(hlac, damage));
71 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
72 if (!autocvar_g_norecoil)
74 self.punchangle_x = random () - 0.5;
75 self.punchangle_y = random () - 0.5;
79 missile.owner = missile.realowner = self;
80 missile.classname = "hlacbolt";
81 missile.bot_dodge = TRUE;
83 missile.bot_dodgerating = WEP_CVAR_PRI(hlac, damage);
85 missile.movetype = MOVETYPE_FLY;
86 PROJECTILE_MAKETRIGGER(missile);
88 setorigin (missile, w_shotorg);
89 setsize(missile, '0 0 0', '0 0 0');
91 W_SetupProjectileVelocity(missile, WEP_CVAR_PRI(hlac, speed), spread);
92 //missile.angles = vectoangles (missile.velocity); // csqc
94 missile.touch = W_HLAC_Touch;
95 missile.think = SUB_Remove;
97 missile.nextthink = time + WEP_CVAR_PRI(hlac, lifetime);
99 missile.flags = FL_PROJECTILE;
100 missile.projectiledeathtype = WEP_HLAC;
102 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
104 other = missile; MUTATOR_CALLHOOK(EditProjectile);
107 void W_HLAC_Attack2f (void)
112 spread = WEP_CVAR_SEC(hlac, spread);
116 spread = spread * WEP_CVAR_SEC(hlac, spread_crouchmod);
118 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(hlac, damage));
119 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
122 missile.owner = missile.realowner = self;
123 missile.classname = "hlacbolt";
124 missile.bot_dodge = TRUE;
126 missile.bot_dodgerating = WEP_CVAR_SEC(hlac, damage);
128 missile.movetype = MOVETYPE_FLY;
129 PROJECTILE_MAKETRIGGER(missile);
131 setorigin (missile, w_shotorg);
132 setsize(missile, '0 0 0', '0 0 0');
134 W_SetupProjectileVelocity(missile, WEP_CVAR_SEC(hlac, speed), spread);
135 //missile.angles = vectoangles (missile.velocity); // csqc
137 missile.touch = W_HLAC_Touch;
138 missile.think = SUB_Remove;
140 missile.nextthink = time + WEP_CVAR_SEC(hlac, lifetime);
142 missile.flags = FL_PROJECTILE;
143 missile.missile_flags = MIF_SPLASH;
144 missile.projectiledeathtype = WEP_HLAC | HITTYPE_SECONDARY;
146 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
148 other = missile; MUTATOR_CALLHOOK(EditProjectile);
151 void W_HLAC_Attack2 (void)
155 W_DecreaseAmmo(ammo_cells, WEP_CVAR_SEC(hlac, ammo), autocvar_g_balance_hlac_reload_ammo);
157 for(i=WEP_CVAR_SEC(hlac, shots);i>0;--i)
160 if (!autocvar_g_norecoil)
162 self.punchangle_x = random () - 0.5;
163 self.punchangle_y = random () - 0.5;
170 if(self.weapon != self.switchweapon) // abort immediately if switching
176 if (self.BUTTON_ATCK)
178 if (!WEP_ACTION(self.weapon, WR_CHECKAMMO1))
179 if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
181 W_SwitchWeapon_Force(self, w_getbestweapon(self));
186 ATTACK_FINISHED(self) = time + WEP_CVAR_PRI(hlac, refire) * W_WeaponRateFactor();
188 self.misc_bulletcounter = self.misc_bulletcounter + 1;
189 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), HLAC_fire1_02);
193 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hlac, animtime), w_ready);
197 float w_hlac(float req)
204 self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), FALSE);
209 if(autocvar_g_balance_hlac_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo))) // forced reload
210 WEP_ACTION(self.weapon, WR_RELOAD);
211 else if (self.BUTTON_ATCK)
213 if (weapon_prepareattack(0, WEP_CVAR_PRI(hlac, refire)))
215 self.misc_bulletcounter = 0;
217 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), HLAC_fire1_02);
221 else if (self.BUTTON_ATCK2 && WEP_CVAR(hlac, secondary))
223 if (weapon_prepareattack(1, WEP_CVAR_SEC(hlac, refire)))
226 weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(hlac, animtime), w_ready);
234 precache_model ("models/weapons/g_hlac.md3");
235 precache_model ("models/weapons/v_hlac.md3");
236 precache_model ("models/weapons/h_hlac.iqm");
237 precache_sound ("weapons/lasergun_fire.wav");
238 HLAC_SETTINGS(WEP_SKIPCVAR, WEP_SET_PROP)
243 self.current_ammo = ammo_cells;
248 ammo_amount = self.ammo_cells >= WEP_CVAR_PRI(hlac, ammo);
249 ammo_amount += self.(weapon_load[WEP_HLAC]) >= WEP_CVAR_PRI(hlac, ammo);
254 ammo_amount = self.ammo_cells >= WEP_CVAR_SEC(hlac, ammo);
255 ammo_amount += self.(weapon_load[WEP_HLAC]) >= WEP_CVAR_SEC(hlac, ammo);
260 HLAC_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
265 W_Reload(min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), "weapons/reload.wav");
268 case WR_SUICIDEMESSAGE:
270 return WEAPON_HLAC_SUICIDE;
274 return WEAPON_HLAC_MURDER;
281 float w_hlac(float req)
285 case WR_IMPACTEFFECT:
288 org2 = w_org + w_backoff * 6;
289 pointparticles(particleeffectnum("laser_impact"), org2, w_backoff * 1000, 1);
291 sound(self, CH_SHOTS, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM);
297 precache_sound("weapons/laserimpact.wav");