Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
cl_tka.qc File Reference
#include "cl_tka.qh"
#include <client/draw.qh>
#include <client/hud/panel/modicons.qh>
Include dependency graph for cl_tka.qc:
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 pos, vector mySize)

Variables

int tkaball_prevstatus
float tkaball_statuschange_time

Function Documentation

◆ HUD_Mod_TeamKeepaway()

void HUD_Mod_TeamKeepaway ( vector pos,
vector mySize )

Definition at line 13 of file cl_tka.qc.

14{
15 mod_active = 1; // team keepaway should always show the mod HUD
16
17 float tkaball_alpha = blink(0.85, 0.15, 5);
18
19 int stat_items = STAT(TKA_BALLSTATUS);
20 int tkaball = (stat_items & TKA_BALL_CARRYING);
21
22 if(tkaball != tkaball_prevstatus)
23 {
25 tkaball_prevstatus = tkaball;
26 }
27
28 vector tkaball_pos, tkaball_size;
29
30 if(mySize.x > mySize.y) {
31 tkaball_pos = pos + eX * 0.25 * mySize.x;
32 tkaball_size = vec2(0.5 * mySize.x, mySize.y);
33 } else {
34 tkaball_pos = pos + eY * 0.25 * mySize.y;
35 tkaball_size = vec2(mySize.x, 0.5 * mySize.y);
36 }
37
38 float tkaball_statuschange_elapsedtime = time - tkaball_statuschange_time;
39 float f = bound(0, tkaball_statuschange_elapsedtime*2, 1);
40
41 if(tkaball_prevstatus && f < 1)
42 drawpic_aspect_skin_expanding(tkaball_pos, "keepawayball_carrying", tkaball_size, '1 1 1', panel_fg_alpha * tkaball_alpha, DRAWFLAG_NORMAL, f);
43
44 if(stat_items & TKA_BALL_CARRYING) // TODO: unique team based icon while carrying
45 drawpic_aspect_skin(pos, "keepawayball_carrying", vec2(mySize.x, mySize.y), '1 1 1', panel_fg_alpha * tkaball_alpha * f, DRAWFLAG_NORMAL);
46 else if(stat_items & TKA_BALL_TAKEN_RED)
47 drawpic_aspect_skin(pos, "tka_taken_red", vec2(mySize.x, mySize.y), '1 1 1', panel_fg_alpha * tkaball_alpha * f, DRAWFLAG_NORMAL);
48 else if(stat_items & TKA_BALL_TAKEN_BLUE)
49 drawpic_aspect_skin(pos, "tka_taken_blue", vec2(mySize.x, mySize.y), '1 1 1', panel_fg_alpha * tkaball_alpha * f, DRAWFLAG_NORMAL);
50 else if(stat_items & TKA_BALL_TAKEN_YELLOW)
51 drawpic_aspect_skin(pos, "tka_taken_yellow", vec2(mySize.x, mySize.y), '1 1 1', panel_fg_alpha * tkaball_alpha * f, DRAWFLAG_NORMAL);
52 else if(stat_items & TKA_BALL_TAKEN_PINK)
53 drawpic_aspect_skin(pos, "tka_taken_pink", vec2(mySize.x, mySize.y), '1 1 1', panel_fg_alpha * tkaball_alpha * f, DRAWFLAG_NORMAL);
54}
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:2178
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:66
const int TKA_BALL_TAKEN_YELLOW
Definition tka.qh:64
const int TKA_BALL_TAKEN_RED
Definition tka.qh:62
const int TKA_BALL_TAKEN_PINK
Definition tka.qh:65
const int TKA_BALL_TAKEN_BLUE
Definition tka.qh:63
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().

Variable Documentation

◆ tkaball_prevstatus

int tkaball_prevstatus

Definition at line 7 of file cl_tka.qc.

Referenced by HUD_Mod_TeamKeepaway().

◆ tkaball_statuschange_time

float tkaball_statuschange_time

Definition at line 8 of file cl_tka.qc.

Referenced by HUD_Mod_TeamKeepaway().