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 (other == self.owner)
87 else if (pointcontents (self.origin) == CONTENT_SKY)
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();
112 sound (self, CHAN_WEAPON, "weapons/hagar_fire.ogg", 1, ATTN_NORM);
113 if (self.items & IT_STRENGTH) {
114 sound (self, CHAN_AUTO, "weapons/strength_fire.ogg", 1, ATTN_NORM);
117 if (cvar("g_use_ammunition"))
118 self.ammo_rockets = self.ammo_rockets - cvar("g_balance_hagar_primary_ammo");
119 self.punchangle_x = -2;
120 org = self.origin + self.view_ofs + v_forward * 15 + v_right * 5 + v_up * -8;
123 missile.owner = self;
124 missile.classname = "missile";
125 missile.touch = W_Hagar_Touch;
126 missile.think = W_Hagar_Explode;
127 missile.nextthink = time + cvar("g_balance_hagar_primary_lifetime");
128 missile.solid = SOLID_BBOX;
129 missile.scale = 0.4; // BUG: the model is too big
130 setorigin (missile, org);
131 setmodel (missile, "models/hagarmissile.mdl");
132 setsize (missile, '0 0 0', '0 0 0');
133 //missile.takedamage = DAMAGE_YES;
134 //missile.damageforcescale = 4;
135 //missile.health = 10;
136 //missile.event_damage = W_Hagar_Damage;
137 missile.effects = EF_LOWPRECISION | EF_NOSHADOW | EF_FULLBRIGHT;
139 missile.movetype = MOVETYPE_FLY;
140 missile.velocity = (normalize(trueaim - org) + randomvec() * cvar("g_balance_hagar_primary_spread")) * cvar("g_balance_hagar_primary_speed");
142 missile.angles = vectoangles (missile.velocity);
145 void W_Hagar_Attack2 (void)
147 local entity missile;
150 local vector trueaim;
151 trueaim = W_TrueAim();
154 sound (self, CHAN_WEAPON, "weapons/hagar_fire.ogg", 1, ATTN_NORM);
155 if (self.items & IT_STRENGTH) {
156 sound (self, CHAN_AUTO, "weapons/strength_fire.ogg", 1, ATTN_NORM);
159 if (cvar("g_use_ammunition"))
160 self.ammo_rockets = self.ammo_rockets - cvar("g_balance_hagar_secondary_ammo");
161 self.punchangle_x = -2;
162 org = self.origin + self.view_ofs + v_forward * 15 + v_right * 5 + v_up * -8;
165 missile.owner = self;
166 missile.classname = "missile";
167 missile.touch = W_Hagar_Touch;
168 missile.think = W_Hagar_Explode;
169 missile.nextthink = time + cvar("g_balance_hagar_secondary_lifetime");
170 missile.solid = SOLID_BBOX;
171 missile.scale = 0.4; // BUG: the model is too big
172 setorigin (missile, org);
173 setmodel (missile, "models/hagarmissile.mdl");
174 setsize (missile, '0 0 0', '0 0 0');
175 //missile.takedamage = DAMAGE_YES;
176 //missile.damageforcescale = 4;
177 //missile.health = 10;
178 //missile.event_damage = W_Hagar_Damage;
179 missile.effects = EF_LOWPRECISION | EF_NOSHADOW | EF_FULLBRIGHT;
181 missile.movetype = MOVETYPE_TOSS;
182 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");
183 missile.avelocity = '100 10 10';
185 missile.angles = vectoangles (missile.velocity);
189 void() hagar_ready_01 = {weapon_thinkf(WFRAME_IDLE, 0.1, hagar_ready_01); self.weaponentity.state = WS_READY;};
190 void() hagar_select_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_ready); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');};
191 void() hagar_deselect_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_clear); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);};
192 void() hagar_fire1_01 =
194 weapon_doattack(hagar_check, hagar_check, W_Hagar_Attack);
195 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hagar_primary_refire"), hagar_ready_01);
197 void() hagar_fire2_01 =
199 weapon_doattack(hagar_check, hagar_check, W_Hagar_Attack2);
200 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hagar_secondary_refire"), hagar_ready_01);