3 #include <server/miscfunctions.qh>
5 #define INDEPENDENT_ATTACK_FINISHED 1
7 // there is 2 weapon tics that can run in one server frame
8 const int W_TICSPERFRAME = 2;
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;
15 entity weapon_dropevent_item;
17 ..entity weaponentity_fld;
19 .float weapon_load[REGISTRY_MAX(Weapons)];
20 .int ammo_none; // used by the reloading system, must always be 0
25 .float attack_finished_for[REGISTRY_MAX(Weapons) * MAX_WEAPONSLOTS];
26 .float attack_finished_single[MAX_WEAPONSLOTS];
27 #if INDEPENDENT_ATTACK_FINISHED
28 #define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).(attack_finished_for[((w) - WEP_FIRST) * MAX_WEAPONSLOTS + (slot)]))
30 #define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).attack_finished_single[slot])
32 #define ATTACK_FINISHED(ent, w) ATTACK_FINISHED_FOR(ent, ent.(w).m_weapon.m_id, weaponslot(w))
34 void CL_SpawnWeaponentity(entity e, .entity weaponentity);
36 void w_clear(Weapon thiswep, entity actor, .entity weaponentity, int fire);
38 void w_ready(Weapon thiswep, entity actor, .entity weaponentity, int fire);
40 vector CL_Weapon_GetShotOrg(float wpn);
42 bool weaponUseForbidden(entity player);
43 bool weaponLocked(entity player);
45 void W_AttachToShotorg(entity actor, .entity weaponentity, entity flash, vector offset);
47 void W_DecreaseAmmo(Weapon wep, entity actor, float ammo_use, .entity weaponentity);
49 void W_DropEvent(.void(Weapon, entity actor, .entity) event, entity player, float weapon_type, entity weapon_item, .entity weaponentity);
51 void W_Reload(entity actor, .entity weaponentity, float sent_ammo_min, Sound sent_sound);
53 void W_ResetGunAlign(entity player, int preferred_alignment);
55 void W_WeaponFrame(Player actor, .entity weaponentity);
57 float W_WeaponRateFactor(entity this);
59 float W_WeaponSpeedFactor(entity this);
61 bool weapon_prepareattack(Weapon thiswep, entity actor, .entity weaponentity, bool secondary, float attacktime);
63 bool weapon_prepareattack_check(Weapon thiswep, entity actor, .entity weaponentity, float secondary, float attacktime);
65 void weapon_prepareattack_do(entity actor, .entity weaponentity, float secondary, float attacktime);
67 void weapon_thinkf(entity actor, .entity weaponentity, WFRAME fr, float t, void(Weapon thiswep, entity actor, .entity weaponentity, int fire) func);