Weapon virtual functions

From ZDoom Wiki
Jump to navigation Jump to search
Called when the level is first loaded if the weapon has neither a defined slot number property nor is assigned to a slot in a player class. Returns the slot number of the weapon and its slot priority multiplied by 65536.
Returns the weapon's Ready state. Called by multiple functions when setting a weapon to its Ready state (e.g. A_Raise).
Returns the weapon's Select state. Called when a pending weapon becomes the player's current weapon.
Returns the weapon's Deselect state. Called when a pending weapon has been queued up and the current weapon needs to be lowered.
Returns the weapon's Fire state. Called by PlayerPawn's fire function.
  • hold - If true, returns the Hold state instead if one is found, otherwise returning Fire.
Returns the weapon's Altfire state. Called by PlayerPawn's alt fire function
  • hold - If true, returns the AltHold state instead if one is found, otherwise returning Altfire.
Plays the weapon's UpSound. Called when a pending weapon becomes the player's current weapon.
  • origin - The actor to play the sound from.
Called when a Tome of Power expires and the weapon is currently powered up.
  • bool CheckAmmo(int fireMode, bool autoSwitch, bool requireAmmo = false, int ammocount = -1)
Called when the game checks to see if a weapon has enough ammo either for firing or for switching to. Returns true if the weapon has enough ammo.
  • bool DepleteAmmo(bool altFire, bool checkEnough = true, int ammouse = -1)
Called to consume ammo when attacking.
Allows modifying the weapon bob values after they have been calculated by the BobWeapon() call on the PlayerPawn.
  • bob - the bob value received from BobWeapon().
  • layer - the number of the layer that is bobbing.
  • ticfrac - current tic fraction.
By default the function returns bob unmodified.
  • ui Vector3, Vector3 ModifyBobLayer3D(Vector3 Translation, Vector3 Rotation, int layer, double ticfrac)
Allows modifying the weapon bob values for 3D-model-based weapons after they have been calculated by the BobWeapon3D() call on the PlayerPawn.
  • Translation - the 3D position value received from BobWeapon3D().
  • Rotation - the 3D rotation value received from BobWeapon3D().
  • layer - the number of the layer that is bobbing.
  • ticfrac - current tic fraction.
By default the function returns Translation, Rotation unmodified.
(Need more info)