X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;ds=inline;f=qcsrc%2Fserver%2Fweapons%2Fweaponsystem.qh;h=284c1efc62443bbc1db8e3dab0791edcf0a956df;hb=f8da4c3a82ee2899e90c84af196ca0f530ac5447;hp=91879feb2a9a95548eb6008c500498bc79a07a09;hpb=865b6850172f0afde171d638656bef17fc49e336;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/weapons/weaponsystem.qh b/qcsrc/server/weapons/weaponsystem.qh index 91879feb2..284c1efc6 100644 --- a/qcsrc/server/weapons/weaponsystem.qh +++ b/qcsrc/server/weapons/weaponsystem.qh @@ -1,15 +1,46 @@ #pragma once -#include -#include +#include + +#define INDEPENDENT_ATTACK_FINISHED 1 + +// there is 2 weapon tics that can run in one server frame +const int W_TICSPERFRAME = 2; + +// VorteX: standalone think for weapons, so normal think on weaponentity can be reserved by weaponflashes (which needs update even player dies) +.float weapon_nextthink; +.void(Weapon thiswep, entity actor, .entity weaponentity, int fire) weapon_think; float internalteam; entity weapon_dropevent_item; +// reset to 0 on weapon switch +// may be useful to all weapons +.float bulletcounter; + ..entity weaponentity_fld; +.float weapon_load[REGISTRY_MAX(Weapons)]; +.int ammo_none; // used by the reloading system, must always be 0 +.int clip_load; +.int old_clip_load; +.int clip_size; + +.float attack_finished_for[REGISTRY_MAX(Weapons) * MAX_WEAPONSLOTS]; +.float attack_finished_single[MAX_WEAPONSLOTS]; +#if INDEPENDENT_ATTACK_FINISHED +#define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).(attack_finished_for[((w) - WEP_FIRST) * MAX_WEAPONSLOTS + (slot)])) +#else +#define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).attack_finished_single[slot]) +#endif +#define ATTACK_FINISHED(ent, w) ATTACK_FINISHED_FOR(ent, ent.(w).m_weapon.m_id, weaponslot(w)) + void CL_SpawnWeaponentity(entity e, .entity weaponentity); +void w_clear(Weapon thiswep, entity actor, .entity weaponentity, int fire); + +void w_ready(Weapon thiswep, entity actor, .entity weaponentity, int fire); + vector CL_Weapon_GetShotOrg(float wpn); bool weaponUseForbidden(entity player); @@ -23,6 +54,8 @@ void W_DropEvent(.void(Weapon, entity actor, .entity) event, entity player, floa void W_Reload(entity actor, .entity weaponentity, float sent_ammo_min, Sound sent_sound); +void W_ResetGunAlign(entity player, int preferred_alignment); + void W_WeaponFrame(Player actor, .entity weaponentity); float W_WeaponRateFactor(entity this);