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

Go to the source code of this file.

Functions

void HUD_Mod_TeamKeepaway (vector myPos, vector mySize, bool should_draw)

Function Documentation

◆ HUD_Mod_TeamKeepaway()

void HUD_Mod_TeamKeepaway ( vector myPos,
vector mySize,
bool should_draw )

Definition at line 13 of file cl_tka.qc.

14{
15 if (!should_draw)
16 return;
17
18 mod_active = 1; // team keepaway should always show the mod HUD
19
20 float tkaball_alpha = blink(0.85, 0.15, 5);
21
22 int stat_items = STAT(TKA_BALLSTATUS);
23 int tkaball = (stat_items & TKA_BALL_CARRYING);
24
25 if(tkaball != tkaball_prevstatus)
26 {
28 tkaball_prevstatus = tkaball;
29 }
30
31 vector tkaball_pos, tkaball_size;
32
33 if(mySize.x > mySize.y) {
34 tkaball_pos = pos + eX * 0.25 * mySize.x;
35 tkaball_size = vec2(0.5 * mySize.x, mySize.y);
36 } else {
37 tkaball_pos = pos + eY * 0.25 * mySize.y;
38 tkaball_size = vec2(mySize.x, 0.5 * mySize.y);
39 }
40
41 float tkaball_statuschange_elapsedtime = time - tkaball_statuschange_time;
42 float f = bound(0, tkaball_statuschange_elapsedtime*2, 1);
43
44 if(tkaball_prevstatus && f < 1)
45 drawpic_aspect_skin_expanding(tkaball_pos, "keepawayball_carrying", tkaball_size, '1 1 1', panel_fg_alpha * tkaball_alpha, DRAWFLAG_NORMAL, f);
46
47 if(stat_items & TKA_BALL_CARRYING) // TODO: unique team based icon while carrying
48 drawpic_aspect_skin(pos, "keepawayball_carrying", vec2(mySize.x, mySize.y), '1 1 1', panel_fg_alpha * tkaball_alpha * f, DRAWFLAG_NORMAL);
49 else if(stat_items & TKA_BALL_TAKEN_RED)
50 drawpic_aspect_skin(pos, "tka_taken_red", vec2(mySize.x, mySize.y), '1 1 1', panel_fg_alpha * tkaball_alpha * f, DRAWFLAG_NORMAL);
51 else if(stat_items & TKA_BALL_TAKEN_BLUE)
52 drawpic_aspect_skin(pos, "tka_taken_blue", vec2(mySize.x, mySize.y), '1 1 1', panel_fg_alpha * tkaball_alpha * f, DRAWFLAG_NORMAL);
53 else if(stat_items & TKA_BALL_TAKEN_YELLOW)
54 drawpic_aspect_skin(pos, "tka_taken_yellow", vec2(mySize.x, mySize.y), '1 1 1', panel_fg_alpha * tkaball_alpha * f, DRAWFLAG_NORMAL);
55 else if(stat_items & TKA_BALL_TAKEN_PINK)
56 drawpic_aspect_skin(pos, "tka_taken_pink", vec2(mySize.x, mySize.y), '1 1 1', panel_fg_alpha * tkaball_alpha * f, DRAWFLAG_NORMAL);
57}
float tkaball_statuschange_time
Definition cl_tka.qc:8
int tkaball_prevstatus
Definition cl_tka.qc:7
void drawpic_aspect_skin_expanding(vector position, string pic, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp)
Definition draw.qc:61
#define drawpic_aspect_skin(pos, pic, sz, color, theAlpha, drawflag)
Definition draw.qh:78
ERASEABLE float blink(float base, float range, float freq)
Definition util.qc:2274
const float DRAWFLAG_NORMAL
float time
float panel_fg_alpha
Definition hud.qh:169
#define STAT(...)
Definition stats.qh:82
float bound(float min, float value, float max)
bool mod_active
Definition modicons.qh:7
vector
Definition self.qh:92
const int TKA_BALL_CARRYING
Definition tka.qh:71
const int TKA_BALL_TAKEN_YELLOW
Definition tka.qh:69
const int TKA_BALL_TAKEN_RED
Definition tka.qh:67
const int TKA_BALL_TAKEN_PINK
Definition tka.qh:70
const int TKA_BALL_TAKEN_BLUE
Definition tka.qh:68
const vector eY
Definition vector.qh:45
const vector eX
Definition vector.qh:44
#define vec2(...)
Definition vector.qh:90

References blink(), bound(), DRAWFLAG_NORMAL, drawpic_aspect_skin, drawpic_aspect_skin_expanding(), eX, eY, mod_active, panel_fg_alpha, STAT, time, TKA_BALL_CARRYING, TKA_BALL_TAKEN_BLUE, TKA_BALL_TAKEN_PINK, TKA_BALL_TAKEN_RED, TKA_BALL_TAKEN_YELLOW, tkaball_prevstatus, tkaball_statuschange_time, vec2, and vector.

Referenced by TeamKeepaway::void().