5 /* ammotype */ ammo_cells,
7 /* flags */ WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH,
8 /* rating */ BOT_PICKUP_RATING_MID,
10 /* modelname */ "hlac",
11 /* simplemdl */ "foobar",
12 /* crosshair */ "gfx/crosshairhlac 0.6",
13 /* wepimg */ "weaponhlac",
15 /* wepname */ _("Heavy Laser Assault Cannon")
18 #define HLAC_SETTINGS(w_cvar,w_prop) HLAC_SETTINGS_LIST(w_cvar, w_prop, HLAC, hlac)
19 #define HLAC_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
20 w_cvar(id, sn, BOTH, ammo) \
21 w_cvar(id, sn, BOTH, animtime) \
22 w_cvar(id, sn, BOTH, damage) \
23 w_cvar(id, sn, BOTH, edgedamage) \
24 w_cvar(id, sn, BOTH, force) \
25 w_cvar(id, sn, BOTH, lifetime) \
26 w_cvar(id, sn, BOTH, radius) \
27 w_cvar(id, sn, BOTH, refire) \
28 w_cvar(id, sn, BOTH, speed) \
29 w_cvar(id, sn, BOTH, spread_crouchmod) \
30 w_cvar(id, sn, PRI, spread_add) \
31 w_cvar(id, sn, PRI, spread_max) \
32 w_cvar(id, sn, PRI, spread_min) \
33 w_cvar(id, sn, NONE, secondary) \
34 w_cvar(id, sn, SEC, shots) \
35 w_cvar(id, sn, SEC, spread) \
36 w_prop(id, sn, float, reloading_ammo, reload_ammo) \
37 w_prop(id, sn, float, reloading_time, reload_time) \
38 w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
39 w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
40 w_prop(id, sn, string, weaponreplace, weaponreplace) \
41 w_prop(id, sn, float, weaponstart, weaponstart) \
42 w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
43 w_prop(id, sn, float, weaponthrowable, weaponthrowable)
46 HLAC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
51 void spawnfunc_weapon_hlac(void) { weapon_defaultspawnfunc(WEP_HLAC.m_id); }
53 void W_HLAC_Touch(void)
59 self.event_damage = func_null;
61 isprimary = !(self.projectiledeathtype & HITTYPE_SECONDARY);
63 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);
68 void W_HLAC_Attack(void)
73 W_DecreaseAmmo(WEP_CVAR_PRI(hlac, ammo));
75 spread = WEP_CVAR_PRI(hlac, spread_min) + (WEP_CVAR_PRI(hlac, spread_add) * self.misc_bulletcounter);
76 spread = min(spread,WEP_CVAR_PRI(hlac, spread_max));
78 spread = spread * WEP_CVAR_PRI(hlac, spread_crouchmod);
80 W_SetupShot(self, false, 3, W_Sound("lasergun_fire"), CH_WEAPON_A, WEP_CVAR_PRI(hlac, damage));
81 Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
82 if(!autocvar_g_norecoil)
84 self.punchangle_x = random() - 0.5;
85 self.punchangle_y = random() - 0.5;
89 missile.owner = missile.realowner = self;
90 missile.classname = "hlacbolt";
91 missile.bot_dodge = true;
93 missile.bot_dodgerating = WEP_CVAR_PRI(hlac, damage);
95 missile.movetype = MOVETYPE_FLY;
96 PROJECTILE_MAKETRIGGER(missile);
98 setorigin(missile, w_shotorg);
99 setsize(missile, '0 0 0', '0 0 0');
101 W_SetupProjVelocity_Basic(missile, WEP_CVAR_PRI(hlac, speed), spread);
102 //missile.angles = vectoangles(missile.velocity); // csqc
104 missile.touch = W_HLAC_Touch;
105 missile.think = SUB_Remove;
107 missile.nextthink = time + WEP_CVAR_PRI(hlac, lifetime);
109 missile.flags = FL_PROJECTILE;
110 missile.projectiledeathtype = WEP_HLAC.m_id;
112 CSQCProjectile(missile, true, PROJECTILE_HLAC, true);
114 MUTATOR_CALLHOOK(EditProjectile, self, missile);
117 void W_HLAC_Attack2(void)
122 spread = WEP_CVAR_SEC(hlac, spread);
126 spread = spread * WEP_CVAR_SEC(hlac, spread_crouchmod);
128 W_SetupShot(self, false, 3, W_Sound("lasergun_fire"), CH_WEAPON_A, WEP_CVAR_SEC(hlac, damage));
129 Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
132 missile.owner = missile.realowner = self;
133 missile.classname = "hlacbolt";
134 missile.bot_dodge = true;
136 missile.bot_dodgerating = WEP_CVAR_SEC(hlac, damage);
138 missile.movetype = MOVETYPE_FLY;
139 PROJECTILE_MAKETRIGGER(missile);
141 setorigin(missile, w_shotorg);
142 setsize(missile, '0 0 0', '0 0 0');
144 W_SetupProjVelocity_Basic(missile, WEP_CVAR_SEC(hlac, speed), spread);
145 //missile.angles = vectoangles(missile.velocity); // csqc
147 missile.touch = W_HLAC_Touch;
148 missile.think = SUB_Remove;
150 missile.nextthink = time + WEP_CVAR_SEC(hlac, lifetime);
152 missile.flags = FL_PROJECTILE;
153 missile.missile_flags = MIF_SPLASH;
154 missile.projectiledeathtype = WEP_HLAC.m_id | HITTYPE_SECONDARY;
156 CSQCProjectile(missile, true, PROJECTILE_HLAC, true);
158 MUTATOR_CALLHOOK(EditProjectile, self, missile);
162 void W_HLAC_Attack_Frame(void)
164 if(self.weapon != self.switchweapon) // abort immediately if switching
172 if(!WEP_ACTION(self.weapon, WR_CHECKAMMO1))
173 if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
175 W_SwitchWeapon_Force(self, w_getbestweapon(self));
180 ATTACK_FINISHED(self) = time + WEP_CVAR_PRI(hlac, refire) * W_WeaponRateFactor();
182 self.misc_bulletcounter = self.misc_bulletcounter + 1;
183 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
187 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hlac, animtime), w_ready);
191 void W_HLAC_Attack2_Frame(void)
195 W_DecreaseAmmo(WEP_CVAR_SEC(hlac, ammo));
197 for(i=WEP_CVAR_SEC(hlac, shots);i>0;--i)
200 if(!autocvar_g_norecoil)
202 self.punchangle_x = random() - 0.5;
203 self.punchangle_y = random() - 0.5;
214 self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), false);
219 if(autocvar_g_balance_hlac_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo))) // forced reload
220 WEP_ACTION(self.weapon, WR_RELOAD);
221 else if(self.BUTTON_ATCK)
223 if(weapon_prepareattack(0, WEP_CVAR_PRI(hlac, refire)))
225 self.misc_bulletcounter = 0;
227 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
231 else if(self.BUTTON_ATCK2 && WEP_CVAR(hlac, secondary))
233 if(weapon_prepareattack(1, WEP_CVAR_SEC(hlac, refire)))
235 W_HLAC_Attack2_Frame();
236 weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(hlac, animtime), w_ready);
244 precache_model(W_Model("g_hlac.md3"));
245 precache_model(W_Model("v_hlac.md3"));
246 precache_model(W_Model("h_hlac.iqm"));
247 precache_sound(W_Sound("lasergun_fire"));
248 HLAC_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
253 ammo_amount = self.WEP_AMMO(HLAC) >= WEP_CVAR_PRI(hlac, ammo);
254 ammo_amount += self.(weapon_load[WEP_HLAC.m_id]) >= WEP_CVAR_PRI(hlac, ammo);
259 ammo_amount = self.WEP_AMMO(HLAC) >= WEP_CVAR_SEC(hlac, ammo);
260 ammo_amount += self.(weapon_load[WEP_HLAC.m_id]) >= WEP_CVAR_SEC(hlac, ammo);
265 HLAC_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
270 W_Reload(min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), W_Sound("reload"));
273 case WR_SUICIDEMESSAGE:
275 return WEAPON_HLAC_SUICIDE;
279 return WEAPON_HLAC_MURDER;
290 case WR_IMPACTEFFECT:
293 org2 = w_org + w_backoff * 6;
294 pointparticles(particleeffectnum(EFFECT_BLASTER_IMPACT), org2, w_backoff * 1000, 1);
296 sound(self, CH_SHOTS, W_Sound("laserimpact"), VOL_BASE, ATTN_NORM);
302 precache_sound(W_Sound("laserimpact"));
307 // no weapon specific image for this weapon