Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
hagar.qc File Reference
#include "hagar.qh"
#include <common/items/item/ammo.qh>
Include dependency graph for hagar.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void W_Hagar_Attack (Weapon thiswep, entity actor,.entity weaponentity)
void W_Hagar_Attack2 (Weapon thiswep, entity actor,.entity weaponentity)
void W_Hagar_Attack2_Load (Weapon thiswep, entity actor,.entity weaponentity)
void W_Hagar_Attack2_Load_Release (Weapon thiswep, entity actor,.entity weaponentity)
void W_Hagar_Attack_Auto (Weapon thiswep, entity actor,.entity weaponentity, int fire)
void W_Hagar_Damage (entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
void W_Hagar_Explode (entity this, entity directhitentity)
void W_Hagar_Explode2 (entity this, entity directhitentity)
void W_Hagar_Explode2_use (entity this, entity actor, entity trigger)
void W_Hagar_Explode_use (entity this, entity actor, entity trigger)
void W_Hagar_Touch (entity this, entity toucher)
void W_Hagar_Touch2 (entity this, entity toucher)

Variables

float hagar_loadbeep
float hagar_loadblock
float hagar_loadstep
float hagar_warning

Function Documentation

◆ W_Hagar_Attack()

void W_Hagar_Attack ( Weapon thiswep,
entity actor,
.entity weaponentity )

Definition at line 98 of file hagar.qc.

99{
100 W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(WEP_HAGAR, ammo), weaponentity);
101
102 W_SetupShot(actor, weaponentity, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(WEP_HAGAR, damage), thiswep.m_id);
103
104 W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
105
106 entity missile;
107 missile = new(missile);
108 missile.owner = missile.realowner = actor;
109 missile.bot_dodge = true;
110 missile.bot_dodgerating = WEP_CVAR_PRI(WEP_HAGAR, damage);
111
112 missile.takedamage = DAMAGE_YES;
113 SetResourceExplicit(missile, RES_HEALTH, WEP_CVAR_PRI(WEP_HAGAR, health));
114 missile.damageforcescale = WEP_CVAR_PRI(WEP_HAGAR, damageforcescale);
115 missile.event_damage = W_Hagar_Damage;
116 missile.damagedbycontents = true;
118
119 settouch(missile, W_Hagar_Touch);
120 missile.use = W_Hagar_Explode_use;
122 missile.nextthink = time + WEP_CVAR_PRI(WEP_HAGAR, lifetime);
123 PROJECTILE_MAKETRIGGER(missile);
124 missile.projectiledeathtype = thiswep.m_id;
125 missile.weaponentity_fld = weaponentity;
126 setorigin(missile, w_shotorg);
127 setsize(missile, '0 0 0', '0 0 0');
128
129 set_movetype(missile, MOVETYPE_FLY);
130 W_SetupProjVelocity_PRI(missile, WEP_HAGAR);
131
132 missile.angles = vectoangles(missile.velocity);
133 missile.flags = FL_PROJECTILE;
134 IL_PUSH(g_projectiles, missile);
135 IL_PUSH(g_bot_dodge, missile);
136 missile.missile_flags = MIF_SPLASH;
137
138 CSQCProjectile(missile, true, PROJECTILE_HAGAR, true);
139
140 MUTATOR_CALLHOOK(EditProjectile, actor, missile);
141}
IntrusiveList g_bot_dodge
Definition api.qh:150
#define MUTATOR_CALLHOOK(id,...)
Definition base.qh:143
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
int m_id
Definition weapon.qh:43
float lifetime
Definition powerups.qc:23
const int FL_PROJECTILE
Definition constants.qh:85
float time
void CSQCProjectile(entity e, float clientanimate, int type, float docull)
IntrusiveList g_damagedbycontents
Definition damage.qh:143
float damageforcescale
void W_Hagar_Explode_use(entity this, entity actor, entity trigger)
Definition hagar.qc:25
void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
Definition hagar.qc:53
void W_Hagar_Touch(entity this, entity toucher)
Definition hagar.qc:76
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
vector vectoangles(vector v)
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
const int MOVETYPE_FLY
Definition movetypes.qh:134
const int PROJECTILE_HAGAR
float health
Legacy fields for the resources. To be removed.
Definition resources.qh:9
#define setthink(e, f)
#define settouch(e, f)
Definition self.qh:73
void adaptor_think2use_hittype_splash(entity this)
Definition common.qc:106
const int MIF_SPLASH
Definition common.qh:46
IntrusiveList g_projectiles
Definition common.qh:58
#define PROJECTILE_MAKETRIGGER(e)
Definition common.qh:34
const int CH_WEAPON_A
Definition sound.qh:7
const int DAMAGE_YES
Definition subs.qh:80
float ammo
Definition sv_turrets.qh:43
vector w_shotdir
Definition tracing.qh:20
#define W_SetupProjVelocity_PRI(ent, wep)
Definition tracing.qh:67
vector w_shotorg
Definition tracing.qh:19
#define W_SetupShot(ent, wepent, antilag, recoil, snd, chan, maxdamage, deathtype)
Definition tracing.qh:34
void W_MuzzleFlash(Weapon thiswep, entity actor,.entity weaponentity, vector shotorg, vector shotdir)
Definition all.qc:715
#define WEP_CVAR_PRI(wep, name)
Definition all.qh:338
void W_DecreaseAmmo(Weapon wep, entity actor, float ammo_use,.entity weaponentity)

References adaptor_think2use_hittype_splash(), ammo, CH_WEAPON_A, CSQCProjectile(), DAMAGE_YES, damageforcescale, entity(), FL_PROJECTILE, g_bot_dodge, g_damagedbycontents, g_projectiles, health, IL_PUSH(), lifetime, Weapon::m_id, MIF_SPLASH, MOVETYPE_FLY, MUTATOR_CALLHOOK, PROJECTILE_HAGAR, PROJECTILE_MAKETRIGGER, set_movetype(), SetResourceExplicit(), setthink, settouch, time, vectoangles(), W_DecreaseAmmo(), W_Hagar_Damage(), W_Hagar_Explode_use(), W_Hagar_Touch(), W_MuzzleFlash(), W_SetupProjVelocity_PRI, W_SetupShot, w_shotdir, w_shotorg, and WEP_CVAR_PRI.

Referenced by W_Hagar_Attack_Auto().

◆ W_Hagar_Attack2()

void W_Hagar_Attack2 ( Weapon thiswep,
entity actor,
.entity weaponentity )

Definition at line 143 of file hagar.qc.

144{
145 W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(WEP_HAGAR, ammo), weaponentity);
146
147 W_SetupShot(actor, weaponentity, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(WEP_HAGAR, damage), thiswep.m_id | HITTYPE_SECONDARY);
148
149 W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
150
151 entity missile;
152 missile = new(missile);
153 missile.owner = missile.realowner = actor;
154 missile.bot_dodge = true;
155 missile.bot_dodgerating = WEP_CVAR_SEC(WEP_HAGAR, damage);
156
157 missile.takedamage = DAMAGE_YES;
158 SetResourceExplicit(missile, RES_HEALTH, WEP_CVAR_SEC(WEP_HAGAR, health));
159 missile.damageforcescale = WEP_CVAR_SEC(WEP_HAGAR, damageforcescale);
160 missile.event_damage = W_Hagar_Damage;
161 missile.damagedbycontents = true;
163
164 settouch(missile, W_Hagar_Touch2);
165 missile.cnt = 0;
166 missile.use = W_Hagar_Explode2_use;
168 missile.nextthink = time + WEP_CVAR_SEC(WEP_HAGAR, lifetime_min) + random() * WEP_CVAR_SEC(WEP_HAGAR, lifetime_rand);
169 PROJECTILE_MAKETRIGGER(missile);
170 missile.projectiledeathtype = thiswep.m_id | HITTYPE_SECONDARY;
171 missile.weaponentity_fld = weaponentity;
172 setorigin(missile, w_shotorg);
173 setsize(missile, '0 0 0', '0 0 0');
174
176 W_SetupProjVelocity_SEC(missile, WEP_HAGAR);
177
178 missile.angles = vectoangles(missile.velocity);
179 missile.flags = FL_PROJECTILE;
180 IL_PUSH(g_projectiles, missile);
181 IL_PUSH(g_bot_dodge, missile);
182 missile.missile_flags = MIF_SPLASH;
183
184 CSQCProjectile(missile, true, PROJECTILE_HAGAR_BOUNCING, true);
185
186 MUTATOR_CALLHOOK(EditProjectile, actor, missile);
187}
const int HITTYPE_SECONDARY
Definition all.qh:29
void W_Hagar_Explode2_use(entity this, entity actor, entity trigger)
Definition hagar.qc:48
void W_Hagar_Touch2(entity this, entity toucher)
Definition hagar.qc:82
float random(void)
const int MOVETYPE_BOUNCEMISSILE
Definition movetypes.qh:140
const int PROJECTILE_HAGAR_BOUNCING
#define W_SetupProjVelocity_SEC(ent, wep)
Definition tracing.qh:69
#define WEP_CVAR_SEC(wep, name)
Definition all.qh:339

References adaptor_think2use_hittype_splash(), ammo, CH_WEAPON_A, CSQCProjectile(), DAMAGE_YES, damageforcescale, entity(), FL_PROJECTILE, g_bot_dodge, g_damagedbycontents, g_projectiles, health, HITTYPE_SECONDARY, IL_PUSH(), Weapon::m_id, MIF_SPLASH, MOVETYPE_BOUNCEMISSILE, MUTATOR_CALLHOOK, PROJECTILE_HAGAR_BOUNCING, PROJECTILE_MAKETRIGGER, random(), set_movetype(), SetResourceExplicit(), setthink, settouch, time, vectoangles(), W_DecreaseAmmo(), W_Hagar_Damage(), W_Hagar_Explode2_use(), W_Hagar_Touch2(), W_MuzzleFlash(), W_SetupProjVelocity_SEC, W_SetupShot, w_shotdir, w_shotorg, and WEP_CVAR_SEC.

◆ W_Hagar_Attack2_Load()

void W_Hagar_Attack2_Load ( Weapon thiswep,
entity actor,
.entity weaponentity )

Definition at line 261 of file hagar.qc.

262{
263 // loadable hagar secondary attack, must always run each frame
264 if (time < game_starttime || time < actor.race_penalty || timeout_status == TIMEOUT_ACTIVE)
265 return;
266 if (weaponUseForbidden(actor))
267 return;
268
269 bool loaded = actor.(weaponentity).hagar_load >= WEP_CVAR_SEC(WEP_HAGAR, load_max);
270
271 // this is different than WR_CHECKAMMO when it comes to reloading
272 bool enough_ammo;
273 if (actor.items & IT_UNLIMITED_AMMO)
274 enough_ammo = true;
275 else if (autocvar_g_balance_hagar_reload_ammo)
276 enough_ammo = actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(WEP_HAGAR, ammo);
277 else
278 enough_ammo = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(WEP_HAGAR, ammo);
279
280 bool stopped = loaded || !enough_ammo;
281
282 if (PHYS_INPUT_BUTTON_ATCK2(actor))
283 {
284 if (PHYS_INPUT_BUTTON_ATCK(actor) && WEP_CVAR_SEC(WEP_HAGAR, load_abort))
285 {
286 if (actor.(weaponentity).hagar_load)
287 {
288 // if we pressed primary fire while loading, unload all rockets and abort
289 actor.(weaponentity).state = WS_READY;
290 W_DecreaseAmmo(thiswep, actor, -WEP_CVAR_SEC(WEP_HAGAR, ammo) * actor.(weaponentity).hagar_load, weaponentity); // give back ammo
291 actor.(weaponentity).hagar_load = 0;
292 sound(actor, CH_WEAPON_A, SND_HAGAR_BEEP, VOL_BASE, ATTN_NORM);
293
294 // pause until we can load rockets again, once we re-press the alt fire button
295 actor.(weaponentity).hagar_loadstep = time + WEP_CVAR_SEC(WEP_HAGAR, load_speed) * W_WeaponRateFactor(actor);
296
297 // require letting go of the alt fire button before we can load again
298 actor.(weaponentity).hagar_loadblock = true;
299 }
300 }
301 else
302 {
303 // check if we can attempt to load another rocket
304 if (!stopped
305 && !actor.(weaponentity).hagar_loadblock && actor.(weaponentity).hagar_loadstep < time)
306 {
307 W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(WEP_HAGAR, ammo), weaponentity);
308 actor.(weaponentity).state = WS_INUSE;
309 ++actor.(weaponentity).hagar_load;
310 sound(actor, CH_WEAPON_B, SND_HAGAR_LOAD, VOL_BASE * 0.8, ATTN_NORM); // sound is too loud according to most
311
312 if (actor.(weaponentity).hagar_load >= WEP_CVAR_SEC(WEP_HAGAR, load_max))
313 stopped = true;
314 else
315 actor.(weaponentity).hagar_loadstep = time + WEP_CVAR_SEC(WEP_HAGAR, load_speed) * W_WeaponRateFactor(actor);
316 }
317 if (stopped && !actor.(weaponentity).hagar_loadbeep && actor.(weaponentity).hagar_load) // prevents the beep from playing each frame
318 {
319 // if this is the last rocket we can load, play a beep sound to notify the player
320 sound(actor, CH_WEAPON_A, SND_HAGAR_BEEP, VOL_BASE, ATTN_NORM);
321 actor.(weaponentity).hagar_loadbeep = true;
322 actor.(weaponentity).hagar_loadstep = time + WEP_CVAR_SEC(WEP_HAGAR, load_hold) * W_WeaponRateFactor(actor);
323 }
324 }
325 }
326 else if (actor.(weaponentity).hagar_loadblock)
327 {
328 // the alt fire button has been released, so re-enable loading if blocked
329 actor.(weaponentity).hagar_loadblock = false;
330 }
331
332 if (actor.(weaponentity).hagar_load)
333 {
334 // play warning sound if we're about to release
335 if (stopped && actor.(weaponentity).hagar_loadstep - 0.5 < time && WEP_CVAR_SEC(WEP_HAGAR, load_hold) >= 0
336 && !actor.(weaponentity).hagar_warning) // prevents the beep from playing each frame
337 {
338 // we're about to automatically release after holding time, play a beep sound to notify the player
339 sound(actor, CH_WEAPON_A, SND_HAGAR_BEEP, VOL_BASE, ATTN_NORM);
340 actor.(weaponentity).hagar_warning = true;
341 }
342
343 // release if player let go of button or if they've held it in too long
344 if (!PHYS_INPUT_BUTTON_ATCK2(actor)
345 || (stopped && actor.(weaponentity).hagar_loadstep < time && WEP_CVAR_SEC(WEP_HAGAR, load_hold) >= 0))
346 {
347 actor.(weaponentity).state = WS_READY;
348 W_Hagar_Attack2_Load_Release(thiswep, actor, weaponentity);
349 }
350 }
351 else
352 {
353 actor.(weaponentity).hagar_loadbeep = false;
354 actor.(weaponentity).hagar_warning = false;
355
356 // we aren't checking ammo during an attack, so we must do it here
357 if (!(thiswep.wr_checkammo1(thiswep, actor, weaponentity) + thiswep.wr_checkammo2(thiswep, actor, weaponentity))
358 && !(actor.items & IT_UNLIMITED_AMMO))
359 {
360 // note: this doesn't force the switch
361 W_SwitchToOtherWeapon(actor, weaponentity);
362 return;
363 }
364 }
365}
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
Resource ammo_type
M: ammotype : main ammo type.
Definition weapon.qh:56
virtual void wr_checkammo2()
(SERVER) checks ammo for weapon second
Definition weapon.qh:105
virtual void wr_checkammo1()
(SERVER) checks ammo for weapon primary
Definition weapon.qh:100
const int IT_UNLIMITED_AMMO
Definition item.qh:23
#define PHYS_INPUT_BUTTON_ATCK(s)
Definition player.qh:152
#define PHYS_INPUT_BUTTON_ATCK2(s)
Definition player.qh:154
int timeout_status
Definition stats.qh:87
float game_starttime
Definition stats.qh:82
float W_WeaponRateFactor(entity this)
const float ATTN_NORM
int state
float hagar_loadbeep
Definition hagar.qc:191
void W_Hagar_Attack2_Load_Release(Weapon thiswep, entity actor,.entity weaponentity)
Definition hagar.qc:193
float hagar_loadstep
Definition hagar.qc:189
float hagar_warning
Definition hagar.qc:192
float hagar_loadblock
Definition hagar.qc:190
void W_SwitchToOtherWeapon(entity this,.entity weaponentity)
Perform weapon to attack (weaponstate and attack_finished check is here)
Definition selection.qc:247
const float TIMEOUT_ACTIVE
Definition common.qh:49
const float VOL_BASE
Definition sound.qh:36
#define sound(e, c, s, v, a)
Definition sound.qh:52
const int CH_WEAPON_B
Definition sound.qh:8
const int WS_READY
idle frame
Definition weapon.qh:38
const int WS_INUSE
fire state
Definition weapon.qh:36
bool weaponUseForbidden(entity player)
float weapon_load[REGISTRY_MAX(Weapons)]
int hagar_load
Definition wepent.qh:13

References ammo, Weapon::ammo_type, ATTN_NORM, CH_WEAPON_A, CH_WEAPON_B, entity(), game_starttime, GetResource(), hagar_load, hagar_loadbeep, hagar_loadblock, hagar_loadstep, hagar_warning, IT_UNLIMITED_AMMO, Weapon::m_id, PHYS_INPUT_BUTTON_ATCK, PHYS_INPUT_BUTTON_ATCK2, sound, state, time, TIMEOUT_ACTIVE, timeout_status, VOL_BASE, W_DecreaseAmmo(), W_Hagar_Attack2_Load_Release(), W_SwitchToOtherWeapon(), W_WeaponRateFactor(), weapon_load, weaponUseForbidden(), WEP_CVAR_SEC, Weapon::wr_checkammo1(), Weapon::wr_checkammo2(), WS_INUSE, and WS_READY.

◆ W_Hagar_Attack2_Load_Release()

void W_Hagar_Attack2_Load_Release ( Weapon thiswep,
entity actor,
.entity weaponentity )

Definition at line 193 of file hagar.qc.

194{
195 if (!actor.(weaponentity).hagar_load)
196 return;
197 // time to release the rockets we've loaded
198
199 weapon_prepareattack_do(actor, weaponentity, true, WEP_CVAR_SEC(WEP_HAGAR, refire));
200
201 float shots = actor.(weaponentity).hagar_load;
202 W_SetupShot(actor, weaponentity, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(WEP_HAGAR, damage) * shots, thiswep.m_id | HITTYPE_SECONDARY);
203 vector right = v_right;
204 vector up = v_up;
205 W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
206
207 entity missile = NULL;
208 vector s;
209 float spread_pershot;
210 for (int counter = 0; counter < shots; ++counter)
211 {
212 missile = new(missile);
213 missile.owner = missile.realowner = actor;
214 missile.bot_dodge = true;
215 missile.bot_dodgerating = WEP_CVAR_SEC(WEP_HAGAR, damage);
216
217 missile.takedamage = DAMAGE_YES;
218 SetResourceExplicit(missile, RES_HEALTH, WEP_CVAR_SEC(WEP_HAGAR, health));
219 missile.damageforcescale = WEP_CVAR_SEC(WEP_HAGAR, damageforcescale);
220 missile.event_damage = W_Hagar_Damage;
221 missile.damagedbycontents = true;
223
224 settouch(missile, W_Hagar_Touch); // not bouncy
225 missile.use = W_Hagar_Explode2_use;
227 missile.nextthink = time + WEP_CVAR_SEC(WEP_HAGAR, lifetime_min) + random() * WEP_CVAR_SEC(WEP_HAGAR, lifetime_rand);
228 PROJECTILE_MAKETRIGGER(missile);
229 missile.projectiledeathtype = thiswep.m_id | HITTYPE_SECONDARY;
230 missile.weaponentity_fld = weaponentity;
231 setorigin(missile, w_shotorg);
232 setsize(missile, '0 0 0', '0 0 0');
233 set_movetype(missile, MOVETYPE_FLY);
234 missile.missile_flags = MIF_SPLASH;
235
236 // per-shot spread calculation: the more shots there are, the less spread is applied (based on the bias cvar)
237 spread_pershot = ((shots - 1) / (WEP_CVAR_SEC(WEP_HAGAR, load_max) - 1));
238 spread_pershot = (1 - (spread_pershot * WEP_CVAR_SEC(WEP_HAGAR, load_spread_bias)));
239 spread_pershot = (WEP_CVAR_SEC(WEP_HAGAR, spread) * spread_pershot * autocvar_g_weaponspreadfactor);
240
241 s = W_CalculateSpreadPattern(1, 0, counter, shots);
242 s *= WEP_CVAR_SEC(WEP_HAGAR, load_spread) * autocvar_g_weaponspreadfactor;
243
244 W_SetupProjVelocity_Explicit(missile, w_shotdir + right * s.y + up * s.z, v_up, WEP_CVAR_SEC(WEP_HAGAR, speed), 0, 0, spread_pershot, false);
245
246 missile.angles = vectoangles(missile.velocity);
247 missile.flags = FL_PROJECTILE;
248 IL_PUSH(g_projectiles, missile);
249 IL_PUSH(g_bot_dodge, missile);
250
251 CSQCProjectile(missile, true, PROJECTILE_HAGAR, true);
252
253 MUTATOR_CALLHOOK(EditProjectile, actor, missile);
254 }
255
256 weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(WEP_HAGAR, load_animtime), w_ready);
257 actor.(weaponentity).hagar_loadstep = time + WEP_CVAR_SEC(WEP_HAGAR, refire) * W_WeaponRateFactor(actor);
258 actor.(weaponentity).hagar_load = 0;
259}
vector W_CalculateSpreadPattern(int pattern, float bias, int counter, int total)
float autocvar_g_weaponspreadfactor
vector v_up
vector v_right
float speed
Definition dynlight.qc:9
#define NULL
Definition post.qh:14
vector
Definition self.qh:92
void W_SetupProjVelocity_Explicit(entity proj, vector dir, vector upDir, float pSpeed, float pUpSpeed, float pZSpeed, float spread, float forceAbsolute)
Definition tracing.qc:185
void weapon_thinkf(entity actor,.entity weaponentity, WFRAME fr, float t, void(Weapon thiswep, entity actor,.entity weaponentity, int fire) func)
void w_ready(Weapon thiswep, entity actor,.entity weaponentity, int fire)
void weapon_prepareattack_do(entity actor,.entity weaponentity, bool secondary, float attacktime)

References adaptor_think2use_hittype_splash(), autocvar_g_weaponspreadfactor, CH_WEAPON_A, CSQCProjectile(), DAMAGE_YES, damageforcescale, entity(), FL_PROJECTILE, g_bot_dodge, g_damagedbycontents, g_projectiles, hagar_load, hagar_loadstep, health, HITTYPE_SECONDARY, IL_PUSH(), Weapon::m_id, MIF_SPLASH, MOVETYPE_FLY, MUTATOR_CALLHOOK, NULL, PROJECTILE_HAGAR, PROJECTILE_MAKETRIGGER, random(), set_movetype(), SetResourceExplicit(), setthink, settouch, speed, time, v_right, v_up, vectoangles(), vector, W_CalculateSpreadPattern(), W_Hagar_Damage(), W_Hagar_Explode2_use(), W_Hagar_Touch(), W_MuzzleFlash(), w_ready(), W_SetupProjVelocity_Explicit(), W_SetupShot, w_shotdir, w_shotorg, W_WeaponRateFactor(), weapon_prepareattack_do(), weapon_thinkf(), and WEP_CVAR_SEC.

Referenced by W_Hagar_Attack2_Load().

◆ W_Hagar_Attack_Auto()

void W_Hagar_Attack_Auto ( Weapon thiswep,
entity actor,
.entity weaponentity,
int fire )

Definition at line 367 of file hagar.qc.

368{
369 if (!(fire & 1) || actor.(weaponentity).hagar_load || actor.(weaponentity).hagar_loadblock
370 || actor.(weaponentity).m_switchweapon != thiswep || !weapon_prepareattack_check(thiswep, actor, weaponentity, false, -1))
371 {
372 w_ready(thiswep, actor, weaponentity, fire);
373 return;
374 }
375
376 if (!thiswep.wr_checkammo1(thiswep, actor, weaponentity)
377 && !(actor.items & IT_UNLIMITED_AMMO))
378 {
379 W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity);
380 w_ready(thiswep, actor, weaponentity, fire);
381 return;
382 }
383
384 W_Hagar_Attack(thiswep, actor, weaponentity);
385
386 ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR_PRI(WEP_HAGAR, refire) * W_WeaponRateFactor(actor);
387 actor.(weaponentity).wframe = WFRAME_FIRE1;
388 weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, WEP_CVAR_PRI(WEP_HAGAR, refire), W_Hagar_Attack_Auto);
389}
void W_SwitchWeapon_Force(Player this, Weapon w,.entity weaponentity)
Definition selection.qc:237
void W_Hagar_Attack_Auto(Weapon thiswep, entity actor,.entity weaponentity, int fire)
Definition hagar.qc:367
void W_Hagar_Attack(Weapon thiswep, entity actor,.entity weaponentity)
Definition hagar.qc:98
#define w_getbestweapon(ent, wepent)
Definition selection.qh:23
WFRAME wframe
Definition all.qh:439
bool weapon_prepareattack_check(Weapon thiswep, entity actor,.entity weaponentity, bool secondary, float attacktime)
#define ATTACK_FINISHED(ent, w)

References ATTACK_FINISHED, entity(), IT_UNLIMITED_AMMO, time, w_getbestweapon, W_Hagar_Attack(), W_Hagar_Attack_Auto(), w_ready(), W_SwitchWeapon_Force(), W_WeaponRateFactor(), weapon_prepareattack_check(), weapon_thinkf(), WEP_CVAR_PRI, wframe, and Weapon::wr_checkammo1().

Referenced by W_Hagar_Attack_Auto().

◆ W_Hagar_Damage()

void W_Hagar_Damage ( entity this,
entity inflictor,
entity attacker,
float damage,
int deathtype,
.entity weaponentity,
vector hitloc,
vector force )

Definition at line 53 of file hagar.qc.

54{
55 if (GetResource(this, RES_HEALTH) <= 0)
56 return;
57
58 bool is_linkexplode = (inflictor.owner != NULL ? inflictor.owner == this.owner : true)
59 && (HITTYPE_SECONDARY & inflictor.projectiledeathtype & this.projectiledeathtype);
60
61 if (is_linkexplode)
62 is_linkexplode = WEP_CVAR_SEC(WEP_HAGAR, load_linkexplode);
63 else
64 is_linkexplode = -1; // not secondary load, so continue as normal without exception.
65
66 if (!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, is_linkexplode))
67 return; // g_projectiles_damage says to halt
68
69 TakeResource(this, RES_HEALTH, damage);
70 this.angles = vectoangles(this.velocity);
71
72 if (GetResource(this, RES_HEALTH) <= 0)
73 W_PrepareExplosionByDamage(this, attacker, getthink(this));
74}
void TakeResource(entity receiver, Resource res_type, float amount)
Takes an entity some resource.
entity owner
Definition main.qh:87
vector velocity
ent angles
Definition ent_cs.qc:121
#define getthink(e)
float W_CheckProjectileDamage(entity inflictor, entity projowner, int deathtype, float exception)
Definition common.qc:45
void W_PrepareExplosionByDamage(entity this, entity attacker, void(entity this) explode)
Definition common.qc:87

References angles, entity(), GetResource(), getthink, HITTYPE_SECONDARY, NULL, owner, TakeResource(), vectoangles(), vector, velocity, W_CheckProjectileDamage(), W_PrepareExplosionByDamage(), and WEP_CVAR_SEC.

Referenced by W_Hagar_Attack(), W_Hagar_Attack2(), and W_Hagar_Attack2_Load_Release().

◆ W_Hagar_Explode()

void W_Hagar_Explode ( entity this,
entity directhitentity )

Definition at line 7 of file hagar.qc.

8{
9 this.event_damage = func_null;
10 RadiusDamage(this, this.realowner,
11 WEP_CVAR_PRI(WEP_HAGAR, damage),
12 WEP_CVAR_PRI(WEP_HAGAR, edgedamage),
13 WEP_CVAR_PRI(WEP_HAGAR, radius),
14 NULL,
15 NULL,
16 WEP_CVAR_PRI(WEP_HAGAR, force),
19 directhitentity
20 );
21
22 delete(this);
23}
float radius
Definition impulse.qh:11
float RadiusDamage(entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype,.entity weaponentity, entity directhitentity)
Definition damage.qc:943
var void func_null()
int projectiledeathtype
Definition common.qh:21
entity realowner
entity weaponentity_fld

References entity(), func_null(), NULL, projectiledeathtype, radius, RadiusDamage(), realowner, weaponentity_fld, and WEP_CVAR_PRI.

Referenced by W_Hagar_Explode_use().

◆ W_Hagar_Explode2()

void W_Hagar_Explode2 ( entity this,
entity directhitentity )

Definition at line 30 of file hagar.qc.

31{
32 this.event_damage = func_null;
33 RadiusDamage(this, this.realowner,
34 WEP_CVAR_SEC(WEP_HAGAR, damage),
35 WEP_CVAR_SEC(WEP_HAGAR, edgedamage),
36 WEP_CVAR_SEC(WEP_HAGAR, radius),
37 NULL,
38 NULL,
39 WEP_CVAR_SEC(WEP_HAGAR, force),
42 directhitentity
43 );
44
45 delete(this);
46}

References entity(), func_null(), NULL, projectiledeathtype, radius, RadiusDamage(), realowner, weaponentity_fld, and WEP_CVAR_SEC.

Referenced by W_Hagar_Explode2_use().

◆ W_Hagar_Explode2_use()

void W_Hagar_Explode2_use ( entity this,
entity actor,
entity trigger )

Definition at line 48 of file hagar.qc.

49{
50 W_Hagar_Explode2(this, trigger);
51}
void W_Hagar_Explode2(entity this, entity directhitentity)
Definition hagar.qc:30

References entity(), and W_Hagar_Explode2().

Referenced by W_Hagar_Attack2(), and W_Hagar_Attack2_Load_Release().

◆ W_Hagar_Explode_use()

void W_Hagar_Explode_use ( entity this,
entity actor,
entity trigger )

Definition at line 25 of file hagar.qc.

26{
27 W_Hagar_Explode(this, trigger);
28}
void W_Hagar_Explode(entity this, entity directhitentity)
Definition hagar.qc:7

References entity(), and W_Hagar_Explode().

Referenced by W_Hagar_Attack().

◆ W_Hagar_Touch()

void W_Hagar_Touch ( entity this,
entity toucher )

Definition at line 76 of file hagar.qc.

77{
79 this.use(this, NULL, toucher);
80}
#define use
entity entity toucher
Definition self.qh:72
#define PROJECTILE_TOUCH(e, t)
Definition common.qh:28

References entity(), NULL, PROJECTILE_TOUCH, toucher, and use.

Referenced by W_Hagar_Attack(), and W_Hagar_Attack2_Load_Release().

◆ W_Hagar_Touch2()

void W_Hagar_Touch2 ( entity this,
entity toucher )

Definition at line 82 of file hagar.qc.

83{
85
86 if (this.cnt > 0 || toucher.takedamage == DAMAGE_AIM)
87 this.use(this, NULL, toucher);
88 else
89 {
90 ++this.cnt;
91 Send_Effect(EFFECT_HAGAR_BOUNCE, this.origin, this.velocity, 1);
92 this.angles = vectoangles(this.velocity);
93 this.owner = NULL;
95 }
96}
float cnt
Definition powerups.qc:24
vector origin
const int HITTYPE_BOUNCE
Definition all.qh:31
void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
Definition all.qc:120
const int DAMAGE_AIM
Definition subs.qh:81

References angles, cnt, DAMAGE_AIM, entity(), HITTYPE_BOUNCE, NULL, origin, owner, PROJECTILE_TOUCH, projectiledeathtype, Send_Effect(), toucher, use, vectoangles(), and velocity.

Referenced by W_Hagar_Attack2().

Variable Documentation

◆ hagar_loadbeep

float hagar_loadbeep

Definition at line 191 of file hagar.qc.

Referenced by W_Hagar_Attack2_Load().

◆ hagar_loadblock

float hagar_loadblock

Definition at line 190 of file hagar.qc.

Referenced by W_Hagar_Attack2_Load().

◆ hagar_loadstep

float hagar_loadstep

Definition at line 189 of file hagar.qc.

Referenced by W_Hagar_Attack2_Load(), and W_Hagar_Attack2_Load_Release().

◆ hagar_warning

float hagar_warning

Definition at line 192 of file hagar.qc.

Referenced by W_Hagar_Attack2_Load().