Xonotic
items.qh File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void ItemDraw (entity this)
 

Variables

const int AMMO_COUNT = 4
 
float autocvar_cl_animate_items = 1
 
float autocvar_cl_ghost_items = 0.45
 
vector autocvar_cl_ghost_items_color = '-1 -1 -1'
 
bool autocvar_cl_items_nofade
 
float autocvar_cl_simple_items = 0
 
string autocvar_cl_simpleitems_postfix = "_simple"
 
float autocvar_cl_weapon_stay_alpha = 0.75
 
vector autocvar_cl_weapon_stay_color = '2 0.5 0.5'
 
vector colormod
 
float gravity
 
float onground_time
 
float spawntime
 

Function Documentation

◆ ItemDraw()

void ItemDraw ( entity  this)

Definition at line 41 of file items.qc.

References angles, autocvar_cl_animate_items, avelocity, bound(), frametime, gravity, IS_ONGROUND, Item_SetAlpha(), item_simple, Movetype_Physics_MatchServer(), oldorigin, onground_time, origin, setorigin(), sin(), and time.

Referenced by NET_HANDLE().

42 {
43  if(this.gravity)
44  {
45  Movetype_Physics_MatchServer(this, false);
46  if(IS_ONGROUND(this))
47  { // For some reason avelocity gets set to '0 0 0' here ...
48  this.oldorigin = this.origin;
49  this.gravity = 0;
50 
52  { // ... so reset it if animations are requested.
53  if(this.ItemStatus & ITS_ANIMATE1)
54  this.avelocity = '0 180 0';
55 
56  if(this.ItemStatus & ITS_ANIMATE2)
57  this.avelocity = '0 -90 0';
58  }
59 
60  // delay is for blocking item's position for a while;
61  // it's a workaround for dropped weapons that receive the position
62  // another time right after they spawn overriding animation position
63  this.onground_time = time + 0.5;
64  }
65  }
66  else if (autocvar_cl_animate_items && !this.item_simple) // no bobbing applied to simple items, for consistency's sake (no visual difference between ammo and weapons)
67  {
68  if(this.ItemStatus & ITS_ANIMATE1)
69  {
70  this.angles += this.avelocity * frametime;
71  float fade_in = bound(0, time - this.onground_time, 1);
72  setorigin(this, this.oldorigin + fade_in * ('0 0 10' + '0 0 8' * sin((time - this.onground_time) * 2)));
73  }
74 
75  if(this.ItemStatus & ITS_ANIMATE2)
76  {
77  this.angles += this.avelocity * frametime;
78  float fade_in = bound(0, time - this.onground_time, 1);
79  setorigin(this, this.oldorigin + fade_in * ('0 0 8' + '0 0 4' * sin((time - this.onground_time) * 3)));
80  }
81  }
82 
83  Item_SetAlpha(this);
84 }
float autocvar_cl_animate_items
Definition: items.qh:8
vector oldorigin
Definition: csprogsdefs.qc:102
#define IS_ONGROUND(s)
Definition: movetypes.qh:16
origin
Definition: ent_cs.qc:114
void Item_SetAlpha(entity this)
Definition: items.qc:16
vector avelocity
Definition: csprogsdefs.qc:105
void Movetype_Physics_MatchServer(entity this, bool sloppy)
Definition: movetypes.qc:851
float frametime
Definition: csprogsdefs.qc:17
float gravity
Definition: items.qh:16
float onground_time
Definition: items.qh:5
bool item_simple
Definition: items.qc:13
setorigin(ent, v)
vector angles
Definition: csprogsdefs.qc:104
float time
Definition: csprogsdefs.qc:16
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ AMMO_COUNT

const int AMMO_COUNT = 4

Definition at line 3 of file items.qh.

Referenced by HUD_Ammo().

◆ autocvar_cl_animate_items

float autocvar_cl_animate_items = 1

Definition at line 8 of file items.qh.

Referenced by ItemDraw(), and NET_HANDLE().

◆ autocvar_cl_ghost_items

float autocvar_cl_ghost_items = 0.45

Definition at line 9 of file items.qh.

Referenced by Item_SetAlpha().

◆ autocvar_cl_ghost_items_color

vector autocvar_cl_ghost_items_color = '-1 -1 -1'

Definition at line 10 of file items.qh.

Referenced by Item_SetAlpha().

◆ autocvar_cl_items_nofade

bool autocvar_cl_items_nofade

Definition at line 7 of file items.qh.

Referenced by NET_HANDLE().

◆ autocvar_cl_simple_items

float autocvar_cl_simple_items = 0

Definition at line 13 of file items.qh.

Referenced by NET_HANDLE().

◆ autocvar_cl_simpleitems_postfix

string autocvar_cl_simpleitems_postfix = "_simple"

Definition at line 14 of file items.qh.

◆ autocvar_cl_weapon_stay_alpha

float autocvar_cl_weapon_stay_alpha = 0.75

Definition at line 12 of file items.qh.

Referenced by Item_SetAlpha().

◆ autocvar_cl_weapon_stay_color

vector autocvar_cl_weapon_stay_color = '2 0.5 0.5'

Definition at line 11 of file items.qh.

Referenced by Item_SetAlpha().

◆ colormod

vector colormod

Definition at line 17 of file items.qh.

◆ gravity

◆ onground_time

float onground_time

Definition at line 5 of file items.qh.

Referenced by ItemDraw().

◆ spawntime

float spawntime

Definition at line 15 of file items.qh.

Referenced by NET_HANDLE(), and Projectile_Draw().