Xonotic
cl_keepaway.qc File Reference
+ Include dependency graph for cl_keepaway.qc:

Go to the source code of this file.

Functions

void HUD_Mod_Keepaway (vector pos, vector mySize)
 

Variables

int kaball_prevstatus
 
float kaball_statuschange_time
 

Function Documentation

◆ HUD_Mod_Keepaway()

void HUD_Mod_Keepaway ( vector  pos,
vector  mySize 
)

Definition at line 13 of file cl_keepaway.qc.

References blink(), bound(), DRAWFLAG_NORMAL, drawpic_aspect_skin, drawpic_aspect_skin_expanding(), eX, eY, kaball_prevstatus, kaball_statuschange_time, mod_active, panel_fg_alpha, time, vec2, and vector().

Referenced by Keepaway::Keepaway ::m_isAlwaysSupported().

14 {
15  mod_active = 1; // keepaway should always show the mod HUD
16 
17  float kaball_alpha = blink(0.85, 0.15, 5);
18 
19  int kaball = (STAT(OBJECTIVE_STATUS) & KA_CARRYING);
20 
21  if(kaball != kaball_prevstatus)
22  {
24  kaball_prevstatus = kaball;
25  }
26 
27  vector kaball_pos, kaball_size;
28 
29  if(mySize.x > mySize.y) {
30  kaball_pos = pos + eX * 0.25 * mySize.x;
31  kaball_size = vec2(0.5 * mySize.x, mySize.y);
32  } else {
33  kaball_pos = pos + eY * 0.25 * mySize.y;
34  kaball_size = vec2(mySize.x, 0.5 * mySize.y);
35  }
36 
37  float kaball_statuschange_elapsedtime = time - kaball_statuschange_time;
38  float f = bound(0, kaball_statuschange_elapsedtime*2, 1);
39 
40  if(kaball_prevstatus && f < 1)
41  drawpic_aspect_skin_expanding(kaball_pos, "keepawayball_carrying", kaball_size, '1 1 1', panel_fg_alpha * kaball_alpha, DRAWFLAG_NORMAL, f);
42 
43  if(kaball)
44  drawpic_aspect_skin(pos, "keepawayball_carrying", vec2(mySize.x, mySize.y), '1 1 1', panel_fg_alpha * kaball_alpha * f, DRAWFLAG_NORMAL);
45 }
float panel_fg_alpha
Definition: hud.qh:166
float kaball_statuschange_time
Definition: cl_keepaway.qc:8
const vector eY
Definition: vector.qh:45
ERASEABLE float blink(float base, float range, float freq)
Definition: util.qc:2044
bool mod_active
Definition: modicons.qh:7
#define drawpic_aspect_skin(pos, pic, sz, color, theAlpha, drawflag)
Definition: draw.qh:78
void drawpic_aspect_skin_expanding(vector position, string pic, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp)
Definition: draw.qc:61
const float DRAWFLAG_NORMAL
Definition: csprogsdefs.qc:317
vector(float skel, float bonenum) _skel_get_boneabs_hidden
const vector eX
Definition: vector.qh:44
#define vec2(...)
Definition: vector.qh:90
int kaball_prevstatus
Definition: cl_keepaway.qc:7
float time
Definition: csprogsdefs.qc:16
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ kaball_prevstatus

int kaball_prevstatus

Definition at line 7 of file cl_keepaway.qc.

Referenced by HUD_Mod_Keepaway().

◆ kaball_statuschange_time

float kaball_statuschange_time

Definition at line 8 of file cl_keepaway.qc.

Referenced by HUD_Mod_Keepaway().