]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/weapons/weaponsystem.qh
Update default video settings
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / weapons / weaponsystem.qh
1 #pragma once
2
3 #include <common/weapons/all.qh>
4
5 float autocvar_g_weaponspreadfactor;
6 float autocvar_g_weaponforcefactor;
7 float autocvar_g_weapondamagefactor;
8 float autocvar_g_weaponratefactor;
9 float autocvar_g_weaponspeedfactor;
10
11 #define INDEPENDENT_ATTACK_FINISHED 1
12
13 // there is 2 weapon tics that can run in one server frame
14 const int W_TICSPERFRAME = 2;
15
16 // VorteX: standalone think for weapons, so normal think on weaponentity can be reserved by weaponflashes (which needs update even player dies)
17 .float weapon_nextthink;
18 .void(Weapon thiswep, entity actor, .entity weaponentity, int fire) weapon_think;
19
20 float internalteam;
21 entity weapon_dropevent_item;
22
23 // reset to 0 on weapon switch
24 // may be useful to all weapons
25 .float bulletcounter;
26
27 ..entity weaponentity_fld;
28
29 .float weapon_load[REGISTRY_MAX(Weapons)];
30 .int ammo_none; // used by the reloading system, must always be 0
31 .int clip_load;
32 .int old_clip_load;
33 .int clip_size;
34
35 .float attack_finished_for[REGISTRY_MAX(Weapons) * MAX_WEAPONSLOTS];
36 .float attack_finished_single[MAX_WEAPONSLOTS];
37 #if INDEPENDENT_ATTACK_FINISHED
38 #define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).(attack_finished_for[((w) - WEP_FIRST) * MAX_WEAPONSLOTS + (slot)]))
39 #else
40 #define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).attack_finished_single[slot])
41 #endif
42 #define ATTACK_FINISHED(ent, w) ATTACK_FINISHED_FOR(ent, ent.(w).m_weapon.m_id, weaponslot(w))
43
44 void CL_SpawnWeaponentity(entity e, .entity weaponentity);
45
46 void w_clear(Weapon thiswep, entity actor, .entity weaponentity, int fire);
47
48 void w_ready(Weapon thiswep, entity actor, .entity weaponentity, int fire);
49
50 vector CL_Weapon_GetShotOrg(int wpn);
51
52 bool weaponUseForbidden(entity player);
53 bool weaponLocked(entity player);
54
55 void W_AttachToShotorg(entity actor, .entity weaponentity, entity flash, vector offset);
56
57 void W_DecreaseAmmo(Weapon wep, entity actor, float ammo_use, .entity weaponentity);
58
59 void W_DropEvent(.void(Weapon, entity actor, .entity) event, entity player, int weapon_type, entity weapon_item, .entity weaponentity);
60
61 void W_Reload(entity actor, .entity weaponentity, float sent_ammo_min, Sound sent_sound);
62
63 void W_ResetGunAlign(entity player, int preferred_alignment);
64
65 void W_WeaponFrame(Player actor, .entity weaponentity);
66
67 float W_WeaponRateFactor(entity this);
68
69 float W_WeaponSpeedFactor(entity this);
70
71 bool weapon_prepareattack(Weapon thiswep, entity actor, .entity weaponentity, bool secondary, float attacktime);
72
73 bool weapon_prepareattack_check(Weapon thiswep, entity actor, .entity weaponentity, bool secondary, float attacktime);
74
75 void weapon_prepareattack_do(entity actor, .entity weaponentity, bool secondary, float attacktime);
76
77 void weapon_thinkf(entity actor, .entity weaponentity, WFRAME fr, float t, void(Weapon thiswep, entity actor, .entity weaponentity, int fire) func);
78
79 //REPLICATE_APPLYCHANGE("cl_gunalign", { W_ResetGunAlign(this, store.cvar_cl_gunalign); });