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 dt, float dist, float damage, float edgedamage, float burntime)
void W_Fireball_Think (entity this)
void W_Fireball_TouchExplode (entity this, entity toucher)

Function Documentation

◆ W_Fireball_Attack1()

void W_Fireball_Attack1 ( entity actor,
.entity weaponentity )

Definition at line 168 of file fireball.qc.

169{
170 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);
171
172 W_MuzzleFlash(WEP_FIREBALL, actor, weaponentity, w_shotorg, w_shotdir);
173
174 entity proj = new(plasma_prim);
175 proj.owner = proj.realowner = actor;
176 proj.bot_dodge = true;
177 proj.bot_dodgerating = WEP_CVAR_PRI(WEP_FIREBALL, damage);
178 proj.pushltime = time + WEP_CVAR_PRI(WEP_FIREBALL, lifetime);
179 proj.use = W_Fireball_Explode_use;
181 proj.nextthink = time;
182 SetResourceExplicit(proj, RES_HEALTH, WEP_CVAR_PRI(WEP_FIREBALL, health));
183 proj.team = actor.team;
184 proj.event_damage = W_Fireball_Damage;
185 proj.takedamage = DAMAGE_YES;
186 proj.damageforcescale = WEP_CVAR_PRI(WEP_FIREBALL, damageforcescale);
188 proj.projectiledeathtype = WEP_FIREBALL.m_id;
189 proj.weaponentity_fld = weaponentity;
190 setorigin(proj, w_shotorg);
191
193 W_SetupProjVelocity_PRI(proj, WEP_FIREBALL);
194 proj.angles = vectoangles(proj.velocity);
196 setsize(proj, '-16 -16 -16', '16 16 16');
197 proj.flags = FL_PROJECTILE;
198 IL_PUSH(g_projectiles, proj);
199 IL_PUSH(g_bot_dodge, proj);
200 proj.missile_flags = MIF_SPLASH | MIF_PROXY;
201
202 CSQCProjectile(proj, true, PROJECTILE_FIREBALL, true);
203
204 MUTATOR_CALLHOOK(EditProjectile, actor, proj);
205}
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.
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)
float damageforcescale
void W_Fireball_Think(entity this)
Definition fireball.qc:137
void W_Fireball_Explode_use(entity this, entity actor, entity trigger)
Definition fireball.qc:87
void W_Fireball_TouchExplode(entity this, entity toucher)
Definition fireball.qc:92
void W_Fireball_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
Definition fireball.qc:152
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_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:73
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:65
vector w_shotorg
Definition tracing.qh:19
void W_MuzzleFlash(Weapon thiswep, entity actor,.entity weaponentity, vector shotorg, vector shotdir)
Definition all.qc:728
#define WEP_CVAR_PRI(wep, name)
Definition all.qh:322

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 238 of file fireball.qc.

239{
240 W_Fireball_AttackEffect(actor, weaponentity, 0, '-1.25 -3.75 0');
241 sound(actor, CH_WEAPON_SINGLE, SND_FIREBALL_PREFIRE2, VOL_BASE, ATTEN_NORM);
242 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_FIREBALL, animtime), W_Fireball_Attack1_Frame1);
243}
void W_Fireball_Attack1_Frame1(Weapon thiswep, entity actor,.entity weaponentity, int fire)
Definition fireball.qc:232
void W_Fireball_AttackEffect(entity actor,.entity weaponentity, float i, vector f_diff)
Definition fireball.qc:207
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 232 of file fireball.qc.

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

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 226 of file fireball.qc.

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

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 220 of file fireball.qc.

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

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 214 of file fireball.qc.

215{
216 W_Fireball_Attack1(actor, weaponentity);
217 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_FIREBALL, animtime), w_ready);
218}
void W_Fireball_Attack1(entity actor,.entity weaponentity)
Definition fireball.qc:168
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 283 of file fireball.qc.

284{
285 entity proj;
286 vector f_diff;
287 float c;
288
289 c = actor.(weaponentity).bulletcounter % 4;
290 switch(c)
291 {
292 case 0:
293 f_diff = '-1.25 -3.75 0';
294 break;
295 case 1:
296 f_diff = '+1.25 -3.75 0';
297 break;
298 case 2:
299 f_diff = '-1.25 +3.75 0';
300 break;
301 case 3:
302 default:
303 f_diff = '+1.25 +3.75 0';
304 break;
305 }
306 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);
307 traceline(w_shotorg, w_shotorg + f_diff_x * v_up + f_diff_y * v_right, MOVE_NORMAL, actor);
309
310 W_MuzzleFlash(WEP_FIREBALL, actor, weaponentity, w_shotorg, w_shotdir);
311
312 proj = new(grenade);
313 proj.owner = proj.realowner = actor;
314 proj.bot_dodge = true;
315 proj.bot_dodgerating = WEP_CVAR_SEC(WEP_FIREBALL, damage);
317 proj.projectiledeathtype = WEP_FIREBALL.m_id | HITTYPE_SECONDARY;
320 setsize(proj, '-4 -4 -4', '4 4 4');
321 setorigin(proj, w_shotorg);
323 proj.nextthink = time;
324 proj.damageforcescale = WEP_CVAR_SEC(WEP_FIREBALL, damageforcescale);
325 proj.pushltime = time + WEP_CVAR_SEC(WEP_FIREBALL, lifetime);
326 W_SetupProjVelocity_UP_SEC(proj, WEP_FIREBALL);
327
328 proj.angles = vectoangles(proj.velocity);
329 proj.flags = FL_PROJECTILE;
330 IL_PUSH(g_projectiles, proj);
331 IL_PUSH(g_bot_dodge, proj);
332 proj.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_ARC;
333
334 CSQCProjectile(proj, true, PROJECTILE_FIREMINE, true);
335
336 MUTATOR_CALLHOOK(EditProjectile, actor, proj);
337}
vector v_up
const float MOVE_NORMAL
vector v_right
vector trace_endpos
const int HITTYPE_SECONDARY
Definition all.qh:29
void W_Fireball_Firemine_Touch(entity this, entity toucher)
Definition fireball.qc:271
void W_Fireball_Firemine_Think(entity this)
Definition fireball.qc:245
const int MOVETYPE_BOUNCE
Definition movetypes.qh:139
const int PROJECTILE_FIREMINE
vector
Definition self.qh:92
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:323
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 207 of file fireball.qc.

208{
209 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
210 w_shotorg += f_diff.x * v_up + f_diff.y * v_right;
211 Send_Effect(EFFECT_FIREBALL_PRE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
212}
void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
Definition all.qc:124

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 152 of file fireball.qc.

153{
154 if(GetResource(this, RES_HEALTH) <= 0)
155 return;
156
157 if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
158 return; // g_projectiles_damage says to halt
159
160 TakeResource(this, RES_HEALTH, damage);
161 if(GetResource(this, RES_HEALTH) <= 0)
162 {
163 this.cnt = 1;
165 }
166}
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:82
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 entity e;
8 float dist;
9 float points;
10 vector dir;
11 float d;
12
13 this.event_damage = func_null;
14 this.takedamage = DAMAGE_NO;
15
16 // 1. dist damage
17 d = (GetResource(this.realowner, RES_HEALTH) + GetResource(this.realowner, RES_ARMOR));
18
20 this,
21 this.realowner,
22 WEP_CVAR_PRI(WEP_FIREBALL, damage),
23 WEP_CVAR_PRI(WEP_FIREBALL, edgedamage),
24 WEP_CVAR_PRI(WEP_FIREBALL, radius),
25 NULL,
26 NULL,
27 WEP_CVAR_PRI(WEP_FIREBALL, force),
29 this.weaponentity_fld, directhitentity
30 );
31
32 if(GetResource(this.realowner, RES_HEALTH) + GetResource(this.realowner, RES_ARMOR) >= d)
33 if(!this.cnt)
34 {
35 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);
36
37 // 2. bfg effect
38 // NOTE: this cannot be made warpzone aware by design. So, better intentionally ignore warpzones here.
39 for(e = findradius(this.origin, WEP_CVAR_PRI(WEP_FIREBALL, bfgradius)); e; e = e.chain)
40 {
41 if(e != this.realowner && e.takedamage == DAMAGE_AIM && !IS_INDEPENDENT_PLAYER(e))
42 if(!IS_PLAYER(e) || !this.realowner || DIFF_TEAM(e, this))
43 {
44
45 // can we see fireball?
46 traceline(e.origin + e.view_ofs, this.origin, MOVE_NORMAL, e);
47 if(/* trace_startsolid || */ trace_fraction != 1) // startsolid should be never happening anyway
48 continue;
49 // can we see player who shot fireball?
50 traceline(e.origin + e.view_ofs, this.realowner.origin + this.realowner.view_ofs, MOVE_NORMAL, e);
51 if(trace_ent != this.realowner)
52 if(/* trace_startsolid || */ trace_fraction != 1)
53 continue;
54 dist = vlen(this.origin - e.origin - e.view_ofs);
55 points = (1 - sqrt(dist / WEP_CVAR_PRI(WEP_FIREBALL, bfgradius)));
56 if(points <= 0)
57 continue;
58 dir = normalize(e.origin + e.view_ofs - this.origin);
59
61 accuracy_add(this.realowner, WEP_FIREBALL, 0, WEP_CVAR_PRI(WEP_FIREBALL, bfgdamage) * points, 0); // add to hit
62
63 Damage(
64 e,
65 this,
66 this.realowner,
67 WEP_CVAR_PRI(WEP_FIREBALL, bfgdamage) * points,
70 e.origin + e.view_ofs,
71 WEP_CVAR_PRI(WEP_FIREBALL, bfgforce) * dir
72 );
73
74 Send_Effect(EFFECT_FIREBALL_BFGDAMAGE, e.origin, -1 * dir, 1);
75 }
76 }
77 }
78
79 delete(this);
80}
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:243
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:503
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:981
const int HITTYPE_BOUNCE
Definition all.qh:31
const int HITTYPE_SPLASH
Definition all.qh:30
RES_ARMOR
Definition ent_cs.qc:130
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 82 of file fireball.qc.

83{
85}
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 87 of file fireball.qc.

88{
89 W_Fireball_Explode(this, trigger);
90}

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 245 of file fireball.qc.

246{
247 if(time > this.pushltime)
248 {
249 delete(this);
250 return;
251 }
252
253 // make it "hot" once it leaves its owner
254 if(this.owner)
255 {
256 if(vdist(this.origin - this.owner.origin - this.owner.view_ofs, >, WEP_CVAR_SEC(WEP_FIREBALL, laserradius)))
257 {
258 this.cnt += 1;
259 if(this.cnt == 3)
260 this.owner = NULL;
261 }
262 else
263 this.cnt = 0;
264 }
265
266 W_Fireball_LaserPlay(this, 0.1, WEP_CVAR_SEC(WEP_FIREBALL, laserradius), WEP_CVAR_SEC(WEP_FIREBALL, laserdamage), WEP_CVAR_SEC(WEP_FIREBALL, laseredgedamage), WEP_CVAR_SEC(WEP_FIREBALL, laserburntime));
267
268 this.nextthink = time + 0.1;
269}
entity owner
Definition main.qh:87
float nextthink
void W_Fireball_LaserPlay(entity this, float dt, float dist, float damage, float edgedamage, float burntime)
Definition fireball.qc:98
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 271 of file fireball.qc.

272{
274 if(toucher.takedamage == DAMAGE_AIM)
275 if(Fire_AddDamage(toucher, this.realowner, WEP_CVAR_SEC(WEP_FIREBALL, damage), WEP_CVAR_SEC(WEP_FIREBALL, damagetime), this.projectiledeathtype) >= 0)
276 {
277 delete(this);
278 return;
279 }
281}
float Fire_AddDamage(entity e, entity o, float d, float t, float dt)
Definition damage.qc:1002
entity entity toucher
Definition self.qh:72
#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 dt,
float dist,
float damage,
float edgedamage,
float burntime )

Definition at line 98 of file fireball.qc.

99{
100 entity e;
101 float d;
102 vector p;
103
104 if(damage <= 0)
105 return;
106
108 for(e = WarpZone_FindRadius(this.origin, dist, true); e; e = e.chain)
109 {
110 if(STAT(FROZEN, e) || StatusEffects_active(STATUSEFFECT_Frozen, e)) continue;
111 if(e == this.realowner) continue;
112 if(IS_INDEPENDENT_PLAYER(e)) continue;
113 if(e.takedamage != DAMAGE_AIM) continue;
114 if(IS_PLAYER(e) && this.realowner && SAME_TEAM(e, this)) continue;
115
116 p = e.origin;
117 p.x += e.mins.x + random() * (e.maxs.x - e.mins.x);
118 p.y += e.mins.y + random() * (e.maxs.y - e.mins.y);
119 p.z += e.mins.z + random() * (e.maxs.z - e.mins.z);
120 d = vlen(WarpZone_UnTransformOrigin(e, this.origin) - p);
121 if(d < dist)
122 {
123 e.fireball_impactvec = p;
124 RandomSelection_AddEnt(e, 1 / (1 + d), !StatusEffects_active(STATUSEFFECT_Burning, e));
125 }
126 }
128 {
130 d = damage + (edgedamage - damage) * (d / dist);
132 //trailparticles(this, particleeffectnum(EFFECT_FIREBALL_LASER), this.origin, RandomSelection_chosen_ent.fireball_impactvec);
133 Send_Effect(EFFECT_FIREBALL_LASER, this.origin, RandomSelection_chosen_ent.fireball_impactvec - this.origin, 1);
134 }
135}
#define STAT(...)
Definition stats.qh:82
entity WarpZone_FindRadius(vector org, float rad, bool needlineofsight)
Definition common.qc:686
vector WarpZone_UnTransformOrigin(entity wz, vector v)
Definition common.qc:545
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

References DAMAGE_AIM, entity(), Fire_AddDamage(), HITTYPE_BOUNCE, IS_INDEPENDENT_PLAYER, IS_PLAYER, origin, projectiledeathtype, random(), RandomSelection_AddEnt, RandomSelection_chosen_ent, RandomSelection_Init(), realowner, SAME_TEAM, Send_Effect(), STAT, StatusEffects_active(), vector, vlen(), 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 137 of file fireball.qc.

138{
139 if(time > this.pushltime)
140 {
141 this.cnt = 1;
144 return;
145 }
146
147 W_Fireball_LaserPlay(this, 0.1, WEP_CVAR_PRI(WEP_FIREBALL, laserradius), WEP_CVAR_PRI(WEP_FIREBALL, laserdamage), WEP_CVAR_PRI(WEP_FIREBALL, laseredgedamage), WEP_CVAR_PRI(WEP_FIREBALL, laserburntime));
148
149 this.nextthink = time + 0.1;
150}

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 92 of file fireball.qc.

93{
96}

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

Referenced by W_Fireball_Attack1().