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

Go to the source code of this file.

Functions

 classfield (TeamRadar) .float teamradar_icon
 
void draw_teamradar_background (float fg)
 
void draw_teamradar_icon (vector coord, entity icon, entity pingdata, vector rgb, float a)
 
void draw_teamradar_link (vector start, vector end, int colors)
 
void draw_teamradar_player (vector coord3d, vector pangles, vector rgb)
 
 entityclass (TeamRadar)
 
vector teamradar_2dcoord_to_texcoord (vector in)
 
vector teamradar_3dcoord_to_texcoord (vector in)
 
void teamradar_loadcvars ()
 
vector teamradar_texcoord_to_2dcoord (vector in)
 
vector teamradar_texcoord_to_3dcoord (vector in, float oz)
 

Variables

float hud_panel_radar_foreground_alpha
 
int hud_panel_radar_maximized_rotation
 
int hud_panel_radar_maximized_zoommode
 
int hud_panel_radar_rotation
 
float hud_panel_radar_scale
 
vector hud_panel_radar_size
 
int hud_panel_radar_zoommode
 
const int MAX_TEAMRADAR_TIMES = 32
 
float teamradar_angle
 
vector teamradar_extraclip_maxs
 
vector teamradar_extraclip_mins
 
vector teamradar_origin2d
 
vector teamradar_origin3d_in_texcoord
 
float teamradar_size
 
vector teamradar_size2d
 
float v_flipped
 

Function Documentation

◆ classfield()

classfield ( TeamRadar  )

◆ draw_teamradar_background()

void draw_teamradar_background ( float  fg)

Definition at line 60 of file teamradar.qc.

References DRAWFLAG_MIPMAP, DRAWFLAG_SCREEN, minimapname, teamradar_texcoord_to_2dcoord(), v_flipped, vector(), and yinvert.

Referenced by HUD_Radar().

61 {
62  float fga;
63  vector fgc;
64 
65  if(fg > 0 && minimapname != "")
66  {
67  fga = 1;
68  fgc = '1 1 1' * fg;
69  R_BeginPolygon(minimapname, DRAWFLAG_SCREEN | DRAWFLAG_MIPMAP, true);
70  if(v_flipped)
71  {
72  R_PolygonVertex(teamradar_texcoord_to_2dcoord(mi_pictexcoord3), yinvert(mi_pictexcoord3), fgc, fga);
73  R_PolygonVertex(teamradar_texcoord_to_2dcoord(mi_pictexcoord2), yinvert(mi_pictexcoord2), fgc, fga);
74  R_PolygonVertex(teamradar_texcoord_to_2dcoord(mi_pictexcoord1), yinvert(mi_pictexcoord1), fgc, fga);
75  R_PolygonVertex(teamradar_texcoord_to_2dcoord(mi_pictexcoord0), yinvert(mi_pictexcoord0), fgc, fga);
76  }
77  else
78  {
79  R_PolygonVertex(teamradar_texcoord_to_2dcoord(mi_pictexcoord0), yinvert(mi_pictexcoord0), fgc, fga);
80  R_PolygonVertex(teamradar_texcoord_to_2dcoord(mi_pictexcoord1), yinvert(mi_pictexcoord1), fgc, fga);
81  R_PolygonVertex(teamradar_texcoord_to_2dcoord(mi_pictexcoord2), yinvert(mi_pictexcoord2), fgc, fga);
82  R_PolygonVertex(teamradar_texcoord_to_2dcoord(mi_pictexcoord3), yinvert(mi_pictexcoord3), fgc, fga);
83  }
84  R_EndPolygon();
85  }
86 }
float v_flipped
Definition: teamradar.qh:18
const float DRAWFLAG_SCREEN
Definition: csprogsdefs.qc:321
const float DRAWFLAG_MIPMAP
Definition: csprogsdefs.qc:322
vector teamradar_texcoord_to_2dcoord(vector in)
Definition: teamradar.qc:17
vector(float skel, float bonenum) _skel_get_boneabs_hidden
string minimapname
Definition: main.qh:27
#define yinvert(v)
Definition: vector.qh:112
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_teamradar_icon()

void draw_teamradar_icon ( vector  coord,
entity  icon,
entity  pingdata,
vector  rgb,
float  a 
)

Definition at line 128 of file teamradar.qc.

References DRAWFLAG_ADDITIVE, ftos(), MAX_TEAMRADAR_TIMES, strcat(), teamradar_3dcoord_to_texcoord(), teamradar_size, teamradar_texcoord_to_2dcoord(), time, v, and vector().

Referenced by HUD_Radar().

129 {
131  drawpic_builtin(coord - '4 4 0', strcat("gfx/teamradar_icon_", ftos(icon.m_radaricon)), '8 8 0', rgb, a, 0);
132 
133  if(pingdata)
134  {
135  for(int i = 0; i < MAX_TEAMRADAR_TIMES; ++i)
136  {
137  float dt = pingdata.(teamradar_times[i]);
138  if(dt == 0)
139  continue;
140  dt = time - dt;
141  if(dt >= 1 || dt <= 0)
142  continue;
143  vector v = '2 2 0' * teamradar_size * dt;
144  drawpic_builtin(coord - 0.5 * v, "gfx/teamradar_ping", v, '1 1 1', (1 - dt) * a, DRAWFLAG_ADDITIVE);
145  }
146  }
147 }
const int MAX_TEAMRADAR_TIMES
Definition: teamradar.qh:3
vector teamradar_3dcoord_to_texcoord(vector in)
Definition: teamradar.qc:8
const float DRAWFLAG_ADDITIVE
Definition: csprogsdefs.qc:318
vector teamradar_texcoord_to_2dcoord(vector in)
Definition: teamradar.qc:17
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
vector(float skel, float bonenum) _skel_get_boneabs_hidden
float teamradar_size
Definition: teamradar.qh:17
vector v
Definition: ent_cs.qc:116
float time
Definition: csprogsdefs.qc:16
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_teamradar_link()

void draw_teamradar_link ( vector  start,
vector  end,
int  colors 
)

Definition at line 149 of file teamradar.qc.

References colormapPaletteColor, normalize(), panel_fg_alpha, TC, teamradar_3dcoord_to_texcoord(), teamradar_texcoord_to_2dcoord(), and vector().

Referenced by HUD_Radar().

150 {
151  TC(int, colors);
152  vector c0, c1, norm;
153 
156  norm = normalize(start - end);
157  norm.z = norm.x;
158  norm.x = -norm.y;
159  norm.y = norm.z;
160  norm.z = 0;
161 
162  c0 = colormapPaletteColor(colors & 0x0F, false);
163  c1 = colormapPaletteColor((colors & 0xF0) / 0x10, false);
164 
165  R_BeginPolygon("", 0, true);
166  R_PolygonVertex(start - norm, '0 0 0', c0, panel_fg_alpha);
167  R_PolygonVertex(start + norm, '0 1 0', c0, panel_fg_alpha);
168  R_PolygonVertex(end + norm, '1 1 0', c1, panel_fg_alpha);
169  R_PolygonVertex(end - norm, '1 0 0', c1, panel_fg_alpha);
170  R_EndPolygon();
171 }
float panel_fg_alpha
Definition: hud.qh:166
vector teamradar_3dcoord_to_texcoord(vector in)
Definition: teamradar.qc:8
vector teamradar_texcoord_to_2dcoord(vector in)
Definition: teamradar.qc:17
#define TC(T, sym)
Definition: _all.inc:82
vector(float skel, float bonenum) _skel_get_boneabs_hidden
#define colormapPaletteColor(c, isPants)
Definition: color.qh:5
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_teamradar_player()

void draw_teamradar_player ( vector  coord3d,
vector  pangles,
vector  rgb 
)

Definition at line 88 of file teamradar.qc.

References normalize(), panel_fg_alpha, teamradar_3dcoord_to_texcoord(), teamradar_angle, teamradar_texcoord_to_2dcoord(), v_flipped, and vector().

Referenced by HUD_Radar().

89 {
90  vector coord, rgb2;
91 
93 
94  vector forward, right, up;
95  MAKE_VECTORS(pangles - '0 1 0' * teamradar_angle, forward, right, up);
96  if(v_flipped)
97  {
98  forward.x = -forward.x;
99  right.x = -right.x;
100  up.x = -up.x; // TODO: unused!
101  }
102  forward.z = 0;
103  forward = normalize(forward);
104  forward.y *= -1.0;
105  right.x = -forward.y;
106  right.y = forward.x;
107 
108  if(rgb == '1 1 1')
109  rgb2 = '0 0 0';
110  else
111  rgb2 = '1 1 1';
112 
113  R_BeginPolygon("", 0, true);
114  R_PolygonVertex(coord+forward*3, '0 0 0', rgb2, panel_fg_alpha);
115  R_PolygonVertex(coord+right*4-forward*2.5, '0 1 0', rgb2, panel_fg_alpha);
116  R_PolygonVertex(coord-forward*2, '1 0 0', rgb2, panel_fg_alpha);
117  R_PolygonVertex(coord-right*4-forward*2.5, '1 1 0', rgb2, panel_fg_alpha);
118  R_EndPolygon();
119 
120  R_BeginPolygon("", 0, true);
121  R_PolygonVertex(coord+forward*2, '0 0 0', rgb, panel_fg_alpha);
122  R_PolygonVertex(coord+right*3-forward*2, '0 1 0', rgb, panel_fg_alpha);
123  R_PolygonVertex(coord-forward, '1 0 0', rgb, panel_fg_alpha);
124  R_PolygonVertex(coord-right*3-forward*2, '1 1 0', rgb, panel_fg_alpha);
125  R_EndPolygon();
126 }
float panel_fg_alpha
Definition: hud.qh:166
vector teamradar_3dcoord_to_texcoord(vector in)
Definition: teamradar.qc:8
float v_flipped
Definition: teamradar.qh:18
float teamradar_angle
Definition: teamradar.qh:12
vector teamradar_texcoord_to_2dcoord(vector in)
Definition: teamradar.qc:17
vector(float skel, float bonenum) _skel_get_boneabs_hidden
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ entityclass()

entityclass ( TeamRadar  )

◆ teamradar_2dcoord_to_texcoord()

vector teamradar_2dcoord_to_texcoord ( vector  in)

Definition at line 33 of file teamradar.qc.

References DEG2RAD, Rotate(), teamradar_angle, teamradar_origin2d, teamradar_origin3d_in_texcoord, teamradar_size, v_flipped, and vector().

Referenced by HUD_Radar_Mouse().

34 {
35  vector out;
36  out = in;
37 
38  out -= teamradar_origin2d;
39  if(v_flipped)
40  out_x = -out_x;
41  out = out / teamradar_size;
42 
43  out_y = - out_y; // screen space is reversed
44  out = Rotate(out, -teamradar_angle * DEG2RAD);
45 
47 
48  return out;
49 }
float DEG2RAD
Definition: csprogsdefs.qc:961
float v_flipped
Definition: teamradar.qh:18
float teamradar_angle
Definition: teamradar.qh:12
vector(float skel, float bonenum) _skel_get_boneabs_hidden
float teamradar_size
Definition: teamradar.qh:17
vector teamradar_origin3d_in_texcoord
Definition: teamradar.qh:13
vector teamradar_origin2d
Definition: teamradar.qh:14
ERASEABLE vector Rotate(vector v, float a)
Definition: vector.qh:105
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ teamradar_3dcoord_to_texcoord()

vector teamradar_3dcoord_to_texcoord ( vector  in)

Definition at line 8 of file teamradar.qc.

References vector().

Referenced by draw_teamradar_icon(), draw_teamradar_link(), draw_teamradar_player(), and HUD_Radar().

9 {
10  vector out;
11  out.x = (in.x - mi_picmin.x) / (mi_picmax.x - mi_picmin.x);
12  out.y = (in.y - mi_picmin.y) / (mi_picmax.y - mi_picmin.y);
13  out.z = 0;
14  return out;
15 }
vector(float skel, float bonenum) _skel_get_boneabs_hidden
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ teamradar_loadcvars()

void teamradar_loadcvars ( )

Definition at line 173 of file teamradar.qc.

References autocvar__hud_configure, autocvar_hud_panel_radar_foreground_alpha, autocvar_hud_panel_radar_maximized_rotation, autocvar_hud_panel_radar_maximized_scale, autocvar_hud_panel_radar_maximized_zoommode, autocvar_hud_panel_radar_rotation, autocvar_hud_panel_radar_scale, autocvar_hud_panel_radar_zoommode, autocvar_v_flipped, hud_panel_radar_foreground_alpha, hud_panel_radar_maximized, hud_panel_radar_maximized_rotation, hud_panel_radar_maximized_zoommode, hud_panel_radar_rotation, hud_panel_radar_scale, hud_panel_radar_size, hud_panel_radar_zoommode, panel_fg_alpha, and v_flipped.

Referenced by HUD_Radar().

174 {
178  {
181  }
187 
188  // others default to 0
189  // match this to default hud cfg file!
194 }
bool hud_panel_radar_maximized
Definition: hud.qh:69
float panel_fg_alpha
Definition: hud.qh:166
int hud_panel_radar_zoommode
Definition: teamradar.qh:24
float v_flipped
Definition: teamradar.qh:18
bool autocvar__hud_configure
Definition: hud_config.qh:3
float autocvar_hud_panel_radar_rotation
Definition: radar.qh:9
float hud_panel_radar_foreground_alpha
Definition: teamradar.qh:21
float autocvar_hud_panel_radar_maximized_scale
Definition: radar.qh:7
int hud_panel_radar_rotation
Definition: teamradar.qh:22
float autocvar_hud_panel_radar_foreground_alpha
Definition: radar.qh:6
int autocvar_hud_panel_radar_maximized_zoommode
Definition: radar.qh:13
float autocvar_hud_panel_radar_scale
Definition: radar.qh:10
int autocvar_hud_panel_radar_zoommode
Definition: radar.qh:11
bool autocvar_v_flipped
Definition: view.qh:70
vector hud_panel_radar_size
Definition: teamradar.qh:23
int hud_panel_radar_maximized_zoommode
Definition: teamradar.qh:25
float hud_panel_radar_scale
Definition: teamradar.qh:20
float autocvar_hud_panel_radar_maximized_rotation
Definition: radar.qh:12
int hud_panel_radar_maximized_rotation
Definition: teamradar.qh:26
+ Here is the caller graph for this function:

◆ teamradar_texcoord_to_2dcoord()

vector teamradar_texcoord_to_2dcoord ( vector  in)

Definition at line 17 of file teamradar.qc.

References DEG2RAD, Rotate(), teamradar_angle, teamradar_origin2d, teamradar_origin3d_in_texcoord, teamradar_size, v_flipped, and vector().

Referenced by draw_teamradar_background(), draw_teamradar_icon(), draw_teamradar_link(), and draw_teamradar_player().

18 {
19  vector out;
21 
22  out = Rotate(in, teamradar_angle * DEG2RAD);
23  out.y = - out.y; // screen space is reversed
24 
25  out = out * teamradar_size;
26  if(v_flipped)
27  out.x = -out.x;
28  out += teamradar_origin2d;
29  return out;
30 }
float DEG2RAD
Definition: csprogsdefs.qc:961
float v_flipped
Definition: teamradar.qh:18
float teamradar_angle
Definition: teamradar.qh:12
vector(float skel, float bonenum) _skel_get_boneabs_hidden
float teamradar_size
Definition: teamradar.qh:17
vector teamradar_origin3d_in_texcoord
Definition: teamradar.qh:13
vector teamradar_origin2d
Definition: teamradar.qh:14
ERASEABLE vector Rotate(vector v, float a)
Definition: vector.qh:105
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ teamradar_texcoord_to_3dcoord()

vector teamradar_texcoord_to_3dcoord ( vector  in,
float  oz 
)

Definition at line 51 of file teamradar.qc.

References vector().

Referenced by HUD_Radar_Mouse().

52 {
53  vector out;
54  out_x = in_x * (mi_picmax_x - mi_picmin_x) + mi_picmin_x;
55  out_y = in_y * (mi_picmax_y - mi_picmin_y) + mi_picmin_y;
56  out_z = oz;
57  return out;
58 }
vector(float skel, float bonenum) _skel_get_boneabs_hidden
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ hud_panel_radar_foreground_alpha

float hud_panel_radar_foreground_alpha

Definition at line 21 of file teamradar.qh.

Referenced by HUD_Radar(), and teamradar_loadcvars().

◆ hud_panel_radar_maximized_rotation

int hud_panel_radar_maximized_rotation

Definition at line 26 of file teamradar.qh.

Referenced by HUD_Radar(), and teamradar_loadcvars().

◆ hud_panel_radar_maximized_zoommode

int hud_panel_radar_maximized_zoommode

Definition at line 25 of file teamradar.qh.

Referenced by HUD_Radar(), and teamradar_loadcvars().

◆ hud_panel_radar_rotation

int hud_panel_radar_rotation

Definition at line 22 of file teamradar.qh.

Referenced by HUD_Radar(), and teamradar_loadcvars().

◆ hud_panel_radar_scale

float hud_panel_radar_scale

Definition at line 20 of file teamradar.qh.

Referenced by HUD_Radar(), and teamradar_loadcvars().

◆ hud_panel_radar_size

vector hud_panel_radar_size

Definition at line 23 of file teamradar.qh.

Referenced by teamradar_loadcvars().

◆ hud_panel_radar_zoommode

int hud_panel_radar_zoommode

Definition at line 24 of file teamradar.qh.

Referenced by HUD_Radar(), and teamradar_loadcvars().

◆ MAX_TEAMRADAR_TIMES

const int MAX_TEAMRADAR_TIMES = 32

Definition at line 3 of file teamradar.qh.

Referenced by draw_teamradar_icon().

◆ teamradar_angle

◆ teamradar_extraclip_maxs

vector teamradar_extraclip_maxs

Definition at line 16 of file teamradar.qh.

Referenced by HUD_Radar().

◆ teamradar_extraclip_mins

vector teamradar_extraclip_mins

Definition at line 16 of file teamradar.qh.

Referenced by HUD_Radar().

◆ teamradar_origin2d

vector teamradar_origin2d

◆ teamradar_origin3d_in_texcoord

vector teamradar_origin3d_in_texcoord

◆ teamradar_size

◆ teamradar_size2d

vector teamradar_size2d

Definition at line 15 of file teamradar.qh.

Referenced by HUD_Radar().

◆ v_flipped