Xonotic
crosshairpicker.qc File Reference
#include "crosshairpicker.qh"
+ Include dependency graph for crosshairpicker.qc:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

string crosshairpicker_cellToCrosshair (entity me, vector cell)
 
vector crosshairpicker_crosshairToCell (entity me, string crosshair_str)
 
entity makeXonoticCrosshairPicker ()
 
void XonoticCrosshairPicker_cellDraw (entity me, vector cell, vector cellPos)
 
bool XonoticCrosshairPicker_cellIsValid (entity me, vector cell)
 
void XonoticCrosshairPicker_cellSelect (entity me, vector cell)
 
void XonoticCrosshairPicker_configureXonoticCrosshairPicker (entity me)
 

Function Documentation

◆ crosshairpicker_cellToCrosshair()

string crosshairpicker_cellToCrosshair ( entity  me,
vector  cell 
)

Definition at line 3 of file crosshairpicker.qc.

References ftos().

Referenced by XonoticCrosshairPicker_cellDraw(), XonoticCrosshairPicker_cellIsValid(), and XonoticCrosshairPicker_cellSelect().

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 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ crosshairpicker_crosshairToCell()

vector crosshairpicker_crosshairToCell ( entity  me,
string  crosshair_str 
)

Definition at line 10 of file crosshairpicker.qc.

References eX, eY, floor(), mod(), and stof().

Referenced by XonoticCrosshairPicker_configureXonoticCrosshairPicker().

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 }
const vector eY
Definition: vector.qh:45
const vector eX
Definition: vector.qh:44
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ makeXonoticCrosshairPicker()

entity makeXonoticCrosshairPicker ( )

Definition at line 18 of file crosshairpicker.qc.

References entity(), and NEW.

19 {
20  entity me;
22  me.configureXonoticCrosshairPicker(me);
23  return me;
24 }
#define NEW(cname,...)
Definition: oo.qh:105
entity() spawn
+ Here is the call graph for this function:

◆ XonoticCrosshairPicker_cellDraw()

void XonoticCrosshairPicker_cellDraw ( entity  me,
vector  cell,
vector  cellPos 
)

Definition at line 45 of file crosshairpicker.qc.

References crosshairpicker_cellToCrosshair(), cvar(), draw_Picture(), draw_PictureSize(), globalToBoxSize(), strcat(), and vector().

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 }
string crosshairpicker_cellToCrosshair(entity me, vector cell)
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
+ Here is the call graph for this function:

◆ XonoticCrosshairPicker_cellIsValid()

bool XonoticCrosshairPicker_cellIsValid ( entity  me,
vector  cell 
)

Definition at line 38 of file crosshairpicker.qc.

References crosshairpicker_cellToCrosshair().

39 {
40  if(crosshairpicker_cellToCrosshair(me, cell) == "")
41  return false;
42  return true;
43 }
string crosshairpicker_cellToCrosshair(entity me, vector cell)
+ Here is the call graph for this function:

◆ XonoticCrosshairPicker_cellSelect()

void XonoticCrosshairPicker_cellSelect ( entity  me,
vector  cell 
)

Definition at line 32 of file crosshairpicker.qc.

References crosshairpicker_cellToCrosshair(), cvar_set(), and SUPER.

33 {
34  cvar_set("crosshair", crosshairpicker_cellToCrosshair(me, me.focusedCell));
35  SUPER(XonoticCrosshairPicker).cellSelect(me, me.focusedCell);
36 }
string crosshairpicker_cellToCrosshair(entity me, vector cell)
#define SUPER(cname)
Definition: oo.qh:219
+ Here is the call graph for this function:

◆ XonoticCrosshairPicker_configureXonoticCrosshairPicker()

void XonoticCrosshairPicker_configureXonoticCrosshairPicker ( entity  me)

Definition at line 26 of file crosshairpicker.qc.

References crosshairpicker_crosshairToCell(), cvar_string(), and SUPER.

27 {
28  me.configureXonoticPicker(me);
30 }
#define SUPER(cname)
Definition: oo.qh:219
vector crosshairpicker_crosshairToCell(entity me, string crosshair_str)
+ Here is the call graph for this function: