5 /* ammotype */ ammo_cells,
7 /* flags */ WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH,
8 /* rating */ BOT_PICKUP_RATING_MID,
12 /* fullname */ _("Heavy Laser Assault Cannon")
15 #define HLAC_SETTINGS(w_cvar,w_prop) HLAC_SETTINGS_LIST(w_cvar, w_prop, HLAC, hlac)
16 #define HLAC_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
17 w_cvar(id, sn, BOTH, ammo) \
18 w_cvar(id, sn, BOTH, animtime) \
19 w_cvar(id, sn, BOTH, damage) \
20 w_cvar(id, sn, BOTH, edgedamage) \
21 w_cvar(id, sn, BOTH, force) \
22 w_cvar(id, sn, BOTH, lifetime) \
23 w_cvar(id, sn, BOTH, radius) \
24 w_cvar(id, sn, BOTH, refire) \
25 w_cvar(id, sn, BOTH, speed) \
26 w_cvar(id, sn, BOTH, spread_crouchmod) \
27 w_cvar(id, sn, PRI, spread_add) \
28 w_cvar(id, sn, PRI, spread_max) \
29 w_cvar(id, sn, PRI, spread_min) \
30 w_cvar(id, sn, NONE, secondary) \
31 w_cvar(id, sn, SEC, shots) \
32 w_cvar(id, sn, SEC, spread) \
33 w_prop(id, sn, float, reloading_ammo, reload_ammo) \
34 w_prop(id, sn, float, reloading_time, reload_time) \
35 w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
36 w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
37 w_prop(id, sn, string, weaponreplace, weaponreplace) \
38 w_prop(id, sn, float, weaponstart, weaponstart) \
39 w_prop(id, sn, float, weaponstartoverride, weaponstartoverride)
42 HLAC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
46 void spawnfunc_weapon_hlac() { weapon_defaultspawnfunc(WEP_HLAC); }
48 void W_HLAC_Touch (void)
54 self.event_damage = func_null;
56 isprimary = !(self.projectiledeathtype & HITTYPE_SECONDARY);
58 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);
63 void W_HLAC_Attack (void)
68 W_DecreaseAmmo(WEP_CVAR_PRI(hlac, ammo));
70 spread = WEP_CVAR_PRI(hlac, spread_min) + (WEP_CVAR_PRI(hlac, spread_add) * self.misc_bulletcounter);
71 spread = min(spread,WEP_CVAR_PRI(hlac, spread_max));
73 spread = spread * WEP_CVAR_PRI(hlac, spread_crouchmod);
75 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_A, WEP_CVAR_PRI(hlac, damage));
76 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
77 if (!autocvar_g_norecoil)
79 self.punchangle_x = random () - 0.5;
80 self.punchangle_y = random () - 0.5;
84 missile.owner = missile.realowner = self;
85 missile.classname = "hlacbolt";
86 missile.bot_dodge = TRUE;
88 missile.bot_dodgerating = WEP_CVAR_PRI(hlac, damage);
90 missile.movetype = MOVETYPE_FLY;
91 PROJECTILE_MAKETRIGGER(missile);
93 setorigin (missile, w_shotorg);
94 setsize(missile, '0 0 0', '0 0 0');
96 W_SetupProjVelocity_Basic(missile, WEP_CVAR_PRI(hlac, speed), spread);
97 //missile.angles = vectoangles (missile.velocity); // csqc
99 missile.touch = W_HLAC_Touch;
100 missile.think = SUB_Remove;
102 missile.nextthink = time + WEP_CVAR_PRI(hlac, lifetime);
104 missile.flags = FL_PROJECTILE;
105 missile.projectiledeathtype = WEP_HLAC;
107 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
109 other = missile; MUTATOR_CALLHOOK(EditProjectile);
112 void W_HLAC_Attack2()
117 spread = WEP_CVAR_SEC(hlac, spread);
121 spread = spread * WEP_CVAR_SEC(hlac, spread_crouchmod);
123 W_SetupShot (self, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(hlac, damage));
124 pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
127 missile.owner = missile.realowner = self;
128 missile.classname = "hlacbolt";
129 missile.bot_dodge = TRUE;
131 missile.bot_dodgerating = WEP_CVAR_SEC(hlac, damage);
133 missile.movetype = MOVETYPE_FLY;
134 PROJECTILE_MAKETRIGGER(missile);
136 setorigin (missile, w_shotorg);
137 setsize(missile, '0 0 0', '0 0 0');
139 W_SetupProjVelocity_Basic(missile, WEP_CVAR_SEC(hlac, speed), spread);
140 //missile.angles = vectoangles (missile.velocity); // csqc
142 missile.touch = W_HLAC_Touch;
143 missile.think = SUB_Remove;
145 missile.nextthink = time + WEP_CVAR_SEC(hlac, lifetime);
147 missile.flags = FL_PROJECTILE;
148 missile.missile_flags = MIF_SPLASH;
149 missile.projectiledeathtype = WEP_HLAC | HITTYPE_SECONDARY;
151 CSQCProjectile(missile, TRUE, PROJECTILE_HLAC, TRUE);
153 other = missile; MUTATOR_CALLHOOK(EditProjectile);
157 void W_HLAC_Attack_Frame()
159 if(self.weapon != self.switchweapon) // abort immediately if switching
165 if (self.BUTTON_ATCK)
167 if (!WEP_ACTION(self.weapon, WR_CHECKAMMO1))
168 if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
170 W_SwitchWeapon_Force(self, w_getbestweapon(self));
175 ATTACK_FINISHED(self) = time + WEP_CVAR_PRI(hlac, refire) * W_WeaponRateFactor();
177 self.misc_bulletcounter = self.misc_bulletcounter + 1;
178 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
182 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hlac, animtime), w_ready);
186 void W_HLAC_Attack2_Frame()
190 W_DecreaseAmmo(WEP_CVAR_SEC(hlac, ammo));
192 for(i=WEP_CVAR_SEC(hlac, shots);i>0;--i)
195 if (!autocvar_g_norecoil)
197 self.punchangle_x = random () - 0.5;
198 self.punchangle_y = random () - 0.5;
202 float W_HLAC(float req)
209 self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), FALSE);
214 if(autocvar_g_balance_hlac_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo))) // forced reload
215 WEP_ACTION(self.weapon, WR_RELOAD);
216 else if (self.BUTTON_ATCK)
218 if (weapon_prepareattack(0, WEP_CVAR_PRI(hlac, refire)))
220 self.misc_bulletcounter = 0;
222 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
226 else if (self.BUTTON_ATCK2 && WEP_CVAR(hlac, secondary))
228 if (weapon_prepareattack(1, WEP_CVAR_SEC(hlac, refire)))
230 W_HLAC_Attack2_Frame();
231 weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(hlac, animtime), w_ready);
239 precache_model ("models/weapons/g_hlac.md3");
240 precache_model ("models/weapons/v_hlac.md3");
241 precache_model ("models/weapons/h_hlac.iqm");
242 precache_sound ("weapons/lasergun_fire.wav");
243 HLAC_SETTINGS(WEP_SKIPCVAR, WEP_SET_PROP)
248 ammo_amount = self.AMMO_VAL(WEP_HLAC) >= WEP_CVAR_PRI(hlac, ammo);
249 ammo_amount += self.(weapon_load[WEP_HLAC]) >= WEP_CVAR_PRI(hlac, ammo);
254 ammo_amount = self.AMMO_VAL(WEP_HLAC) >= 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");