Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
common.qh
Go to the documentation of this file.
1#pragma once
2
4
10
11
12// Helper weapon functions
13bool W_DualWielding(entity player);
14void W_GiveWeapon (entity e, float wep);
15void W_PlayStrengthSound(entity player);
16float W_CheckProjectileDamage(entity inflictor, entity projowner, int deathtype, float exception);
17void W_PrepareExplosionByDamage(entity this, entity attacker, void(entity this) explode);
18
20
22
23.float dmg_radius; // reused field, as the distance the laser damage occurs over
24.vector dest; // reused field, as the adjusted hit location
25void W_LaserPlay(entity this, float rad, float damage, float edgedamage, float burntime, WarpZone_FindRadius_cond_callback_t cb);
26
27float W_SeekOutEnemy(entity this, float speed_decel, float speed_accel, float speed_max, float turn_rate, bool smart, float smart_mindist, float smart_trace_min, float smart_trace_max);
28
29.float dmg_last;
30.float teleport_time; // reused field, as the time the damage started
31void W_DamageOverTime_Think(entity this, float duration, float duration_power, float damage, float edgedamage, float rad, float force, entity cantbe, float think_delay);
32
33void W_GuideProjectile(entity this, .entity weaponentity, float guide_start_time, float guide_rate, float guide_rate_delay, float guide_goal, float guide_delay, entity eff, entity snd, float vol);
34
35
37
39
40.float fade_time;
41.float fade_rate;
42
43.entity realowner;
44
45#define PROJECTILE_TOUCH(e,t) MACRO_BEGIN if (WarpZone_Projectile_Touch(e,t)) return; MACRO_END
46
47// FIXME: some behaviours can't be achieved or would require kludges in physics code,
48// eg we can't make electro bolts hit electro orbs only (without causing other problems) when g_projectiles_interact == 1,
49// see also WarpZone_Projectile_Touch_ImpactFilter_Callback().
50// Ideally, extend engine to support any combination of 'hit a and b but not x or y' and 'take hits from c and d but not w or z'.
51#define PROJECTILE_MAKETRIGGER(e) \
52MACRO_BEGIN \
53 (e).solid = SOLID_CORPSE; \
54 (e).dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE; \
55 if (!autocvar_g_projectiles_interact || (autocvar_g_projectiles_interact == 1 && (e).classname != "blasterbolt")) \
56 (e).clipgroup = 1; \
57MACRO_END
58
59// when doing this, hagar can go through clones
60// #define PROJECTILE_MAKETRIGGER(e) (e).solid = SOLID_BBOX
61
63const int MIF_SPLASH = BIT(1);
64const int MIF_ARC = BIT(2);
65const int MIF_PROXY = BIT(3);
66const int MIF_GUIDED_MANUAL = BIT(4);
67const int MIF_GUIDED_HEAT = BIT(5);
68const int MIF_GUIDED_LASER = BIT(6);
69const int MIF_GUIDED_AI = BIT(7);
70const int MIF_GUIDED_TAG = BIT(7);
74
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition bits.qh:8
float dmg_radius
Definition breakable.qc:14
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
limitations: NULL cannot be present elements can only be present once a maximum of IL_MAX lists can e...
float teleport_time
Definition player.qh:218
#define IL_NEW()
vector dest
Definition jumppads.qh:54
bool(entity e) WarpZone_FindRadius_cond_callback_t
Definition common.qh:67
fade_rate
Definition projectile.qh:14
entity entity toucher
Definition self.qh:76
float autocvar_sv_strengthsound_antispam_refire_threshold
Definition common.qh:8
float W_CheckProjectileDamage(entity inflictor, entity projowner, int deathtype, float exception)
Definition common.qc:45
bool WarpZone_Projectile_Touch_ImpactFilter_Callback(entity this, entity toucher)
Definition common.qc:150
void W_PlayStrengthSound(entity player)
Definition common.qc:40
const int MIF_SPLASH
Definition common.qh:63
int projectiledeathtype
Definition common.qh:38
void W_GuideProjectile(entity this,.entity weaponentity, float guide_start_time, float guide_rate, float guide_rate_delay, float guide_goal, float guide_delay, entity eff, entity snd, float vol)
Guides a projectile towards the crosshair (v_forward).
Definition common.qc:349
const int MIF_GUIDED_ALL
Definition common.qh:71
const int MIF_GUIDED_TRACKING
Definition common.qh:72
void W_LaserPlay(entity this, float rad, float damage, float edgedamage, float burntime, WarpZone_FindRadius_cond_callback_t cb)
Randomly chooses a player within the radius to shoot a laser towards.
Definition common.qc:191
void W_PrepareExplosionByDamage(entity this, entity attacker, void(entity this) explode)
Definition common.qc:87
void W_DamageOverTime_Think(entity this, float duration, float duration_power, float damage, float edgedamage, float rad, float force, entity cantbe, float think_delay)
Applies damage over time, called within a think function.
Definition common.qc:285
float dmg_last
Definition common.qh:29
int missile_flags
Definition common.qh:62
const int MIF_GUIDED_HEAT
Definition common.qh:67
float fade_time
Definition common.qh:40
IntrusiveList g_projectiles
Definition common.qh:75
const int MIF_PROXY
Definition common.qh:65
const int MIF_GUIDED_TAG
Definition common.qh:70
const int MIF_ARC
Definition common.qh:64
const int MIF_GUIDED_LASER
Definition common.qh:68
float autocvar_sv_strengthsound_antispam_time
Definition common.qh:9
const int MIF_GUIDED_AI
Definition common.qh:69
bool autocvar_g_projectiles_keep_owner
Definition common.qh:7
const int MIF_GUIDED_CONFUSABLE
Definition common.qh:73
float W_SeekOutEnemy(entity this, float speed_decel, float speed_accel, float speed_max, float turn_rate, bool smart, float smart_mindist, float smart_trace_min, float smart_trace_max)
Automatically guides a projectile towards its enemy.
Definition common.qc:239
void W_GiveWeapon(entity e, float wep)
float misc_bulletcounter
Definition common.qh:36
int autocvar_g_projectiles_damage
Definition common.qh:5
int autocvar_g_projectiles_interact
Definition common.qh:6
const int MIF_GUIDED_MANUAL
Definition common.qh:66
void adaptor_think2use_hittype_splash(entity this)
Definition common.qc:106
bool W_DualWielding(entity player)
Definition common.qc:20
#define STATIC_INIT(func)
during worldspawn
Definition static.qh:33
entity realowner