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) HLAC_SETTINGS_LIST(w_cvar, w_prop, HLAC, hlac)
15 #define HLAC_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
16 w_cvar(id, sn, MO_BOTH, ammo) \
17 w_cvar(id, sn, MO_BOTH, animtime) \
18 w_cvar(id, sn, MO_BOTH, damage) \
19 w_cvar(id, sn, MO_BOTH, edgedamage) \
20 w_cvar(id, sn, MO_BOTH, force) \
21 w_cvar(id, sn, MO_BOTH, lifetime) \
22 w_cvar(id, sn, MO_BOTH, radius) \
23 w_cvar(id, sn, MO_BOTH, refire) \
24 w_cvar(id, sn, MO_BOTH, speed) \
25 w_cvar(id, sn, MO_BOTH, spread_crouchmod) \
26 w_cvar(id, sn, MO_PRI, spread_add) \
27 w_cvar(id, sn, MO_PRI, spread_max) \
28 w_cvar(id, sn, MO_PRI, spread_min) \
29 w_cvar(id, sn, MO_NONE, secondary) \
30 w_cvar(id, sn, MO_SEC, shots) \
31 w_cvar(id, sn, MO_SEC, spread) \
32 w_prop(id, sn, float, reloading_ammo, reload_ammo) \
33 w_prop(id, sn, float, reloading_time, reload_time) \
34 w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
35 w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
36 w_prop(id, sn, string, weaponreplace, weaponreplace) \
37 w_prop(id, sn, float, weaponstart, weaponstart) \
38 w_prop(id, sn, float, weaponstartoverride, weaponstartoverride)
41 HLAC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
45 void spawnfunc_weapon_hlac() { weapon_defaultspawnfunc(WEP_HLAC); }
47 void W_HLAC_Touch (void)
53 self.event_damage = func_null;
55 isprimary = !(self.projectiledeathtype & HITTYPE_SECONDARY);
57 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);
62 void W_HLAC_Attack (void)
67 W_DecreaseAmmo(ammo_cells, WEP_CVAR_PRI(hlac, ammo), autocvar_g_balance_hlac_reload_ammo);
69 spread = WEP_CVAR_PRI(hlac, spread_min) + (WEP_CVAR_PRI(hlac, spread_add) * self.misc_bulletcounter);
70 spread = min(spread,WEP_CVAR_PRI(hlac, spread_max));
72 spread = spread * WEP_CVAR_PRI(hlac, spread_crouchmod);
74 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_A, WEP_CVAR_PRI(hlac, damage));
75 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
76 if (!autocvar_g_norecoil)
78 self.punchangle_x = random () - 0.5;
79 self.punchangle_y = random () - 0.5;
83 missile.owner = missile.realowner = self;
84 missile.classname = "hlacbolt";
85 missile.bot_dodge = TRUE;
87 missile.bot_dodgerating = WEP_CVAR_PRI(hlac, damage);
89 missile.movetype = MOVETYPE_FLY;
90 PROJECTILE_MAKETRIGGER(missile);
92 setorigin (missile, w_shotorg);
93 setsize(missile, '0 0 0', '0 0 0');
95 W_SetupProjectileVelocity(missile, WEP_CVAR_PRI(hlac, speed), spread);
96 //missile.angles = vectoangles (missile.velocity); // csqc
98 missile.touch = W_HLAC_Touch;
99 missile.think = SUB_Remove;
101 missile.nextthink = time + WEP_CVAR_PRI(hlac, lifetime);
103 missile.flags = FL_PROJECTILE;
104 missile.projectiledeathtype = WEP_HLAC;
106 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
108 other = missile; MUTATOR_CALLHOOK(EditProjectile);
111 void W_HLAC_Attack2f (void)
116 spread = WEP_CVAR_SEC(hlac, spread);
120 spread = spread * WEP_CVAR_SEC(hlac, spread_crouchmod);
122 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(hlac, damage));
123 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
126 missile.owner = missile.realowner = self;
127 missile.classname = "hlacbolt";
128 missile.bot_dodge = TRUE;
130 missile.bot_dodgerating = WEP_CVAR_SEC(hlac, damage);
132 missile.movetype = MOVETYPE_FLY;
133 PROJECTILE_MAKETRIGGER(missile);
135 setorigin (missile, w_shotorg);
136 setsize(missile, '0 0 0', '0 0 0');
138 W_SetupProjectileVelocity(missile, WEP_CVAR_SEC(hlac, speed), spread);
139 //missile.angles = vectoangles (missile.velocity); // csqc
141 missile.touch = W_HLAC_Touch;
142 missile.think = SUB_Remove;
144 missile.nextthink = time + WEP_CVAR_SEC(hlac, lifetime);
146 missile.flags = FL_PROJECTILE;
147 missile.missile_flags = MIF_SPLASH;
148 missile.projectiledeathtype = WEP_HLAC | HITTYPE_SECONDARY;
150 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
152 other = missile; MUTATOR_CALLHOOK(EditProjectile);
155 void W_HLAC_Attack2 (void)
159 W_DecreaseAmmo(ammo_cells, WEP_CVAR_SEC(hlac, ammo), autocvar_g_balance_hlac_reload_ammo);
161 for(i=WEP_CVAR_SEC(hlac, shots);i>0;--i)
164 if (!autocvar_g_norecoil)
166 self.punchangle_x = random () - 0.5;
167 self.punchangle_y = random () - 0.5;
174 if(self.weapon != self.switchweapon) // abort immediately if switching
180 if (self.BUTTON_ATCK)
182 if (!WEP_ACTION(self.weapon, WR_CHECKAMMO1))
183 if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
185 W_SwitchWeapon_Force(self, w_getbestweapon(self));
190 ATTACK_FINISHED(self) = time + WEP_CVAR_PRI(hlac, refire) * W_WeaponRateFactor();
192 self.misc_bulletcounter = self.misc_bulletcounter + 1;
193 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), HLAC_fire1_02);
197 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hlac, animtime), w_ready);
201 float w_hlac(float req)
208 self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), FALSE);
213 if(autocvar_g_balance_hlac_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo))) // forced reload
214 WEP_ACTION(self.weapon, WR_RELOAD);
215 else if (self.BUTTON_ATCK)
217 if (weapon_prepareattack(0, WEP_CVAR_PRI(hlac, refire)))
219 self.misc_bulletcounter = 0;
221 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), HLAC_fire1_02);
225 else if (self.BUTTON_ATCK2 && WEP_CVAR(hlac, secondary))
227 if (weapon_prepareattack(1, WEP_CVAR_SEC(hlac, refire)))
230 weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(hlac, animtime), w_ready);
238 precache_model ("models/weapons/g_hlac.md3");
239 precache_model ("models/weapons/v_hlac.md3");
240 precache_model ("models/weapons/h_hlac.iqm");
241 precache_sound ("weapons/lasergun_fire.wav");
242 HLAC_SETTINGS(WEP_SKIPCVAR, WEP_SET_PROP)
247 self.current_ammo = ammo_cells;
252 ammo_amount = self.ammo_cells >= WEP_CVAR_PRI(hlac, ammo);
253 ammo_amount += self.(weapon_load[WEP_HLAC]) >= WEP_CVAR_PRI(hlac, ammo);
258 ammo_amount = self.ammo_cells >= WEP_CVAR_SEC(hlac, ammo);
259 ammo_amount += self.(weapon_load[WEP_HLAC]) >= WEP_CVAR_SEC(hlac, ammo);
264 HLAC_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
269 W_Reload(min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), "weapons/reload.wav");
272 case WR_SUICIDEMESSAGE:
274 return WEAPON_HLAC_SUICIDE;
278 return WEAPON_HLAC_MURDER;
285 float w_hlac(float req)
289 case WR_IMPACTEFFECT:
292 org2 = w_org + w_backoff * 6;
293 pointparticles(particleeffectnum("laser_impact"), org2, w_backoff * 1000, 1);
295 sound(self, CH_SHOTS, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM);
301 precache_sound("weapons/laserimpact.wav");