Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
inferno.qc
Go to the documentation of this file.
1#include "inferno.qh"
2
3#ifdef SVQC
5{
6#define offset_x 0
7#define offset_y autocvar_g_buffs_inferno_burntime_min_time
8#define intersect_x autocvar_g_buffs_inferno_burntime_target_damage
9#define intersect_y autocvar_g_buffs_inferno_burntime_target_time
10#define base autocvar_g_buffs_inferno_burntime_factor
11 // Interpolates from (offset_x, offset_y) to (intersect_x, intersect_y) logarithmically with base
12 return offset_y + (intersect_y - offset_y) * logn(((dmg - offset_x) * ((base - 1) / intersect_x)) + 1, base);
13#undef offset_x
14#undef offset_y
15#undef intersect_x
16#undef intersect_y
17#undef base
18}
23
24METHOD(InfernoBuff, m_tick, void(StatusEffect this, entity actor))
25{
26 if (time >= actor.buff_effect_delay && autocvar_g_buffs_effects) // prevent unnecessary calculations
27 {
28 .entity weaponentity = weaponentities[0]; // TODO: unhardcode
29 entity e = actor.(weaponentity);
31
32 if (e)
33 {
34 #if 0
35 /* This can't be used as the tags aren't accessible via SVQC, so this code only works properly when testing locally and not on a dedicated server.
36 * e.origin is very inaccurate, but exists for custom weapon models that don't have these tags.
37 * If these particles are moved to CSQC, this code should be used as it's more accurate than the code after the #else
38 * See https://gitlab.com/xonotic/xonotic-data.pk3dir/-/work_items/2852
39 */
40 int idx;
41 if ((idx = gettagindex(e, "shot")) || (idx = gettagindex(e, "tag_shot"))
42 || (idx = gettagindex(e, "weapon")) || (idx = gettagindex(e, "tag_weapon")))
43 org = gettaginfo(e, idx);
44 else
45 org = e.origin;
46 #else
47 /* As an alternative to the above, draw the particles near where casings spawn.
48 * Code is similar to SpawnCasing, but with the effect of `v_up` minimized when aiming far up and down (via the `fabs`);
49 * Otherwise it renders far behind the player when looking down and vice versa.
50 */
51 makevectors(actor.v_angle);
52 vector offset = e.spawnorigin;
53 org += offset.x * v_forward - offset.y * v_right + offset.z * v_up * (1 - fabs(v_forward.z));
54 #endif
55 }
56
57 buff_Effect(actor, EFFECT_RAGE, org, vec2(actor.velocity), 1, true); // particles block view so hide
58 }
59
60 SUPER(InfernoBuff).m_tick(this, actor);
61}
62#endif // SVQC
63#ifdef MENUQC
64METHOD(InfernoBuff, describe, string(InfernoBuff this))
65{
66 TC(InfernoBuff, this);
68 PAR(_("The %s buff sets any enemies or monsters you attack alight, dealing burn damage to them for several seconds until the buff expires."), COLORED_NAME(this));
69 return PAGE_TEXT;
70}
71#endif // MENUQC
float dmg
Definition breakable.qc:12
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define COLORED_NAME(this)
Definition color.qh:189
vector v_up
float time
vector v_right
vector v_forward
#define gettagindex
#define intersect_x
float buff_Inferno_CalculateTime(float dmg)
Definition inferno.qc:4
#define offset_x
float buff_Inferno_CalculateDamage(float frag_damage)
Definition inferno.qc:19
#define base
#define intersect_y
#define offset_y
float autocvar_g_buffs_inferno_damagemultiplier
Definition inferno.qh:10
#define TC(T, sym)
Definition _all.inc:82
float logn(float e, float base)
Definition mathlib.qc:99
float fabs(float f)
#define SUPER(cname)
Definition oo.qh:236
#define METHOD(cname, name, prototype)
Definition oo.qh:274
#define makevectors
Definition post.qh:21
#define gettaginfo
Definition post.qh:32
vector
Definition self.qh:96
vector org
Definition self.qh:96
#define PAGE_TEXT
Definition string.qh:651
#define PAR(...)
Adds an individually translatable paragraph to PAGE_TEXT without having to deal with strcat and sprin...
Definition string.qh:657
#define PAGE_TEXT_INIT()
Definition string.qh:650
void buff_Effect(entity player, entity eff, vector eff_loc, vector eff_vel, int eff_cnt, bool hide)
Spawn effects on a player with a buff.
Definition sv_buffs.qc:103
bool autocvar_g_buffs_effects
Definition sv_buffs.qh:19
float frag_damage
Definition sv_ctf.qc:2316
#define CENTER_OR_VIEWOFS(ent)
Definition utils.qh:31
#define vec2(...)
Definition vector.qh:95
entity weaponentities[MAX_WEAPONSLOTS]
Definition weapon.qh:17