Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
weapon.qh File Reference
Include dependency graph for weapon.qh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  OffhandWeapon
class  Weapon
 fields which are explicitly/manually set are marked with "M", fields set automatically are marked with "A" More...
class  WeaponPickup

Macros

#define SPAWNFUNC_WEAPON(name, weapon)

Typedefs

using WepSet = vector

Enumerations

enum  {
  WEPARENA_OFF , WEPARENA_NONE , WEPARENA_CUSTOM , WEPARENA_ALL ,
  WEPARENA_ALL_AVAILABLE , WEPARENA_STANDARD , WEPARENA_STANDARD_AVAILABLE , WEPARENA_EXTENDED ,
  WEPARENA_EXTENDED_AVAILABLE , WEPARENA_DEVALL , WEPARENA_DEVALL_AVAILABLE
}

Functions

int weaponslot (.entity weaponentity)

Variables

int autocvar_cl_tracers_teamcolor
int max_shot_distance = 32768
const int MAX_WEAPONSLOTS = 2
OffhandWeapon offhand
entity weaponentities [MAX_WEAPONSLOTS]
string weaponorder_byid
const int WEP_FLAG_BLEED = BIT(14)
 weapon pierces and causes bleeding (used for damage effects)
const int WEP_FLAG_CANCLIMB = BIT(3)
 can be used for movement
const int WEP_FLAG_DUALWIELD = BIT(11)
 weapon can be dual wielded
const int WEP_FLAG_HIDDEN = BIT(5)
 hides from menu
const int WEP_FLAG_MUTATORBLOCKED = BIT(8)
 hides from impulse 99 etc. (mutators are allowed to clear this flag)
const int WEP_FLAG_NODUAL = BIT(12)
 weapon doesn't work well with dual wielding (fireball etc just explode on fire), doesn't currently prevent anything
const int WEP_FLAG_NORMAL = BIT(4)
 in "most weapons" set
const int WEP_FLAG_NOTRUEAIM = BIT(15)
 weapon doesn't aim directly at targets
const int WEP_FLAG_PENETRATEWALLS = BIT(13)
 weapon has high calibur bullets that can penetrate thick walls (WEAPONTODO)
const int WEP_FLAG_RELOADABLE = BIT(6)
 can has reload
const int WEP_FLAG_SPECIALATTACK = BIT(16)
 special attack (not a true weapon); NOTE: if this flag is set then WEP_FLAG_HIDDEN must be set as well
const int WEP_FLAG_SUPERWEAPON = BIT(7)
 powerup timer
const int WEP_TYPE_HITSCAN = BIT(2)
 hitscan
const int WEP_TYPE_MELEE_PRI = BIT(9)
 primary attack is melee swing (for animation)
const int WEP_TYPE_MELEE_SEC = BIT(10)
 secondary attack is melee swing (for animation)
const int WEP_TYPE_OTHER = BIT(0)
 not for damaging people
const int WEP_TYPE_SPLASH = BIT(1)
 splash damage
const int WS_CLEAR = 0
 no weapon selected
const int WS_DROP = 2
 deselecting frame
const int WS_INUSE = 3
 fire state
const int WS_RAISE = 1
 raise frame
const int WS_READY = 4
 idle frame

Macro Definition Documentation

◆ SPAWNFUNC_WEAPON

#define SPAWNFUNC_WEAPON ( name,
weapon )
Value:
{ \
this.itemdef = weapon; \
InitializeEntity(this, StartItem, INITPRIO_DROPTOFLOOR); \
}
const int INITPRIO_DROPTOFLOOR
Definition constants.qh:90
string name
Definition menu.qh:30
float weapon
Definition progsdefs.qc:139
void StartItem(entity this)
Definition items.qc:1008
entity itemdef
Definition items.qh:92
#define spawnfunc(id)
Definition spawnfunc.qh:107

Definition at line 184 of file weapon.qh.

184#define SPAWNFUNC_WEAPON(name, weapon) \
185 spawnfunc(name) \
186 { \
187 this.itemdef = weapon; \
188 InitializeEntity(this, StartItem, INITPRIO_DROPTOFLOOR); \
189 }

Referenced by REGISTER_WEAPON(), REGISTER_WEAPON(), REGISTER_WEAPON(), REGISTER_WEAPON(), REGISTER_WEAPON(), REGISTER_WEAPON(), REGISTER_WEAPON(), REGISTER_WEAPON(), REGISTER_WEAPON(), REGISTER_WEAPON(), REGISTER_WEAPON(), REGISTER_WEAPON(), REGISTER_WEAPON(), REGISTER_WEAPON(), REGISTER_WEAPON(), REGISTER_WEAPON(), REGISTER_WEAPON(), and REGISTER_WEAPON().

Typedef Documentation

◆ WepSet

using WepSet = vector

Definition at line 13 of file weapon.qh.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
WEPARENA_OFF 
WEPARENA_NONE 
WEPARENA_CUSTOM 
WEPARENA_ALL 
WEPARENA_ALL_AVAILABLE 
WEPARENA_STANDARD 
WEPARENA_STANDARD_AVAILABLE 
WEPARENA_EXTENDED 
WEPARENA_EXTENDED_AVAILABLE 
WEPARENA_DEVALL 
WEPARENA_DEVALL_AVAILABLE 

Definition at line 270 of file weapon.qh.

271{
283};
@ WEPARENA_ALL
Definition weapon.qh:275
@ WEPARENA_ALL_AVAILABLE
Definition weapon.qh:276
@ WEPARENA_NONE
Definition weapon.qh:273
@ WEPARENA_EXTENDED_AVAILABLE
Definition weapon.qh:280
@ WEPARENA_STANDARD_AVAILABLE
Definition weapon.qh:278
@ WEPARENA_EXTENDED
Definition weapon.qh:279
@ WEPARENA_DEVALL
Definition weapon.qh:281
@ WEPARENA_STANDARD
Definition weapon.qh:277
@ WEPARENA_DEVALL_AVAILABLE
Definition weapon.qh:282
@ WEPARENA_OFF
Definition weapon.qh:272
@ WEPARENA_CUSTOM
Definition weapon.qh:274

Function Documentation

◆ weaponslot()

int weaponslot ( .entity weaponentity)

Definition at line 18 of file weapon.qh.

19{
20 for (int i = 0; i < MAX_WEAPONSLOTS; ++i)
21 if (weaponentities[i] == weaponentity)
22 return i;
23 return 0;
24}
const int MAX_WEAPONSLOTS
Definition weapon.qh:15
entity weaponentities[MAX_WEAPONSLOTS]
Definition weapon.qh:16

References entity(), MAX_WEAPONSLOTS, and weaponentities.

Referenced by _wepent_send(), client_hasweapon(), GrapplingHookSend(), Monster_Attack_Check(), W_Arc_Beam_Send(), W_MuzzleFlash(), W_Reload(), W_WeaponFrame(), weapon_prepareattack_do(), and wframe_send().

Variable Documentation

◆ autocvar_cl_tracers_teamcolor

int autocvar_cl_tracers_teamcolor

Definition at line 243 of file weapon.qh.

Referenced by NET_HANDLE(), and NET_HANDLE().

◆ max_shot_distance

◆ MAX_WEAPONSLOTS

◆ offhand

OffhandWeapon offhand

Definition at line 235 of file weapon.qh.

Referenced by client_hasweapon().

◆ weaponentities

entity weaponentities[MAX_WEAPONSLOTS]

Definition at line 16 of file weapon.qh.

Referenced by AppendItemcodes(), bot_cmd_debug_assert_canfire(), bot_cmd_select_weapon(), bumblebee_gunner_enter(), bumblebee_gunner_exit(), CheatCommand(), CL_SpawnWeaponentity(), CreatureFrame_FallDamage(), Damage(), Drag_Update(), FixIntermissionClient(), for(), formatmessage(), freezetag_Freeze(), freezetag_Unfreeze(), GameCommand_animbench(), GameCommand_gettaginfo(), GiveBall(), GiveItems(), havocbot_ai(), havocbot_movetogoal(), IMPULSE(), IMPULSE(), IMPULSE(), IMPULSE(), IMPULSE(), IMPULSE(), IMPULSE(), IMPULSE(), IMPULSE(), Item_GiveTo(), M_Wyvern_Attack_Fireball(), Monster_Remove(), Monster_Think(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), nade_ammo_touch(), NIX_GiveCurrentWeapon(), ObserverOrSpectatorThink(), OffhandHook::offhand_think(), PlayerDamage(), PlayerPreThink(), PlayerThink(), PM_check_hitground(), PM_ClientMovement_UpdateStatus(), Portal_Think(), PutObserverInServer(), PutPlayerInServer(), racer_frame(), raptor_frame(), REGISTER_MUTATOR(), RemoveGrapplingHooks(), REPLICATE_APPLYCHANGE(), Reset_ArcBeam(), reset_map(), SetSpectatee(), spawn_held_nade(), spiderbot_frame(), TEST(), Turret::tr_attack(), trigger_magicear_processmessage(), turret_initialize(), vehicles_enter(), vehicles_exit(), vehicles_spawn(), W_Devastator_Unregister(), W_DualWielding(), W_GunAlign(), W_ResetGunAlign(), W_WeaponFrame(), weapon_byid_handle(), weapon_group_handle(), weapon_prepareattack_do(), weaponslot(), and X().

◆ weaponorder_byid

string weaponorder_byid

Definition at line 266 of file weapon.qh.

Referenced by STATIC_INIT(), W_NextWeapon(), and W_PreviousWeapon().

◆ WEP_FLAG_BLEED

const int WEP_FLAG_BLEED = BIT(14)

weapon pierces and causes bleeding (used for damage effects)

Definition at line 261 of file weapon.qh.

Referenced by DamageEffect().

◆ WEP_FLAG_CANCLIMB

const int WEP_FLAG_CANCLIMB = BIT(3)

can be used for movement

Definition at line 250 of file weapon.qh.

Referenced by PlayerDamage().

◆ WEP_FLAG_DUALWIELD

const int WEP_FLAG_DUALWIELD = BIT(11)

weapon can be dual wielded

Definition at line 258 of file weapon.qh.

Referenced by client_hasweapon(), and W_WeaponFrame().

◆ WEP_FLAG_HIDDEN

◆ WEP_FLAG_MUTATORBLOCKED

◆ WEP_FLAG_NODUAL

const int WEP_FLAG_NODUAL = BIT(12)

weapon doesn't work well with dual wielding (fireball etc just explode on fire), doesn't currently prevent anything

Definition at line 259 of file weapon.qh.

◆ WEP_FLAG_NORMAL

const int WEP_FLAG_NORMAL = BIT(4)

in "most weapons" set

Definition at line 251 of file weapon.qh.

Referenced by NIX_CanChooseWeapon(), want_weapon(), and weapons_standard().

◆ WEP_FLAG_NOTRUEAIM

const int WEP_FLAG_NOTRUEAIM = BIT(15)

weapon doesn't aim directly at targets

Definition at line 262 of file weapon.qh.

Referenced by TrueAimCheck().

◆ WEP_FLAG_PENETRATEWALLS

const int WEP_FLAG_PENETRATEWALLS = BIT(13)

weapon has high calibur bullets that can penetrate thick walls (WEAPONTODO)

Definition at line 260 of file weapon.qh.

Referenced by W_SetupShot_Dir_ProjectileSize_Range().

◆ WEP_FLAG_RELOADABLE

const int WEP_FLAG_RELOADABLE = BIT(6)

can has reload

Definition at line 253 of file weapon.qh.

Referenced by havocbot_ai(), NIX_GiveCurrentWeapon(), PutPlayerInServer(), W_Reload(), and W_WeaponFrame().

◆ WEP_FLAG_SPECIALATTACK

const int WEP_FLAG_SPECIALATTACK = BIT(16)

special attack (not a true weapon); NOTE: if this flag is set then WEP_FLAG_HIDDEN must be set as well

Definition at line 263 of file weapon.qh.

Referenced by Dump_Weapon_Settings(), fixPriorityList(), STATIC_INIT(), and STATIC_INIT().

◆ WEP_FLAG_SUPERWEAPON

const int WEP_FLAG_SUPERWEAPON = BIT(7)

powerup timer

Definition at line 254 of file weapon.qh.

Referenced by spritelookupblinkvalue(), startsWith(), STATIC_INIT(), weapon_defaultspawnfunc(), and weapons_extended().

◆ WEP_TYPE_HITSCAN

const int WEP_TYPE_HITSCAN = BIT(2)

hitscan

Definition at line 249 of file weapon.qh.

◆ WEP_TYPE_MELEE_PRI

const int WEP_TYPE_MELEE_PRI = BIT(9)

primary attack is melee swing (for animation)

Definition at line 256 of file weapon.qh.

Referenced by nade_damage(), and weapon_thinkf().

◆ WEP_TYPE_MELEE_SEC

const int WEP_TYPE_MELEE_SEC = BIT(10)

secondary attack is melee swing (for animation)

Definition at line 257 of file weapon.qh.

Referenced by nade_damage(), and weapon_thinkf().

◆ WEP_TYPE_OTHER

const int WEP_TYPE_OTHER = BIT(0)

not for damaging people

Definition at line 247 of file weapon.qh.

Referenced by Scoreboard_AccuracyAndItemStats_Draw(), Scoreboard_AccuracyStats_Draw(), and STATIC_INIT().

◆ WEP_TYPE_SPLASH

const int WEP_TYPE_SPLASH = BIT(1)

splash damage

Definition at line 248 of file weapon.qh.

◆ WS_CLEAR

const int WS_CLEAR = 0

no weapon selected

Definition at line 28 of file weapon.qh.

Referenced by viewmodel_draw(), w_enddrop(), and W_WeaponFrame().

◆ WS_DROP

const int WS_DROP = 2

deselecting frame

Definition at line 30 of file weapon.qh.

Referenced by NET_HANDLE(), viewmodel_draw(), and W_WeaponFrame().

◆ WS_INUSE

const int WS_INUSE = 3

fire state

Definition at line 31 of file weapon.qh.

Referenced by W_Hagar_Attack2_Load(), W_WeaponFrame(), and weapon_prepareattack_do().

◆ WS_RAISE

const int WS_RAISE = 1

raise frame

Definition at line 29 of file weapon.qh.

Referenced by NET_HANDLE(), viewmodel_draw(), W_WeaponFrame(), and weapon_thinkf().

◆ WS_READY