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

Go to the source code of this file.

Functions

void W_Fireball_Attack1 (entity actor,.entity weaponentity)
void W_Fireball_Attack1_Frame0 (Weapon thiswep, entity actor,.entity weaponentity, int fire)
void W_Fireball_Attack1_Frame1 (Weapon thiswep, entity actor,.entity weaponentity, int fire)
void W_Fireball_Attack1_Frame2 (Weapon thiswep, entity actor,.entity weaponentity, int fire)
void W_Fireball_Attack1_Frame3 (Weapon thiswep, entity actor,.entity weaponentity, int fire)
void W_Fireball_Attack1_Frame4 (Weapon thiswep, entity actor,.entity weaponentity, int fire)
void W_Fireball_Attack2 (entity actor,.entity weaponentity)
void W_Fireball_AttackEffect (entity actor,.entity weaponentity, float i, vector f_diff)
void W_Fireball_Damage (entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
void W_Fireball_Explode (entity this, entity directhitentity)
void W_Fireball_Explode_think (entity this)
void W_Fireball_Explode_use (entity this, entity actor, entity trigger)
void W_Fireball_Firemine_Think (entity this)
void W_Fireball_Firemine_Touch (entity this, entity toucher)
void W_Fireball_LaserPlay (entity this, float rad, float damage, float edgedamage, float burntime)
void W_Fireball_Think (entity this)
void W_Fireball_TouchExplode (entity this, entity toucher)

Variables

bool bot_primary_fireballmooth

Function Documentation

◆ W_Fireball_Attack1()

void W_Fireball_Attack1 ( entity actor,
.entity weaponentity )

Definition at line 169 of file fireball.qc.

170{
171 W_SetupShot_ProjectileSize(actor, weaponentity, '-16 -16 -16', '16 16 16', false, 2, SND_FIREBALL_FIRE2, CH_WEAPON_A, WEP_CVAR_PRI(WEP_FIREBALL, damage) + WEP_CVAR_PRI(WEP_FIREBALL, bfgdamage), WEP_FIREBALL.m_id);
172
173 W_MuzzleFlash(WEP_FIREBALL, actor, weaponentity, w_shotorg, w_shotdir);
174
175 entity proj = new(plasma_prim);
176 proj.owner = proj.realowner = actor;
177 proj.bot_dodge = true;
178 proj.bot_dodgerating = WEP_CVAR_PRI(WEP_FIREBALL, damage);
179 proj.pushltime = time + WEP_CVAR_PRI(WEP_FIREBALL, lifetime);
180 proj.use = W_Fireball_Explode_use;
182 proj.nextthink = time;
183 SetResourceExplicit(proj, RES_HEALTH, WEP_CVAR_PRI(WEP_FIREBALL, health));
184 proj.team = actor.team;
185 proj.event_damage = W_Fireball_Damage;
186 proj.takedamage = DAMAGE_YES;
187 proj.damageforcescale = WEP_CVAR_PRI(WEP_FIREBALL, damageforcescale);
189 proj.projectiledeathtype = WEP_FIREBALL.m_id;
190 proj.weaponentity_fld = weaponentity;
191 setorigin(proj, w_shotorg);
192
194 W_SetupProjVelocity_PRI(proj, WEP_FIREBALL);
195 proj.angles = vectoangles(proj.velocity);
197 setsize(proj, '-16 -16 -16', '16 16 16');
198 proj.flags = FL_PROJECTILE;
199 IL_PUSH(g_projectiles, proj);
200 IL_PUSH(g_bot_dodge, proj);
201 proj.missile_flags = MIF_SPLASH | MIF_PROXY;
202
203 CSQCProjectile(proj, true, PROJECTILE_FIREBALL, true);
204
205 MUTATOR_CALLHOOK(EditProjectile, actor, proj);
206}
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
float lifetime
Definition powerups.qc:23
const int FL_PROJECTILE
Definition constants.qh:76
float time
void CSQCProjectile(entity e, float clientanimate, int type, float docull)
float damageforcescale
SetResourceExplicit(ent, RES_ARMOR, ReadByte() *DEC_FACTOR)) ENTCS_PROP(NAME
void W_Fireball_Think(entity this)
Definition fireball.qc:135
void W_Fireball_Explode_use(entity this, entity actor, entity trigger)
Definition fireball.qc:78
void W_Fireball_TouchExplode(entity this, entity toucher)
Definition fireball.qc:83
void W_Fireball_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
Definition fireball.qc:154
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:138
const int PROJECTILE_FIREBALL
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:77
const int MIF_SPLASH
Definition common.qh:46
IntrusiveList g_projectiles
Definition common.qh:58
const int MIF_PROXY
Definition common.qh:48
#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
vector w_shotdir
Definition tracing.qh:20
#define W_SetupShot_ProjectileSize(ent, wepent, mi, ma, antilag, recoil, snd, chan, maxdamage, deathtype)
Definition tracing.qh:30
#define W_SetupProjVelocity_PRI(ent, wep)
Definition tracing.qh:67
vector w_shotorg
Definition tracing.qh:19
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

References CH_WEAPON_A, CSQCProjectile(), DAMAGE_YES, damageforcescale, entity(), FL_PROJECTILE, g_bot_dodge, g_projectiles, health, IL_PUSH(), lifetime, MIF_PROXY, MIF_SPLASH, MOVETYPE_FLY, MUTATOR_CALLHOOK, PROJECTILE_FIREBALL, PROJECTILE_MAKETRIGGER, set_movetype(), SetResourceExplicit(), setthink, settouch, time, vectoangles(), W_Fireball_Damage(), W_Fireball_Explode_use(), W_Fireball_Think(), W_Fireball_TouchExplode(), W_MuzzleFlash(), W_SetupProjVelocity_PRI, W_SetupShot_ProjectileSize, w_shotdir, w_shotorg, and WEP_CVAR_PRI.

Referenced by W_Fireball_Attack1_Frame4().

◆ W_Fireball_Attack1_Frame0()

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

Definition at line 239 of file fireball.qc.

240{
241 W_Fireball_AttackEffect(actor, weaponentity, 0, '-1.25 -3.75 0');
242 sound(actor, CH_WEAPON_SINGLE, SND_FIREBALL_PREFIRE2, VOL_BASE, ATTEN_NORM);
243 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_FIREBALL, animtime), W_Fireball_Attack1_Frame1);
244}
void W_Fireball_Attack1_Frame1(Weapon thiswep, entity actor,.entity weaponentity, int fire)
Definition fireball.qc:233
void W_Fireball_AttackEffect(entity actor,.entity weaponentity, float i, vector f_diff)
Definition fireball.qc:208
const int CH_WEAPON_SINGLE
Definition sound.qh:9
const float VOL_BASE
Definition sound.qh:36
const float ATTEN_NORM
Definition sound.qh:30
#define sound(e, c, s, v, a)
Definition sound.qh:52
void weapon_thinkf(entity actor,.entity weaponentity, WFRAME fr, float t, void(Weapon thiswep, entity actor,.entity weaponentity, int fire) func)

References ATTEN_NORM, CH_WEAPON_SINGLE, entity(), sound, VOL_BASE, W_Fireball_Attack1_Frame1(), W_Fireball_AttackEffect(), weapon_thinkf(), and WEP_CVAR_PRI.

◆ W_Fireball_Attack1_Frame1()

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

Definition at line 233 of file fireball.qc.

234{
235 W_Fireball_AttackEffect(actor, weaponentity, 1, '+1.25 -3.75 0');
236 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_FIREBALL, animtime), W_Fireball_Attack1_Frame2);
237}
void W_Fireball_Attack1_Frame2(Weapon thiswep, entity actor,.entity weaponentity, int fire)
Definition fireball.qc:227

References entity(), W_Fireball_Attack1_Frame2(), W_Fireball_AttackEffect(), weapon_thinkf(), and WEP_CVAR_PRI.

Referenced by W_Fireball_Attack1_Frame0().

◆ W_Fireball_Attack1_Frame2()

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

Definition at line 227 of file fireball.qc.

228{
229 W_Fireball_AttackEffect(actor, weaponentity, 0, '-1.25 +3.75 0');
230 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_FIREBALL, animtime), W_Fireball_Attack1_Frame3);
231}
void W_Fireball_Attack1_Frame3(Weapon thiswep, entity actor,.entity weaponentity, int fire)
Definition fireball.qc:221

References entity(), W_Fireball_Attack1_Frame3(), W_Fireball_AttackEffect(), weapon_thinkf(), and WEP_CVAR_PRI.

Referenced by W_Fireball_Attack1_Frame1().

◆ W_Fireball_Attack1_Frame3()

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

Definition at line 221 of file fireball.qc.

222{
223 W_Fireball_AttackEffect(actor, weaponentity, 0, '+1.25 +3.75 0');
224 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_FIREBALL, animtime), W_Fireball_Attack1_Frame4);
225}
void W_Fireball_Attack1_Frame4(Weapon thiswep, entity actor,.entity weaponentity, int fire)
Definition fireball.qc:215

References entity(), W_Fireball_Attack1_Frame4(), W_Fireball_AttackEffect(), weapon_thinkf(), and WEP_CVAR_PRI.

Referenced by W_Fireball_Attack1_Frame2().

◆ W_Fireball_Attack1_Frame4()

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

Definition at line 215 of file fireball.qc.

216{
217 W_Fireball_Attack1(actor, weaponentity);
218 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_FIREBALL, animtime), w_ready);
219}
void W_Fireball_Attack1(entity actor,.entity weaponentity)
Definition fireball.qc:169
void w_ready(Weapon thiswep, entity actor,.entity weaponentity, int fire)

References entity(), W_Fireball_Attack1(), w_ready(), weapon_thinkf(), and WEP_CVAR_PRI.

Referenced by W_Fireball_Attack1_Frame3().

◆ W_Fireball_Attack2()

void W_Fireball_Attack2 ( entity actor,
.entity weaponentity )

Definition at line 288 of file fireball.qc.

289{
290 vector f_diff;
291
292 float c = actor.(weaponentity).bulletcounter % 4;
293 switch (c)
294 {
295 case 0:
296 f_diff = '-1.25 -3.75 0';
297 break;
298 case 1:
299 f_diff = '+1.25 -3.75 0';
300 break;
301 case 2:
302 f_diff = '-1.25 +3.75 0';
303 break;
304 case 3:
305 default:
306 f_diff = '+1.25 +3.75 0';
307 break;
308 }
309 W_SetupShot_ProjectileSize(actor, weaponentity, '-4 -4 -4', '4 4 4', false, 2, SND_FIREBALL_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(WEP_FIREBALL, damage), WEP_FIREBALL.m_id | HITTYPE_SECONDARY);
310 traceline(w_shotorg, w_shotorg + f_diff.x * v_up + f_diff.y * v_right, MOVE_NORMAL, actor);
312
313 W_MuzzleFlash(WEP_FIREBALL, actor, weaponentity, w_shotorg, w_shotdir);
314
315 entity proj = new(grenade);
316 proj.owner = proj.realowner = actor;
317 proj.bot_dodge = true;
318 proj.bot_dodgerating = WEP_CVAR_SEC(WEP_FIREBALL, damage);
320 proj.projectiledeathtype = WEP_FIREBALL.m_id | HITTYPE_SECONDARY;
323 setsize(proj, '-4 -4 -4', '4 4 4');
324 setorigin(proj, w_shotorg);
326 proj.nextthink = time;
327 proj.damageforcescale = WEP_CVAR_SEC(WEP_FIREBALL, damageforcescale);
328 proj.pushltime = time + WEP_CVAR_SEC(WEP_FIREBALL, lifetime);
329 W_SetupProjVelocity_UP_SEC(proj, WEP_FIREBALL);
330
331 proj.angles = vectoangles(proj.velocity);
332 proj.flags = FL_PROJECTILE;
333 IL_PUSH(g_projectiles, proj);
334 IL_PUSH(g_bot_dodge, proj);
335 proj.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_ARC;
336
337 CSQCProjectile(proj, true, PROJECTILE_FIREMINE, true);
338
339 MUTATOR_CALLHOOK(EditProjectile, actor, proj);
340}
vector v_up
const float MOVE_NORMAL
vector v_right
vector trace_endpos
const int HITTYPE_SECONDARY
Definition all.qh:31
void W_Fireball_Firemine_Touch(entity this, entity toucher)
Definition fireball.qc:276
void W_Fireball_Firemine_Think(entity this)
Definition fireball.qc:246
const int MOVETYPE_BOUNCE
Definition movetypes.qh:143
const int PROJECTILE_FIREMINE
vector
Definition self.qh:96
const int MIF_ARC
Definition common.qh:47
#define W_SetupProjVelocity_UP_SEC(ent, wep)
Definition tracing.qh:56
#define WEP_CVAR_SEC(wep, name)
Definition all.qh:339
float bulletcounter

References bulletcounter, CH_WEAPON_A, CSQCProjectile(), damageforcescale, entity(), FL_PROJECTILE, g_bot_dodge, g_projectiles, HITTYPE_SECONDARY, IL_PUSH(), lifetime, MIF_ARC, MIF_PROXY, MIF_SPLASH, MOVE_NORMAL, MOVETYPE_BOUNCE, MUTATOR_CALLHOOK, PROJECTILE_FIREMINE, PROJECTILE_MAKETRIGGER, set_movetype(), setthink, settouch, time, trace_endpos, v_right, v_up, vectoangles(), vector, W_Fireball_Firemine_Think(), W_Fireball_Firemine_Touch(), W_MuzzleFlash(), W_SetupProjVelocity_UP_SEC, W_SetupShot_ProjectileSize, w_shotdir, w_shotorg, and WEP_CVAR_SEC.

◆ W_Fireball_AttackEffect()

void W_Fireball_AttackEffect ( entity actor,
.entity weaponentity,
float i,
vector f_diff )

Definition at line 208 of file fireball.qc.

209{
210 W_SetupShot_ProjectileSize(actor, weaponentity, '-16 -16 -16', '16 16 16', false, 0, SND_Null, 0, 0, WEP_FIREBALL.m_id); // TODO: probably doesn't need deathtype, just a prefire effect
211 w_shotorg += f_diff.x * v_up + f_diff.y * v_right;
212 Send_Effect(EFFECT_FIREBALL_PRE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
213}
void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
Definition all.qc:120

References entity(), Send_Effect(), v_right, v_up, vector, W_SetupShot_ProjectileSize, w_shotdir, and w_shotorg.

Referenced by W_Fireball_Attack1_Frame0(), W_Fireball_Attack1_Frame1(), W_Fireball_Attack1_Frame2(), and W_Fireball_Attack1_Frame3().

◆ W_Fireball_Damage()

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

Definition at line 154 of file fireball.qc.

155{
156 if (GetResource(this, RES_HEALTH) <= 0)
157 return;
158 if (!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
159 return; // g_projectiles_damage says to halt
160
161 TakeResource(this, RES_HEALTH, damage);
162 if (GetResource(this, RES_HEALTH) <= 0)
163 {
164 this.cnt = 1;
166 }
167}
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
void TakeResource(entity receiver, Resource res_type, float amount)
Takes an entity some resource.
float cnt
Definition powerups.qc:24
void W_Fireball_Explode_think(entity this)
Definition fireball.qc:73
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 cnt, entity(), GetResource(), TakeResource(), vector, W_CheckProjectileDamage(), W_Fireball_Explode_think(), and W_PrepareExplosionByDamage().

Referenced by W_Fireball_Attack1().

◆ W_Fireball_Explode()

void W_Fireball_Explode ( entity this,
entity directhitentity )

Definition at line 5 of file fireball.qc.

6{
7 this.event_damage = func_null;
9
10 // 1. dist damage
11 float d = GetResource(this.realowner, RES_HEALTH) + GetResource(this.realowner, RES_ARMOR);
12
13 RadiusDamage(this, this.realowner,
14 WEP_CVAR_PRI(WEP_FIREBALL, damage),
15 WEP_CVAR_PRI(WEP_FIREBALL, edgedamage),
16 WEP_CVAR_PRI(WEP_FIREBALL, radius),
17 NULL,
18 NULL,
19 WEP_CVAR_PRI(WEP_FIREBALL, force),
21 this.weaponentity_fld, directhitentity
22 );
23
24 if (GetResource(this.realowner, RES_HEALTH) + GetResource(this.realowner, RES_ARMOR) >= d
25 && !this.cnt)
26 {
27 float dist;
28 float points;
29 vector dir;
30
31 modeleffect_spawn("models/sphere/sphere.md3", 0, 0, this.origin, '0 0 0', '0 0 0', '0 0 0', 0, WEP_CVAR_PRI(WEP_FIREBALL, bfgradius), 0.2, 0.05, 0.25);
32
33 // 2. bfg effect
34 // NOTE: this cannot be made warpzone aware by design. So, better intentionally ignore warpzones here.
35 for (entity e = findradius(this.origin, WEP_CVAR_PRI(WEP_FIREBALL, bfgradius)); e; e = e.chain)
36 if (e != this.realowner && e.takedamage == DAMAGE_AIM && !IS_INDEPENDENT_PLAYER(e)
37 && (!IS_PLAYER(e) || !this.realowner || DIFF_TEAM(e, this)))
38 {
39
40 // can we see fireball?
41 traceline(e.origin + e.view_ofs, this.origin, MOVE_NORMAL, e);
42 if (/* trace_startsolid || */ trace_fraction != 1) // startsolid should be never happening anyway
43 continue;
44 // can we see player who shot fireball?
45 traceline(e.origin + e.view_ofs, this.realowner.origin + this.realowner.view_ofs, MOVE_NORMAL, e);
46 if (trace_ent != this.realowner)
47 if (/* trace_startsolid || */ trace_fraction != 1)
48 continue;
49 dist = vlen(this.origin - e.origin - e.view_ofs);
50 points = 1 - sqrt(dist / WEP_CVAR_PRI(WEP_FIREBALL, bfgradius));
51 if (points <= 0)
52 continue;
53 dir = normalize(e.origin + e.view_ofs - this.origin);
54
56 accuracy_add(this.realowner, WEP_FIREBALL, 0, WEP_CVAR_PRI(WEP_FIREBALL, bfgdamage) * points, 0); // add to hit
57
58 Damage(e, this, this.realowner,
59 WEP_CVAR_PRI(WEP_FIREBALL, bfgdamage) * points,
62 e.origin + e.view_ofs,
63 WEP_CVAR_PRI(WEP_FIREBALL, bfgforce) * dir
64 );
65
66 Send_Effect(EFFECT_FIREBALL_BFGDAMAGE, e.origin, -dir, 1);
67 }
68 }
69
70 delete(this);
71}
void accuracy_add(entity this, Weapon w, float fired, float hit, float real)
update accuracy stats
Definition accuracy.qc:102
bool accuracy_isgooddamage(entity attacker, entity targ)
does this damage count towards accuracy stats?
Definition accuracy.qc:133
float radius
Definition impulse.qh:11
#define IS_PLAYER(s)
Definition player.qh:242
entity trace_ent
vector origin
float trace_fraction
void Damage(entity targ, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
Definition damage.qc:483
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:934
const int HITTYPE_BOUNCE
set manually after projectile has bounced
Definition all.qh:33
const int HITTYPE_SPLASH
automatically set by RadiusDamage
Definition all.qh:32
RES_ARMOR
Definition ent_cs.qc:155
float vlen(vector v)
float sqrt(float f)
vector normalize(vector v)
void modeleffect_spawn(string m, float s, float f, vector o, vector v, vector ang, vector angv, float s0, float s2, float a, float t1, float t2)
var void func_null()
#define NULL
Definition post.qh:14
#define IS_INDEPENDENT_PLAYER(e)
Definition client.qh:312
int dir
Definition impulse.qc:89
int projectiledeathtype
Definition common.qh:21
const int DAMAGE_NO
Definition subs.qh:79
const int DAMAGE_AIM
Definition subs.qh:81
float takedamage
Definition subs.qh:78
#define DIFF_TEAM(a, b)
Definition teams.qh:242
entity realowner
entity weaponentity_fld

References accuracy_add(), accuracy_isgooddamage(), cnt, Damage(), DAMAGE_AIM, DAMAGE_NO, DIFF_TEAM, dir, entity(), func_null(), GetResource(), HITTYPE_BOUNCE, HITTYPE_SPLASH, IS_INDEPENDENT_PLAYER, IS_PLAYER, modeleffect_spawn(), MOVE_NORMAL, normalize(), NULL, origin, projectiledeathtype, radius, RadiusDamage(), realowner, RES_ARMOR, Send_Effect(), sqrt(), takedamage, trace_ent, trace_fraction, vector, vlen(), weaponentity_fld, and WEP_CVAR_PRI.

Referenced by W_Fireball_Explode_think(), W_Fireball_Explode_use(), W_Fireball_Think(), and W_Fireball_TouchExplode().

◆ W_Fireball_Explode_think()

void W_Fireball_Explode_think ( entity this)

Definition at line 73 of file fireball.qc.

74{
76}
void W_Fireball_Explode(entity this, entity directhitentity)
Definition fireball.qc:5

References entity(), NULL, and W_Fireball_Explode().

Referenced by W_Fireball_Damage().

◆ W_Fireball_Explode_use()

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

Definition at line 78 of file fireball.qc.

79{
80 W_Fireball_Explode(this, trigger);
81}

References entity(), and W_Fireball_Explode().

Referenced by W_Fireball_Attack1().

◆ W_Fireball_Firemine_Think()

void W_Fireball_Firemine_Think ( entity this)

Definition at line 246 of file fireball.qc.

247{
248 if (time > this.pushltime)
249 {
250 delete(this);
251 return;
252 }
253
254 // make it "hot" once it leaves its owner
255 if (this.owner)
256 {
257 if (vdist(this.origin - this.owner.origin - this.owner.view_ofs, >, WEP_CVAR_SEC(WEP_FIREBALL, laserradius)))
258 {
259 ++this.cnt;
260 if (this.cnt == 3)
261 this.owner = NULL;
262 }
263 else
264 this.cnt = 0;
265 }
266
268 WEP_CVAR_SEC(WEP_FIREBALL, laserradius),
269 WEP_CVAR_SEC(WEP_FIREBALL, laserdamage),
270 WEP_CVAR_SEC(WEP_FIREBALL, laseredgedamage),
271 WEP_CVAR_SEC(WEP_FIREBALL, laserburntime));
272
273 this.nextthink = time + 0.1;
274}
entity owner
Definition main.qh:87
float nextthink
void W_Fireball_LaserPlay(entity this, float rad, float damage, float edgedamage, float burntime)
Definition fireball.qc:89
float pushltime
Definition jumppads.qh:21
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt().
Definition vector.qh:8

References cnt, entity(), nextthink, NULL, origin, owner, pushltime, time, vdist, W_Fireball_LaserPlay(), and WEP_CVAR_SEC.

Referenced by W_Fireball_Attack2().

◆ W_Fireball_Firemine_Touch()

void W_Fireball_Firemine_Touch ( entity this,
entity toucher )

Definition at line 276 of file fireball.qc.

277{
279 if (toucher.takedamage == DAMAGE_AIM
280 && Fire_AddDamage(toucher, this.realowner, WEP_CVAR_SEC(WEP_FIREBALL, damage), WEP_CVAR_SEC(WEP_FIREBALL, damagetime), this.projectiledeathtype) >= 0)
281 {
282 delete(this);
283 return;
284 }
286}
float Fire_AddDamage(entity e, entity o, float d, float t, float dt)
Definition damage.qc:965
entity entity toucher
Definition self.qh:76
#define PROJECTILE_TOUCH(e, t)
Definition common.qh:28

References DAMAGE_AIM, entity(), Fire_AddDamage(), HITTYPE_BOUNCE, PROJECTILE_TOUCH, projectiledeathtype, realowner, toucher, and WEP_CVAR_SEC.

Referenced by W_Fireball_Attack2().

◆ W_Fireball_LaserPlay()

void W_Fireball_LaserPlay ( entity this,
float rad,
float damage,
float edgedamage,
float burntime )

Definition at line 89 of file fireball.qc.

90{
91 if (damage <= 0)
92 return;
93
94 // NOTE: napalm_damage uses similar code, please keep them in sync
96 entity last = NULL;
97 float last_dist = 0;
98 // optimize code by comparing squared distances and avoiding vlen and sqrt calls as much as possible
99 float rad2 = rad * rad;
100 for (entity e = WarpZone_FindRadius(this.origin, rad, true); e; e = e.chain)
101 {
102 if (STAT(FROZEN, e) || StatusEffects_active(STATUSEFFECT_Frozen, e)
103 || e == this.realowner || IS_INDEPENDENT_PLAYER(e)
104 || e.takedamage != DAMAGE_AIM
105 || (IS_PLAYER(e) && this.realowner && SAME_TEAM(e, this)))
106 continue;
107
108 vector p = e.origin;
109 p.x += e.mins.x + random() * (e.maxs.x - e.mins.x);
110 p.y += e.mins.y + random() * (e.maxs.y - e.mins.y);
111 p.z += e.mins.z + random() * (e.maxs.z - e.mins.z);
112 float dist2 = vlen2(WarpZone_UnTransformOrigin(e, this.origin) - p);
113 if (dist2 < rad2)
114 {
115 e.fireball_impactvec = p;
116 last = e;
117 last_dist = sqrt(dist2); // won't be recalculated if this entity is the only or last one found
118 RandomSelection_AddEnt(e, 1 / (1 + last_dist), !StatusEffects_active(STATUSEFFECT_Burning, e));
119 }
120 }
122 {
123 float dist;
124 if (RandomSelection_chosen_ent == last)
125 dist = last_dist; // already calculated
126 else
128 dist = damage + (edgedamage - damage) * (dist / rad);
130 //trailparticles(this, particleeffectnum(EFFECT_FIREBALL_LASER), this.origin, RandomSelection_chosen_ent.fireball_impactvec);
131 Send_Effect(EFFECT_FIREBALL_LASER, this.origin, RandomSelection_chosen_ent.fireball_impactvec - this.origin, 1);
132 }
133}
#define STAT(...)
Definition stats.qh:94
entity WarpZone_FindRadius(vector org, float rad, bool needlineofsight)
Definition common.qc:651
vector WarpZone_UnTransformOrigin(entity wz, vector v)
Definition common.qc:519
float random(void)
ERASEABLE void RandomSelection_Init()
Definition random.qc:4
#define RandomSelection_AddEnt(e, weight, priority)
Definition random.qh:14
entity RandomSelection_chosen_ent
Definition random.qh:5
bool StatusEffects_active(StatusEffect this, entity actor)
#define SAME_TEAM(a, b)
Definition teams.qh:241
#define vlen2(v)
Definition vector.qh:4

References DAMAGE_AIM, entity(), Fire_AddDamage(), HITTYPE_BOUNCE, IS_INDEPENDENT_PLAYER, IS_PLAYER, NULL, origin, projectiledeathtype, random(), RandomSelection_AddEnt, RandomSelection_chosen_ent, RandomSelection_Init(), realowner, SAME_TEAM, Send_Effect(), sqrt(), STAT, StatusEffects_active(), vector, vlen(), vlen2, WarpZone_FindRadius(), and WarpZone_UnTransformOrigin().

Referenced by W_Fireball_Firemine_Think(), and W_Fireball_Think().

◆ W_Fireball_Think()

void W_Fireball_Think ( entity this)

Definition at line 135 of file fireball.qc.

136{
137 if (time > this.pushltime)
138 {
139 this.cnt = 1;
142 return;
143 }
144
146 WEP_CVAR_PRI(WEP_FIREBALL, laserradius),
147 WEP_CVAR_PRI(WEP_FIREBALL, laserdamage),
148 WEP_CVAR_PRI(WEP_FIREBALL, laseredgedamage),
149 WEP_CVAR_PRI(WEP_FIREBALL, laserburntime));
150
151 this.nextthink = time + 0.1;
152}

References cnt, entity(), HITTYPE_SPLASH, nextthink, NULL, projectiledeathtype, pushltime, time, W_Fireball_Explode(), W_Fireball_LaserPlay(), and WEP_CVAR_PRI.

Referenced by W_Fireball_Attack1().

◆ W_Fireball_TouchExplode()

void W_Fireball_TouchExplode ( entity this,
entity toucher )

Definition at line 83 of file fireball.qc.

84{
87}

References entity(), PROJECTILE_TOUCH, toucher, and W_Fireball_Explode().

Referenced by W_Fireball_Attack1().

Variable Documentation

◆ bot_primary_fireballmooth

bool bot_primary_fireballmooth

Definition at line 342 of file fireball.qc.