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