4 void() hagar_deselect_01;
5 void() hagar_select_01;
9 if (self.ammo_rockets >= cvar("g_balance_hagar_primary_ammo"))
14 float() hagar_check2 =
16 if (self.ammo_rockets >= cvar("g_balance_hagar_secondary_ammo"))
21 void(float req) w_hagar =
25 else if (req == WR_FIRE1)
26 weapon_prepareattack(hagar_check, hagar_check, hagar_fire1_01, cvar("g_balance_hagar_primary_refire"));
27 else if (req == WR_FIRE2)
28 weapon_prepareattack(hagar_check, hagar_check, hagar_fire2_01, cvar("g_balance_hagar_secondary_refire"));
29 else if (req == WR_RAISE)
31 else if (req == WR_UPDATECOUNTS)
32 self.currentammo = self.ammo_rockets;
33 else if (req == WR_DROP)
35 else if (req == WR_SETUP)
36 weapon_setup(WEP_HAGAR, "w_hagar.zym", IT_ROCKETS);
37 else if (req == WR_CHECKAMMO)
38 weapon_hasammo = hagar_check() + hagar_check2();
41 void W_Hagar_Explode (void)
45 org2 = findbetterlocation (self.origin);
47 effect (org2, "models/sprites/hagar.spr", 0, 12, 35);
50 sound (self, CHAN_BODY, "weapons/hagexp1.ogg", 1, ATTN_NORM);
52 sound (self, CHAN_BODY, "weapons/hagexp2.ogg", 1, ATTN_NORM);
54 sound (self, CHAN_BODY, "weapons/hagexp3.ogg", 1, ATTN_NORM);
56 self.event_damage = SUB_Null;
57 RadiusDamage (self, self.owner, cvar("g_balance_hagar_primary_damage"), cvar("g_balance_hagar_primary_edgedamage"), cvar("g_balance_hagar_primary_radius"), world, cvar("g_balance_hagar_primary_force"), IT_HAGAR);
62 void W_Hagar_Explode2 (void)
66 org2 = findbetterlocation (self.origin);
68 effect (org2, "models/sprites/hagar.spr", 0, 12, 35);
71 sound (self, CHAN_BODY, "weapons/hagexp1.ogg", 1, ATTN_NORM);
73 sound (self, CHAN_BODY, "weapons/hagexp2.ogg", 1, ATTN_NORM);
75 sound (self, CHAN_BODY, "weapons/hagexp3.ogg", 1, ATTN_NORM);
77 self.event_damage = SUB_Null;
78 RadiusDamage (self, self.owner, cvar("g_balance_hagar_secondary_damage"), cvar("g_balance_hagar_secondary_edgedamage"), cvar("g_balance_hagar_secondary_radius"), world, cvar("g_balance_hagar_secondary_force"), IT_HAGAR);
83 void W_Hagar_Touch (void)
85 if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
90 if (other == self.owner)
96 void W_Hagar_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
98 self.health = self.health - damage;
103 void W_Hagar_Attack (void)
105 local entity missile;
108 local vector trueaim;
109 trueaim = W_TrueAim();
111 sound (self, CHAN_WEAPON, "weapons/hagar_fire.ogg", 1, ATTN_NORM);
112 if (self.items & IT_STRENGTH)
113 sound (self, CHAN_AUTO, "weapons/strength_fire.ogg", 1, ATTN_NORM);
115 if (cvar("g_use_ammunition"))
116 self.ammo_rockets = self.ammo_rockets - cvar("g_balance_hagar_primary_ammo");
117 self.punchangle_x = -2;
118 org = W_MuzzleOrigin (self, '18 5 -8');
121 missile.owner = self;
122 missile.classname = "missile";
123 missile.touch = W_Hagar_Touch;
124 missile.think = W_Hagar_Explode;
125 missile.nextthink = time + cvar("g_balance_hagar_primary_lifetime");
126 missile.solid = SOLID_BBOX;
127 missile.scale = 0.4; // BUG: the model is too big
128 setorigin (missile, org);
129 setmodel (missile, "models/hagarmissile.mdl");
130 setsize (missile, '0 0 0', '0 0 0');
131 //missile.takedamage = DAMAGE_YES;
132 //missile.damageforcescale = 4;
133 //missile.health = 10;
134 //missile.event_damage = W_Hagar_Damage;
135 missile.effects = EF_LOWPRECISION | EF_NOSHADOW | EF_FULLBRIGHT;
137 missile.movetype = MOVETYPE_FLY;
138 missile.velocity = (normalize(trueaim - org) + randomvec() * cvar("g_balance_hagar_primary_spread")) * cvar("g_balance_hagar_primary_speed");
140 missile.angles = vectoangles (missile.velocity);
143 void W_Hagar_Attack2 (void)
145 local entity missile;
148 local vector trueaim;
149 trueaim = W_TrueAim();
151 sound (self, CHAN_WEAPON, "weapons/hagar_fire.ogg", 1, ATTN_NORM);
152 if (self.items & IT_STRENGTH)
153 sound (self, CHAN_AUTO, "weapons/strength_fire.ogg", 1, ATTN_NORM);
155 if (cvar("g_use_ammunition"))
156 self.ammo_rockets = self.ammo_rockets - cvar("g_balance_hagar_secondary_ammo");
157 self.punchangle_x = -2;
158 org = W_MuzzleOrigin (self, '18 5 -8');
161 missile.owner = self;
162 missile.classname = "missile";
163 missile.touch = W_Hagar_Touch;
164 missile.think = W_Hagar_Explode;
165 missile.nextthink = time + cvar("g_balance_hagar_secondary_lifetime");
166 missile.solid = SOLID_BBOX;
167 missile.scale = 0.4; // BUG: the model is too big
168 setorigin (missile, org);
169 setmodel (missile, "models/hagarmissile.mdl");
170 setsize (missile, '0 0 0', '0 0 0');
171 //missile.takedamage = DAMAGE_YES;
172 //missile.damageforcescale = 4;
173 //missile.health = 10;
174 //missile.event_damage = W_Hagar_Damage;
175 missile.effects = EF_LOWPRECISION | EF_NOSHADOW | EF_FULLBRIGHT;
177 missile.movetype = MOVETYPE_TOSS;
178 missile.velocity = (v_forward + randomvec() * cvar("g_balance_hagar_secondary_spread")) * cvar("g_balance_hagar_secondary_speed") + v_up * cvar("g_balance_hagar_secondary_speed_up");
179 missile.avelocity = '100 10 10';
181 missile.angles = vectoangles (missile.velocity);
185 void() hagar_ready_01 = {weapon_thinkf(WFRAME_IDLE, 0.1, hagar_ready_01); self.weaponentity.state = WS_READY;};
186 void() hagar_select_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_ready); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');};
187 void() hagar_deselect_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_clear); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);};
188 void() hagar_fire1_01 =
190 self.attack_finished = time + cvar("g_balance_hagar_primary_refire");
191 weapon_doattack(hagar_check, hagar_check, W_Hagar_Attack);
192 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hagar_primary_refire"), hagar_ready_01);
194 void() hagar_fire2_01 =
196 self.attack_finished = time + cvar("g_balance_hagar_secondary_refire");
197 weapon_doattack(hagar_check2, hagar_check2, W_Hagar_Attack2);
198 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hagar_secondary_refire"), hagar_ready_01);