Xonotic
crosshairpicker.qc
Go to the documentation of this file.
1 #include "crosshairpicker.qh"
2 
4 {
5  if(cell.x < 0 || cell.x >= me.columns || cell.y < 0 || cell.y >= me.rows)
6  return "";
7  return ftos(31 + cell.y * me.columns + cell.x);
8 }
9 
11 {
12  float crosshair = stof(crosshair_str) - 31;
13  if(crosshair - floor(crosshair) > 0)
14  return '-1 -1 0';
15  return mod(crosshair, me.columns) * eX + floor(crosshair / me.columns) * eY;
16 }
17 
19 {
20  entity me;
22  me.configureXonoticCrosshairPicker(me);
23  return me;
24 }
25 
27 {
28  me.configureXonoticPicker(me);
30 }
31 
33 {
34  cvar_set("crosshair", crosshairpicker_cellToCrosshair(me, me.focusedCell));
35  SUPER(XonoticCrosshairPicker).cellSelect(me, me.focusedCell);
36 }
37 
39 {
40  if(crosshairpicker_cellToCrosshair(me, cell) == "")
41  return false;
42  return true;
43 }
44 
46 {
47  string s = strcat("/gfx/crosshair", crosshairpicker_cellToCrosshair(me, cell));
48  vector sz = draw_PictureSize(s);
49  sz = globalToBoxSize(sz, me.size);
50 
51  float ar = sz.x / sz.y;
52  sz.x = me.realCellSize.x;
53  sz.y = sz.x / ar;
54  sz *= 0.95;
55 
56  vector crosshairPos = cellPos + 0.5 * me.realCellSize;
57  draw_Picture(crosshairPos - 0.5 * sz, s, sz, SKINCOLOR_CROSSHAIRPICKER_CROSSHAIR, SKINALPHA_CROSSHAIRPICKER_CROSSHAIR);
58 
59  if(cvar("crosshair_dot"))
60  draw_Picture(crosshairPos - 0.5 * sz * cvar("crosshair_dot_size"), "/gfx/crosshairdot", sz * cvar("crosshair_dot_size"), SKINCOLOR_CROSSHAIRPICKER_CROSSHAIR, SKINALPHA_CROSSHAIRPICKER_CROSSHAIR);
61 }
void XonoticCrosshairPicker_cellSelect(entity me, vector cell)
string crosshairpicker_cellToCrosshair(entity me, vector cell)
const vector eY
Definition: vector.qh:45
#define NEW(cname,...)
Definition: oo.qh:105
entity() spawn
#define SUPER(cname)
Definition: oo.qh:219
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"))
bool XonoticCrosshairPicker_cellIsValid(entity me, vector cell)
void XonoticCrosshairPicker_cellDraw(entity me, vector cell, vector cellPos)
vector crosshairpicker_crosshairToCell(entity me, string crosshair_str)
entity makeXonoticCrosshairPicker()
vector(float skel, float bonenum) _skel_get_boneabs_hidden
const vector eX
Definition: vector.qh:44
void XonoticCrosshairPicker_configureXonoticCrosshairPicker(entity me)